Пример #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());
  }