Using same layout for drop-target bar in landscape and portrait
> Adding a tooltip on drag over when the text is not visible
Bug: 71709920
Change-Id: I1897a8dacd191fb1aeaec37f5d5c73c49517192a
diff --git a/res/drawable/tooltip_frame.xml b/res/drawable/tooltip_frame.xml
new file mode 100644
index 0000000..0319051
--- /dev/null
+++ b/res/drawable/tooltip_frame.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?android:attr/colorBackground" />
+ <corners android:radius="2dp" />
+</shape>
\ No newline at end of file
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index f26bfbd..bcaba81 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -67,7 +67,7 @@
<include
android:id="@+id/drop_target_bar"
- layout="@layout/drop_target_bar_vert" />
+ layout="@layout/drop_target_bar" />
<include layout="@layout/all_apps"
android:id="@+id/apps_view"
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index cde3bd5..eb9c34c 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -66,7 +66,7 @@
<include
android:id="@+id/drop_target_bar"
- layout="@layout/drop_target_bar_horz" />
+ layout="@layout/drop_target_bar" />
<include layout="@layout/all_apps"
android:id="@+id/apps_view"
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index fe2f108..fa1a100 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -60,7 +60,7 @@
<include
android:id="@+id/drop_target_bar"
- layout="@layout/drop_target_bar_horz" />
+ layout="@layout/drop_target_bar" />
<!-- Keep these behind the workspace so that they are not visible when
we go into AllApps -->
diff --git a/res/layout/drop_target_bar.xml b/res/layout/drop_target_bar.xml
new file mode 100644
index 0000000..d376bcf
--- /dev/null
+++ b/res/layout/drop_target_bar.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+<com.android.launcher3.DropTargetBar xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dynamic_grid_drop_target_size"
+ android:layout_gravity="center_horizontal|top"
+ android:focusable="false"
+ android:alpha="0"
+ android:theme="@style/HomeScreenElementTheme"
+ android:visibility="invisible">
+
+ <!-- Delete target -->
+ <com.android.launcher3.DeleteDropTarget
+ android:id="@+id/delete_target_text"
+ style="@style/DropTargetButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/remove_drop_target_label" />
+
+ <!-- App Info -->
+ <com.android.launcher3.InfoDropTarget
+ android:id="@+id/info_target_text"
+ style="@style/DropTargetButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/app_info_drop_target_label" />
+
+ <!-- Uninstall target -->
+ <com.android.launcher3.UninstallDropTarget
+ android:id="@+id/uninstall_target_text"
+ style="@style/DropTargetButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="@string/uninstall_drop_target_label" />
+
+</com.android.launcher3.DropTargetBar>
\ No newline at end of file
diff --git a/res/layout/drop_target_bar_horz.xml b/res/layout/drop_target_bar_horz.xml
deleted file mode 100644
index ed18192..0000000
--- a/res/layout/drop_target_bar_horz.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-<com.android.launcher3.DropTargetBar
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto"
- android:theme="@style/HomeScreenElementTheme"
- android:layout_width="match_parent"
- android:layout_height="@dimen/dynamic_grid_drop_target_size"
- android:visibility="invisible"
- android:layout_gravity="center_horizontal|top"
- android:focusable="false">
-
- <FrameLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1" >
-
- <!-- Delete target -->
-
- <com.android.launcher3.DeleteDropTarget
- launcher:hideParentOnDisable="true"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:gravity="center"
- android:id="@+id/delete_target_text"
- style="@style/DropTargetButton"
- android:text="@string/remove_drop_target_label" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1" >
-
- <!-- App Info -->
-
- <com.android.launcher3.InfoDropTarget
- launcher:hideParentOnDisable="true"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:gravity="center"
- android:id="@+id/info_target_text"
- style="@style/DropTargetButton"
- android:text="@string/app_info_drop_target_label" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1" >
-
- <!-- Uninstall target -->
-
- <com.android.launcher3.UninstallDropTarget
- launcher:hideParentOnDisable="true"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:gravity="center"
- android:id="@+id/uninstall_target_text"
- style="@style/DropTargetButton"
- android:text="@string/uninstall_drop_target_label" />
- </FrameLayout>
-
-</com.android.launcher3.DropTargetBar>
\ No newline at end of file
diff --git a/res/layout/drop_target_bar_vert.xml b/res/layout/drop_target_bar_vert.xml
deleted file mode 100644
index 2394d0d..0000000
--- a/res/layout/drop_target_bar_vert.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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.
--->
-<com.android.launcher3.DropTargetBar
- android:theme="@style/HomeScreenElementTheme"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/dynamic_grid_drop_target_size"
- android:orientation="vertical"
- android:layout_height="match_parent"
- android:layout_gravity="left"
- android:visibility="invisible"
- android:focusable="false"
- android:paddingTop="@dimen/vert_drop_target_vertical_gap" >
-
- <!-- Delete target -->
- <com.android.launcher3.DeleteDropTarget
- android:layout_width="match_parent"
- android:layout_height="@dimen/dynamic_grid_drop_target_size"
- android:gravity="center"
- android:paddingLeft="@dimen/vert_drop_target_horizontal_gap"
- android:paddingRight="@dimen/vert_drop_target_horizontal_gap"
- android:id="@+id/delete_target_text" />
-
- <!-- Uninstall target -->
- <com.android.launcher3.UninstallDropTarget
- android:layout_width="match_parent"
- android:layout_height="@dimen/dynamic_grid_drop_target_size"
- android:gravity="center"
- android:paddingLeft="@dimen/vert_drop_target_horizontal_gap"
- android:paddingRight="@dimen/vert_drop_target_horizontal_gap"
- android:id="@+id/uninstall_target_text"
- android:layout_marginTop="@dimen/vert_drop_target_vertical_gap"/>
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <!-- App Info -->
- <com.android.launcher3.InfoDropTarget
- android:layout_width="match_parent"
- android:layout_height="@dimen/dynamic_grid_drop_target_size"
- android:gravity="center"
- android:paddingLeft="@dimen/vert_drop_target_horizontal_gap"
- android:paddingRight="@dimen/vert_drop_target_horizontal_gap"
- android:id="@+id/info_target_text"
- android:layout_marginBottom="64dp"/>
-
-</com.android.launcher3.DropTargetBar>
\ No newline at end of file
diff --git a/res/layout/drop_target_tool_tip.xml b/res/layout/drop_target_tool_tip.xml
new file mode 100644
index 0000000..a3efec4
--- /dev/null
+++ b/res/layout/drop_target_tool_tip.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/tooltip_frame"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:maxWidth="256dp"
+ android:paddingBottom="6.5dp"
+ android:paddingEnd="16dp"
+ android:paddingStart="16dp"
+ android:paddingTop="6.5dp"
+ android:textSize="14sp"
+ android:fontFamily="sans-serif"
+ android:textColor="?android:attr/colorForeground" />
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index ad5f0b8..2033d46 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -91,10 +91,6 @@
<attr name="layout_ignoreInsets" format="boolean" />
</declare-styleable>
- <declare-styleable name="ButtonDropTarget">
- <attr name="hideParentOnDisable" format="boolean" />
- </declare-styleable>
-
<declare-styleable name="InvariantDeviceProfile">
<attr name="name" format="string" />
<attr name="minWidthDps" format="float" />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f53fe79..a0aaca3 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -49,8 +49,7 @@
<!-- Drop target bar -->
<dimen name="dynamic_grid_drop_target_size">48dp</dimen>
- <dimen name="vert_drop_target_vertical_gap">20dp</dimen>
- <dimen name="vert_drop_target_horizontal_gap">14dp</dimen>
+ <dimen name="drop_target_vertical_gap">20dp</dimen>
<!-- App Widget resize frame -->
<dimen name="widget_handle_margin">13dp</dimen>