Finished night theme

This commit is contained in:
Michael Schättgen 2016-09-30 01:17:37 +02:00
parent fe44bdbb65
commit 9204e530b0
2 changed files with 10 additions and 8 deletions

View file

@ -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;
}
});
}

View file

@ -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"