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

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

Issue 2853483003: [Android] Fix direct share in context menu does not close dialog when clicked (Closed)
Patch Set: Update based on Ted's comment. 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextmenu/TabularContextMenuListAdapter.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 displayHeaderIfVisibleItems(params, baseLayout); 153 displayHeaderIfVisibleItems(params, baseLayout);
154 if (isImage) { 154 if (isImage) {
155 // #displayHeaderIfVisibleItems() sets these two views to GONE if th e header text is 155 // #displayHeaderIfVisibleItems() sets these two views to GONE if th e header text is
156 // empty but they should still be visible because we have an image t o display. 156 // empty but they should still be visible because we have an image t o display.
157 baseLayout.findViewById(R.id.context_header_layout).setVisibility(Vi ew.VISIBLE); 157 baseLayout.findViewById(R.id.context_header_layout).setVisibility(Vi ew.VISIBLE);
158 baseLayout.findViewById(R.id.context_divider).setVisibility(View.VIS IBLE); 158 baseLayout.findViewById(R.id.context_divider).setVisibility(View.VIS IBLE);
159 displayImageHeader(baseLayout, params, activity.getResources()); 159 displayImageHeader(baseLayout, params, activity.getResources());
160 } 160 }
161 161
162 // Set the list adapter and get the height to display it appropriately i n a dialog. 162 // Set the list adapter and get the height to display it appropriately i n a dialog.
163 Runnable onDirectShare = new Runnable() {
164 @Override
165 public void run() {
166 mOnShareItemClicked.run();
167 mDialog.dismiss();
168 }
169 };
163 TabularContextMenuListAdapter listAdapter = 170 TabularContextMenuListAdapter listAdapter =
164 new TabularContextMenuListAdapter(items, activity, mOnShareItemC licked); 171 new TabularContextMenuListAdapter(items, activity, onDirectShare );
165 ViewGroup.LayoutParams layoutParams = listView.getLayoutParams(); 172 ViewGroup.LayoutParams layoutParams = listView.getLayoutParams();
166 layoutParams.height = measureApproximateListViewHeight(listView, listAda pter, maxCount); 173 layoutParams.height = measureApproximateListViewHeight(listView, listAda pter, maxCount);
167 listView.setLayoutParams(layoutParams); 174 listView.setLayoutParams(layoutParams);
168 listView.setAdapter(listAdapter); 175 listView.setAdapter(listAdapter);
169 listView.setOnItemClickListener(this); 176 listView.setOnItemClickListener(this);
170 177
171 return baseLayout; 178 return baseLayout;
172 } 179 }
173 180
174 private void displayHeaderIfVisibleItems(ContextMenuParams params, ViewGroup baseLayout) { 181 private void displayHeaderIfVisibleItems(ContextMenuParams params, ViewGroup baseLayout) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 mHeaderImageView.setImageBitmap(bitmap); 263 mHeaderImageView.setImageBitmap(bitmap);
257 } 264 }
258 } 265 }
259 266
260 @Override 267 @Override
261 public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { 268 public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
262 mDialog.dismiss(); 269 mDialog.dismiss();
263 mCallback.onResult((int) id); 270 mCallback.onResult((int) id);
264 } 271 }
265 } 272 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextmenu/TabularContextMenuListAdapter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698