Here are the examples of the java api candybar.lib.tasks.WallpaperApplyTask taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
6
Source : CandyBarWallpaperActivity.java
with Apache License 2.0
from zixpo
with Apache License 2.0
from zixpo
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.back) {
onBackPressed();
} else if (id == R.id.menu_apply) {
Popup popup = Popup.Builder(this).to(mMenuApply).list(PopupItem.getApplyItems(this)).callback((p, position) -> {
PopupItem item = p.gereplacedems().get(position);
if (item.getType() == PopupItem.Type.WALLPAPER_CROP) {
Preferences.get(this).setCropWallpaper(!item.getCheckboxValue());
item.setCheckboxValue(Preferences.get(this).isCropWallpaper());
p.updateItem(position, item);
if (Preferences.get(this).isCropWallpaper()) {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
return;
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
return;
} else {
RectF rectF = null;
if (Preferences.get(this).isCropWallpaper()) {
if (mAttacher != null)
rectF = mAttacher.getDisplayRect();
}
WallpaperApplyTask task = WallpaperApplyTask.prepare(this).wallpaper(mWallpaper).crop(rectF);
if (item.getType() == PopupItem.Type.LOCKSCREEN) {
task.to(WallpaperApplyTask.Apply.LOCKSCREEN);
} else if (item.getType() == PopupItem.Type.HOMESCREEN) {
task.to(WallpaperApplyTask.Apply.HOMESCREEN);
} else if (item.getType() == PopupItem.Type.HOMESCREEN_LOCKSCREEN) {
task.to(WallpaperApplyTask.Apply.HOMESCREEN_LOCKSCREEN);
}
task.start(AsyncTask.THREAD_POOL_EXECUTOR);
}
p.dismiss();
}).build();
if (getResources().getBoolean(R.bool.enable_wallpaper_download)) {
popup.removeItem(popup.gereplacedems().size() - 1);
}
popup.show();
} else if (id == R.id.menu_save) {
if (PermissionHelper.isStorageGranted(this)) {
WallpaperDownloader.prepare(this).wallpaper(mWallpaper).start();
return;
}
PermissionHelper.requestStorage(this);
}
}