Search in sources :

Example 16 with BookmarkId

use of org.chromium.components.bookmarks.BookmarkId in project AndroidChromium by JackyAndroid.

the class BookmarkDrawerListViewAdapter method setTopFolders.

/**
     * Sets folders to show.
     */
void setTopFolders(List<BookmarkId> folders) {
    mBottomSection.clear();
    if (folders.size() > 0) {
        // Add a divider and title to the top of the section.
        mBottomSection.add(new Item(TYPE_DIVIDER));
        mBottomSection.add(new Item(TYPE_FOLDERS_TITLE));
    }
    // Add the rest of the items.
    for (BookmarkId id : folders) {
        mBottomSection.add(new Item(id));
    }
}
Also used : BookmarkId(org.chromium.components.bookmarks.BookmarkId)

Example 17 with BookmarkId

use of org.chromium.components.bookmarks.BookmarkId in project AndroidChromium by JackyAndroid.

the class BookmarkFolderSelectActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mModel = new BookmarkModel();
    mModel.addObserver(mBookmarkModelObserver);
    List<String> stringList = getIntent().getStringArrayListExtra(INTENT_BOOKMARKS_TO_MOVE);
    mBookmarksToMove = new ArrayList<>(stringList.size());
    for (String string : stringList) {
        BookmarkId bookmarkId = BookmarkId.getBookmarkIdFromString(string);
        if (mModel.doesBookmarkExist(bookmarkId)) {
            mBookmarksToMove.add(bookmarkId);
        }
    }
    if (mBookmarksToMove.isEmpty()) {
        finish();
        return;
    }
    mIsCreatingFolder = getIntent().getBooleanExtra(INTENT_IS_CREATING_FOLDER, false);
    if (mIsCreatingFolder) {
        mParentId = mModel.getMobileFolderId();
    } else {
        mParentId = mModel.getBookmarkById(mBookmarksToMove.get(0)).getParentId();
    }
    setContentView(R.layout.bookmark_folder_select_activity);
    mBookmarkIdsList = (ListView) findViewById(R.id.bookmark_folder_list);
    mBookmarkIdsList.setOnItemClickListener(this);
    mBookmarkIdsAdapter = new FolderListAdapter(this);
    mBookmarkIdsList.setAdapter(mBookmarkIdsAdapter);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    updateFolderList();
}
Also used : BookmarkId(org.chromium.components.bookmarks.BookmarkId) Toolbar(android.support.v7.widget.Toolbar)

Example 18 with BookmarkId

use of org.chromium.components.bookmarks.BookmarkId in project AndroidChromium by JackyAndroid.

the class BookmarkFolderSelectActivity method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    assert !mIsCreatingFolder;
    if (requestCode == CREATE_FOLDER_REQUEST_CODE && resultCode == RESULT_OK) {
        BookmarkId createdBookmark = BookmarkId.getBookmarkIdFromString(data.getStringExtra(BookmarkAddEditFolderActivity.INTENT_CREATED_BOOKMARK));
        mModel.moveBookmarks(mBookmarksToMove, createdBookmark);
        BookmarkUtils.setLastUsedParent(this, createdBookmark);
        finish();
    }
}
Also used : BookmarkId(org.chromium.components.bookmarks.BookmarkId)

Aggregations

BookmarkId (org.chromium.components.bookmarks.BookmarkId)18 Intent (android.content.Intent)4 ArrayList (java.util.ArrayList)4 BookmarkItem (org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem)2 Toolbar (android.support.v7.widget.Toolbar)1 HashSet (java.util.HashSet)1 List (java.util.List)1 CalledByNative (org.chromium.base.annotations.CalledByNative)1 BookmarkModel (org.chromium.chrome.browser.bookmarks.BookmarkModel)1 Snackbar (org.chromium.chrome.browser.snackbar.Snackbar)1 SnackbarController (org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarController)1 TabDelegate (org.chromium.chrome.browser.tabmodel.document.TabDelegate)1