Yashasvi has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/357411 )
Change subject: fixing Alpha update notification icon for api >= 21 ...................................................................... fixing Alpha update notification icon for api >= 21 Bug: T159722 Change-Id: I3a9adec63a0f2c5b47f14107b252ee244308d51c --- M app/src/main/java/org/wikipedia/alphaupdater/AlphaUpdateChecker.java A app/src/main/res/drawable/ic_launcher_transparent.xml 2 files changed, 19 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/11/357411/1 diff --git a/app/src/main/java/org/wikipedia/alphaupdater/AlphaUpdateChecker.java b/app/src/main/java/org/wikipedia/alphaupdater/AlphaUpdateChecker.java index 9b98d43..9237eed 100644 --- a/app/src/main/java/org/wikipedia/alphaupdater/AlphaUpdateChecker.java +++ b/app/src/main/java/org/wikipedia/alphaupdater/AlphaUpdateChecker.java @@ -1,12 +1,12 @@ package org.wikipedia.alphaupdater; -import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; +import android.os.Build; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.v4.app.NotificationCompat; @@ -72,16 +72,20 @@ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(ALPHA_BUILD_APK_URL)); PendingIntent pintent = PendingIntent.getActivity(context, 0, intent, 0); - Notification notification = new NotificationCompat.Builder(context) - .setSmallIcon(R.mipmap.launcher) + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) .setContentTitle(context.getString(R.string.alpha_update_notification_title)) .setContentText(context.getString(R.string.alpha_update_notification_text)) .setContentIntent(pintent) - .setAutoCancel(true) - .build(); + .setAutoCancel(true); + + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + notificationBuilder.setSmallIcon(R.drawable.ic_launcher_transparent); + } else { + notificationBuilder.setSmallIcon(R.mipmap.launcher); + } NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - manager.notify(1, notification); + manager.notify(1, notificationBuilder.build()); } @Override diff --git a/app/src/main/res/drawable/ic_launcher_transparent.xml b/app/src/main/res/drawable/ic_launcher_transparent.xml new file mode 100644 index 0000000..49e03cf --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_transparent.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M22.99,6.123C22.99,6.197 22.966,6.265 22.917,6.327C22.868,6.389 22.814,6.419 22.755,6.419C22.273,6.463 21.878,6.61 21.571,6.86C21.265,7.111 20.948,7.588 20.622,8.293L15.631,18.952C15.598,19.051 15.507,19.1 15.357,19.1C15.239,19.1 15.148,19.051 15.083,18.952L12.284,13.404L9.064,18.952C8.999,19.051 8.907,19.1 8.79,19.1C8.646,19.1 8.552,19.051 8.506,18.952L3.603,8.293C3.297,7.632 2.974,7.169 2.634,6.906C2.295,6.644 1.822,6.481 1.215,6.419C1.163,6.419 1.114,6.393 1.069,6.341C1.023,6.288 1,6.228 1,6.16C1,5.987 1.052,5.9 1.157,5.9C1.594,5.9 2.05,5.919 2.527,5.956C2.97,5.993 3.388,6.011 3.779,6.011C4.177,6.011 4.647,5.993 5.189,5.956C5.756,5.919 6.259,5.9 6.696,5.9C6.8,5.9 6.852,5.987 6.852,6.16C6.852,6.333 6.82,6.419 6.754,6.419C6.317,6.45 5.973,6.556 5.722,6.735C5.471,6.914 5.345,7.149 5.345,7.44C5.345,7.588 5.397,7.774 5.502,7.996L9.553,16.67L11.853,12.551L9.71,8.293C9.325,7.533 9.009,7.043 8.761,6.823C8.513,6.603 8.138,6.469 7.635,6.419C7.59,6.419 7.546,6.393 7.503,6.341C7.461,6.288 7.44,6.228 7.44,6.16C7.44,5.987 7.485,5.9 7.577,5.9C8.014,5.9 8.415,5.919 8.78,5.956C9.133,5.993 9.508,6.011 9.906,6.011C10.297,6.011 10.711,5.993 11.149,5.956C11.599,5.919 12.042,5.9 12.48,5.9C12.584,5.9 12.636,5.987 12.636,6.16C12.636,6.333 12.603,6.419 12.538,6.419C11.664,6.475 11.227,6.71 11.227,7.124C11.227,7.31 11.328,7.598 11.53,7.987L12.949,10.714L14.359,8.219C14.554,7.867 14.652,7.57 14.652,7.329C14.652,6.76 14.215,6.457 13.341,6.419C13.262,6.419 13.223,6.333 13.223,6.16C13.223,6.098 13.243,6.039 13.282,5.983C13.321,5.928 13.36,5.9 13.399,5.9C13.713,5.9 14.098,5.919 14.554,5.956C14.991,5.993 15.35,6.011 15.631,6.011C15.833,6.011 16.13,5.996 16.521,5.965C17.017,5.922 17.431,5.9 17.764,5.9C17.843,5.9 17.882,5.974 17.882,6.123C17.882,6.321 17.81,6.419 17.666,6.419C17.157,6.469 16.748,6.602 16.438,6.818C16.128,7.035 15.742,7.526 15.278,8.293L13.399,11.586L15.944,16.503L19.702,8.219C19.832,7.916 19.898,7.638 19.898,7.384C19.898,6.778 19.461,6.457 18.586,6.419C18.508,6.419 18.469,6.333 18.469,6.16C18.469,5.987 18.528,5.9 18.645,5.9C18.965,5.9 19.343,5.919 19.78,5.956C20.185,5.993 20.524,6.011 20.798,6.011C21.085,6.011 21.418,5.993 21.796,5.956C22.188,5.919 22.54,5.9 22.853,5.9C22.945,5.9 22.99,5.974 22.99,6.123L22.99,6.123Z" + android:fillColor="#FFFFFF"/> +</vector> -- To view, visit https://gerrit.wikimedia.org/r/357411 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3a9adec63a0f2c5b47f14107b252ee244308d51c Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Yashasvi <yash.gird...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits