Пример #1
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    // Only show favourites and access tokens (DB-related) if the connected server has a DB
    // representation (non-public).
    MenuItem fullscreenItem = menu.findItem(R.id.menu_fullscreen);
    MenuItem favouritesViewItem = menu.findItem(R.id.menu_view_favorites_button);
    MenuItem accessTokensItem = menu.findItem(R.id.menu_access_tokens_button);

    userRegisterItem = menu.findItem(R.id.menu_user_register);
    userCommentItem = menu.findItem(R.id.menu_user_comment);
    userInformationItem = menu.findItem(R.id.menu_user_information);

    if (mService != null && mService.getConnectedServer() != null) {

      favouritesViewItem.setVisible(!mService.isConnectedServerPublic());
      accessTokensItem.setVisible(!mService.isConnectedServerPublic());
    }

    fullscreenItem.setVisible(mViewPager == null); // Only show fullscreen option if in tablet mode

    // Show whether or not SCO is enabled
    AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
    bluetoothItem = menu.findItem(R.id.menu_bluetooth);
    bluetoothItem.setChecked(audioManager.isBluetoothScoOn());

    return super.onPrepareOptionsMenu(menu);
  }
Пример #2
0
 @Override
 public void deleteToken(String string) {
   mService.getDatabaseAdapter().deleteToken(mService.getConnectedServer().getId(), string);
 };
Пример #3
0
 @Override
 public List<String> getTokens() {
   return mService.getDatabaseAdapter().fetchAllTokens(mService.getConnectedServer().getId());
 }