您的位置:首页 > 移动开发 > Android开发

Android系统完整显示壁纸, 不做X2拉伸处理

2016-11-10 16:39 253 查看
Android系统内置墙纸尺寸跟屏幕尺寸相同, 全尺寸完整显示壁纸, 不做X2拉伸处理:

packages\apps\Launcher3\src\com\android\launcher3\util\WallpaperUtils.java

@@ -24,6 +24,9 @@ import android.graphics.Point;
import android.os.Build;
import android.view.WindowManager;

+// lds add for fix wallpaper size same as lcm screen size at 20160530
+import android.os.SystemProperties;
+
import com.android.launcher3.Utilities;

/**
@@ -100,22 +103,43 @@ public final class WallpaperUtils {

int maxDim = Math.max(maxDims.x, maxDims.y);
int minDim = Math.max(minDims.x, minDims.y);
+
+ // lds add for fix wallpaper size same as lcm screen size at 20160530
+ int realWith = minDim;

if (Utilities.ATLEAST_JB_MR1) {
Point realSize = new Point();
windowManager.getDefaultDisplay().getRealSize(realSize);
maxDim = Math.max(realSize.x, realSize.y);
minDim = Math.min(realSize.x, realSize.y);
+
+ // lds add for fix wallpaper size same as lcm screen size at 20160530
+ if(SystemProperties.get("ro.wallpaper.same.phonescreen").equals("1")){
+ realWith = realSize.x;
+ }
+ // add end
}

// We need to ensure that there is enough extra space in the wallpaper
// for the intended parallax effects
final int defaultWidth, defaultHeight;
if (res.getConfiguration().smallestScreenWidthDp >= 720) {
- defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
+ // lds add for fix wallpaper size same as lcm screen size at 20160530
+ if(SystemProperties.get("ro.wallpaper.same.phonescreen").equals("1")){
+ defaultWidth = realWith;
+ } else {
+ defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
+ }
+ // add end
defaultHeight = maxDim;
} else {
- defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
+ // lds add for fix wallpaper size same as lcm screen size at 20160530
+ if(SystemProperties.get("ro.wallpaper.same.phonescreen").equals("1")){
+ defaultWidth = realWith;
+ } else {
+ defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
+ }
+ // add end
defaultHeight = maxDim;
}
sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android 优化 壁纸 拉伸
相关文章推荐