/[projects]/android/Side9/src/dk/thoerup/side9/Side9Config.java
ViewVC logotype

Diff of /android/Side9/src/dk/thoerup/side9/Side9Config.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 778 by torben, Tue Jun 1 09:14:19 2010 UTC revision 857 by torben, Wed Jun 16 07:51:40 2010 UTC
# Line 18  import android.widget.Spinner; Line 18  import android.widget.Spinner;
18  public class Side9Config extends Activity {  public class Side9Config extends Activity {
19          int mAppWidgetId;          int mAppWidgetId;
20                    
21            public final static String PREFS_SAVEIMAGE = "saveimage";
22            public final static String PREFS_SHOWCAPTION = "showcaption";
23            public final static String PREFS_ONTOUCH = "ontouch";
24            
25            
26            
27          @Override          @Override
28          public void onCreate(Bundle savedInstanceState) {          public void onCreate(Bundle savedInstanceState) {
29                  super.onCreate(savedInstanceState);                  super.onCreate(savedInstanceState);
# Line 39  public class Side9Config extends Activit Line 45  public class Side9Config extends Activit
45                  okBtn.setOnClickListener( okListener );                  okBtn.setOnClickListener( okListener );
46                                    
47                  CheckBox savetosd = (CheckBox) findViewById(R.id.savetosd);                  CheckBox savetosd = (CheckBox) findViewById(R.id.savetosd);
48                  boolean save = prefs.getBoolean("saveimage", false);                  boolean save = prefs.getBoolean(PREFS_SAVEIMAGE, false);
49                  savetosd.setChecked(save);                                savetosd.setChecked(save);
50                    
51                    CheckBox showcaption = (CheckBox) findViewById(R.id.showcaption);
52                    boolean show = prefs.getBoolean(PREFS_SHOWCAPTION, false);
53                    showcaption.setChecked(show);
54                    
55                                    
56                  Spinner ontouch = (Spinner) findViewById(R.id.ontouch);                                          Spinner ontouch = (Spinner) findViewById(R.id.ontouch);                        
57                  ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(this, R.array.ontouchtargets, android.R.layout.simple_spinner_item);                  ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(this, R.array.ontouchtargets, android.R.layout.simple_spinner_item);
# Line 48  public class Side9Config extends Activit Line 59  public class Side9Config extends Activit
59                                    
60                  ontouch.setAdapter(adapter);                  ontouch.setAdapter(adapter);
61    
62                  int ontouchsel = prefs.getInt("ontouch", 0);                  int ontouchsel = prefs.getInt(PREFS_ONTOUCH, 0);
63                  ontouch.setSelection(ontouchsel);                  ontouch.setSelection(ontouchsel);
64                                    
65          }          }
# Line 71  public class Side9Config extends Activit Line 82  public class Side9Config extends Activit
82                                                    
83                          CheckBox savetosd = (CheckBox) findViewById(R.id.savetosd);                          CheckBox savetosd = (CheckBox) findViewById(R.id.savetosd);
84                          boolean save = savetosd.isChecked();                          boolean save = savetosd.isChecked();
85                            
86                            CheckBox showcaption = (CheckBox) findViewById(R.id.showcaption);
87                            boolean show = showcaption.isChecked();
88    
89                          Spinner ontouch = (Spinner) findViewById(R.id.ontouch);                          Spinner ontouch = (Spinner) findViewById(R.id.ontouch);
90                          int ontouchsel = ontouch.getSelectedItemPosition();                          int ontouchsel = ontouch.getSelectedItemPosition();
# Line 78  public class Side9Config extends Activit Line 92  public class Side9Config extends Activit
92                          SharedPreferences prefs = getSharedPreferences(Side9WidgetProvider.TAG, Context.MODE_PRIVATE);                          SharedPreferences prefs = getSharedPreferences(Side9WidgetProvider.TAG, Context.MODE_PRIVATE);
93                                                    
94                          Editor edit = prefs.edit();                          Editor edit = prefs.edit();
95                          edit.putBoolean("saveimage", save);                          edit.putBoolean(PREFS_SAVEIMAGE, save);
96                          edit.putInt("ontouch", ontouchsel);                          edit.putBoolean(PREFS_SHOWCAPTION, show);
97                            edit.putInt(PREFS_ONTOUCH, ontouchsel);
98                          edit.commit();                          edit.commit();
99                                                    
100                          Intent resultValue = new Intent();                          Intent resultValue = new Intent();

Legend:
Removed from v.778  
changed lines
  Added in v.857

  ViewVC Help
Powered by ViewVC 1.1.20