Merge branch 'fuckcolours' into develop
This commit is contained in:
@@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
@@ -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;
|
||||
@@ -13,11 +14,13 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
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;
|
||||
@@ -29,6 +32,7 @@ public class SettingsFragment extends Fragment {
|
||||
private SharedPreferences.Editor editor;
|
||||
private SwitchCompat fontSwitch;
|
||||
private SwitchCompat imperialSwitch;
|
||||
private SwitchCompat colorBlindMode;
|
||||
private Refreshable refreshable;
|
||||
|
||||
@Override
|
||||
@@ -42,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
|
||||
@@ -94,17 +99,37 @@ public class SettingsFragment extends Fragment {
|
||||
if(fontSwitch.isChecked())
|
||||
{
|
||||
requireActivity().setTheme(R.style.Theme_NextLocationBig);
|
||||
editor.putBoolean("fontSwitch",true);
|
||||
editor.apply();
|
||||
}
|
||||
if(!fontSwitch.isChecked())
|
||||
{
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);
|
||||
editor.putBoolean("fontSwitch",false);
|
||||
editor.apply();
|
||||
requireActivity().setTheme(R.style.Theme_NextLocation);;
|
||||
}
|
||||
editor.putBoolean("fontSwitch",fontSwitch.isChecked());
|
||||
editor.apply();
|
||||
editor.commit();
|
||||
});
|
||||
|
||||
this.colorBlindMode = view.findViewById(R.id.colourblindSwitch);
|
||||
this.colorBlindMode.setChecked(sharedPreferences.getBoolean("colorBlindModeSwitch", false));
|
||||
|
||||
this.colorBlindMode.setOnClickListener(view1 -> {
|
||||
editor.putBoolean("colorBlindModeSwitch", colorBlindMode.isChecked());
|
||||
editor.apply();
|
||||
editor.commit();
|
||||
|
||||
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_NextLocation);
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
getActivity().recreate();
|
||||
System.out.println("UIT");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void initializeLanguageDropdown(View view) {
|
||||
|
||||
@@ -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">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/settings_back_button"
|
||||
@@ -31,6 +32,16 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/name_box"
|
||||
app:layout_constraintBottom_toBottomOf="@id/name_box"
|
||||
app:layout_constraintLeft_toLeftOf="@id/name_box"
|
||||
app:layout_constraintRight_toRightOf="@id/name_box"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/name_box"
|
||||
android:layout_width="match_parent"
|
||||
@@ -41,7 +52,6 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||
android:background="@color/primaryColour"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
|
||||
>
|
||||
|
||||
<TextView
|
||||
@@ -57,7 +67,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -79,6 +89,16 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box2"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box2"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box2"
|
||||
app:layout_constraintRight_toRightOf="@id/Box2"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box2"
|
||||
android:layout_width="match_parent"
|
||||
@@ -105,9 +125,9 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk2"
|
||||
android:layout_width="1dp"
|
||||
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"
|
||||
@@ -126,13 +146,22 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box3"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box3"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box3"
|
||||
app:layout_constraintRight_toRightOf="@id/Box3"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:background="@color/primaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/Box4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/Box2"
|
||||
@@ -151,9 +180,9 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk3"
|
||||
android:layout_width="1dp"
|
||||
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"
|
||||
@@ -168,6 +197,61 @@
|
||||
app:layout_constraintStart_toStartOf="@id/Balk3"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box4"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box4"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box4"
|
||||
app:layout_constraintRight_toRightOf="@id/Box4"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/Box3"
|
||||
android:background="@color/primaryColour"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/colorblind"
|
||||
android:textColor="@color/secondaryColour"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/Balk4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk4"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/colourblindSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/Balk4"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/name_box"
|
||||
app:layout_constraintBottom_toBottomOf="@id/name_box"
|
||||
app:layout_constraintLeft_toLeftOf="@id/name_box"
|
||||
app:layout_constraintRight_toRightOf="@id/name_box"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/name_box"
|
||||
android:layout_width="match_parent"
|
||||
@@ -46,7 +55,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -69,6 +78,15 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box2"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box2"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box2"
|
||||
app:layout_constraintRight_toRightOf="@id/Box2"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box2"
|
||||
android:layout_width="match_parent"
|
||||
@@ -95,7 +113,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -118,6 +136,15 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box3"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box3"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box3"
|
||||
app:layout_constraintRight_toRightOf="@id/Box3"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box3"
|
||||
android:layout_width="match_parent"
|
||||
@@ -142,7 +169,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk3"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -165,6 +192,15 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="74dp"
|
||||
app:layout_constraintTop_toTopOf="@id/Box4"
|
||||
app:layout_constraintBottom_toBottomOf="@id/Box4"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Box4"
|
||||
app:layout_constraintRight_toRightOf="@id/Box4"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Box4"
|
||||
android:layout_width="match_parent"
|
||||
@@ -191,7 +227,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/Balk4"
|
||||
android:layout_width="1dp"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/secondaryColour"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -8,6 +8,24 @@
|
||||
android:id="@+id/locationItem"
|
||||
android:layout_margin="20dp">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="54dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="46dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@color/primaryColour"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/location_image"
|
||||
android:layout_width="50dp"
|
||||
|
||||
@@ -8,6 +8,24 @@
|
||||
android:id="@+id/routeItem"
|
||||
android:layout_margin="20dp">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="54dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@color/secondaryColour"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="46dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@color/primaryColour"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
|
||||
14
app/src/main/res/values-night/colors.xml
Normal file
14
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="primaryColour">#FF115571</color>
|
||||
<color name="secondaryColour">#FF31AFB4</color>
|
||||
<color name="buttonColour">#FF14212D</color>
|
||||
<color name="red">#FF0000</color>
|
||||
</resources>
|
||||
@@ -2,15 +2,28 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.NextLocation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||
<item name="colorPrimaryDark">@color/secondaryColour</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Switches" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="colorControlActivated">@color/buttonColour</item>
|
||||
<item name="colorSwitchThumbNormal">@color/primaryColour</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.NextLocationBig" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/secondaryColour</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorButtonNormal">@color/buttonColour</item>
|
||||
<item name="colorPrimaryDark">@color/secondaryColour</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -11,4 +11,7 @@
|
||||
<color name="secondaryColour">#FF000000</color>
|
||||
<color name="buttonColour">#FF000000</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="primaryColourCB">#FF115571</color>
|
||||
<color name="secondaryColourCB">#FF31AFB4</color>
|
||||
<color name="buttonColourCB">#FF14212D</color>
|
||||
</resources>
|
||||
@@ -11,6 +11,11 @@
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Switches" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="colorControlActivated">@color/buttonColour</item>
|
||||
<item name="colorSwitchThumbNormal">@color/primaryColour</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.NextLocationBig" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primaryColour</item>
|
||||
@@ -21,4 +26,7 @@
|
||||
<item name="colorPrimaryDark">@color/secondaryColour</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user