use of androidx.recyclerview.widget.LinearLayoutManager in project Timber by naman14.
the class AlbumDetailFragment method onCreateView.
@TargetApi(21)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_album_detail, container, false);
albumArt = (ImageView) rootView.findViewById(R.id.album_art);
artistArt = (ImageView) rootView.findViewById(R.id.artist_art);
albumTitle = (TextView) rootView.findViewById(R.id.album_title);
albumDetails = (TextView) rootView.findViewById(R.id.album_details);
toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
if (getArguments().getBoolean("transition")) {
albumArt.setTransitionName(getArguments().getString("transition_name"));
}
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
recyclerView.setEnabled(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
album = AlbumLoader.getAlbum(getActivity(), albumID);
setAlbumart();
setUpEverything();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
AlbumSongsAdapter adapter = (AlbumSongsAdapter) recyclerView.getAdapter();
MusicPlayer.playAll(getActivity(), adapter.getSongIds(), 0, albumID, TimberUtils.IdType.Album, true);
NavigationUtils.navigateToNowplaying(getActivity(), false);
}
}, 150);
}
});
return rootView;
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Timber by naman14.
the class Timber5 method setupSlidingQueue.
private void setupSlidingQueue() {
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
adapter = new SlidingQueueAdapter((AppCompatActivity) getActivity(), QueueLoader.getQueueSongs(getActivity()));
recyclerView.setAdapter(adapter);
recyclerView.scrollToPosition(MusicPlayer.getQueuePosition() - 3);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Timber by naman14.
the class ArtistMusicFragment method setUpSongs.
private void setUpSongs() {
songsRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
ArrayList<Song> songList;
songList = ArtistSongLoader.getSongsForArtist(getActivity(), artistID);
// adding one dummy song to top of arraylist
// there will be albums header at this position in recyclerview
songList.add(0, new Song(-1, -1, -1, "dummy", "dummy", "dummy", -1, -1));
mSongAdapter = new ArtistSongAdapter(getActivity(), songList, artistID);
songsRecyclerview.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
songsRecyclerview.setAdapter(mSongAdapter);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Timber by naman14.
the class PlaylistDetailActivity method onCreate.
@TargetApi(21)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist_detail);
action = getIntent().getAction();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
playlistsMap.put(Constants.NAVIGATE_PLAYLIST_LASTADDED, playlistLastAdded);
playlistsMap.put(Constants.NAVIGATE_PLAYLIST_RECENT, playlistRecents);
playlistsMap.put(Constants.NAVIGATE_PLAYLIST_TOPTRACKS, playlistToptracks);
playlistsMap.put(Constants.NAVIGATE_PLAYLIST_USERCREATED, playlistUsercreated);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
blurFrame = (ImageView) findViewById(R.id.blurFrame);
playlistname = (TextView) findViewById(R.id.name);
foreground = findViewById(R.id.foreground);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
setAlbumart();
animate = getIntent().getBooleanExtra(Constants.ACTIVITY_TRANSITION, false);
if (animate && TimberUtils.isLollipop()) {
if (savedInstanceState != null && savedInstanceState.containsKey("ROTATION_RECREATION")) {
setUpSongs();
} else {
getWindow().getEnterTransition().addListener(new EnterTransitionListener());
}
} else {
setUpSongs();
}
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Tusky by Vavassor.
the class NotificationsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_timeline_notifications, container, false);
// from inflater to silence warning
@NonNull Context context = inflater.getContext();
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
boolean showNotificationsFilterSetting = preferences.getBoolean("showNotificationsFilter", true);
// Clear notifications on filter visibility change to force refresh
if (showNotificationsFilterSetting != showNotificationsFilter)
notifications.clear();
showNotificationsFilter = showNotificationsFilterSetting;
// Setup the SwipeRefreshLayout.
swipeRefreshLayout = rootView.findViewById(R.id.swipeRefreshLayout);
recyclerView = rootView.findViewById(R.id.recyclerView);
progressBar = rootView.findViewById(R.id.progressBar);
statusView = rootView.findViewById(R.id.statusView);
appBarOptions = rootView.findViewById(R.id.appBarOptions);
swipeRefreshLayout.setOnRefreshListener(this);
swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue);
loadNotificationsFilter();
// Setup the RecyclerView.
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAccessibilityDelegateCompat(new ListStatusAccessibilityDelegate(recyclerView, this, (pos) -> {
NotificationViewData notification = notifications.getPairedItemOrNull(pos);
// We support replies only for now
if (notification instanceof NotificationViewData.Concrete) {
return ((NotificationViewData.Concrete) notification).getStatusViewData();
} else {
return null;
}
}));
recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
StatusDisplayOptions statusDisplayOptions = new StatusDisplayOptions(preferences.getBoolean("animateGifAvatars", false), accountManager.getActiveAccount().getMediaPreviewEnabled(), preferences.getBoolean("absoluteTimeView", false), preferences.getBoolean("showBotOverlay", true), preferences.getBoolean("useBlurhash", true), CardViewMode.NONE, preferences.getBoolean("confirmReblogs", true), preferences.getBoolean("confirmFavourites", false), preferences.getBoolean(PrefKeys.WELLBEING_HIDE_STATS_POSTS, false), preferences.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false));
adapter = new NotificationsAdapter(accountManager.getActiveAccount().getAccountId(), dataSource, statusDisplayOptions, this, this, this);
alwaysShowSensitiveMedia = accountManager.getActiveAccount().getAlwaysShowSensitiveMedia();
alwaysOpenSpoiler = accountManager.getActiveAccount().getAlwaysOpenSpoiler();
recyclerView.setAdapter(adapter);
topLoading = false;
bottomLoading = false;
bottomId = null;
updateAdapter();
Button buttonClear = rootView.findViewById(R.id.buttonClear);
buttonClear.setOnClickListener(v -> confirmClearNotifications());
buttonFilter = rootView.findViewById(R.id.buttonFilter);
buttonFilter.setOnClickListener(v -> showFilterMenu());
if (notifications.isEmpty()) {
swipeRefreshLayout.setEnabled(false);
sendFetchNotificationsRequest(null, null, FetchEnd.BOTTOM, -1);
} else {
progressBar.setVisibility(View.GONE);
}
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
updateFilterVisibility();
return rootView;
}
Aggregations