speedup chats opening with wp

This commit is contained in:
gdlbo
2022-09-01 21:00:08 +03:00
parent 010a71ecca
commit 00d8e60d1e
2 changed files with 9 additions and 8 deletions
@@ -8,6 +8,7 @@ import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.widget.ImageView;
@@ -57,10 +58,10 @@ public class WallpaperPreferences extends Preference{
}
private void requestBg(){
final Drawable drawable = getFilteredFile();
Uri f = getFilteredFile();
if (drawable != null && getWallpaperFile() != null)
mChatBackground.setImageDrawable(drawable);
if (f != null && getWallpaperFile() != null)
mChatBackground.setImageURI(f);
else
mChatBackground.setImageDrawable(null);
}
@@ -8,9 +8,9 @@ import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.view.View;
import android.widget.ImageView;
@@ -37,7 +37,7 @@ public class WallpapersHooks{
return mWallpaperFile;
}
public static Drawable getFilteredFile(){
public static Uri getFilteredFile(){
File file = null;
File wp = mWallpaperFile;
String temp = getGlobalContext().getFilesDir() + File.separator + "filteredwp.webp";
@@ -64,9 +64,9 @@ public class WallpapersHooks{
}
try {
return Drawable.createFromPath(temp);
return Uri.parse(temp);
} catch (Exception e) {
return Drawable.createFromPath(file.getAbsolutePath());
return Uri.parse(file.getAbsolutePath());
}
}
@@ -82,7 +82,7 @@ public class WallpapersHooks{
public static void setBg(View view){
if (getWallpaper() != null) {
((ImageView) view).setImageDrawable(getFilteredFile()); // set picture to background
((ImageView) view).setImageURI(getFilteredFile()); // set picture to background
return;
}