summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-02-13 14:33:31 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-02-13 14:33:31 -0800
commit4fad005fbc84825278d341ffb8a9a5c5c9f95a32 (patch)
tree34b2e600f556f12092c5cb8893ddb9c177e5e8ea
parent8292ec0171aa61d9372d8ea24d7d5c0e6bb915fa (diff)
parent5e794499725296c2d436ccbe54e5517037938172 (diff)
downloadplatform_packages_apps_CertInstaller-tools_r20.tar.gz
platform_packages_apps_CertInstaller-tools_r20.tar.bz2
platform_packages_apps_CertInstaller-tools_r20.zip
am 5e794499: Merge "Remove PKCS12_PASSWORD_DIALOG and NAME_CREDENTIAL_DIALOG in order to correctly recreate it on onCreateDialog"android-sdk-adt_r20tools_r20ics-plus-aosp
* commit '5e794499725296c2d436ccbe54e5517037938172': Remove PKCS12_PASSWORD_DIALOG and NAME_CREDENTIAL_DIALOG in order to correctly recreate it on onCreateDialog
-rw-r--r--src/com/android/certinstaller/CertInstaller.java14
-rw-r--r--src/com/android/certinstaller/ViewHelper.java9
2 files changed, 21 insertions, 2 deletions
diff --git a/src/com/android/certinstaller/CertInstaller.java b/src/com/android/certinstaller/CertInstaller.java
index d37cd72..0809ad3 100644
--- a/src/com/android/certinstaller/CertInstaller.java
+++ b/src/com/android/certinstaller/CertInstaller.java
@@ -317,6 +317,10 @@ public class CertInstaller extends Activity {
private Dialog createPkcs12PasswordDialog() {
View view = View.inflate(this, R.layout.password_dialog, null);
mView.setView(view);
+ if (mView.getHasEmptyError()) {
+ mView.showError(R.string.password_empty_error);
+ mView.setHasEmptyError(false);
+ }
String title = mCredentials.getName();
title = TextUtils.isEmpty(title)
@@ -329,7 +333,8 @@ public class CertInstaller extends Activity {
public void onClick(DialogInterface dialog, int id) {
String password = mView.getText(R.id.credential_password);
if (TextUtils.isEmpty(password)) {
- mView.showError(R.string.password_empty_error);
+ mView.setHasEmptyError(true);
+ removeDialog(PKCS12_PASSWORD_DIALOG);
showDialog(PKCS12_PASSWORD_DIALOG);
} else {
mNextAction = new Pkcs12ExtractAction(password);
@@ -354,6 +359,10 @@ public class CertInstaller extends Activity {
private Dialog createNameCredentialDialog() {
ViewGroup view = (ViewGroup) View.inflate(this, R.layout.name_credential_dialog, null);
mView.setView(view);
+ if (mView.getHasEmptyError()) {
+ mView.showError(R.string.name_empty_error);
+ mView.setHasEmptyError(false);
+ }
mView.setText(R.id.credential_info, mCredentials.getDescription(this).toString());
final EditText nameInput = (EditText) view.findViewById(R.id.credential_name);
nameInput.setText(getDefaultName());
@@ -365,7 +374,8 @@ public class CertInstaller extends Activity {
public void onClick(DialogInterface dialog, int id) {
String name = mView.getText(R.id.credential_name);
if (TextUtils.isEmpty(name)) {
- mView.showError(R.string.name_empty_error);
+ mView.setHasEmptyError(true);
+ removeDialog(NAME_CREDENTIAL_DIALOG);
showDialog(NAME_CREDENTIAL_DIALOG);
} else {
removeDialog(NAME_CREDENTIAL_DIALOG);
diff --git a/src/com/android/certinstaller/ViewHelper.java b/src/com/android/certinstaller/ViewHelper.java
index 81ff628..6561667 100644
--- a/src/com/android/certinstaller/ViewHelper.java
+++ b/src/com/android/certinstaller/ViewHelper.java
@@ -24,6 +24,7 @@ import android.widget.TextView;
*/
class ViewHelper {
private View mView;
+ private boolean mHasEmptyError;
void setView(View view) {
mView = view;
@@ -49,4 +50,12 @@ class ViewHelper {
TextView v = (TextView) mView.findViewById(viewId);
if (v != null) v.setText(textId);
}
+
+ void setHasEmptyError(boolean hasEmptyError) {
+ mHasEmptyError = hasEmptyError;
+ }
+
+ boolean getHasEmptyError() {
+ return mHasEmptyError;
+ }
}