1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-22 21:16:57 +00:00

Add Barinsta Light theme

This commit is contained in:
Ammar Githam 2020-09-13 23:55:17 +09:00
parent 31b94f17fc
commit e7cd0e0041
7 changed files with 40 additions and 12 deletions

View File

@ -113,7 +113,7 @@ public final class SettingsHelper {
@StringDef(
{APP_LANGUAGE, APP_THEME, COOKIE, FOLDER_PATH, DATE_TIME_FORMAT, DATE_TIME_SELECTION, CUSTOM_DATE_TIME_FORMAT,
DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB, STORY_VIEWER})
DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB, STORY_VIEWER, PREF_DARK_THEME, PREF_LIGHT_THEME})
public @interface StringSettings {}
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
@ -121,6 +121,6 @@ public final class SettingsHelper {
CHECK_ACTIVITY, CHECK_UPDATES})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION, PREF_DARK_THEME, PREF_LIGHT_THEME})
@StringDef({PREV_INSTALL_VERSION})
public @interface IntegerSettings {}
}

View File

@ -3,6 +3,7 @@ package awais.instagrabber.utils;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
@ -23,8 +24,13 @@ public final class ThemeUtils {
themeCode = AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
}
final boolean isNight = isNight(context, themeCode);
final int themeResId = isNight ? settingsHelper.getInteger(Constants.PREF_DARK_THEME)
: settingsHelper.getInteger(Constants.PREF_LIGHT_THEME);
int themeResId = 0;
try {
themeResId = Integer.parseInt(isNight ? settingsHelper.getString(Constants.PREF_DARK_THEME)
: settingsHelper.getString(Constants.PREF_LIGHT_THEME));
} catch (NumberFormatException e) {
Log.e(TAG, "changeTheme: ", e);
}
final int finalThemeResId;
if (themeResId <= 0) {

View File

@ -119,9 +119,11 @@
</array>
<string-array name="light_themes">
<item>@string/light_white_theme</item>
<item>@string/light_barinsta_theme</item>
</string-array>
<string-array name="light_theme_values">
<item>@style/AppTheme.Light.White</item>
<item>@style/AppTheme.Light.Barinsta</item>
</string-array>
<string-array name="dark_themes">
<item>@string/dark_black_theme</item>

View File

@ -33,9 +33,6 @@
<color name="dm_profile_button_color">#efefef</color>
<color name="semi_transparent_black">#80000000</color>
<!-- Amoled Colors -->
<color name="background_amoled">#000000</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
@ -67,4 +64,14 @@
<color name="blue_A700">#2962FF</color>
<color name="green_400">#66BB6A</color>
<!-- Barinsta Theme colors -->
<color name="barinstaColorPrimary">#a86735</color>
<color name="barinstaColorPrimaryLight">#dd9561</color>
<color name="barinstaColorPrimaryDark">#753c0a</color>
<color name="barinstaColorSecondary">#d4ab7c</color>
<color name="barinstaColorSecondaryLight">#ffddac</color>
<color name="barinstaColorSecondaryDark">#a17c4f</color>
<color name="barinstaColorPrimaryText">#616161</color>
<color name="barinstaColorSecondaryText">@color/black</color>
</resources>

View File

@ -281,4 +281,5 @@
<string name="dark_black_theme">Black</string>
<string name="light_theme_settings">Light theme</string>
<string name="dark_theme_settings">Dark theme</string>
<string name="light_barinsta_theme">Barinsta</string>
</resources>

View File

@ -44,7 +44,6 @@
<item name="background">?attr/colorPrimary</item>
</style>
<style name="Widget.BottomNavigationView.Light.White" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<item name="colorPrimary">@color/black</item>
</style>
@ -53,6 +52,10 @@
<item name="colorPrimary">@color/white</item>
</style>
<style name="Widget.BottomNavigationView.Light.Barinsta" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<item name="colorPrimary">@color/barinstaColorPrimary</item>
</style>
<style name="Widget.MaterialComponents.Button.Light.White" parent="Widget.MaterialComponents.Button">
<item name="materialThemeOverlay">@style/ThemeOverlay.Button.Dark.Black</item>
</style>

View File

@ -4,7 +4,6 @@
<style name="AppTheme.Base" parent="Theme.MaterialComponents.Light.NoActionBar">
<!--<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog</item>-->
<!--<item name="android:windowAnimationStyle">@style/AppTheme.WindowAnimationTransition</item>-->
<!--<item name="bottomNavigationStyle">@style/AppTheme.BottomNavigationView</item>-->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeCloseDrawable">@drawable/ic_close_24</item>
<item name="android:textColorLink">@color/blue_700</item>
@ -50,9 +49,19 @@
<item name="preferenceFragmentCompatStyle">@style/PreferenceFragmentCompatStyle.Dark.Black</item>
</style>
<style name="Theme.Amoled" parent="AppTheme.Base">
<!--<item name="android:colorBackground">@color/background_amoled</item>-->
<!--<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>-->
<style name="AppTheme.Light.Barinsta" parent="AppTheme.Base">
<item name="colorPrimary">@color/barinstaColorPrimary</item>
<item name="colorPrimaryDark">@color/barinstaColorPrimaryDark</item>
<item name="colorPrimaryVariant">@color/barinstaColorPrimaryLight</item>
<item name="colorSecondary">@color/barinstaColorSecondary</item>
<item name="colorSurface">@color/grey_200</item>
<item name="colorControlHighlight">@color/barinstaColorSecondaryDark</item>
<item name="colorAccent">@color/barinstaColorSecondaryDark</item>
<item name="android:windowBackground">?colorSurface</item>
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.Barinsta</item>
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
<item name="actionModeStyle">@style/Widget.App.ActionMode</item>
<item name="android:textColorPrimary">@color/barinstaColorPrimaryText</item>
</style>
<style name="AppTheme.BottomSheetDialog.Dark" parent="Theme.MaterialComponents.BottomSheetDialog" />