X-Git-Url: http://www.average.org/gitweb/?p=YkNeoCR.git;a=blobdiff_plain;f=src%2Forg%2Faverage%2Fnfcauthcr%2FNFCAuthCREnroll.java;fp=src%2Forg%2Faverage%2Fnfcauthcr%2FNFCAuthCREnroll.java;h=bb6b4f0357118db644ce4e7aace211823aa5be34;hp=6aae6f1970e4e38b30d10285ed3b1ab904abeafc;hb=16a341cff772b8d413af1d95a21e181a5b4879ff;hpb=e17a0ae9d37c1d36dd3a040341d4312f5296c60e diff --git a/src/org/average/nfcauthcr/NFCAuthCREnroll.java b/src/org/average/nfcauthcr/NFCAuthCREnroll.java index 6aae6f1..bb6b4f0 100644 --- a/src/org/average/nfcauthcr/NFCAuthCREnroll.java +++ b/src/org/average/nfcauthcr/NFCAuthCREnroll.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.preference.PreferenceManager; +import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.DialogInterface; @@ -12,8 +13,10 @@ import android.view.View; import android.widget.TextView; import android.widget.RadioButton; -public class NFCAuthCREnroll extends Activity -{ +import org.average.nfcauthcr.NFCAuthCRCheck; + +public class NFCAuthCREnroll extends Activity { + private final String TAG = getClass().getName(); private static boolean waitingForResult = false; @@ -73,12 +76,24 @@ public class NFCAuthCREnroll extends Activity public void onEnrollClicked(View view) { Log.v(TAG, "Enroll clicked"); if (slot > 0) { - showEnrollResult(" using slot" + slot); + runChallenge(slot); } else { showEnrollResult("Must specify which slot to use"); } } + public void onActivityResult(int requestCode, int resultCode, + Intent intent) { + Log.v(TAG, "Got activity result"); + waitingForResult = false; + if (resultCode == RESULT_OK) { + String res = intent.getStringExtra("response"); + Log.v(TAG, "Response is \"" + res + "\""); + } else { + Log.v(TAG, "Error result code " + resultCode); + } + } + private void showEnrollResult(final String msg) { Log.v(TAG, "Show result: \"" + msg + "\""); @@ -95,4 +110,12 @@ public class NFCAuthCREnroll extends Activity AlertDialog dialog = builder.create(); dialog.show(); } + + private void runChallenge(int slot) { + Log.v(TAG, "Launching challenging activity"); + Intent crIntent = new Intent(this, NFCAuthCRCheck.class); + crIntent.putExtra("slot", slot); + this.startActivityForResult(crIntent, 0); + waitingForResult = true; + } }