예제 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(this);
    state = getSharedPreferences(STATE_PREFS_NAME, MODE_PRIVATE);
    prefsSaver = PrefsSaver.get(this);
    games = getResources().getStringArray(R.array.games);
    gameTypes = new LinkedHashMap<Integer, String>();

    applyFullscreen(false); // must precede super.onCreate and setContentView
    cachedFullscreen = startedFullscreen = prefs.getBoolean(FULLSCREEN_KEY, false);
    applyStayAwake();
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mainLayout = (RelativeLayout) findViewById(R.id.mainLayout);
    statusBar = (TextView) findViewById(R.id.statusBar);
    gameView = (GameView) findViewById(R.id.game);
    keyboard = (SmallKeyboard) findViewById(R.id.keyboard);
    actionBarCompat = ActionBarCompat.get(this);
    try {
      actionBarHomeId = android.R.id.class.getField("home").getInt(null);
    } catch (Exception e) {
    }
    setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
    gameView.requestFocus();
    onNewIntent(getIntent());
  }
예제 #2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   prefsSaver = PrefsSaver.get(this);
   addPreferencesFromResource(R.xml.preferences);
   updateSummary((ListPreference) findPreference(SGTPuzzles.ARROW_KEYS_KEY));
   if (ActionBarCompat.get(this) != null) {
     getPreferenceScreen().removePreference(findPreference("gameChooser"));
   } else {
     updateSummary((ListPreference) findPreference(GameChooser.CHOOSER_STYLE_KEY));
   }
 }