Implement auto switcher for light and dark theme (#388)
Remove import and add author Implement auto switcher for light and dark theme. other ui fixes Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/388 Reviewed-by: 6543 <6543@noreply.gitea.io>
This commit is contained in:
@@ -4,6 +4,7 @@ import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.FontsOverride;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,18 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
if(tinyDb.getInt("themeId") == 1) {
|
||||
setTheme(R.style.AppThemeLight);
|
||||
}
|
||||
else if(tinyDb.getInt("themeId") == 2) {
|
||||
|
||||
boolean timeSetterFlag = TimeHelper.timeBetweenHours(18, 6); // 6pm to 6am
|
||||
|
||||
if(timeSetterFlag) {
|
||||
setTheme(R.style.AppTheme);
|
||||
}
|
||||
else {
|
||||
setTheme(R.style.AppThemeLight);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
setTheme(R.style.AppTheme);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user