fixed rounding pic
This commit is contained in:
@@ -123,7 +123,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.addPreferencesFromResource(vtosterXml);
|
||||
|
||||
PreferencesUtil.addPreferenceDrawable(this, "", "Аккаунты", getUsername() + (hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate")), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28"), preference -> {
|
||||
PreferencesUtil.addPreferenceDrawable(this, "", "Аккаунты", getUsername() + (hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate")), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true), preference -> {
|
||||
AuthBridge.logout();
|
||||
restartApplication();
|
||||
return false;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class Globals{
|
||||
return extendedUserProfile.a;
|
||||
}
|
||||
|
||||
public static Drawable getDrawableFromUrl(String url, String nopic){
|
||||
public static Drawable getDrawableFromUrl(String url, String nopic, Boolean rounded){
|
||||
try {
|
||||
URL aryURI = new URL(url);
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
@@ -181,7 +181,8 @@ public class Globals{
|
||||
InputStream is = conn.getInputStream();
|
||||
Bitmap bmp = BitmapFactory.decodeStream(is);
|
||||
|
||||
return new BitmapDrawable(getResources(), bmp);
|
||||
|
||||
return new BitmapDrawable(getResources(), rounded? Bitmap.createScaledBitmap(getBitmapClippedCircle(bmp), convertDpToPixel(256), convertDpToPixel(256), true) : bmp);
|
||||
} catch (Exception e) {
|
||||
return getDrawable(getContext(), getIdentifier(nopic, "drawable"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user