當前位置: 首頁>>代碼示例>>Java>>正文


Java SelectionDelegate類代碼示例

本文整理匯總了Java中org.chromium.chrome.browser.widget.selection.SelectionDelegate的典型用法代碼示例。如果您正苦於以下問題:Java SelectionDelegate類的具體用法?Java SelectionDelegate怎麽用?Java SelectionDelegate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SelectionDelegate類屬於org.chromium.chrome.browser.widget.selection包,在下文中一共展示了SelectionDelegate類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
@Override
public void initialize(SelectionDelegate<DownloadHistoryItemWrapper> delegate, int titleResId,
        @Nullable DrawerLayout drawerLayout, int normalGroupResId, int selectedGroupResId) {
    if (DeviceFormFactor.isTablet(getContext())) {
        getMenu().removeItem(R.id.close_menu_id);
    }

    super.initialize(delegate, titleResId, drawerLayout, normalGroupResId, selectedGroupResId);

    mNumberRollView.setContentDescriptionString(R.plurals.accessibility_selected_items);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:12,代碼來源:DownloadManagerToolbar.java

示例2: DownloadBackendProvider

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
DownloadBackendProvider() {
    Resources resources = ContextUtils.getApplicationContext().getResources();
    int iconSize = resources.getDimensionPixelSize(R.dimen.downloads_item_icon_size);

    mOfflinePageBridge = new OfflinePageDownloadBridge(
            Profile.getLastUsedProfile().getOriginalProfile());
    mSelectionDelegate = new SelectionDelegate<DownloadHistoryItemWrapper>();
    mThumbnailProvider = new ThumbnailProviderImpl(iconSize);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:10,代碼來源:DownloadManagerUi.java

示例3: postConstruction

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的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);
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:44,代碼來源:PickerCategoryView.java

示例4: HistoryAdapter

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
public HistoryAdapter(SelectionDelegate<HistoryItem> delegate, HistoryManager manager,
        HistoryProvider provider) {
    setHasStableIds(true);
    mSelectionDelegate = delegate;
    mHistoryProvider = provider;
    mHistoryProvider.setObserver(this);
    mHistoryManager = manager;
    mItemViews = new ArrayList<>();
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:10,代碼來源:HistoryAdapter.java

示例5: BookmarkManager

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的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.
 */
public BookmarkManager(Activity activity, boolean isDialogUi) {
    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);
    mDrawer = (DrawerLayout) mMainView.findViewById(R.id.bookmark_drawer_layout);
    mDrawerListView = (BookmarkDrawerListView) mMainView.findViewById(
            R.id.bookmark_drawer_list);
    mContentView = (BookmarkContentView) mMainView.findViewById(R.id.bookmark_content_view);
    mViewSwitcher = (ViewSwitcher) mMainView.findViewById(R.id.bookmark_view_switcher);
    mUndoController = new BookmarkUndoController(activity, mBookmarkModel,
            ((SnackbarManageable) activity).getSnackbarManager());
    mSearchView = (BookmarkSearchView) getView().findViewById(R.id.bookmark_search_view);
    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");
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:50,代碼來源:BookmarkManager.java

示例6: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
@Override
public SelectionDelegate<BookmarkId> getSelectionDelegate() {
    return mSelectionDelegate;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:5,代碼來源:BookmarkManager.java

示例7: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
/** Returns the {@link SelectionDelegate} that tracks selected items. */
SelectionDelegate<DownloadHistoryItemWrapper> getSelectionDelegate();
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:3,代碼來源:BackendProvider.java

示例8: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
private SelectionDelegate<DownloadHistoryItemWrapper> getSelectionDelegate() {
    return mBackendProvider.getSelectionDelegate();
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:4,代碼來源:DownloadHistoryAdapter.java

示例9: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
@Override
public SelectionDelegate<DownloadHistoryItemWrapper> getSelectionDelegate() {
    return mSelectionDelegate;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:5,代碼來源:DownloadManagerUi.java

示例10: BookmarkManager

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的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();
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:70,代碼來源:BookmarkManager.java

示例11: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
public SelectionDelegate<PickerBitmap> getSelectionDelegate() {
    return mSelectionDelegate;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:4,代碼來源:PickerCategoryView.java

示例12: getSelectionDelegateForTesting

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
@VisibleForTesting
public SelectionDelegate<PickerBitmap> getSelectionDelegateForTesting() {
    return mSelectionDelegate;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:5,代碼來源:PickerCategoryView.java

示例13: HistoryManager

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的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");
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:77,代碼來源:HistoryManager.java

示例14: getSelectionDelegateForTests

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
@VisibleForTesting
SelectionDelegate<HistoryItem> getSelectionDelegateForTests() {
    return mSelectionDelegate;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:5,代碼來源:HistoryManager.java

示例15: getSelectionDelegate

import org.chromium.chrome.browser.widget.selection.SelectionDelegate; //導入依賴的package包/類
/**
 * @return The SelectionDelegate responsible for tracking selected bookmarks.
 */
SelectionDelegate<BookmarkId> getSelectionDelegate();
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:5,代碼來源:BookmarkDelegate.java


注:本文中的org.chromium.chrome.browser.widget.selection.SelectionDelegate類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。