mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-10 04:24:05 +08:00
Changed!: Move to package-by-feature hierarchy for classes not using it since termux-shared is growing too big and layers are getting out of hand
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.termux.shared.theme;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
/** The modes used by to decide night mode for themes. */
|
||||
public enum NightMode {
|
||||
|
||||
/** Night theme should be enabled. */
|
||||
TRUE("true", AppCompatDelegate.MODE_NIGHT_YES),
|
||||
|
||||
/** Dark theme should be enabled. */
|
||||
FALSE("false", AppCompatDelegate.MODE_NIGHT_NO),
|
||||
|
||||
/**
|
||||
* Use night or dark theme depending on system night mode.
|
||||
* https://developer.android.com/guide/topics/resources/providing-resources#NightQualifier
|
||||
*/
|
||||
SYSTEM("system", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
|
||||
private final String name;
|
||||
private final int mode;
|
||||
|
||||
NightMode(final String name, int mode) {
|
||||
this.name = name;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public static Integer modeOf(String name) {
|
||||
if (TRUE.name.equals(name))
|
||||
return TRUE.mode;
|
||||
else if (FALSE.name.equals(name))
|
||||
return FALSE.mode;
|
||||
else if (SYSTEM.name.equals(name)) {
|
||||
return SYSTEM.mode;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -3,8 +3,6 @@ package com.termux.shared.theme;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import com.termux.shared.models.theme.NightMode;
|
||||
|
||||
public class ThemeUtils {
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user