Search in sources :

Example 1 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project fresco by facebook.

the class DraweeRecyclerViewFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    final RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
    recyclerView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {

        @Override
        public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            final int imageSize = (right - left) / SPAN_COUNT;
            mResizeOptions = new ResizeOptions(imageSize, imageSize);
        }
    });
    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), SPAN_COUNT);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    final SimpleAdapter adapter = new SimpleAdapter(new ArrayList<Uri>());
    recyclerView.setAdapter(adapter);
    final Spinner imageSource = view.findViewById(R.id.spinner_image_source);
    ImageSourceSpinner.INSTANCE.setup(imageSource, sampleUris(), new Function1<List<Uri>, Unit>() {

        @Override
        public Unit invoke(List<Uri> uris) {
            adapter.setData(uris);
            return null;
        }
    });
}
Also used : ImageSourceSpinner(com.facebook.fresco.samples.showcase.misc.ImageSourceSpinner) Spinner(android.widget.Spinner) Unit(kotlin.Unit) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Uri(android.net.Uri) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) RecyclerView(androidx.recyclerview.widget.RecyclerView) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView 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;
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 3 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView 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;
}
Also used : AlbumSongsAdapter(com.naman14.timber.adapters.AlbumSongsAdapter) Handler(android.os.Handler) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) TargetApi(android.annotation.TargetApi)

Example 4 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project Timber by naman14.

the class Timber5 method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_timber5, container, false);
    setMusicStateListener();
    setSongDetails(rootView);
    mBlurredArt = (ImageView) rootView.findViewById(R.id.album_art_blurred);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.queue_recyclerview_horizontal);
    initGestures(mBlurredArt);
    setupSlidingQueue();
    return rootView;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 5 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project Timber by naman14.

the class Timber4 method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_timber4, container, false);
    setMusicStateListener();
    setSongDetails(rootView);
    mBlurredArt = (ImageView) rootView.findViewById(R.id.album_art_blurred);
    horizontalRecyclerview = (RecyclerView) rootView.findViewById(R.id.queue_recyclerview_horizontal);
    setupHorizontalQueue();
    initGestures(mBlurredArt);
    return rootView;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Aggregations

RecyclerView (androidx.recyclerview.widget.RecyclerView)336 View (android.view.View)224 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)146 TextView (android.widget.TextView)51 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)38 ImageView (android.widget.ImageView)29 Nullable (androidx.annotation.Nullable)27 Toolbar (androidx.appcompat.widget.Toolbar)25 Test (org.junit.Test)24 ArrayList (java.util.ArrayList)20 Intent (android.content.Intent)19 NonNull (androidx.annotation.NonNull)19 Bundle (android.os.Bundle)18 ViewGroup (android.view.ViewGroup)16 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)16 Context (android.content.Context)15 Rect (android.graphics.Rect)15 StaggeredGridLayoutManager (androidx.recyclerview.widget.StaggeredGridLayoutManager)14 SuppressLint (android.annotation.SuppressLint)12 LayoutInflater (android.view.LayoutInflater)11