Bug 1269914 - Add probe for reaching end of History list. r=margaret

MozReview-Commit-ID: E7eXsF8Voc9

--HG--
extra : rebase_source : aee5c00b342a5caa3125216f66f2925612d792b2
This commit is contained in:
Chenxia Liu 2016-05-03 17:23:58 -07:00
parent f90d2f6327
commit 7c7423a780

View File

@ -17,6 +17,7 @@ import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
@ -146,11 +147,23 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
animator.setChangeDuration(100);
animator.setMoveDuration(100);
animator.setRemoveDuration(100);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.setItemAnimator(animator);
mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
mRecyclerView.setOnHistoryClickedListener(mUrlOpenListener);
mRecyclerView.setOnPanelLevelChangeListener(new OnLevelChangeListener());
mRecyclerView.setHiddenClientsDialogBuilder(new HiddenClientsHelper());
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
final LinearLayoutManager llm = (LinearLayoutManager) recyclerView.getLayoutManager();
if ((mPanelLevel == OnPanelLevelChangeListener.PanelLevel.PARENT) && (llm.findLastCompletelyVisibleItemPosition() == HistoryCursorLoader.HISTORY_LIMIT)) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.LIST, "history_scroll_max");
}
}
});
registerForContextMenu(mRecyclerView);
}
@ -222,7 +235,7 @@ public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsD
private static class HistoryCursorLoader extends SimpleCursorLoader {
// Max number of history results
private static final int HISTORY_LIMIT = 100;
public static final int HISTORY_LIMIT = 100;
private final BrowserDB mDB;
public HistoryCursorLoader(Context context) {