use of com.simplecity.amp_library.ui.fragments.DetailFragment in project Shuttle by timusus.
the class MainActivity method swapFragments.
public void swapFragments(Serializable item, View transitionView) {
String transitionName = ViewCompat.getTransitionName(transitionView);
DetailFragment detailFragment = DetailFragment.newInstance(item, transitionName);
if (ShuttleUtils.hasLollipop()) {
Transition moveTransition = TransitionInflater.from(this).inflateTransition(R.transition.image_transition);
detailFragment.setSharedElementEnterTransition(moveTransition);
detailFragment.setEnterTransition(new Fade());
getCurrentFragment().setExitTransition(new Fade());
}
getSupportFragmentManager().beginTransaction().addSharedElement(transitionView, transitionName).replace(R.id.main_container, detailFragment).addToBackStack(null).commit();
}
use of com.simplecity.amp_library.ui.fragments.DetailFragment in project Shuttle by timusus.
the class MainActivity method onPrepareOptionsMenu.
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
PlaylistUtils.isFavorite(this, MusicUtils.getSong()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(isFavorite -> {
if (isFavorite) {
final MenuItem favItem = menu.findItem(R.id.menu_favorite);
int[] attrs = new int[] { R.attr.btn_fav_pressed };
TypedArray ta = obtainStyledAttributes(attrs);
if (ta != null) {
Drawable drawableFromTheme = ta.getDrawable(0);
ta.recycle();
if (favItem != null) {
favItem.setIcon(drawableFromTheme);
}
}
}
});
MenuItem whiteListItem = menu.findItem(R.id.whitelist);
MenuItem sortingItem = menu.findItem(R.id.sort);
MenuItem viewAsItem = menu.findItem(R.id.view_as);
if (mSlidingUpPanelLayout == null || !mIsSlidingEnabled || mSlidingUpPanelLayout.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
if (whiteListItem != null) {
whiteListItem.setVisible(true);
}
if (sortingItem != null) {
sortingItem.setVisible(true);
}
if (viewAsItem != null) {
viewAsItem.setVisible(true);
}
} else {
if (whiteListItem != null) {
whiteListItem.setVisible(false);
}
if (sortingItem != null) {
sortingItem.setVisible(false);
}
if (viewAsItem != null) {
viewAsItem.setVisible(false);
}
}
if (getCurrentFragment() instanceof DetailFragment) {
if (sortingItem != null) {
sortingItem.setVisible(false);
}
}
return super.onPrepareOptionsMenu(menu);
}
Aggregations