Search in sources :

Example 26 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.

the class DetailFragment method onOverflowClick.

@Override
public void onOverflowClick(View v, int position, Object item) {
    PopupMenu menu = new PopupMenu(getActivity(), v);
    MenuUtils.addAlbumMenuOptions(getActivity(), menu);
    MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, (Album) item);
    menu.show();
}
Also used : PopupMenu(android.support.v7.widget.PopupMenu)

Example 27 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.

the class PlayqueueDialog method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    injectDependences();
    mPresenter.attachView(this);
    mAdapter = new PlayqueueSongsAdapter((AppCompatActivity) getActivity(), null);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) PlayqueueSongsAdapter(io.hefuyi.listener.ui.adapter.PlayqueueSongsAdapter)

Example 28 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.

the class ArtistDetailFragment method setupToolbar.

private void setupToolbar() {
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    collapsingToolbarLayout.setTitle(artistName);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Example 29 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.

the class PlaylistDetailFragment method setupToolbar.

private void setupToolbar() {
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    collapsingToolbarLayout.setTitle(playlistName);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Example 30 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.

the class ListenerUtil method showAddPlaylistDialog.

public static void showAddPlaylistDialog(final Context context, final long[] songIds) {
    PlaylistLoader.getPlaylists(context, true).map(new Func1<List<Playlist>, Dialog>() {

        @Override
        public Dialog call(final List<Playlist> playlists) {
            final CharSequence[] chars = new CharSequence[playlists.size() + 1];
            chars[0] = context.getResources().getString(R.string.create_new_playlist);
            for (int i = 0; i < playlists.size(); i++) {
                chars[i + 1] = playlists.get(i).name;
            }
            return new MaterialDialog.Builder(context).title(R.string.add_to_playlist).items(chars).itemsCallback(new MaterialDialog.ListCallback() {

                @Override
                public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
                    if (which == 0) {
                        CreatePlaylistDialog.newInstance(songIds).show(((AppCompatActivity) context).getSupportFragmentManager(), context.getString(R.string.create_new_playlist));
                        return;
                    } else if (which == 1) {
                        //我喜欢
                        int num = FavoriteSong.getInstance(context).addFavoriteSong(songIds);
                        Toast.makeText(getContext(), R.string.add_favorite_success, Toast.LENGTH_SHORT).show();
                        RxBus.getInstance().post(new FavourateSongEvent());
                        dialog.dismiss();
                        return;
                    }
                    MusicPlayer.addToPlaylist(context, songIds, playlists.get(which - 1).id);
                    RxBus.getInstance().post(new PlaylistUpdateEvent());
                    dialog.dismiss();
                }
            }).build();
        }
    }).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Dialog>() {

        @Override
        public void call(Dialog dialog) {
            dialog.show();
        }
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) FavourateSongEvent(io.hefuyi.listener.event.FavourateSongEvent) AppCompatActivity(android.support.v7.app.AppCompatActivity) View(android.view.View) Playlist(io.hefuyi.listener.mvp.model.Playlist) PlaylistUpdateEvent(io.hefuyi.listener.event.PlaylistUpdateEvent) CreatePlaylistDialog(io.hefuyi.listener.ui.dialogs.CreatePlaylistDialog) Dialog(android.app.Dialog) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) List(java.util.List)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)85 View (android.view.View)36 ActionBar (android.support.v7.app.ActionBar)32 TextView (android.widget.TextView)22 RecyclerView (android.support.v7.widget.RecyclerView)18 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 ImageView (android.widget.ImageView)16 Toolbar (android.support.v7.widget.Toolbar)12 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 Transition (android.transition.Transition)6 MenuItem (android.view.MenuItem)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 FragmentManager (android.support.v4.app.FragmentManager)4 PopupMenu (android.widget.PopupMenu)4 BindView (butterknife.BindView)4