Revert "Fix issue with ???" This reverts commit 52a2885e28309631edab2fe653c956600107394b.
.idea/gradle.xml
4 | 4 | <component name="GradleSettings"> | |
5 | 5 | <option name="linkedExternalProjectsSettings"> | |
6 | 6 | <GradleProjectSettings> | |
7 | - | <option name="testRunner" value="GRADLE" /> | |
7 | + | <option name="testRunner" value="PLATFORM" /> | |
8 | 8 | <option name="distributionType" value="DEFAULT_WRAPPED" /> | |
9 | 9 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | |
10 | 10 | <option name="modules"> | |
… | |||
14 | 14 | <option value="$PROJECT_DIR$/rubytextview" /> | |
15 | 15 | </set> | |
16 | 16 | </option> | |
17 | + | <option name="resolveModulePerSourceSet" value="false" /> | |
17 | 18 | </GradleProjectSettings> | |
18 | 19 | </option> | |
19 | 20 | </component> |
.idea/runConfigurations.xml unknown status 1
1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
2 | + | <project version="4"> | |
3 | + | <component name="RunConfigurationProducerService"> | |
4 | + | <option name="ignoredProducers"> | |
5 | + | <set> | |
6 | + | <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> | |
7 | + | <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> | |
8 | + | <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> | |
9 | + | </set> | |
10 | + | </option> | |
11 | + | </component> | |
12 | + | </project> | |
12 | < | ||
0 | 13 | < | \ No newline at end of file |
app/src/main/java/eu/lepiller/nani/result/Result.java
1 | 1 | package eu.lepiller.nani.result; | |
2 | 2 | ||
3 | - | import android.os.Build; | |
4 | 3 | import android.util.Log; | |
5 | 4 | ||
6 | 5 | import com.moji4j.MojiConverter; | |
… | |||
10 | 9 | import java.util.regex.Matcher; | |
11 | 10 | import java.util.regex.Pattern; | |
12 | 11 | ||
13 | - | import static java.lang.Character.UnicodeBlock.*; | |
12 | + | import static java.lang.Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS; | |
13 | + | import static java.lang.Character.UnicodeBlock.KATAKANA; | |
14 | 14 | ||
15 | 15 | public class Result { | |
16 | 16 | public static class Source { | |
… | |||
133 | 133 | return null; | |
134 | 134 | } | |
135 | 135 | ||
136 | - | private static boolean isKanji(char c) { | |
137 | - | Character.UnicodeBlock b = of(c); | |
138 | - | return b == CJK_UNIFIED_IDEOGRAPHS || | |
139 | - | b == CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || | |
140 | - | b == CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B || | |
141 | - | (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && b == CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C) || | |
142 | - | (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && b == CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D) || | |
143 | - | b == CJK_SYMBOLS_AND_PUNCTUATION; | |
144 | - | } | |
145 | - | ||
146 | 136 | public String getKanjiFurigana() { | |
147 | 137 | String txt = getKanji(); | |
148 | 138 | String reading = getReading(); | |
… | |||
152 | 142 | ArrayList<String> portions = new ArrayList<>(); | |
153 | 143 | ||
154 | 144 | StringBuilder current = new StringBuilder(); | |
155 | - | boolean currentBlockIsKanji = true; | |
145 | + | Character.UnicodeBlock b = CJK_UNIFIED_IDEOGRAPHS; | |
156 | 146 | ||
157 | 147 | MojiConverter converter = new MojiConverter(); | |
158 | 148 | for(int i=0; i<txt.length(); i++) { | |
159 | - | boolean currentCharIsKanji = isKanji(txt.charAt(i)); | |
160 | - | if(currentBlockIsKanji == currentCharIsKanji) { | |
149 | + | Character.UnicodeBlock b2 = Character.UnicodeBlock.of(txt.charAt(i)); | |
150 | + | if(b == b2) { | |
161 | 151 | // if the headwork contains katakana, convert it to hiragana to match pronunciation | |
162 | 152 | // better. | |
163 | 153 | current.append(txt.charAt(i)); | |
… | |||
168 | 158 | current = new StringBuilder(); | |
169 | 159 | current.append(txt.charAt(i)); | |
170 | 160 | } | |
171 | - | currentBlockIsKanji = currentCharIsKanji; | |
161 | + | ||
162 | + | b = b2; | |
172 | 163 | } | |
173 | 164 | String str = current.toString(); | |
174 | 165 | if(!str.isEmpty()) |