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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/TabularContextMenuUi.java

Issue 2845303003: added rounded corners & created file for rounded corners (Closed)
Patch Set: fixing Link context menu's header color Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.contextmenu; 5 package org.chromium.chrome.browser.contextmenu;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.Dialog; 8 import android.app.Dialog;
9 import android.content.DialogInterface; 9 import android.content.DialogInterface;
10 import android.content.res.Resources; 10 import android.content.res.Resources;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public TabularContextMenuUi(Runnable onShareItemClicked) { 48 public TabularContextMenuUi(Runnable onShareItemClicked) {
49 mOnShareItemClicked = onShareItemClicked; 49 mOnShareItemClicked = onShareItemClicked;
50 } 50 }
51 51
52 @Override 52 @Override
53 public void displayMenu(Activity activity, ContextMenuParams params, 53 public void displayMenu(Activity activity, ContextMenuParams params,
54 List<Pair<Integer, List<ContextMenuItem>>> items, Callback<Integer> onItemClicked, 54 List<Pair<Integer, List<ContextMenuItem>>> items, Callback<Integer> onItemClicked,
55 final Runnable onMenuShown, final Runnable onMenuClosed) { 55 final Runnable onMenuShown, final Runnable onMenuClosed) {
56 mCallback = onItemClicked; 56 mCallback = onItemClicked;
57 mDialog = createDialog(activity, params, items); 57 mDialog = createDialog(activity, params, items);
58
58 mDialog.getWindow().setBackgroundDrawable(ApiCompatibilityUtils.getDrawa ble( 59 mDialog.getWindow().setBackgroundDrawable(ApiCompatibilityUtils.getDrawa ble(
59 activity.getResources(), R.drawable.bg_find_toolbar_popup)); 60 activity.getResources(), R.drawable.white_with_rounded_corners)) ;
60 61
61 mDialog.setOnShowListener(new DialogInterface.OnShowListener() { 62 mDialog.setOnShowListener(new DialogInterface.OnShowListener() {
62 @Override 63 @Override
63 public void onShow(DialogInterface dialogInterface) { 64 public void onShow(DialogInterface dialogInterface) {
64 onMenuShown.run(); 65 onMenuShown.run();
65 } 66 }
66 }); 67 });
67 68
68 mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { 69 mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
69 @Override 70 @Override
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 maxCount = Math.max(maxCount, itemGroup.second.size()); 111 maxCount = Math.max(maxCount, itemGroup.second.size());
111 } 112 }
112 for (int i = 0; i < itemGroups.size(); i++) { 113 for (int i = 0; i < itemGroups.size(); i++) {
113 Pair<Integer, List<ContextMenuItem>> itemGroup = itemGroups.get(i); 114 Pair<Integer, List<ContextMenuItem>> itemGroup = itemGroups.get(i);
114 // TODO(tedchoc): Pass the ContextMenuGroup identifier to determine if it's an image. 115 // TODO(tedchoc): Pass the ContextMenuGroup identifier to determine if it's an image.
115 boolean isImageTab = itemGroup.first == R.string.contextmenu_image_t itle; 116 boolean isImageTab = itemGroup.first == R.string.contextmenu_image_t itle;
116 viewGroups.add(new Pair<>(activity.getString(itemGroup.first), 117 viewGroups.add(new Pair<>(activity.getString(itemGroup.first),
117 createContextMenuPageUi( 118 createContextMenuPageUi(
118 activity, params, itemGroup.second, isImageTab, maxC ount))); 119 activity, params, itemGroup.second, isImageTab, maxC ount)));
119 } 120 }
121 if (itemGroups.size() == 1) {
122 viewGroups.get(0).second.getChildAt(0).findViewById(R.id.context_hea der_layout)
gone 2017/05/02 17:09:39 Did you run git cl format on this?
Daniel Park 2017/05/02 17:46:56 Done.
123 .setBackgroundResource(R.color.google_grey_100);
124 }
125
120 TabularContextMenuViewPager pager = 126 TabularContextMenuViewPager pager =
121 (TabularContextMenuViewPager) view.findViewById(R.id.custom_page r); 127 (TabularContextMenuViewPager) view.findViewById(R.id.custom_page r);
122 pager.setAdapter(new TabularContextMenuPagerAdapter(viewGroups)); 128 pager.setAdapter(new TabularContextMenuPagerAdapter(viewGroups));
123 129
124 TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout); 130 TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
125 if (itemGroups.size() <= 1) { 131 if (itemGroups.size() <= 1) {
126 tabLayout.setVisibility(View.GONE); 132 tabLayout.setVisibility(View.GONE);
127 } else { 133 } else {
128 tabLayout.setupWithViewPager((ViewPager) view.findViewById(R.id.cust om_pager)); 134 tabLayout.setupWithViewPager((ViewPager) view.findViewById(R.id.cust om_pager));
129 } 135 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 mHeaderImageView.setImageBitmap(bitmap); 262 mHeaderImageView.setImageBitmap(bitmap);
257 } 263 }
258 } 264 }
259 265
260 @Override 266 @Override
261 public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { 267 public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
262 mDialog.dismiss(); 268 mDialog.dismiss();
263 mCallback.onResult((int) id); 269 mCallback.onResult((int) id);
264 } 270 }
265 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698