Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,8 @@ <string name="wallpaper_button_text">Wallpapers</string> <!-- Text for settings button --> <string name="settings_button_text">Settings</string> <!-- Message shown when a feature is disabled by the administrator --> <string name="msg_disabled_by_admin">Disabled by your admin</string> <!-- Strings for settings --> <!-- Title for Allow Rotation setting. [CHAR LIMIT=50] --> Loading src/com/android/launcher3/Launcher.java +5 −0 Original line number Diff line number Diff line Loading @@ -2735,6 +2735,11 @@ public class Launcher extends Activity * on the home screen. */ protected void onClickWallpaperPicker(View v) { if (!Utilities.isWallapaperAllowed(this)) { Toast.makeText(this, R.string.msg_disabled_by_admin, Toast.LENGTH_SHORT).show(); return; } if (LOGD) Log.d(TAG, "onClickWallpaperPicker"); int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen()); float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll); Loading src/com/android/launcher3/Utilities.java +13 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.app.Activity; import android.app.SearchManager; import android.app.WallpaperManager; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; Loading @@ -45,6 +46,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.PowerManager; import android.text.Spannable; Loading Loading @@ -828,6 +830,17 @@ public final class Utilities { return ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode(); } public static boolean isWallapaperAllowed(Context context) { if (isNycOrAbove()) { try { WallpaperManager wm = context.getSystemService(WallpaperManager.class); return (Boolean) wm.getClass().getDeclaredMethod("isWallpaperSettingAllowed") .invoke(wm); } catch (Exception e) { } } return true; } /** * An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size. * This allows the badging to be done based on the action bitmap size rather than Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,8 @@ <string name="wallpaper_button_text">Wallpapers</string> <!-- Text for settings button --> <string name="settings_button_text">Settings</string> <!-- Message shown when a feature is disabled by the administrator --> <string name="msg_disabled_by_admin">Disabled by your admin</string> <!-- Strings for settings --> <!-- Title for Allow Rotation setting. [CHAR LIMIT=50] --> Loading
src/com/android/launcher3/Launcher.java +5 −0 Original line number Diff line number Diff line Loading @@ -2735,6 +2735,11 @@ public class Launcher extends Activity * on the home screen. */ protected void onClickWallpaperPicker(View v) { if (!Utilities.isWallapaperAllowed(this)) { Toast.makeText(this, R.string.msg_disabled_by_admin, Toast.LENGTH_SHORT).show(); return; } if (LOGD) Log.d(TAG, "onClickWallpaperPicker"); int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen()); float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll); Loading
src/com/android/launcher3/Utilities.java +13 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.app.Activity; import android.app.SearchManager; import android.app.WallpaperManager; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; Loading @@ -45,6 +46,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.PowerManager; import android.text.Spannable; Loading Loading @@ -828,6 +830,17 @@ public final class Utilities { return ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode(); } public static boolean isWallapaperAllowed(Context context) { if (isNycOrAbove()) { try { WallpaperManager wm = context.getSystemService(WallpaperManager.class); return (Boolean) wm.getClass().getDeclaredMethod("isWallpaperSettingAllowed") .invoke(wm); } catch (Exception e) { } } return true; } /** * An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size. * This allows the badging to be done based on the action bitmap size rather than Loading