Skip to content

Commit 8c016a8

Browse files
authored
Merge pull request #58 from snabble/feature/ui-toolkit
New UI toolkit
2 parents 52948b3 + 88011ec commit 8c016a8

File tree

101 files changed

+4425
-836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4425
-836
lines changed

.phrase.yml

Lines changed: 110 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,119 @@
1+
# Configuration for Android projects: https://help.phrase.com/help/examples
12
phrase:
23
project_id: 3e43b3f90cf19e83c7d85652df5766ca
3-
file_format: strings
4+
file_format: xml
45
pull:
56
targets:
7+
# ui module
68
- file: ./ui/src/main/res/values/strings.xml
7-
params:
8-
locale_id: b220db5757be359631c55ec54fb65ac6
9-
encoding: "UTF-8"
10-
file_format: xml
11-
include_empty_translations: false
9+
params: &defaults
10+
locale_id: b220db5757be359631c55ec54fb65ac6 # en-US
11+
fallback_locale_id: b220db5757be359631c55ec54fb65ac6 # en-US
12+
tags: SDK,Coupons
13+
include_empty_translations: true
1214
format_options:
1315
convert_placeholder: true
1416
escape_linebreaks: true
15-
- file: ./ui/src/main/res/values-<locale_name>/strings.xml
17+
- file: ./ui/src/main/res/values-de/strings.xml
1618
params:
17-
encoding: "UTF-8"
18-
file_format: xml
19-
include_empty_translations: false
20-
format_options:
21-
convert_placeholder: true
22-
escape_linebreaks: true
19+
<<: *defaults
20+
locale_id: 512f99f8cd03c80affd16303fb5de9c2 # de
21+
- file: ./ui/src/main/res/values-fr/strings.xml
22+
params:
23+
<<: *defaults
24+
locale_id: edf0b29dd998221329199f185d360ae4 # fr
25+
- file: ./ui/src/main/res/values-fr-rCH/strings.xml
26+
params:
27+
<<: *defaults
28+
locale_id: fae2e092d1704da2ed88f3f56eb6f219 # fr-CH
29+
- file: ./ui/src/main/res/values-hu/strings.xml
30+
params:
31+
<<: *defaults
32+
locale_id: 8f797bd77008e27f6286531a5ad55f67 # hu
33+
- file: ./ui/src/main/res/values-it/strings.xml
34+
params:
35+
<<: *defaults
36+
locale_id: a4dea5c3e2c77e7c6ea344e69db63ed9 # it
37+
- file: ./ui/src/main/res/values-sk/strings.xml
38+
params:
39+
<<: *defaults
40+
locale_id: 9ee4c528e480d56878c98ee8bfbc521b # sk
41+
42+
# ui-toolkit module
43+
- file: ./ui-toolkit/src/debug/res/values/strings.xml
44+
params:
45+
<<: *defaults
46+
locale_id: b220db5757be359631c55ec54fb65ac6 # en-US
47+
tags: Sample
48+
- file: ./ui-toolkit/src/main/res/values/strings.xml
49+
params:
50+
<<: *defaults
51+
locale_id: b220db5757be359631c55ec54fb65ac6 # en-US
52+
tags: Onboarding
53+
- file: ./ui-toolkit/src/main/res/values-de/strings.xml
54+
params:
55+
<<: *defaults
56+
locale_id: 512f99f8cd03c80affd16303fb5de9c2 # de
57+
tags: Onboarding
58+
- file: ./ui-toolkit/src/main/res/values-fr/strings.xml
59+
params:
60+
<<: *defaults
61+
locale_id: edf0b29dd998221329199f185d360ae4 # fr
62+
tags: Onboarding
63+
- file: ./ui-toolkit/src/main/res/values-fr-rCH/strings.xml
64+
params:
65+
<<: *defaults
66+
locale_id: fae2e092d1704da2ed88f3f56eb6f219 # fr-CH
67+
tags: Onboarding
68+
- file: ./ui-toolkit/src/main/res/values-hu/strings.xml
69+
params:
70+
<<: *defaults
71+
locale_id: 8f797bd77008e27f6286531a5ad55f67 # hu
72+
tags: Onboarding
73+
- file: ./ui-toolkit/src/main/res/values-it/strings.xml
74+
params:
75+
<<: *defaults
76+
locale_id: a4dea5c3e2c77e7c6ea344e69db63ed9 # it
77+
tags: Onboarding
78+
- file: ./ui-toolkit/src/main/res/values-sk/strings.xml
79+
params:
80+
<<: *defaults
81+
locale_id: 9ee4c528e480d56878c98ee8bfbc521b # sk
82+
tags: Onboarding
83+
84+
# kotlin-sample module
85+
- file: ./kotlin-sample/src/main/res/values/strings.xml
86+
params:
87+
<<: *defaults
88+
locale_id: b220db5757be359631c55ec54fb65ac6 # en-US
89+
tags: Sample
90+
- file: ./kotlin-sample/src/main/res/values-de/strings.xml
91+
params:
92+
<<: *defaults
93+
locale_id: 512f99f8cd03c80affd16303fb5de9c2 # de
94+
tags: Sample
95+
- file: ./kotlin-sample/src/main/res/values-fr/strings.xml
96+
params:
97+
<<: *defaults
98+
locale_id: edf0b29dd998221329199f185d360ae4 # fr
99+
tags: Sample
100+
- file: ./kotlin-sample/src/main/res/values-fr-rCH/strings.xml
101+
params:
102+
<<: *defaults
103+
locale_id: fae2e092d1704da2ed88f3f56eb6f219 # fr-CH
104+
tags: Sample
105+
- file: ./kotlin-sample/src/main/res/values-hu/strings.xml
106+
params:
107+
<<: *defaults
108+
locale_id: 8f797bd77008e27f6286531a5ad55f67 # hu
109+
tags: Sample
110+
- file: ./kotlin-sample/src/main/res/values-it/strings.xml
111+
params:
112+
<<: *defaults
113+
locale_id: a4dea5c3e2c77e7c6ea344e69db63ed9 # it
114+
tags: Sample
115+
- file: ./kotlin-sample/src/main/res/values-sk/strings.xml
116+
params:
117+
<<: *defaults
118+
locale_id: 9ee4c528e480d56878c98ee8bfbc521b # sk
119+
tags: Sample

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.69.0]
5+
6+
### Changed
7+
- Added ui-toolkit for more realistic sample app with onboarding
8+
- Moved accessibility toolbox to an own dependency
9+
10+
### Breaking Changes
11+
- Renamed some colors which should be only used internal only
12+
413
## [0.68.6]
514

