@@ -48,29 +48,12 @@ public class MainActivity extends Activity implements OnItemClickListener, View.
4848 */
4949 public static final String SELECTED_LIST_POSITION = "Selected_List_Position" ;
5050
51- /**
52- * Static String to pass the key for the setting for enabling mouse events to the
53- * savedInstanceState Bundle.
54- */
55- public static final String ENABLE_MOUSE_EVENTS = "Enable_Mouse_Events" ;
56-
57- /**
58- * Static String to pass the key for the setting for enabling joystick events to the
59- * savedInstanceState Bundle.
60- */
61- public static final String ENABLE_JOYSTICK_EVENTS = "Enable_Joystick_Events" ;
62-
63- /**
64- * Static String to pass the key for the setting for enabling key events to the
65- * savedInstanceState Bundle.
66- */
67- public static final String ENABLE_KEY_EVENTS = "Enable_Key_Events" ;
68-
6951 /**
7052 * Static String to pass the key for the setting for verbose logging to the
7153 * savedInstanceState Bundle.
7254 */
7355 public static final String VERBOSE_LOGGING = "Verbose_Logging" ;
56+ public static final boolean DEFAULT_VERBOSE_LOGGING = false ;
7457
7558 /* Fields to contain the current position and display contents of the spinner */
7659 private int currentPosition = 0 ;
@@ -93,10 +76,7 @@ public class MainActivity extends Activity implements OnItemClickListener, View.
9376 EditText editFilterText ;
9477
9578 /* Custom settings for the test app */
96- private boolean enableMouseEvents = true ;
97- private boolean enableJoystickEvents = false ;
98- private boolean enableKeyEvents = true ;
99- private boolean verboseLogging = false ;
79+ private boolean verboseLogging = DEFAULT_VERBOSE_LOGGING ;
10080
10181
10282 /**
@@ -113,10 +93,7 @@ public void onCreate(Bundle savedInstanceState) {
11393 );
11494 currentPosition = savedInstanceState .getInt (SELECTED_LIST_POSITION , 0 );
11595 currentSelection = savedInstanceState .getString (SELECTED_APP_CLASS );
116- enableMouseEvents = savedInstanceState .getBoolean (ENABLE_MOUSE_EVENTS , true );
117- enableJoystickEvents = savedInstanceState .getBoolean (ENABLE_JOYSTICK_EVENTS , false );
118- enableKeyEvents = savedInstanceState .getBoolean (ENABLE_KEY_EVENTS , true );
119- verboseLogging = savedInstanceState .getBoolean (VERBOSE_LOGGING , true );
96+ verboseLogging = savedInstanceState .getBoolean (VERBOSE_LOGGING , DEFAULT_VERBOSE_LOGGING );
12097 }
12198
12299
@@ -224,25 +201,12 @@ public void onClick(View view) {
224201 /* Get selected class, pack it in the intent and start the test app */
225202 Log .d (TAG , "User selected OK for class: " + currentSelection );
226203 Intent intent = new Intent (this , TestActivity .class );
227- // intent.putExtra(SELECTED_APP_CLASS, currentSelection);
228- // intent.putExtra(ENABLE_MOUSE_EVENTS, enableMouseEvents);
229- // intent.putExtra(ENABLE_JOYSTICK_EVENTS, enableJoystickEvents);
230- // intent.putExtra(ENABLE_KEY_EVENTS, enableKeyEvents);
231204
232205 Bundle args = new Bundle ();
233206
234207 args .putString (MainActivity .SELECTED_APP_CLASS , currentSelection );
235208// Log.d(this.getClass().getSimpleName(), "AppClass="+currentSelection);
236209
237- args .putBoolean (MainActivity .ENABLE_MOUSE_EVENTS , enableMouseEvents );
238- // Log.d(TestActivity.class.getSimpleName(), "MouseEnabled="+enableMouseEvents);
239-
240- args .putBoolean (MainActivity .ENABLE_JOYSTICK_EVENTS , enableJoystickEvents );
241- // Log.d(TestActivity.class.getSimpleName(), "JoystickEnabled="+enableJoystickEvents);
242-
243- args .putBoolean (MainActivity .ENABLE_KEY_EVENTS , enableKeyEvents );
244- // Log.d(TestActivity.class.getSimpleName(), "KeyEnabled="+enableKeyEvents);
245-
246210 args .putBoolean (MainActivity .VERBOSE_LOGGING , verboseLogging );
247211// Log.d(TestActivity.class.getSimpleName(), "VerboseLogging="+verboseLogging);
248212
@@ -329,19 +293,13 @@ public void onSaveInstanceState(Bundle savedInstanceState) {
329293 Log .d (TAG , "Saving selections in onSaveInstanceState: "
330294 + "position: " + currentPosition + ", "
331295 + "class: " + currentSelection + ", "
332- + "mouseEvents: " + enableMouseEvents + ", "
333- + "joystickEvents: " + enableJoystickEvents + ", "
334- + "keyEvents: " + enableKeyEvents + ", "
335296 + "VerboseLogging: " + verboseLogging + ", "
336297 );
337298 // Save current selections to the savedInstanceState.
338299 // This bundle will be passed to onCreate if the process is
339300 // killed and restarted.
340301 savedInstanceState .putString (SELECTED_APP_CLASS , currentSelection );
341302 savedInstanceState .putInt (SELECTED_LIST_POSITION , currentPosition );
342- savedInstanceState .putBoolean (ENABLE_MOUSE_EVENTS , enableMouseEvents );
343- savedInstanceState .putBoolean (ENABLE_JOYSTICK_EVENTS , enableJoystickEvents );
344- savedInstanceState .putBoolean (ENABLE_KEY_EVENTS , enableKeyEvents );
345303 savedInstanceState .putBoolean (VERBOSE_LOGGING , verboseLogging );
346304 }
347305
@@ -388,36 +346,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
388346 public boolean onPrepareOptionsMenu (Menu menu ) {
389347 MenuItem item ;
390348
391- item = menu .findItem (R .id .optionMouseEvents );
392- if (item != null ) {
393- Log .d (TAG , "Found EnableMouseEvents menu item" );
394- if (enableMouseEvents ) {
395- item .setTitle (R .string .strOptionDisableMouseEventsTitle );
396- } else {
397- item .setTitle (R .string .strOptionEnableMouseEventsTitle );
398- }
399- }
400-
401- item = menu .findItem (R .id .optionJoystickEvents );
402- if (item != null ) {
403- Log .d (TAG , "Found EnableJoystickEvents menu item" );
404- if (enableJoystickEvents ) {
405- item .setTitle (R .string .strOptionDisableJoystickEventsTitle );
406- } else {
407- item .setTitle (R .string .strOptionEnableJoystickEventsTitle );
408- }
409- }
410-
411- item = menu .findItem (R .id .optionKeyEvents );
412- if (item != null ) {
413- Log .d (TAG , "Found EnableKeyEvents menu item" );
414- if (enableKeyEvents ) {
415- item .setTitle (R .string .strOptionDisableKeyEventsTitle );
416- } else {
417- item .setTitle (R .string .strOptionEnableKeyEventsTitle );
418- }
419- }
420-
421349 item = menu .findItem (R .id .optionVerboseLogging );
422350 if (item != null ) {
423351 Log .d (TAG , "Found EnableVerboseLogging menu item" );
@@ -434,16 +362,7 @@ public boolean onPrepareOptionsMenu (Menu menu) {
434362 @ Override
435363 public boolean onOptionsItemSelected (MenuItem item ) {
436364 int itemId = item .getItemId ();
437- if (itemId == R .id .optionMouseEvents ) {
438- enableMouseEvents = !enableMouseEvents ;
439- Log .d (TAG , "enableMouseEvents set to: " + enableMouseEvents );
440- } else if (itemId == R .id .optionJoystickEvents ) {
441- enableJoystickEvents = !enableJoystickEvents ;
442- Log .d (TAG , "enableJoystickEvents set to: " + enableJoystickEvents );
443- } else if (itemId == R .id .optionKeyEvents ) {
444- enableKeyEvents = !enableKeyEvents ;
445- Log .d (TAG , "enableKeyEvents set to: " + enableKeyEvents );
446- } else if (itemId == R .id .optionVerboseLogging ) {
365+ if (itemId == R .id .optionVerboseLogging ) {
447366 verboseLogging = !verboseLogging ;
448367 Log .d (TAG , "verboseLogging set to: " + verboseLogging );
449368 } else {
0 commit comments