Theming improvements (#502)
* Split theme definitions into day and night * Add support for Night Mode in code * Add theme chooser in preferences * Fix translations * Adjust IDs * Adjust preferences for custom themes * UI tweaks for custom theme support * Added code for custom theme support 🍅 * Fixed resource display in Kotlin 🍅 * Restored styles * Updated strings * Fixed getIdentifier() to fit into setTheme() * Removed redundant resources * Reset default theme to "Dusky" * Fixed night mode handler to maintain compatibility * Refactor functions to use helper methods * Added license block * Added preview to theme selector * Added color identifier getter helper method * Fixed reference in AccountMediaFragment * Cleanup * Fixed navbar foreground not changing color * Fix fallback theme switch(){} * Enable location-based daylight trigger * Cleanup * Modified theming strategy to reduce clutter in preferences * Updated translations for latest version * Removed "Default" theme flavor from settings * Updated Polish translations 🇵🇱 * Modified TwilightManager handling code to support Android M's UiModeManager features and moved it to its own function * Updated Polish translations 🇵🇱 * Cleanup; Fixed hardcoded string * Added missing escape in string * Removed permission request dialog. As we now use native UiModeManager APIs that don't need special permission for Android 6.0 and above, we no longer need to bother user with Android M+ specific location permission request dialog. * Increased readability of ThemeUtil class * Refactored ThemeUtils.setAppNightMode method * Cleanup
This commit is contained in:
parent
8fa1320afe
commit
11105f4aac
28 changed files with 341 additions and 142 deletions
|
|
@ -37,6 +37,8 @@ import com.keylesspalace.tusky.json.SpannedTypeAdapter;
|
|||
import com.keylesspalace.tusky.network.AuthInterceptor;
|
||||
import com.keylesspalace.tusky.network.MastodonApi;
|
||||
import com.keylesspalace.tusky.util.OkHttpUtils;
|
||||
import com.keylesspalace.tusky.util.ResourcesUtils;
|
||||
import com.keylesspalace.tusky.util.ThemeUtils;
|
||||
|
||||
import okhttp3.Dispatcher;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
|
@ -61,9 +63,15 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||
/* There isn't presently a way to globally change the theme of a whole application at
|
||||
* runtime, just individual activities. So, each activity has to set its theme before any
|
||||
* views are created. */
|
||||
if (preferences.getBoolean("lightTheme", false)) {
|
||||
setTheme(R.style.AppTheme_Light);
|
||||
}
|
||||
String[] themeFlavorPair = preferences.getString("appTheme", TuskyApplication.APP_THEME_DEFAULT).split(":");
|
||||
String appTheme = themeFlavorPair[0], themeFlavorPreference = themeFlavorPair[2];
|
||||
|
||||
setTheme(ResourcesUtils.getResourceIdentifier(this, "style", appTheme));
|
||||
|
||||
String flavor = preferences.getString("appThemeFlavor", ThemeUtils.THEME_FLAVOR_DEFAULT);
|
||||
if (flavor.equals(ThemeUtils.THEME_FLAVOR_DEFAULT))
|
||||
flavor = themeFlavorPreference;
|
||||
ThemeUtils.setAppNightMode(flavor);
|
||||
|
||||
int style;
|
||||
switch(preferences.getString("statusTextSize", "medium")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue