1 package org.average.ykneocr;
3 import java.util.Random;
5 import android.os.Bundle;
6 import android.app.Activity;
7 import android.app.AlertDialog;
8 import android.preference.PreferenceManager;
9 import android.content.Intent;
10 import android.content.SharedPreferences;
11 import android.content.SharedPreferences.Editor;
12 import android.content.DialogInterface;
13 import android.text.Html;
14 import android.util.Log;
15 import android.view.View;
16 import android.widget.TextView;
17 import android.widget.RadioButton;
19 import org.average.ykneocr.QueryCrToken;
21 public class Enroll extends Activity {
23 private final String TAG = getClass().getName();
25 private static boolean waitingForResult = false;
26 private static SharedPreferences prefs;
27 private static int slot;
30 protected void onCreate(Bundle savedInstanceState)
32 super.onCreate(savedInstanceState);
33 Log.v(TAG, "Starting");
34 prefs = PreferenceManager.getDefaultSharedPreferences(this);
38 protected void onResume() {
40 setContentView(R.layout.main);
41 TextView tv = (TextView)findViewById(R.id.info);
42 tv.setText(Html.fromHtml(getString(R.string.info)));
43 slot = prefs.getInt("slot_number", -1);
44 Log.v(TAG, "found saved slot value " + slot);
45 RadioButton btn = null;
47 case 1: btn = (RadioButton)findViewById(R.id.slot_1);
49 case 2: btn = (RadioButton)findViewById(R.id.slot_2);
52 if (btn != null) btn.setChecked(true);
55 public void onSlotSelectionClicked(View view) {
56 Log.v(TAG, "Radio Button selected");
57 if (! ((RadioButton) view).isChecked()) return;
58 switch(view.getId()) {
59 case R.id.slot_1: slot=1; break;
60 case R.id.slot_2: slot=2; break;
62 Editor editor = prefs.edit();
63 editor.putInt("slot_number", slot);
65 Log.v(TAG, "stored slot number " + slot);