diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ac058c4..2b9b854be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Test and beta releases will have experimental functions enabled by default. * Fixed disabling application settings when using global settings ([issue](https://github.com/M66B/XPrivacy/issues/1050)) * Fixed display issues and scroll lag ([issue](https://github.com/M66B/XPrivacy/issues/1049)) ([issue](https://github.com/M66B/XPrivacy/issues/1059)) +* Fixed check marks not visible with some themes ([issue](https://github.com/M66B/XPrivacy/issues/1057)) * Updated Vietnamese translation [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/res/drawable/checkmark.png b/res/drawable-nodpi/checkmark.png similarity index 100% rename from res/drawable/checkmark.png rename to res/drawable-nodpi/checkmark.png diff --git a/res/drawable/check_off_holo_dark.png b/res/drawable/check_off_holo_dark.png deleted file mode 100644 index 37b1d0493..000000000 Binary files a/res/drawable/check_off_holo_dark.png and /dev/null differ diff --git a/res/drawable/check_off_holo_light.png b/res/drawable/check_off_holo_light.png deleted file mode 100644 index b537d17c4..000000000 Binary files a/res/drawable/check_off_holo_light.png and /dev/null differ diff --git a/res/drawable/checked_box_holo_dark.png b/res/drawable/checked_box_holo_dark.png deleted file mode 100644 index b95ff9561..000000000 Binary files a/res/drawable/checked_box_holo_dark.png and /dev/null differ diff --git a/res/drawable/checked_box_holo_light.png b/res/drawable/checked_box_holo_light.png deleted file mode 100644 index fab9e4408..000000000 Binary files a/res/drawable/checked_box_holo_light.png and /dev/null differ diff --git a/res/layout/mainlist.xml b/res/layout/mainlist.xml index 14439ac28..7890d06ef 100644 --- a/res/layout/mainlist.xml +++ b/res/layout/mainlist.xml @@ -230,7 +230,7 @@ android:layout_width="24dip" android:layout_height="24dip" android:contentDescription="@string/title_restrict" - android:src="?attr/icon_checked" /> + android:src="?attr/icon_restricted" /> @drawable/expander_ic_minimized_holo_dark @drawable/expander_ic_maximized_holo_dark @drawable/ic_launcher_holo_dark - @drawable/check_holo_dark - @drawable/check_off_holo_dark - @drawable/checked_box_holo_dark + @drawable/check_holo_dark @drawable/cross_holo_dark @drawable/cross_grayed_out_holo_dark @drawable/frozen_holo_dark @@ -37,9 +35,7 @@ @drawable/expander_ic_minimized_holo_light @drawable/expander_ic_maximized_holo_light @drawable/ic_launcher_holo_light - @drawable/check_holo_light - @drawable/check_off_holo_light - @drawable/checked_box_holo_light + @drawable/check_holo_light @drawable/cross_holo_light @drawable/cross_grayed_out_holo_light @drawable/frozen_holo_light diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 4302a8d9b..cbaa903bb 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -1,8 +1,6 @@ - - - + diff --git a/src/biz/bokhorst/xprivacy/Util.java b/src/biz/bokhorst/xprivacy/Util.java index de0a1dc57..e1e9ffba6 100644 --- a/src/biz/bokhorst/xprivacy/Util.java +++ b/src/biz/bokhorst/xprivacy/Util.java @@ -28,11 +28,11 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.TypedArray; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; +import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; +import android.graphics.PorterDuff.Mode; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Environment; import android.os.Process; @@ -403,42 +403,45 @@ public static Bitmap[] getTriStateCheckBox(Context context) { Bitmap[] bitmap = new Bitmap[3]; // Get highlight color - TypedArray arrayColor = context.getTheme().obtainStyledAttributes( + TypedArray arrayColor1 = context.getTheme().obtainStyledAttributes( new int[] { android.R.attr.colorActivatedHighlight }); - int highlightColor = arrayColor.getColor(0, 0xFF00FF); - arrayColor.recycle(); + int highlightColor = arrayColor1.getColor(0, 0xFF00FF); + arrayColor1.recycle(); + + // Get off check box + TypedArray ta1 = context.getTheme().obtainStyledAttributes( + new int[] { android.R.attr.listChoiceIndicatorMultiple }); + Drawable off = ta1.getDrawable(0); + ta1.recycle(); + off.setBounds(0, 0, off.getIntrinsicWidth(), off.getIntrinsicHeight()); + + // Get check mark + Drawable checkmark = context.getResources().getDrawable(R.drawable.checkmark); + checkmark.setBounds(0, 0, off.getIntrinsicWidth(), off.getIntrinsicHeight()); + checkmark.setColorFilter(highlightColor, Mode.SRC_ATOP); // Create off check box - // TODO: do we need btn_check_off_holo_light&dark ? - bitmap[0] = BitmapFactory.decodeResource(context.getResources(), getThemed(context, R.attr.icon_check_off)); + bitmap[0] = Bitmap.createBitmap(off.getIntrinsicWidth(), off.getIntrinsicHeight(), Config.ARGB_8888); + Canvas canvas0 = new Canvas(bitmap[0]); + off.draw(canvas0); // Create half check box - bitmap[1] = Bitmap.createBitmap(bitmap[0].getWidth(), bitmap[0].getHeight(), bitmap[0].getConfig()); - Canvas canvas = new Canvas(bitmap[1]); - Paint paint = new Paint(); - paint.setStyle(Paint.Style.FILL); - paint.setColor(highlightColor); - int border = bitmap[1].getWidth() / 3; - canvas.drawBitmap(bitmap[0], 0, 0, paint); - canvas.drawRect(border, border, bitmap[1].getWidth() - border, bitmap[1].getHeight() - border, paint); + bitmap[1] = Bitmap.createBitmap(off.getIntrinsicWidth(), off.getIntrinsicHeight(), Config.ARGB_8888); + Canvas canvas1 = new Canvas(bitmap[1]); + off.draw(canvas1); + Paint paint1 = new Paint(); + paint1.setStyle(Paint.Style.FILL); + paint1.setColor(highlightColor); + float wborder = off.getIntrinsicWidth() / 3f; + float hborder = off.getIntrinsicHeight() / 3f; + canvas1.drawRect(wborder, hborder, off.getIntrinsicWidth() - wborder, off.getIntrinsicHeight() - hborder, + paint1); // Create full check box - // square of highlight color - bitmap[2] = Bitmap.createBitmap(bitmap[0].getWidth(), bitmap[0].getHeight(), bitmap[0].getConfig()); + bitmap[2] = Bitmap.createBitmap(off.getIntrinsicWidth(), off.getIntrinsicHeight(), Config.ARGB_8888); Canvas canvas2 = new Canvas(bitmap[2]); - canvas2.drawRect(0, 0, bitmap[2].getWidth(), bitmap[2].getHeight(), paint); - - // draw checkmark with porter-duff mode DstIn which keeps the highlight - // color where the checkmark goes - Bitmap checkmark = BitmapFactory.decodeResource(context.getResources(), R.drawable.checkmark); - paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); - canvas2.drawBitmap(checkmark, 0, 0, paint); - - // add border - Bitmap checked_box = BitmapFactory.decodeResource(context.getResources(), - getThemed(context, R.attr.icon_checked_box)); - paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); - canvas2.drawBitmap(checked_box, 0, 0, paint); + off.draw(canvas2); + checkmark.draw(canvas2); return bitmap; }