From 9204e530b0db43f61791fdebbf7ce8b5fe6087c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sch=C3=A4ttgen?= Date: Fri, 30 Sep 2016 01:17:37 +0200 Subject: [PATCH] Finished night theme --- .../java/me/impy/aegis/PreferencesActivity.java | 13 ++++++------- app/src/main/res/layout/activity_add_profile.xml | 5 ++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/me/impy/aegis/PreferencesActivity.java b/app/src/main/java/me/impy/aegis/PreferencesActivity.java index 51982ac1..8ee541cc 100644 --- a/app/src/main/java/me/impy/aegis/PreferencesActivity.java +++ b/app/src/main/java/me/impy/aegis/PreferencesActivity.java @@ -9,6 +9,7 @@ import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatDelegate; +import android.widget.Toast; public class PreferencesActivity extends AppCompatActivity { @@ -35,14 +36,12 @@ public class PreferencesActivity extends AppCompatActivity { // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); - Preference nightModePreference = findPreference("pref_night_mode"); - nightModePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + final Preference nightModePreference = findPreference("pref_night_mode"); + nightModePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override - public boolean onPreferenceClick(Preference preference) { - //AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - Intent i = new Intent(getActivity(), MainActivity.class); - //startActivity(i); - return false; + public boolean onPreferenceChange(Preference preference, Object newValue) { + Toast.makeText(getActivity(), "Night mode will be enabled after closing this screen", Toast.LENGTH_SHORT).show(); + return true; } }); } diff --git a/app/src/main/res/layout/activity_add_profile.xml b/app/src/main/res/layout/activity_add_profile.xml index f42d3d54..bb4e9fee 100644 --- a/app/src/main/res/layout/activity_add_profile.xml +++ b/app/src/main/res/layout/activity_add_profile.xml @@ -84,6 +84,7 @@ android:layout_width="wrap_content" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" + android:textColor="?attr/primaryText" android:textSize="18sp" android:layout_alignBottom="@+id/imageView3" android:layout_toRightOf="@+id/imageView3" @@ -108,6 +109,7 @@ android:layout_weight="1" android:layout_width="wrap_content" android:textSize="18sp" + android:textColor="?attr/primaryText" android:layout_alignBottom="@+id/ivIssuer" android:layout_alignLeft="@+id/tvAlgorithm" android:layout_alignStart="@+id/tvAlgorithm"/> @@ -131,6 +133,7 @@ android:layout_weight="1" android:layout_width="wrap_content" android:textSize="18sp" + android:textColor="?attr/primaryText" android:layout_alignBottom="@+id/ivPeriod" android:layout_alignLeft="@+id/tvIssuer" android:layout_alignStart="@+id/tvIssuer" @@ -151,7 +154,7 @@ android:text="Medium Text" android:id="@+id/tvOtp" android:textSize="36sp" - android:textColor="@color/primary_text" + android:textColor="?attr/primaryText" android:layout_alignParentBottom="true" android:layout_toRightOf="@+id/tvAlgorithm" android:layout_toEndOf="@+id/tvAlgorithm"