use of org.chromium.components.sync.PassphraseType in project AndroidChromium by JackyAndroid.
the class PassphraseDialogFragment method getPromptText.
private String getPromptText() {
ProfileSyncService pss = ProfileSyncService.get();
String accountName = pss.getCurrentSignedInAccountText() + "\n\n";
PassphraseType passphraseType = pss.getPassphraseType();
if (pss.hasExplicitPassphraseTime()) {
switch(passphraseType) {
case FROZEN_IMPLICIT_PASSPHRASE:
return accountName + pss.getSyncEnterGooglePassphraseBodyWithDateText();
case CUSTOM_PASSPHRASE:
return accountName + pss.getSyncEnterCustomPassphraseBodyWithDateText();
// Falling through intentionally.
case IMPLICIT_PASSPHRASE:
// Falling through intentionally.
case KEYSTORE_PASSPHRASE:
default:
Log.w(TAG, "Found incorrect passphrase type " + passphraseType + ". Falling back to default string.");
return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
}
return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
use of org.chromium.components.sync.PassphraseType in project AndroidChromium by JackyAndroid.
the class PassphraseTypeDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.sync_passphrase_types, null);
// Configure the passphrase type list
ListView list = (ListView) v.findViewById(R.id.passphrase_types);
Adapter adapter = createAdapter(getCurrentTypeFromArguments());
list.setAdapter(adapter);
list.setId(R.id.passphrase_type_list);
list.setOnItemClickListener(this);
list.setDividerHeight(0);
PassphraseType currentType = getCurrentTypeFromArguments();
list.setSelection(adapter.getPositionForType(currentType));
// Only show this hint if encryption has been set to use sync passphrase
if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
instructionsView.setVisibility(View.VISIBLE);
instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
instructionsView.setText(getResetText());
}
// Create and return the dialog
return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setNegativeButton(R.string.cancel, this).setTitle(R.string.sync_passphrase_type_title).setView(v).create();
}
use of org.chromium.components.sync.PassphraseType in project AndroidChromium by JackyAndroid.
the class PassphraseTypeDialogFragment method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long typeId) {
PassphraseType currentType = getCurrentTypeFromArguments();
// We know this conversion from long to int is safe, because it represents very small
// enum values.
PassphraseType type = PassphraseType.fromInternalValue((int) typeId);
boolean isEncryptEverythingAllowed = getIsEncryptEverythingAllowedFromArguments();
if (currentType.getAllowedTypes(isEncryptEverythingAllowed).contains(type)) {
if (typeId != currentType.internalValue()) {
Listener listener = (Listener) getTargetFragment();
listener.onPassphraseTypeSelected(type);
}
dismiss();
}
}
Aggregations