Merge "Update Pin widget dialog UI according to mocks." into sc-dev am: acb3cac938
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/13945229 Change-Id: I8b9c97401701cb595fff5952efbbf5f707d55cf9
This commit is contained in:
@@ -116,8 +116,7 @@
|
||||
android:theme="@style/AppItemActivityTheme"
|
||||
android:excludeFromRecents="true"
|
||||
android:autoRemoveFromRecents="true"
|
||||
android:exported="true"
|
||||
android:label="@string/action_add_to_workspace" >
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.content.pm.action.CONFIRM_PIN_SHORTCUT" />
|
||||
<action android:name="android.content.pm.action.CONFIRM_PIN_APPWIDGET" />
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
<corners
|
||||
android:topLeftRadius="?android:attr/dialogCornerRadius"
|
||||
android:topRightRadius="?android:attr/dialogCornerRadius" />
|
||||
</shape>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset
|
||||
android:insetLeft="@dimen/pin_widget_button_inset_horizontal"
|
||||
android:insetRight="@dimen/pin_widget_button_inset_horizontal"
|
||||
android:insetTop="@dimen/pin_widget_button_inset_vertical"
|
||||
android:insetBottom="@dimen/pin_widget_button_inset_vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple
|
||||
android:color="?android:attr/colorControlHighlight">
|
||||
<item>
|
||||
<shape android:tint="?android:attr/colorAccent" android:shape="rectangle">
|
||||
<corners android:radius="18dp" />
|
||||
<solid android:color="#FFFFFF" />
|
||||
<padding
|
||||
android:left="@dimen/pin_widget_button_padding_horizontal"
|
||||
android:top="@dimen/pin_widget_button_padding_vertical"
|
||||
android:right="@dimen/pin_widget_button_padding_horizontal"
|
||||
android:bottom="@dimen/pin_widget_button_padding_vertical" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
||||
</inset>
|
||||
@@ -17,70 +17,51 @@
|
||||
*/
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/add_item_confirmation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
android:orientation="vertical">
|
||||
<ScrollView
|
||||
|
||||
<TextView
|
||||
style="@style/TextHeadline"
|
||||
android:id="@+id/widget_appName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:ellipsize="end"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1" />
|
||||
|
||||
<include layout="@layout/widget_cell"
|
||||
android:id="@+id/widget_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="4dp"
|
||||
android:text="@string/add_item_request_drag_hint" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorPrimaryDark"
|
||||
android:theme="?attr/widgetsTheme">
|
||||
|
||||
<com.android.launcher3.widget.WidgetCell
|
||||
android:id="@+id/widget_cell"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/colorPrimaryDark"
|
||||
android:focusable="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/widget_cell_content" />
|
||||
|
||||
</com.android.launcher3.widget.WidgetCell>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
android:layout_marginVertical="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="4dp" >
|
||||
android:padding="8dp"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onCancelClick"
|
||||
android:text="@android:string/cancel" />
|
||||
|
||||
<Space
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onPlaceAutomaticallyClick"
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- The image of the widget. This view does not support padding. Any placement adjustment
|
||||
should be done using margins.
|
||||
width & height are set at runtime after scaling the preview image. -->
|
||||
should be done using margins. Width & height are set at runtime after scaling the preview
|
||||
image. -->
|
||||
<com.android.launcher3.widget.WidgetImageView
|
||||
android:id="@+id/widget_preview"
|
||||
android:layout_width="0dp"
|
||||
@@ -41,16 +41,15 @@
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/widget_cell_font_size" />
|
||||
|
||||
<!-- The original dimensions of the widget (can't be the same text as above due to different
|
||||
style. -->
|
||||
<!-- The original dimensions of the widget -->
|
||||
<TextView
|
||||
android:id="@+id/widget_dims"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/widget_cell_font_size"
|
||||
android:alpha="0.8" />
|
||||
android:alpha="0.7" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_description"
|
||||
@@ -58,9 +57,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="@dimen/widget_cell_font_size"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:fadingEdge="horizontal" />
|
||||
android:fadingEdge="horizontal"
|
||||
android:alpha="0.7" />
|
||||
|
||||
</merge>
|
||||
@@ -56,7 +56,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:alpha="0.7"
|
||||
tools:text="m widgets, n shortcuts" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
<style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Dialog.Alert">
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
|
||||
<item name="android:windowBackground">@drawable/add_item_dialog_background</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -138,6 +138,12 @@
|
||||
<dimen name="shortcut_preview_padding_right">0dp</dimen>
|
||||
<dimen name="shortcut_preview_padding_top">0dp</dimen>
|
||||
|
||||
<!-- Pin widget dialog -->
|
||||
<dimen name="pin_widget_button_padding_horizontal">8dp</dimen>
|
||||
<dimen name="pin_widget_button_padding_vertical">4dp</dimen>
|
||||
<dimen name="pin_widget_button_inset_horizontal">4dp</dimen>
|
||||
<dimen name="pin_widget_button_inset_vertical">6dp</dimen>
|
||||
|
||||
<!-- Dragging -->
|
||||
<!-- Drag padding to add to the bottom of drop targets -->
|
||||
<dimen name="drop_target_drag_padding">14dp</dimen>
|
||||
|
||||
@@ -145,6 +145,8 @@
|
||||
|
||||
<style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
|
||||
<item name="android:windowBackground">@drawable/add_item_dialog_background</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettingsTheme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
@@ -281,4 +283,8 @@
|
||||
<item name="android:colorControlHighlight">#DFE1E5</item>
|
||||
<item name="android:colorForeground">@color/all_apps_bg_hand_fill_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.DeviceDefault.Button.Rounded.Colored" parent="@android:style/Widget.DeviceDefault.Button.Colored">
|
||||
<item name="android:background">@drawable/add_item_dialog_button_background</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -37,11 +37,14 @@ import android.graphics.Rect;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.DragShadowBuilder;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
@@ -127,6 +130,9 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
|
||||
if (savedInstanceState == null) {
|
||||
logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_START);
|
||||
}
|
||||
|
||||
TextView widgetAppName = findViewById(R.id.widget_appName);
|
||||
widgetAppName.setText(getApplicationInfo().labelRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -326,4 +332,15 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
|
||||
.withItemInfo((ItemInfo) mWidgetCell.getWidgetView().getTag())
|
||||
.log(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
View view = getWindow().getDecorView();
|
||||
WindowManager.LayoutParams layoutParams =
|
||||
(WindowManager.LayoutParams) view.getLayoutParams();
|
||||
layoutParams.gravity = Gravity.BOTTOM;
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
getWindowManager().updateViewLayout(view, layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user