コード例 #1
0
  @Override
  protected void onResume() {
    super.onResume();

    refreshPeersFragment();

    initializeAppia();
    initializeOffercast();

    if (ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_GUI_TOS_ACCEPTED)) {
      if (ConfigurationManager.instance()
          .getBoolean(Constants.PREF_KEY_GUI_INITIAL_SETTINGS_COMPLETE)) {
        mainResume();
      } else {
        controller.startWizardActivity();
      }
    } else {
      trackDialog(
          TOS.showEula(
              this,
              new OnTOSAcceptListener() {
                public void onAccept() {
                  controller.startWizardActivity();
                }
              }));
    }

    checkLastSeenVersion();
  }
コード例 #2
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   if (outState != null) {
     super.onSaveInstanceState(outState);
     saveLastFragment(outState);
     saveFragmentsStack(outState);
   }
 }
コード例 #3
0
  @Override
  protected void onPause() {
    super.onPause();

    search.dismissDialogs();
    library.dismissDialogs();
    peers.dismissDialogs();
  }
コード例 #4
0
  @Override
  protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    saveLastFragment(outState);
    saveFragmentsStack(outState);

    outState.putString(DUR_TOKEN_KEY, durToken);
    outState.putBoolean(APPIA_STARTED_KEY, appiaStarted);
  }
コード例 #5
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    // avoid memory leaks when the device is tilted and the menu gets recreated.
    SoftwareUpdater.instance().removeConfigurationUpdateListener(this);

    if (playerItem != null) {
      playerItem.unbindDrawables();
    }
  }
コード例 #6
0
  @Override
  protected void onPause() {
    super.onPause();

    if (mainBroadcastReceiver != null) {
      try {
        unregisterReceiver(mainBroadcastReceiver);
      } catch (Throwable t) {
        // oh well (the api doesn't provide a way to know if it's been registered before,
        // seems like overkill keeping track of these ourselves.)
      }
    }
  }
コード例 #7
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (playerSubscription != null) {
      playerSubscription.unsubscribe();
    }

    // avoid memory leaks when the device is tilted and the menu gets recreated.
    SoftwareUpdater.instance().removeConfigurationUpdateListener(this);

    if (playerItem != null) {
      playerItem.unbindDrawables();
    }

    if (mToken != null) {
      MusicUtils.unbindFromService(mToken);
      mToken = null;
    }
  }
コード例 #8
0
  @Override
  protected void onResume() {
    super.onResume();

    refreshPlayerItem();

    if (ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_GUI_TOS_ACCEPTED)) {
      if (ConfigurationManager.instance()
          .getBoolean(Constants.PREF_KEY_GUI_INITIAL_SETTINGS_COMPLETE)) {
        mainResume();
        Offers.initAdNetworks(this);
      } else {
        controller.startWizardActivity();
      }
    } else {
      TermsUseDialog dlg = new TermsUseDialog();
      dlg.show(getFragmentManager());
    }

    checkLastSeenVersion();
    registerMainBroadcastReceiver();
  }
コード例 #9
0
 @Override
 protected void onPostCreate(Bundle savedInstanceState) {
   super.onPostCreate(savedInstanceState);
   drawerToggle.syncState();
 }
コード例 #10
0
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   drawerToggle.onConfigurationChanged(newConfig);
 }
コード例 #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mToken = MusicUtils.bindToService(this, this);
  }
コード例 #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    drawerLayout = findView(R.id.drawer_layout);
    drawerLayout.setDrawerListener(
        new SimpleDrawerListener() {
          @Override
          public void onDrawerStateChanged(int newState) {
            refreshPlayerItem();
            syncSlideMenu();
          }

          @Override
          public void onDrawerSlide(View drawerView, float slideOffset) {
            if (slideOffset > 0) {
              buttonMainMenu.setImageResource(R.drawable.main_menu_button_icon_selected);
            } else {
              buttonMainMenu.setImageResource(R.drawable.main_menu_button_icon);
            }
          }

          @Override
          public void onDrawerOpened(View drawerView) {
            buttonMainMenu.setImageResource(R.drawable.main_menu_button_icon_selected);
          }

          @Override
          public void onDrawerClosed(View drawerView) {
            buttonMainMenu.setImageResource(R.drawable.main_menu_button_icon);
          }
        });

    leftDrawer = findView(R.id.activity_main_left_drawer);
    listMenu = findView(R.id.left_drawer);

    playerItem = findView(R.id.slidemenu_player_menuitem);
    playerItem.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            controller.launchPlayerActivity();
          }
        });

    buttonMainMenu = findView(R.id.activity_main_button_menu);
    buttonMainMenu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            toggleDrawer();
          }
        });

    setupFragments();

    setupInitialFragment(savedInstanceState);

    setupMenuItems();

    if (savedInstanceState != null) {
      durToken = savedInstanceState.getString(DUR_TOKEN_KEY);
      appiaStarted = savedInstanceState.getBoolean(APPIA_STARTED_KEY);
    }

    addRefreshable((Refreshable) findView(R.id.activity_main_player_notifier));

    onNewIntent(getIntent());

    SoftwareUpdater.instance().addConfigurationUpdateListener(this);
  }