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:
agnostic-apollo
2021-10-26 07:04:08 +05:00
parent 549a772d45
commit 361bfb3961
47 changed files with 105 additions and 174 deletions

View File

@@ -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;
}
}
}

View File

@@ -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 {
/**