Remove "Select up to max items" message label
Bug: 197941418
Test: manual
Change-Id: Ice8974780b3cdec388150680b15d09de89de85f7
Merged-In: Ice8974780b3cdec388150680b15d09de89de85f7
(cherry picked from commit 271b4f38e80f44bf1e14a57c5191654e0ec82958)
diff --git a/res/layout/item_message.xml b/res/layout/item_message.xml
deleted file mode 100644
index 84e29ed..0000000
--- a/res/layout/item_message.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- ~ Copyright (C) 2021 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/item_message"
- android:layout_width="match_parent"
- android:layout_height="@dimen/picker_message_height"
- android:textAppearance="@style/PickerMessage"
- android:gravity="center"
-/>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 8c7eb35..596dd5b 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -27,7 +27,6 @@
<color name="picker_toolbar_icon_color">#E8EAED</color>
<color name="picker_toolbar_chip_text_color">#E8EAED</color>
<color name="picker_toolbar_title_color">#FFFFFF</color>
- <color name="picker_message_text_color">#9AA0A6</color>
<!-- PhotoPicker Profile Button -->
<color name="picker_profile_button_content_color">#A8C7FA</color>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 544c41c..2337f98 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -26,7 +26,6 @@
<color name="picker_background_color">@android:color/white</color>
<color name="picker_highlight_color">#E8F0FE</color>
<color name="picker_date_header_text_color">#3C4043</color>
- <color name="picker_message_text_color">#5F6368</color>
<color name="picker_toolbar_icon_color">#3C4043</color>
<color name="picker_toolbar_chip_text_color">#5F6368</color>
<color name="picker_toolbar_title_color">#3C4043</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 346803b..a56d8d5 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -41,8 +41,6 @@
<dimen name="picker_date_header_height">56dp</dimen>
<dimen name="picker_date_header_padding">16dp</dimen>
- <dimen name="picker_message_height">32dp</dimen>
-
<dimen name="picker_album_name_min_height">20dp</dimen>
<dimen name="picker_album_name_margin">8dp</dimen>
<dimen name="picker_album_item_count_height">16dp</dimen>
diff --git a/res/values/styles_text.xml b/res/values/styles_text.xml
index d7f5dec..b972c8b 100644
--- a/res/values/styles_text.xml
+++ b/res/values/styles_text.xml
@@ -16,10 +16,6 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="PickerMessage" parent="@android:style/TextAppearance.Material.Caption">
- <item name="android:textColor">@color/picker_message_text_color</item>
- </style>
-
<style name="PickerDateHeader" parent="@android:style/TextAppearance.Material.Title">
<item name="android:textColor">@color/picker_date_header_text_color</item>
<item name="android:textSize">16sp</item>
diff --git a/src/com/android/providers/media/photopicker/data/model/Item.java b/src/com/android/providers/media/photopicker/data/model/Item.java
index c1b59dc..c69bbee 100644
--- a/src/com/android/providers/media/photopicker/data/model/Item.java
+++ b/src/com/android/providers/media/photopicker/data/model/Item.java
@@ -80,7 +80,6 @@
private boolean mIsVideo;
private boolean mIsGif;
private boolean mIsDate;
- private boolean mIsMessage;
private Item() {}
@@ -118,10 +117,6 @@
return mIsDate;
}
- public boolean isMessage() {
- return mIsMessage;
- }
-
public Uri getContentUri() {
return mUri;
}
@@ -145,15 +140,6 @@
}
/**
- * Return a message item.
- */
- public static Item createMessageItem() {
- final Item item = new Item();
- item.mIsMessage = true;
- return item;
- }
-
- /**
* Return the date item. If dateTaken is 0, it is a recent item.
* @param dateTaken the time of date taken. The unit is in milliseconds since
* January 1, 1970 00:00:00.0 UTC.
diff --git a/src/com/android/providers/media/photopicker/ui/MessageHolder.java b/src/com/android/providers/media/photopicker/ui/MessageHolder.java
deleted file mode 100644
index b9d0430..0000000
--- a/src/com/android/providers/media/photopicker/ui/MessageHolder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.providers.media.photopicker.ui;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.text.TextUtils;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-
-import com.android.providers.media.R;
-
-import java.text.NumberFormat;
-import java.util.Locale;
-
-/**
- * ViewHolder of a message within a RecyclerView.
- */
-public class MessageHolder extends BaseViewHolder {
- private TextView mMessage;
- private int mMaxCount;
- public MessageHolder(@NonNull Context context, @NonNull ViewGroup parent, int maxCount) {
- super(context, parent, R.layout.item_message);
- mMaxCount = maxCount;
- mMessage = (TextView) itemView.findViewById(R.id.item_message);
- }
-
- @Override
- public void bind() {
- final Resources res = itemView.getResources();
- final CharSequence quantityText = res.getQuantityString(R.plurals.select_up_to, mMaxCount);
- final String itemCountString = NumberFormat.getInstance(Locale.getDefault()).format(
- mMaxCount);
- mMessage.setText(TextUtils.expandTemplate(quantityText, itemCountString));
- }
-}
diff --git a/src/com/android/providers/media/photopicker/ui/PhotosTabAdapter.java b/src/com/android/providers/media/photopicker/ui/PhotosTabAdapter.java
index 6b08f6c..881dde6 100644
--- a/src/com/android/providers/media/photopicker/ui/PhotosTabAdapter.java
+++ b/src/com/android/providers/media/photopicker/ui/PhotosTabAdapter.java
@@ -36,7 +36,6 @@
public static final int ITEM_TYPE_DATE_HEADER = 0;
private static final int ITEM_TYPE_PHOTO = 1;
- private static final int ITEM_TYPE_MESSAGE = 2;
public static final int COLUMN_COUNT = 3;
@@ -58,10 +57,6 @@
if (viewType == ITEM_TYPE_DATE_HEADER) {
return new DateHeaderHolder(viewGroup.getContext(), viewGroup);
}
- if (viewType == ITEM_TYPE_MESSAGE) {
- return new MessageHolder(viewGroup.getContext(), viewGroup,
- mPickerViewModel.getMaxSelectionLimit());
- }
return new PhotoGridHolder(viewGroup.getContext(), viewGroup, mImageLoader,
mPickerViewModel.canSelectMultiple());
}
@@ -88,9 +83,6 @@
@Override
public int getItemViewType(int position) {
- if (getItem(position).isMessage()) {
- return ITEM_TYPE_MESSAGE;
- }
if (getItem(position).isDate()) {
return ITEM_TYPE_DATE_HEADER;
}
@@ -114,9 +106,9 @@
@Override
public int getSpanSize(int position) {
final int itemViewType = getItemViewType(position);
- // For the item view type is ITEM_TYPE_DATE_HEADER or ITEM_TYPE_MESSAGE, it is full
+ // For the item view type is ITEM_TYPE_DATE_HEADER, it is full
// span, return the span count of the layoutManager.
- if (itemViewType == ITEM_TYPE_DATE_HEADER || itemViewType == ITEM_TYPE_MESSAGE) {
+ if (itemViewType == ITEM_TYPE_DATE_HEADER ) {
return layoutManager.getSpanCount();
} else {
return 1;
diff --git a/src/com/android/providers/media/photopicker/viewmodel/PickerViewModel.java b/src/com/android/providers/media/photopicker/viewmodel/PickerViewModel.java
index e0fed67..70d95e7 100644
--- a/src/com/android/providers/media/photopicker/viewmodel/PickerViewModel.java
+++ b/src/com/android/providers/media/photopicker/viewmodel/PickerViewModel.java
@@ -78,9 +78,6 @@
private int mMaxSelectionLimit = DEFAULT_MAX_SELECTION_LIMIT;
// This is set to false when max selection limit is reached.
private boolean mIsSelectionAllowed = true;
- // Show max label text view if and only if caller sets acceptable value for
- // {@link MediaStore#EXTRA_PICK_IMAGES_MAX}
- private boolean mShowMaxLabel = false;
private int mBottomSheetState;
public PickerViewModel(@NonNull Application application) {
@@ -199,10 +196,6 @@
int recentSize = 0;
long currentDateTaken = 0;
- // add max label message header item
- if (mShowMaxLabel) {
- items.add(Item.createMessageItem());
- }
if (showRecent) {
// add Recent date header
@@ -372,7 +365,6 @@
if (extraMax <= DEFAULT_MAX_SELECTION_LIMIT) {
mMaxSelectionLimit = extraMax;
}
- mShowMaxLabel = true;
}
}
diff --git a/tests/src/com/android/providers/media/photopicker/data/model/ItemTest.java b/tests/src/com/android/providers/media/photopicker/data/model/ItemTest.java
index de13581..230afdd 100644
--- a/tests/src/com/android/providers/media/photopicker/data/model/ItemTest.java
+++ b/tests/src/com/android/providers/media/photopicker/data/model/ItemTest.java
@@ -51,7 +51,6 @@
assertThat(item.getDuration()).isEqualTo(duration);
assertThat(item.getContentUri()).isEqualTo(Uri.parse("content://media/external/file/1"));
- assertThat(item.isMessage()).isFalse();
assertThat(item.isDate()).isFalse();
assertThat(item.isImage()).isTrue();
assertThat(item.isVideo()).isFalse();
@@ -76,7 +75,6 @@
assertThat(item.getDuration()).isEqualTo(duration);
assertThat(item.getContentUri()).isEqualTo(Uri.parse("content://10@media/external/file/1"));
- assertThat(item.isMessage()).isFalse();
assertThat(item.isDate()).isFalse();
assertThat(item.isImage()).isTrue();
assertThat(item.isVideo()).isFalse();
@@ -92,7 +90,6 @@
final Item item = generateItem(id, mimeType, dateTaken, duration);
assertThat(item.isImage()).isTrue();
- assertThat(item.isMessage()).isFalse();
assertThat(item.isDate()).isFalse();
assertThat(item.isVideo()).isFalse();
assertThat(item.isGif()).isFalse();
@@ -107,7 +104,6 @@
final Item item = generateItem(id, mimeType, dateTaken, duration);
assertThat(item.isVideo()).isTrue();
- assertThat(item.isMessage()).isFalse();
assertThat(item.isDate()).isFalse();
assertThat(item.isImage()).isFalse();
assertThat(item.isGif()).isFalse();
@@ -122,7 +118,6 @@
final Item item = generateItem(id, mimeType, dateTaken, duration);
assertThat(item.isGif()).isTrue();
- assertThat(item.isMessage()).isFalse();
assertThat(item.isDate()).isFalse();
assertThat(item.isImage()).isFalse();
assertThat(item.isVideo()).isFalse();
@@ -138,17 +133,6 @@
assertThat(item.isDate()).isTrue();
}
- @Test
- public void testCreateMessageItem() {
- final Item item = Item.createMessageItem();
-
- assertThat(item.isMessage()).isTrue();
- assertThat(item.isDate()).isFalse();
- assertThat(item.isImage()).isFalse();
- assertThat(item.isVideo()).isFalse();
- assertThat(item.isGif()).isFalse();
- }
-
private static Cursor generateCursorForItem(String id, String mimeType, long dateTaken,
long duration) {
final MatrixCursor cursor = new MatrixCursor(ItemColumns.ALL_COLUMNS);