@Override protected void initComponents(Bundle savedInstanceState) { if (isShutdown(getIntent())) { return; } 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) {} @Override public void onDrawerOpened(View drawerView) {} @Override public void onDrawerClosed(View drawerView) {} }); 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(); } }); setupFragments(); setupMenuItems(); setupInitialFragment(savedInstanceState); playerSubscription = TimerService.subscribe((TimerObserver) findView(R.id.activity_main_player_notifier), 1); onNewIntent(getIntent()); SoftwareUpdater.instance().addConfigurationUpdateListener(this); setupActionBar(); setupDrawer(); // PlaybackService.get(this); }
@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); }