diff --git a/libs/WindowManager/Shell/res/layout/letterbox_education_overlay_layout.xml b/libs/WindowManager/Shell/res/drawable/letterbox_education_dialog_background.xml
similarity index 70%
rename from libs/WindowManager/Shell/res/layout/letterbox_education_overlay_layout.xml
rename to libs/WindowManager/Shell/res/drawable/letterbox_education_dialog_background.xml
index f4c6d65bad055..3e1a2bce23932 100644
--- a/libs/WindowManager/Shell/res/layout/letterbox_education_overlay_layout.xml
+++ b/libs/WindowManager/Shell/res/drawable/letterbox_education_dialog_background.xml
@@ -14,11 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-
+
+
+
+
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background.xml b/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background.xml
similarity index 91%
rename from libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background.xml
rename to libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background.xml
index 723963ff8c9ad..0d8811357c058 100644
--- a/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background.xml
+++ b/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background.xml
@@ -16,6 +16,6 @@
-->
-
+
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background_ripple.xml b/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background_ripple.xml
similarity index 92%
rename from libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background_ripple.xml
rename to libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background_ripple.xml
index 0a3a81302a49b..0d8a8faa97983 100644
--- a/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_background_ripple.xml
+++ b/libs/WindowManager/Shell/res/drawable/letterbox_education_dismiss_button_background_ripple.xml
@@ -14,8 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-
+
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable/letterbox_education_ic_letterboxed_app.xml b/libs/WindowManager/Shell/res/drawable/letterbox_education_ic_letterboxed_app.xml
new file mode 100644
index 0000000000000..6fcd1de892a30
--- /dev/null
+++ b/libs/WindowManager/Shell/res/drawable/letterbox_education_ic_letterboxed_app.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/layout/letterbox_education_dialog_layout.xml b/libs/WindowManager/Shell/res/layout/letterbox_education_dialog_layout.xml
index edf737fcc86ad..fc6ea9a57e10d 100644
--- a/libs/WindowManager/Shell/res/layout/letterbox_education_dialog_layout.xml
+++ b/libs/WindowManager/Shell/res/layout/letterbox_education_dialog_layout.xml
@@ -13,30 +13,31 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
+ android:background="@android:color/system_neutral1_900">
+
+
-
+ android:orientation="vertical"
+ android:background="@drawable/letterbox_education_dialog_background"
+ android:padding="24dp">
+ android:layout_marginBottom="12dp"
+ android:src="@drawable/letterbox_education_ic_letterboxed_app"/>
+
+
+ android:paddingTop="48dp">
+ app:icon="@drawable/letterbox_education_ic_screen_rotation"
+ app:text="@string/letterbox_education_screen_rotation_text"/>
-
-
+
diff --git a/libs/WindowManager/Shell/res/values/colors.xml b/libs/WindowManager/Shell/res/values/colors.xml
index 84aec640434b9..4606d24d1716d 100644
--- a/libs/WindowManager/Shell/res/values/colors.xml
+++ b/libs/WindowManager/Shell/res/values/colors.xml
@@ -35,6 +35,7 @@
@android:color/system_neutral1_50
+ @android:color/system_accent1_100@android:color/system_neutral2_200
diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml
index 40c7647ecedf0..7a398c5045469 100644
--- a/libs/WindowManager/Shell/res/values/dimen.xml
+++ b/libs/WindowManager/Shell/res/values/dimen.xml
@@ -226,18 +226,14 @@
48dp
- 136dp
+ 140dp
- 18dp
+ 24dp444dp
-
- 20dp
-
200dp
diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml
index 16a4b524803ac..a24311fb1f21b 100644
--- a/libs/WindowManager/Shell/res/values/strings.xml
+++ b/libs/WindowManager/Shell/res/values/strings.xml
@@ -172,19 +172,16 @@
No camera issues? Tap to dismiss.
- Get the most out of %s
+ Some apps work best in portrait
-
- Rotate your screen to portrait
+
+ Try one of these options to make the most of your space
-
- Rotate your screen to landscape
-
-
- Drag in another app to use split screen
+
+ Rotate your device to go full screen
- Double tap to reposition
+ Double-tap next to an app to reposition itGot it
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUILayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUILayout.java
index 29b2baa221e77..d44b4d8f63b6f 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUILayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUILayout.java
@@ -31,7 +31,7 @@ import com.android.wm.shell.R;
/**
* Container for compat UI controls.
*/
-public class CompatUILayout extends LinearLayout {
+class CompatUILayout extends LinearLayout {
private CompatUIWindowManager mWindowManager;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogActionLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogActionLayout.java
index 762a037d19dfa..fc6fd3f2c9596 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogActionLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogActionLayout.java
@@ -16,7 +16,6 @@
package com.android.wm.shell.compatui.letterboxedu;
-import android.annotation.StringRes;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
@@ -32,8 +31,6 @@ import com.android.wm.shell.R;
*/
// TODO(b/215316431): Add tests
class LetterboxEduDialogActionLayout extends FrameLayout {
- private final ImageView mIcon;
- private final TextView mText;
LetterboxEduDialogActionLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -46,26 +43,15 @@ class LetterboxEduDialogActionLayout extends FrameLayout {
/* defStyleRes= */ 0);
int iconId = styledAttributes.getResourceId(
R.styleable.LetterboxEduDialogActionLayout_icon, 0);
- String optionalText = styledAttributes.getString(
+ String text = styledAttributes.getString(
R.styleable.LetterboxEduDialogActionLayout_text);
styledAttributes.recycle();
View rootView = inflate(getContext(), R.layout.letterbox_education_dialog_action_layout,
this);
-
- mIcon = rootView.findViewById(R.id.letterbox_education_dialog_action_icon);
- mIcon.setImageResource(iconId);
- mText = rootView.findViewById(R.id.letterbox_education_dialog_action_text);
- if (optionalText != null) {
- mText.setText(optionalText);
- }
- }
-
- void setText(@StringRes int id) {
- mText.setText(getResources().getString(id));
- }
-
- void setIconRotation(float rotation) {
- mIcon.setRotation(rotation);
+ ((ImageView) rootView.findViewById(
+ R.id.letterbox_education_dialog_action_icon)).setImageResource(iconId);
+ ((TextView) rootView.findViewById(R.id.letterbox_education_dialog_action_text)).setText(
+ text);
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java
index 662862afd4613..fa75d14b4aec1 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java
@@ -17,22 +17,23 @@
package com.android.wm.shell.compatui.letterboxedu;
import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Configuration.Orientation;
-import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
import com.android.wm.shell.R;
/**
- * Container for Letterbox Education Dialog.
+ * Container for Letterbox Education Dialog and background dim.
+ *
+ *
This layout should fill the entire task and the background around the dialog acts as the
+ * background dim which dismisses the dialog when clicked.
*/
// TODO(b/215316431): Add tests
-public class LetterboxEduDialogLayout extends FrameLayout {
+class LetterboxEduDialogLayout extends FrameLayout {
+
+ // The alpha of a background is a number between 0 (fully transparent) to 255 (fully opaque).
+ // 204 is simply 255 * 0.8.
+ private static final int BACKGROUND_DIM_ALPHA = 204;
public LetterboxEduDialogLayout(Context context) {
this(context, null);
@@ -52,43 +53,23 @@ public class LetterboxEduDialogLayout extends FrameLayout {
}
/**
- * Register a callback for the dismiss button.
+ * Register a callback for the dismiss button and background dim.
+ *
* @param callback The callback to register
*/
void setDismissOnClickListener(Runnable callback) {
- findViewById(R.id.letterbox_education_dialog_dismiss).setOnClickListener(
+ findViewById(R.id.letterbox_education_dialog_dismiss_button).setOnClickListener(
view -> callback.run());
+ // Clicks on the background dim should also dismiss the dialog.
+ setOnClickListener(view -> callback.run());
+ // We add a no-op on-click listener to the dialog container so that clicks on it won't
+ // propagate to the listener of the layout (which represents the background dim).
+ findViewById(R.id.letterbox_education_dialog_container).setOnClickListener(view -> {});
}
- /**
- * Updates the layout with the given app info.
- * @param appIcon The name of the app
- * @param appIcon The icon of the app
- */
- void updateAppInfo(String appName, Drawable appIcon) {
- ((ImageView) findViewById(R.id.letterbox_education_icon)).setImageDrawable(appIcon);
- ((TextView) findViewById(R.id.letterbox_education_dialog_title)).setText(
- getResources().getString(R.string.letterbox_education_dialog_title, appName));
- }
-
- /**
- * Updates the layout according to the given orientation.
- * @param orientation The orientation of the display
- */
- void updateDisplayOrientation(@Orientation int orientation) {
- boolean isOrientationPortrait = orientation == Configuration.ORIENTATION_PORTRAIT;
- ((LetterboxEduDialogActionLayout) findViewById(
- R.id.letterbox_education_dialog_screen_rotation_action)).setText(
- isOrientationPortrait
- ? R.string.letterbox_education_screen_rotation_landscape_text
- : R.string.letterbox_education_screen_rotation_portrait_text);
-
- if (isOrientationPortrait) {
- ((LetterboxEduDialogActionLayout) findViewById(
- R.id.letterbox_education_dialog_split_screen_action)).setIconRotation(90f);
- }
-
- findViewById(R.id.letterbox_education_dialog_reposition_action).setVisibility(
- isOrientationPortrait ? View.GONE : View.VISIBLE);
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ getBackground().mutate().setAlpha(BACKGROUND_DIM_ALPHA);
}
}