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();
}
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);
}
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);
}
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);
}
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();
}
});
}
Aggregations