gecko/mobile/android/base/home/HomeAdapter.java

179 lines
5.1 KiB
Java
Raw Normal View History

/* -*- 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;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
import org.mozilla.gecko.home.HomeConfig.PanelConfig;
import org.mozilla.gecko.home.HomeConfig.PanelType;
import org.mozilla.gecko.home.HomePager;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
class HomeAdapter extends FragmentStatePagerAdapter {
private final Context mContext;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
private final ArrayList<PanelInfo> mPanelInfos;
private final HashMap<String, Fragment> mPanels;
private boolean mCanLoadHint;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
private OnAddPanelListener mAddPanelListener;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
interface OnAddPanelListener {
public void onAddPanel(String title);
}
public HomeAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
mCanLoadHint = HomeFragment.DEFAULT_CAN_LOAD_HINT;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
mPanelInfos = new ArrayList<PanelInfo>();
mPanels = new HashMap<String, Fragment>();
}
@Override
public int getCount() {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
return mPanelInfos.size();
}
@Override
public Fragment getItem(int position) {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
PanelInfo info = mPanelInfos.get(position);
return Fragment.instantiate(mContext, info.getClassName(), info.getArgs());
}
@Override
public CharSequence getPageTitle(int position) {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
if (mPanelInfos.size() > 0) {
PanelInfo info = mPanelInfos.get(position);
return info.getTitle().toUpperCase();
}
return null;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
Fragment fragment = (Fragment) super.instantiateItem(container, position);
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
mPanels.put(mPanelInfos.get(position).getId(), fragment);
return fragment;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
super.destroyItem(container, position, object);
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
mPanels.remove(mPanelInfos.get(position).getId());
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
public void setOnAddPanelListener(OnAddPanelListener listener) {
mAddPanelListener = listener;
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
public int getItemPosition(String panelId) {
for (int i = 0; i < mPanelInfos.size(); i++) {
final String id = mPanelInfos.get(i).getId();
if (id.equals(panelId)) {
return i;
}
}
return -1;
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
public String getPanelIdAtPosition(int position) {
// getPanelIdAtPosition() might be called before HomeAdapter
// has got its initial list of PanelConfigs. Just bail.
if (mPanelInfos.isEmpty()) {
return null;
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
return mPanelInfos.get(position).getId();
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
private void addPanel(PanelInfo info) {
mPanelInfos.add(info);
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
if (mAddPanelListener != null) {
mAddPanelListener.onAddPanel(info.getTitle());
}
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
public void update(List<PanelConfig> panelConfigs) {
mPanels.clear();
mPanelInfos.clear();
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
if (panelConfigs != null) {
for (PanelConfig panelConfig : panelConfigs) {
final PanelInfo info = new PanelInfo(panelConfig);
addPanel(info);
}
}
notifyDataSetChanged();
}
public boolean getCanLoadHint() {
return mCanLoadHint;
}
public void setCanLoadHint(boolean canLoadHint) {
// We cache the last hint value so that we can use it when
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
// creating new panels. See PanelInfo.getArgs().
mCanLoadHint = canLoadHint;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
// Enable/disable loading on all existing panels
for (Fragment panelFragment : mPanels.values()) {
final HomeFragment panel = (HomeFragment) panelFragment;
panel.setCanLoadHint(canLoadHint);
}
}
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
private final class PanelInfo {
private final PanelConfig mPanelConfig;
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
PanelInfo(PanelConfig panelConfig) {
mPanelConfig = panelConfig;
}
public String getId() {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
return mPanelConfig.getId();
}
public String getTitle() {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
return mPanelConfig.getTitle();
}
public String getClassName() {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
final PanelType type = mPanelConfig.getType();
return type.getPanelClass().getName();
}
public Bundle getArgs() {
final Bundle args = new Bundle();
args.putBoolean(HomePager.CAN_LOAD_ARG, mCanLoadHint);
// Only DynamicPanels need the PanelConfig argument
if (mPanelConfig.getType() == PanelType.DYNAMIC) {
Bug 958185 - Rename Page* terminology to Panel* in the home package (r=margaret) --HG-- rename : mobile/android/base/home/BookmarksPage.java => mobile/android/base/home/BookmarksPanel.java rename : mobile/android/base/home/HistoryPage.java => mobile/android/base/home/HistoryPanel.java rename : mobile/android/base/home/LastTabsPage.java => mobile/android/base/home/LastTabsPanel.java rename : mobile/android/base/home/ListPage.java => mobile/android/base/home/ListPanel.java rename : mobile/android/base/home/MostRecentPage.java => mobile/android/base/home/MostRecentPanel.java rename : mobile/android/base/home/ReadingListPage.java => mobile/android/base/home/ReadingListPanel.java rename : mobile/android/base/home/TopSitesPage.java => mobile/android/base/home/TopSitesPanel.java rename : mobile/android/base/resources/drawable/home_page_title_background.xml => mobile/android/base/resources/drawable/home_panel_title_background.xml rename : mobile/android/base/resources/layout-large-land-v11/home_history_page.xml => mobile/android/base/resources/layout-large-land-v11/home_history_panel.xml rename : mobile/android/base/resources/layout-xlarge-v11/home_history_page.xml => mobile/android/base/resources/layout-xlarge-v11/home_history_panel.xml rename : mobile/android/base/resources/layout/home_bookmarks_page.xml => mobile/android/base/resources/layout/home_bookmarks_panel.xml rename : mobile/android/base/resources/layout/home_history_page.xml => mobile/android/base/resources/layout/home_history_panel.xml rename : mobile/android/base/resources/layout/home_last_tabs_page.xml => mobile/android/base/resources/layout/home_last_tabs_panel.xml rename : mobile/android/base/resources/layout/home_most_recent_page.xml => mobile/android/base/resources/layout/home_most_recent_panel.xml rename : mobile/android/base/resources/layout/home_reading_list_page.xml => mobile/android/base/resources/layout/home_reading_list_panel.xml rename : mobile/android/base/resources/layout/home_top_sites_page.xml => mobile/android/base/resources/layout/home_top_sites_panel.xml rename : mobile/android/base/tests/testBookmarksPage.java => mobile/android/base/tests/testBookmarksPanel.java
2014-01-10 17:18:07 -08:00
args.putParcelable(HomePager.PANEL_CONFIG_ARG, mPanelConfig);
}
return args;
}
}
}