Back to project page Calma.
The source code is released under:
Apache License
If you think the Android project Calma listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2013 Thomas Schmid//w w w .jav a2 s.c o m * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ package com.scto.android.calma.activities; //import net.appositedesigns.fileexplorer.util.BookmarksHelper; import com.scto.android.calma.utils.PreferenceUtils; import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.PreferenceManager; import android.widget.*; public abstract class BaseActivity extends Activity { private OnSharedPreferenceChangeListener listener; protected boolean shouldRestartApp = false; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(new PreferenceUtils(this).getTheme()); super.onCreate(savedInstanceState); listenToThemeChange(); } private void listenToThemeChange() { listener = new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (PreferenceUtils.THEME.equals(key)) { shouldRestartApp = true; } } }; PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(listener); } public synchronized PreferenceUtils getPreferenceUtils() { return new PreferenceUtils(this); } @Override protected void onDestroy() { super.onDestroy(); PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(listener); } }