summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSantiago Etchebehere <santie@google.com>2019-06-07 11:13:02 -0700
committerSantiago Etchebehere <santie@google.com>2019-06-07 11:13:02 -0700
commit4560d6c127557bf308e26b022e337aaa2264c902 (patch)
tree43c49201c5c6682238743a5e8b7da1b34fe68de8 /src
parent468a66c7570f3a169f8b2317c4371b631fb402de (diff)
parentf3f4636ba6c7a2b23f517c494c887076c3946f00 (diff)
downloadandroid_packages_apps_WallpaperPicker2-4560d6c127557bf308e26b022e337aaa2264c902.tar.gz
android_packages_apps_WallpaperPicker2-4560d6c127557bf308e26b022e337aaa2264c902.tar.bz2
android_packages_apps_WallpaperPicker2-4560d6c127557bf308e26b022e337aaa2264c902.zip
Merging ub-launcher3-qt-r1-dev, build 5642509
Test: Manual Bug:133160356 P2 Tracking bug for P19 dynamic wallpapers Bug:133465584 P1 [A11y] In customization, the color of info/customize tab name and location name aren't sufficiently contrast with the background. Bug:133471577 P1 [A11y] While talkback is on, in the wallpaper list , an incoming call will cause the screen become blank Change-Id: If40284fe5da073092a0e1eb67afeb38bc0788dc9
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/wallpaper/module/Injector.java1
-rw-r--r--src/com/android/wallpaper/module/WallpaperSetter.java14
-rwxr-xr-xsrc/com/android/wallpaper/picker/PreviewActivity.java10
-rwxr-xr-xsrc/com/android/wallpaper/picker/PreviewFragment.java27
-rwxr-xr-xsrc/com/android/wallpaper/picker/SetWallpaperDialogFragment.java13
-rwxr-xr-xsrc/com/android/wallpaper/picker/StandalonePreviewActivity.java17
-rwxr-xr-xsrc/com/android/wallpaper/picker/ViewOnlyPreviewActivity.java10
-rwxr-xr-xsrc/com/android/wallpaper/picker/individual/IndividualPickerActivity.java5
8 files changed, 56 insertions, 41 deletions
diff --git a/src/com/android/wallpaper/module/Injector.java b/src/com/android/wallpaper/module/Injector.java
index 520e79b..746917e 100755
--- a/src/com/android/wallpaper/module/Injector.java
+++ b/src/com/android/wallpaper/module/Injector.java
@@ -73,6 +73,7 @@ public interface Injector {
WallpaperRotationRefresher getWallpaperRotationRefresher();
Fragment getPreviewFragment(
+ Context context,
WallpaperInfo wallpaperInfo,
@PreviewMode int mode,
boolean testingModeEnabled);
diff --git a/src/com/android/wallpaper/module/WallpaperSetter.java b/src/com/android/wallpaper/module/WallpaperSetter.java
index 2fb00a8..830d914 100644
--- a/src/com/android/wallpaper/module/WallpaperSetter.java
+++ b/src/com/android/wallpaper/module/WallpaperSetter.java
@@ -200,24 +200,26 @@ public class WallpaperSetter {
/**
* Show a dialog asking the user for the Wallpaper's destination
* (eg, "Home screen", "Lock Screen")
+ * @param isLiveWallpaper whether the wallpaper that we want to set is a live wallpaper.
* @param listener {@link SetWallpaperDialogFragment.Listener} that will receive the response.
* @see Destination
*/
public void requestDestination(Context context, FragmentManager fragmentManager,
- WallpaperInfo wallpaper, Listener listener) {
+ Listener listener, boolean isLiveWallpaper) {
requestDestination(context, fragmentManager, R.string.set_wallpaper_dialog_message,
- wallpaper, listener);
+ listener, isLiveWallpaper);
}
/**
* Show a dialog asking the user for the Wallpaper's destination
* (eg, "Home screen", "Lock Screen")
+ * @param isLiveWallpaper whether the wallpaper that we want to set is a live wallpaper.
* @param listener {@link SetWallpaperDialogFragment.Listener} that will receive the response.
* @param titleResId title for the dialog
* @see Destination
*/
public void requestDestination(Context context, FragmentManager fragmentManager,
- @StringRes int titleResId, WallpaperInfo wallpaper, Listener listener) {
+ @StringRes int titleResId, Listener listener, boolean isLiveWallpaper) {
CurrentWallpaperInfoFactory factory = InjectorProvider.getInjector()
.getCurrentWallpaperFactory(context);
@@ -226,16 +228,16 @@ public class WallpaperSetter {
setWallpaperDialog.setTitleResId(titleResId);
setWallpaperDialog.setListener(listener);
if (homeWallpaper instanceof LiveWallpaperInfo && lockWallpaper == null) {
- if (wallpaper instanceof LiveWallpaperInfo) {
+ if (isLiveWallpaper) {
// If lock wallpaper is live and we're setting a live wallpaper, we can only
// set it to both, so bypass the dialog.
- listener.onSetBoth();
+ listener.onSet(WallpaperPersister.DEST_BOTH);
return;
}
// if the lock wallpaper is a live wallpaper, we cannot set a home-only static one
setWallpaperDialog.setHomeOptionAvailable(false);
}
- if (wallpaper instanceof LiveWallpaperInfo) {
+ if (isLiveWallpaper) {
setWallpaperDialog.setLockOptionAvailable(false);
}
setWallpaperDialog.show(fragmentManager, TAG_SET_WALLPAPER_DIALOG_FRAGMENT);
diff --git a/src/com/android/wallpaper/picker/PreviewActivity.java b/src/com/android/wallpaper/picker/PreviewActivity.java
index bbedb7f..457de69 100755
--- a/src/com/android/wallpaper/picker/PreviewActivity.java
+++ b/src/com/android/wallpaper/picker/PreviewActivity.java
@@ -46,6 +46,11 @@ public class PreviewActivity extends BasePreviewActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
@@ -55,7 +60,10 @@ public class PreviewActivity extends BasePreviewActivity {
WallpaperInfo wallpaper = intent.getParcelableExtra(EXTRA_WALLPAPER_INFO);
boolean testingModeEnabled = intent.getBooleanExtra(EXTRA_TESTING_MODE_ENABLED, false);
fragment = InjectorProvider.getInjector().getPreviewFragment(
- wallpaper, PreviewFragment.MODE_CROP_AND_SET_WALLPAPER, testingModeEnabled);
+ /* context */ this,
+ wallpaper,
+ PreviewFragment.MODE_CROP_AND_SET_WALLPAPER,
+ testingModeEnabled);
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
diff --git a/src/com/android/wallpaper/picker/PreviewFragment.java b/src/com/android/wallpaper/picker/PreviewFragment.java
index eba645c..c698c8c 100755
--- a/src/com/android/wallpaper/picker/PreviewFragment.java
+++ b/src/com/android/wallpaper/picker/PreviewFragment.java
@@ -70,6 +70,7 @@ import com.android.wallpaper.asset.Asset;
import com.android.wallpaper.asset.Asset.BitmapReceiver;
import com.android.wallpaper.asset.Asset.DimensionsReceiver;
import com.android.wallpaper.compat.BuildCompat;
+import com.android.wallpaper.model.LiveWallpaperInfo;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.module.ExploreIntentChecker;
import com.android.wallpaper.module.Injector;
@@ -122,9 +123,9 @@ public class PreviewFragment extends Fragment implements
public @interface PreviewMode {
}
- protected static final String ARG_WALLPAPER = "wallpaper";
- protected static final String ARG_PREVIEW_MODE = "preview_mode";
- protected static final String ARG_TESTING_MODE_ENABLED = "testing_mode_enabled";
+ public static final String ARG_WALLPAPER = "wallpaper";
+ public static final String ARG_PREVIEW_MODE = "preview_mode";
+ public static final String ARG_TESTING_MODE_ENABLED = "testing_mode_enabled";
private static final String TAG_LOAD_WALLPAPER_ERROR_DIALOG_FRAGMENT =
"load_wallpaper_error_dialog";
private static final String TAG_SET_WALLPAPER_ERROR_DIALOG_FRAGMENT =
@@ -148,7 +149,7 @@ public class PreviewFragment extends Fragment implements
protected SubsamplingScaleImageView mFullResImageView;
protected WallpaperInfo mWallpaper;
private Asset mWallpaperAsset;
- private WallpaperSetter mWallpaperSetter;;
+ private WallpaperSetter mWallpaperSetter;
private UserEventLogger mUserEventLogger;
private LinearLayout mBottomSheet;
private TextView mAttributionTitle;
@@ -461,18 +462,8 @@ public class PreviewFragment extends Fragment implements
}
@Override
- public void onSetHomeScreen() {
- setCurrentWallpaper(WallpaperPersister.DEST_HOME_SCREEN);
- }
-
- @Override
- public void onSetLockScreen() {
- setCurrentWallpaper(WallpaperPersister.DEST_LOCK_SCREEN);
- }
-
- @Override
- public void onSetBoth() {
- setCurrentWallpaper(WallpaperPersister.DEST_BOTH);
+ public void onSet(int destination) {
+ setCurrentWallpaper(destination);
}
@Override
@@ -508,8 +499,8 @@ public class PreviewFragment extends Fragment implements
private void onSetWallpaperClicked(View button) {
if (BuildCompat.isAtLeastN()) {
- mWallpaperSetter.requestDestination(getContext(), getFragmentManager(), mWallpaper,
- this);
+ mWallpaperSetter.requestDestination(getContext(), getFragmentManager(), this,
+ mWallpaper instanceof LiveWallpaperInfo);
} else {
setCurrentWallpaper(WallpaperPersister.DEST_HOME_SCREEN);
}
diff --git a/src/com/android/wallpaper/picker/SetWallpaperDialogFragment.java b/src/com/android/wallpaper/picker/SetWallpaperDialogFragment.java
index 391c29a..6b2cb3f 100755
--- a/src/com/android/wallpaper/picker/SetWallpaperDialogFragment.java
+++ b/src/com/android/wallpaper/picker/SetWallpaperDialogFragment.java
@@ -28,6 +28,7 @@ import androidx.fragment.app.DialogFragment;
import com.android.wallpaper.R;
import com.android.wallpaper.compat.ButtonDrawableSetterCompat;
+import com.android.wallpaper.module.WallpaperPersister;
/**
* Dialog fragment which shows the "Set wallpaper" destination dialog for N+ devices. Lets user
@@ -68,7 +69,7 @@ public class SetWallpaperDialogFragment extends DialogFragment {
mSetHomeWallpaperButton = layout.findViewById(R.id.set_home_wallpaper_button);
mSetHomeWallpaperButton.setOnClickListener(v -> {
- mListener.onSetHomeScreen();
+ mListener.onSet(WallpaperPersister.DEST_HOME_SCREEN);
dismiss();
});
ButtonDrawableSetterCompat.setDrawableToButtonStart(
@@ -77,7 +78,7 @@ public class SetWallpaperDialogFragment extends DialogFragment {
mSetLockWallpaperButton = layout.findViewById(R.id.set_lock_wallpaper_button);
mSetLockWallpaperButton.setOnClickListener(v -> {
- mListener.onSetLockScreen();
+ mListener.onSet(WallpaperPersister.DEST_LOCK_SCREEN);
dismiss();
});
ButtonDrawableSetterCompat.setDrawableToButtonStart(
@@ -86,7 +87,7 @@ public class SetWallpaperDialogFragment extends DialogFragment {
mSetBothWallpaperButton = layout.findViewById(R.id.set_both_wallpaper_button);
mSetBothWallpaperButton.setOnClickListener(v -> {
- mListener.onSetBoth();
+ mListener.onSet(WallpaperPersister.DEST_BOTH);
dismiss();
});
ButtonDrawableSetterCompat.setDrawableToButtonStart(
@@ -130,10 +131,6 @@ public class SetWallpaperDialogFragment extends DialogFragment {
* on the dialog's clickable elements.
*/
public interface Listener {
- void onSetHomeScreen();
-
- void onSetLockScreen();
-
- void onSetBoth();
+ void onSet(int destination);
}
}
diff --git a/src/com/android/wallpaper/picker/StandalonePreviewActivity.java b/src/com/android/wallpaper/picker/StandalonePreviewActivity.java
index 9eb07fc..5d87df8 100755
--- a/src/com/android/wallpaper/picker/StandalonePreviewActivity.java
+++ b/src/com/android/wallpaper/picker/StandalonePreviewActivity.java
@@ -52,9 +52,6 @@ public class StandalonePreviewActivity extends BasePreviewActivity {
mUserEventLogger = InjectorProvider.getInjector().getUserEventLogger(getApplicationContext());
mUserEventLogger.logStandalonePreviewLaunched();
- FragmentManager fragmentManager = getSupportFragmentManager();
- Fragment fragment = fragmentManager.findFragmentById(R.id.fragment_container);
-
Intent cropAndSetWallpaperIntent = getIntent();
Uri imageUri = cropAndSetWallpaperIntent.getData();
@@ -77,8 +74,15 @@ public class StandalonePreviewActivity extends BasePreviewActivity {
requestPermissions(
new String[]{permission.READ_EXTERNAL_STORAGE},
READ_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE);
- return;
}
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+
+ FragmentManager fragmentManager = getSupportFragmentManager();
+ Fragment fragment = fragmentManager.findFragmentById(R.id.fragment_container);
if (fragment == null) {
loadPreviewFragment();
@@ -116,7 +120,10 @@ public class StandalonePreviewActivity extends BasePreviewActivity {
boolean testingModeEnabled = intent.getBooleanExtra(EXTRA_TESTING_MODE_ENABLED, false);
WallpaperInfo wallpaper = new ImageWallpaperInfo(intent.getData());
Fragment fragment = InjectorProvider.getInjector().getPreviewFragment(
- wallpaper, PreviewFragment.MODE_CROP_AND_SET_WALLPAPER, testingModeEnabled);
+ /* context */ this,
+ wallpaper,
+ PreviewFragment.MODE_CROP_AND_SET_WALLPAPER,
+ testingModeEnabled);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
diff --git a/src/com/android/wallpaper/picker/ViewOnlyPreviewActivity.java b/src/com/android/wallpaper/picker/ViewOnlyPreviewActivity.java
index 2a22046..f10cc51 100755
--- a/src/com/android/wallpaper/picker/ViewOnlyPreviewActivity.java
+++ b/src/com/android/wallpaper/picker/ViewOnlyPreviewActivity.java
@@ -44,6 +44,11 @@ public class ViewOnlyPreviewActivity extends BasePreviewActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
@@ -53,7 +58,10 @@ public class ViewOnlyPreviewActivity extends BasePreviewActivity {
WallpaperInfo wallpaper = intent.getParcelableExtra(EXTRA_WALLPAPER_INFO);
boolean testingModeEnabled = intent.getBooleanExtra(EXTRA_TESTING_MODE_ENABLED, false);
fragment = InjectorProvider.getInjector().getPreviewFragment(
- wallpaper, PreviewFragment.MODE_VIEW_ONLY, testingModeEnabled);
+ /* context */ this,
+ wallpaper,
+ PreviewFragment.MODE_VIEW_ONLY,
+ testingModeEnabled);
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java b/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
index 25b15b8..6c05983 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
@@ -110,8 +110,9 @@ public class IndividualPickerActivity extends BaseActivity {
toolbar.getNavigationIcon().setTint(getColor(R.color.toolbar_icon_color));
getWindow().getDecorView().setSystemUiVisibility(
- getWindow().getDecorView().getSystemUiVisibility() |
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+ getWindow().getDecorView().getSystemUiVisibility()
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().getDecorView().setOnApplyWindowInsetsListener((view, windowInsets) -> {
view.setPadding(view.getPaddingLeft(), windowInsets.getSystemWindowInsetTop(),
view.getPaddingRight(), view.getBottom());