Back to project page com.elsewhat.android.slideshow.
The source code is released under:
Copyright (C) 2012 Dagfinn Parnas <dagfinn.parnas@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Sof...
If you think the Android project com.elsewhat.android.slideshow 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 com.elsewhat.android.slideshow.api; /*from ww w .j a va2s . co m*/ import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.preference.DialogPreference; import android.util.AttributeSet; public class DeletablePreference extends DialogPreference { OnPreferenceChangeListener mOnChangeListener; public DeletablePreference(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public DeletablePreference(Context context) { super(context, null); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see android.preference.DialogPreference#onDialogClosed(boolean) */ @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); if(positiveResult && mOnChangeListener!=null){ mOnChangeListener.onPreferenceChange(this, "OK"); } if(positiveResult &&isPersistent()){ SharedPreferences preferences =getSharedPreferences(); Editor editor =preferences.edit(); //we want a unique value so that it triggers any SharedPreferenceListeners editor.putString(getKey(), System.currentTimeMillis()+""); editor.commit(); } } /* (non-Javadoc) * @see android.preference.Preference#setOnPreferenceChangeListener(android.preference.Preference.OnPreferenceChangeListener) */ @Override public void setOnPreferenceChangeListener( OnPreferenceChangeListener onPreferenceChangeListener) { mOnChangeListener = onPreferenceChangeListener; //super.setOnPreferenceChangeListener(onPreferenceChangeListener); } }