Back to project page SuiviConsoFreeMobile.
The source code is released under:
Ce logiciel est dans le domaine public.
If you think the Android project SuiviConsoFreeMobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.yvesd.scfm; //w w w . ja v a 2 s. co m import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; public class GestionnaireThemes { Activity activity; SharedPreferences settings; public GestionnaireThemes(Activity activity) { this.activity = activity; settings = activity.getSharedPreferences( SuiviConsoFreeMobileActivity.PREFS_NAME, 0); } /** * Bascule du theme noir au thme blanc ou vice versa */ protected void basculerTheme() { int theme = settings.getInt( SuiviConsoFreeMobileActivity.PREF_KEY_THEME, android.R.style.Theme_Light); int newTheme = android.R.style.Theme_Light; if (theme == android.R.style.Theme_Light) newTheme = android.R.style.Theme_Black; else newTheme = android.R.style.Theme_Light; Editor editor = settings.edit(); editor.putInt(SuiviConsoFreeMobileActivity.PREF_KEY_THEME, newTheme); editor.commit(); } public void chargerThemeChoisi() { int theme = settings.getInt( SuiviConsoFreeMobileActivity.PREF_KEY_THEME, android.R.style.Theme_Light); activity.setTheme(theme); } }