use of android.support.v7.preference.DialogPreference in project KeePassDX by Kunzisoft.
the class RoundsFixPreferenceDialogFragmentCompat method onDialogClosed.
@Override
public void onDialogClosed(boolean positiveResult) {
if (positiveResult) {
long rounds;
try {
String strRounds = mRoundsView.getText().toString();
rounds = Long.valueOf(strRounds);
} catch (NumberFormatException e) {
Toast.makeText(getContext(), R.string.error_rounds_not_number, Toast.LENGTH_LONG).show();
return;
}
DialogPreference preference = getPreference();
if (preference instanceof RoundsPreference) {
RoundsPreference roundsPreference = (RoundsPreference) preference;
// This allows the client to ignore the user value.
if (roundsPreference.callChangeListener(rounds)) {
// Save the value
roundsPreference.setRounds(rounds);
}
}
}
}
use of android.support.v7.preference.DialogPreference in project KeePassDX by Kunzisoft.
the class RoundsPreferenceDialogFragmentCompat method onBindDialogView.
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
mRoundsView = (TextView) view.findViewById(R.id.rounds);
// Get the time from the related Preference
Database db = App.getDB();
mPM = db.pm;
long numRounds = mPM.getNumRounds();
DialogPreference preference = getPreference();
if (preference instanceof RoundsPreference) {
numRounds = ((RoundsPreference) preference).getRounds();
}
mRoundsView.setText(String.valueOf(numRounds));
}
use of android.support.v7.preference.DialogPreference in project KeePassDX by Kunzisoft.
the class RoundsFixPreferenceDialogFragmentCompat method onBindDialogView.
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
TextView textDescriptionView = (TextView) view.findViewById(R.id.rounds_explanation);
mRoundsView = (TextView) view.findViewById(R.id.rounds);
DialogPreference preference = getPreference();
if (preference instanceof RoundsPreference) {
textDescriptionView.setText(((RoundsPreference) preference).getExplanations());
long numRounds = ((RoundsPreference) preference).getRounds();
mRoundsView.setText(String.valueOf(numRounds));
}
}
Aggregations