Commit 3fa1a096 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Contacts Picker: Show data in the dialog.

This implements the CategoryView, showing all contacts in a list,
allowing for selection and reporting back.

Bug: 860467
Change-Id: I83d7e068ab7e2c6cd97631f9f79204042c49bd77
Reviewed-on: https://chromium-review.googlesource.com/1172787
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarBecky Zhou <huayinz@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583221}
parent 782c0e31
......@@ -35,6 +35,7 @@ by a child template that "extends" this file.
{% endif %}
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH"/>
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission-sdk-23 android:name="android.permission.READ_CONTACTS"/>
<uses-permission-sdk-23 android:name="android.permission.REORDER_TASKS"/>
<uses-permission-sdk-23 android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!-- Represents a single item in the Contacts Picker. -->
<view class="org.chromium.chrome.browser.contacts_picker.ContactView"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:paddingBottom="10dp"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:paddingTop="12dp"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/name"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="5dp"
android:layout_toEndOf="@id/image"
style="@style/BlackTitle1" />
<TextView
android:id="@+id/email"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingBottom="5dp"
android:layout_below="@id/name"
android:layout_alignStart="@id/name"
style="@style/BlackBody"/>
<ImageView
android:id="@+id/selected"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginStart="2dp"
android:layout_marginTop="2dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:visibility="gone"
android:layout_alignParentEnd="true"
app:srcCompat="@drawable/checkmark_blue"
tools:ignore="ContentDescription" />
</RelativeLayout>
</view>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<org.chromium.chrome.browser.widget.selection.SelectableListLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/selectable_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/modern_primary_color"
android:fitsSystemWindows="true" />
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<org.chromium.chrome.browser.contacts_picker.ContactsPickerToolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="0dp"
android:paddingEnd="0dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end">
<Button
android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/done"
style="@style/MainButtonStyle" />
</LinearLayout>
</org.chromium.chrome.browser.contacts_picker.ContactsPickerToolbar>
......@@ -192,6 +192,9 @@
<!-- Favicon colors -->
<color name="default_favicon_background_color">#787878</color>
<!-- Contacts Picker colors -->
<color name="selectable_list_item_highlight_color">@color/default_primary_color</color>
<!-- Photo Picker colors -->
<color name="photo_picker_tile_bg_color">@color/google_grey_200</color>
<color name="photo_picker_special_tile_bg_color">@color/google_grey_300</color>
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.contacts_picker;
import android.support.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
/**
* A class to keep track of the metadata associated with a contact.
*/
public class ContactDetails implements Comparable<ContactDetails> {
// The unique id for the contact.
private String mId;
// The display name for this contact.
private String mDisplayName;
// The list of emails registered for this contact.
private List<String> mEmails;
/**
* The ContactDetails constructor.
* @param id The unique identifier of this contact.
* @param displayName The display name of this contact.
* @param emails The emails registered for this contact.
*/
public ContactDetails(String id, String displayName, List<String> emails) {
mDisplayName = displayName;
mEmails = emails;
mId = id;
}
/**
* Accessor for the display name.
* @return The full display name.
*/
public String getDisplayName() {
return mDisplayName;
}
/**
* Accessor for the abbreviated display name (first letter of first name and first letter of
* last name).
* @return The display name, abbreviated to two characters.
*/
public String getDisplayNameAbbreviation() {
// Display the two letter abbreviation of the display name.
String displayChars = "";
if (mDisplayName.length() > 0) {
displayChars += mDisplayName.charAt(0);
String[] parts = mDisplayName.split(" ");
if (parts.length > 1) {
displayChars += parts[parts.length - 1].charAt(0);
}
}
return displayChars;
}
/**
* Accessor for the list of emails (as strings separated by newline).
* @return A string containing all the emails registered for this contact.
*/
public String getEmailsAsString() {
int count = 0;
StringBuilder builder = new StringBuilder();
for (String email : mEmails) {
if (count++ > 0) {
builder.append("\n");
}
builder.append(email);
}
return builder.toString();
}
/**
* A comparison function (results in a full name ascending sorting).
* @param other The other ContactDetails object to compare it with.
* @return 0, 1, or -1, depending on which is bigger.
*/
@Override
public int compareTo(ContactDetails other) {
return other.mDisplayName.compareTo(mDisplayName);
}
@Override
public int hashCode() {
Object[] values = {mId, mDisplayName, mEmails};
return Arrays.hashCode(values);
}
@Override
public boolean equals(@Nullable Object object) {
if (object == null) return false;
if (object == this) return true;
if (!(object instanceof ContactDetails)) return false;
ContactDetails otherInfo = (ContactDetails) object;
return mId.equals(otherInfo.mId);
}
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.contacts_picker;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.selection.SelectableItemView;
import org.chromium.chrome.browser.widget.selection.SelectionDelegate;
import java.util.List;
/**
* A container class for a view showing a contact in the Contacts Picker.
*/
public class ContactView extends SelectableItemView<ContactDetails> {
// Our context.
private Context mContext;
// Our parent category.
private PickerCategoryView mCategoryView;
// Our selection delegate.
private SelectionDelegate<ContactDetails> mSelectionDelegate;
// The details of the contact shown.
private ContactDetails mContactDetails;
// The image view containing the abbreviated letters of the name.
private ImageView mImage;
// The control that signifies the contact has been selected.
private ImageView mSelectedView;
// The display name of the contact.
public TextView mDisplayName;
// The emails for the contact.
public TextView mEmails;
/**
* Constructor for inflating from XML.
*/
public ContactView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mImage = (ImageView) findViewById(R.id.image);
mDisplayName = (TextView) findViewById(R.id.name);
mEmails = (TextView) findViewById(R.id.email);
mSelectedView = (ImageView) findViewById(R.id.selected);
}
@Override
public void onClick() {
// Clicks are disabled until initialize() has been called.
if (mContactDetails == null) return;
// The SelectableItemView expects long press to be the selection event, but this class wants
// that to happen on click instead.
onLongClick(this);
}
@Override
public void setChecked(boolean checked) {
super.setChecked(checked);
updateSelectionState();
}
@Override
public void onSelectionStateChange(List<ContactDetails> selectedItems) {
// If the user cancels the dialog before this object has initialized, the SelectionDelegate
// will try to notify us that all selections have been cleared. However, we don't need to
// process that message.
if (mContactDetails == null) return;
// When SelectAll or Undo is used, the underlying UI must be updated
// to reflect the changes.
boolean selected = selectedItems.contains(mContactDetails);
boolean checked = super.isChecked();
if (selected != checked) super.toggle();
updateSelectionState();
}
/**
* Sets the {@link PickerCategoryView} for this ContactView.
* @param categoryView The category view showing the images. Used to access
* common functionality and sizes and retrieve the {@link SelectionDelegate}.
*/
public void setCategoryView(PickerCategoryView categoryView) {
mCategoryView = categoryView;
mSelectionDelegate = mCategoryView.getSelectionDelegate();
setSelectionDelegate(mSelectionDelegate);
}
/**
* Completes the initialization of the ContactView. Must be called before the
* {@link ContactView} can respond to click events.
* @param contactDetails The details about the contact represented by this ContactView.
*/
public void initialize(ContactDetails contactDetails) {
resetTile();
mContactDetails = contactDetails;
setItem(contactDetails);
String displayName = contactDetails.getDisplayName();
mDisplayName.setText(displayName);
mEmails.setText(contactDetails.getEmailsAsString());
Bitmap icon = mCategoryView.getIconGenerator().generateIconForText(
contactDetails.getDisplayNameAbbreviation());
mImage.setImageBitmap(icon);
updateSelectionState();
}
/**
* Resets the view to its starting state, which is necessary when the view is about to be
* re-used.
*/
private void resetTile() {
mImage.setImageBitmap(null);
mDisplayName.setText("");
mEmails.setText("");
mSelectedView.setVisibility(View.GONE);
}
/**
* Updates the selection controls for this view.
*/
private void updateSelectionState() {
boolean checked = super.isChecked();
if (checked) {
Resources resources = mContext.getResources();
setBackgroundColor(ApiCompatibilityUtils.getColor(
resources, R.color.selectable_list_item_highlight_color));
} else {
setBackgroundColor(Color.TRANSPARENT);
}
mSelectedView.setVisibility(checked ? View.VISIBLE : View.GONE);
}
}
......@@ -17,6 +17,9 @@ import java.util.List;
* &lt;input type=file accept=contacts &gt; form element.
*/
public class ContactsPickerDialog extends AlertDialog {
// The category we're showing contacts for.
private PickerCategoryView mCategoryView;
/**
* The ContactsPickerDialog constructor.
* @param context The context to use.
......@@ -27,5 +30,10 @@ public class ContactsPickerDialog extends AlertDialog {
public ContactsPickerDialog(Context context, ContactsPickerListener listener,
boolean allowMultiple, List<String> mimeTypes) {
super(context, R.style.FullscreenWhite);
// Initialize the main content view.
mCategoryView = new PickerCategoryView(context);
mCategoryView.initialize(this, listener, mimeTypes);
setView(mCategoryView);
}
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.contacts_picker;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.TextView;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.selection.SelectableListToolbar;
import java.util.List;
/**
* Handles toolbar functionality for the {@ContactsPickerDialog}.
*/
public class ContactsPickerToolbar extends SelectableListToolbar<ContactDetails> {
public ContactsPickerToolbar(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
showCloseButton();
TextView up = (TextView) mNumberRollView.findViewById(R.id.up);
TextView down = (TextView) mNumberRollView.findViewById(R.id.down);
// TODO(finnur): Change this to use pre-defined styles.
up.setTextColor(Color.BLACK);
down.setTextColor(Color.BLACK);
}
/**
* Shows the Close or 'X' navigation button in the upper left corner.
*/
public void showCloseButton() {
setNavigationIcon(R.drawable.btn_close);
setNavigationContentDescription(R.string.close);
}
@Override
protected void showSelectionView(
List<ContactDetails> selectedItems, boolean wasSelectionEnabled) {
switchToNumberRollView(selectedItems, wasSelectionEnabled);
}
@Override
public void onSelectionStateChange(List<ContactDetails> selectedItems) {
super.onSelectionStateChange(selectedItems);
Button done = (Button) findViewById(R.id.done);
done.setEnabled(selectedItems.size() > 0);
}
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.contacts_picker;
import android.database.Cursor;
import android.provider.ContactsContract;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import org.chromium.chrome.R;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
/**
* A data adapter for the Contacts Picker.
*/
public class PickerAdapter extends Adapter<ViewHolder> {
// The category view to use to show the contacts.
private PickerCategoryView mCategoryView;
// A cursor containing the raw contacts data.
private Cursor mContactsCursor;
/**
* Holds on to a {@link ContactView} that displays information about a contact.
*/
public class ContactViewHolder extends ViewHolder {
/**
* The ContactViewHolder.
* @param itemView The {@link ContactView} view for showing the contact details.
*/
public ContactViewHolder(ContactView itemView) {
super(itemView);
}
}
private static final String[] PROJECTION = {
ContactsContract.Contacts._ID, ContactsContract.Contacts.LOOKUP_KEY,
ContactsContract.Contacts.DISPLAY_NAME_PRIMARY,
};
/**
* The PickerAdapter constructor.
* @param categoryView The category view to use to show the contacts.
*/
public PickerAdapter(PickerCategoryView categoryView) {
mCategoryView = categoryView;
mContactsCursor = mCategoryView.getActivity().getContentResolver().query(
ContactsContract.Contacts.CONTENT_URI, PROJECTION, null, null,
ContactsContract.Contacts.DISPLAY_NAME_PRIMARY + " ASC");
}
/**
* Fetches all known contacts and their emails.
* @return The contact list as a set.
*/
public Set<ContactDetails> getAllContacts() {
Set<ContactDetails> contacts = new HashSet<>();
if (!mContactsCursor.moveToFirst()) return contacts;
do {
String id = mContactsCursor.getString(
mContactsCursor.getColumnIndex(ContactsContract.Contacts._ID));
String name = mContactsCursor.getString(
mContactsCursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY));
contacts.add(new ContactDetails(id, name, getEmails()));
} while (mContactsCursor.moveToNext());
return contacts;
}
// RecyclerView.Adapter:
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ContactView itemView = (ContactView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.contact_view, parent, false);
itemView.setCategoryView(mCategoryView);
return new ContactViewHolder(itemView);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
String id = "";
String name = "";
if (mContactsCursor.moveToPosition(position)) {
id = mContactsCursor.getString(
mContactsCursor.getColumnIndex(ContactsContract.Contacts._ID));
name = mContactsCursor.getString(
mContactsCursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY));
}
((ContactView) holder.itemView).initialize(new ContactDetails(id, name, getEmails()));
}
private Cursor getEmailCursor(String id) {
Cursor emailCursor = mCategoryView.getActivity().getContentResolver().query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + id, null,
ContactsContract.CommonDataKinds.Email.DATA + " ASC");
return emailCursor;
}
private ArrayList<String> getEmails() {
// Look up all associated emails for this contact.
// TODO(finnur): Investigate whether we can do this in one go with the original cursor...
String id = mContactsCursor.getString(
mContactsCursor.getColumnIndex(ContactsContract.Contacts._ID));
Cursor emailCursor = getEmailCursor(id);
ArrayList<String> emails = new ArrayList<String>();
while (emailCursor.moveToNext()) {
emails.add(emailCursor.getString(
emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)));
}
emailCursor.close();
return emails;
}
@Override
public int getItemCount() {
return mContactsCursor.getCount();
}
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.contacts_picker;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
import org.chromium.chrome.browser.widget.selection.SelectableListLayout;
import org.chromium.chrome.browser.widget.selection.SelectionDelegate;
import org.chromium.ui.ContactsPickerListener;
import org.chromium.ui.UiUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* A class for keeping track of common data associated with showing contact details in
* the contacts picker, for example the RecyclerView.
*/
public class PickerCategoryView extends RelativeLayout implements View.OnClickListener {
// Constants for the RoundedIconGenerator.
private static final int ICON_SIZE_DP = 32;
private static final int ICON_CORNER_RADIUS_DP = 20;
private static final int ICON_TEXT_SIZE_DP = 12;
// The dialog that owns us.
private ContactsPickerDialog mDialog;
// The view containing the RecyclerView and the toolbar, etc.
private SelectableListLayout<ContactDetails> mSelectableListLayout;
// Our activity.
private Activity mActivity;
// The callback to notify the listener of decisions reached in the picker.
private ContactsPickerListener mListener;
// The toolbar located at the top of the dialog.
private ContactsPickerToolbar mToolbar;
// The RecyclerView showing the images.
private RecyclerView mRecyclerView;
// The {@link PickerAdapter} for the RecyclerView.
private PickerAdapter mPickerAdapter;
// The layout manager for the RecyclerView.
private LinearLayoutManager mLayoutManager;
// A helper class to draw the icon for each contact.
private RoundedIconGenerator mIconGenerator;
// The {@link SelectionDelegate} keeping track of which contacts are selected.
private SelectionDelegate<ContactDetails> mSelectionDelegate;
// The Done text button that confirms the selection choice.
private Button mDoneButton;
// The MIME types requested.
private List<String> mMimeTypes;
@SuppressWarnings("unchecked") // mSelectableListLayout
public PickerCategoryView(Context context) {
super(context);
mActivity = (Activity) context;
mSelectionDelegate = new SelectionDelegate<ContactDetails>();
Resources resources = getActivity().getResources();
int iconColor =
ApiCompatibilityUtils.getColor(resources, R.color.default_favicon_background_color);
mIconGenerator = new RoundedIconGenerator(resources, ICON_SIZE_DP, ICON_SIZE_DP,
ICON_CORNER_RADIUS_DP, iconColor, ICON_TEXT_SIZE_DP);
View root = LayoutInflater.from(context).inflate(R.layout.contacts_picker_dialog, this);
mSelectableListLayout =
(SelectableListLayout<ContactDetails>) root.findViewById(R.id.selectable_list);
mPickerAdapter = new PickerAdapter(this);
mRecyclerView = mSelectableListLayout.initializeRecyclerView(mPickerAdapter);
mToolbar = (ContactsPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.contacts_picker_toolbar, mSelectionDelegate,
R.string.contacts_picker_select_contacts, null, 0, 0, R.color.modern_primary_color,
null, false, false);
mToolbar.setNavigationOnClickListener(this);
mDoneButton = (Button) mToolbar.findViewById(R.id.done);
mDoneButton.setOnClickListener(this);
mLayoutManager = new LinearLayoutManager(mActivity);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(mLayoutManager);
}
/**
* Initializes the PickerCategoryView object.
* @param dialog The dialog showing us.
* @param listener The listener who should be notified of actions.
* @param mimeTypes A list of mime types to show in the dialog.
*/
public void initialize(
ContactsPickerDialog dialog, ContactsPickerListener listener, List<String> mimeTypes) {
mDialog = dialog;
mListener = listener;
mMimeTypes = new ArrayList<>(mimeTypes);
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
executeAction(ContactsPickerListener.ContactsPickerAction.CANCEL, null);
}
});
mPickerAdapter.notifyDataSetChanged();
}
// OnClickListener:
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.done) {
notifyContactsSelected();
} else {
executeAction(ContactsPickerListener.ContactsPickerAction.CANCEL, null);
}
}
// Simple accessors:
public Activity getActivity() {
return mActivity;
}
public SelectionDelegate<ContactDetails> getSelectionDelegate() {
return mSelectionDelegate;
}
public RoundedIconGenerator getIconGenerator() {
return mIconGenerator;
}
/**
* Notifies any listeners that one or more contacts have been selected.
*/
private void notifyContactsSelected() {
List<ContactDetails> selectedFiles = mSelectionDelegate.getSelectedItems();
Collections.sort(selectedFiles);
String[] contacts = new String[selectedFiles.size()];
int i = 0;
for (ContactDetails contactDetails : selectedFiles) {
contacts[i++] = contactDetails.getDisplayName();
}
executeAction(ContactsPickerListener.ContactsPickerAction.CONTACTS_SELECTED, contacts);
}
/**
* Report back what the user selected in the dialog, report UMA and clean up.
* @param action The action taken.
* @param contacts The contacts that were selected (if any).
*/
private void executeAction(
ContactsPickerListener.ContactsPickerAction action, String[] contacts) {
mListener.onContactsPickerUserAction(action, contacts);
mDialog.dismiss();
UiUtils.onContactsPickerDismissed();
}
}
......@@ -19,6 +19,7 @@ import java.util.List;
* Handles toolbar functionality for the Photo Picker class.
*/
public class PhotoPickerToolbar extends SelectableListToolbar<PickerBitmap> {
// TODO(finnur): Match style changes from Contacts Picker and delete blue_when_enabled.
public PhotoPickerToolbar(Context context, AttributeSet attrs) {
super(context, attrs);
}
......
......@@ -53,9 +53,9 @@ public abstract class SelectableItemView<E> extends SelectableItemViewBase<E> {
protected void onFinishInflate() {
super.onFinishInflate();
mIconView = findViewById(R.id.icon_view);
mTitleView = findViewById(R.id.title);
mDescriptionView = findViewById(R.id.description);
mIconView = (TintedImageView) findViewById(R.id.icon_view);
mTitleView = (TextView) findViewById(R.id.title);
mDescriptionView = (TextView) findViewById(R.id.description);
if (mIconView != null) {
mIconView.setBackgroundResource(R.drawable.list_item_icon_modern_bg);
......
......@@ -156,8 +156,8 @@ public class SelectableListLayout<E>
mRecyclerView = recyclerView;
// Replace the inflated recycler view with the one supplied to this method.
FrameLayout contentView = findViewById(R.id.list_content);
RecyclerView existingView = contentView.findViewById(R.id.recycler_view);
FrameLayout contentView = (FrameLayout) findViewById(R.id.list_content);
RecyclerView existingView = (RecyclerView) contentView.findViewById(R.id.recycler_view);
contentView.removeView(existingView);
contentView.addView(mRecyclerView, 0);
}
......
......@@ -3394,6 +3394,11 @@ However, you aren’t invisible. Going private doesn’t hide your browsing from
<ph name="BEGIN_LINK">&lt;link&gt;</ph>Get help<ph name="END_LINK">&lt;/link&gt;</ph>
</message>
<!-- Contacts Picker strings -->
<message name="IDS_CONTACTS_PICKER_SELECT_CONTACTS" desc="The label at the top of the dialog that allows users to select contacts from their device and share the details with a web page.">
Select contacts
</message>
<!-- Photo Picker strings -->
<message name="IDS_DECODER_DESCRIPTION" desc="The title for the image decoder utility service.">
Image decoder
......
dd7eff76d816beaf11e0fe267ec43250c56f9f03
\ No newline at end of file
......@@ -267,7 +267,12 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java",
"java/src/org/chromium/chrome/browser/compositor/scene_layer/ToolbarSceneLayer.java",
"java/src/org/chromium/chrome/browser/consent_auditor/ConsentAuditorBridge.java",
"java/src/org/chromium/chrome/browser/contacts_picker/ContactDetails.java",
"java/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerDialog.java",
"java/src/org/chromium/chrome/browser/contacts_picker/ContactsPickerToolbar.java",
"java/src/org/chromium/chrome/browser/contacts_picker/ContactView.java",
"java/src/org/chromium/chrome/browser/contacts_picker/PickerAdapter.java",
"java/src/org/chromium/chrome/browser/contacts_picker/PickerCategoryView.java",
"java/src/org/chromium/chrome/browser/content/ContentUtils.java",
"java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java",
"java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/black_alpha_38" />
<item android:color="@color/modern_blue_600"/>
</selector>
......@@ -154,7 +154,7 @@
<item name="android:textAllCaps">true</item>
</style>
<style name="BlueButtonText2" parent="RobotoMediumStyle" tools:ignore="UnusedResources">
<item name="android:textColor">@color/modern_blue_600</item>
<item name="android:textColor">@color/blue_when_enabled</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textAllCaps">true</item>
</style>
......
......@@ -246,9 +246,6 @@ public class SelectFileDialog
// Use the new contacts picker, if available.
if (shouldUseContactsPicker()
&& UiUtils.showContactsPicker(activity, this, mAllowMultiple, mFileTypes)) {
// Since the dialog is not implemented, cancel the request so we can serve others.
// This will be removed once the select/cancel actions are implemented.
onFileNotSelected();
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment