Commit 9bf8e30f authored by Geoffrey Métais's avatar Geoffrey Métais

Disable predictive animations in videos grid

parent e239c609
......@@ -34,7 +34,7 @@ import org.videolan.vlc.VLCApplication;
public class AutoFitRecyclerView extends ContextMenuRecyclerView {
private GridLayoutManager mGridLayoutManager;
private NpaGridLayoutManager mGridLayoutManager;
private int mColumnWidth = -1;
private int mSpanCount = -1;
......@@ -63,7 +63,7 @@ public class AutoFitRecyclerView extends ContextMenuRecyclerView {
array.recycle();
}
mGridLayoutManager = new GridLayoutManager(getContext(), 1);
mGridLayoutManager = new NpaGridLayoutManager(getContext(), 1);
setLayoutManager(mGridLayoutManager);
}
......@@ -71,7 +71,7 @@ public class AutoFitRecyclerView extends ContextMenuRecyclerView {
protected void onMeasure(int widthSpec, int heightSpec) {
super.onMeasure(widthSpec, heightSpec);
if (mSpanCount == -1 && mColumnWidth > 0) {
int ratio = (int) (getMeasuredWidth() / (mColumnWidth));
int ratio = getMeasuredWidth() / mColumnWidth;
int spanCount = Math.max(1, ratio);
mGridLayoutManager.setSpanCount(spanCount);
} else
......
/*
* ************************************************************************
* NpaGridLayout.java
* *************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
* Author: Geoffrey Métais
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*
* *************************************************************************
*/
package org.videolan.vlc.gui.view;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
public class NpaGridLayoutManager extends GridLayoutManager {
public NpaGridLayoutManager(Context context, int spanCount) {
super(context, spanCount);
}
/*
* Disable predictive animations to prevent a bug on Recyclerview
* AppCompat 23.1.1, may be fixed with AppCompat 24.
*/
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment