Update dependencies
app/build.gradle
26 | 26 | implementation 'androidx.preference:preference:1.2.0' | |
27 | 27 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" | |
28 | 28 | implementation "androidx.viewpager2:viewpager2:1.0.0" | |
29 | - | implementation 'com.andree-surya:moji4j:1.0.0' | |
29 | + | implementation 'com.andree-surya:moji4j:1.2.0' | |
30 | 30 | implementation 'com.google.android.flexbox:flexbox:3.0.0' | |
31 | 31 | implementation 'com.google.android.material:material:1.6.1' | |
32 | 32 | implementation project(path: ':rubytextview') | |
33 | - | testImplementation 'junit:junit:4.12' | |
33 | + | testImplementation 'junit:junit:4.13.2' | |
34 | 34 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' | |
35 | 35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | |
36 | 36 | } |
app/src/main/java/eu/lepiller/nani/MainActivity.java
169 | 169 | } | |
170 | 170 | ||
171 | 171 | private SearchResult findResults() { | |
172 | + | boolean converted = false; | |
172 | 173 | ArrayList<String> tried = new ArrayList<>(); | |
173 | 174 | tried.add(text); | |
174 | 175 | ||
… | |||
185 | 186 | tried.add(converter.convertRomajiToHiragana(text)); | |
186 | 187 | searchResult = DictionaryFactory.search(converter.convertRomajiToHiragana(text)); | |
187 | 188 | searchResult.addAll(DictionaryFactory.search(converter.convertRomajiToKatakana(text))); | |
189 | + | converted = true; | |
188 | 190 | } catch (DictionaryException e) { | |
189 | 191 | return new SearchResult(e); | |
190 | 192 | } | |
… | |||
232 | 234 | kanjiResults.add(r); | |
233 | 235 | } | |
234 | 236 | ||
235 | - | return new SearchResult(searchResult, kanjiResults, text, true); | |
237 | + | return new SearchResult(searchResult, kanjiResults, text, converted); | |
236 | 238 | } | |
237 | 239 | } | |
238 | 240 | ||
… | |||
278 | 280 | Log.d(TAG, "results. Kanjis: " + r.getKanjiResults().size()); | |
279 | 281 | ||
280 | 282 | MojiDetector detector = new MojiDetector(); | |
281 | - | String text = r.getText(); | |
282 | - | if(searchResult != null && searchResult.size()>0 && !r.isConverted() && detector.hasLatin(text)) { | |
283 | + | if(searchResult != null && searchResult.size()>0 && !r.isConverted() && detector.hasRomaji(r.getText())) { | |
283 | 284 | MojiConverter converter = new MojiConverter(); | |
284 | 285 | final String moji = converter.convertRomajiToHiragana(r.getText()); | |
285 | 286 | feedback_text.setText(String.format(getString(R.string.feedback_didyoumean), moji)); |
rubytextview/build.gradle
24 | 24 | dependencies { | |
25 | 25 | implementation fileTree(dir: "libs", include: ["*.jar"]) | |
26 | 26 | implementation 'androidx.appcompat:appcompat:1.4.2' | |
27 | - | testImplementation 'junit:junit:4.12' | |
27 | + | testImplementation 'junit:junit:4.13.2' | |
28 | 28 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' | |
29 | 29 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | |
30 | 30 |