use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToAlbum.
@TargetApi(21)
public static void navigateToAlbum(Activity context, long albumID, String albumName, Pair<View, String> transitionViews) {
FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
Fragment fragment;
if (isLollipop() && transitionViews != null) {
Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
transaction.addSharedElement(transitionViews.first, transitionViews.second);
fragment = AlbumDetailFragment.newInstance(albumID, albumName, true, transitionViews.second);
fragment.setSharedElementEnterTransition(changeImage);
fragment.setSharedElementReturnTransition(changeImage);
} else {
transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
fragment = AlbumDetailFragment.newInstance(albumID, albumName, false, null);
}
transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
transaction.add(R.id.fragment_container, fragment);
transaction.addToBackStack(null).commit();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToArtist.
@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, String name, Pair<View, String> transitionViews) {
FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
Fragment fragment;
if (ListenerUtil.isLollipop() && transitionViews != null) {
Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
transaction.addSharedElement(transitionViews.first, transitionViews.second);
fragment = ArtistDetailFragment.newInstance(artistID, name, true, transitionViews.second);
fragment.setSharedElementEnterTransition(changeImage);
fragment.setSharedElementReturnTransition(changeImage);
} else {
transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
fragment = ArtistDetailFragment.newInstance(artistID, name, false, null);
}
transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
transaction.add(R.id.fragment_container, fragment);
transaction.addToBackStack(null).commit();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToFolderSongs.
public static void navigateToFolderSongs(Activity context, String path) {
FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
Fragment fragment = FolderSongsFragment.newInstance(path);
transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
transaction.add(R.id.fragment_container, fragment);
transaction.addToBackStack(null).commit();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
if (Build.VERSION.SDK_INT >= 19) {
int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
view.findViewById(R.id.toolbar).setPadding(0, statusBarHeight, 0, 0);
}
}
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.playlists);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(mAdapter);
setItemDecoration();
mPresenter.subscribe();
subscribePlaylistUpdateEvent();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class AlbumDetailFragment method setupToolbar.
private void setupToolbar() {
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
collapsingToolbarLayout.setTitle(albumName);
}
Aggregations