6-
# Changed
15+
### Changed
716
- Apply new Phrase key structure
817

918
## [0.68.5]

accessibility-toolbox/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

accessibility-toolbox/build.gradle

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply from: '../scripts/maven.gradle'
4+
apply plugin: 'org.jetbrains.dokka'
5+
apply plugin: "org.jetbrains.kotlin.plugin.parcelize"
6+
7+
description = "Accessibility-Toolbox: Make it easy to make your app accessibile"
8+
9+
android {
10+
compileSdkVersion project.compileSdkVersion
11+
12+
defaultConfig {
13+
minSdkVersion project.minSdkVersion
14+
targetSdkVersion project.targetSdkVersion
15+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
16+
}
17+
18+
buildTypes {
19+
release {
20+
postprocessing {
21+
removeUnusedCode false
22+
removeUnusedResources false
23+
obfuscate false
24+
optimizeCode false
25+
proguardFile 'proguard-rules.pro'
26+
}
27+
}
28+
}
29+
30+
compileOptions {
31+
coreLibraryDesugaringEnabled true
32+
sourceCompatibility JavaVersion.VERSION_1_8
33+
targetCompatibility JavaVersion.VERSION_1_8
34+
}
35+
36+
sourceSets {
37+
getByName("main").java.srcDirs("src/main/kotlin")
38+
getByName("test").java.srcDirs("src/test/kotlin")
39+
getByName("androidTest").java.srcDirs("src/androidTest/kotlin")
40+
}
41+
42+
kotlinOptions {
43+
freeCompilerArgs = ['-Xjvm-default=all']
44+
jvmTarget = '1.8'
45+
}
46+
47+
lint {
48+
disable 'LabelFor', 'MissingTranslation'
49+
}
50+
}
51+
52+
dependencies {
53+
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:${project.desugarVersion}"
54+
55+
implementation project(':utils')
56+
57+
implementation 'androidx.core:core-ktx:1.8.0'
58+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest package="io.snabble.accessibility" />

ui/src/main/java/io/snabble/sdk/ui/AccessibilityToolBox.kt renamed to accessibility-toolbox/src/main/kotlin/io/snabble/accessibility/AccessibilityToolBox.kt

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.snabble.sdk.ui
1+
package io.snabble.accessibility
22

33
import android.accessibilityservice.AccessibilityServiceInfo
44
import android.annotation.SuppressLint
@@ -15,7 +15,6 @@ import androidx.core.view.AccessibilityDelegateCompat
1515
import androidx.core.view.ViewCompat
1616
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
1717
import androidx.core.view.isVisible
18-
import io.snabble.sdk.Snabble
1918

2019
typealias AccessibilityEventListener = (host: ViewGroup?,
2120
child: View?,
@@ -47,18 +46,16 @@ class AccessibilityToolBox(private val target: View): AccessibilityDelegateCompa
4746
}
4847

4948
override fun onRequestSendAccessibilityEvent(
50-
host: ViewGroup?,
51-
child: View?,
52-
event: AccessibilityEvent?
49+
host: ViewGroup,
50+
child: View,
51+
event: AccessibilityEvent
5352
): Boolean {
54-
val listener = event?.let { eventListeners[event.eventType] }
55-
listener?.invoke(host, child, event)
53+
eventListeners[event.eventType]?.invoke(host, child, event)
5654
return super.onRequestSendAccessibilityEvent(host, child, event)
5755
}
5856

59-
override fun onPopulateAccessibilityEvent(host: View, event: AccessibilityEvent?) {
60-
val listener = event?.let { populateListeners[event.eventType] }
61-
listener?.invoke(host.parent as? ViewGroup, host, event)
57+
override fun onPopulateAccessibilityEvent(host: View, event: AccessibilityEvent) {
58+
populateListeners[event.eventType]?.invoke(host.parent as? ViewGroup, host, event)
6259
super.onPopulateAccessibilityEvent(host, event)
6360
}
6461

@@ -234,17 +231,4 @@ fun <T> Iterable<T>.forEachWindow(iterator: (last: T?, current: T, next: T?) ->
234231
}
235232
}
236233
}
237-
}
238-
239-
object AccessibilityPreferences {
240-
private const val KEY_SUPPRESS_SCANNER_HINT = "suppress_scanner_hint"
241-
private val sharedPreferences = Snabble.application.getSharedPreferences("accessibility", Context.MODE_PRIVATE)
242-
var suppressScannerHint: Boolean
243-
get() = sharedPreferences.getBoolean(KEY_SUPPRESS_SCANNER_HINT, false)
244-
set(seen) {
245-
sharedPreferences
246-
.edit()
247-
.putBoolean(KEY_SUPPRESS_SCANNER_HINT, seen)
248-
.apply()
249-
}
250234
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<item type="id" name="snabble_accessibility_toolbox" />
4+
</resources>

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ buildscript {
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1515
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$kotlin_version"
1616
classpath "org.jetbrains.dokka:dokka-base:$kotlin_version"
17-
classpath 'com.android.tools.build:gradle:7.2.1'
17+
classpath 'com.android.tools.build:gradle:7.2.2'
1818
classpath 'gradle.plugin.com.github.jlouns:gradle-cross-platform-exec-plugin:0.5.0'
1919
classpath 'gradle.plugin.gmazzo:sqlite-plugin:0.2'
20+
classpath 'com.github.bjoernq:unmockplugin:0.7.9'
2021
}
2122
}
2223

