зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1300144 - Pre: pass mUrlOpenInBackgroundListener into HighlightsItem r=sebastian
This will be needed for opening background/private tabs from the highlights menu. MozReview-Commit-ID: 8wvFuTgl2SP --HG-- extra : histedit_source : de4024ee986c5a48d9da4206160cf960b1d7bc3c
This commit is contained in:
Родитель
38b08f88b4
Коммит
63cbca5ca4
|
@ -77,7 +77,7 @@ public abstract class HomeFragment extends Fragment {
|
|||
protected OnUrlOpenListener mUrlOpenListener;
|
||||
|
||||
// Helper for opening a tab in the background.
|
||||
private OnUrlOpenInBackgroundListener mUrlOpenInBackgroundListener;
|
||||
protected OnUrlOpenInBackgroundListener mUrlOpenInBackgroundListener;
|
||||
|
||||
protected PanelStateChangeListener mPanelStateChangeListener = null;
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ public class ActivityStream extends FrameLayout {
|
|||
tileMargin = resources.getDimensionPixelSize(R.dimen.activity_stream_base_margin);
|
||||
}
|
||||
|
||||
void setOnUrlOpenListener(HomePager.OnUrlOpenListener listener) {
|
||||
adapter.setOnUrlOpenListener(listener);
|
||||
void setOnUrlOpenListeners(HomePager.OnUrlOpenListener onUrlOpenListener, HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener) {
|
||||
adapter.setOnUrlOpenListeners(onUrlOpenListener, onUrlOpenInBackgroundListener);
|
||||
}
|
||||
|
||||
public void load(LoaderManager lm) {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ActivityStreamHomeFragment
|
|||
@Nullable Bundle savedInstanceState) {
|
||||
if (activityStream == null) {
|
||||
activityStream = (ActivityStream) inflater.inflate(R.layout.activity_stream, container, false);
|
||||
activityStream.setOnUrlOpenListener(mUrlOpenListener);
|
||||
activityStream.setOnUrlOpenListeners(mUrlOpenListener, mUrlOpenInBackgroundListener);
|
||||
}
|
||||
|
||||
return activityStream;
|
||||
|
|
|
@ -83,7 +83,9 @@ public abstract class StreamItem extends RecyclerView.ViewHolder {
|
|||
private Future<IconResponse> ongoingIconLoad;
|
||||
private int tilesMargin;
|
||||
|
||||
public HighlightItem(final View itemView) {
|
||||
public HighlightItem(final View itemView,
|
||||
final HomePager.OnUrlOpenListener onUrlOpenListener,
|
||||
final HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener) {
|
||||
super(itemView);
|
||||
|
||||
tilesMargin = itemView.getResources().getDimensionPixelSize(R.dimen.activity_stream_base_margin);
|
||||
|
|
|
@ -24,13 +24,15 @@ public class StreamRecyclerAdapter extends RecyclerView.Adapter<StreamItem> impl
|
|||
private Cursor topSitesCursor;
|
||||
|
||||
private HomePager.OnUrlOpenListener onUrlOpenListener;
|
||||
private HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener;
|
||||
|
||||
private int tiles;
|
||||
private int tilesWidth;
|
||||
private int tilesHeight;
|
||||
|
||||
void setOnUrlOpenListener(HomePager.OnUrlOpenListener onUrlOpenListener) {
|
||||
void setOnUrlOpenListeners(HomePager.OnUrlOpenListener onUrlOpenListener, HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener) {
|
||||
this.onUrlOpenListener = onUrlOpenListener;
|
||||
this.onUrlOpenInBackgroundListener = onUrlOpenInBackgroundListener;
|
||||
}
|
||||
|
||||
public void setTileSize(int tiles, int tilesWidth, int tilesHeight) {
|
||||
|
@ -57,7 +59,7 @@ public class StreamRecyclerAdapter extends RecyclerView.Adapter<StreamItem> impl
|
|||
if (type == TopPanel.LAYOUT_ID) {
|
||||
return new TopPanel(inflater.inflate(type, parent, false), onUrlOpenListener);
|
||||
} else if (type == HighlightItem.LAYOUT_ID) {
|
||||
return new HighlightItem(inflater.inflate(type, parent, false));
|
||||
return new HighlightItem(inflater.inflate(type, parent, false), onUrlOpenListener, onUrlOpenInBackgroundListener);
|
||||
} else {
|
||||
throw new IllegalStateException("Missing inflation for ViewType " + type);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче