Search in sources :

Example 66 with AppCompatActivity

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();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Transition(android.transition.Transition) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlaylistDetailFragment(io.hefuyi.listener.ui.fragment.PlaylistDetailFragment) ArtistDetailFragment(io.hefuyi.listener.ui.fragment.ArtistDetailFragment) Fragment(android.support.v4.app.Fragment) FolderSongsFragment(io.hefuyi.listener.ui.fragment.FolderSongsFragment) AlbumDetailFragment(io.hefuyi.listener.ui.fragment.AlbumDetailFragment) TargetApi(android.annotation.TargetApi)

Example 67 with AppCompatActivity

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();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Transition(android.transition.Transition) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlaylistDetailFragment(io.hefuyi.listener.ui.fragment.PlaylistDetailFragment) ArtistDetailFragment(io.hefuyi.listener.ui.fragment.ArtistDetailFragment) Fragment(android.support.v4.app.Fragment) FolderSongsFragment(io.hefuyi.listener.ui.fragment.FolderSongsFragment) AlbumDetailFragment(io.hefuyi.listener.ui.fragment.AlbumDetailFragment) TargetApi(android.annotation.TargetApi)

Example 68 with AppCompatActivity

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();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlaylistDetailFragment(io.hefuyi.listener.ui.fragment.PlaylistDetailFragment) ArtistDetailFragment(io.hefuyi.listener.ui.fragment.ArtistDetailFragment) Fragment(android.support.v4.app.Fragment) FolderSongsFragment(io.hefuyi.listener.ui.fragment.FolderSongsFragment) AlbumDetailFragment(io.hefuyi.listener.ui.fragment.AlbumDetailFragment)

Example 69 with AppCompatActivity

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();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Example 70 with AppCompatActivity

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);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)99 View (android.view.View)43 ActionBar (android.support.v7.app.ActionBar)36 TextView (android.widget.TextView)28 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)17 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 Toolbar (android.support.v7.widget.Toolbar)14 BindView (butterknife.BindView)11 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Transition (android.transition.Transition)7 MenuItem (android.view.MenuItem)7 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 Bundle (android.os.Bundle)4 FragmentManager (android.support.v4.app.FragmentManager)4