@Override public void onDestroy() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); SettingsManager.save(); }
/** * When the back button is pressed, update the MidiOptions. Return the updated options as the * 'result' of this Activity. */ @Override public void onBackPressed() { Intent intent = new Intent(); updateOptions(); intent.putExtra(SettingsActivity.settingsID, options); setResult(Activity.RESULT_OK, intent); super.onBackPressed(); }
/** * Create the Settings activity. Retrieve the initial option values (MidiOptions) from the Intent. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(android.R.style.Theme_Holo_Light); getWindow().getDecorView().setBackgroundColor(Color.WHITE); // getListView().setBackgroundColor(Color.TRANSPARENT); // getListView().setCacheColorHint(Color.TRANSPARENT); setTitle("ECML: Settings"); options = (MidiOptions) this.getIntent().getSerializableExtra(settingsID); defaultOptions = (MidiOptions) this.getIntent().getSerializableExtra(defaultSettingsID); createView(); }
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); LinearLayout root = (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent(); Toolbar bar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, null, false); bar.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); root.addView(bar, 0); }
@Override protected void onResume() { super.onResume(); ThemeManager.applyTheme(this); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); }