]> www.average.org Git - YkNeoCR.git/blobdiff - src/org/average/nfcauthcr/Enroll.java
move swipeDialog to activity
[YkNeoCR.git] / src / org / average / nfcauthcr / Enroll.java
index 190c08ff921c190b65754e5d3b01eb4ae9f5c331..8d90488dbc41e34e665aea4e9c84a76b71b93211 100644 (file)
@@ -24,6 +24,7 @@ public class Enroll extends Activity {
        private static boolean waitingForResult = false;
        private static SharedPreferences prefs;
        private static int slot;
+       private AlertDialog swipeDialog;
 
        @Override
        protected void onCreate(Bundle savedInstanceState)
@@ -88,6 +89,10 @@ public class Enroll extends Activity {
                                        Intent intent) {
                Log.v(TAG, "Got activity result");
                waitingForResult = false;
+               if(swipeDialog != null) {
+                       swipeDialog.dismiss();
+                       swipeDialog = null;
+               }
 
                if (resultCode != RESULT_OK) {
                        Log.v(TAG, "Error result code " + resultCode);
@@ -125,12 +130,27 @@ public class Enroll extends Activity {
                byte[] challenge = new byte[63];
                rng.nextBytes(challenge);
                Log.v(TAG, "Random challenge: " + hex(challenge));
-               Log.v(TAG, "Launching challenging activity");
                Intent crIntent = new Intent(this, Check.class);
                crIntent.putExtra("slot", slot);
                crIntent.putExtra("challenge", challenge);
                this.startActivityForResult(crIntent, 0);
                waitingForResult = true;
+               if (swipeDialog != null) swipeDialog.dismiss();
+               swipeDialog = makeDialog();
+               swipeDialog.show();
+       }
+
+       private AlertDialog makeDialog() {
+               AlertDialog.Builder builder = new AlertDialog.Builder(this);
+               builder.setTitle(R.string.challenging);
+               builder.setMessage(R.string.swipe);
+               builder.setOnCancelListener(
+                               new DialogInterface.OnCancelListener() {
+                       public void onCancel(DialogInterface dialog) {
+                               Log.v(TAG, "unbind service FIXME");
+                       }
+               });
+               return builder.create();
        }
 
        private String hex(byte[] a) {