diff --git a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperMenuFragment.java b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperMenuFragment.java index d03ac059b..8e10d1341 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperMenuFragment.java +++ b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperMenuFragment.java @@ -16,7 +16,6 @@ import androidx.preference.ListPreference; import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -28,6 +27,19 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment{ private WallpaperPreferences mWPPreviewPref; + public static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException{ + + byte[] buffer = new byte[1024]; + int length; + while((length = copyFrom.read(buffer)) > 0) { + copyTo.write(buffer, 0, length); + } + + copyTo.flush(); + copyTo.close(); + copyFrom.close(); + } + @Override public void onCreate(Bundle bundle){ super.onCreate(bundle); @@ -115,19 +127,6 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment{ } } - public static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException{ - - byte[] buffer = new byte[1024]; - int length; - while ((length = copyFrom.read(buffer)) > 0) { - copyTo.write(buffer, 0, length); - } - - copyTo.flush(); - copyTo.close(); - copyFrom.close(); - } - @Override public int T4(){ return getIdentifier("vtltgs", "string"); diff --git a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperPreferences.java b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperPreferences.java index 3a732d110..598893654 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperPreferences.java +++ b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpaperPreferences.java @@ -1,4 +1,5 @@ package ru.vtosters.lite.ui.wallpapers; +import static ru.vtosters.lite.ui.PreferencesUtil.*; import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper; import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaperFile; import static ru.vtosters.lite.utils.Globals.convertDpToPixel; @@ -27,7 +28,7 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -import ru.vtosters.lite.ui.PreferencesUtil; +import ru.vtosters.lite.utils.Themes; public class WallpaperPreferences extends Preference{ private final Executor mExecutor = Executors.newSingleThreadExecutor(); @@ -54,13 +55,13 @@ public class WallpaperPreferences extends Preference{ public static int getMsgInColor(Context ctx){ TypedValue typedValue = new TypedValue(); - ctx.getTheme().resolveAttribute(getIdentifier("im_bubble_incoming", "attr"), typedValue, true); + ctx.getTheme().resolveAttribute(com.vtosters.lite.R.attr.im_bubble_incoming, typedValue, true); return typedValue.data; } public static int getMsgOutColor(Context ctx){ TypedValue typedValue = new TypedValue(); - ctx.getTheme().resolveAttribute(getIdentifier("im_bubble_outgoing", "attr"), typedValue, true); + ctx.getTheme().resolveAttribute(com.vtosters.lite.R.attr.im_bubble_outgoing, typedValue, true); return typedValue.data; } @@ -73,8 +74,6 @@ public class WallpaperPreferences extends Preference{ @Override public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder){ super.onBindViewHolder(preferenceViewHolder); - preferenceViewHolder.itemView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, convertDpToPixel(220))); - preferenceViewHolder.itemView.setPadding(0, 0, 0, 0); preview = (RecyclerView) preferenceViewHolder.findViewById(getIdentifier("install_btn_container", "id")); preview.setPadding(0, convertDpToPixel(8), 0, 0); @@ -131,16 +130,16 @@ public class WallpaperPreferences extends Preference{ if(isOut[previewVH.getAdapterPosition()]){ params.addRule(RelativeLayout.ALIGN_PARENT_END); bubble.setPadding(convertDpToPixel(16), convertDpToPixel(16), convertDpToPixel(24), 0); - bubble.setBackgroundResource(getIdentifier("vkim_msg_new_out_light_full", "drawable")); + bubble.setBackgroundResource(com.vtosters.lite.R.drawable.vkim_msg_new_out_light_full); bubble.setBackgroundTintList(ColorStateList.valueOf(getMsgOutColor(previewVH.itemView.getContext()))); } else { params.addRule(RelativeLayout.ALIGN_PARENT_START); bubble.setPadding(convertDpToPixel(24), convertDpToPixel(16), convertDpToPixel(16), 0); - bubble.setBackgroundResource(getIdentifier("vkim_msg_new_in_light_full", "drawable")); + bubble.setBackgroundResource(com.vtosters.lite.R.drawable.vkim_msg_new_in_light_full); bubble.setBackgroundTintList(ColorStateList.valueOf(getMsgInColor(previewVH.itemView.getContext()))); } - bubble.setTextColor(PreferencesUtil.getTextColor(previewVH.itemView.getContext())); + bubble.setTextColor(Themes.getTextAttr()); bubble.setLayoutParams(params); } @@ -150,9 +149,9 @@ public class WallpaperPreferences extends Preference{ Context ctx = viewGroup.getContext(); RelativeLayout root = new RelativeLayout(ctx); - root.setLayoutParams(new RecyclerView.LayoutParams( - RecyclerView.LayoutParams.MATCH_PARENT, - RecyclerView.LayoutParams.MATCH_PARENT)); + root.setLayoutParams(new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.MATCH_PARENT, + RelativeLayout.LayoutParams.MATCH_PARENT)); TextView bubble = new TextView(ctx); bubble.setId(getIdentifier("author", "id")); diff --git a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpapersHooks.java b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpapersHooks.java index 41dd35664..a4376a8cb 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpapersHooks.java +++ b/app/src/main/java/ru/vtosters/lite/ui/wallpapers/WallpapersHooks.java @@ -1,10 +1,8 @@ package ru.vtosters.lite.ui.wallpapers; import static com.vk.im.engine.h.im_bg_chat; import static ru.vtosters.lite.utils.Globals.getContext; -import static ru.vtosters.lite.utils.Globals.getIdentifier; import static ru.vtosters.lite.utils.Globals.getPreferences; import static ru.vtosters.lite.utils.Globals.getResources; -import static ru.vtosters.lite.utils.Globals.scaleCenterCrop; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -18,7 +16,6 @@ import android.graphics.drawable.Drawable; import android.view.View; import android.widget.ImageView; -import com.vk.im.ui.views.FrescoImageView; import com.vk.medianative.MediaNative; import java.io.File; @@ -125,7 +122,7 @@ public class WallpapersHooks{ public static Drawable getDimmed(Drawable orig){ if(orig == null) return null; - if(!(orig instanceof BitmapDrawable)) return orig; // we need only BitmapDrawable + if(!(orig instanceof BitmapDrawable)) return orig; Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true); String radius = getPreferences().getString("msg_dim", "disabled"); switch(radius) { diff --git a/smali/res/layout/wppreview.xml b/smali/res/layout/wppreview.xml index 91177e200..49f8d2f3f 100644 --- a/smali/res/layout/wppreview.xml +++ b/smali/res/layout/wppreview.xml @@ -2,7 +2,7 @@ + android:layout_height="220dp">