mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
overhaul style of parsing layouts
and add a cache
This commit is contained in:
parent
1bd30f612b
commit
ed776c3804
12 changed files with 256 additions and 262 deletions
|
@ -36,7 +36,6 @@ import helium314.keyboard.latin.common.Colors;
|
|||
import helium314.keyboard.latin.common.LocaleUtils;
|
||||
import helium314.keyboard.latin.utils.AdditionalSubtypeUtils;
|
||||
import helium314.keyboard.latin.utils.ColorUtilKt;
|
||||
import helium314.keyboard.latin.utils.CustomLayoutUtilsKt;
|
||||
import helium314.keyboard.latin.utils.DeviceProtectedUtils;
|
||||
import helium314.keyboard.latin.utils.JniUtils;
|
||||
import helium314.keyboard.latin.utils.Log;
|
||||
|
@ -548,22 +547,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
};
|
||||
}
|
||||
|
||||
/** @return custom layout name if there is one for the given layout, else returns "layout" */
|
||||
public static String readLayoutName(final String layout, final Context context) {
|
||||
String[] layouts = getLayoutsDir(context).list();
|
||||
if (layouts != null) {
|
||||
for (String name : layouts) {
|
||||
if (name.startsWith(CustomLayoutUtilsKt.CUSTOM_LAYOUT_PREFIX + layout + "."))
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
public static File getLayoutsDir(final Context context) {
|
||||
return new File(DeviceProtectedUtils.getFilesDir(context), "layouts");
|
||||
}
|
||||
|
||||
@Nullable public static Drawable readUserBackgroundImage(final Context context, final boolean night) {
|
||||
if (night && sCachedBackgroundNight != null) return sCachedBackgroundNight;
|
||||
if (!night && sCachedBackgroundDay != null) return sCachedBackgroundDay;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue