mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1004850 - (Part 3) Create RecentTabsPanel from existing LastTabsPanel. r=lucasr
--HG-- rename : mobile/android/base/home/LastTabsPanel.java => mobile/android/base/home/RecentTabsPanel.java rename : mobile/android/base/resources/layout/home_last_tabs_panel.xml => mobile/android/base/resources/layout/home_recent_tabs_panel.xml
This commit is contained in:
parent
fd3de6d19e
commit
b5484b5435
@ -40,6 +40,7 @@ public final class HomeConfig {
|
||||
BOOKMARKS("bookmarks", BookmarksPanel.class),
|
||||
HISTORY("history", HistoryPanel.class),
|
||||
READING_LIST("reading_list", ReadingListPanel.class),
|
||||
RECENT_TABS("recent_tabs", RecentTabsPanel.class),
|
||||
DYNAMIC("dynamic", DynamicPanel.class);
|
||||
|
||||
private final String mId;
|
||||
@ -1495,6 +1496,7 @@ public final class HomeConfig {
|
||||
private static final String BOOKMARKS_PANEL_ID = "7f6d419a-cd6c-4e34-b26f-f68b1b551907";
|
||||
private static final String READING_LIST_PANEL_ID = "20f4549a-64ad-4c32-93e4-1dcef792733b";
|
||||
private static final String HISTORY_PANEL_ID = "f134bf20-11f7-4867-ab8b-e8e705d7fbe8";
|
||||
private static final String RECENT_TABS_PANEL_ID = "5c2601a5-eedc-4477-b297-ce4cef52adf8";
|
||||
|
||||
private final HomeConfigBackend mBackend;
|
||||
|
||||
@ -1550,6 +1552,11 @@ public final class HomeConfig {
|
||||
id = READING_LIST_PANEL_ID;
|
||||
break;
|
||||
|
||||
case RECENT_TABS:
|
||||
titleId = R.string.recent_tabs_title;
|
||||
id = RECENT_TABS_PANEL_ID;
|
||||
break;
|
||||
|
||||
case DYNAMIC:
|
||||
throw new IllegalArgumentException("createBuiltinPanelConfig() is only for built-in panels");
|
||||
}
|
||||
|
@ -68,13 +68,16 @@ class HomeConfigPrefsBackend implements HomeConfigBackend {
|
||||
}
|
||||
|
||||
final PanelConfig historyEntry = createBuiltinPanelConfig(mContext, PanelType.HISTORY);
|
||||
final PanelConfig recentTabsEntry = createBuiltinPanelConfig(mContext, PanelType.RECENT_TABS);
|
||||
|
||||
// On tablets, the history panel is the last.
|
||||
// On phones, the history panel is the first one.
|
||||
if (HardwareUtils.isTablet()) {
|
||||
panelConfigs.add(historyEntry);
|
||||
panelConfigs.add(recentTabsEntry);
|
||||
} else {
|
||||
panelConfigs.add(0, historyEntry);
|
||||
panelConfigs.add(0, recentTabsEntry);
|
||||
}
|
||||
|
||||
return new State(panelConfigs, true);
|
||||
|
@ -34,15 +34,15 @@ import android.widget.TextView;
|
||||
/**
|
||||
* Fragment that displays tabs from last session in a ListView.
|
||||
*/
|
||||
public class LastTabsPanel extends HomeFragment {
|
||||
public class RecentTabsPanel extends HomeFragment {
|
||||
// Logging tag name
|
||||
private static final String LOGTAG = "GeckoLastTabsPanel";
|
||||
private static final String LOGTAG = "GeckoRecentTabsPanel";
|
||||
|
||||
// Cursor loader ID for the session parser
|
||||
private static final int LOADER_ID_LAST_TABS = 0;
|
||||
// Cursor loader ID for the loader that loads recent tabs
|
||||
private static final int LOADER_ID_RECENT_TABS = 0;
|
||||
|
||||
// Adapter for the list of search results
|
||||
private LastTabsAdapter mAdapter;
|
||||
// Adapter for the list of recent tabs.
|
||||
private RecentTabsAdapter mAdapter;
|
||||
|
||||
// The view shown by the fragment.
|
||||
private HomeListView mList;
|
||||
@ -62,14 +62,6 @@ public class LastTabsPanel extends HomeFragment {
|
||||
// On new tabs listener
|
||||
private OnNewTabsListener mNewTabsListener;
|
||||
|
||||
public static LastTabsPanel newInstance() {
|
||||
return new LastTabsPanel();
|
||||
}
|
||||
|
||||
public LastTabsPanel() {
|
||||
mNewTabsListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
@ -91,7 +83,7 @@ public class LastTabsPanel extends HomeFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.home_last_tabs_panel, container, false);
|
||||
return inflater.inflate(R.layout.home_recent_tabs_panel, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -154,7 +146,7 @@ public class LastTabsPanel extends HomeFragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
// Intialize adapter
|
||||
mAdapter = new LastTabsAdapter(getActivity());
|
||||
mAdapter = new RecentTabsAdapter(getActivity());
|
||||
mList.setAdapter(mAdapter);
|
||||
|
||||
// Create callbacks before the initial loader is started
|
||||
@ -195,7 +187,7 @@ public class LastTabsPanel extends HomeFragment {
|
||||
|
||||
@Override
|
||||
protected void load() {
|
||||
getLoaderManager().initLoader(LOADER_ID_LAST_TABS, null, mCursorLoaderCallbacks);
|
||||
getLoaderManager().initLoader(LOADER_ID_RECENT_TABS, null, mCursorLoaderCallbacks);
|
||||
}
|
||||
|
||||
private void openAllTabs() {
|
||||
@ -215,8 +207,8 @@ public class LastTabsPanel extends HomeFragment {
|
||||
mNewTabsListener.onNewTabs(urls);
|
||||
}
|
||||
|
||||
private static class LastTabsCursorLoader extends SimpleCursorLoader {
|
||||
public LastTabsCursorLoader(Context context) {
|
||||
private static class RecentTabsCursorLoader extends SimpleCursorLoader {
|
||||
public RecentTabsCursorLoader(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -257,8 +249,8 @@ public class LastTabsPanel extends HomeFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private static class LastTabsAdapter extends CursorAdapter {
|
||||
public LastTabsAdapter(Context context) {
|
||||
private static class RecentTabsAdapter extends CursorAdapter {
|
||||
public RecentTabsAdapter(Context context) {
|
||||
super(context, null, 0);
|
||||
}
|
||||
|
||||
@ -276,7 +268,7 @@ public class LastTabsPanel extends HomeFragment {
|
||||
private class CursorLoaderCallbacks implements LoaderCallbacks<Cursor> {
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
return new LastTabsCursorLoader(getActivity());
|
||||
return new RecentTabsCursorLoader(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
@ -11,6 +11,7 @@
|
||||
<!ENTITY bookmarks_title "Bookmarks">
|
||||
<!ENTITY history_title "History">
|
||||
<!ENTITY reading_list_title "Reading List">
|
||||
<!ENTITY recent_tabs_title "Recent Tabs">
|
||||
|
||||
<!ENTITY switch_to_tab "Switch to tab">
|
||||
|
||||
|
@ -272,7 +272,6 @@ gbjar.sources += [
|
||||
'home/HomePagerTabStrip.java',
|
||||
'home/HomePanelPicker.java',
|
||||
'home/HomePanelsManager.java',
|
||||
'home/LastTabsPanel.java',
|
||||
'home/MultiTypeCursorAdapter.java',
|
||||
'home/PanelAuthCache.java',
|
||||
'home/PanelAuthLayout.java',
|
||||
@ -288,6 +287,7 @@ gbjar.sources += [
|
||||
'home/PinSiteDialog.java',
|
||||
'home/ReadingListPanel.java',
|
||||
'home/ReadingListRow.java',
|
||||
'home/RecentTabsPanel.java',
|
||||
'home/SearchEngine.java',
|
||||
'home/SearchEngineRow.java',
|
||||
'home/SearchLoader.java',
|
||||
|
@ -36,6 +36,7 @@
|
||||
<string name="bookmarks_title">&bookmarks_title;</string>
|
||||
<string name="history_title">&history_title;</string>
|
||||
<string name="reading_list_title">&reading_list_title;</string>
|
||||
<string name="recent_tabs_title">&recent_tabs_title;</string>
|
||||
|
||||
<string name="switch_to_tab">&switch_to_tab;</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user