Merge "Update All Set page to expressive style" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c7268c11c
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2025 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="@color/materialColorSecondaryContainer" />
|
||||
<corners android:radius="48dp" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2025 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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<Button
|
||||
android:id="@+id/navigation_settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/allset_change_navigation_mode_button"
|
||||
android:gravity="center_horizontal"
|
||||
android:minHeight="48dp"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:text="@string/allset_navigation_settings_expressive"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/materialColorOnSecondaryContainer"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle" />
|
||||
|
||||
</merge>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2025 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.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/root_view">
|
||||
|
||||
<View
|
||||
android:id="@+id/wallpaper_scrim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/suw_all_set_scrim"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="72dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:paddingHorizontal="@dimen/allset_page_padding_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Title.AllSet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/suw_all_set_expressive_theme_color"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle.AllSet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_subtitle_margin_top"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/suw_all_set_expressive_theme_color"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/suw_all_set_expressive_theme_color"
|
||||
android:textSize="@dimen/allset_page_swipe_up_text_size_expressive"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<include layout="@layout/allset_navigation_expressive" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2025 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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<Button
|
||||
android:id="@+id/navigation_settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="24dp"
|
||||
android:background="@drawable/allset_change_navigation_mode_button"
|
||||
android:gravity="center_horizontal"
|
||||
android:minHeight="48dp"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:text="@string/allset_navigation_settings_expressive"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/materialColorOnSecondaryContainer"
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/hint"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
</merge>
|
||||
@@ -40,4 +40,5 @@
|
||||
<dimen name="allset_page_padding_horizontal">120dp</dimen>
|
||||
<dimen name="allset_page_allset_text_size">38sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size">15sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size_expressive">16sp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<!-- All Set page-->
|
||||
<dimen name="allset_page_allset_text_size">42sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size">16sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size_expressive">16sp</dimen>
|
||||
|
||||
<!-- Taskbar swipe up thresholds -->
|
||||
<dimen name="taskbar_from_nav_threshold">30dp</dimen>
|
||||
|
||||
@@ -305,6 +305,7 @@
|
||||
<dimen name="allset_page_padding_horizontal">40dp</dimen>
|
||||
<dimen name="allset_page_allset_text_size">36sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size">14sp</dimen>
|
||||
<dimen name="allset_page_swipe_up_text_size_expressive">16sp</dimen>
|
||||
|
||||
<dimen name="allset_title_margin_top">24dp</dimen>
|
||||
<dimen name="allset_title_icon_margin_top">32dp</dimen>
|
||||
|
||||
@@ -228,6 +228,22 @@
|
||||
<string name="allset_description_fallback">You\u2019re ready to start using your device</string>
|
||||
<!-- String linking to navigation settings on "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_navigation_settings"><annotation id="link">System navigation settings</annotation></string>
|
||||
<!-- New Title of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_title_expressive">Your <xliff:g id="device" example="Pixel 9">%1$s</xliff:g> is \nready!</string>
|
||||
<!-- Description of "All Set" page on the user's device when no device name is provided [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_title_expressive_fallback">Your device is \nready!</string>
|
||||
<!-- New subtitle of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_subtitle_expressive">Enjoy your new <xliff:g id="device" example="phone">%1$s</xliff:g>!</string>
|
||||
<!-- String linking to navigation settings on "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_navigation_settings_expressive"><annotation id="link">Choose how to navigate</annotation></string>
|
||||
<!-- Hint string at the bottom of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_hint_expressive">Swipe up</string>
|
||||
<!-- Hint string at the bottom of "All Set" page for button navigation [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_button_hint_expressive">Tap the home button</string>
|
||||
<!-- String representing device type of a Tablet [CHAR LIMIT=30] -->
|
||||
<string name="allset_device_type_tablet">tablet</string>
|
||||
<!-- String representing device type of a Phone [CHAR LIMIT=30] -->
|
||||
<string name="allset_device_type_phone">phone</string>
|
||||
|
||||
<!-- ******* Overview ******* -->
|
||||
<!-- Label for a button that causes the current overview app to be shared. [CHAR_LIMIT=40] -->
|
||||
|
||||
@@ -214,6 +214,11 @@
|
||||
<item name="android:windowShowWallpaper">false</item>
|
||||
</style>
|
||||
|
||||
<style name="AllSetTheme.Expressive" parent="AllSetTheme">
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Can be applied to views to color things like ripples and list highlights the workspace text
|
||||
color.
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.quickstep.interaction;
|
||||
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
|
||||
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
|
||||
|
||||
import static com.android.app.animation.Interpolators.ACCELERATE;
|
||||
import static com.android.app.animation.Interpolators.FAST_OUT_SLOW_IN;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.Utilities.mapBoundToRange;
|
||||
@@ -29,7 +30,6 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
@@ -42,8 +42,10 @@ import android.graphics.PointF;
|
||||
import android.graphics.RadialGradient;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader.TileMode;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.text.TextUtils;
|
||||
@@ -77,6 +79,7 @@ import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||
import com.android.quickstep.util.ActivityPreloadUtil;
|
||||
import com.android.quickstep.util.LottieAnimationColorUtils;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
import com.android.wm.shell.shared.TypefaceUtils.FontFamily;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
|
||||
@@ -102,10 +105,18 @@ public class AllSetActivity extends Activity {
|
||||
private static final String LOTTIE_PRIMARY_COLOR_TOKEN = ".primary";
|
||||
private static final String LOTTIE_TERTIARY_COLOR_TOKEN = ".tertiary";
|
||||
|
||||
private static final String SUW_THEME_SYSTEM_PROPERTY = "setupwizard.theme";
|
||||
private static final String GLIF_EXPRESSIVE_THEME = "glif_expressive";
|
||||
private static final String GLIF_EXPRESSIVE_LIGHT_THEME = "glif_expressive_light";
|
||||
|
||||
private boolean mIsExpressiveThemeEnabledInSUW = false;
|
||||
|
||||
private static final float HINT_BOTTOM_FACTOR = 1 - .94f;
|
||||
|
||||
private static final int MAX_SWIPE_DURATION = 350;
|
||||
|
||||
private static final int WALLPAPER_BLUR_RADIUS = 30;
|
||||
|
||||
private static final float ANIMATION_PAUSE_ALPHA_THRESHOLD = 0.1f;
|
||||
|
||||
private static final String KEY_BACKGROUND_ANIMATION_TOGGLED_ON =
|
||||
@@ -137,67 +148,96 @@ public class AllSetActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
String SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, "");
|
||||
mIsExpressiveThemeEnabledInSUW = SUWTheme.equals(GLIF_EXPRESSIVE_THEME) || SUWTheme.equals(
|
||||
GLIF_EXPRESSIVE_LIGHT_THEME);
|
||||
if (mIsExpressiveThemeEnabledInSUW) setTheme(R.style.AllSetTheme_Expressive);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_allset);
|
||||
mRootView = findViewById(R.id.root_view);
|
||||
mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
boolean isDarkTheme =
|
||||
(getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
|
||||
== Configuration.UI_MODE_NIGHT_YES;
|
||||
String suwDeviceName = getIntent().getStringExtra(EXTRA_DEVICE_NAME);
|
||||
if (mIsExpressiveThemeEnabledInSUW) {
|
||||
setupExpressiveTheme(suwDeviceName);
|
||||
} else {
|
||||
setupDefaultTheme(savedInstanceState, isDarkTheme, suwDeviceName);
|
||||
}
|
||||
initializeCommonViewsAndListeners();
|
||||
configureSystemUI(isDarkTheme);
|
||||
|
||||
Resources resources = getResources();
|
||||
int mode = resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
boolean isDarkTheme = mode == Configuration.UI_MODE_NIGHT_YES;
|
||||
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
|
||||
mVibrator = getSystemService(Vibrator.class);
|
||||
getIDP().addOnChangeListener(mOnIDPChangeListener);
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.addOverviewChangeListener(mOverviewChangeListener);
|
||||
ActivityPreloadUtil.preloadOverviewForSUWAllSet(this);
|
||||
}
|
||||
|
||||
private void configureSystemUI(boolean isDarkTheme) {
|
||||
int systemBarsMask = APPEARANCE_LIGHT_STATUS_BARS | APPEARANCE_LIGHT_NAVIGATION_BARS;
|
||||
int systemBarsAppearance = isDarkTheme ? 0 : systemBarsMask;
|
||||
Window window = getWindow();
|
||||
WindowInsetsController insetsController = window == null
|
||||
? null
|
||||
: window.getInsetsController();
|
||||
|
||||
if (insetsController != null) {
|
||||
insetsController.setSystemBarsAppearance(systemBarsAppearance, systemBarsMask);
|
||||
}
|
||||
if (mIsExpressiveThemeEnabledInSUW && window != null) {
|
||||
window.setBackgroundBlurRadius(WALLPAPER_BLUR_RADIUS);
|
||||
}
|
||||
mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
int accentColor = intent.getIntExtra(
|
||||
isDarkTheme ? EXTRA_ACCENT_COLOR_DARK_MODE : EXTRA_ACCENT_COLOR_LIGHT_MODE,
|
||||
isDarkTheme ? Color.WHITE : Color.BLACK);
|
||||
private void initializeCommonViewsAndListeners() {
|
||||
mHintView = findViewById(R.id.hint);
|
||||
mHintView.setAccessibilityDelegate(new SkipButtonAccessibilityDelegate());
|
||||
updateHint();
|
||||
|
||||
((ImageView) findViewById(R.id.icon)).getDrawable().mutate().setTint(accentColor);
|
||||
mSwipeUpShift = getResources().getDimension(R.dimen.allset_swipe_up_shift);
|
||||
|
||||
mBackground = new BgDrawable(this);
|
||||
mRootView.setBackground(mBackground);
|
||||
mSwipeUpShift = resources.getDimension(R.dimen.allset_swipe_up_shift);
|
||||
|
||||
TextView subtitle = findViewById(R.id.subtitle);
|
||||
String suwDeviceName = intent.getStringExtra(EXTRA_DEVICE_NAME);
|
||||
subtitle.setText(TextUtils.isEmpty(suwDeviceName)
|
||||
? getString(R.string.allset_description_fallback)
|
||||
: getString(R.string.allset_description_generic, suwDeviceName));
|
||||
|
||||
TextView settings = findViewById(R.id.navigation_settings);
|
||||
settings.setTextColor(accentColor);
|
||||
settings.setOnClickListener(v -> {
|
||||
View navigationSettings = findViewById(R.id.navigation_settings);
|
||||
navigationSettings.setOnClickListener(v -> {
|
||||
try {
|
||||
// This is the action that starts the system navigation settings page
|
||||
startActivityForResult(
|
||||
Intent.parseUri(URI_SYSTEM_NAVIGATION_SETTING, 0), 0);
|
||||
} catch (URISyntaxException e) {
|
||||
Log.e(LOG_TAG, "Failed to parse system nav settings intent", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mHintView = findViewById(R.id.hint);
|
||||
mHintView.setAccessibilityDelegate(new SkipButtonAccessibilityDelegate());
|
||||
updateHint();
|
||||
private void setupDefaultTheme(@Nullable Bundle savedInstanceState, boolean isDarkTheme,
|
||||
String suwDeviceName) {
|
||||
setContentView(R.layout.activity_allset);
|
||||
mRootView = findViewById(R.id.root_view);
|
||||
|
||||
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
|
||||
mBackground = new BgDrawable(this);
|
||||
mRootView.setBackground(mBackground);
|
||||
|
||||
int accentColor = getIntent().getIntExtra(
|
||||
isDarkTheme ? EXTRA_ACCENT_COLOR_DARK_MODE : EXTRA_ACCENT_COLOR_LIGHT_MODE,
|
||||
isDarkTheme ? Color.WHITE : Color.BLACK);
|
||||
|
||||
((ImageView) findViewById(R.id.icon)).getDrawable().mutate().setTint(accentColor);
|
||||
TextView navigationSettings = findViewById(R.id.navigation_settings);
|
||||
navigationSettings.setTextColor(accentColor);
|
||||
|
||||
TextView subtitle = findViewById(R.id.subtitle);
|
||||
subtitle.setText(TextUtils.isEmpty(suwDeviceName)
|
||||
? getString(R.string.allset_description_fallback)
|
||||
: getString(R.string.allset_description_generic, suwDeviceName));
|
||||
|
||||
mVibrator = getSystemService(Vibrator.class);
|
||||
mAnimatedBackground = findViewById(R.id.animated_background);
|
||||
// There's a bug in the currently used external Lottie library (v5.2.0), and it doesn't load
|
||||
// the correct animation from the raw resources when configuration changes, so we need to
|
||||
// manually load the resource and pass it to Lottie.
|
||||
mAnimatedBackground.setAnimation(resources.openRawResource(R.raw.all_set_page_bg),
|
||||
mAnimatedBackground.setAnimation(getResources().openRawResource(R.raw.all_set_page_bg),
|
||||
null);
|
||||
|
||||
LottieAnimationColorUtils.updateToColorResources(
|
||||
@@ -214,19 +254,44 @@ public class AllSetActivity extends Activity {
|
||||
mBackgroundAnimationToggledOn = !mBackgroundAnimationToggledOn;
|
||||
maybeResumeOrPauseBackgroundAnimation();
|
||||
});
|
||||
|
||||
setUpBackgroundAnimation(getDP().getDeviceProperties().isTablet());
|
||||
getIDP().addOnChangeListener(mOnIDPChangeListener);
|
||||
}
|
||||
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.addOverviewChangeListener(mOverviewChangeListener);
|
||||
ActivityPreloadUtil.preloadOverviewForSUWAllSet(this);
|
||||
private void setupExpressiveTheme(String suwDeviceName) {
|
||||
setContentView(R.layout.activity_allset_expressive);
|
||||
mRootView = findViewById(R.id.root_view);
|
||||
|
||||
TextView title = findViewById(R.id.title);
|
||||
TextView subtitle = findViewById(R.id.subtitle);
|
||||
mHintView = findViewById(R.id.hint);
|
||||
TextView navigationSettings = findViewById(R.id.navigation_settings);
|
||||
title.setText(TextUtils.isEmpty(suwDeviceName)
|
||||
? getString(R.string.allset_title_expressive_fallback)
|
||||
: getString(R.string.allset_title_expressive, suwDeviceName));
|
||||
String deviceType = getDP().getDeviceProperties().isTablet()
|
||||
? getString(R.string.allset_device_type_tablet)
|
||||
: getString(R.string.allset_device_type_phone);
|
||||
subtitle.setText(getString(R.string.allset_subtitle_expressive, deviceType));
|
||||
|
||||
title.setTypeface(
|
||||
Typeface.create(FontFamily.GSF_HEADLINE_LARGE_EMPHASIZED.getValue(),
|
||||
Typeface.NORMAL));
|
||||
subtitle.setTypeface(
|
||||
Typeface.create(FontFamily.GSF_BODY_MEDIUM.getValue(), Typeface.NORMAL));
|
||||
mHintView.setTypeface(
|
||||
Typeface.create(FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED.getValue(),
|
||||
Typeface.NORMAL));
|
||||
navigationSettings.setTypeface(
|
||||
Typeface.create(FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED.getValue(),
|
||||
Typeface.NORMAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(KEY_BACKGROUND_ANIMATION_TOGGLED_ON, mBackgroundAnimationToggledOn);
|
||||
if (!mIsExpressiveThemeEnabledInSUW) {
|
||||
outState.putBoolean(KEY_BACKGROUND_ANIMATION_TOGGLED_ON, mBackgroundAnimationToggledOn);
|
||||
}
|
||||
}
|
||||
|
||||
private InvariantDeviceProfile getIDP() {
|
||||
@@ -238,8 +303,17 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
|
||||
private void updateHint() {
|
||||
mHintView.setText(
|
||||
getDP().getDeviceProperties().isGestureMode() ? R.string.allset_hint : R.string.allset_button_hint);
|
||||
if (mIsExpressiveThemeEnabledInSUW) {
|
||||
mHintView.setText(
|
||||
getDP().getDeviceProperties().isGestureMode()
|
||||
? R.string.allset_hint_expressive
|
||||
: R.string.allset_button_hint_expressive);
|
||||
} else {
|
||||
mHintView.setText(
|
||||
getDP().getDeviceProperties().isGestureMode()
|
||||
? R.string.allset_hint
|
||||
: R.string.allset_button_hint);
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUiHelperThread(Runnable runnable) {
|
||||
@@ -251,7 +325,7 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
|
||||
private void setUpBackgroundAnimation(boolean forTablet) {
|
||||
if (mVibrator == null) {
|
||||
if (mVibrator == null || mIsExpressiveThemeEnabledInSUW) {
|
||||
return;
|
||||
}
|
||||
boolean supportsThud = mVibrator.areAllPrimitivesSupported(
|
||||
@@ -311,6 +385,9 @@ public class AllSetActivity extends Activity {
|
||||
setSetupUIVisible(true);
|
||||
binder.setSwipeUpProxy(this::createSwipeUpProxy);
|
||||
}
|
||||
if (mIsExpressiveThemeEnabledInSUW) {
|
||||
getWindow().setBackgroundBlurRadius(WALLPAPER_BLUR_RADIUS);
|
||||
}
|
||||
}
|
||||
|
||||
private void onTISConnected(TISBinder binder) {
|
||||
@@ -388,6 +465,9 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
|
||||
private void maybeResumeOrPauseBackgroundAnimation() {
|
||||
if (mIsExpressiveThemeEnabledInSUW) {
|
||||
return;
|
||||
}
|
||||
boolean shouldPlayAnimation =
|
||||
!RemoveAnimationSettingsTracker.INSTANCE.get(this).isRemoveAnimationEnabled()
|
||||
&& getContentViewAlphaForSwipeProgress() > ANIMATION_PAUSE_ALPHA_THRESHOLD
|
||||
@@ -401,7 +481,13 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
|
||||
private void onSwipeProgressUpdate() {
|
||||
mBackground.setProgress(mSwipeProgress.value);
|
||||
if (!mIsExpressiveThemeEnabledInSUW) {
|
||||
mBackground.setProgress(mSwipeProgress.value);
|
||||
} else {
|
||||
getWindow().setBackgroundBlurRadius((int) mapBoundToRange(
|
||||
mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR, WALLPAPER_BLUR_RADIUS, 0,
|
||||
ACCELERATE));
|
||||
}
|
||||
float alpha = getContentViewAlphaForSwipeProgress();
|
||||
mRootView.setAlpha(alpha);
|
||||
mRootView.setTranslationY((alpha - 1) * mSwipeUpShift);
|
||||
|
||||
@@ -252,6 +252,9 @@
|
||||
<color name="widget_cell_title_color_dark">@color/system_on_surface_dark</color>
|
||||
<color name="widget_cell_subtitle_color_dark">@color/system_on_surface_variant_dark</color>
|
||||
|
||||
<color name="suw_all_set_expressive_theme_color">#ECDFE5</color>
|
||||
<color name="suw_all_set_scrim">#40000000</color>
|
||||
|
||||
<color name="material_color_surface_container_lowest">#FFFFFF</color>
|
||||
<color name="material_color_on_surface">#1B1B1F</color>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user