Java Code Examples for com.pixplicity.easyprefs.library.Prefs#putInt()

The following examples show how to use com.pixplicity.easyprefs.library.Prefs#putInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HomeActivity.java    From tilt-game-android with MIT License 5 votes vote down vote up
@OnClick(R.id.single_player_button)
protected void onSinglePlayerButtonClick() {
    SoundManager.getInstance().play(R.raw.tap);

    GoogleFlipGameApplication.getOrientationProvider(this).start();
    GoogleFlipGameApplication.getUserModel().selectNextLockedLevel();

    Prefs.putInt(PrefKeys.GAME_TYPE, GameType.SINGLE_PLAYER.ordinal());

    Intent intent = new Intent(this, SinglePlayerGameFlowActivity.class);
    intent.putExtra(IntentKeys.FRAGMENT, Fragments.GAME_FLOW_SELECT_LEVEL);
    startActivity(intent);

    overridePendingTransition(R.anim.slide_up_in, R.anim.slide_up_out);
}
 
Example 2
Source File: HomeActivity.java    From tilt-game-android with MIT License 5 votes vote down vote up
@OnClick(R.id.multi_player_button)
protected void onMultiPlayerButtonClick() {
    SoundManager.getInstance().play(R.raw.tap);

    Prefs.putInt(PrefKeys.GAME_TYPE, GameType.MULTI_PLAYER.ordinal());

    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    if (adapter == null) {
        AlertUtils.showAlert(this, R.string.no_bluetooth_message, R.string.no_bluetooth_title, R.string.btn_ok);
    } else if (!adapter.isEnabled()) {
        startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), ActivityRequestCode.REQUEST_ENABLE_BT);
    } else {
        startMultiplayer();
    }
}
 
Example 3
Source File: ConnectClientServerFragment.java    From tilt-game-android with MIT License 5 votes vote down vote up
@OnClick(R.id.btn_start_new_game)
protected void onStartNewGameButtonClick() {
    Prefs.putInt(PrefKeys.MULTIPLAYER_MODE, MultiplayerMode.SERVER.ordinal());

    Intent intent = new Intent(getActivity(), MultiPlayerGameFlowActivity.class);
    intent.putExtra(IntentKeys.FRAGMENT, Fragments.GAME_FLOW_LOBBY);
    startActivity(intent);
}
 
Example 4
Source File: ConnectPlayerNameFragment.java    From tilt-game-android with MIT License 5 votes vote down vote up
@OnClick(R.id.next_button)
protected void onNextButtonClick() {
    String playerName = _playerNameInput.getText().toString().trim();

    if (!TextUtils.isEmpty(playerName)) {
        // store name in preferences
        Prefs.putString(PrefKeys.PLAYER_NAME, playerName);
        Prefs.putInt(PrefKeys.MULTIPLAYER_PROTOCOL, MultiplayerProtocol.BLUETOOTH.ordinal());

        // go to connection selection
        navigateTo(Fragments.CONNECT_CLIENTSERVER);
    } else {
        Toast.makeText(getActivity(), "Please fill in your name", Toast.LENGTH_SHORT).show();
    }
}
 
Example 5
Source File: ConnectClientServerFragment.java    From tilt-game-android with MIT License 4 votes vote down vote up
@OnClick(R.id.btn_join_game)
protected void onJoinGameButtonClick() {
    Prefs.putInt(PrefKeys.MULTIPLAYER_MODE, MultiplayerMode.CLIENT.ordinal());

    navigateTo(Fragments.CONNECT_JOIN_GAME);
}
 
Example 6
Source File: ConnectProtocolFragment.java    From tilt-game-android with MIT License 4 votes vote down vote up
private void goNextScreen(MultiplayerProtocol protocol) {
    Prefs.putInt(PrefKeys.MULTIPLAYER_PROTOCOL, protocol.ordinal());

    navigateTo(Fragments.CONNECT_CLIENTSERVER);
}