зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 76f34a9578d2 (bug 1335814) on request of developer. r=backout
This commit is contained in:
Родитель
e95f7d6ea3
Коммит
54dd8e6804
|
@ -12,8 +12,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.home.HomePager;
|
||||
import org.mozilla.gecko.home.activitystream.topsites.CirclePageIndicator;
|
||||
import org.mozilla.gecko.home.activitystream.topsites.TopSitesPagerAdapter;
|
||||
|
@ -23,39 +21,11 @@ public class TopPanel extends StreamItem {
|
|||
|
||||
private final ViewPager topSitesPager;
|
||||
|
||||
private static class SwipeListener extends ViewPager.SimpleOnPageChangeListener {
|
||||
int currentPosition = 0;
|
||||
|
||||
SwipeListener(final ViewPager pager) {
|
||||
pager.addOnPageChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int newPosition) {
|
||||
final String extra;
|
||||
if (newPosition > currentPosition) {
|
||||
extra = "swipe_forward";
|
||||
} else if (newPosition < currentPosition) {
|
||||
extra = "swipe_back";
|
||||
} else {
|
||||
// Selected the same page - this could happen if framework behaviour differs across
|
||||
// Android versions of manufacturers.
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.LIST, extra);
|
||||
currentPosition = newPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private final SwipeListener swipeListener = new SwipeListener();
|
||||
|
||||
public TopPanel(View itemView, HomePager.OnUrlOpenListener onUrlOpenListener, HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener) {
|
||||
super(itemView);
|
||||
|
||||
topSitesPager = (ViewPager) itemView.findViewById(R.id.topsites_pager);
|
||||
topSitesPager.setAdapter(new TopSitesPagerAdapter(itemView.getContext(), onUrlOpenListener, onUrlOpenInBackgroundListener));
|
||||
topSitesPager.addOnPageChangeListener(swipeListener);
|
||||
|
||||
CirclePageIndicator indicator = (CirclePageIndicator) itemView.findViewById(R.id.topsites_indicator);
|
||||
indicator.setViewPager(topSitesPager);
|
||||
|
@ -73,10 +43,5 @@ public class TopPanel extends StreamItem {
|
|||
ViewGroup.LayoutParams layoutParams = topSitesPager.getLayoutParams();
|
||||
layoutParams.height = tilesHeight + tilesMargin + textHeight;
|
||||
topSitesPager.setLayoutParams(layoutParams);
|
||||
|
||||
// Reset the page position: binding a new Cursor means that topsites reverts to the first page,
|
||||
// no event is sent in that case, but we need to know the right page number to send correct
|
||||
// page swipe events
|
||||
swipeListener.currentPosition = 0;
|
||||
}
|
||||
}
|
|
@ -33,13 +33,12 @@ highlight for which the menu is being displayed.
|
|||
|
||||
Top Site interactions
|
||||
---------------------
|
||||
Three event types are recorded:
|
||||
Two event types are recorded:
|
||||
|
||||
1) User clicked on a Top Site: event="loadurl.1", method="listitem"
|
||||
2) User clicked on the menu button: event="show.1", method="contextmenu"
|
||||
3) User swiped left/right (only for Activity Stream topsites): event="action.1", method="list", extras="swipe_forward"/"swipe_back"
|
||||
|
||||
For each click event (1/2), in addition to global extras, the following information is recorded:
|
||||
For each event, in addition to global extras, the following information is recorded:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче