Ejemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mToken = MusicUtils.bindToService(this, this);
  }
Ejemplo n.º 2
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);
  }