@@ -40,7 +41,7 @@ allprojects {
4041
minSdkVersion=21
4142
targetSdkVersion=31
4243

43-
okhttpVersion='4.9.3'
44+
okhttpVersion='4.10.0'
4445
desugarVersion='1.1.5'
4546

4647
sdkVersion += project.getProperties().get('versionSuffix', '')

core/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ dependencies {
6161
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
6262
implementation 'androidx.appcompat:appcompat:1.4.2'
6363
implementation 'androidx.biometric:biometric:1.2.0-alpha04'
64-
implementation 'androidx.lifecycle:lifecycle-process:2.4.1'
65-
implementation 'androidx.lifecycle:lifecycle-common:2.4.1'
64+
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
65+
implementation 'androidx.lifecycle:lifecycle-common:2.5.1'
6666

6767
api "com.squareup.okhttp3:okhttp:${project.okhttpVersion}"
6868
implementation "com.squareup.okhttp3:logging-interceptor:${project.okhttpVersion}"
6969
implementation 'eu.rekisoft.android.util:LazyWorker:2.1.0'
7070

71-
api 'com.google.code.gson:gson:2.9.0'
71+
api 'com.google.code.gson:gson:2.9.1'
7272

7373
testImplementation 'junit:junit:4.13.2'
7474
testImplementation 'org.robolectric:robolectric:4.8.1'
7575
testImplementation "com.squareup.okhttp3:mockwebserver:${project.okhttpVersion}"
76-
testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.21'
76+
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${project.kotlin_version}"
7777
testImplementation 'androidx.arch.core:core-testing:2.1.0'
7878
}

0 commit comments

Comments
 (0)