--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -5,17 +5,17 @@
package org.mozilla.gecko;
import android.Manifest;
import android.app.DownloadManager;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.annotation.WorkerThread;
+
import org.json.JSONArray;
import org.mozilla.gecko.adjust.AdjustHelperInterface;
import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
import org.mozilla.gecko.Tabs.TabEvents;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
@@ -28,17 +28,16 @@ import org.mozilla.gecko.delegates.Scree
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.distribution.DistributionStoreCallback;
import org.mozilla.gecko.dlc.DownloadContentService;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
import org.mozilla.gecko.feeds.ContentNotificationsDelegate;
import org.mozilla.gecko.feeds.FeedService;
-import org.mozilla.gecko.feeds.action.CheckForUpdatesAction;
import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator.PinReason;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.home.BrowserSearch;
import org.mozilla.gecko.home.HomeBanner;
import org.mozilla.gecko.home.HomeConfig;
@@ -175,17 +174,16 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
-import java.util.UUID;
import java.util.Vector;
import java.util.regex.Pattern;
public class BrowserApp extends GeckoApp
implements TabsPanel.TabsLayoutChangeListener,
PropertyAnimator.PropertyAnimationListener,
View.OnKeyListener,
LayerView.DynamicToolbarListener,
@@ -2531,17 +2529,17 @@ public class BrowserApp extends GeckoApp
// to panel BAR, the history URL still contains FOO, and we restore to FOO. In most
// cases however we aren't supplying a panel ID in the URL so this code still works
// for most cases.
// We can't fix this directly since we can't ignore the panelId if we're explicitly
// loading a specific panel, and we currently can't distinguish between loading
// history, and loading new pages, see Bug 1268887
panelId = tab.getMostRecentHomePanel();
panelRestoreData = tab.getMostRecentHomePanelData();
- } else if (panelId.equals(HomeConfig.getIdForBuiltinPanelType(PanelType.RECENT_TABS))) {
+ } else if (panelId.equals(HomeConfig.getIdForBuiltinPanelType(PanelType.DEPRECATED_RECENT_TABS))) {
// Redirect to the Combined History panel.
panelId = HomeConfig.getIdForBuiltinPanelType(PanelType.COMBINED_HISTORY);
panelRestoreData = new Bundle();
// Jump directly to the Recent Tabs subview of the Combined History panel.
panelRestoreData.putBoolean("goToRecentTabs", true);
}
showHomePager(panelId, panelRestoreData);
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -3,17 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.GeckoProfileDirectories.NoMozillaDirectoryException;
import org.mozilla.gecko.db.BrowserDB;
-import org.mozilla.gecko.db.URLMetadataTable;
import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.gfx.FullScreenState;
import org.mozilla.gecko.gfx.Layer;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.gfx.PluginLayer;
@@ -46,17 +45,16 @@ import org.mozilla.gecko.util.HardwareUt
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.PrefUtils;
import org.mozilla.gecko.util.ThreadUtils;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -84,17 +82,16 @@ import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
-import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.AbsoluteLayout;
import android.widget.AdapterView;
import android.widget.Button;
@@ -110,17 +107,16 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -1425,17 +1421,17 @@ public abstract class GeckoApp
* restore tabs as needed.
* If we restore tabs, we don't need to create a new tab.
*/
protected void loadStartupTab(final int flags) {
if (!mShouldRestore) {
if (mLastSessionCrashed) {
// The Recent Tabs panel no longer exists, but BrowserApp will redirect us
// to the Recent Tabs section of the Combined History panel.
- Tabs.getInstance().loadUrl(AboutPages.getURLForBuiltinPanelType(PanelType.RECENT_TABS), flags);
+ Tabs.getInstance().loadUrl(AboutPages.getURLForBuiltinPanelType(PanelType.DEPRECATED_RECENT_TABS), flags);
} else {
final String homepage = getHomepage();
Tabs.getInstance().loadUrl(!TextUtils.isEmpty(homepage) ? homepage : AboutPages.HOME, flags);
}
}
}
/**
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
@@ -38,23 +38,23 @@ public final class HomeConfig {
* to a default set of built-in panels. The DYNAMIC panel type is used by
* third-party services to create panels with varying types of content.
*/
@RobocopTarget
public static enum PanelType implements Parcelable {
TOP_SITES("top_sites", TopSitesPanel.class),
BOOKMARKS("bookmarks", BookmarksPanel.class),
COMBINED_HISTORY("combined_history", CombinedHistoryPanel.class),
- RECENT_TABS("recent_tabs", RecentTabsPanel.class),
DYNAMIC("dynamic", DynamicPanel.class),
// Deprecated panels that should no longer exist but are kept around for
// migration code. Class references have been replaced with new version of the panel.
DEPRECATED_REMOTE_TABS("remote_tabs", CombinedHistoryPanel.class),
DEPRECATED_HISTORY("history", CombinedHistoryPanel.class),
- DEPRECATED_READING_LIST("reading_list", BookmarksPanel.class);
+ DEPRECATED_READING_LIST("reading_list", BookmarksPanel.class),
+ DEPRECATED_RECENT_TABS("recent_tabs", CombinedHistoryPanel.class);
private final String mId;
private final Class<?> mPanelClass;
PanelType(String id, Class<?> panelClass) {
mId = id;
mPanelClass = panelClass;
}
@@ -1639,22 +1639,20 @@ public final class HomeConfig {
return R.string.home_top_sites_title;
case BOOKMARKS:
case DEPRECATED_READING_LIST:
return R.string.bookmarks_title;
case DEPRECATED_HISTORY:
case DEPRECATED_REMOTE_TABS:
+ case DEPRECATED_RECENT_TABS:
case COMBINED_HISTORY:
return R.string.home_history_title;
- case RECENT_TABS:
- return R.string.recent_tabs_title;
-
default:
throw new IllegalArgumentException("Only for built-in panel types: " + panelType);
}
}
public static String getIdForBuiltinPanelType(PanelType panelType) {
switch (panelType) {
case TOP_SITES:
@@ -1670,17 +1668,17 @@ public final class HomeConfig {
return COMBINED_HISTORY_PANEL_ID;
case DEPRECATED_REMOTE_TABS:
return REMOTE_TABS_PANEL_ID;
case DEPRECATED_READING_LIST:
return DEPRECATED_READING_LIST_PANEL_ID;
- case RECENT_TABS:
+ case DEPRECATED_RECENT_TABS:
return RECENT_TABS_PANEL_ID;
default:
throw new IllegalArgumentException("Only for built-in panel types: " + panelType);
}
}
public static PanelConfig createBuiltinPanelConfig(Context context, PanelType panelType, EnumSet<PanelConfig.Flags> flags) {
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeConfigPrefsBackend.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeConfigPrefsBackend.java
@@ -357,17 +357,17 @@ public class HomeConfigPrefsBackend impl
for (int v = version + 1; v <= VERSION; v++) {
Log.d(LOGTAG, "Migrating to version = " + v);
switch (v) {
case 1:
// Add "Recent Tabs" panel.
addBuiltinPanelConfig(context, jsonPanels,
- PanelType.RECENT_TABS, Position.FRONT, Position.BACK);
+ PanelType.DEPRECATED_RECENT_TABS, Position.FRONT, Position.BACK);
// Remove the old pref key.
prefsEditor.remove(PREFS_CONFIG_KEY_OLD);
break;
case 2:
// Add "Remote Tabs"/"Synced Tabs" panel.
addBuiltinPanelConfig(context, jsonPanels,
@@ -400,17 +400,17 @@ public class HomeConfigPrefsBackend impl
break;
case 6:
jsonPanels = removePanel(context, jsonPanels,
PanelType.DEPRECATED_READING_LIST, PanelType.BOOKMARKS, false);
break;
case 7:
jsonPanels = removePanel(context, jsonPanels,
- PanelType.RECENT_TABS, PanelType.COMBINED_HISTORY, true);
+ PanelType.DEPRECATED_RECENT_TABS, PanelType.COMBINED_HISTORY, true);
break;
}
}
// Save the new panel config and the new version number.
final JSONObject newJson = new JSONObject();
newJson.put(JSON_KEY_PANELS, jsonPanels);
newJson.put(JSON_KEY_VERSION, VERSION);
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/home/RecentTabsPanel.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.home;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.mozilla.gecko.AboutPages;
-import org.mozilla.gecko.EventDispatcher;
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.GeckoEvent;
-import org.mozilla.gecko.GeckoProfile;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.SessionParser;
-import org.mozilla.gecko.Telemetry;
-import org.mozilla.gecko.TelemetryContract;
-import org.mozilla.gecko.db.BrowserContract.CommonColumns;
-import org.mozilla.gecko.db.BrowserContract.URLColumns;
-import org.mozilla.gecko.reader.SavedReaderViewHelper;
-import org.mozilla.gecko.util.EventCallback;
-import org.mozilla.gecko.util.NativeEventListener;
-import org.mozilla.gecko.util.NativeJSObject;
-import org.mozilla.gecko.util.ThreadUtils;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.database.MatrixCursor.RowBuilder;
-import android.os.Bundle;
-import android.support.v4.app.LoaderManager;
-import android.support.v4.content.Loader;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewStub;
-import android.widget.AdapterView;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-/**
- * Fragment that displays tabs from last session in a ListView.
- */
-public class RecentTabsPanel extends HomeFragment
- implements NativeEventListener {
- // Logging tag name
- @SuppressWarnings("unused")
- private static final String LOGTAG = "GeckoRecentTabsPanel";
-
- // Cursor loader ID for the loader that loads recent tabs
- private static final int LOADER_ID_RECENT_TABS = 0;
-
- private static final String TELEMETRY_EXTRA_LAST_TIME = "recent_tabs_last_time";
- private static final String TELEMETRY_EXTRA_CLOSED = "recent_closed_tabs";
-
- // Adapter for the list of recent tabs.
- private RecentTabsAdapter mAdapter;
-
- // The view shown by the fragment.
- private HomeListView mList;
-
- // Reference to the View to display when there are no results.
- private View mEmptyView;
-
- // Callbacks used for the search and favicon cursor loaders
- private CursorLoaderCallbacks mCursorLoaderCallbacks;
-
- // Recently closed tabs from gecko
- private ClosedTab[] mClosedTabs;
-
- private void restoreSessionWithHistory(List<String> dataList) {
- JSONObject json = new JSONObject();
- try {
- json.put("tabs", new JSONArray(dataList));
- } catch (JSONException e) {
- Log.e(LOGTAG, "JSON error", e);
- }
-
- GeckoAppShell.notifyObservers("Session:RestoreRecentTabs", json.toString());
- }
-
- private static final class ClosedTab {
- public final String url;
- public final String title;
- public final String data;
-
- public ClosedTab(String url, String title, String data) {
- this.url = url;
- this.title = title;
- this.data = data;
- }
- }
-
- public static final class RecentTabs implements URLColumns, CommonColumns {
- public static final String TYPE = "type";
- public static final String DATA = "data";
-
- public static final int TYPE_HEADER = 0;
- public static final int TYPE_LAST_TIME = 1;
- public static final int TYPE_CLOSED = 2;
- public static final int TYPE_OPEN_ALL_LAST_TIME = 3;
- public static final int TYPE_OPEN_ALL_CLOSED = 4;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- return inflater.inflate(R.layout.home_list_panel, container, false);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- mList = (HomeListView) view.findViewById(R.id.list);
- mList.setTag(HomePager.LIST_TAG_RECENT_TABS);
-
- mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- final Cursor c = mAdapter.getCursor();
- if (c == null || !c.moveToPosition(position)) {
- return;
- }
-
- final int itemType = c.getInt(c.getColumnIndexOrThrow(RecentTabs.TYPE));
-
- if (itemType == RecentTabs.TYPE_OPEN_ALL_LAST_TIME) {
- openTabsWithType(RecentTabs.TYPE_LAST_TIME);
- return;
- }
-
- if (itemType == RecentTabs.TYPE_OPEN_ALL_CLOSED) {
- openTabsWithType(RecentTabs.TYPE_CLOSED);
- return;
- }
-
- final String extras = (itemType == RecentTabs.TYPE_CLOSED) ? TELEMETRY_EXTRA_CLOSED : TELEMETRY_EXTRA_LAST_TIME;
- Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.LIST_ITEM, extras);
-
- final List<String> dataList = new ArrayList<>();
- dataList.add(c.getString(c.getColumnIndexOrThrow(RecentTabs.DATA)));
- restoreSessionWithHistory(dataList);
- }
- });
-
- mList.setContextMenuInfoFactory(new HomeContextMenuInfo.Factory() {
- @Override
- public HomeContextMenuInfo makeInfoForCursor(View view, int position, long id, Cursor cursor) {
- // Don't show context menus for the "Open all" rows.
- final int itemType = cursor.getInt(cursor.getColumnIndexOrThrow(RecentTabs.TYPE));
- if (itemType == RecentTabs.TYPE_OPEN_ALL_LAST_TIME || itemType == RecentTabs.TYPE_OPEN_ALL_CLOSED) {
- return null;
- }
-
- final HomeContextMenuInfo info = new HomeContextMenuInfo(view, position, id);
- info.url = cursor.getString(cursor.getColumnIndexOrThrow(RecentTabs.URL));
- info.title = cursor.getString(cursor.getColumnIndexOrThrow(RecentTabs.TITLE));
- return info;
- }
- });
-
- registerForContextMenu(mList);
-
- EventDispatcher.getInstance().registerGeckoThreadListener(this, "ClosedTabs:Data");
- GeckoAppShell.notifyObservers("ClosedTabs:StartNotifications", null);
- }
-
- @Override
- public void onDestroyView() {
- super.onDestroyView();
-
- // Discard any additional item clicks on the list as the
- // panel is getting destroyed (bug 1210243).
- mList.setOnItemClickListener(null);
-
- mList = null;
- mEmptyView = null;
-
- EventDispatcher.getInstance().unregisterGeckoThreadListener(this, "ClosedTabs:Data");
- GeckoAppShell.notifyObservers("ClosedTabs:StopNotifications", null);
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
-
- // Intialize adapter
- mAdapter = new RecentTabsAdapter(getActivity());
- mList.setAdapter(mAdapter);
-
- // Create callbacks before the initial loader is started
- mCursorLoaderCallbacks = new CursorLoaderCallbacks();
- loadIfVisible();
- }
-
- private void updateUiFromCursor(Cursor c) {
- if (c != null && c.getCount() > 0) {
- return;
- }
-
- if (mEmptyView == null) {
- // Set empty panel view. We delay this so that the empty view won't flash.
- final ViewStub emptyViewStub = (ViewStub) getView().findViewById(R.id.home_empty_view_stub);
- mEmptyView = emptyViewStub.inflate();
-
- final ImageView emptyIcon = (ImageView) mEmptyView.findViewById(R.id.home_empty_image);
- emptyIcon.setImageResource(R.drawable.icon_remote_tabs_empty);
-
- final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
- emptyText.setText(R.string.home_last_tabs_empty);
-
- mList.setEmptyView(mEmptyView);
- }
- }
-
- @Override
- protected void load() {
- getLoaderManager().initLoader(LOADER_ID_RECENT_TABS, null, mCursorLoaderCallbacks);
- }
-
- @Override
- public void handleMessage(String event, NativeJSObject message, EventCallback callback) {
- final NativeJSObject[] tabs = message.getObjectArray("tabs");
- final int length = tabs.length;
-
- final ClosedTab[] closedTabs = new ClosedTab[length];
- for (int i = 0; i < length; i++) {
- final NativeJSObject tab = tabs[i];
- closedTabs[i] = new ClosedTab(tab.getString("url"), tab.getString("title"), tab.getObject("data").toString());
- }
-
- // Only modify mClosedTabs on the UI thread
- ThreadUtils.postToUiThread(new Runnable() {
- @Override
- public void run() {
- mClosedTabs = closedTabs;
-
- // The fragment might have been detached before this code
- // runs in the UI thread.
- if (getActivity() != null) {
- // Reload the cursor to show recently closed tabs.
- getLoaderManager().restartLoader(LOADER_ID_RECENT_TABS, null, mCursorLoaderCallbacks);
- }
- }
- });
- }
-
- private void openTabsWithType(int type) {
- final Cursor c = mAdapter.getCursor();
- if (c == null || !c.moveToFirst()) {
- return;
- }
-
- final List<String> dataList = new ArrayList<String>();
- do {
- if (c.getInt(c.getColumnIndexOrThrow(RecentTabs.TYPE)) == type) {
- dataList.add(c.getString(c.getColumnIndexOrThrow(RecentTabs.DATA)));
- }
- } while (c.moveToNext());
-
- final String extras = (type == RecentTabs.TYPE_CLOSED) ? TELEMETRY_EXTRA_CLOSED : TELEMETRY_EXTRA_LAST_TIME;
- Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.BUTTON, extras);
-
- restoreSessionWithHistory(dataList);
- }
-
- private static class RecentTabsCursorLoader extends SimpleCursorLoader {
- private final ClosedTab[] closedTabs;
-
- public RecentTabsCursorLoader(Context context, ClosedTab[] closedTabs) {
- super(context);
- this.closedTabs = closedTabs;
- }
-
- private void addRow(MatrixCursor c, String url, String title, int type, String data) {
- final RowBuilder row = c.newRow();
- row.add(-1);
- row.add(url);
- row.add(title);
- row.add(type);
- row.add(data);
- }
-
- @Override
- public Cursor loadCursor() {
- // TwoLinePageRow requires the SavedReaderViewHelper to be initialised. Usually this is
- // done as part of BrowserDatabaseHelper.onOpen(), however we don't actually access
- // the DB when showing the Recent Tabs panel, hence it's possible that the SavedReaderViewHelper
- // isn't loaded. Therefore we need to explicitly force loading here.
- // Note: loadCursor is run on a background thread, hence it's safe to do this here.
- // (loading time is a few ms, and hence shouldn't impact overall loading time for this
- // panel in any significant way).
- SavedReaderViewHelper.getSavedReaderViewHelper(getContext()).loadItems();
-
- final Context context = getContext();
-
- final MatrixCursor c = new MatrixCursor(new String[] { RecentTabs._ID,
- RecentTabs.URL,
- RecentTabs.TITLE,
- RecentTabs.TYPE,
- RecentTabs.DATA});
-
- if (closedTabs != null && closedTabs.length > 0) {
- // How many closed tabs are actually displayed.
- int visibleClosedTabs = 0;
-
- final int length = closedTabs.length;
- for (int i = 0; i < length; i++) {
- final String url = closedTabs[i].url;
-
- // Don't show recent tabs for about:home or about:privatebrowsing.
- if (!AboutPages.isTitlelessAboutPage(url)) {
- // If this is the first closed tab we're adding, add a header for the section.
- if (visibleClosedTabs == 0) {
- addRow(c, null, context.getString(R.string.home_closed_tabs_title), RecentTabs.TYPE_HEADER, null);
- }
- addRow(c, url, closedTabs[i].title, RecentTabs.TYPE_CLOSED, closedTabs[i].data);
- visibleClosedTabs++;
- }
- }
-
- // Add an "Open all" button if more than 2 tabs were added to the list.
- if (visibleClosedTabs > 1) {
- addRow(c, null, null, RecentTabs.TYPE_OPEN_ALL_CLOSED, null);
- }
- }
-
- final String jsonString = GeckoProfile.get(context).readSessionFile(true);
- if (jsonString == null) {
- // No previous session data
- return c;
- }
-
- final int count = c.getCount();
-
- new SessionParser() {
- @Override
- public void onTabRead(SessionTab tab) {
- final String url = tab.getUrl();
-
- // Don't show last tabs for about:home
- if (AboutPages.isAboutHome(url)) {
- return;
- }
-
- // If this is the first tab we're reading, add a header.
- if (c.getCount() == count) {
- addRow(c, null, context.getString(R.string.home_last_tabs_title), RecentTabs.TYPE_HEADER, null);
- }
-
- addRow(c, url, tab.getTitle(), RecentTabs.TYPE_LAST_TIME, tab.getTabObject().toString());
- }
- }.parse(jsonString);
-
- // Add an "Open all" button if more than 2 tabs were added to the list (account for the header)
- if (c.getCount() - count > 2) {
- addRow(c, null, null, RecentTabs.TYPE_OPEN_ALL_LAST_TIME, null);
- }
-
- return c;
- }
- }
-
- private static class RecentTabsAdapter extends MultiTypeCursorAdapter {
- private static final int ROW_HEADER = 0;
- private static final int ROW_STANDARD = 1;
- private static final int ROW_OPEN_ALL = 2;
-
- private static final int[] VIEW_TYPES = new int[] { ROW_STANDARD, ROW_HEADER, ROW_OPEN_ALL };
- private static final int[] LAYOUT_TYPES =
- new int[] { R.layout.home_item_row, R.layout.home_header_row, R.layout.home_open_all_row };
-
- public RecentTabsAdapter(Context context) {
- super(context, null, VIEW_TYPES, LAYOUT_TYPES);
- }
-
- @Override
- public int getItemViewType(int position) {
- final Cursor c = getCursor(position);
- final int type = c.getInt(c.getColumnIndexOrThrow(RecentTabs.TYPE));
-
- if (type == RecentTabs.TYPE_HEADER) {
- return ROW_HEADER;
- }
-
- if (type == RecentTabs.TYPE_OPEN_ALL_LAST_TIME || type == RecentTabs.TYPE_OPEN_ALL_CLOSED) {
- return ROW_OPEN_ALL;
- }
-
- return ROW_STANDARD;
- }
-
- @Override
- public boolean isEnabled(int position) {
- return (getItemViewType(position) != ROW_HEADER);
- }
-
- @Override
- public void bindView(View view, Context context, int position) {
- final int itemType = getItemViewType(position);
- if (itemType == ROW_OPEN_ALL) {
- return;
- }
-
- final Cursor c = getCursor(position);
-
- if (itemType == ROW_HEADER) {
- final String title = c.getString(c.getColumnIndexOrThrow(RecentTabs.TITLE));
- final TextView textView = (TextView) view;
- textView.setText(title);
- } else if (itemType == ROW_STANDARD) {
- final TwoLinePageRow pageRow = (TwoLinePageRow) view;
- pageRow.setShowIcons(false);
- pageRow.updateFromCursor(c);
- }
- }
- }
-
- private class CursorLoaderCallbacks implements LoaderManager.LoaderCallbacks<Cursor> {
- @Override
- public Loader<Cursor> onCreateLoader(int id, Bundle args) {
- return new RecentTabsCursorLoader(getActivity(), mClosedTabs);
- }
-
- @Override
- public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
- mAdapter.swapCursor(c);
- updateUiFromCursor(c);
- }
-
- @Override
- public void onLoaderReset(Loader<Cursor> loader) {
- mAdapter.swapCursor(null);
- }
- }
-}
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -43,17 +43,16 @@
<!ENTITY firstrun_account_message "Have &brandShortName; on another device?">
<!ENTITY onboard_start_restricted1 "Stay safe and in control with this simplified version of &brandShortName;.">
<!-- Localization note: These are used as the titles of different pages on the home screen.
They are automatically converted to all caps by the Android platform. -->
<!ENTITY bookmarks_title "Bookmarks">
<!ENTITY history_title "History">
-<!ENTITY recent_tabs_title "Recent Tabs">
<!ENTITY switch_to_tab "Switch to tab">
<!ENTITY crash_reporter_title "&brandShortName; Crash Reporter">
<!ENTITY crash_message2 "&brandShortName; had a problem and crashed. Your tabs should be listed on the &brandShortName; Start page when you restart.">
<!ENTITY crash_send_report_message3 "Tell &vendorShortName; about this crash so they can fix it">
<!ENTITY crash_include_url2 "Include the address of the page I was on">
<!ENTITY crash_sorry "We\'re sorry">
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -426,17 +426,16 @@ gbjar.sources += ['java/org/mozilla/geck
'home/PanelListView.java',
'home/PanelRecyclerView.java',
'home/PanelRecyclerViewAdapter.java',
'home/PanelRefreshLayout.java',
'home/PanelViewAdapter.java',
'home/PanelViewItemHandler.java',
'home/PinSiteDialog.java',
'home/RecentTabsAdapter.java',
- 'home/RecentTabsPanel.java',
'home/RemoteTabsExpandableListState.java',
'home/SearchEngine.java',
'home/SearchEngineAdapter.java',
'home/SearchEngineBar.java',
'home/SearchEngineRow.java',
'home/SearchLoader.java',
'home/SimpleCursorLoader.java',
'home/SpacingDecoration.java',
deleted file mode 100644
--- a/mobile/android/base/resources/layout-large-land-v11/home_list.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <ViewStub android:id="@+id/home_empty_view_stub"
- android:layout="@layout/home_empty_panel"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-
- <org.mozilla.gecko.home.HomeListView
- android:id="@+id/list"
- style="@style/Widget.Home.HomeList"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"/>
-
-</merge>
deleted file mode 100644
--- a/mobile/android/base/resources/layout-xlarge-v11/home_list.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <ViewStub android:id="@+id/home_empty_view_stub"
- android:layout="@layout/home_empty_panel"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-
- <org.mozilla.gecko.home.HomeListView
- android:id="@+id/list"
- style="@style/Widget.Home.HomeList"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"/>
-
-</merge>
deleted file mode 100644
--- a/mobile/android/base/resources/layout/home_list.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-
- <ViewStub android:id="@+id/home_empty_view_stub"
- android:layout="@layout/home_empty_panel"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-
- <org.mozilla.gecko.home.HomeListView
- android:id="@+id/list"
- style="@style/Widget.Home.HomeList"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"/>
-
-</merge>
deleted file mode 100644
--- a/mobile/android/base/resources/layout/home_list_panel.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <include layout="@layout/home_list"/>
-
-</LinearLayout>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -64,17 +64,16 @@
<string name="firstrun_account_title">&firstrun_account_title;</string>
<string name="firstrun_account_message">&firstrun_account_message;</string>
<string name="firstrun_welcome_restricted">&onboard_start_restricted1;</string>
<string name="bookmarks_title">&bookmarks_title;</string>
<string name="history_title">&history_title;</string>
- <string name="recent_tabs_title">&recent_tabs_title;</string>
<string name="switch_to_tab">&switch_to_tab;</string>
<string name="crash_reporter_title">&crash_reporter_title;</string>
<string name="crash_message2">&crash_message2;</string>
<string name="crash_send_report_message3">&crash_send_report_message3;</string>
<string name="crash_include_url2">&crash_include_url2;</string>
<string name="crash_sorry">&crash_sorry;</string>
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
@@ -29,18 +29,17 @@ import com.robotium.solo.Solo;
* A class representing any interactions that take place on the Awesomescreen.
*/
public class AboutHomeComponent extends BaseComponent {
private static final String LOGTAG = AboutHomeComponent.class.getSimpleName();
private static final List<PanelType> PANEL_ORDERING = Arrays.asList(
PanelType.TOP_SITES,
PanelType.BOOKMARKS,
- PanelType.COMBINED_HISTORY,
- PanelType.RECENT_TABS
+ PanelType.COMBINED_HISTORY
);
// The percentage of the panel to swipe between 0 and 1. This value was set through
// testing: 0.55f was tested on try and fails on armv6 devices.
private static final float SWIPE_PERCENTAGE = 0.70f;
public AboutHomeComponent(final UITestContext testContext) {
super(testContext);
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAboutHomePageNavigation.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAboutHomePageNavigation.java
@@ -5,18 +5,16 @@
package org.mozilla.gecko.tests;
import org.mozilla.gecko.home.HomeConfig.PanelType;
import org.mozilla.gecko.tests.helpers.DeviceHelper;
import org.mozilla.gecko.tests.helpers.GeckoHelper;
/**
* Tests functionality related to navigating between the various about:home panels.
- *
- * TODO: Update this test to account for recent tabs panel (bug 1028727).
*/
public class testAboutHomePageNavigation extends UITest {
// TODO: Define this test dynamically by creating dynamic representations of the Page
// enum for both phone and tablet, then swiping through the panels. This will also
// benefit having a HomePager with custom panels.
public void testAboutHomePageNavigation() {
GeckoHelper.blockForDelayedStartup();