private final String TAG = getClass().getName();
- private AlertDialog swipeDialog;
private PendingIntent tagIntent;
@Override
Intent intent = getIntent();
setResult(RESULT_CANCELED);
- if (swipeDialog != null) {
- swipeDialog.dismiss();
- swipeDialog = null;
- }
int slot = intent.getIntExtra("slot", -1);
if (slot > 0) {
- swipeDialog = makeDialog();
- swipeDialog.show();
enableDispatch(slot);
}
}
super.onPause();
Log.v(TAG, "Finished the work");
- if(swipeDialog != null) {
- swipeDialog.dismiss();
- swipeDialog = null;
- }
disableDispatch();
}
finish();
}
- 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) {
- finish();
- }
- });
- return builder.create();
- }
-
/*
<receiver android:name=".IsoDepReceiver"
android:label="IsoDepReceiver">
private static boolean waitingForResult = false;
private static SharedPreferences prefs;
private static int slot;
+ private AlertDialog swipeDialog;
@Override
protected void onCreate(Bundle savedInstanceState)
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);
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) {