|
30 | 30 | import android.graphics.drawable.Drawable;
|
31 | 31 | import android.graphics.drawable.GradientDrawable;
|
32 | 32 | import android.graphics.drawable.NinePatchDrawable;
|
33 |
| -import android.os.SystemClock; |
34 | 33 | import android.util.TypedValue;
|
35 | 34 | import androidx.annotation.NonNull;
|
36 | 35 | import androidx.annotation.Nullable;
|
@@ -182,25 +181,13 @@ public void prepareRime(Context context) {
|
182 | 181 | boolean isOverwrite = AppVersionUtils.INSTANCE.isDifferentVersion(appPrefs);
|
183 | 182 | String defaultFile = "trime.yaml";
|
184 | 183 | Timber.d(methodName + "copy");
|
185 |
| - if (isOverwrite) { |
186 |
| - copyFileOrDir("", true); |
187 |
| - } else if (isExist) { |
188 |
| - String path = new File("", defaultFile).getPath(); |
189 |
| - copyFileOrDir(path, false); |
190 |
| - } else { |
191 |
| - copyFileOrDir("", false); |
192 |
| - } |
193 |
| - Timber.d(methodName + "copy2"); |
194 |
| - while (!new File(sharedDataDir, defaultFile).exists()) { |
195 |
| - SystemClock.sleep(100); |
196 |
| - copyFileOrDir("", isOverwrite); |
197 |
| - } |
| 184 | + copyFileOrDir("", isOverwrite); |
198 | 185 | // 缺失导致获取方案列表为空
|
199 | 186 | Timber.d(methodName + "copy default.custom.yaml");
|
200 | 187 | final String defaultCustom = "default.custom.yaml";
|
201 |
| - if (!new File(sharedDataDir, defaultCustom).exists()) { |
| 188 | + if (!new File(userDataDir, defaultCustom).exists()) { |
202 | 189 | try {
|
203 |
| - new File(sharedDataDir, defaultCustom).createNewFile(); |
| 190 | + new File(userDataDir, defaultCustom).createNewFile(); |
204 | 191 | } catch (IOException e) {
|
205 | 192 | e.printStackTrace();
|
206 | 193 | }
|
|
0 commit comments