summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2018-08-21 11:40:23 -0700
committerTony Wickham <twickham@google.com>2018-08-30 16:22:25 -0700
commit6a71a5bd7787a2dc4a585e9e6ea0a440d0458a54 (patch)
treeb3bdc0c63c2540f57042c0d09d82786ec8d1869c /res
parent1654c9e1c00cb41de392880adf7c3a5a558270b3 (diff)
downloadandroid_packages_apps_Trebuchet-6a71a5bd7787a2dc4a585e9e6ea0a440d0458a54.tar.gz
android_packages_apps_Trebuchet-6a71a5bd7787a2dc4a585e9e6ea0a440d0458a54.tar.bz2
android_packages_apps_Trebuchet-6a71a5bd7787a2dc4a585e9e6ea0a440d0458a54.zip
Add undo snackbar for deleting items
- Add methods to ModelWriter to prepareForUndoDelete, then enqueueDeleteRunnable, followed by commitDelete or abortDelete. - Add Snackbar floating view - Show Undo snackbar when dropping or flinging to delete target; if the undo action is clicked, we abort the delete, otherwise we commit it. Bug: 24238108 Change-Id: I9997235e1f8525cbb8b1fa2338099609e7358426
Diffstat (limited to 'res')
-rw-r--r--res/layout/snackbar.xml41
-rw-r--r--res/values/dimens.xml6
-rw-r--r--res/values/strings.xml5
3 files changed, 51 insertions, 1 deletions
diff --git a/res/layout/snackbar.xml b/res/layout/snackbar.xml
new file mode 100644
index 000000000..419fb8220
--- /dev/null
+++ b/res/layout/snackbar.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView
+ android:id="@+id/label"
+ android:layout_height="@dimen/snackbar_content_height"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:textSize="14sp"
+ android:textColor="?android:attr/textColorPrimary"/>
+ <TextView
+ android:id="@+id/action"
+ android:layout_height="@dimen/snackbar_content_height"
+ android:layout_width="wrap_content"
+ android:layout_weight="0"
+ android:gravity="center"
+ android:padding="8dp"
+ android:background="?android:attr/selectableItemBackground"
+ android:textStyle="bold"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textAllCaps="true"/>
+</merge> \ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 58fce3482..e7bd64caa 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -225,4 +225,10 @@
<!-- Overview -->
<dimen name="options_menu_icon_size">24dp</dimen>
<dimen name="options_menu_thumb_size">32dp</dimen>
+
+<!-- Snackbar -->
+ <dimen name="snackbar_height">48dp</dimen>
+ <dimen name="snackbar_content_height">32dp</dimen>
+ <dimen name="snackbar_padding">8dp</dimen>
+ <dimen name="snackbar_margin">16dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7bc11c3be..6d73dcbd1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -259,9 +259,12 @@
<!-- Accessibility confirmation for item added to workspace. -->
<string name="item_added_to_workspace">Item added to home screen</string>
- <!-- Accessibility confirmation for item removed. -->
+ <!-- Accessibility confirmation for item removed. [CHAR_LIMIT=50]-->
<string name="item_removed">Item removed</string>
+ <!-- Action shown in snackbar to undo item removal. [CHAR_LIMIT=15] -->
+ <string name="undo">Undo</string>
+
<!-- Accessibility action to move an item on the workspace. [CHAR_LIMIT=30] -->
<string name="action_move">Move item</string>