some wp fixes
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp">
|
||||
android:layout_height="220dp">
|
||||
<ImageView
|
||||
android:id="@id/author"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user