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:
remi6397 2018-01-20 13:39:01 +01:00 committed by Konrad Pozniak
parent 8fa1320afe
commit 11105f4aac
28 changed files with 341 additions and 142 deletions

View file

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.keylesspalace.tusky">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

View file

@ -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")) {

View file

@ -26,7 +26,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.method.LinkMovementMethod;
import android.util.Log;
@ -42,6 +41,8 @@ import com.keylesspalace.tusky.network.MastodonApi;
import com.keylesspalace.tusky.util.CustomTabsHelper;
import com.keylesspalace.tusky.util.NotificationManager;
import com.keylesspalace.tusky.util.OkHttpUtils;
import com.keylesspalace.tusky.util.ResourcesUtils;
import com.keylesspalace.tusky.util.ThemeUtils;
import java.util.HashMap;
import java.util.Map;
@ -68,9 +69,16 @@ public class LoginActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("lightTheme", false)) {
setTheme(R.style.AppTheme_Light);
}
preferences = PreferenceManager.getDefaultSharedPreferences(this);
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);
setContentView(R.layout.activity_login);
@ -234,15 +242,8 @@ public class LoginActivity extends AppCompatActivity {
}
private static boolean openInCustomTab(Uri uri, Context context) {
boolean lightTheme = PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean("lightTheme", false);
int toolbarColorRes;
if (lightTheme) {
toolbarColorRes = R.color.custom_tab_toolbar_light;
} else {
toolbarColorRes = R.color.custom_tab_toolbar_dark;
}
int toolbarColor = ContextCompat.getColor(context, toolbarColorRes);
int toolbarColor = ThemeUtils.getColorById(context, "custom_tab_toolbar");
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(toolbarColor);
CustomTabsIntent customTabsIntent = builder.build();

View file

@ -27,6 +27,8 @@ import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import com.keylesspalace.tusky.fragment.PreferencesFragment;
import com.keylesspalace.tusky.util.ResourcesUtils;
import com.keylesspalace.tusky.util.ThemeUtils;
public class PreferencesActivity extends BaseActivity
implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -46,9 +48,6 @@ public class PreferencesActivity extends BaseActivity
}
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
if (preferences.getBoolean("lightTheme", false)) {
setTheme(R.style.AppTheme_Light);
}
setContentView(R.layout.activity_preferences);
@ -72,6 +71,28 @@ public class PreferencesActivity extends BaseActivity
}
showFragment(currentPreferences, currentTitle);
PreferencesFragment preferencesFragment = (PreferencesFragment)getFragmentManager().findFragmentById(R.id.fragment_container);
String[] themeFlavorPair = preferences.getString("appTheme", TuskyApplication.APP_THEME_DEFAULT).split(":");
String appTheme = themeFlavorPair[0], themeFlavorMode = themeFlavorPair[1], themeFlavorPreference = themeFlavorPair[2];
setTheme(ResourcesUtils.getResourceIdentifier(this, "style", appTheme));
if (preferencesFragment.findPreference("appThemeFlavor") != null) {
boolean lockFlavor = themeFlavorMode.equals(ThemeUtils.THEME_MODE_ONLY);
preferencesFragment.findPreference("appThemeFlavor").setEnabled(!lockFlavor);
}
String flavor = preferences.getString("appThemeFlavor", ThemeUtils.THEME_FLAVOR_DEFAULT);
if (flavor.equals(ThemeUtils.THEME_FLAVOR_DEFAULT)) {
flavor = themeFlavorPreference;
preferences.edit()
.putString("appThemeFlavor", flavor)
.apply();
}
// Set theme based on preference
setTheme(ResourcesUtils.getResourceIdentifier(this, "style", appTheme));
}
public void showFragment(@XmlRes int preferenceId, @StringRes int title) {
@ -81,6 +102,8 @@ public class PreferencesActivity extends BaseActivity
.replace(R.id.fragment_container, PreferencesFragment.newInstance(preferenceId))
.commit();
getFragmentManager().executePendingTransactions();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(title);
@ -104,7 +127,32 @@ public class PreferencesActivity extends BaseActivity
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key) {
case "lightTheme": {
case "appTheme": {
String[] themeFlavorPair = sharedPreferences.getString("appTheme", TuskyApplication.APP_THEME_DEFAULT).split(":");
String appTheme = themeFlavorPair[0];
setTheme(ResourcesUtils.getResourceIdentifier(this, "style", appTheme));
sharedPreferences.edit()
.remove("appThemeFlavor")
.apply();
}
case "appThemeFlavor": {
String[] themeFlavorPair = sharedPreferences.getString("appTheme", TuskyApplication.APP_THEME_DEFAULT).split(":");
String appTheme = themeFlavorPair[0], themeFlavorPreference = themeFlavorPair[2];
setTheme(ResourcesUtils.getResourceIdentifier(this, "style", appTheme));
String flavor = sharedPreferences.getString("appThemeFlavor", ThemeUtils.THEME_FLAVOR_DEFAULT);
if (flavor.equals(ThemeUtils.THEME_FLAVOR_DEFAULT)) {
flavor = themeFlavorPreference;
sharedPreferences.edit()
.putString("appThemeFlavor", flavor)
.apply();
}
ThemeUtils.setAppNightMode(flavor);
restartActivitiesOnExit = true;
// recreate() could be used instead, but it doesn't have an animation B).
Intent intent = getIntent();

View file

@ -16,7 +16,9 @@
package com.keylesspalace.tusky;
import android.app.Application;
import android.app.UiModeManager;
import android.arch.persistence.room.Room;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatDelegate;
@ -28,12 +30,18 @@ import com.keylesspalace.tusky.util.OkHttpUtils;
import com.squareup.picasso.Picasso;
public class TuskyApplication extends Application {
public static final String APP_THEME_DEFAULT = "AppTheme:prefer:night";
private static AppDatabase db;
public static AppDatabase getDB() {
return db;
}
private static UiModeManager uiModeManager;
public static UiModeManager getUiModeManager() { return uiModeManager; }
@Override
public void onCreate() {
super.onCreate();
@ -59,6 +67,8 @@ public class TuskyApplication extends Application {
JobManager.create(this).addJobCreator(new NotificationPullJobCreator(this));
uiModeManager = (UiModeManager)getSystemService(Context.UI_MODE_SERVICE);
//necessary for Android < APi 21
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

View file

@ -18,7 +18,6 @@ package com.keylesspalace.tusky.fragment
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.ActivityOptionsCompat
import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewCompat
@ -26,6 +25,7 @@ import android.support.v4.widget.SwipeRefreshLayout
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -37,6 +37,7 @@ import com.keylesspalace.tusky.ViewVideoActivity
import com.keylesspalace.tusky.entity.Attachment
import com.keylesspalace.tusky.entity.Status
import com.keylesspalace.tusky.network.MastodonApi
import com.keylesspalace.tusky.util.ThemeUtils
import com.keylesspalace.tusky.view.SquareImageView
import com.squareup.picasso.Picasso
import retrofit2.Call
@ -133,10 +134,8 @@ class AccountMediaFragment : BaseFragment() {
val columnCount = context?.resources?.getInteger(R.integer.profile_media_column_count) ?: 2
val layoutManager = GridLayoutManager(context, columnCount)
val lightThemeEnabled = PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean("lightTheme", false)
val bgRes = if (lightThemeEnabled) R.color.window_background_light
else R.color.window_background_dark
val bgRes = ThemeUtils.getColorId(context, R.attr.window_background)
adapter.baseItemColor = ContextCompat.getColor(recyclerView.context, bgRes)
recyclerView.layoutManager = layoutManager

View file

@ -23,7 +23,6 @@ import android.preference.PreferenceManager;
import android.provider.Browser;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
@ -34,7 +33,6 @@ import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.LinkListener;
@ -172,8 +170,8 @@ public class LinkHelper {
* @param context context
*/
public static void openLinkInCustomTab(Uri uri, Context context) {
boolean lightTheme = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("lightTheme", false);
int toolbarColor = ContextCompat.getColor(context, lightTheme ? R.color.custom_tab_toolbar_light : R.color.custom_tab_toolbar_dark);
int toolbarColor = ThemeUtils.getColorById(context, "custom_tab_toolbar");
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(toolbarColor);
CustomTabsIntent customTabsIntent = builder.build();

View file

@ -0,0 +1,29 @@
/* Copyright 2017 Andrew Dawson
*
* This file is a part of Tusky.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky; if not,
* see <http://www.gnu.org/licenses>. */
package com.keylesspalace.tusky.util;
import android.content.Context;
import android.support.annotation.AnyRes;
/**
* Created by remi on 1/14/18.
*/
public class ResourcesUtils {
public static @AnyRes int getResourceIdentifier(Context context, String defType, String name) {
return context.getResources().getIdentifier(name, defType, context.getPackageName());
}
}

View file

@ -15,22 +15,35 @@
package com.keylesspalace.tusky.util;
import android.app.UiModeManager;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatDelegate;
import android.util.TypedValue;
import android.widget.ImageView;
import com.keylesspalace.tusky.TuskyApplication;
/**
* Provides runtime compatibility to obtain theme information and re-theme views, especially where
* the ability to do so is not supported in resource files.
*/
public class ThemeUtils {
public static final String THEME_MODE_PREFER = "prefer";
public static final String THEME_MODE_ONLY = "only";
public static final String THEME_FLAVOR_NIGHT = "night";
public static final String THEME_FLAVOR_DAY = "day";
public static final String THEME_FLAVOR_AUTO = "auto";
public static final String THEME_FLAVOR_DEFAULT = "preferred";
public static Drawable getDrawable(Context context, @AttrRes int attribute,
@DrawableRes int fallbackDrawable) {
TypedValue value = new TypedValue();
@ -62,6 +75,17 @@ public class ThemeUtils {
}
}
public static @ColorRes int getColorId(Context context, @AttrRes int attribute) {
TypedValue value = new TypedValue();
context.getTheme().resolveAttribute(attribute, value, true);
return value.resourceId;
}
public static @ColorInt int getColorById(Context context, String name) {
return getColor(context,
ResourcesUtils.getResourceIdentifier(context, "attr", name));
}
public static void setImageViewTint(ImageView view, @AttrRes int attribute) {
view.setColorFilter(getColor(view.getContext(), attribute), PorterDuff.Mode.SRC_IN);
}
@ -69,4 +93,29 @@ public class ThemeUtils {
public static void setDrawableTint(Context context, Drawable drawable, @AttrRes int attribute) {
drawable.setColorFilter(getColor(context, attribute), PorterDuff.Mode.SRC_IN);
}
public static boolean setAppNightMode(String flavor) {
int mode;
switch (flavor) {
case THEME_FLAVOR_AUTO:
mode = UiModeManager.MODE_NIGHT_AUTO;
break;
case THEME_FLAVOR_NIGHT:
mode = UiModeManager.MODE_NIGHT_YES;
break;
case THEME_FLAVOR_DAY:
mode = UiModeManager.MODE_NIGHT_NO;
break;
default:
return false;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
TuskyApplication.getUiModeManager().setNightMode(mode);
} else {
AppCompatDelegate.setDefaultNightMode(mode);
}
return true;
}
}

View file

@ -151,7 +151,6 @@
<string name="pref_title_notification_filter_reblogs">تُرقّى منشوراتي</string>
<string name="pref_title_notification_filter_favourites">يعجب أحد ما بمنشوراتي</string>
<string name="pref_title_appearance_settings">المظهر</string>
<string name="pref_title_light_theme">إستخدم سمةً فاتحة اللون</string>
<string name="pref_title_browser_settings">المتصفح</string>
<string name="pref_title_custom_tabs">إخفاء زر المتابعة أثناء تمرير الصفحة</string>
<string name="pref_title_hide_follow_button">إخفاء زر التحرير عند التمرير</string>

View file

@ -166,7 +166,6 @@
<string name="pref_title_notification_filter_reblogs">retootejen les meves publicacions</string>
<string name="pref_title_notification_filter_favourites">marquen com a preferit les meves publicacions</string>
<string name="pref_title_appearance_settings">Aparença</string>
<string name="pref_title_light_theme">Usa el tema clar</string>
<string name="pref_title_browser_settings">Navegador</string>
<string name="pref_title_custom_tabs">Pestanyes personalitzades del Chrome</string>
<string name="pref_title_hide_follow_button">Amaga el botó de redacció en desplaçament</string>

View file

@ -140,7 +140,6 @@
<string name="pref_title_notification_filter_reblogs">Jemand meine Posts teilt</string>
<string name="pref_title_notification_filter_favourites">Jemandem meine Posts gefallen</string>
<string name="pref_title_appearance_settings">Aussehen</string>
<string name="pref_title_light_theme">Benutze helles Theme</string>
<string name="pref_title_browser_settings">Browser</string>
<string name="pref_title_custom_tabs">Öffne Links in der App</string>
<string name="pref_title_hide_follow_button">Verstecke Button bei Bildlauf </string>

View file

@ -152,7 +152,6 @@
<string name="pref_title_notification_filter_reblogs">mes pouets sont boostés.</string>
<string name="pref_title_notification_filter_favourites">mes pouets sont mis en favoris.</string>
<string name="pref_title_appearance_settings">Apparence</string>
<string name="pref_title_light_theme">Utiliser le thème clair.</string>
<string name="pref_title_browser_settings">Navigateur</string>
<string name="pref_title_custom_tabs">Utiliser le navigateur intégré.</string>
<string name="pref_title_hide_follow_button">Masquer le bouton de suivi lors du défilement.</string>

View file

@ -163,7 +163,6 @@
<string name="pref_title_notification_filter_reblogs">posztjaimat rebloggolták</string>
<string name="pref_title_notification_filter_favourites">posztjaimat kedvencé teszik</string>
<string name="pref_title_appearance_settings">Kinézet</string>
<string name="pref_title_light_theme">Használja a világos témát</string>
<string name="pref_title_browser_settings">Böngésző</string>
<string name="pref_title_custom_tabs">Linkek megnyitása applikáción belül</string>
<string name="pref_title_hide_follow_button">Szerkesztési gomb elérejtése görgetés közben</string>

View file

@ -164,7 +164,6 @@
<string name="pref_title_notification_filter_reblogs">投稿がブーストされた</string>
<string name="pref_title_notification_filter_favourites">投稿がお気に入りに登録された</string>
<string name="pref_title_appearance_settings">表示</string>
<string name="pref_title_light_theme">明るいテーマを使用</string>
<string name="pref_title_browser_settings">ブラウザ</string>
<string name="pref_title_custom_tabs">Chrome Custom Tabsを使用する</string>
<string name="pref_title_hide_follow_button">スクロール中はフォローボタンを隠す</string>

View file

@ -0,0 +1,10 @@
<resources>
<!--Dark Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase">
<item name="android:windowLightNavigationBar">false</item>
<item name="android:navigationBarColor">@color/window_background_dark</item>
<item name="android:navigationBarDividerColor">@color/status_divider_dark</item>
</style>
</resources>

View file

@ -0,0 +1,90 @@
<resources>
<!--Dark Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"/>
<style name="AppThemeBase" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/color_primary_dark</item>
<item name="colorPrimaryDark">@color/color_primary_dark_dark</item>
<item name="colorAccent">@color/color_accent_dark</item>
<item name="colorButtonNormal">@color/button_dark</item>
<item name="android:colorBackground">@color/color_primary_dark_dark</item>
<item name="android:windowBackground">@color/window_background_dark</item>
<item name="android:editTextColor">@color/edit_text_color_dark</item>
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
<item name="android:textColorTertiary">@color/text_color_tertiary_dark</item>
<item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse_dark</item>
<item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse_dark</item>
<item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse_dark</item>
<item name="android:actionMenuTextColor">@color/text_color_primary_dark</item>
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>
<item name="window_background">@color/window_background_dark</item>
<item name="custom_tab_toolbar">@color/custom_tab_toolbar_dark</item>
<item name="toolbar_background_color">@color/toolbar_background_dark</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_dark</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Dark</item>
<item name="status_reblog_small_drawable">@drawable/ic_reblog_dark_18dp</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_dark</item>
<item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_dark</item>
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_dark</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_dark</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item>
<item name="content_warning_button">@drawable/toggle_small</item>
<item name="sensitive_media_warning_background_color">@color/color_background_dark</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item>
<item name="status_divider_drawable">@drawable/status_divider_dark</item>
<item name="conversation_thread_line_drawable">@drawable/conversation_thread_line_dark</item>
<item name="tab_icon_selected_tint">@color/color_accent_dark</item>
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_dark</item>
<item name="account_header_background_color">@color/account_header_background_dark</item>
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item>
<item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_dark</item>
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
<item name="compose_close_button_tint">@color/toolbar_icon_dark</item>
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
<item name="compose_mention_color">@color/color_accent_dark</item>
<item name="compose_content_warning_bar_background">@drawable/border_background_dark</item>
<item name="compose_hide_media_button_color">@color/image_button_dark</item>
<item name="compose_hide_media_button_selected_color">@color/color_accent_dark</item>
<item name="compose_image_button_tint">@color/image_button_dark</item>
<item name="compose_reply_content_background">@color/compose_reply_content_background_dark</item>
<item name="report_status_background_color">@color/color_background_dark</item>
<item name="report_status_divider_drawable">@drawable/status_divider_dark</item>
<item name="material_drawer_background">@color/window_background_dark</item>
<item name="material_drawer_primary_text">@color/text_color_primary_dark</item>
<item name="material_drawer_primary_icon">@color/toolbar_icon_dark</item>
<item name="material_drawer_secondary_text">@color/text_color_secondary_dark</item>
<item name="material_drawer_hint_text">@color/text_color_tertiary_dark</item>
<item name="material_drawer_divider">@color/color_primary_dark_dark</item>
<item name="material_drawer_selected">@color/color_primary_dark</item>
<item name="material_drawer_selected_text">@color/text_color_primary_dark</item>
<item name="material_drawer_header_selection_text">@color/text_color_primary_dark</item>
<item name="card_background">@drawable/card_frame_dark</item>
<item name="card_image_background">@color/text_color_tertiary_dark</item>
<item name="play_indicator_drawable">@drawable/ic_play_indicator_dark</item>
</style>
<style name="AppTheme.ImageButton.Dark" parent="@style/Widget.AppCompat.Button.Borderless.Colored">
<item name="android:tint">@color/image_button_dark</item>
</style>
<style name="AppTheme.BottomSheetDialog.Dark" parent="@style/Theme.Design.BottomSheetDialog">
<item name="colorAccent">@color/color_accent_dark</item>
<item name="android:colorBackground">@color/color_background_dark</item>
</style>
<style name="AppTheme.Account.ToolbarPopupTheme.Dark" parent="ThemeOverlay.AppCompat">
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
</resources>

View file

@ -140,7 +140,6 @@
<string name="pref_title_notification_filter_reblogs">mijn toots werden geboost</string>
<string name="pref_title_notification_filter_favourites">mijn toots favoriet zijn</string>
<string name="pref_title_appearance_settings">Uiterlijk</string>
<string name="pref_title_light_theme">Licht thema gebruiken</string>
<string name="pref_title_browser_settings">Webbrowser</string>
<string name="pref_title_custom_tabs">Gebruik Chrome aangepaste tabbladen</string>
<string name="pref_title_hide_follow_button">Verberg volgknop tijdens scrollen</string>

View file

@ -157,7 +157,15 @@
<string name="pref_title_notification_filter_reblogs">moje posty zostaną podbite</string>
<string name="pref_title_notification_filter_favourites">moje posty zostaną dodane do ulubionych</string>
<string name="pref_title_appearance_settings">Wygląd</string>
<string name="pref_title_light_theme">Użyj jasnego motywu</string>
<string name="pref_title_app_theme">Motyw</string>
<string name="pref_title_app_theme_flavor">Odmiana motywu</string>
<string-array name="app_theme_flavor_names">
<item>Pora dnia</item>
<item>Noc</item>
<item>Dzień</item>
</string-array>
<string name="pref_title_browser_settings">Przeglądarka</string>
<string name="pref_title_custom_tabs">Używaj niestandardowych kart Chrome</string>
<string name="pref_title_hide_follow_button">Ukryj przycisk obserwacji podczas przewijania</string>

View file

@ -166,7 +166,6 @@
<string name="pref_title_notification_filter_reblogs">minhas postagens forem compartilhadas</string>
<string name="pref_title_notification_filter_favourites">minhas postagens forem favoritadas</string>
<string name="pref_title_appearance_settings">Aparência</string>
<string name="pref_title_light_theme">Usar tema diurno</string>
<string name="pref_title_browser_settings">Navegador</string>
<string name="pref_title_custom_tabs">Usar abas customizadas do Chrome</string>
<string name="pref_title_hide_follow_button">Esconder botão de composição enquanto rolar página</string>

View file

@ -160,7 +160,6 @@
<string name="pref_title_notification_filter_reblogs">мой пост продвинули</string>
<string name="pref_title_notification_filter_favourites">мой пост понравился</string>
<string name="pref_title_appearance_settings">Внешний вид</string>
<string name="pref_title_light_theme">Использовать светлую тему</string>
<string name="pref_title_browser_settings">Браузер</string>
<string name="pref_title_custom_tabs">Использовать Chrome Custom Tabs</string>
<string name="pref_title_hide_follow_button">Скрывать кнопку подписки при покрутке</string>

View file

@ -146,7 +146,6 @@
<string name="pref_title_notification_filter_reblogs">iletilerim yüksetilince</string>
<string name="pref_title_notification_filter_favourites">iletilerim favori edilince</string>
<string name="pref_title_appearance_settings">Görünüş</string>
<string name="pref_title_light_theme">ık renkli temayı kullan</string>
<string name="pref_title_browser_settings">Tarayacı</string>
<string name="pref_title_custom_tabs">Chrome Özel Şekmelerini Kullan</string>
<string name="pref_title_hide_follow_button">Kaydırırken takip düğmesi gizlensin</string>

View file

@ -1,14 +1,13 @@
<resources>
<!--Dark Application Theme Styles-->
<!--Light Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase">
<item name="android:windowLightNavigationBar">false</item>
<item name="android:navigationBarColor">@color/window_background_dark</item>
<item name="android:navigationBarDividerColor">@color/status_divider_dark</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/color_background_light</item>
<item name="android:navigationBarDividerColor">@color/status_divider_light</item>
</style>
<!--Light Application Theme Styles-->
<style name="AppTheme.Light" parent="AppThemeBase.Light">
<style name="Remin" parent="ReminBase">
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/color_background_light</item>
<item name="android:navigationBarDividerColor">@color/status_divider_light</item>

View file

@ -11,6 +11,8 @@
</declare-styleable>
<!--Themed Attributes-->
<attr name="window_background" format="reference" />
<attr name="custom_tab_toolbar" format="reference" />
<attr name="toolbar_background_color" format="reference" />
<attr name="toolbar_icon_tint" format="reference" />
<attr name="image_button_style" format="reference" />

View file

@ -29,4 +29,15 @@
<item>medium</item>
<item>large</item>
</string-array>
<string-array name="app_theme_values">
<item>AppTheme:prefer:night</item>
<item>Remin:only:day</item>
</string-array>
<string-array name="app_theme_flavor_values">
<item>auto</item>
<item>night</item>
<item>day</item>
</string-array>
</resources>

View file

@ -168,7 +168,20 @@
<string name="pref_title_notification_filter_reblogs">my posts are boosted</string>
<string name="pref_title_notification_filter_favourites">my posts are favourited</string>
<string name="pref_title_appearance_settings">Appearance</string>
<string name="pref_title_light_theme">Use the Light Theme</string>
<string name="pref_title_app_theme">App Theme</string>
<string-array name="app_theme_names">
<item>Tusky</item>
<item>Remin</item>
</string-array>
<string name="pref_title_app_theme_flavor">Theme flavor</string>
<string-array name="app_theme_flavor_names">
<item>Sunset/Sunrise</item>
<item>Night</item>
<item>Day</item>
</string-array>
<string name="pref_title_browser_settings">Browser</string>
<string name="pref_title_custom_tabs">Use Chrome Custom Tabs</string>
<string name="pref_title_hide_follow_button">Hide compose button while scrolling</string>
@ -280,5 +293,4 @@
<string name="action_set_caption">Set caption</string>
<string name="action_remove_media">Remove</string>
</resources>

View file

@ -32,95 +32,9 @@
<item name="android:windowNoTitle">true</item>
</style>
<!--Dark Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"/>
<style name="AppThemeBase" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/color_primary_dark</item>
<item name="colorPrimaryDark">@color/color_primary_dark_dark</item>
<item name="colorAccent">@color/color_accent_dark</item>
<item name="colorButtonNormal">@color/button_dark</item>
<item name="android:colorBackground">@color/color_primary_dark_dark</item>
<item name="android:windowBackground">@color/window_background_dark</item>
<item name="android:editTextColor">@color/edit_text_color_dark</item>
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
<item name="android:textColorTertiary">@color/text_color_tertiary_dark</item>
<item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse_dark</item>
<item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse_dark</item>
<item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse_dark</item>
<item name="android:actionMenuTextColor">@color/text_color_primary_dark</item>
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>
<item name="toolbar_background_color">@color/toolbar_background_dark</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_dark</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Dark</item>
<item name="status_reblog_small_drawable">@drawable/ic_reblog_dark_18dp</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_dark</item>
<item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_dark</item>
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_dark</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_dark</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item>
<item name="content_warning_button">@drawable/toggle_small</item>
<item name="sensitive_media_warning_background_color">@color/color_background_dark</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item>
<item name="status_divider_drawable">@drawable/status_divider_dark</item>
<item name="conversation_thread_line_drawable">@drawable/conversation_thread_line_dark</item>
<item name="tab_icon_selected_tint">@color/color_accent_dark</item>
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_dark</item>
<item name="account_header_background_color">@color/account_header_background_dark</item>
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item>
<item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_dark</item>
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
<item name="compose_close_button_tint">@color/toolbar_icon_dark</item>
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
<item name="compose_mention_color">@color/color_accent_dark</item>
<item name="compose_content_warning_bar_background">@drawable/border_background_dark</item>
<item name="compose_hide_media_button_color">@color/image_button_dark</item>
<item name="compose_hide_media_button_selected_color">@color/color_accent_dark</item>
<item name="compose_image_button_tint">@color/image_button_dark</item>
<item name="compose_reply_content_background">@color/compose_reply_content_background_dark</item>
<item name="report_status_background_color">@color/color_background_dark</item>
<item name="report_status_divider_drawable">@drawable/status_divider_dark</item>
<item name="material_drawer_background">@color/window_background_dark</item>
<item name="material_drawer_primary_text">@color/text_color_primary_dark</item>
<item name="material_drawer_primary_icon">@color/toolbar_icon_dark</item>
<item name="material_drawer_secondary_text">@color/text_color_secondary_dark</item>
<item name="material_drawer_hint_text">@color/text_color_tertiary_dark</item>
<item name="material_drawer_divider">@color/color_primary_dark_dark</item>
<item name="material_drawer_selected">@color/color_primary_dark</item>
<item name="material_drawer_selected_text">@color/text_color_primary_dark</item>
<item name="material_drawer_header_selection_text">@color/text_color_primary_dark</item>
<item name="card_background">@drawable/card_frame_dark</item>
<item name="card_image_background">@color/text_color_tertiary_dark</item>
<item name="play_indicator_drawable">@drawable/ic_play_indicator_dark</item>
</style>
<style name="AppTheme.ImageButton.Dark" parent="@style/Widget.AppCompat.Button.Borderless.Colored">
<item name="android:tint">@color/image_button_dark</item>
</style>
<style name="AppTheme.BottomSheetDialog.Dark" parent="@style/Theme.Design.BottomSheetDialog">
<item name="colorAccent">@color/color_accent_dark</item>
<item name="android:colorBackground">@color/color_background_dark</item>
</style>
<style name="AppTheme.Account.ToolbarPopupTheme.Dark" parent="ThemeOverlay.AppCompat">
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
<!--Light Application Theme Styles-->
<style name="AppTheme.Light" parent="AppThemeBase.Light"/>
<style name="AppThemeBase.Light" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="AppThemeBase"/>
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/color_primary_light</item>
<item name="colorPrimaryDark">@color/color_primary_dark_light</item>
<item name="colorAccent">@color/color_accent_light</item>
@ -139,6 +53,8 @@
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Light</item>
<item name="window_background">@color/window_background_light</item>
<item name="custom_tab_toolbar">@color/custom_tab_toolbar_light</item>
<item name="toolbar_background_color">@color/toolbar_background_light</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_light</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Light</item>
@ -189,6 +105,14 @@
</style>
<style name="Remin" parent="ReminBase"/>
<style name="ReminBase" parent="AppThemeBase">
<item name="colorAccent">#e5ac00</item>
<item name="colorButtonNormal">#e8c14e</item>
<item name="tab_icon_selected_tint">#e2b62f</item>
<item name="compose_hide_media_button_selected_color">#f4c842</item>
</style>
<style name="AppTheme.ImageButton.Light" parent="Widget.AppCompat.Button.Borderless.Colored">
<item name="android:tint">@color/image_button_light</item>
</style>

View file

@ -4,10 +4,20 @@
<PreferenceCategory android:title="@string/pref_title_appearance_settings">
<CheckBoxPreference
android:defaultValue="false"
android:key="lightTheme"
android:title="@string/pref_title_light_theme" />
<ListPreference
android:defaultValue="AppTheme:prefer:night"
android:entries="@array/app_theme_names"
android:entryValues="@array/app_theme_values"
android:key="appTheme"
android:summary="%s"
android:title="@string/pref_title_app_theme" />
<ListPreference
android:entries="@array/app_theme_flavor_names"
android:entryValues="@array/app_theme_flavor_values"
android:key="appThemeFlavor"
android:summary="%s"
android:title="@string/pref_title_app_theme_flavor" />
<ListPreference
android:defaultValue="medium"