mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
flickering fixed (#4095)
This commit is contained in:
parent
9e92c95d42
commit
ae18b24e92
2 changed files with 12 additions and 0 deletions
|
|
@ -69,6 +69,9 @@ public class ContributionViewHolder extends RecyclerView.ViewHolder {
|
|||
titleView.setText(contribution.getMedia().getMostRelevantCaption());
|
||||
authorView.setText(contribution.getMedia().getAuthor());
|
||||
|
||||
//Removes flicker of loading image.
|
||||
imageView.getHierarchy().setFadeDuration(0);
|
||||
|
||||
imageView.getHierarchy().setPlaceholderImage(R.drawable.image_placeholder);
|
||||
imageView.getHierarchy().setFailureImage(R.drawable.image_placeholder);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import androidx.fragment.app.FragmentManager;
|
|||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
||||
import androidx.recyclerview.widget.RecyclerView.ItemAnimator;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
|
@ -133,6 +135,13 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl
|
|||
final GridLayoutManager layoutManager = new GridLayoutManager(getContext(),
|
||||
getSpanCount(getResources().getConfiguration().orientation));
|
||||
rvContributionsList.setLayoutManager(layoutManager);
|
||||
|
||||
//Setting flicker animation of recycler view to false.
|
||||
final ItemAnimator animator = rvContributionsList.getItemAnimator();
|
||||
if (animator instanceof SimpleItemAnimator) {
|
||||
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
|
||||
}
|
||||
|
||||
contributionsListPresenter.setup();
|
||||
contributionsListPresenter.contributionList.observe(this.getViewLifecycleOwner(), adapter::submitList);
|
||||
rvContributionsList.setAdapter(adapter);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue