From 22d96afba5c648b9f405c90086ff58c247434399 Mon Sep 17 00:00:00 2001 From: Davide Panaroni Date: Fri, 4 Nov 2022 14:33:58 +0100 Subject: [PATCH 01/37] Autosize text inside `Element` Text resizing is handled by `AutoSizeableTextView`, which `Element` implements, so manual text resizing is unnecessary. Fixes #2, #6 and #12. --- .idea/runConfigurations.xml | 12 ------------ .../privacyfriendly2048/activities/Element.java | 17 +---------------- .../activities/GameActivity.java | 1 - 3 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java index f1db4d9..045242d 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java @@ -49,7 +49,6 @@ public class Element extends android.support.v7.widget.AppCompatButton { public int dPosY = 0; public boolean activated; public boolean animateMoving = false; - public float textSize = 24; Context context; int color; @@ -59,7 +58,6 @@ public Element(Context c) super(c); context = c; setAllCaps(false); - setTextSize(textSize); setBackgroundResource(R.drawable.game_brick); if(PreferenceManager.getDefaultSharedPreferences(context).getString("pref_color","1").equals("1")) setColor(context.getResources().getColor(R.color.button_empty)); @@ -143,14 +141,10 @@ public void drawItem() { case 16384: setColor(ContextCompat.getColor(context,R.color.button16384)); setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); break; case 32768: setColor(ContextCompat.getColor(context,R.color.button32768)); setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); break; } } @@ -216,14 +210,10 @@ public void drawItem() { case 16384: setColor(ContextCompat.getColor(context,R.color.button16384_2)); setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); break; case 32768: setColor(ContextCompat.getColor(context,R.color.button32768_2)); setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); break; } } @@ -273,10 +263,7 @@ public int getPosX() { public int getPosY() { return posY; } - public void updateFontSize(){ - textSize=(float)(getLayoutParams().width/7.0); - setTextSize(textSize); - } + public Element copy() { Element temp = new Element(context); @@ -288,9 +275,7 @@ public Element copy() temp.dPosY = dPosY; temp.activated = activated; temp.animateMoving = animateMoving; - temp.textSize = textSize; temp.color = color; - temp.setTextSize(textSize); //temp.setBackgroundResource(backGroundResource); temp.setColor(color); temp.setVisibility(getVisibility()); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java index 51d1875..00375f3 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java @@ -369,7 +369,6 @@ record = gameStatistics.getRecord(); elements[i][j].setDPosition(lp.getMarginStart(),lp.topMargin); elements[i][j].setLayoutParams(lp); backgroundElements[i][j].setLayoutParams(lp); - elements[i][j].updateFontSize(); backgroundElements[i][j].setLayoutParams(lp); backgroundElements[i][j].setOnTouchListener(swipeListener); elements[i][j].setOnTouchListener(swipeListener); From bc0a0da0cbda8f214c3df12b80e0dcd2e39139e9 Mon Sep 17 00:00:00 2001 From: Julius Pedersen Date: Mon, 4 Dec 2023 17:16:38 +0100 Subject: [PATCH 02/37] =?UTF-8?q?=E2=9C=85=20Add=20theme=20menu=20entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values-de/arrays.xml | 2 ++ app/src/main/res/values/arrays.xml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/src/main/res/values-de/arrays.xml b/app/src/main/res/values-de/arrays.xml index bb3d2e4..2e2b1fd 100644 --- a/app/src/main/res/values-de/arrays.xml +++ b/app/src/main/res/values-de/arrays.xml @@ -3,9 +3,11 @@ Standard Original + Dark 1 2 + 3 \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 1601d06..e62feb3 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -3,9 +3,11 @@ Default Original + Dark 1 2 + 3 \ No newline at end of file From 1fb70995d9471256e46a0c809cf3e55ee0f8211e Mon Sep 17 00:00:00 2001 From: Julius Pedersen Date: Tue, 5 Dec 2023 08:03:33 +0100 Subject: [PATCH 03/37] =?UTF-8?q?=E2=9C=85=20Add=20settings=20option=20for?= =?UTF-8?q?=20theme=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values-de/arrays.xml | 13 +++++++++++-- app/src/main/res/values/arrays.xml | 13 +++++++++++-- app/src/main/res/xml/pref_general.xml | 9 +++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-de/arrays.xml b/app/src/main/res/values-de/arrays.xml index 2e2b1fd..d38be6d 100644 --- a/app/src/main/res/values-de/arrays.xml +++ b/app/src/main/res/values-de/arrays.xml @@ -3,11 +3,20 @@ Standard Original - Dark 1 2 - 3 + + + + System + Light + Dark + + + system + light + dark \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index e62feb3..cef4f8b 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -3,11 +3,20 @@ Default Original - Dark 1 2 - 3 + + + + System + Light + Dark + + + system + light + dark \ No newline at end of file diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index b07c11e..e0fb948 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -1,6 +1,15 @@ + + Date: Tue, 5 Dec 2023 08:33:34 +0100 Subject: [PATCH 04/37] =?UTF-8?q?=E2=9C=85=20Add=20setting=20theme=20for?= =?UTF-8?q?=20each=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activities/AboutActivity.java | 3 +++ .../activities/GameActivity.java | 3 +++ .../activities/HelpActivity.java | 3 +++ .../activities/MainActivity.java | 4 +++- .../activities/SettingsActivity.java | 3 +++ .../activities/SplashActivity.java | 3 +++ .../activities/StatsActivity.java | 3 +++ .../activities/TutorialActivity.java | 4 +++- .../helpers/ThemeResolver.kt | 17 +++++++++++++++++ 9 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/org/secuso/privacyfriendly2048/helpers/ThemeResolver.kt diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/AboutActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/AboutActivity.java index c046f82..a3ad24a 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/AboutActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/AboutActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.os.Bundle; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; @@ -40,6 +42,7 @@ public class AboutActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_about); ActionBar ab = getSupportActionBar(); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java index 51d1875..cf35b09 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/GameActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.app.AlertDialog; @@ -138,6 +140,7 @@ public void onPause() { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); saveState = true; diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/HelpActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/HelpActivity.java index 91d6480..c28ed9d 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/HelpActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/HelpActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.os.Bundle; import android.widget.ExpandableListView; @@ -40,6 +42,7 @@ public class HelpActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_help); LinkedHashMap> expandableListDetail = buildData(); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/MainActivity.java index 44fa024..fd8a130 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/MainActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -99,10 +101,10 @@ protected void onStart() @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_main); - overridePendingTransition(0, 0); // Making notification bar transparent diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/SettingsActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/SettingsActivity.java index 75a74af..f0e7ff2 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/SettingsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/SettingsActivity.java @@ -20,6 +20,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; @@ -107,6 +109,7 @@ private static void bindPreferenceSummaryToValue(Preference preference) { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_settings); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/SplashActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/SplashActivity.java index 1a32253..e680f64 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/SplashActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/SplashActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; @@ -37,6 +39,7 @@ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); Intent mainIntent = new Intent(SplashActivity.this, TutorialActivity.class); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/StatsActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/StatsActivity.java index ae0946e..e440acd 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/StatsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/StatsActivity.java @@ -19,6 +19,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; @@ -89,6 +91,7 @@ public class StatsActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_stats); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/TutorialActivity.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/TutorialActivity.java index 17f330f..f873766 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/TutorialActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/TutorialActivity.java @@ -18,6 +18,8 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetThemeRes; + import android.content.Context; import android.content.Intent; import android.graphics.Color; @@ -75,7 +77,7 @@ public class TutorialActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + setTheme(GetThemeRes(getApplicationContext())); setContentView(R.layout.activity_tutorial); // Making notification bar transparent diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/helpers/ThemeResolver.kt b/app/src/main/java/org/secuso/privacyfriendly2048/helpers/ThemeResolver.kt new file mode 100644 index 0000000..3e5a808 --- /dev/null +++ b/app/src/main/java/org/secuso/privacyfriendly2048/helpers/ThemeResolver.kt @@ -0,0 +1,17 @@ +package org.secuso.privacyfriendly2048.helpers + +import android.content.Context +import android.preference.PreferenceManager +import androidx.annotation.StyleRes +import org.secuso.privacyfriendly2048.R + +@StyleRes +fun GetThemeRes(ctx: Context): Int { + val prefs = PreferenceManager.getDefaultSharedPreferences(ctx) + + return when (prefs.getString("currentTheme", "system")) { + "light" -> R.style.AppThemeLight + "dark" -> R.style.AppThemeDark + else -> R.style.AppTheme + } +} \ No newline at end of file From 2108ea89823749fd0543a51b6b6adda6985de599 Mon Sep 17 00:00:00 2001 From: Julius Pedersen Date: Tue, 5 Dec 2023 08:45:20 +0100 Subject: [PATCH 05/37] =?UTF-8?q?=F0=9F=90=9B=20Fix=20forced=20bg=20colors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_about.xml | 3 +-- app/src/main/res/layout/activity_game.xml | 2 +- app/src/main/res/layout/activity_settings.xml | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 69ce433..edf8cfd 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -5,13 +5,12 @@ android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#FFFFFF"> + > + > Date: Tue, 5 Dec 2023 10:37:19 +0100 Subject: [PATCH 06/37] =?UTF-8?q?=E2=9C=85=20Add=20themes=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/styles.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 393bb5b..f26ef55 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,13 +1,27 @@ + - + + + + - + + From 7ac50cfcf3181f646956a7ff7868301670e8f821 Mon Sep 17 00:00:00 2001 From: Julius Pedersen Date: Tue, 5 Dec 2023 10:41:54 +0100 Subject: [PATCH 08/37] =?UTF-8?q?=E2=9C=85=20Add=20dynamic=20color=20schem?= =?UTF-8?q?e=20resolving=20to=20game=20elements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activities/Element.java | 226 ++++++------------ 1 file changed, 74 insertions(+), 152 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java b/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java index 67abb60..4fc9f0d 100644 --- a/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java +++ b/app/src/main/java/org/secuso/privacyfriendly2048/activities/Element.java @@ -19,13 +19,14 @@ package org.secuso.privacyfriendly2048.activities; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorInt; +import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorRes; + import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.ShapeDrawable; -import android.preference.PreferenceManager; -import androidx.core.content.ContextCompat; import android.view.View; import org.secuso.privacyfriendly2048.R; @@ -61,11 +62,7 @@ public Element(Context c) setAllCaps(false); setTextSize(textSize); setBackgroundResource(R.drawable.game_brick); - if(PreferenceManager.getDefaultSharedPreferences(context).getString("pref_color","1").equals("1")) - setColor(context.getResources().getColor(R.color.button_empty)); - else - setColor(context.getResources().getColor(R.color.button_empty_2)); - + setColor(GetColorRes(context, R.attr.buttonEmpty)); } public void drawItem() { @@ -81,153 +78,78 @@ public void drawItem() { setVisibility(View.VISIBLE); } - if(PreferenceManager.getDefaultSharedPreferences(context).getString("pref_color","1").equals("1")) - { - switch (number){ - case 0: - setColor(ContextCompat.getColor(context, R.color.button_empty)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 2: - setColor(ContextCompat.getColor(context,R.color.button2)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 4: - setColor(ContextCompat.getColor(context,R.color.button4)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 8: - setColor(ContextCompat.getColor(context,R.color.button8)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 16: - setColor(ContextCompat.getColor(context,R.color.button16)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 32: - setColor(ContextCompat.getColor(context,R.color.button32)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 64: - setColor(ContextCompat.getColor(context,R.color.button64)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 128: - setColor(ContextCompat.getColor(context,R.color.button128)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 256: - setColor(ContextCompat.getColor(context,R.color.button256)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 512: - setColor(ContextCompat.getColor(context,R.color.button512)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 1024: - setColor(ContextCompat.getColor(context,R.color.button1024)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 2048: - setColor(ContextCompat.getColor(context,R.color.button2048)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 4096: - setColor(ContextCompat.getColor(context,R.color.button4096)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 8192: - setColor(ContextCompat.getColor(context,R.color.button8192)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 16384: - setColor(ContextCompat.getColor(context,R.color.button16384)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); - break; - case 32768: - setColor(ContextCompat.getColor(context,R.color.button32768)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); - break; - } - } - else - { - switch (number){ - case 0: - setColor(R.color.button_empty_2); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 2: - setColor(ContextCompat.getColor(context,R.color.button2_2)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 4: - setColor(ContextCompat.getColor(context,R.color.button4_2)); - setTextColor(ContextCompat.getColor(context,R.color.black)); - break; - case 8: - setColor(ContextCompat.getColor(context,R.color.button8_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 16: - setColor(ContextCompat.getColor(context,R.color.button16_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 32: - setColor(ContextCompat.getColor(context,R.color.button32_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 64: - setColor(ContextCompat.getColor(context,R.color.button64_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 128: - setColor(ContextCompat.getColor(context,R.color.button128_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 256: - setColor(ContextCompat.getColor(context,R.color.button256_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 512: - setColor(ContextCompat.getColor(context,R.color.button512_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 1024: - setColor(ContextCompat.getColor(context,R.color.button1024_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 2048: - setColor(ContextCompat.getColor(context,R.color.button2048_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 4096: - setColor(ContextCompat.getColor(context,R.color.button4096_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 8192: - setColor(ContextCompat.getColor(context,R.color.button8192_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - break; - case 16384: - setColor(ContextCompat.getColor(context,R.color.button16384_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); - break; - case 32768: - setColor(ContextCompat.getColor(context,R.color.button32768_2)); - setTextColor(ContextCompat.getColor(context,R.color.white)); - textSize = textSize * 0.8f; - setTextSize(textSize); - break; - } + switch (number){ + case 0: + setColor(GetColorRes(context, R.attr.buttonEmpty)); + setTextColor(GetColorInt(context, R.attr.buttonEmptyText)); + break; + case 2: + setColor(GetColorRes(context, R.attr.button2)); + setTextColor(GetColorInt(context, R.attr.button2Text)); + break; + case 4: + setColor(GetColorRes(context, R.attr.button4)); + setTextColor(GetColorInt(context, R.attr.button4Text)); + break; + case 8: + setColor(GetColorRes(context, R.attr.button8)); + setTextColor(GetColorInt(context, R.attr.button8Text)); + break; + case 16: + setColor(GetColorRes(context,R.attr.button16)); + setTextColor(GetColorInt(context,R.attr.button16Text)); + break; + case 32: + setColor(GetColorRes(context,R.attr.button32)); + setTextColor(GetColorInt(context,R.attr.button32Text)); + break; + case 64: + setColor(GetColorRes(context,R.attr.button64)); + setTextColor(GetColorInt(context,R.attr.button64Text)); + break; + case 128: + setColor(GetColorRes(context,R.attr.button128)); + setTextColor(GetColorInt(context,R.attr.button128Text)); + break; + case 256: + setColor(GetColorRes(context,R.attr.button256)); + setTextColor(GetColorInt(context,R.attr.button256Text)); + break; + case 512: + setColor(GetColorRes(context,R.attr.button512)); + setTextColor(GetColorInt(context,R.attr.button512Text)); + break; + case 1024: + setColor(GetColorRes(context,R.attr.button1024)); + setTextColor(GetColorInt(context,R.attr.button1024Text)); + break; + case 2048: + setColor(GetColorRes(context,R.attr.button2048)); + setTextColor(GetColorInt(context,R.attr.button2048Text)); + break; + case 4096: + setColor(GetColorRes(context,R.attr.button4096)); + setTextColor(GetColorInt(context,R.attr.button4096Text)); + break; + case 8192: + setColor(GetColorRes(context,R.attr.button8192)); + setTextColor(GetColorInt(context,R.attr.button8192Text)); + break; + case 16384: + setColor(GetColorRes(context,R.attr.button16384)); + setTextColor(GetColorInt(context,R.attr.button16384Text)); + textSize = textSize * 0.8f; + setTextSize(textSize); + break; + case 32768: + setColor(GetColorRes(context,R.attr.button32768)); + setTextColor(GetColorInt(context,R.attr.button32768Text)); + textSize = textSize * 0.8f; + setTextSize(textSize); + break; } } + private void setColor(int c) { color = c; From 30f27d9193a2d059376ab02f4dac881156801196 Mon Sep 17 00:00:00 2001 From: Julius Pedersen Date: Tue, 5 Dec 2023 10:42:53 +0100 Subject: [PATCH 09/37] =?UTF-8?q?=F0=9F=90=9B=20Fix=20dual=20actionbar=20i?= =?UTF-8?q?n=20light=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 390e971..d461292 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,7 +5,7 @@ - - + + - - + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 67413fa..abbc255 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -23,7 +23,10 @@ true - -