Commit aaa57fa1 authored by Grigory Fedorov's avatar Grigory Fedorov

A kind of solution of ViewPages hangs up: ChatViewerAdapter count set to 200,...

A kind of solution of ViewPages hangs up: ChatViewerAdapter count set to 200, InfiniteViewPager offset set to 100.
parent e56189b4
......@@ -34,6 +34,9 @@ import com.xabber.android.ui.adapter.ChatViewerAdapter;
*/
public class InfiniteViewPager extends ViewPager {
public static final int OFFSET = 100;
public static final int TOTAL_COUNT = 200;
public InfiniteViewPager(Context context) {
super(context);
}
......@@ -74,7 +77,7 @@ public class InfiniteViewPager extends ViewPager {
// should be enough to create an illusion of infinity
// warning: scrolling to very high values (1,000,000+) results in
// strange drawing behaviour
return ((ChatViewerAdapter) getAdapter()).getRealCount() * 100;
return OFFSET;
}
@Override
......
......@@ -6,6 +6,7 @@ import android.app.FragmentManager;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import com.antonyt.infiniteviewpager.InfiniteViewPager;
import com.xabber.android.data.message.AbstractChat;
import com.xabber.android.data.message.MessageManager;
import com.xabber.android.ui.ChatViewerFragment;
......@@ -46,7 +47,7 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter implements Upda
public int getCount() {
// warning: scrolling to very high values (1,000,000+) results in
// strange drawing behaviour
return Integer.MAX_VALUE;
return InfiniteViewPager.TOTAL_COUNT;
}
public int getRealCount() {
......
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