passdialog: switch to ViewAnimator
This commit is contained in:
@@ -44,6 +44,7 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.widget.ViewAnimator;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
@@ -191,7 +192,6 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
public static class PassphraseDialogFragment extends DialogFragment implements TextView.OnEditorActionListener {
|
public static class PassphraseDialogFragment extends DialogFragment implements TextView.OnEditorActionListener {
|
||||||
private EditText mPassphraseEditText;
|
private EditText mPassphraseEditText;
|
||||||
private TextView mPassphraseText;
|
private TextView mPassphraseText;
|
||||||
private View mInput, mProgress;
|
|
||||||
private EditText[] mBackupCodeEditText;
|
private EditText[] mBackupCodeEditText;
|
||||||
|
|
||||||
private CanonicalizedSecretKeyRing mSecretRing = null;
|
private CanonicalizedSecretKeyRing mSecretRing = null;
|
||||||
@@ -199,6 +199,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
private long mSubKeyId;
|
private long mSubKeyId;
|
||||||
|
|
||||||
private Intent mServiceIntent;
|
private Intent mServiceIntent;
|
||||||
|
private ViewAnimator mLayout;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@@ -234,13 +235,11 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(theme);
|
LayoutInflater inflater = LayoutInflater.from(theme);
|
||||||
View view = inflater.inflate(R.layout.passphrase_dialog, null);
|
mLayout = (ViewAnimator) inflater.inflate(R.layout.passphrase_dialog, null);
|
||||||
alert.setView(view);
|
alert.setView(mLayout);
|
||||||
|
|
||||||
mPassphraseText = (TextView) view.findViewById(R.id.passphrase_text);
|
mPassphraseText = (TextView) mLayout.findViewById(R.id.passphrase_text);
|
||||||
mPassphraseEditText = (EditText) view.findViewById(R.id.passphrase_passphrase);
|
mPassphraseEditText = (EditText) mLayout.findViewById(R.id.passphrase_passphrase);
|
||||||
mInput = view.findViewById(R.id.input);
|
|
||||||
mProgress = view.findViewById(R.id.progress);
|
|
||||||
|
|
||||||
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@@ -428,8 +427,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInput.setVisibility(View.INVISIBLE);
|
mLayout.setDisplayedChild(1);
|
||||||
mProgress.setVisibility(View.VISIBLE);
|
|
||||||
positive.setEnabled(false);
|
positive.setEnabled(false);
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Boolean>() {
|
new AsyncTask<Void, Void, Boolean>() {
|
||||||
@@ -469,8 +467,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
mPassphraseEditText.setText("");
|
mPassphraseEditText.setText("");
|
||||||
mPassphraseEditText.setError(getString(R.string.wrong_passphrase));
|
mPassphraseEditText.setError(getString(R.string.wrong_passphrase));
|
||||||
mInput.setVisibility(View.VISIBLE);
|
mLayout.setDisplayedChild(0);
|
||||||
mProgress.setVisibility(View.INVISIBLE);
|
|
||||||
positive.setEnabled(true);
|
positive.setEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:custom="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="16dp"
|
android:paddingTop="16dp"
|
||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
android:paddingLeft="24dp"
|
android:paddingLeft="24dp"
|
||||||
android:paddingRight="24dp"
|
android:paddingRight="24dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
custom:initialView="0">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/input"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -34,7 +36,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/progress"
|
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -57,4 +58,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>
|
||||||
Reference in New Issue
Block a user