1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Android: Fixes #7766: Support monochrome icons (#7772)

This commit is contained in:
Andrey Mukamolov 2023-05-29 13:36:47 +03:00 committed by GitHub
parent 230e7f6914
commit fd578d1c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 427 additions and 39 deletions

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 108 108"
height="108"
width="108"
xml:space="preserve"
id="svg2"
version="1.1"
sodipodi:docname="JoplinLetter.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
id="metadata23">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
inkscape:document-rotation="0"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1094"
id="namedview21"
showgrid="false"
inkscape:zoom="2.8"
inkscape:cx="-2.1428571"
inkscape:cy="73.214286"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<defs
id="defs6" />
<g
id="g865"
transform="translate(44, 40), scale(0.33,0.33)"
style="fill:none;fill-opacity:1"
inkscape:label="Letter container"><path
id="path30"
fill="#ffffff"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.17263;stroke-dasharray:none;stroke-opacity:1;stop-opacity:1"
d="M 92.634508,-48.8373 H 28.444063 c -0.606678,0 -1.097079,0.490859 -1.097079,1.096592 v 20.383573 c 0,0.686004 0.555444,1.241912 1.241922,1.241912 h 8.800852 c 3.559682,0 6.44623,2.738013 6.755314,6.217395 v 13.9751869 7.78593 74.1585111 0.52545 h -0.0016 c 0.02333,0.77689 -0.0096,1.54086 -0.08442,2.29329 -0.0096,0.10981 -0.02333,0.21821 -0.03653,0.32709 -0.05078,0.43965 -0.107028,0.87699 -0.192454,1.30511 -0.04661,0.24405 -0.112627,0.48164 -0.171063,0.72199 -0.07882,0.3197 -0.142579,0.64448 -0.240789,0.95727 -0.580372,1.85779 -1.49796,3.58087 -2.767117,5.09773 -0.04647,0.054 -0.104299,0.10381 -0.150278,0.15732 -0.387038,0.44843 -0.793477,0.88531 -1.243283,1.2945 -0.453957,0.4129 -0.934667,0.79673 -1.439823,1.15335 -3.591033,2.54379 -8.424421,3.66298 -13.824789,3.14629 -6.885879,-0.64724 -13.717305,-3.77002 -19.2390127,-8.79395 -5.52077603,-5.02346 -8.953577,-11.23901 -9.664036,-17.50346 -0.638943,-5.60429 1.040305,-10.53595 4.72500997,-13.88846 0.0096,-0.007 0.01866,-0.0142 0.0258,-0.0222 0.142742,-0.12779 0.299405,-0.23989 0.446104,-0.36307 2.63699903,-2.209329 6.07439703,-3.548119 9.99711673,-3.91719 0.04421,-0.0042 0.08683,-0.0112 0.128653,-0.0147 0.412878,-0.03644 0.833625,-0.05307 1.258052,-0.06875 0.221801,-0.0075 0.441028,-0.02309 0.666165,-0.02489 0.07465,-10e-4 0.145635,-0.0089 0.220634,-0.0089 0.133761,0 0.272634,0.0175 0.406421,0.01936 0.618197,0.0098 1.240993,0.03506 1.876236,0.08951 0.08027,0.0065 0.156833,0.0037 0.239457,0.0112 0.05865,0.0061 0.116802,0.0189 0.175239,0.02494 3.598402,0.360764 7.161287,1.43521 10.542386,3.06325 0.0705,0.003 0.152191,0.0249 0.254215,0.0812 1.030611,0.56929 1.228062,-0.0415 1.258503,-0.44519 V 33.605817 20.558368 c 0,-0.878838 -0.611246,-1.656187 -1.468421,-1.844874 -18.2116207,-4.008068 -36.079989,0.163761 -48.68826,11.641302 -11.014353,10.01925 -16.342292,24.477454 -14.615976,39.665024 1.5404,13.5277 8.484385,26.52393 19.555018,36.599 10.7901423,9.81673 24.5286593,15.9557 38.700372,17.29085 1.952829,0.18076 3.914888,0.27393 5.829429,0.27393 13.534593,0 26.093507,-4.64092 35.363086,-13.07322 8.781041,-7.99493 14.040701,-18.97328 14.812501,-30.91676 l 0.0714,-78.3303471 h 0.006 V -19.079901 h 0.002 v -0.365378 c 0.0793,-3.696201 3.09325,-6.669963 6.80976,-6.669963 h 8.80085 c 0.68555,0 1.24192,-0.555907 1.24192,-1.241909 v -20.383571 c 0,-0.605733 -0.4904,-1.096592 -1.09705,-1.096592"
inkscape:connector-curvature="0"
inkscape:label="Letter" /></g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="#fff" d="M5.841 0C2.63 0 0 2.628 0 5.841V18.16C0 21.372 2.629 24 5.841 24H18.16C21.372 24 24 21.372 24 18.159V5.84C24 2.628 21.372 0 18.159 0Zm6.207 3.21h6.522a.111.111 0 0 1 .111.111v2.071c0 .07-.056.127-.126.127h-.894a.692.692 0 0 0-.692.677v2.165h-.001l-.007 7.96a4.628 4.628 0 0 1-1.505 3.14c-.942.858-2.218 1.33-3.594 1.33-.194 0-.393-.01-.592-.029a6.843 6.843 0 0 1-3.932-1.757c-1.125-1.023-1.83-2.344-1.987-3.718-.175-1.544.366-3.013 1.485-4.03 1.281-1.167 3.097-1.59 4.947-1.183.087.019.15.098.15.187v3.117c-.004.041-.024.104-.128.046a.059.059 0 0 0-.026-.009 3.22 3.22 0 0 0-1.072-.31c-.005-.001-.011-.003-.017-.003-.009-.001-.016 0-.025-.002a2.753 2.753 0 0 0-.19-.009l-.042-.002-.022.001c-.023 0-.045.002-.068.003a2.53 2.53 0 0 0-.127.007l-.014.001c-.398.038-.747.174-1.015.398l-.046.037a.02.02 0 0 1-.002.002c-.375.341-.545.842-.48 1.412.072.636.42 1.268.981 1.778.562.51 1.256.828 1.955.894.55.052 1.04-.062 1.405-.32a1.52 1.52 0 0 0 .146-.117c.046-.042.087-.086.127-.132l.015-.016c.129-.154.222-.329.281-.518.01-.031.017-.064.025-.097l.017-.073c.009-.044.014-.088.02-.133l.003-.033a1.81 1.81 0 0 0 .009-.233v-9.8a.69.69 0 0 0-.686-.631h-.895a.126.126 0 0 1-.126-.127v-2.07a.111.111 0 0 1 .112-.112Z" style="stroke-width:.015625"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -84,6 +84,7 @@
"lint-staged": "13.2.2",
"madge": "6.0.0",
"npm-package-json-lint": "6.4.0",
"svg2vectordrawable": "^2.9.1",
"typedoc": "0.17.8",
"typescript": "4.9.4"
},

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M5.84 0C2.63 0 0 2.63 0 5.84V18.16C0 21.37 2.63 24 5.84 24H18.16C21.37 24 24 21.37 24 18.16V5.84C24 2.63 21.37 0 18.16 0Zm6.21 3.21h6.52a0.11 0.11 0 0 1 0.11 0.11v2.07c0 0.07-0.06 0.13-0.12 0.13h-0.9a0.69 0.69 0 0 0-0.69 0.68v2.16h0l-0.01 7.96a4.63 4.63 0 0 1-1.5 3.14c-0.94 0.86-2.22 1.33-3.6 1.33-0.19 0-0.39-0.01-0.59-0.03a6.84 6.84 0 0 1-3.93-1.75c-1.13-1.02-1.83-2.34-1.99-3.72-0.17-1.54 0.37-3.01 1.49-4.03 1.28-1.17 3.1-1.59 4.94-1.19 0.09 0.02 0.15 0.1 0.15 0.19v3.12c0 0.04-0.02 0.1-0.12 0.04a0.06 0.06 0 0 0-0.03 0 3.22 3.22 0 0 0-1.07-0.31c-0.01 0-0.01 0-0.02-0.01-0.01 0-0.02 0-0.02 0a2.75 2.75 0 0 0-0.19-0.01l-0.05 0-0.02 0c-0.02 0-0.04 0-0.07 0a2.53 2.53 0 0 0-0.12 0.01l-0.02 0c-0.4 0.04-0.75 0.17-1.01 0.4l-0.05 0.04a0.02 0.02 0 0 1 0 0c-0.38 0.34-0.55 0.84-0.48 1.41 0.07 0.64 0.42 1.27 0.98 1.78 0.56 0.51 1.26 0.83 1.96 0.89 0.55 0.05 1.04-0.06 1.4-0.32a1.52 1.52 0 0 0 0.15-0.11c0.05-0.04 0.09-0.09 0.12-0.14l0.02-0.01c0.13-0.15 0.22-0.33 0.28-0.52 0.01-0.03 0.02-0.06 0.02-0.1l0.02-0.07c0.01-0.04 0.01-0.09 0.02-0.13l0-0.04a1.81 1.81 0 0 0 0.01-0.23v-9.8a0.69 0.69 0 0 0-0.68-0.63h-0.9a0.13 0.13 0 0 1-0.12-0.13v-2.07a0.11 0.11 0 0 1 0.11-0.11Z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group
android:scaleX="0.33"
android:scaleY="0.33"
android:translateX="44"
android:translateY="40">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M92.63-48.84H28.44c-0.61 0-1.1 0.49-1.09 1.1v20.38c0 0.69 0.56 1.24 1.24 1.24h8.8c3.56 0 6.45 2.74 6.76 6.22v13.98 7.78 74.16 0.53h-0.01c0.02 0.78-0.01 1.54-0.08 2.29-0.01 0.11-0.02 0.22-0.04 0.33-0.05 0.44-0.11 0.88-0.19 1.3-0.05 0.24-0.11 0.48-0.17 0.72-0.08 0.32-0.14 0.64-0.24 0.96-0.58 1.86-1.5 3.58-2.77 5.1-0.05 0.05-0.1 0.1-0.15 0.16-0.39 0.45-0.79 0.89-1.24 1.29-0.45 0.41-0.93 0.8-1.44 1.15-3.59 2.54-8.42 3.66-13.83 3.15-6.89-0.65-13.72-3.77-19.24-8.79-5.52-5.02-8.95-11.24-9.66-17.51-0.64-5.6 1.04-10.54 4.72-13.88 0.01-0.01 0.02-0.01 0.03-0.03 0.14-0.13 0.3-0.24 0.45-0.36 2.64-2.21 6.07-3.55 9.99-3.92 0.04 0 0.09-0.01 0.13-0.01 0.41-0.04 0.83-0.05 1.26-0.07 0.22-0.01 0.44-0.02 0.67-0.03 0.07 0 0.15-0.01 0.22 0 0.13 0 0.27 0.02 0.4 0.01 0.62 0.01 1.24 0.04 1.88 0.09 0.08 0.01 0.16 0 0.24 0.02 0.06 0.01 0.12 0.02 0.17 0.02 3.6 0.36 7.16 1.44 10.55 3.06 0.07 0 0.15 0.02 0.25 0.09 1.03 0.57 1.23-0.04 1.26-0.45V33.61 20.56c0-0.88-0.61-1.66-1.47-1.85-18.21-4.01-36.08 0.16-48.69 11.64-11.01 10.02-16.34 24.48-14.61 39.67 1.54 13.53 8.48 26.52 19.55 36.6 10.79 9.82 24.53 15.96 38.7 17.29 1.95 0.18 3.91 0.27 5.83 0.27 13.53 0 26.09-4.64 35.37-13.07 8.78-7.99 14.04-18.97 14.81-30.92l0.07-78.33h0.01V-19.08h0v-0.37c0.08-3.7 3.09-6.67 6.81-6.67h8.8c0.69 0 1.24-0.56 1.24-1.24v-20.38c0-0.61-0.49-1.1-1.1-1.1"/>
</group>
</vector>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -53,8 +53,7 @@ export default class AlarmServiceDriver {
title: notification.title,
message: notification.body ? notification.body : '-', // Required
channel: 'net.cozic.joplin.notification',
small_icon: 'ic_launcher_foreground', // Android requires the icon to be transparent
color: 'blue',
small_icon: 'ic_notification',
data: {
joplinNotificationId: notification.id,
noteId: notification.noteId,

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.emekalites.react.alarm.notification">
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

View File

@ -369,7 +369,7 @@ public class AlarmModel implements Serializable {
alarm.setActive(1);
alarm.setAutoCancel(bundle.getBoolean("auto_cancel", true));
alarm.setChannel(bundle.getString("channel", "my_channel_id"));
alarm.setColor(bundle.getString("color", "red"));
alarm.setColor(bundle.getString("color", ""));
Bundle data = bundle.getBundle("data");
alarm.setData(data);
@ -380,7 +380,7 @@ public class AlarmModel implements Serializable {
alarm.setMessage(bundle.getString("message", "My Notification Message"));
alarm.setPlaySound(bundle.getBoolean("play_sound", true));
alarm.setScheduleType(bundle.getString("schedule_type", "once"));
alarm.setSmallIcon(bundle.getString("small_icon", "ic_launcher"));
alarm.setSmallIcon(bundle.getString("small_icon", "ic_notification"));
alarm.setSnoozeInterval((int) bundle.getDouble("snooze_interval", 1.0));
alarm.setSoundName(bundle.getString("sound_name", null));
alarm.setSoundNames(bundle.getString("sound_names", null));

View File

@ -9,6 +9,7 @@ import android.util.Log;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import java.util.ArrayList;
import java.util.List;
public class AlarmReceiver extends BroadcastReceiver {
@ -27,7 +28,7 @@ public class AlarmReceiver extends BroadcastReceiver {
alarmUtil.sendNotification(alarm);
alarmUtil.setBootReceiver();
ArrayList<AlarmModel> alarms = alarmDB.getAlarmList(1);
List<AlarmModel> alarms = alarmDB.getAlarmList(1);
Log.d(Constants.TAG, "alarm start: " + alarm.toString() + ", alarms left: " + alarms.size());
} catch (Exception e) {
Log.e(Constants.TAG, "Failed to add alarm", e);

View File

@ -1,5 +1,9 @@
package com.emekalites.react.alarm.notification;
import static com.emekalites.react.alarm.notification.Constants.ADD_INTENT;
import static com.emekalites.react.alarm.notification.Constants.NOTIFICATION_ACTION_DISMISS;
import static com.emekalites.react.alarm.notification.Constants.NOTIFICATION_ACTION_SNOOZE;
import android.app.AlarmManager;
import android.app.Application;
import android.app.Notification;
@ -21,6 +25,7 @@ import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import androidx.core.app.AlarmManagerCompat;
import androidx.core.app.NotificationCompat;
import com.facebook.react.bridge.WritableMap;
@ -33,10 +38,6 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import static com.emekalites.react.alarm.notification.Constants.ADD_INTENT;
import static com.emekalites.react.alarm.notification.Constants.NOTIFICATION_ACTION_DISMISS;
import static com.emekalites.react.alarm.notification.Constants.NOTIFICATION_ACTION_SNOOZE;
class AlarmUtil {
private static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250};
@ -110,12 +111,12 @@ class AlarmUtil {
String scheduleType = alarm.getScheduleType();
if (scheduleType.equals("once")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (alarmManager.canScheduleExactAlarms()) {
AlarmManagerCompat.setAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
}
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
AlarmManagerCompat.setExact(alarmManager, AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
}
} else if (scheduleType.equals("repeat")) {
long interval = this.getInterval(alarm.getInterval(), alarm.getIntervalValue());
@ -152,12 +153,12 @@ class AlarmUtil {
String scheduleType = alarm.getScheduleType();
if (scheduleType.equals("once")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (alarmManager.canScheduleExactAlarms()) {
AlarmManagerCompat.setAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
}
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
AlarmManagerCompat.setExact(alarmManager, AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
}
} else if (scheduleType.equals("repeat")) {
long interval = this.getInterval(alarm.getInterval(), alarm.getIntervalValue());
@ -176,7 +177,7 @@ class AlarmUtil {
duration = value;
break;
case "hourly":
duration = 60 * value;
duration = 60L * value;
break;
case "daily":
duration = 60 * 24;
@ -317,9 +318,9 @@ class AlarmUtil {
int smallIconResId;
String smallIcon = alarm.getSmallIcon();
if (smallIcon != null && !smallIcon.equals("")) {
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
smallIconResId = res.getIdentifier(smallIcon, "drawable", packageName);
} else {
smallIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
smallIconResId = res.getIdentifier("ic_notification", "drawable", packageName);
}
Intent intent = new Intent(context, intentClass);
@ -329,7 +330,7 @@ class AlarmUtil {
intent.putExtra(Constants.NOTIFICATION_ID, alarm.getId());
intent.putExtra("data", alarm.getData());
PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationID, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, channelID)
.setSmallIcon(smallIconResId)
@ -378,12 +379,10 @@ class AlarmUtil {
}
//color
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
String color = alarm.getColor();
if (color != null && !color.equals("")) {
mBuilder.setColor(Color.parseColor(color));
}
}
mBuilder.setContentIntent(pendingIntent);
@ -410,8 +409,8 @@ class AlarmUtil {
//large icon
String largeIcon = alarm.getLargeIcon();
if (largeIcon != null && !largeIcon.equals("") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
if (largeIcon != null && !largeIcon.equals("")) {
int largeIconResId = res.getIdentifier(largeIcon, "drawable", packageName);
Bitmap largeIconBitmap = BitmapFactory.decodeResource(res, largeIconResId);
if (largeIconResId != 0) {
mBuilder.setLargeIcon(largeIconBitmap);

View File

@ -58,6 +58,10 @@
"7_a088bffc3266cee9cf14dcb575533df2_Assets/LinuxIcons/256x256.png_256_256__": true,
"7_a088bffc3266cee9cf14dcb575533df2_Assets/LinuxIcons/512x512.png_512_512__": true,
"7_a088bffc3266cee9cf14dcb575533df2_Assets/LinuxIcons/1024x1024.png_1024_1024__": true,
"icns_to_icon_set_89ddfe84307b49fa96580655b5d7c045_216bb492f34224f24aabacb5f98c3620_fe652082bfb7427cd5c74566ecc24322_ebf1ccaf3f5b77b01ff690b763a411f9_216bb492f34224f24aabacb5f98c3620_950b970a784b14c329e09e78af827a77_ebf1ccaf3f5b77b01ff690b763a411f9_d33dafc8081155149dd1d8c1713bf03f_950b970a784b14c329e09e78af827a77_94949c497e46ed0c67082175f5bb22f8": true
"icns_to_icon_set_89ddfe84307b49fa96580655b5d7c045_216bb492f34224f24aabacb5f98c3620_fe652082bfb7427cd5c74566ecc24322_ebf1ccaf3f5b77b01ff690b763a411f9_216bb492f34224f24aabacb5f98c3620_950b970a784b14c329e09e78af827a77_ebf1ccaf3f5b77b01ff690b763a411f9_d33dafc8081155149dd1d8c1713bf03f_950b970a784b14c329e09e78af827a77_94949c497e46ed0c67082175f5bb22f8": true,
"11_5f89ab52500090249bf3464c17dae433_packages/app-mobile/android/app/src/main/res/drawable-mdpi/ic_notification.png_24_24__": true,
"11_5f89ab52500090249bf3464c17dae433_packages/app-mobile/android/app/src/main/res/drawable-hdpi/ic_notification.png_36_36__": true,
"11_5f89ab52500090249bf3464c17dae433_packages/app-mobile/android/app/src/main/res/drawable-xhdpi/ic_notification.png_48_48__": true,
"11_5f89ab52500090249bf3464c17dae433_packages/app-mobile/android/app/src/main/res/drawable-xxhdpi/ic_notification.png_72_72__": true
}
}

View File

@ -4,6 +4,7 @@ import { execCommand } from './tool-utils';
import { fileExtension } from '@joplin/lib/path-utils';
const md5File = require('md5-file');
const sharp = require('sharp');
const svg2vectordrawable = require('svg2vectordrawable/src/svg-file-to-vectordrawable-file');
interface Source {
id: number;
@ -60,6 +61,14 @@ const sources: Source[] = [
id: 9,
name: 'WebsiteTopImageCn.png',
},
{
id: 10,
name: 'JoplinIconForeground.svg',
},
{
id: 11,
name: 'JoplinNotificationIcon.svg',
},
];
function sourceById(id: number) {
@ -71,6 +80,47 @@ function sourceById(id: number) {
const operations: Operation[] = [
// ============================================================================
// Android icons
// ============================================================================
{
source: 10,
dest: 'packages/app-mobile/android/app/src/main/res/drawable/ic_launcher_foreground.xml',
width: 108,
height: 108,
},
{
source: 11,
dest: 'packages/app-mobile/android/app/src/main/res/drawable-anydpi-v24/ic_notification.xml',
width: 24,
height: 24,
},
{
source: 11,
dest: 'packages/app-mobile/android/app/src/main/res/drawable-mdpi/ic_notification.png',
width: 24,
height: 24,
},
{
source: 11,
dest: 'packages/app-mobile/android/app/src/main/res/drawable-hdpi/ic_notification.png',
width: 36,
height: 36,
},
{
source: 11,
dest: 'packages/app-mobile/android/app/src/main/res/drawable-xhdpi/ic_notification.png',
width: 48,
height: 48,
},
{
source: 11,
dest: 'packages/app-mobile/android/app/src/main/res/drawable-xxhdpi/ic_notification.png',
width: 72,
height: 72,
},
// ============================================================================
// iOS icons
// ============================================================================
@ -534,6 +584,15 @@ async function main() {
s.webp({
// quality: 90,
});
} else if (destExt === 'xml') {
const options = {
floatPrecision: 2,
fillBlack: false,
xmlTag: false,
tint: '#FFFFFFFF',
};
svg2vectordrawable.convertFile(sourcePath, destPath, options);
continue;
} else {
throw new Error(`Unsupported extension: ${destExt}`);
}

View File

@ -37,6 +37,7 @@
"request": "2.88.2",
"sharp": "0.32.1",
"source-map-support": "0.5.21",
"svg2vectordrawable": "2.9.1",
"uri-template": "2.0.0",
"yargs": "17.7.2"
},

226
yarn.lock
View File

@ -5460,6 +5460,7 @@ __metadata:
sharp: 0.32.1
source-map-support: 0.5.21
sqlite3: 5.1.6
svg2vectordrawable: 2.9.1
typescript: 4.9.4
uri-template: 2.0.0
yargs: 17.7.2
@ -7424,6 +7425,13 @@ __metadata:
languageName: node
linkType: hard
"@trysound/sax@npm:0.2.0":
version: 0.2.0
resolution: "@trysound/sax@npm:0.2.0"
checksum: 11226c39b52b391719a2a92e10183e4260d9651f86edced166da1d95f39a0a1eaa470e44d14ac685ccd6d3df7e2002433782872c0feeb260d61e80f21250e65c
languageName: node
linkType: hard
"@tsconfig/node10@npm:^1.0.7":
version: 1.0.9
resolution: "@tsconfig/node10@npm:1.0.9"
@ -8061,6 +8069,13 @@ __metadata:
languageName: node
linkType: hard
"@types/q@npm:^1.5.1":
version: 1.5.5
resolution: "@types/q@npm:1.5.5"
checksum: 3bd386fb97a0e5f1ce1ed7a14e39b60e469b5ca9d920a7f69e0cdb58d22c0f5bdd16637d8c3a5bfeda76663c023564dd47a65389ee9aaabd65aee54803d5ba45
languageName: node
linkType: hard
"@types/qs@npm:*":
version: 6.9.7
resolution: "@types/qs@npm:6.9.7"
@ -8846,6 +8861,13 @@ __metadata:
languageName: node
linkType: hard
"abs-svg-path@npm:^0.1.1":
version: 0.1.1
resolution: "abs-svg-path@npm:0.1.1"
checksum: af1a167c09e8bdb76c80adca7333f3d828e5b50e37b9702aa03675e271919e7b1eeaa35cce939970ecba14769953b7465ea34c2129ab683ddff9d973a07f164f
languageName: node
linkType: hard
"absolute-path@npm:^0.0.0":
version: 0.0.0
resolution: "absolute-path@npm:0.0.0"
@ -10448,6 +10470,13 @@ __metadata:
languageName: node
linkType: hard
"boolbase@npm:^1.0.0":
version: 1.0.0
resolution: "boolbase@npm:1.0.0"
checksum: 3e25c80ef626c3a3487c73dbfc70ac322ec830666c9ad915d11b701142fab25ec1e63eff2c450c74347acfd2de854ccde865cd79ef4db1683f7c7b046ea43bb0
languageName: node
linkType: hard
"boolean@npm:^3.0.1":
version: 3.1.4
resolution: "boolean@npm:3.1.4"
@ -11363,7 +11392,7 @@ __metadata:
languageName: node
linkType: hard
"chalk@npm:2.4.2, chalk@npm:^2.0.0, chalk@npm:^2.1.0, chalk@npm:^2.3.1, chalk@npm:^2.4.2":
"chalk@npm:2.4.2, chalk@npm:^2.0.0, chalk@npm:^2.1.0, chalk@npm:^2.3.1, chalk@npm:^2.4.1, chalk@npm:^2.4.2":
version: 2.4.2
resolution: "chalk@npm:2.4.2"
dependencies:
@ -11874,6 +11903,17 @@ __metadata:
languageName: node
linkType: hard
"coa@npm:^2.0.2":
version: 2.0.2
resolution: "coa@npm:2.0.2"
dependencies:
"@types/q": ^1.5.1
chalk: ^2.4.1
q: ^1.1.2
checksum: 44736914aac2160d3d840ed64432a90a3bb72285a0cd6a688eb5cabdf15d15a85eee0915b3f6f2a4659d5075817b1cb577340d3c9cbb47d636d59ab69f819552
languageName: node
linkType: hard
"code-excerpt@npm:^3.0.0":
version: 3.0.0
resolution: "code-excerpt@npm:3.0.0"
@ -12892,6 +12932,19 @@ __metadata:
languageName: node
linkType: hard
"css-select@npm:^4.1.3":
version: 4.3.0
resolution: "css-select@npm:4.3.0"
dependencies:
boolbase: ^1.0.0
css-what: ^6.0.1
domhandler: ^4.3.1
domutils: ^2.8.0
nth-check: ^2.0.1
checksum: d6202736839194dd7f910320032e7cfc40372f025e4bf21ca5bf6eb0a33264f322f50ba9c0adc35dadd342d3d6fae5ca244779a4873afbfa76561e343f2058e0
languageName: node
linkType: hard
"css-selector-parser@npm:^1.3":
version: 1.4.1
resolution: "css-selector-parser@npm:1.4.1"
@ -12910,6 +12963,23 @@ __metadata:
languageName: node
linkType: hard
"css-tree@npm:^1.1.2, css-tree@npm:^1.1.3":
version: 1.1.3
resolution: "css-tree@npm:1.1.3"
dependencies:
mdn-data: 2.0.14
source-map: ^0.6.1
checksum: 79f9b81803991b6977b7fcb1588799270438274d89066ce08f117f5cdb5e20019b446d766c61506dd772c839df84caa16042d6076f20c97187f5abe3b50e7d1f
languageName: node
linkType: hard
"css-what@npm:^6.0.1":
version: 6.1.0
resolution: "css-what@npm:6.1.0"
checksum: b975e547e1e90b79625918f84e67db5d33d896e6de846c9b584094e529f0c63e2ab85ee33b9daffd05bff3a146a1916bec664e18bb76dd5f66cbff9fc13b2bbe
languageName: node
linkType: hard
"css@npm:3.0.0":
version: 3.0.0
resolution: "css@npm:3.0.0"
@ -12930,6 +13000,15 @@ __metadata:
languageName: node
linkType: hard
"csso@npm:^4.2.0":
version: 4.2.0
resolution: "csso@npm:4.2.0"
dependencies:
css-tree: ^1.1.2
checksum: 380ba9663da3bcea58dee358a0d8c4468bb6539be3c439dc266ac41c047217f52fd698fb7e4b6b6ccdfb8cf53ef4ceed8cc8ceccb8dfca2aa628319826b5b998
languageName: node
linkType: hard
"cssom@npm:^0.4.4":
version: 0.4.4
resolution: "cssom@npm:0.4.4"
@ -14609,6 +14688,17 @@ __metadata:
languageName: node
linkType: hard
"dom-serializer@npm:^1.0.1":
version: 1.4.1
resolution: "dom-serializer@npm:1.4.1"
dependencies:
domelementtype: ^2.0.1
domhandler: ^4.2.0
entities: ^2.0.0
checksum: fbb0b01f87a8a2d18e6e5a388ad0f7ec4a5c05c06d219377da1abc7bb0f674d804f4a8a94e3f71ff15f6cb7dcfc75704a54b261db672b9b3ab03da6b758b0b22
languageName: node
linkType: hard
"dom-serializer@npm:^2.0.0":
version: 2.0.0
resolution: "dom-serializer@npm:2.0.0"
@ -14634,7 +14724,7 @@ __metadata:
languageName: node
linkType: hard
"domelementtype@npm:2.3.0, domelementtype@npm:^2.3.0":
"domelementtype@npm:2.3.0, domelementtype@npm:^2.2.0, domelementtype@npm:^2.3.0":
version: 2.3.0
resolution: "domelementtype@npm:2.3.0"
checksum: ee837a318ff702622f383409d1f5b25dd1024b692ef64d3096ff702e26339f8e345820f29a68bcdcea8cfee3531776b3382651232fbeae95612d6f0a75efb4f6
@ -14684,6 +14774,15 @@ __metadata:
languageName: node
linkType: hard
"domhandler@npm:^4.2.0, domhandler@npm:^4.3.1":
version: 4.3.1
resolution: "domhandler@npm:4.3.1"
dependencies:
domelementtype: ^2.2.0
checksum: 4c665ceed016e1911bf7d1dadc09dc888090b64dee7851cccd2fcf5442747ec39c647bb1cb8c8919f8bbdd0f0c625a6bafeeed4b2d656bbecdbae893f43ffaaa
languageName: node
linkType: hard
"domhandler@npm:^5.0.1, domhandler@npm:^5.0.2":
version: 5.0.3
resolution: "domhandler@npm:5.0.3"
@ -14735,6 +14834,17 @@ __metadata:
languageName: node
linkType: hard
"domutils@npm:^2.8.0":
version: 2.8.0
resolution: "domutils@npm:2.8.0"
dependencies:
dom-serializer: ^1.0.1
domelementtype: ^2.2.0
domhandler: ^4.2.0
checksum: abf7434315283e9aadc2a24bac0e00eab07ae4313b40cc239f89d84d7315ebdfd2fb1b5bf750a96bc1b4403d7237c7b2ebf60459be394d625ead4ca89b934391
languageName: node
linkType: hard
"dot-case@npm:^3.0.4":
version: 3.0.4
resolution: "dot-case@npm:3.0.4"
@ -19829,6 +19939,13 @@ __metadata:
languageName: node
linkType: hard
"is-svg-path@npm:^1.0.1":
version: 1.0.2
resolution: "is-svg-path@npm:1.0.2"
checksum: ed35f610d117f3bd2b6a1a637e9c03136f408976221c2396acfa811636ac71853b7509338245853154e2da69f9b5223a65ecf8d1d6192bd8b337a32b46b589e3
languageName: node
linkType: hard
"is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3":
version: 1.0.4
resolution: "is-symbol@npm:1.0.4"
@ -22996,6 +23113,13 @@ __metadata:
languageName: node
linkType: hard
"mdn-data@npm:2.0.14":
version: 2.0.14
resolution: "mdn-data@npm:2.0.14"
checksum: 9d0128ed425a89f4cba8f787dca27ad9408b5cb1b220af2d938e2a0629d17d879a34d2cb19318bdb26c3f14c77dd5dfbae67211f5caaf07b61b1f2c5c8c7dc16
languageName: node
linkType: hard
"mdurl@npm:^1.0.1":
version: 1.0.1
resolution: "mdurl@npm:1.0.1"
@ -24809,6 +24933,15 @@ __metadata:
languageName: node
linkType: hard
"normalize-svg-path@npm:^1.0.0":
version: 1.1.0
resolution: "normalize-svg-path@npm:1.1.0"
dependencies:
svg-arc-to-cubic-bezier: ^3.0.0
checksum: 106e108b2f99e9e222a1c6edfc859523c6c3c2b0a6ba64743ed08af120b23b9bc2c16682bc2ae043a24c011c34c8252376c68525cf11735c6f110b571740eb2e
languageName: node
linkType: hard
"normalize-url@npm:^4.1.0":
version: 4.5.1
resolution: "normalize-url@npm:4.5.1"
@ -24998,6 +25131,15 @@ __metadata:
languageName: node
linkType: hard
"nth-check@npm:^2.0.1":
version: 2.1.1
resolution: "nth-check@npm:2.1.1"
dependencies:
boolbase: ^1.0.0
checksum: 5afc3dafcd1573b08877ca8e6148c52abd565f1d06b1eb08caf982e3fa289a82f2cae697ffb55b5021e146d60443f1590a5d6b944844e944714a5b549675bcd3
languageName: node
linkType: hard
"nullthrows@npm:^1.1.1":
version: 1.1.1
resolution: "nullthrows@npm:1.1.1"
@ -25935,6 +26077,13 @@ __metadata:
languageName: node
linkType: hard
"parse-svg-path@npm:^0.1.2":
version: 0.1.2
resolution: "parse-svg-path@npm:0.1.2"
checksum: bba7d4b4207fcc9eaf553b0d34db96ea8a1173635bc94528b5b66e1581902d4792d8d6229103764f01af4d839274234e97a4fa1c6f0fe7dcce195383848cec56
languageName: node
linkType: hard
"parse-url@npm:^6.0.0":
version: 6.0.0
resolution: "parse-url@npm:6.0.0"
@ -27105,7 +27254,7 @@ __metadata:
languageName: node
linkType: hard
"q@npm:^1.5.1":
"q@npm:^1.1.2, q@npm:^1.5.1":
version: 1.5.1
resolution: "q@npm:1.5.1"
checksum: 147baa93c805bc1200ed698bdf9c72e9e42c05f96d007e33a558b5fdfd63e5ea130e99313f28efc1783e90e6bdb4e48b67a36fcc026b7b09202437ae88a1fb12
@ -29115,6 +29264,7 @@ __metadata:
node-gyp: 9.3.1
nodemon: 2.0.22
npm-package-json-lint: 6.4.0
svg2vectordrawable: ^2.9.1
typedoc: 0.17.8
typescript: 4.9.4
languageName: unknown
@ -30386,6 +30536,13 @@ __metadata:
languageName: node
linkType: hard
"stable@npm:^0.1.8":
version: 0.1.8
resolution: "stable@npm:0.1.8"
checksum: 2ff482bb100285d16dd75cd8f7c60ab652570e8952c0bfa91828a2b5f646a0ff533f14596ea4eabd48bb7f4aeea408dce8f8515812b975d958a4cc4fa6b9dfeb
languageName: node
linkType: hard
"stack-trace@npm:0.0.10":
version: 0.0.10
resolution: "stack-trace@npm:0.0.10"
@ -31171,6 +31328,69 @@ __metadata:
languageName: node
linkType: hard
"svg-arc-to-cubic-bezier@npm:^3.0.0":
version: 3.2.0
resolution: "svg-arc-to-cubic-bezier@npm:3.2.0"
checksum: 55bf17756d558b9c0daddf636a6c9f2fe01fd5ac412229dfa2d4b29740226a82c980bcd3b5eb09ce311cbea282106c7549d97f8c8dba3a5a7b75f786bcb5e155
languageName: node
linkType: hard
"svg-path-bounds@npm:^1.0.1":
version: 1.0.2
resolution: "svg-path-bounds@npm:1.0.2"
dependencies:
abs-svg-path: ^0.1.1
is-svg-path: ^1.0.1
normalize-svg-path: ^1.0.0
parse-svg-path: ^0.1.2
checksum: 8590a4e14942a34f595df64d804a3533cb83a29498b34f61723cf3172958a5a3c3b211805c6c4b2f93fb90ff4eab74b08a2dc1daa489d6ba429534aca5f5184d
languageName: node
linkType: hard
"svg2vectordrawable@npm:2.9.1, svg2vectordrawable@npm:^2.9.1":
version: 2.9.1
resolution: "svg2vectordrawable@npm:2.9.1"
dependencies:
coa: ^2.0.2
mkdirp: ^1.0.4
svg-path-bounds: ^1.0.1
svgo: ^2.8.0
svgpath: ^2.5.0
bin:
s2v: bin/svg2vectordrawable
svg2android: bin/svg2vectordrawable
svg2avd: bin/svg2vectordrawable
svg2drawable: bin/svg2vectordrawable
svg2vector: bin/svg2vectordrawable
svg2vectordrawable: bin/svg2vectordrawable
checksum: 37f83e21f6dd81a09afcbe2b01f09c9cde3f9c1614045a66e5ae82d550f2629b0bad6335913fd13e8dc1d885bcfcb184f410100419ec3ba53380ae0a2034c939
languageName: node
linkType: hard
"svgo@npm:^2.8.0":
version: 2.8.0
resolution: "svgo@npm:2.8.0"
dependencies:
"@trysound/sax": 0.2.0
commander: ^7.2.0
css-select: ^4.1.3
css-tree: ^1.1.3
csso: ^4.2.0
picocolors: ^1.0.0
stable: ^0.1.8
bin:
svgo: bin/svgo
checksum: b92f71a8541468ffd0b81b8cdb36b1e242eea320bf3c1a9b2c8809945853e9d8c80c19744267eb91cabf06ae9d5fff3592d677df85a31be4ed59ff78534fa420
languageName: node
linkType: hard
"svgpath@npm:^2.5.0":
version: 2.6.0
resolution: "svgpath@npm:2.6.0"
checksum: 57bd2512b41a03a729c2880a6c771bb8ad449a9cea47c1fc43ac5cec70bf81a607591bb916ba16c21c9d87122537bcdf2ac4082dae13559c84c964b8fe868204
languageName: node
linkType: hard
"symbol-tree@npm:^3.2.4":
version: 3.2.4
resolution: "symbol-tree@npm:3.2.4"