Search in sources :

Example 1 with LandingAnimator

use of jp.wasabeef.recyclerview.animators.LandingAnimator in project LeafPic by HoraApps.

the class AlbumsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_albums, container, false);
    ButterKnife.bind(this, v);
    int spanCount = columnsCount();
    spacingDecoration = new GridSpacingItemDecoration(spanCount, Measure.pxToDp(3, getContext()), true);
    rv.setHasFixedSize(true);
    rv.addItemDecoration(spacingDecoration);
    rv.setLayoutManager(new GridLayoutManager(getContext(), spanCount));
    if (Prefs.animationsEnabled()) {
        rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
    }
    adapter = new AlbumsAdapter(getContext(), this);
    refresh.setOnRefreshListener(this::displayAlbums);
    rv.setAdapter(adapter);
    return v;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) OvershootInterpolator(android.view.animation.OvershootInterpolator) AlbumsAdapter(org.horaapps.leafpic.adapters.AlbumsAdapter) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) BindView(butterknife.BindView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) GridSpacingItemDecoration(org.horaapps.leafpic.views.GridSpacingItemDecoration) Nullable(android.support.annotation.Nullable)

Example 2 with LandingAnimator

use of jp.wasabeef.recyclerview.animators.LandingAnimator in project LeafPic by HoraApps.

the class RvMediaFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_rv_media, container, false);
    ButterKnife.bind(this, v);
    int spanCount = columnsCount();
    spacingDecoration = new GridSpacingItemDecoration(spanCount, Measure.pxToDp(3, getContext()), true);
    rv.setHasFixedSize(true);
    rv.addItemDecoration(spacingDecoration);
    rv.setLayoutManager(new GridLayoutManager(getContext(), spanCount));
    rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
    adapter = new MediaAdapter(getContext(), album.settings.getSortingMode(), album.settings.getSortingOrder(), this);
    refresh.setOnRefreshListener(this::reload);
    rv.setAdapter(adapter);
    return v;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) OvershootInterpolator(android.view.animation.OvershootInterpolator) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) MediaAdapter(org.horaapps.leafpic.adapters.MediaAdapter) BindView(butterknife.BindView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) GridSpacingItemDecoration(org.horaapps.leafpic.views.GridSpacingItemDecoration) Nullable(android.support.annotation.Nullable)

Example 3 with LandingAnimator

use of jp.wasabeef.recyclerview.animators.LandingAnimator in project LeafPic by HoraApps.

the class AlertDialogsHelper method getProgressDialogWithErrors.

public static AlertDialog getProgressDialogWithErrors(ThemedActivity activity, @StringRes int title, ProgressAdapter adapter, int max) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity, activity.getDialogStyle());
    View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_list_progress, null);
    final int[] progress = { 0 };
    TextView dialogTitle = dialogLayout.findViewById(R.id.text_dialog_title);
    TextView progressMessage = dialogLayout.findViewById(R.id.name_folder);
    ((ProgressBar) dialogLayout.findViewById(org.horaapps.leafpic.R.id.progress_dialog_loading)).getIndeterminateDrawable().setColorFilter(activity.getPrimaryColor(), android.graphics.PorterDuff.Mode.SRC_ATOP);
    adapter.setListener(item -> {
        progress[0]++;
        dialogTitle.setText(activity.getString(title, progress[0], max));
        progressMessage.setText(item.getName());
    });
    RecyclerView rv = dialogLayout.findViewById(R.id.rv_progress);
    rv.setLayoutManager(new LinearLayoutManager(activity));
    rv.setHasFixedSize(true);
    rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
    rv.setAdapter(adapter);
    ((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.message_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    dialogTitle.setText(activity.getString(title, progress[0], max));
    builder.setView(dialogLayout);
    return builder.create();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OvershootInterpolator(android.view.animation.OvershootInterpolator) CardView(android.support.v7.widget.CardView) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView)

Example 4 with LandingAnimator

use of jp.wasabeef.recyclerview.animators.LandingAnimator in project LeafPic by HoraApps.

the class BlackWhiteListActivity method initUi.

private void initUi() {
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setAdapter((adapter = new ItemsAdapter()));
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 1));
    mRecyclerView.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) OvershootInterpolator(android.view.animation.OvershootInterpolator) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Aggregations

CardView (android.support.v7.widget.CardView)4 RecyclerView (android.support.v7.widget.RecyclerView)4 View (android.view.View)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 TextView (android.widget.TextView)4 LandingAnimator (jp.wasabeef.recyclerview.animators.LandingAnimator)4 GridLayoutManager (android.support.v7.widget.GridLayoutManager)3 Nullable (android.support.annotation.Nullable)2 BindView (butterknife.BindView)2 GridSpacingItemDecoration (org.horaapps.leafpic.views.GridSpacingItemDecoration)2 AlertDialog (android.support.v7.app.AlertDialog)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 AlbumsAdapter (org.horaapps.leafpic.adapters.AlbumsAdapter)1 MediaAdapter (org.horaapps.leafpic.adapters.MediaAdapter)1