Letterbox Education: Cleanup the toast layout.
The toast is no longer needed since we decided to only show the letterbox education once as a dialog. Test: N/A Bug: 207010227 Change-Id: I1dccf10d0effad111d8ee8e62a068e4dee571c20
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/system_neutral2_400"
|
||||
android:pathData="M16.59,8.59L12.0,13.17 7.41,8.59 6.0,10.0l6.0,6.0 6.0,-6.0z"/>
|
||||
</vector>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@android:color/system_neutral2_200">
|
||||
<item android:drawable="@drawable/letterbox_education_ic_expand_more"/>
|
||||
</ripple>
|
||||
@@ -1,61 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2022 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.wm.shell.compatui.LetterboxEduToastLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/compat_controls_background"
|
||||
android:gravity="center"
|
||||
android:paddingVertical="14dp"
|
||||
android:paddingHorizontal="16dp">
|
||||
|
||||
<!-- Adding an extra layer to animate the alpha of the background and content separately. -->
|
||||
<LinearLayout
|
||||
android:id="@+id/letterbox_education_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/letterbox_education_icon"
|
||||
android:layout_width="@dimen/letterbox_education_toast_icon_size"
|
||||
android:layout_height="@dimen/letterbox_education_toast_icon_size"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="@dimen/letterbox_education_toast_text_max_width"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:lineSpacingExtra="5sp"
|
||||
android:text="@string/letterbox_education_toast_title"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/compat_controls_text"
|
||||
android:textSize="16sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/letterbox_education_toast_expand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/letterbox_education_ic_expand_more_ripple"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/letterbox_education_expand_button_description"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.wm.shell.compatui.LetterboxEduToastLayout>
|
||||
@@ -219,18 +219,9 @@
|
||||
<!-- The width of the camera compat hint. -->
|
||||
<dimen name="camera_compat_hint_width">143dp</dimen>
|
||||
|
||||
<!-- The corner radius of the letterbox education toast. -->
|
||||
<dimen name="letterbox_education_toast_corner_radius">100dp</dimen>
|
||||
|
||||
<!-- The corner radius of the letterbox education dialog. -->
|
||||
<dimen name="letterbox_education_dialog_corner_radius">28dp</dimen>
|
||||
|
||||
<!-- The margin between the letterbox education toast/dialog and the bottom of the task. -->
|
||||
<dimen name="letterbox_education_margin_bottom">16dp</dimen>
|
||||
|
||||
<!-- The size of the icon in the letterbox education toast. -->
|
||||
<dimen name="letterbox_education_toast_icon_size">24dp</dimen>
|
||||
|
||||
<!-- The size of an icon in the letterbox education dialog. -->
|
||||
<dimen name="letterbox_education_dialog_icon_size">48dp</dimen>
|
||||
|
||||
@@ -243,9 +234,6 @@
|
||||
<!-- The maximum width of the title and subtitle in the letterbox education dialog. -->
|
||||
<dimen name="letterbox_education_dialog_title_max_width">444dp</dimen>
|
||||
|
||||
<!-- The maximum width of the text in the letterbox education toast. -->
|
||||
<dimen name="letterbox_education_toast_text_max_width">398dp</dimen>
|
||||
|
||||
<!-- The distance that the letterbox education dialog will move up during appear/dismiss
|
||||
animation. -->
|
||||
<dimen name="letterbox_education_dialog_animation_elevation">20dp</dimen>
|
||||
|
||||
@@ -174,9 +174,6 @@
|
||||
<!-- The title of the letterbox education dialog. [CHAR LIMIT=NONE] -->
|
||||
<string name="letterbox_education_dialog_title">Get the most out of <xliff:g id="app_name" example="YouTube">%s</xliff:g></string>
|
||||
|
||||
<!-- The title of the letterbox education toast. [CHAR LIMIT=60] -->
|
||||
<string name="letterbox_education_toast_title">Rotate your device for a full-screen view</string>
|
||||
|
||||
<!-- Description of the rotate screen into portrait action. [CHAR LIMIT=NONE] -->
|
||||
<string name="letterbox_education_screen_rotation_portrait_text">Rotate your screen to portrait</string>
|
||||
|
||||
@@ -192,7 +189,4 @@
|
||||
<!-- Button text for dismissing the letterbox education dialog. [CHAR LIMIT=20] -->
|
||||
<string name="letterbox_education_got_it">Got it</string>
|
||||
|
||||
<!-- Accessibility description of the letterbox education toast expand to dialog button. [CHAR LIMIT=NONE] -->
|
||||
<string name="letterbox_education_expand_button_description">Expand for more information.</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.wm.shell.compatui.letterboxedu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.wm.shell.R;
|
||||
|
||||
/**
|
||||
* Container for the Letterbox Education Toast.
|
||||
*/
|
||||
// TODO(b/215316431): Add tests
|
||||
public class LetterboxEduToastLayout extends FrameLayout {
|
||||
|
||||
public LetterboxEduToastLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LetterboxEduToastLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public LetterboxEduToastLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
public LetterboxEduToastLayout(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback for the dismiss button.
|
||||
* @param callback The callback to register
|
||||
*/
|
||||
void setExpandOnClickListener(Runnable callback) {
|
||||
findViewById(R.id.letterbox_education_toast_expand).setOnClickListener(
|
||||
view -> callback.run());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the layout with the given app info.
|
||||
* @param appName The name of the app
|
||||
* @param appIcon The icon of the app
|
||||
*/
|
||||
void updateAppInfo(String appName, Drawable appIcon) {
|
||||
ImageView icon = findViewById(R.id.letterbox_education_icon);
|
||||
icon.setContentDescription(appName);
|
||||
icon.setImageDrawable(appIcon);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user