use of android.support.v7.app.AppCompatActivity in project Timber by naman14.
the class MainFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
viewPager.setOffscreenPageLimit(2);
}
TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
return rootView;
}
use of android.support.v7.app.AppCompatActivity in project Timber by naman14.
the class PlaylistFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_playlist, container, false);
Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
pager = (MultiViewPager) rootView.findViewById(R.id.playlistpager);
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.playlists);
playlists = PlaylistLoader.getPlaylists(getActivity(), showAuto);
playlistcount = playlists.size();
if (isDefault) {
initPager();
} else {
initRecyclerView();
}
return rootView;
}
use of android.support.v7.app.AppCompatActivity in project Timber by naman14.
the class SearchAdapter method setOnPopupMenuListener.
private void setOnPopupMenuListener(ItemHolder itemHolder, final int position) {
itemHolder.menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final PopupMenu menu = new PopupMenu(mContext, v);
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
long[] song = new long[1];
song[0] = ((Song) searchResults.get(position)).id;
switch(item.getItemId()) {
case R.id.popup_song_play:
MusicPlayer.playAll(mContext, song, 0, -1, TimberUtils.IdType.NA, false);
break;
case R.id.popup_song_play_next:
MusicPlayer.playNext(mContext, song, -1, TimberUtils.IdType.NA);
break;
case R.id.popup_song_goto_album:
NavigationUtils.navigateToAlbum(mContext, ((Song) searchResults.get(position)).albumId, null);
break;
case R.id.popup_song_goto_artist:
NavigationUtils.navigateToArtist(mContext, ((Song) searchResults.get(position)).artistId, null);
break;
case R.id.popup_song_addto_queue:
MusicPlayer.addToQueue(mContext, song, -1, TimberUtils.IdType.NA);
break;
case R.id.popup_song_addto_playlist:
AddPlaylistDialog.newInstance(((Song) searchResults.get(position))).show(((AppCompatActivity) mContext).getSupportFragmentManager(), "ADD_PLAYLIST");
break;
}
return false;
}
});
menu.inflate(R.menu.popup_song);
menu.show();
}
});
}
use of android.support.v7.app.AppCompatActivity in project Timber by naman14.
the class ArtistDetailFragment method setupToolbar.
private void setupToolbar() {
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayHomeAsUpEnabled(true);
}
use of android.support.v7.app.AppCompatActivity in project Robot-Scouter by SUPERCILEX.
the class ActivityScoutListFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mRootView.findViewById(R.id.toolbar));
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
super.onActivityCreated(savedInstanceState);
}
Aggregations