Commit c6fb6010 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Contacts Picker: Move Select All/Undo up into the toolbar.

This also removes the dependency on the Floating Action Button
and sets the accessibility text for the Select All, Undo and
Search buttons.

Bug: 876823, 860467
Change-Id: I1fc2758ddb72db133bf489ef7a0f71783b5d2ac9
Reviewed-on: https://chromium-review.googlesource.com/1190342Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586734}
parent 93859a4c
......@@ -13,6 +13,6 @@
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#FFFFFF"
android:fillColor="@color/default_icon_color"
android:pathData="M3 5h2V3c-1.1 0-2 0.9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-0.9-2-2-2zM5 21v-2H3c0 1.1 0.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-0.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z" />
</vector>
......@@ -14,7 +14,7 @@
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#FFFFFF"
android:fillColor="@color/default_icon_color"
android:pathData="M12.5 8c-2.65 0-5.05 0.99 -6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-0.78C21.08 11.03 17.15 8 12.5 8z" />
</vector>
......@@ -3,27 +3,10 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<FrameLayout
<org.chromium.chrome.browser.widget.selection.SelectableListLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/selectable_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<org.chromium.chrome.browser.widget.selection.SelectableListLayout
android:id="@+id/selectable_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/modern_primary_color" />
<!-- TODO(finnur): Probably not the right widget for the final UI, but this will change anyway
once the UX designer is involved. -->
<android.support.design.widget.FloatingActionButton
android:id="@+id/action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:backgroundTint="@color/default_icon_color_blue"
app:srcCompat="@drawable/ic_select_all" />
</FrameLayout>
\ No newline at end of file
android:background="@color/modern_primary_color"
android:fitsSystemWindows="true" />
......@@ -19,13 +19,22 @@
android:layout_gravity="end">
<!-- The ContentDescription for this View gets set in Java -->
<ImageView
android:id="@+id/action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="10dp"
android:src="@drawable/ic_select_all"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/ic_search"
tools:ignore="ContentDescription" />
android:contentDescription="@string/search" />
<Button
android:id="@+id/done"
......
......@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.contacts_picker;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
......@@ -80,7 +79,11 @@ public class PickerCategoryView extends RelativeLayout
private Button mDoneButton;
// The action button in the bottom right corner.
private FloatingActionButton mActionButton;
private ImageView mActionButton;
// The accessibility labels for the two states of the action button.
private String mLabelSelectAll;
private String mLabelUndo;
// The action button has two modes, Select All and Undo. This keeps track of which mode is
// active.
......@@ -115,17 +118,20 @@ public class PickerCategoryView extends RelativeLayout
mToolbar.setNavigationOnClickListener(this);
mToolbar.initializeSearchView(this, R.string.contacts_picker_search, 0);
mActionButton = (ImageView) root.findViewById(R.id.action);
mActionButton.setOnClickListener(this);
mSearchButton = (ImageView) mToolbar.findViewById(R.id.search);
mSearchButton.setOnClickListener(this);
mDoneButton = (Button) mToolbar.findViewById(R.id.done);
mDoneButton.setOnClickListener(this);
mLabelSelectAll = resources.getString(R.string.select_all);
mLabelUndo = resources.getString(R.string.undo);
mActionButton.setContentDescription(mLabelSelectAll);
mLayoutManager = new LinearLayoutManager(context);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(mLayoutManager);
mActionButton = (FloatingActionButton) root.findViewById(R.id.action);
mActionButton.setOnClickListener(this);
}
/**
......@@ -226,9 +232,11 @@ public class PickerCategoryView extends RelativeLayout
mPreviousSelection = mSelectionDelegate.getSelectedItems();
mSelectionDelegate.setSelectedItems(mPickerAdapter.getAllContacts());
mActionButton.setImageResource(R.drawable.ic_undo);
mActionButton.setContentDescription(mLabelUndo);
} else {
mSelectionDelegate.setSelectedItems(mPreviousSelection);
mActionButton.setImageResource(R.drawable.ic_select_all);
mActionButton.setContentDescription(mLabelSelectAll);
mPreviousSelection = null;
}
mSelectAllMode = !mSelectAllMode;
......
......@@ -200,6 +200,9 @@ CHAR-LIMIT guidelines:
<message name="IDS_SELECT" desc="Prompt for user to select something. [CHAR-LIMIT=20]">
Select
</message>
<message name="IDS_SELECT_ALL" desc="Prompt for user to select everything.">
Select all
</message>
<message name="IDS_ADD" desc="Prompt for the user to add something, like a new address. [CHAR-LIMIT=20]">
Add
</message>
......
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