本文整理汇总了Java中org.chromium.chrome.browser.widget.selection.SelectableListLayout类的典型用法代码示例。如果您正苦于以下问题:Java SelectableListLayout类的具体用法?Java SelectableListLayout怎么用?Java SelectableListLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectableListLayout类属于org.chromium.chrome.browser.widget.selection包,在下文中一共展示了SelectableListLayout类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHeader
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
@Override
protected BasicViewHolder createHeader(ViewGroup parent) {
if (mSpaceDisplay == null) {
mSpaceDisplay = new SpaceDisplay(parent, this);
registerAdapterDataObserver(mSpaceDisplay);
if (mUiConfig != null) {
MarginResizer.createWithViewAdapter(mSpaceDisplay.getView(), mUiConfig,
parent.getResources().getDimensionPixelSize(
R.dimen.list_item_default_margin),
SelectableListLayout.getDefaultListItemLateralShadowSizePx(
parent.getResources()));
}
}
mSpaceDisplay.onChanged();
return new BasicViewHolder(mSpaceDisplay.getView());
}
示例2: postConstruction
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* A helper function for initializing the PickerCategoryView.
* @param context The context to use.
*/
@SuppressWarnings("unchecked") // mSelectableListLayout
private void postConstruction(Context context) {
mContext = context;
mDecoderServiceHost = new DecoderServiceHost(this);
mDecoderServiceHost.bind(mContext);
enumerateBitmaps();
mSelectionDelegate = new SelectionDelegate<PickerBitmap>();
View root = LayoutInflater.from(context).inflate(R.layout.photo_picker_dialog, this);
mSelectableListLayout =
(SelectableListLayout<PickerBitmap>) root.findViewById(R.id.selectable_list);
mPickerAdapter = new PickerAdapter(this);
mRecyclerView = mSelectableListLayout.initializeRecyclerView(mPickerAdapter);
PhotoPickerToolbar toolbar = (PhotoPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.photo_picker_toolbar, mSelectionDelegate,
R.string.photo_picker_select_images, null, 0, 0, R.color.default_primary_color,
null);
toolbar.setNavigationOnClickListener(this);
Button doneButton = (Button) toolbar.findViewById(R.id.done);
doneButton.setOnClickListener(this);
calculateGridMetrics();
mLayoutManager = new GridLayoutManager(mContext, mColumns);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(mLayoutManager);
mSpacingDecoration = new GridSpacingItemDecoration(mColumns, mPadding);
mRecyclerView.addItemDecoration(mSpacingDecoration);
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / KILOBYTE);
final int cacheSizeLarge = maxMemory / 2; // 1/2 of the available memory.
final int cacheSizeSmall = maxMemory / 8; // 1/8th of the available memory.
mLowResBitmaps = new LruCache<String, Bitmap>(cacheSizeSmall);
mHighResBitmaps = new LruCache<String, Bitmap>(cacheSizeLarge);
}
示例3: createDateViewHolder
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
@Override
protected DateViewHolder createDateViewHolder(ViewGroup parent) {
DateViewHolder viewHolder = super.createDateViewHolder(parent);
if (mUiConfig != null) {
MarginResizer.createWithViewAdapter(viewHolder.itemView, mUiConfig,
parent.getResources().getDimensionPixelSize(R.dimen.list_item_default_margin),
SelectableListLayout.getDefaultListItemLateralShadowSizePx(
parent.getResources()));
}
return viewHolder;
}
示例4: createDateViewHolder
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
@Override
protected DateViewHolder createDateViewHolder(ViewGroup parent) {
DateViewHolder viewHolder = super.createDateViewHolder(parent);
MarginResizer.createWithViewAdapter(viewHolder.itemView,
mHistoryManager.getSelectableListLayout().getUiConfig(),
getDefaultTextMargin(parent.getResources()),
SelectableListLayout.getDefaultListItemLateralShadowSizePx(parent.getResources()));
return viewHolder;
}
示例5: DownloadManagerUi
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
public DownloadManagerUi(
Activity activity, boolean isOffTheRecord, ComponentName parentComponent) {
mActivity = activity;
mBackendProvider =
sProviderForTests == null ? new DownloadBackendProvider() : sProviderForTests;
mMainView = (ViewGroup) LayoutInflater.from(activity).inflate(R.layout.download_main, null);
DrawerLayout drawerLayout = null;
if (!DeviceFormFactor.isLargeTablet(activity)) {
drawerLayout = (DrawerLayout) mMainView;
addDrawerListener(drawerLayout);
}
mSelectableListLayout =
(SelectableListLayout) mMainView.findViewById(R.id.selectable_list);
mSelectableListLayout.initializeEmptyView(R.drawable.downloads_big,
R.string.download_manager_ui_empty);
mHistoryAdapter = new DownloadHistoryAdapter(isOffTheRecord, parentComponent);
mSelectableListLayout.initializeRecyclerView(mHistoryAdapter);
mHistoryAdapter.initialize(mBackendProvider);
addObserver(mHistoryAdapter);
mSpaceDisplay = new SpaceDisplay(mMainView, mHistoryAdapter);
mHistoryAdapter.registerAdapterDataObserver(mSpaceDisplay);
mSpaceDisplay.onChanged();
mFilterAdapter = new FilterAdapter();
mFilterAdapter.initialize(this);
addObserver(mFilterAdapter);
mToolbar = (DownloadManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.download_manager_toolbar, mBackendProvider.getSelectionDelegate(),
0, drawerLayout, R.id.normal_menu_group, R.id.selection_mode_menu_group, this);
mToolbar.setTitle(R.string.menu_downloads);
addObserver(mToolbar);
mFilterView = (ListView) mMainView.findViewById(R.id.section_list);
mFilterView.setAdapter(mFilterAdapter);
mFilterView.setOnItemClickListener(mFilterAdapter);
mUndoDeletionSnackbarController = new UndoDeletionSnackbarController();
}
示例6: BookmarkManager
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* Creates an instance of {@link BookmarkManager}. It also initializes resources,
* bookmark models and jni bridges.
* @param activity The activity context to use.
* @param isDialogUi Whether the main bookmarks UI will be shown in a dialog, not a NativePage.
* @param snackbarManager The {@link SnackbarManager} used to display snackbars.
*/
public BookmarkManager(Activity activity, boolean isDialogUi, SnackbarManager snackbarManager) {
mActivity = activity;
mIsDialogUi = isDialogUi;
mSelectionDelegate = new SelectionDelegate<BookmarkId>() {
@Override
public boolean toggleSelectionForItem(BookmarkId bookmark) {
if (!mBookmarkModel.getBookmarkById(bookmark).isEditable()) return false;
return super.toggleSelectionForItem(bookmark);
}
};
mBookmarkModel = new BookmarkModel();
mMainView = (ViewGroup) mActivity.getLayoutInflater().inflate(R.layout.bookmark_main, null);
@SuppressWarnings("unchecked")
SelectableListLayout<BookmarkId> selectableList =
(SelectableListLayout<BookmarkId>) mMainView.findViewById(R.id.selectable_list);
mSelectableListLayout = selectableList;
mSelectableListLayout.initializeEmptyView(
VectorDrawableCompat.create(
mActivity.getResources(), R.drawable.bookmark_big, mActivity.getTheme()),
R.string.bookmarks_folder_empty, R.string.bookmark_no_result);
mAdapter = new BookmarkItemsAdapter(activity);
mRecyclerView = mSelectableListLayout.initializeRecyclerView(mAdapter);
mToolbar = (BookmarkActionBar) mSelectableListLayout.initializeToolbar(
R.layout.bookmark_action_bar, mSelectionDelegate, 0, null, R.id.normal_menu_group,
R.id.selection_mode_menu_group, R.color.default_primary_color, null);
mToolbar.initializeSearchView(
this, R.string.bookmark_action_bar_search, R.id.search_menu_id);
mSelectableListLayout.configureWideDisplayStyle();
mUndoController = new BookmarkUndoController(activity, mBookmarkModel, snackbarManager);
mBookmarkModel.addObserver(mBookmarkModelObserver);
initializeToLoadingState();
mBookmarkModel.runAfterBookmarkModelLoaded(mModelLoadedRunnable);
// Load partner bookmarks explicitly. We load partner bookmarks in the deferred startup
// code, but that might be executed much later. Especially on L, showing loading
// progress bar blocks that so it won't be loaded. http://crbug.com/429383
PartnerBookmarksShim.kickOffReading(activity);
mLargeIconBridge = new LargeIconBridge(Profile.getLastUsedProfile().getOriginalProfile());
ActivityManager activityManager = ((ActivityManager) ContextUtils
.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE));
int maxSize = Math.min(activityManager.getMemoryClass() / 4 * 1024 * 1024,
FAVICON_MAX_CACHE_SIZE_BYTES);
mLargeIconBridge.createCache(maxSize);
RecordUserAction.record("MobileBookmarkManagerOpen");
if (!isDialogUi) {
RecordUserAction.record("MobileBookmarkManagerPageOpen");
}
// TODO(twellington): Remove this when Chrome version 59 is a distant memory and users
// are unlikely to have the old PREF_SEARCH_HISTORY in shared preferences.
ContextUtils.getAppSharedPreferences().edit().remove(PREF_SEARCH_HISTORY).apply();
}
示例7: getSelectableListLayout
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
@Override
public SelectableListLayout<BookmarkId> getSelectableListLayout() {
return mSelectableListLayout;
}
示例8: DownloadManagerUi
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* Constructs a new DownloadManagerUi.
* @param activity The {@link Activity} associated with the download manager.
* @param isOffTheRecord Whether an off-the-record tab is currently being displayed.
* @param parentComponent The {@link ComponentName} of the parent activity.
* @param isSeparateActivity Whether the download manager UI will be shown in a separate
* activity than the main Chrome activity.
* @param snackbarManager The {@link SnackbarManager} used to display snackbars.
*/
@SuppressWarnings("unchecked") // mSelectableListLayout
public DownloadManagerUi(Activity activity, boolean isOffTheRecord,
ComponentName parentComponent, boolean isSeparateActivity,
SnackbarManager snackbarManager) {
mActivity = activity;
mBackendProvider =
sProviderForTests == null ? new DownloadBackendProvider() : sProviderForTests;
mSnackbarManager = snackbarManager;
mMainView = (ViewGroup) LayoutInflater.from(activity).inflate(R.layout.download_main, null);
mSelectableListLayout = (SelectableListLayout<DownloadHistoryItemWrapper>)
mMainView.findViewById(R.id.selectable_list);
mSelectableListLayout.initializeEmptyView(
VectorDrawableCompat.create(
mActivity.getResources(), R.drawable.downloads_big, mActivity.getTheme()),
R.string.download_manager_ui_empty, R.string.download_manager_no_results);
mHistoryAdapter = new DownloadHistoryAdapter(isOffTheRecord, parentComponent);
mRecyclerView = mSelectableListLayout.initializeRecyclerView(mHistoryAdapter);
// Prevent every progress update from causing a transition animation.
mRecyclerView.getItemAnimator().setChangeDuration(0);
mFilterAdapter = new FilterAdapter();
mFilterAdapter.initialize(this);
addObserver(mFilterAdapter);
mToolbar = (DownloadManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.download_manager_toolbar, mBackendProvider.getSelectionDelegate(), 0, null,
R.id.normal_menu_group, R.id.selection_mode_menu_group, null, this);
mToolbar.initializeFilterSpinner(mFilterAdapter);
mToolbar.initializeSearchView(this, R.string.download_manager_search, R.id.search_menu_id);
addObserver(mToolbar);
mSelectableListLayout.configureWideDisplayStyle();
mHistoryAdapter.initialize(mBackendProvider, mSelectableListLayout.getUiConfig());
addObserver(mHistoryAdapter);
mUndoDeletionSnackbarController = new UndoDeletionSnackbarController();
enableStorageInfoHeader(mHistoryAdapter.shouldShowStorageInfoHeader());
mIsSeparateActivity = isSeparateActivity;
if (!mIsSeparateActivity) mToolbar.removeCloseButton();
}
示例9: HistoryManager
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* Creates a new HistoryManager.
* @param activity The Activity associated with the HistoryManager.
* @param isSeparateActivity Whether the history UI will be shown in a separate activity than
* the main Chrome activity.
* @param snackbarManager The {@link SnackbarManager} used to display snackbars.
*/
@SuppressWarnings("unchecked") // mSelectableListLayout
public HistoryManager(
Activity activity, boolean isSeparateActivity, SnackbarManager snackbarManager) {
mActivity = activity;
mIsSeparateActivity = isSeparateActivity;
mSnackbarManager = snackbarManager;
mSelectionDelegate = new SelectionDelegate<>();
mSelectionDelegate.addObserver(this);
mHistoryAdapter = new HistoryAdapter(mSelectionDelegate, this,
sProviderForTests != null ? sProviderForTests : new BrowsingHistoryBridge());
// 1. Create SelectableListLayout.
mSelectableListLayout =
(SelectableListLayout<HistoryItem>) LayoutInflater.from(activity).inflate(
R.layout.history_main, null);
// 2. Initialize RecyclerView.
mRecyclerView = mSelectableListLayout.initializeRecyclerView(mHistoryAdapter);
// 3. Initialize toolbar.
mToolbar = (HistoryManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.history_toolbar, mSelectionDelegate, R.string.menu_history, null,
R.id.normal_menu_group, R.id.selection_mode_menu_group,
R.color.default_primary_color, this);
mToolbar.setManager(this);
mToolbar.initializeSearchView(this, R.string.history_manager_search, R.id.search_menu_id);
// 4. Width constrain the SelectableListLayout.
mSelectableListLayout.configureWideDisplayStyle();
// 5. Initialize empty view.
mEmptyView = mSelectableListLayout.initializeEmptyView(
VectorDrawableCompat.create(
mActivity.getResources(), R.drawable.history_big, mActivity.getTheme()),
R.string.history_manager_empty, R.string.history_manager_no_results);
// 6. Create large icon bridge.
mLargeIconBridge = new LargeIconBridge(Profile.getLastUsedProfile().getOriginalProfile());
ActivityManager activityManager = ((ActivityManager) ContextUtils
.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE));
int maxSize = Math.min((activityManager.getMemoryClass() / 4) * MEGABYTES_TO_BYTES,
FAVICON_MAX_CACHE_SIZE_BYTES);
mLargeIconBridge.createCache(maxSize);
// 7. Initialize the adapter to load items.
mHistoryAdapter.initialize();
// 8. Add scroll listener to page in more items when necessary.
mRecyclerView.addOnScrollListener(new OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (!mHistoryAdapter.canLoadMoreItems()) return;
// Load more items if the scroll position is close to the bottom of the list.
LinearLayoutManager layoutManager =
(LinearLayoutManager) recyclerView.getLayoutManager();
if (layoutManager.findLastVisibleItemPosition()
> (mHistoryAdapter.getItemCount() - 25)) {
mHistoryAdapter.loadMoreItems();
recordUserActionWithOptionalSearch("LoadMoreOnScroll");
}
}});
// 9. Listen to changes in sign in state.
SigninManager.get(mActivity).addSignInStateObserver(this);
recordUserAction("Show");
}
示例10: getSelectableListLayout
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* @return The SelectableListLayout that displays HistoryItems.
*/
public SelectableListLayout<HistoryItem> getSelectableListLayout() {
return mSelectableListLayout;
}
示例11: getSelectableListLayout
import org.chromium.chrome.browser.widget.selection.SelectableListLayout; //导入依赖的package包/类
/**
* @return The {@link SelectableListLayout} displaying the list of bookmarks.
*/
SelectableListLayout<BookmarkId> getSelectableListLayout();