clean up calcAutoTheme

don't reuse variables, declare in scope
This commit is contained in:
Harry Bond 2025-03-06 18:20:09 +00:00
parent 4da1ac38c4
commit 0f5f90322a

View file

@ -150,15 +150,17 @@ public enum ThemeSwitcher
String defaultTheme = mContext.getResources().getString(R.string.theme_default);
String nightTheme = mContext.getResources().getString(R.string.theme_night);
Location last = LocationHelper.from(mContext).getSavedLocation();
long currentTime = System.currentTimeMillis() / 1000;
boolean day;
if (last != null)
{
long currentTime = System.currentTimeMillis() / 1000;
day = Framework.nativeIsDayTime(currentTime, last.getLatitude(), last.getLongitude());
}
else
{
currentTime = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
day = (currentTime < 18 && currentTime > 6);
int currentHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
day = (currentHour < 18 && currentHour > 6);
}
return (day ? defaultTheme : nightTheme);