mobile/android/base/home/FramePanelLayout.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 package org.mozilla.gecko.home;
michael@0 7
michael@0 8 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
michael@0 9 import org.mozilla.gecko.home.HomeConfig.PanelConfig;
michael@0 10 import org.mozilla.gecko.home.HomeConfig.ViewConfig;
michael@0 11
michael@0 12 import android.content.Context;
michael@0 13 import android.util.Log;
michael@0 14 import android.view.View;
michael@0 15
michael@0 16 class FramePanelLayout extends PanelLayout {
michael@0 17 private static final String LOGTAG = "GeckoFramePanelLayout";
michael@0 18
michael@0 19 private final View mChildView;
michael@0 20 private final ViewConfig mChildConfig;
michael@0 21
michael@0 22 public FramePanelLayout(Context context, PanelConfig panelConfig, DatasetHandler datasetHandler,
michael@0 23 OnUrlOpenListener urlOpenListener, ContextMenuRegistry contextMenuRegistry) {
michael@0 24 super(context, panelConfig, datasetHandler, urlOpenListener, contextMenuRegistry);
michael@0 25
michael@0 26 // This layout can only hold one view so we simply
michael@0 27 // take the first defined view from PanelConfig.
michael@0 28 mChildConfig = panelConfig.getViewAt(0);
michael@0 29 if (mChildConfig == null) {
michael@0 30 throw new IllegalStateException("FramePanelLayout requires a view in PanelConfig");
michael@0 31 }
michael@0 32
michael@0 33 mChildView = createPanelView(mChildConfig);
michael@0 34 addView(mChildView);
michael@0 35 }
michael@0 36
michael@0 37 @Override
michael@0 38 public void load() {
michael@0 39 Log.d(LOGTAG, "Loading");
michael@0 40
michael@0 41 if (mChildView instanceof DatasetBacked) {
michael@0 42 final FilterDetail filter = new FilterDetail(mChildConfig.getFilter(), null);
michael@0 43
michael@0 44 final DatasetRequest request = new DatasetRequest(mChildConfig.getIndex(),
michael@0 45 mChildConfig.getDatasetId(),
michael@0 46 filter);
michael@0 47
michael@0 48 Log.d(LOGTAG, "Requesting child request: " + request);
michael@0 49 requestDataset(request);
michael@0 50 }
michael@0 51 }
michael@0 52 }

mercurial