Browse Source

Fix previous themes and add Material Dark theme (needs improvements)

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
15eed4137a
  1. 2
      app/src/main/java/awais/instagrabber/activities/BaseLanguageActivity.java
  2. 1
      app/src/main/java/awais/instagrabber/activities/MainActivity.java
  3. 1
      app/src/main/res/layout/activity_main.xml
  4. 2
      app/src/main/res/values/arrays.xml
  5. 24
      app/src/main/res/values/color.xml
  6. 1
      app/src/main/res/values/strings.xml
  7. 36
      app/src/main/res/values/styles.xml
  8. 99
      app/src/main/res/values/themes.xml

2
app/src/main/java/awais/instagrabber/activities/BaseLanguageActivity.java

@ -15,7 +15,7 @@ public abstract class BaseLanguageActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ThemeUtils.changeTheme(this);
super.onCreate(savedInstanceState);
}
}

1
app/src/main/java/awais/instagrabber/activities/MainActivity.java

@ -264,7 +264,6 @@ public class MainActivity extends BaseLanguageActivity {
final View searchText = searchView.findViewById(R.id.search_src_text);
if (searchText instanceof AutoCompleteTextView) {
searchAutoComplete = (AutoCompleteTextView) searchText;
searchAutoComplete.setTextColor(getResources().getColor(android.R.color.white));
}
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
private boolean searchUser;

1
app/src/main/res/layout/activity_main.xml

@ -25,7 +25,6 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Widget.AppTheme.Toolbar.PrimarySurface"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="none"

2
app/src/main/res/values/arrays.xml

@ -127,8 +127,10 @@
</string-array>
<string-array name="dark_themes">
<item>@string/dark_black_theme</item>
<item>@string/dark_material_dark_theme</item>
</string-array>
<string-array name="dark_theme_values">
<item>@style/AppTheme.Dark.Black</item>
<item>@style/AppTheme.Dark.MaterialDark</item>
</string-array>
</resources>

24
app/src/main/res/values/color.xml

@ -34,7 +34,9 @@
<color name="semi_transparent_black">#80000000</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="black_800">#121212</color>
<color name="grey_50">#FAFAFA</color>
<color name="grey_100">#F5F5F5</color>
@ -63,7 +65,25 @@
<color name="blue_A400">#2979FF</color>
<color name="blue_A700">#2962FF</color>
<color name="brown_50">#EFEBE9</color>
<color name="brown_100">#D7CCC8</color>
<color name="brown_200">#BCAAA4</color>
<color name="brown_300">#A1887F</color>
<color name="brown_400">#8D6E63</color>
<color name="brown_500">#795548</color>
<color name="brown_600">#6D4C41</color>
<color name="brown_700">#5D4037</color>
<color name="brown_800">#4E342E</color>
<color name="brown_900">#3E2723</color>
<color name="green_200">#03dac6</color>
<color name="green_400">#66BB6A</color>
<color name="green_500">#018786</color>
<color name="purple_200">#bb86fc</color>
<color name="purple_600">#4b01d0</color>
<color name="red_200">#cf6679</color>
<!-- Barinsta Theme colors -->
<color name="barinstaColorPrimary">#a86735</color>
@ -72,6 +92,6 @@
<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>
<color name="barinstaPrimaryTextColor">#616161</color>
<color name="barinstaSecondaryTextColor">@color/white</color>
</resources>

1
app/src/main/res/values/strings.xml

@ -282,4 +282,5 @@
<string name="light_theme_settings">Light theme</string>
<string name="dark_theme_settings">Dark theme</string>
<string name="light_barinsta_theme">Barinsta</string>
<string name="dark_material_dark_theme">Material Dark</string>
</resources>

36
app/src/main/res/values/styles.xml

@ -23,12 +23,12 @@
<item name="android:windowActionBar">false</item>
</style>
<style name="AppTheme.BottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog" />
<!--<style name="AppTheme.BottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog" />-->
<style name="AppTheme.WindowAnimationTransition">
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style>
<!--<style name="AppTheme.WindowAnimationTransition">-->
<!-- <item name="android:windowEnterAnimation">@android:anim/fade_in</item>-->
<!-- <item name="android:windowExitAnimation">@android:anim/fade_out</item>-->
<!--</style>-->
<style name="AppTheme.BottomNavigationView" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.BottomNavigationView</item>
@ -38,21 +38,21 @@
<style name="Widget.AppTheme.Toolbar.PrimarySurface" parent="Widget.MaterialComponents.Toolbar.PrimarySurface" />
<style name="ThemeOverlay.AppTheme.Dark.ActionBar" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />
<!--<style name="ThemeOverlay.AppTheme.Dark.ActionBar" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />-->
<style name="Widget.App.ActionMode" parent="Widget.AppCompat.ActionMode">
<item name="background">?attr/colorPrimary</item>
</style>
<style name="Widget.BottomNavigationView.Light.White" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<style name="Widget.BottomNavigationView.Light.White" parent="@style/Widget.MaterialComponents.BottomNavigationView.Colored">
<item name="colorPrimary">@color/black</item>
</style>
<style name="Widget.BottomNavigationView.Dark.Black" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<style name="Widget.BottomNavigationView.Dark.Black" parent="@style/Widget.MaterialComponents.BottomNavigationView.Colored">
<item name="colorPrimary">@color/white</item>
</style>
<style name="Widget.BottomNavigationView.Light.Barinsta" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<style name="Widget.BottomNavigationView.Light.Barinsta" parent="@style/Widget.MaterialComponents.BottomNavigationView.Colored">
<item name="colorPrimary">@color/barinstaColorPrimary</item>
</style>
@ -85,11 +85,27 @@
<item name="colorOnSurface">@color/grey_800</item>
</style>
<style name="Widget.AppCompat.ListView.DropDown.Dark.Black" parent="@style/Widget.AppCompat.ListView.DropDown">
<style name="Widget.AppCompat.ListView.DropDown.Dark.Black" parent="Widget.AppCompat.ListView.DropDown">
<item name="android:background">@color/grey_800</item>
</style>
<style name="PreferenceFragmentCompatStyle.Dark.Black" parent="PreferenceFragment.Material">
<item name="android:divider">@drawable/pref_list_divider_material</item>
</style>
<style name="Widget.MaterialComponents.Toolbar.Light.Barinsta" parent="Widget.MaterialComponents.Toolbar.Primary">
<item name="android:textColorPrimary">@color/white</item>
<item name="colorControlNormal">@color/white</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.MaterialComponents.ActionBar.Light.Barinsta</item>
</style>
<style name="ThemeOverlay.MaterialComponents.ActionBar.Light.Barinsta" parent="ThemeOverlay.MaterialComponents.ActionBar.Primary">
<item name="colorControlNormal">@color/white</item>
<item name="android:textColorHint">@color/brown_600</item>
</style>
<style name="PreferenceFragmentCompatStyle.Dark.MaterialDark" parent="PreferenceFragment.Material">
<item name="android:background">?colorSurface</item>
<item name="android:windowBackground">?attr/colorSurface</item>
</style>
</resources>

99
app/src/main/res/values/themes.xml

@ -1,37 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme.Base" parent="Theme.MaterialComponents.Light.NoActionBar">
<!--<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog</item>-->
<!--<item name="android:windowAnimationStyle">@style/AppTheme.WindowAnimationTransition</item>-->
<style name="AppTheme" parent="" />
<!-- Light Themes -->
<style name="AppTheme.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Common start -->
<item name="android:statusBarColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="android:navigationBarColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="android:navigationBarDividerColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeCloseDrawable">@drawable/ic_close_24</item>
<item name="android:textColorLink">@color/blue_700</item>
<item name="android:textColorHighlight">@color/blue_300</item>
<item name="actionModeStyle">@style/Widget.App.ActionMode</item>
<!--<item name="actionBarTheme">@style/ThemeOverlay.AppTheme.Dark.ActionBar</item>-->
<!-- Common end -->
<item name="android:windowLightStatusBar" tools:ignore="NewApi">false</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item>
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>
<!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>-->
</style>
<style name="AppTheme" parent="AppTheme.Base" />
<style name="AppTheme.Light.White" parent="AppTheme.Base">
<style name="AppTheme.Light.White" parent="AppTheme.Light">
<item name="colorPrimary">@color/white</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/white</item>
<item name="colorSecondaryVariant">@color/white</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorSurface">@color/white</item>
<item name="colorOnSurface">@color/black</item>
<item name="colorAccent">@color/black</item>
<item name="editTextColor">@color/black</item>
<item name="android:editTextColor">@color/black</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:windowBackground">@color/white</item>
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.White</item>
<item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.Light.White</item>
</style>
<style name="AppTheme.Dark.Black" parent="AppTheme.Base">
<style name="AppTheme.Light.Barinsta" parent="AppTheme.Light">
<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="colorSecondaryVariant">@color/barinstaColorSecondaryDark</item>
<item name="colorSurface">@color/grey_200</item>
<item name="colorControlHighlight">@color/barinstaColorSecondaryDark</item>
<item name="colorAccent">@color/barinstaColorSecondaryDark</item>
<!--<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>-->
<item name="android:windowBackground">?colorSurface</item>
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.Barinsta</item>
<item name="android:textColorPrimary">@color/barinstaPrimaryTextColor</item>
<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Light.Barinsta</item>
</style>
<!-- Dark Themes -->
<style name="AppTheme.Dark" parent="Theme.MaterialComponents.NoActionBar">
<!-- Common start -->
<item name="android:statusBarColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="android:navigationBarColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="android:navigationBarDividerColor" tools:ignore="NewApi">?attr/colorPrimaryDark</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeCloseDrawable">@drawable/ic_close_24</item>
<item name="android:textColorLink">@color/blue_700</item>
<item name="android:textColorHighlight">@color/blue_300</item>
<item name="actionModeStyle">@style/Widget.App.ActionMode</item>
<!-- Common end -->
<item name="android:windowLightStatusBar" tools:ignore="NewApi">false</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item>
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
<!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>-->
</style>
<style name="AppTheme.Dark.Black" parent="AppTheme.Dark">
<item name="android:windowLightStatusBar" tools:ignore="NewApi">false</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/black</item>
<item name="colorOnSecondary">@color/white</item>
<item name="colorSecondaryVariant">@color/black</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/white</item>
<item name="colorAccent">@color/blue_A700</item>
@ -47,22 +97,23 @@
<item name="switchStyle">@style/Widget.AppCompat.CompoundButton.Switch.Dark.Black</item>
<item name="android:dropDownListViewStyle">@style/Widget.AppCompat.ListView.DropDown.Dark.Black</item>
<item name="preferenceFragmentCompatStyle">@style/PreferenceFragmentCompatStyle.Dark.Black</item>
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Primary</item>
</style>
<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 name="AppTheme.Dark.MaterialDark" parent="AppTheme.Dark">
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_600</item>
<item name="colorSecondary">@color/green_200</item>
<item name="colorSecondaryVariant">@color/green_500</item>
<item name="android:colorBackground">@color/black</item>
<item name="colorSurface">@color/black_800</item>
<item name="colorError">@color/red_200</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnBackground">@color/white</item>
<item name="colorOnSurface">@color/white</item>
<item name="colorOnError">@color/black</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.MaterialComponents.Dialog.Alert</item>
<item name="preferenceFragmentCompatStyle">@style/PreferenceFragmentCompatStyle.Dark.MaterialDark</item>
</style>
<style name="AppTheme.BottomSheetDialog.Dark" parent="Theme.MaterialComponents.BottomSheetDialog" />
</resources>
Loading…
Cancel
Save