Some improvements
This commit is contained in:
parent
55d3a241fa
commit
97fb1e71f3
|
@ -625,7 +625,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), addBorder(resource, account_pp.getContext()));
|
||||
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext()));
|
||||
circularBitmapDrawable.setCircular(true);
|
||||
account_pp.setImageDrawable(circularBitmapDrawable);
|
||||
}
|
||||
|
@ -633,26 +633,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
|
||||
}
|
||||
|
||||
private static Bitmap addBorder(Bitmap resource, Context context) {
|
||||
int w = resource.getWidth();
|
||||
int h = resource.getHeight();
|
||||
int radius = Math.min(h / 2, w / 2);
|
||||
Bitmap output = Bitmap.createBitmap(w + 8, h + 8, Bitmap.Config.ARGB_8888);
|
||||
Paint p = new Paint();
|
||||
p.setAntiAlias(true);
|
||||
Canvas c = new Canvas(output);
|
||||
c.drawARGB(0, 0, 0, 0);
|
||||
p.setStyle(Paint.Style.FILL);
|
||||
c.drawCircle((w / 2) + 4, (h / 2) + 4, radius, p);
|
||||
p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
c.drawBitmap(resource, 4, 4, p);
|
||||
p.setXfermode(null);
|
||||
p.setStyle(Paint.Style.STROKE);
|
||||
p.setColor(ContextCompat.getColor(context, R.color.white));
|
||||
p.setStrokeWidth(3);
|
||||
c.drawCircle((w / 2) + 4, (h / 2) + 4, radius, p);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRetrieveFeedsAccount(List<Status> statuses) {
|
||||
|
|
|
@ -1757,4 +1757,26 @@ public class Helper {
|
|||
"kMGTPE".charAt(exp-1));
|
||||
}
|
||||
|
||||
|
||||
public static Bitmap addBorder(Bitmap resource, Context context) {
|
||||
int w = resource.getWidth();
|
||||
int h = resource.getHeight();
|
||||
int radius = Math.min(h / 2, w / 2);
|
||||
Bitmap output = Bitmap.createBitmap(w + 8, h + 8, Bitmap.Config.ARGB_8888);
|
||||
Paint p = new Paint();
|
||||
p.setAntiAlias(true);
|
||||
Canvas c = new Canvas(output);
|
||||
c.drawARGB(0, 0, 0, 0);
|
||||
p.setStyle(Paint.Style.FILL);
|
||||
c.drawCircle((w / 2) + 4, (h / 2) + 4, radius, p);
|
||||
p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
c.drawBitmap(resource, 4, 4, p);
|
||||
p.setXfermode(null);
|
||||
p.setStyle(Paint.Style.STROKE);
|
||||
p.setColor(ContextCompat.getColor(context, R.color.white));
|
||||
p.setStrokeWidth(3);
|
||||
c.drawCircle((w / 2) + 4, (h / 2) + 4, radius, p);
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
tools:ignore="ContentDescription" />
|
||||
<VideoView
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_below="@+id/appBar"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/media_video"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue