正在查看: Fix Locker v1.5 应用的 WallpaperActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Fix Locker v1.5 应用的 WallpaperActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.user.a4keygen.activity;
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.user.a4keygen.R;
import com.user.a4keygen.constants.WebServiceUrlConstant;
import com.user.a4keygen.webutil.WebClientService;
import java.io.IOException;
public class WallpaperActivity extends AppCompatActivity {
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_rebood_device);
boolean booleanExtra = getIntent().getBooleanExtra("WallPaper", false);
if (!isWallpaperSupported()) {
Toast.makeText((Context) this, (CharSequence) "Wallpaper is not supported on this device", 0).show();
} else if (booleanExtra) {
setWallpaper();
} else {
removeWallpaper();
}
}
private boolean isWallpaperSupported() {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
if (Build.VERSION.SDK_INT >= 23) {
return wallpaperManager.isWallpaperSupported();
}
return false;
}
private void setWallpaper() {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try {
if (WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL)) {
wallpaperManager.setResource(R.drawable.gmm_wall);
} else {
wallpaperManager.setResource(R.drawable.wall_);
}
Toast.makeText((Context) this, (CharSequence) "Wallpaper set successfully", 0).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText((Context) this, (CharSequence) "Failed to set wallpaper", 0).show();
}
}
private void removeWallpaper() {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try {
wallpaperManager.setBitmap(Bitmap.createBitmap(wallpaperManager.getDesiredMinimumWidth(), wallpaperManager.getDesiredMinimumHeight(), Bitmap.Config.ARGB_8888));
Toast.makeText((Context) this, (CharSequence) "Wallpaper removed successfully", 0).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText((Context) this, (CharSequence) "Failed to remove wallpaper", 0).show();
}
}
}