Skip to content

Commit

Permalink
add vector notification icon compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Siamak committed Jun 8, 2019
1 parent 6634ced commit 39d266e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/disconnected_banner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/icon"
android:src="@drawable/ic_signal_wifi_off"
app:srcCompat="@drawable/ic_signal_wifi_off"
android:layout_centerInParent="true"
android:layout_width="120dp"
android:layout_height="120dp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ private static void detectAndAct(Context context, int status){

Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), getNotificationIcon());
mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(getNotificationIcon())
.setLargeIcon(bitmap)
.setColor(Color.parseColor("#ffffff"))
.setContentTitle(message == null ? context.getString(R.string.netwatch_lost_connection) : message)
.setAutoCancel(true)
.setOngoing(!cancelable);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBuilder.setSmallIcon(getNotificationIcon());
}
}
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand Down

0 comments on commit 39d266e

Please sign in to comment.