Back to project page RSSFeedReader-App.
The source code is released under:
GNU General Public License
If you think the Android project RSSFeedReader-App 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 tan.chesley.rssfeedreader; /*from w w w .j a va 2 s . c o m*/ import android.content.Context; import android.content.DialogInterface; import android.preference.PreferenceManager; import android.util.AttributeSet; import android.view.View; import android.widget.NumberPicker; public class MaxDatabaseSizeNumberPickerDialog extends NumberPickerDialogPreference { private NumberPicker dialogNumberPicker; public MaxDatabaseSizeNumberPickerDialog(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onBindDialogView (View view) { super.onBindDialogView(view); dialogNumberPicker = (NumberPicker) view.findViewById(R.id.dialogNumberPicker); dialogNumberPicker.setMinValue(getContext().getResources().getInteger(R.integer.max_database_size_minimum)); dialogNumberPicker.setMaxValue(getContext().getResources().getInteger(R.integer.max_database_size_maximum)); dialogNumberPicker.setValue(PreferenceManager.getDefaultSharedPreferences(getContext()).getInt(SettingsActivity.KEY_PREF_MAX_DATABASE_SIZE, getContext().getResources().getInteger(R.integer.max_database_size_default))); } @Override public void onClick (DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreferenceManager.getDefaultSharedPreferences(getContext()).edit().putInt(SettingsActivity.KEY_PREF_MAX_DATABASE_SIZE, dialogNumberPicker.getValue()).commit(); setSummary(Integer.toString(dialogNumberPicker.getValue())); } } }