Skip to content

Commit ea406b4

Browse files
authored
Merge pull request #34 from what3words/dev
1.0.5
2 parents 9f0fdee + c6c3496 commit ea406b4

File tree

69 files changed

+1068
-26
lines changed

Some content is hidden

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

69 files changed

+1068
-26
lines changed

README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The artifact is available through [![Maven Central](https://img.shields.io/maven
1616
### Gradle
1717

1818
```
19-
implementation 'com.what3words:w3w-android-ocr-components:1.0.0'
19+
implementation 'com.what3words:w3w-android-ocr-components:1.0.5'
2020
```
2121

2222
## Documentation
@@ -46,26 +46,25 @@ There are two ways to use our MLKit OCR Component:
4646
```Kotlin
4747
class MainActivity : AppCompatActivity() {
4848
49-
private val resultLauncher =
49+
private val resultLauncher =
5050
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
5151
when {
5252
//registerForActivityResult success with result
5353
result.resultCode == Activity.RESULT_OK && result.data?.hasExtra(BaseOcrScanActivity.SUCCESS_RESULT_ID) == true -> {
54-
val suggestion = result.data!!.serializable<SuggestionWithCoordinates>(BaseOcrScanActivity.SUCCESS_RESULT_ID)
55-
if (suggestion != null) {
56-
//TODO: Use scanned three word address info
57-
}
54+
val suggestion =
55+
result.data!!.serializable<SuggestionWithCoordinates>(BaseOcrScanActivity.SUCCESS_RESULT_ID)
56+
//TODO: Handle suggestion scanned
5857
}
5958
//registerForActivityResult canceled with error
60-
result.resultCode == Activity.RESULT_CANCELED && result.data?.hasExtra(BaseOcrScanActivity.ERROR_RESULT_ID) == true -> {
61-
val error = result.data!!.getStringExtra(BaseOcrScanActivity.ERROR_RESULT_ID)
62-
if(error != null) {
63-
//TODO: Handle error.
64-
}
59+
result.resultCode == Activity.RESULT_CANCELED && result.data?.hasExtra(
60+
BaseOcrScanActivity.ERROR_RESULT_ID
61+
) == true -> {
62+
val error =
63+
result.data!!.getStringExtra(BaseOcrScanActivity.ERROR_RESULT_ID)
64+
//TODO: Handle error
6565
}
6666
//registerForActivityResult canceled by user.
6767
else -> {
68-
//TODO: Dismissed by user.
6968
}
7069
}
7170
}
@@ -82,17 +81,17 @@ class MainActivity : AppCompatActivity() {
8281
8382
//MLKitOcrScanActivity.newInstanceWithApi allows to provide all strings to be used internally for localisation and accessibility propuses. This should be used on a click actions, i.e: button click.
8483
val intent = MLKitOcrScanActivity.newInstanceWithApi(
85-
this,
86-
W3WOcrWrapper.MLKitLibraries.Latin,
87-
"YOUR_API_KEY_HERE",
88-
options,
89-
returnCoordinates,
90-
scanStateFoundTitle = "YOUR_STRING_HERE"
84+
context = this,
85+
mlKitLibrary = com.google.mlkit.vision.text.TextRecognizerOptionsInterface.LATIN,
86+
apiKey = "YOUR_API_KEY_HERE",
87+
options = options,
88+
returnCoordinates = returnCoordinates,
89+
scanStateFoundTitle = "Custom found title"
9190
)
9291
try {
9392
resultLauncher.launch(intent)
9493
} catch (e: ExceptionInInitializerError) {
95-
//TODO: Handle error.
94+
//TODO: Handle Error
9695
}
9796
}
9897
}
@@ -111,7 +110,7 @@ class MainActivity : ComponentActivity() {
111110
112111
override fun onCreate(savedInstanceState: Bundle?) {
113112
//This example uses Latin MLKit library, check MLKit documentation of how to instanciate other libraries like Korean, Japanese, Devanagari or Chinese.
114-
val textRecognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS)
113+
val textRecognizer = com.google.mlkit.vision.text.TextRecognizerOptionsInterface.LATIN
115114
116115
//Options to filter the OCR scanning or like this example providing current location for more accurate results/distances to three word addresses.
117116
val options = AutosuggestOptions().apply {
@@ -122,12 +121,13 @@ class MainActivity : ComponentActivity() {
122121
val returnCoordinates = true
123122
124123
val dataProvider = What3WordsV3("YOUR_API_KEY_HERE", this)
125-
ocrWrapper = W3WOcrMLKitWrapper(this, dataProvider, textRecognizer)
124+
ocrWrapper = W3WOcrMLKitWrapper(this, textRecognizer)
126125
127126
setContent {
128127
YourTheme {
129128
W3WOcrScanner(
130129
ocrWrapper,
130+
dataProvider = dataProvider,
131131
modifier = Modifier.fillMaxSize(),
132132
options = options,
133133
returnCoordinates = returnCoordinates,
@@ -139,7 +139,8 @@ class MainActivity : ComponentActivity() {
139139
},
140140
onSuggestionSelected = { scannedSuggestion ->
141141
//TODO: Use scanned three word address info, hide W3WOcrScanner using AnimatedVisibility or finish activity.
142-
})
142+
}
143+
)
143144
}
144145
}
145146
}
@@ -172,4 +173,4 @@ W3WOcrScanner(
172173
wordsTextStyle = W3WTheme.typography.headline
173174
)
174175
)
175-
```
176+
```

lib/maven-push.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ def ossrhUsername = findProperty('OSSRH_USERNAME')
22
def ossrhPassword = findProperty('OSSRH_PASSWORD')
33
def signingKey = findProperty('SIGNING_KEY')
44
def signingKeyPwd = findProperty('SIGNING_KEY_PWD')
5-
def libVersion = findProperty('LIBRARY_VERSION') ? findProperty('LIBRARY_VERSION') : "1.0.4"
5+
def libVersion = findProperty('LIBRARY_VERSION') ? findProperty('LIBRARY_VERSION') : "1.0.5"
66

77
afterEvaluate {
88
publishing {

lib/src/main/java/com/what3words/ocr/components/ui/OcrScanComposable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fun W3WOcrScanner(
238238
scannerStrings: W3WOcrScannerDefaults.Strings = W3WOcrScannerDefaults.defaultStrings(),
239239
suggestionTextStyles: SuggestionWhat3wordsDefaults.TextStyles = SuggestionWhat3wordsDefaults.defaultTextStyles(),
240240
suggestionColors: SuggestionWhat3wordsDefaults.Colors = SuggestionWhat3wordsDefaults.defaultColors(),
241-
suggestionNearestPlacePrefix: String? = stringResource(id = com.what3words.design.library.R.string.near),
241+
suggestionNearestPlacePrefix: String? = stringResource(id = R.string.near),
242242
onSuggestionSelected: ((SuggestionWithCoordinates) -> Unit),
243243
onError: ((What3WordsError) -> Unit)?,
244244
onDismiss: (() -> Unit)?,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">Toemaak-knoppie</string>
5+
<string name="grip_content_description">Tik en hou jou vinger op die what3words-adres lys om dit op of af te beweeg</string>
6+
<string name="near">naby</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">Net \'n oomblik...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">Klaar geskandeer</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">Besig om te laai...</string>
13+
<string name="scan_state_scanning">Skandeer \'n what3words-adres</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">Besig om te valideer...</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">ቁልፉን ይዝጉት</string>
5+
<string name="grip_content_description">የwhat3words አድራሻ ዝርዝሩን ወደላይ ወይም ወደታች ለማንቀሳቀስ ጫን አድርገው ይያዙ</string>
6+
<string name="near">አቅራቢያ</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">በማግኘት ላይ</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">ስካን የተደረገ</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">በመጫን ለይ...</string>
13+
<string name="scan_state_scanning">የ3 ቃላት አድራሻ ስካን ያድርጉ</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">በማረጋገጥ ላይ...</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">زر الإغلاق</string>
5+
<string name="grip_content_description">اضغط باستمرار لتحريك قائمة عنوان٣كلمات للأعلى أو للأسفل</string>
6+
<string name="near">قريب</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">جار الكشف...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">مُسح</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">تحميل...</string>
13+
<string name="scan_state_scanning">امسح عنوان٣كلمات</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">التحقق من الصحة...</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">Бутон за затваряне</string>
5+
<string name="grip_content_description">Докоснете и задръжте, за да преместите списъка с адреси в what3words нагоре или надолу</string>
6+
<string name="near">близо</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">Открива се...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">Сканирано</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">Зарежда се…</string>
13+
<string name="scan_state_scanning">Сканиране на адрес от 3 думи</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">Потвърждава се…</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">বন্ধ করার বাটন</string>
5+
<string name="grip_content_description">what3words ঠিকানার তালিকা উপর বা নিচে করার জন্য ট্যাপ করে রাখুন</string>
6+
<string name="near">কাছে</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">ডিটেক্ট করা যাচ্ছে...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">স্ক্যান করা হয়েছে</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">লোড হচ্ছে...</string>
13+
<string name="scan_state_scanning">৩ শব্দের ঠিকানা স্ক্যান করুন</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">ভ্যালিডেট করা যাচ্ছে...</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">Dugme za zatvaranje</string>
5+
<string name="grip_content_description">Dodirnite i držite da pomjerite adresu od 3 riječi nagore ili nadolje</string>
6+
<string name="near">u blizini</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">Prepoznavanje...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">Skenirano</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">Učitavanje...</string>
13+
<string name="scan_state_scanning">Skenirajte adresu od 3 riječi</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">Potvrđivanje...</string>
16+
</resources>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<resources>
3+
<!-- this is for accessibility 'read aloud' purposes - helping people with visual impairments to locate where the 'close' button is on the screen. so it will not be seen as text, just as spoken word for people using that feature -->
4+
<string name="cd_close_button">Botó Tanca</string>
5+
<string name="grip_content_description">Mantén premut per moure la llista d\'adreces de what3words cap amunt o cap avall</string>
6+
<string name="near">a prop</string>
7+
<!-- This text shows up when the user is scanning a what3words address and the system is processing the information before suggesting results -->
8+
<string name="scan_state_detecting">S\'està detectant...</string>
9+
<!-- it is a what3words address that is being scanned -->
10+
<string name="scan_state_found">Escanejada</string>
11+
<!-- This text shows up when the user is scanning a what3words address and the system is loading the results -->
12+
<string name="scan_state_loading">S\'està carregant...</string>
13+
<string name="scan_state_scanning">Escaneja una adreça de 3 paraules</string>
14+
<!-- This text shows up when the user is scanning a what3words address and the system is validating the information before displaying results -->
15+
<string name="scan_state_validating">S\'està validant...</string>
16+
</resources>

0 commit comments

Comments
 (0)