Merge "Wallpaper clean up as a result of getting rid of USE_SURFACE_VIEW_FOR_PREVIEW flag" into ub-launcher3-master
diff --git a/res/layout/fragment_custom_theme_component.xml b/res/layout/fragment_custom_theme_component.xml
index fb3e5b3..26feab8 100644
--- a/res/layout/fragment_custom_theme_component.xml
+++ b/res/layout/fragment_custom_theme_component.xml
@@ -58,32 +58,39 @@
android:background="@color/divider_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/component_preview_container"/>
-
- <TextView
- android:id="@+id/component_options_title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginVertical="18dp"
- android:layout_marginHorizontal="16dp"
- android:textAlignment="center"
- android:textAppearance="@style/TitleTextAppearance"
- android:textSize="@dimen/component_options_title_size"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/component_preview_container"
- app:layout_constraintBottom_toTopOf="@+id/options_container"/>
+ app:layout_constraintBottom_toTopOf="@+id/component_scroll_view"/>
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/options_container"
+ <ScrollView
+ android:id="@+id/component_scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_gravity="center_horizontal"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/component_options_title"
- app:layout_constraintVertical_bias="1"/>
+ app:layout_constraintTop_toBottomOf="@+id/divider"
+ app:layout_constraintBottom_toBottomOf="parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/component_options_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginVertical="18dp"
+ android:layout_marginHorizontal="16dp"
+ android:textAlignment="center"
+ android:textAppearance="@style/TitleTextAppearance"
+ android:textSize="@dimen/component_options_title_size" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/options_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"/>
+ </LinearLayout>
+ </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d5291c0..02b3472 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -31,14 +31,9 @@
<color name="clockface_preview_background">@android:color/black</color>
<color name="theme_preview_icon_color">@color/google_grey700</color>
- <color name="theme_preview_workspace_shadow_color_dark">#B0000000</color>
- <color name="theme_preview_workspace_shadow_color_transparent">@android:color/transparent</color>
<color name="theme_preview_color_icons_background">@color/material_white_100</color>
<color name="theme_preview_color_icons_title_color">@color/black_87_alpha</color>
- <color name="text_color_dark">#2d2d2d</color>
- <color name="text_color_light">@color/material_white_text</color>
-
<color name="control_grey">#757575</color>
<color name="switch_track_tint">#acacac</color>
<color name="switch_thumb_tint">#f1f1f1</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 1c6242e..280c187 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -86,7 +86,6 @@
<dimen name="preview_theme_color_icons_title_text_size">12sp</dimen>
<dimen name="preview_theme_color_icons_icon_size">@dimen/preview_theme_icon_size</dimen>
<dimen name="preview_theme_color_icons_tile_size">@dimen/preview_theme_tile_size</dimen>
- <dimen name="preview_theme_smartspace_key_ambient_shadow_blur">1.5dp</dimen>
<dimen name="preview_theme_app_name_key_ambient_shadow_blur">2.5dp</dimen>
<!-- For the customization previews on the picker. -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 569600e..b4ec835 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -121,7 +121,7 @@
[CHAR LIMIT=20] -->
<string name="custom_theme_previous">Previous</string>
- <!-- Title for "Custom theme" option. [CHAR LIMIT=15] -->
+ <!-- Title for "Custom theme" option. [CHAR LIMIT=20] -->
<string name="custom_theme">Custom</string>
<!-- Generic label for one system Style/Theme (combination of fonts/colors/icons) that is
@@ -198,7 +198,7 @@
<!-- Title for a section of a style preview screen that shows a preview of the style color and icons. [CHAR_LIMIT=30]-->
<string name="theme_preview_icons_section_title">Color / Icons</string>
- <!-- Bottom sheet dialog which displaying different theme's info. [CHAR_LIMIT=30]
+ <!-- Bottom sheet dialog which displaying different theme's info. [CHAR_LIMIT=80]
(eg, Fonts, icons, shape, color will change to the "Default" Style) -->
<string name="style_info_description">Fonts, icons, shape, color will change to the <xliff:g name="style_name">%1$s</xliff:g> Style</string>
</resources>
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index 0ce8ac1..240f879 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -367,6 +367,11 @@
}
@Override
+ public boolean isNavigationTabsContained() {
+ return true;
+ }
+
+ @Override
public void onWallpapersReady() {
}
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index 9e56cec..ba750c9 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -28,6 +28,7 @@
import android.view.SurfaceControlViewHost;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
+import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -84,6 +85,16 @@
mWallpaperSurface = wallpaperSurface;
mWallpaperSurface.setZOrderMediaOverlay(false);
mWallpaperSurface.getHolder().addCallback(mWallpaperSurfaceCallback);
+
+ View rootView = homePreview.getRootView();
+ rootView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ updatePreviewCardRadius();
+ rootView.removeOnLayoutChangeListener(this);
+ }
+ });
}
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
@@ -128,18 +139,6 @@
}
}
- /** Updates the preview card view radius to match the device radius. */
- public void updatePreviewCardRadius() {
- final float screenAspectRatio =
- ScreenSizeCalculator.getInstance().getScreenAspectRatio(mActivity);
- CardView cardView = (CardView) mHomePreview.getParent();
- final int cardWidth = (int) (cardView.getMeasuredHeight() / screenAspectRatio);
- ViewGroup.LayoutParams layoutParams = cardView.getLayoutParams();
- layoutParams.width = cardWidth;
- cardView.setLayoutParams(layoutParams);
- cardView.setRadius(SizeCalculator.getPreviewCornerRadius(mActivity, cardWidth));
- }
-
/**
* Sets a wallpaper to be shown on preview screen.
*
@@ -148,7 +147,7 @@
*/
public void setWallpaper(WallpaperInfo wallpaperInfo,
@Nullable WallpaperColorsListener listener) {
- mWallpaper = wallpaperInfo;
+ mWallpaper = wallpaperInfo;
mWallpaperColorsListener = listener;
setUpWallpaperPreview();
}
@@ -224,6 +223,23 @@
});
}
+ /** Updates the preview card view corner radius to match the device corner radius. */
+ private void updatePreviewCardRadius() {
+ final float screenAspectRatio =
+ ScreenSizeCalculator.getInstance().getScreenAspectRatio(mActivity);
+ CardView cardView = (CardView) mHomePreview.getParent();
+ final int cardWidth = (int) (cardView.getMeasuredHeight() / screenAspectRatio);
+ ViewGroup.LayoutParams layoutParams = cardView.getLayoutParams();
+ layoutParams.width = cardWidth;
+ cardView.setLayoutParams(layoutParams);
+ cardView.setRadius(SizeCalculator.getPreviewCornerRadius(mActivity, cardWidth));
+ }
+
+ private static Intent getWallpaperIntent(android.app.WallpaperInfo info) {
+ return new Intent(WallpaperService.SERVICE_INTERFACE)
+ .setClassName(info.getPackageName(), info.getServiceName());
+ }
+
private class WallpaperSurfaceCallback implements SurfaceHolder.Callback {
private Surface mLastSurface;
@@ -262,10 +278,5 @@
mHost = null;
}
}
- };
-
- private static Intent getWallpaperIntent(android.app.WallpaperInfo info) {
- return new Intent(WallpaperService.SERVICE_INTERFACE)
- .setClassName(info.getPackageName(), info.getServiceName());
}
}
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index 98c7515..ad37fbf 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -150,15 +150,6 @@
mGridOptionPreviewer = new GridOptionPreviewer(mGridManager,
view.findViewById(R.id.grid_preview_container));
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- wallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
-
view.findViewById(R.id.grid_preview_card).setOnClickListener(v -> showFullPreview());
return view;
}
diff --git a/src/com/android/customization/picker/grid/GridFullPreviewFragment.java b/src/com/android/customization/picker/grid/GridFullPreviewFragment.java
index ae3370c..69105df 100644
--- a/src/com/android/customization/picker/grid/GridFullPreviewFragment.java
+++ b/src/com/android/customization/picker/grid/GridFullPreviewFragment.java
@@ -104,15 +104,6 @@
mGridOptionPreviewer = new GridOptionPreviewer(gridManager,
view.findViewById(R.id.grid_preview_container));
-
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- mWallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
return view;
}
diff --git a/src/com/android/customization/picker/theme/CustomThemeNameFragment.java b/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
index 750c405..f36c80b 100644
--- a/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
+++ b/src/com/android/customization/picker/theme/CustomThemeNameFragment.java
@@ -106,15 +106,6 @@
// Set theme default name.
mNameEditor = view.findViewById(R.id.custom_theme_name);
mNameEditor.setText(getOriginalThemeName());
-
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- wallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
return view;
}
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 4b77214..de8aa69 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -143,15 +143,6 @@
mThemeOptionPreviewer::updateColorForLauncherWidgets);
}, false);
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- mWallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
-
view.findViewById(R.id.theme_preview_card).setOnClickListener(v -> showFullPreview());
return view;
}
diff --git a/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java b/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
index c96c3ac..7cbeab9 100644
--- a/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
@@ -120,15 +120,6 @@
view.findViewById(R.id.wallpaper_preview_surface));
wallpaperPreviewer.setWallpaper(mWallpaper,
themeOptionPreviewer::updateColorForLauncherWidgets);
-
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- wallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
return view;
}
diff --git a/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java b/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
index d9b7f4d..7b4d220 100644
--- a/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
+++ b/src/com/android/customization/picker/theme/ThemeOptionPreviewer.java
@@ -128,8 +128,8 @@
public void onLayoutChange(View view, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
// Calculate the full preview card height and width.
- int fullPreviewCardHeight = getFullPreviewCardHeight();
- int fullPreviewCardWidth = (int) (getFullPreviewCardHeight() / screenAspectRatio);
+ final int fullPreviewCardHeight = getFullPreviewCardHeight();
+ final int fullPreviewCardWidth = (int) (fullPreviewCardHeight / screenAspectRatio);
// Relayout the content view to match full preview card size.
mContentView.measure(
@@ -139,8 +139,7 @@
// Scale the content view from full preview size to the container size. For full
// preview, the scale value is 1.
- float scale =
- (float) previewContainer.getMeasuredHeight() / getFullPreviewCardHeight();
+ float scale = (float) previewContainer.getMeasuredHeight() / fullPreviewCardHeight;
mContentView.setScaleX(scale);
mContentView.setScaleY(scale);
// The pivot point is centered by default, set to (0, 0).
@@ -188,8 +187,8 @@
? R.color.text_color_light
: R.color.text_color_dark);
int textShadowColor = mContext.getColor(useLightTextColor
- ? R.color.theme_preview_workspace_shadow_color_dark
- : R.color.theme_preview_workspace_shadow_color_transparent);
+ ? R.color.smartspace_preview_shadow_color_dark
+ : R.color.smartspace_preview_shadow_color_transparent);
// Update the top status bar clock text color.
mStatusBarClock.setTextColor(textColor);
// Update the top status bar icon color.
@@ -202,7 +201,7 @@
mSmartSpaceDate.setTextColor(textColor);
mSmartSpaceDate.setShadowLayer(
mContext.getResources().getDimension(
- R.dimen.preview_theme_smartspace_key_ambient_shadow_blur),
+ R.dimen.smartspace_preview_key_ambient_shadow_blur),
/* dx = */ 0,
/* dy = */ 0,
textShadowColor);