-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into develop-translations
# Conflicts: # app/src/main/res/values-de/strings.xml
- Loading branch information
Showing
29 changed files
with
760 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ version: 2.1 | |
orbs: | ||
gh: circleci/[email protected] | ||
jq: circleci/[email protected] | ||
android: circleci/[email protected] | ||
filters: &release | ||
branches: | ||
ignore: /.*/ | ||
|
@@ -10,20 +11,16 @@ filters: &release | |
jobs: | ||
build: | ||
working_directory: ~/betteruntis | ||
docker: | ||
- image: cimg/android:2023.06.1 | ||
resource_class: large | ||
executor: | ||
name: android/android-machine | ||
resource-class: large | ||
tag: 2023.10.1 | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | ||
- android/restore-gradle-cache | ||
- run: | ||
name: Download Dependencies | ||
command: ./gradlew androidDependencies | ||
- save_cache: | ||
paths: | ||
- ~/.gradle | ||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | ||
- run: | ||
name: Prepare signing config | ||
command: | | ||
|
@@ -34,14 +31,15 @@ jobs: | |
echo 'export KEY_RELEASE_PASSWORD=$(echo "$KEY_RELEASE_PASSWORD_ENCODED" | base64 --decode)' >> $BASH_ENV | ||
- run: | ||
name: Initial build | ||
command: ./gradlew --no-daemon assemble bundle | ||
command: ./gradlew --no-configuration-cache --no-daemon assemble bundle | ||
environment: | ||
GRADLE_OPTS: ' | ||
-Dorg.gradle.daemon=false | ||
-Dorg.gradle.parallel=true | ||
-Dorg.gradle.workers.max=3 | ||
-Dkotlin.incremental=false | ||
' | ||
- android/save-gradle-cache | ||
- store_artifacts: | ||
name: Upload build artifacts | ||
path: app/build/outputs | ||
|
@@ -163,6 +161,7 @@ jobs: | |
git config user.name "CircleCI" | ||
git checkout -B release | ||
git reset --hard HEAD~1 | ||
git merge $CIRCLE_TAG | ||
versionCode=$(jq '.elements[0].versionCode' ./workspace/outputs/apk/gms/release/output-metadata.json) | ||
|
@@ -171,7 +170,7 @@ jobs: | |
git add ./app/build.gradle | ||
git commit -m "[skip ci] Update F-Droid release" | ||
git tag fdroid-$CIRCLE_TAG | ||
git push --set-upstream origin release | ||
git push --force --set-upstream origin release | ||
git push origin fdroid-$CIRCLE_TAG | ||
workflows: | ||
version: 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,55 @@ | ||
package com.sapuseven.untis.helpers | ||
|
||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.AnnotatedString | ||
import androidx.compose.ui.text.SpanStyle | ||
import androidx.compose.ui.text.buildAnnotatedString | ||
import androidx.compose.ui.text.substring | ||
import androidx.compose.ui.text.withStyle | ||
|
||
object TextUtils { | ||
fun isNullOrEmpty(obj: Any?): Boolean { | ||
return obj?.toString()?.length ?: 0 == 0 | ||
} | ||
} | ||
|
||
@Composable | ||
fun annotateUrls( | ||
text: String, | ||
urlColor: Color = MaterialTheme.colorScheme.primary | ||
): AnnotatedString = buildAnnotatedString { | ||
val urlRegex = """(?:https?:\/\/|www\.)[\w-@:%_+.~#?&/=]+""".toRegex() | ||
|
||
var startIndex = 0 | ||
while (startIndex < text.length) { | ||
// find the next match | ||
val match = urlRegex.find(text, startIndex) | ||
|
||
if (match == null) { | ||
// no more matches - append remaining text and return | ||
append(text.substring(startIndex)) | ||
return@buildAnnotatedString | ||
} | ||
|
||
if (match.range.start > startIndex) { | ||
// matching url found with preceding text - append text first | ||
append(text.substring(startIndex, match.range.start)) | ||
} | ||
|
||
// append matched url | ||
appendUrl(match.value, urlColor) | ||
|
||
// set new start index to the end of the matched url | ||
startIndex = match.range.endInclusive + 1 | ||
} | ||
} | ||
|
||
private fun AnnotatedString.Builder.appendUrl(url: String, color: Color) { | ||
pushStringAnnotation("url", url) | ||
withStyle(style = SpanStyle(color = color)) { | ||
append(url) | ||
} | ||
pop() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.