Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkFolderSelectActivity.java

Issue 2270163002: Delete more document mode specific code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.bookmarks; 5 package org.chromium.chrome.browser.bookmarks;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.graphics.drawable.Drawable; 9 import android.graphics.drawable.Drawable;
10 import android.os.Bundle; 10 import android.os.Bundle;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bookmarkStrings.add(id.toString()); 106 bookmarkStrings.add(id.toString());
107 } 107 }
108 intent.putStringArrayListExtra(INTENT_BOOKMARKS_TO_MOVE, bookmarkStrings ); 108 intent.putStringArrayListExtra(INTENT_BOOKMARKS_TO_MOVE, bookmarkStrings );
109 activity.startActivityForResult(intent, 109 activity.startActivityForResult(intent,
110 BookmarkAddEditFolderActivity.PARENT_FOLDER_REQUEST_CODE); 110 BookmarkAddEditFolderActivity.PARENT_FOLDER_REQUEST_CODE);
111 } 111 }
112 112
113 @Override 113 @Override
114 public void onCreate(Bundle savedInstanceState) { 114 public void onCreate(Bundle savedInstanceState) {
115 super.onCreate(savedInstanceState); 115 super.onCreate(savedInstanceState);
116 BookmarkUtils.setTaskDescriptionInDocumentMode(this,
117 getString(R.string.bookmark_choose_folder));
118 mModel = new BookmarkModel(); 116 mModel = new BookmarkModel();
119 mModel.addObserver(mBookmarkModelObserver); 117 mModel.addObserver(mBookmarkModelObserver);
120 List<String> stringList = getIntent().getStringArrayListExtra(INTENT_BOO KMARKS_TO_MOVE); 118 List<String> stringList = getIntent().getStringArrayListExtra(INTENT_BOO KMARKS_TO_MOVE);
121 mBookmarksToMove = new ArrayList<>(stringList.size()); 119 mBookmarksToMove = new ArrayList<>(stringList.size());
122 for (String string : stringList) { 120 for (String string : stringList) {
123 BookmarkId bookmarkId = BookmarkId.getBookmarkIdFromString(string); 121 BookmarkId bookmarkId = BookmarkId.getBookmarkIdFromString(string);
124 if (mModel.doesBookmarkExist(bookmarkId)) { 122 if (mModel.doesBookmarkExist(bookmarkId)) {
125 mBookmarksToMove.add(bookmarkId); 123 mBookmarksToMove.add(bookmarkId);
126 } 124 }
127 } 125 }
(...skipping 17 matching lines...) Expand all
145 mBookmarkIdsList.setAdapter(mBookmarkIdsAdapter); 143 mBookmarkIdsList.setAdapter(mBookmarkIdsAdapter);
146 144
147 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 145 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
148 setSupportActionBar(toolbar); 146 setSupportActionBar(toolbar);
149 getSupportActionBar().setDisplayHomeAsUpEnabled(true); 147 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
150 148
151 updateFolderList(); 149 updateFolderList();
152 } 150 }
153 151
154 private void updateFolderList() { 152 private void updateFolderList() {
155 List<BookmarkId> folderList = new ArrayList<BookmarkId>(); 153 List<BookmarkId> folderList = new ArrayList<>();
156 List<Integer> depthList = new ArrayList<Integer>(); 154 List<Integer> depthList = new ArrayList<>();
157 mModel.getMoveDestinations(folderList, depthList, mBookmarksToMove); 155 mModel.getMoveDestinations(folderList, depthList, mBookmarksToMove);
158 List<FolderListEntry> entryList = new ArrayList<FolderListEntry>(folderL ist.size() + 3); 156 List<FolderListEntry> entryList = new ArrayList<>(folderList.size() + 3) ;
159 157
160 if (!mIsCreatingFolder) { 158 if (!mIsCreatingFolder) {
161 entryList.add(new FolderListEntry(null, 0, 159 entryList.add(new FolderListEntry(null, 0,
162 getString(R.string.bookmark_add_folder), false, 160 getString(R.string.bookmark_add_folder), false,
163 FolderListEntry.TYPE_NEW_FOLDER)); 161 FolderListEntry.TYPE_NEW_FOLDER));
164 } 162 }
165 163
166 for (int i = 0; i < folderList.size(); i++) { 164 for (int i = 0; i < folderList.size(); i++) {
167 BookmarkId folder = folderList.get(i); 165 BookmarkId folder = folderList.get(i);
168 166
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 256 }
259 257
260 private static class FolderListAdapter extends BaseAdapter { 258 private static class FolderListAdapter extends BaseAdapter {
261 // The maximum depth that will be indented. Folders with a depth greater 259 // The maximum depth that will be indented. Folders with a depth greater
262 // than this will all appear at this same depth. 260 // than this will all appear at this same depth.
263 private static final int MAX_FOLDER_DEPTH = 5; 261 private static final int MAX_FOLDER_DEPTH = 5;
264 262
265 private final int mBasePadding; 263 private final int mBasePadding;
266 private final int mPaddingIncrement; 264 private final int mPaddingIncrement;
267 265
268 List<FolderListEntry> mEntryList = new ArrayList<FolderListEntry>(); 266 List<FolderListEntry> mEntryList = new ArrayList<>();
269 267
270 public FolderListAdapter(Context context) { 268 public FolderListAdapter(Context context) {
271 mBasePadding = context.getResources() 269 mBasePadding = context.getResources()
272 .getDimensionPixelSize(R.dimen.bookmark_folder_item_left); 270 .getDimensionPixelSize(R.dimen.bookmark_folder_item_left);
273 mPaddingIncrement = mBasePadding * 2; 271 mPaddingIncrement = mBasePadding * 2;
274 } 272 }
275 273
276 @Override 274 @Override
277 public int getCount() { 275 public int getCount() {
278 return mEntryList.size(); 276 return mEntryList.size();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 * Sets up padding for the entry 350 * Sets up padding for the entry
353 */ 351 */
354 private void setUpPadding(FolderListEntry entry, TextView textView) { 352 private void setUpPadding(FolderListEntry entry, TextView textView) {
355 int paddingStart = mBasePadding + Math.min(entry.mDepth, MAX_FOLDER_ DEPTH) 353 int paddingStart = mBasePadding + Math.min(entry.mDepth, MAX_FOLDER_ DEPTH)
356 * mPaddingIncrement; 354 * mPaddingIncrement;
357 ApiCompatibilityUtils.setPaddingRelative(textView, paddingStart, 0, 355 ApiCompatibilityUtils.setPaddingRelative(textView, paddingStart, 0,
358 mBasePadding, 0); 356 mBasePadding, 0);
359 } 357 }
360 } 358 }
361 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698