Search in sources :

Example 1 with DialogPreference

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);
            }
        }
    }
}
Also used : DialogPreference(android.support.v7.preference.DialogPreference)

Example 2 with DialogPreference

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));
}
Also used : DialogPreference(android.support.v7.preference.DialogPreference) PwDatabase(com.keepassdroid.database.PwDatabase) Database(com.keepassdroid.database.Database)

Example 3 with DialogPreference

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));
    }
}
Also used : DialogPreference(android.support.v7.preference.DialogPreference) TextView(android.widget.TextView)

Aggregations

DialogPreference (android.support.v7.preference.DialogPreference)3 TextView (android.widget.TextView)1 Database (com.keepassdroid.database.Database)1 PwDatabase (com.keepassdroid.database.PwDatabase)1