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));
}
}
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();
}
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();
}
}
Aggregations