Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59b6a7dd authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "Lockscreen Targets: Icon Revamp" into cm-10.1

parents ba3b7089 745ec715
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@
    <dimen name="notification_subtext_size">12dp</dimen>

    <!-- Lockscreen target insets -->
    <item type="dimen" name="lockscreen_target_inset">25dp</item>
    <item type="dimen" name="lockscreen_target_inset">30dp</item>

    <!-- Keyguard dimensions -->
    <!-- TEMP -->
+30 −1
Original line number Diff line number Diff line
@@ -31,7 +31,16 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Xfermode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
@@ -338,7 +347,8 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri
                                if (fSource != null) {
                                    File fPath = new File(fSource);
                                    if (fPath.exists()) {
                                        front = new BitmapDrawable(res, BitmapFactory.decodeFile(fSource));
                                        front = new BitmapDrawable(res, getRoundedCornerBitmap(BitmapFactory.decodeFile(fSource)));
                                        tmpInset = tmpInset + 5;
                                    }
                                }
                            } else if (in.hasExtra(GlowPadView.ICON_RESOURCE)) {
@@ -402,6 +412,25 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri
        }
    }

    public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) {
        Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
            bitmap.getHeight(), Config.ARGB_8888);
        Canvas canvas = new Canvas(output);

        final int color = 0xff424242;
        final Paint paint = new Paint();
        final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
        final RectF rectF = new RectF(rect);
        final float roundPx = 24;
        paint.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        paint.setColor(color);
        canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
        paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rect, paint);
        return output;
    }

    void doTransition(View view, float to) {
        if (mAnim != null) {
            mAnim.cancel();