Skip to content

Commit

Permalink
Update ThemeEngine.java
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirosakiMio committed Jun 17, 2024
1 parent 7d554c1 commit e5d4b03
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ private void applyBackground(Context context, View view, String ltPath, String d
} catch (IOException e) {
e.printStackTrace();
}
Bitmap ltBitmap = !new File(FCLPath.LT_BACKGROUND_PATH).exists() ? ConvertUtils.getBitmapFromRes(context, R.drawable.background_light) : BitmapFactory.decodeFile(FCLPath.LT_BACKGROUND_PATH);
Bitmap dkBitmap = !new File(FCLPath.DK_BACKGROUND_PATH).exists() ? ConvertUtils.getBitmapFromRes(context, R.drawable.background_dark) : BitmapFactory.decodeFile(FCLPath.DK_BACKGROUND_PATH);
Bitmap ltBitmap;
Bitmap dkBitmap;
try {
ltBitmap = !new File(FCLPath.LT_BACKGROUND_PATH).exists() ? ConvertUtils.getBitmapFromRes(context, R.drawable.background_light) : BitmapFactory.decodeFile(FCLPath.LT_BACKGROUND_PATH);
dkBitmap = !new File(FCLPath.DK_BACKGROUND_PATH).exists() ? ConvertUtils.getBitmapFromRes(context, R.drawable.background_dark) : BitmapFactory.decodeFile(FCLPath.DK_BACKGROUND_PATH);
} catch (RuntimeException e) {
new File(FCLPath.LT_BACKGROUND_PATH).delete();
new File(FCLPath.DK_BACKGROUND_PATH).delete();
ltBitmap = ConvertUtils.getBitmapFromRes(context, R.drawable.background_light);
dkBitmap = ConvertUtils.getBitmapFromRes(context, R.drawable.background_dark);
}
BitmapDrawable lt = new BitmapDrawable(ltBitmap);
BitmapDrawable dk = new BitmapDrawable(dkBitmap);
theme.setBackgroundLt(lt);
Expand Down

0 comments on commit e5d4b03

Please sign in to comment.