1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +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
26 changed files with 427 additions and 39 deletions

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}`);
}