From 587b81e17f9c4659c13844124e2689f7a31c82f7 Mon Sep 17 00:00:00 2001 From: vinceh121 Date: Fri, 3 Jan 2020 17:32:57 +0100 Subject: [PATCH] Made themes changeable and some fixes --- app/src/main/AndroidManifest.xml | 2 +- app/src/main/java/de/k3b/android/GuiUtil.java | 17 +++ .../androFotoFinder/SettingsActivity.java | 2 + .../widget/ActivityWithCallContext.java | 17 ++- .../main/res/drawable/grid_color_selector.xml | 1 - app/src/main/res/layout/fragment_gallery.xml | 2 +- app/src/main/res/layout/fragment_tags.xml | 2 +- app/src/main/res/values/arrays.xml | 10 ++ app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 11 +- app/src/main/res/values/styles.xml | 6 +- app/src/main/res/xml/preferences.xml | 143 ++++++++++-------- 12 files changed, 142 insertions(+), 73 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0a84ea3e..bcd1afc0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -77,7 +77,7 @@ android:icon="@drawable/foto_gallery" android:label="@string/app_name" android:largeHeap="true" - android:theme="@style/AppTheme" + android:theme="@style/AppTheme.Light" > * Created by k3b on 25.08.2018. */ public class ActivityWithCallContext extends Activity { @@ -42,7 +43,9 @@ public class ActivityWithCallContext extends Activity { */ public static final Boolean isCallContextEnabled = true; - /** what the current activity is doing. This will become part of the callstack when a child activity is invoked */ + /** + * what the current activity is doing. This will become part of the callstack when a child activity is invoked + */ public static String additionalCallContext = ""; /** @@ -73,6 +76,7 @@ public static void addContext(String debugContext, Intent targetIntent, Activity @Override protected void onCreate(Bundle savedInstanceState) { + GuiUtil.setTheme(this); // Almost every activity extends this so use this to set theme super.onCreate(savedInstanceState); if (isCallContextEnabled) { @@ -93,6 +97,7 @@ public static String readCallContext(Intent intent) { public boolean hasParentCallContext() { return this.parentCallContext.length() > 0; } + @Override protected void onResume() { super.onResume(); @@ -110,7 +115,9 @@ public String getCallContext() { return parentCallContext + "\n=> " + getCallerDescription(this); } - /** called by all variants of startActivity(ForResult): add context to call.*/ + /** + * called by all variants of startActivity(ForResult): add context to call. + */ @Override public void startActivityForResult(Intent intent, int requestCode, Bundle options) { startActivityForResultImpl(intent, requestCode, options); @@ -131,7 +138,9 @@ public void startActivity(Intent intent) { startActivityForResultImpl(intent, -1, null); } - /** called by all variants of startActivity(ForResult): add context to call.*/ + /** + * called by all variants of startActivity(ForResult): add context to call. + */ private void startActivityForResultImpl(Intent intent, int requestCode, Bundle options) { addContext(additionalCallContext, intent, this); additionalCallContext = ""; diff --git a/app/src/main/res/drawable/grid_color_selector.xml b/app/src/main/res/drawable/grid_color_selector.xml index 90a0cde5..9aefe6ae 100644 --- a/app/src/main/res/drawable/grid_color_selector.xml +++ b/app/src/main/res/drawable/grid_color_selector.xml @@ -23,6 +23,5 @@ - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_gallery.xml b/app/src/main/res/layout/fragment_gallery.xml index 56be740c..4c67b143 100644 --- a/app/src/main/res/layout/fragment_gallery.xml +++ b/app/src/main/res/layout/fragment_gallery.xml @@ -147,8 +147,8 @@ + - 00000 + + Light + Dark + + + + @string/theme_light + @string/theme_dark + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 985a132a..e27e2fc6 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -21,7 +21,7 @@ --> #00abea - #ffffff + #70ffffff @android:color/black #50000000 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 38ec4e98..ab341d15 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -275,9 +275,12 @@ You can undo hiding by calling the mediascanner from gallery-menu." When: - + Theme + Holo light + Holo dark + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a7f42402..e1f688e3 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -22,8 +22,12 @@ - +