Add black theme (#726)
* Add black theme On amoled screens a completely black theme helps save battery, besides looking awesome! * Fix first set of merge request issues except the dialog. * Black theme inherits from dark and only the different values are declared * Make nav bar translucent (for some reason content does not go behind it in main activity. Need to investigate) * Remove nav bar line * Fix toolbar color * Fix dialog issue with black theme. Revert translucent navigation. * Translations updated, as well as possible from online sources. * Make login screen respect black theme
This commit is contained in:
parent
6fcb3cb495
commit
562beacfc1
@ -93,31 +93,25 @@ dependencies {
|
||||
// EmojiCompat
|
||||
implementation "com.android.support:support-emoji:$supportLibraryVersion"
|
||||
implementation "com.android.support:support-emoji-appcompat:$supportLibraryVersion"
|
||||
implementation "de.c1710:filemojicompat:1.0.14"
|
||||
implementation 'de.c1710:filemojicompat:1.0.14'
|
||||
// architecture components
|
||||
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
||||
//room
|
||||
implementation 'android.arch.persistence.room:runtime:1.1.1'
|
||||
kapt 'android.arch.persistence.room:compiler:1.1.1'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
implementation "com.google.dagger:dagger-android:$daggerVersion"
|
||||
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
|
||||
|
||||
testImplementation "org.robolectric:robolectric:3.8"
|
||||
testImplementation "org.mockito:mockito-inline:2.19.1"
|
||||
testImplementation 'org.robolectric:robolectric:3.8'
|
||||
testImplementation 'org.mockito:mockito-inline:2.19.1'
|
||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
|
||||
debugImplementation 'im.dino:dbinspector:3.4.1@aar'
|
||||
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
implementation 'com.uber.autodispose:autodispose-android-archcomponents:0.8.0'
|
||||
|
@ -25,6 +25,7 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
|
||||
@ -59,6 +60,10 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
|
||||
* runtime, just individual activities. So, each activity has to set its theme before any
|
||||
* views are created. */
|
||||
String theme = preferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT);
|
||||
Log.d("activeTheme", theme);
|
||||
if (theme.equals("black")) {
|
||||
setTheme(R.style.TuskyBlackTheme);
|
||||
}
|
||||
ThemeUtils.setAppNightMode(theme, this);
|
||||
|
||||
long accountId = getIntent().getLongExtra("account", -1);
|
||||
|
@ -216,6 +216,11 @@ public final class ComposeActivity
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String theme = preferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT);
|
||||
if (theme.equals("black")) {
|
||||
setTheme(R.style.TuskyDialogActivityBlackTheme);
|
||||
}
|
||||
setContentView(R.layout.activity_compose);
|
||||
|
||||
replyTextView = findViewById(R.id.composeReplyView);
|
||||
@ -381,7 +386,6 @@ public final class ComposeActivity
|
||||
if (intent != null) {
|
||||
|
||||
if (startingVisibility == Status.Visibility.UNKNOWN) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Status.Visibility preferredVisibility = Status.Visibility.byString(
|
||||
preferences.getString("defaultPostPrivacy",
|
||||
Status.Visibility.PUBLIC.serverString()));
|
||||
|
@ -70,6 +70,9 @@ class LoginActivity : AppCompatActivity(), Injectable {
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val theme = preferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT)
|
||||
if (theme == "black") {
|
||||
setTheme(R.style.TuskyBlackTheme)
|
||||
}
|
||||
ThemeUtils.setAppNightMode(theme, this)
|
||||
|
||||
setContentView(R.layout.activity_login)
|
||||
|
@ -24,6 +24,7 @@ import android.support.annotation.StringRes;
|
||||
import android.support.annotation.XmlRes;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.keylesspalace.tusky.fragment.PreferencesFragment;
|
||||
@ -105,6 +106,7 @@ public class PreferencesActivity extends BaseActivity
|
||||
switch (key) {
|
||||
case "appTheme": {
|
||||
String theme = sharedPreferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT);
|
||||
Log.d("activeTheme", theme);
|
||||
ThemeUtils.setAppNightMode(theme, this);
|
||||
restartActivitiesOnExit = true;
|
||||
|
||||
|
@ -39,6 +39,7 @@ public class ThemeUtils {
|
||||
|
||||
public static final String THEME_NIGHT = "night";
|
||||
public static final String THEME_DAY = "day";
|
||||
public static final String THEME_BLACK = "black";
|
||||
public static final String THEME_AUTO = "auto";
|
||||
|
||||
public static Drawable getDrawable(Context context, @AttrRes int attribute,
|
||||
@ -101,6 +102,9 @@ public class ThemeUtils {
|
||||
case THEME_DAY:
|
||||
mode = UiModeManager.MODE_NIGHT_NO;
|
||||
break;
|
||||
case THEME_BLACK:
|
||||
mode = UiModeManager.MODE_NIGHT_YES;
|
||||
break;
|
||||
case THEME_AUTO:
|
||||
mode = UiModeManager.MODE_NIGHT_AUTO;
|
||||
break;
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="@color/dialog_background_black" />
|
||||
</shape>
|
@ -163,6 +163,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>داكنة</item>
|
||||
<item>فاتحة</item>
|
||||
<item>أسود</item>
|
||||
<item>تلقائي عند الغروب</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -165,6 +165,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Dunkel</item>
|
||||
<item>Hell</item>
|
||||
<item>Schwarz</item>
|
||||
<item>Automatisch bei Sonnenuntergang</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -164,6 +164,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Oscuro</item>
|
||||
<item>Claro</item>
|
||||
<item>Negro</item>
|
||||
<item>Automático</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -182,6 +182,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Sombre</item>
|
||||
<item>Clair</item>
|
||||
<item>Noir</item>
|
||||
<item>Basé sur le coucher du soleil</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Dark</item>
|
||||
<item>Light</item>
|
||||
<item>Black</item>
|
||||
<item>日没による自動設定</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -9,4 +9,14 @@
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="TuskyDialogActivityBlackTheme" parent="@style/TuskyBlackTheme">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowBackground">@drawable/background_dialog_activity_black</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
<item name="android:windowCloseOnTouchOutside">false</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -7,4 +7,8 @@
|
||||
<item name="android:navigationBarDividerColor">@color/status_divider_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TuskyBlackTheme" parent="TuskyBlackThemeBase">
|
||||
<item name="android:navigationBarColor">@color/window_background_black</item>
|
||||
<item name="android:navigationBarDividerColor">@color/window_background_black</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -174,6 +174,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Donker</item>
|
||||
<item>Licht</item>
|
||||
<item>Zwart</item>
|
||||
<item>Automatisch tijdens zonsondergang</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -168,6 +168,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Escur</item>
|
||||
<item>Luminós</item>
|
||||
<item>Negre</item>
|
||||
<item>Alba automatica</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -176,6 +176,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Ciemny</item>
|
||||
<item>Jasny</item>
|
||||
<item>Czarny</item>
|
||||
<item>Zmieniaj automatycznie po zachodzie słońca</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -174,6 +174,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Noturno</item>
|
||||
<item>Diurno</item>
|
||||
<item>Negro</item>
|
||||
<item>Automático</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -172,6 +172,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Тёмная</item>
|
||||
<item>Светлая</item>
|
||||
<item>Черный</item>
|
||||
<item>Автоматическая (по времени)</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>கருமை</item>
|
||||
<item>வெளிச்சம்</item>
|
||||
<item>பிளாக்</item>
|
||||
<item>தானியங்கி</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>黑夜</item>
|
||||
<item>白天</item>
|
||||
<item>黑色</item>
|
||||
<item>自动切换</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>黑夜</item>
|
||||
<item>白天</item>
|
||||
<item>黑色</item>
|
||||
<item>自動切換</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>黑夜</item>
|
||||
<item>白天</item>
|
||||
<item>黑色</item>
|
||||
<item>自動切換</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>黑夜</item>
|
||||
<item>白天</item>
|
||||
<item>黑色</item>
|
||||
<item>自动切换</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -160,6 +160,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>黑夜</item>
|
||||
<item>白天</item>
|
||||
<item>黑色</item>
|
||||
<item>自動切換</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -40,6 +40,15 @@
|
||||
<color name="report_status_divider_dark">#2F2F2F</color>
|
||||
<color name="custom_tab_toolbar_dark">#313543</color>
|
||||
<color name="compose_reply_content_background_dark">#373c4b</color>
|
||||
<!--Black Theme Colors-->
|
||||
<color name="color_primary_black">#000000</color>
|
||||
<color name="color_primary_dark_black">#111111</color> <!--Dark Dark-->
|
||||
<color name="color_background_black">#000000</color>
|
||||
<color name="window_background_black">#000000</color>
|
||||
<color name="edit_text_color_black">#FFFFFF</color>
|
||||
<color name="text_color_primary_black">#FFFFFF</color>
|
||||
<color name="toolbar_background_black">#111111</color>
|
||||
<color name="dialog_background_black">#111111</color>
|
||||
<!--Light Theme Colors-->
|
||||
<color name="color_primary_light">#dfdfdf</color>
|
||||
<color name="color_primary_dark_light">#8f8f8f</color>
|
||||
|
@ -35,6 +35,7 @@
|
||||
<string-array name="app_theme_values">
|
||||
<item>night</item>
|
||||
<item>day</item>
|
||||
<item>black</item>
|
||||
<item>auto</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -176,6 +176,7 @@
|
||||
<string-array name="app_theme_names">
|
||||
<item>Dark</item>
|
||||
<item>Light</item>
|
||||
<item>Black</item>
|
||||
<item>Automatic at sunset</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -148,4 +148,30 @@
|
||||
<item name="android:textSize">?attr/status_text_medium</item>
|
||||
</style>
|
||||
|
||||
<!--Black Application Theme Styles-->
|
||||
<style name="TuskyBlackThemeBase" parent="TuskyBaseTheme">
|
||||
<item name="colorPrimary">@color/color_primary_black</item>
|
||||
<item name="colorPrimaryDark">@color/color_primary_dark_black</item>
|
||||
<item name="android:colorBackground">@color/color_primary_dark_black</item>
|
||||
<item name="android:windowBackground">@color/window_background_black</item>
|
||||
<item name="android:editTextColor">@color/edit_text_color_black</item>
|
||||
<item name="android:textColorPrimary">@color/text_color_primary_black</item>
|
||||
<item name="android:actionMenuTextColor">@color/text_color_primary_black</item>
|
||||
|
||||
<item name="window_background">@color/window_background_black</item>
|
||||
<item name="toolbar_background_color">@color/toolbar_background_black</item>
|
||||
<item name="sensitive_media_warning_background_color">@color/color_background_black</item>
|
||||
<item name="account_header_background_color">@color/color_background_black</item>
|
||||
|
||||
<item name="report_status_background_color">@color/color_background_black</item>
|
||||
|
||||
<item name="material_drawer_background">@color/window_background_black</item>
|
||||
<item name="material_drawer_primary_text">@color/text_color_primary_black</item>
|
||||
<item name="material_drawer_divider">@color/color_primary_dark_black</item>
|
||||
<item name="material_drawer_selected">@color/color_primary_black</item>
|
||||
<item name="material_drawer_selected_text">@color/text_color_primary_black</item>
|
||||
<item name="material_drawer_header_selection_text">@color/text_color_primary_black</item>
|
||||
</style>
|
||||
<style name="TuskyBlackTheme" parent="TuskyBlackThemeBase"/>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user