From f3dbb2b1d1d4db84f6942cd5415defb763346646 Mon Sep 17 00:00:00 2001 From: Bipin Date: Tue, 12 Jan 2021 10:44:59 +0100 Subject: [PATCH 1/7] big bordfer --- app/src/main/res/layout/fragment_settings.xml | 93 ++++++++++++++++++- app/src/main/res/values/themes.xml | 1 + 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 9ea800a..a421c02 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -31,6 +31,16 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 1e892a3..bc08dfa 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -8,6 +8,7 @@ @color/buttonColour @color/secondaryColour + @color/teal_700 16sp From e7f152bc009e9b4227d57d98599c87e6372e568c Mon Sep 17 00:00:00 2001 From: Bipin Date: Tue, 12 Jan 2021 11:00:44 +0100 Subject: [PATCH 2/7] WAT MOOOOOOI --- app/src/main/res/layout/fragment_settings.xml | 3 +- .../main/res/layout/fragment_statistic.xml | 44 +++++++++++++++++-- app/src/main/res/layout/location_item.xml | 18 ++++++++ app/src/main/res/layout/route_item.xml | 18 ++++++++ app/src/main/res/values/themes.xml | 6 ++- 5 files changed, 83 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index a421c02..88bc2be 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -6,7 +6,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/primaryColour" android:id="@+id/settingFragment" - tools:context=".fragments.SettingsFragment"> + tools:context=".fragments.SettingsFragment" + android:theme="@style/Theme.Switches"> + + + + + + + + + + + + + + + + @color/buttonColour @color/secondaryColour - @color/teal_700 16sp + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index ebfbba9..4cad898 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -11,4 +11,7 @@ #FF000000 #FF000000 #FF0000 + #FF115571 + #FF31AFB4 + #FF14212D \ No newline at end of file From 87403625531dfd25cf634b47ebdb86e78d6bb329 Mon Sep 17 00:00:00 2001 From: Robin Koedood Date: Tue, 12 Jan 2021 12:05:27 +0100 Subject: [PATCH 4/7] Auto stash before merge of "fuckcolours" and "origin/fuckcolours" --- .../fragments/SettingsFragment.java | 37 +++++++++---------- app/src/main/res/values/themes.xml | 3 ++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java index c7a1131..e0a2937 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; +import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -19,6 +20,7 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentTransaction; +import com.a1.nextlocation.MainActivity; import com.a1.nextlocation.R; import org.jetbrains.annotations.NotNull; @@ -30,7 +32,7 @@ public class SettingsFragment extends Fragment { private SharedPreferences.Editor editor; private SwitchCompat fontSwitch; private SwitchCompat imperialSwitch; - private SwitchCompat colourblindSwitch; + private SwitchCompat colorBlindMode; private Refreshable refreshable; @Override @@ -106,28 +108,23 @@ public class SettingsFragment extends Fragment { editor.commit(); }); - //Initialises colourblind mode switchCompat - this.colourblindSwitch = view.findViewById(R.id.colourblindSwitch); - fontSwitch.setChecked(sharedPreferences.getBoolean("colourblindSwitch", false)); - - //Initial check to see what setting was last chosen - if (colourblindSwitch.isChecked()){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - }else if (!colourblindSwitch.isChecked()){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - } - - colourblindSwitch.setOnClickListener(view1 -> { - if (colourblindSwitch.isChecked()){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - }else if (!colourblindSwitch.isChecked()){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - } - editor.putBoolean("colourblindSwitch", colourblindSwitch.isChecked()); + this.colorBlindMode = view.findViewById(R.id.settingsEyesButton); + this.colorBlindMode.setOnClickListener(view1 -> { + editor.putBoolean("colorBlindModeSwitch", imperialSwitch.isChecked()); editor.apply(); editor.commit(); - }); + if (colorBlindMode.isChecked()){ + requireActivity().setTheme(R.style.Theme_NextLocation); + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + System.out.println("AAN"); + }else if (!colorBlindMode.isChecked()){ + requireActivity().setTheme(R.style.Theme_NextLocationNight); + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + System.out.println("UIT"); + } + + }); } private void initializeLanguageDropdown(View view) { diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 5306d31..d3ca57a 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -26,4 +26,7 @@ @color/secondaryColour 24sp + + + \ No newline at end of file From 4c09192f9a314097c8e879073cf73e66048977f3 Mon Sep 17 00:00:00 2001 From: Robin Koedood Date: Tue, 12 Jan 2021 12:09:30 +0100 Subject: [PATCH 5/7] YEP --- app/src/main/java/com/a1/nextlocation/MainActivity.java | 1 - .../com/a1/nextlocation/fragments/SettingsFragment.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/MainActivity.java b/app/src/main/java/com/a1/nextlocation/MainActivity.java index 500ccbe..209e51d 100644 --- a/app/src/main/java/com/a1/nextlocation/MainActivity.java +++ b/app/src/main/java/com/a1/nextlocation/MainActivity.java @@ -38,7 +38,6 @@ public class MainActivity extends AppCompatActivity implements Refreshable { */ @Override protected void onCreate(Bundle savedInstanceState) { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); super.onCreate(savedInstanceState); // initialize saved language from sharedPreferences diff --git a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java index e0a2937..6155a58 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java @@ -108,7 +108,7 @@ public class SettingsFragment extends Fragment { editor.commit(); }); - this.colorBlindMode = view.findViewById(R.id.settingsEyesButton); + this.colorBlindMode = view.findViewById(R.id.colourblindSwitch); this.colorBlindMode.setOnClickListener(view1 -> { editor.putBoolean("colorBlindModeSwitch", imperialSwitch.isChecked()); editor.apply(); @@ -117,10 +117,12 @@ public class SettingsFragment extends Fragment { if (colorBlindMode.isChecked()){ requireActivity().setTheme(R.style.Theme_NextLocation); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + getActivity().recreate(); System.out.println("AAN"); }else if (!colorBlindMode.isChecked()){ - requireActivity().setTheme(R.style.Theme_NextLocationNight); + requireActivity().setTheme(R.style.Theme_NextLocation); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + getActivity().recreate(); System.out.println("UIT"); } From 2f5b53e2b4ae9f598ad71d9fb488edf27dacb59e Mon Sep 17 00:00:00 2001 From: Bipin Date: Tue, 12 Jan 2021 12:13:29 +0100 Subject: [PATCH 6/7] barFix --- app/src/main/res/layout/fragment_settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 2b1128a..d71b96b 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -127,7 +127,7 @@ android:id="@+id/Balk2" android:layout_width="2dp" android:layout_height="match_parent" - android:background="@color/buttonColour" + android:background="@color/secondaryColour" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -182,7 +182,7 @@ android:id="@+id/Balk3" android:layout_width="2dp" android:layout_height="match_parent" - android:background="@color/black" + android:background="@color/secondaryColour" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" From 7f56cbe30ae863f7237de01c976800a0c9857049 Mon Sep 17 00:00:00 2001 From: Bipin Date: Tue, 12 Jan 2021 13:58:41 +0100 Subject: [PATCH 7/7] Button be working now --- .../java/com/a1/nextlocation/fragments/SettingsFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java index 6155a58..ecc623d 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/SettingsFragment.java @@ -46,6 +46,7 @@ public class SettingsFragment extends Fragment { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); editor = getContext().getSharedPreferences("Settings", Context.MODE_PRIVATE).edit(); + } @Override @@ -109,8 +110,10 @@ public class SettingsFragment extends Fragment { }); this.colorBlindMode = view.findViewById(R.id.colourblindSwitch); + this.colorBlindMode.setChecked(sharedPreferences.getBoolean("colorBlindModeSwitch", false)); + this.colorBlindMode.setOnClickListener(view1 -> { - editor.putBoolean("colorBlindModeSwitch", imperialSwitch.isChecked()); + editor.putBoolean("colorBlindModeSwitch", colorBlindMode.isChecked()); editor.apply(); editor.commit();