Implement full screen preview and animation.
This CL implements the full screen preview as well as animations to and from it.
Screenshots and Recordings
* Default - https://screenshot.googleplex.com/xNMSw6tsHUjdFW7
* Fullscreen - https://screenshot.googleplex.com/6Tz8GjGmo6Z9zaL
* Static wallpaper - https://drive.google.com/file/d/1gO8gW66TH7agvM-rIsuvq1Xkc_dah6wx/view?usp=sharing&resourcekey=0-NIbcQItWMDl09yC-5K_AjA
* Live wallpaper - https://drive.google.com/file/d/103yJULy-ZoRTKV_r4roxtOiUtClsCsI9/view?usp=sharing&resourcekey=0-YdGFldUgxQWSlFgf40bxVA
Fixes: 182345358
Test: none added
Change-Id: I445e59bda430ef424b9e16c0e159f86fcb6661f4
diff --git a/src/com/android/wallpaper/picker/ImagePreviewFragment.java b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
index 4e0b54a..5088608 100755
--- a/src/com/android/wallpaper/picker/ImagePreviewFragment.java
+++ b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
@@ -60,6 +60,7 @@
import com.android.wallpaper.module.InjectorProvider;
import com.android.wallpaper.module.WallpaperPersister.Destination;
import com.android.wallpaper.module.WallpaperPersister.SetWallpaperCallback;
+import com.android.wallpaper.util.FullScreenAnimation;
import com.android.wallpaper.util.ResourceUtils;
import com.android.wallpaper.util.ScreenSizeCalculator;
import com.android.wallpaper.util.SizeCalculator;
@@ -168,6 +169,7 @@
// Trim some memory from Glide to make room for the full-size image in this fragment.
Glide.get(activity).setMemoryCategory(MemoryCategory.LOW);
setUpLoadingIndicator();
+
return view;
}
@@ -199,6 +201,12 @@
protected void onWallpaperColorsChanged(@Nullable WallpaperColors colors) {
mLockScreenPreviewer.setColor(colors);
+
+ mFullScreenAnimation.setFullScreenTextColor(
+ colors == null || (colors.getColorHints()
+ & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) == 0
+ ? FullScreenAnimation.FullScreenTextColor.LIGHT
+ : FullScreenAnimation.FullScreenTextColor.DARK);
}
@Override
@@ -237,10 +245,7 @@
R.layout.wallpaper_info_view, /* root= */null);
mBottomActionBar.attachViewToBottomSheetAndBindAction(mWallpaperInfoView, INFORMATION);
mBottomActionBar.showActionsOnly(INFORMATION, EDIT, APPLY);
- mBottomActionBar.setActionClickListener(EDIT, v ->
- setEditingEnabled(mBottomActionBar.isActionSelected(EDIT))
- );
- mBottomActionBar.setActionSelectedListener(EDIT, this::setEditingEnabled);
+
mBottomActionBar.setActionClickListener(APPLY, this::onSetWallpaperClicked);
// Update target view's accessibility param since it will be blocked by the bottom sheet
@@ -259,7 +264,6 @@
});
// Will trigger onActionSelected callback to update the editing state.
- mBottomActionBar.setDefaultSelectedButton(EDIT);
mBottomActionBar.show();
// Loads wallpaper info and populate into view.
setUpExploreIntentAndLabel(this::populateWallpaperInfo);
@@ -520,7 +524,6 @@
}
private class WallpaperSurfaceCallback implements SurfaceHolder.Callback {
-
private Surface mLastSurface;
private SurfaceControlViewHost mHost;
@@ -596,12 +599,16 @@
}
};
- private void setEditingEnabled(boolean enabled) {
- mTouchForwardingLayout.setForwardingEnabled(enabled);
+ @Override
+ protected void setFullScreen(boolean fullScreen) {
+ super.setFullScreen(fullScreen);
+ mTouchForwardingLayout.setForwardingEnabled(fullScreen);
}
private void updateScreenPreview(boolean isHomeSelected) {
mWorkspaceSurface.setVisibility(isHomeSelected ? View.VISIBLE : View.INVISIBLE);
mLockPreviewContainer.setVisibility(isHomeSelected ? View.INVISIBLE : View.VISIBLE);
+
+ mFullScreenAnimation.setIsHomeSelected(isHomeSelected);
}
}