use of com.simplecity.amp_library.ui.fragments.QueuePagerFragment in project Shuttle by timusus.
the class MainActivity method onServiceConnected.
@Override
public void onServiceConnected(ComponentName name, IBinder obj) {
super.onServiceConnected(name, obj);
supportInvalidateOptionsMenu();
if (mIsSlidingEnabled) {
PlayerFragment playerFragment = (PlayerFragment) getSupportFragmentManager().findFragmentById(R.id.player_container);
if (playerFragment != null) {
playerFragment.update();
// If the QueuePagerFragment's adapter is empty, it's because it was created before the service
// was connected. We need to recreate it now that we know the service is connected.
Fragment fragment = playerFragment.getChildFragmentManager().findFragmentById(R.id.main_container);
if (fragment instanceof QueueFragment) {
((QueueFragment) fragment).scrollToCurrentItem();
} else if (fragment instanceof QueuePagerFragment) {
((QueuePagerFragment) fragment).resetAdapter();
((QueuePagerFragment) fragment).updateQueuePosition();
}
}
}
handlePendingPlaybackRequest();
togglePanelVisibility(!(MusicServiceConnectionUtils.sServiceBinder == null || MusicUtils.getSongId() == -1));
}
use of com.simplecity.amp_library.ui.fragments.QueuePagerFragment in project Shuttle by timusus.
the class PlayerActivity method onServiceConnected.
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
super.onServiceConnected(componentName, iBinder);
updateTrackInfo();
setPauseButtonImage();
QueuePagerFragment queuePagerFragment = (QueuePagerFragment) getSupportFragmentManager().findFragmentByTag(QUEUE_PAGER_FRAGMENT);
if (queuePagerFragment != null) {
queuePagerFragment.resetAdapter();
queuePagerFragment.updateQueuePosition();
}
}
use of com.simplecity.amp_library.ui.fragments.QueuePagerFragment in project Shuttle by timusus.
the class PlayerActivity method onCreate.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle savedInstanceState) {
ThemeUtils.setTheme(this);
if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
getWindow().setFlags(FLAG_TRANSLUCENT_STATUS, FLAG_TRANSLUCENT_STATUS);
}
if (ShuttleUtils.hasLollipop()) {
if (!ShuttleUtils.hasKitKat()) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
} else {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
}
if (SettingsManager.getInstance().canTintNavBar()) {
getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle(null);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ThemeUtils.themeActionBar(this);
ThemeUtils.themeStatusBar(this, null);
if (!ShuttleUtils.isTablet() && ShuttleUtils.isLandscape()) {
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ColorUtils.getPrimaryColor()));
} else {
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.parseColor("#20000000")));
}
mTimeHandler = new TimeHandler(this);
mTrack = (TextView) findViewById(R.id.text1);
mAlbum = (TextView) findViewById(R.id.text2);
mArtist = (TextView) findViewById(R.id.text3);
mCurrentTime = (TextView) findViewById(R.id.current_time);
mTotalTime = (TextView) findViewById(R.id.total_time);
mQueuePosition = (TextView) findViewById(R.id.queue_position);
mQueuePosition = (TextView) findViewById(R.id.queue_position);
mPauseButton = (ImageButton) findViewById(R.id.play);
mPauseButton.setOnClickListener(this);
mNextButton = (RepeatingImageButton) findViewById(R.id.next);
mNextButton.setOnClickListener(this);
mNextButton.setRepeatListener(mFastForwardListener);
mPrevButton = (RepeatingImageButton) findViewById(R.id.prev);
mPrevButton.setOnClickListener(this);
mPrevButton.setRepeatListener(mRewindListener);
mRepeatButton = (ImageButton) findViewById(R.id.repeat);
mRepeatButton.setOnClickListener(this);
mShuffleButton = (ImageButton) findViewById(R.id.shuffle);
mShuffleButton.setOnClickListener(this);
mTextViewContainer = findViewById(R.id.textContainer);
mButtonContainer = findViewById(R.id.button_container);
mSeekBar = (SizableSeekBar) findViewById(R.id.seekbar);
mSeekBar.setMax(1000);
mSeekBar.setOnSeekBarChangeListener(this);
mBackgroundImage = (ImageView) findViewById(R.id.background);
themeUIComponents();
if (savedInstanceState == null) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.abc_fade_in, R.anim.abc_fade_out);
ft.replace(R.id.main_container, new QueuePagerFragment(), QUEUE_PAGER_FRAGMENT);
if (ShuttleUtils.isTablet()) {
ft.replace(R.id.queue_container, QueueFragment.newInstance(), QUEUE_FRAGMENT);
}
ft.commit();
}
Glide.with(this).load(MusicUtils.getAlbumArtist()).diskCacheStrategy(DiskCacheStrategy.ALL).bitmapTransform(new BlurTransformation(this)).override(500, 500).into(mBackgroundImage);
}
Aggregations