Skip to content

Commit 76078e1

Browse files
committed
update icon handling code
1 parent b41f7f7 commit 76078e1

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/processing/mode/android/AndroidBuild.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AndroidBuild extends JavaBuild {
6666
static public final String min_sdk_watchface = "21"; // Lollipop (5.0)
6767

6868
// Hard-coded target SDK, no longer user-selected.
69-
static public final String target_sdk = "22"; // Lollipop (5.1)
69+
static public final String target_sdk = "23"; // Marshmallow (6.0)
7070
static public final String target_platform = "android-" + target_sdk;
7171

7272
static public int appComponent = FRAGMENT;
@@ -941,6 +941,8 @@ private void writeLocalProps(final File file) {
941941
writer.close();
942942
}
943943

944+
static final String ICON_192 = "icon-192.png";
945+
static final String ICON_144 = "icon-144.png";
944946
static final String ICON_96 = "icon-96.png";
945947
static final String ICON_72 = "icon-72.png";
946948
static final String ICON_48 = "icon-48.png";
@@ -974,18 +976,24 @@ private void writeRes(File resFolder,
974976
File localIcon48 = new File(sketchFolder, ICON_48);
975977
File localIcon72 = new File(sketchFolder, ICON_72);
976978
File localIcon96 = new File(sketchFolder, ICON_96);
979+
File localIcon144 = new File(sketchFolder, ICON_144);
980+
File localIcon192 = new File(sketchFolder, ICON_192);
977981

978982
// File drawableFolder = new File(resFolder, "drawable");
979983
// drawableFolder.mkdirs()
980984
File buildIcon48 = new File(resFolder, "drawable/icon.png");
981985
File buildIcon36 = new File(resFolder, "drawable-ldpi/icon.png");
982986
File buildIcon72 = new File(resFolder, "drawable-hdpi/icon.png");
983987
File buildIcon96 = new File(resFolder, "drawable-xhdpi/icon.png");
988+
File buildIcon144 = new File(resFolder, "drawable-xxhdpi/icon.png");
989+
File buildIcon192 = new File(resFolder, "drawable-xxxhdpi/icon.png");
984990

985991
if (!localIcon36.exists() &&
986992
!localIcon48.exists() &&
987993
!localIcon72.exists() &&
988-
!localIcon96.exists()) {
994+
!localIcon96.exists() &&
995+
!localIcon144.exists() &&
996+
!localIcon192.exists()) {
989997
try {
990998
// if no icons are in the sketch folder, then copy all the defaults
991999
if (buildIcon36.getParentFile().mkdirs()) {
@@ -1008,6 +1016,16 @@ private void writeRes(File resFolder,
10081016
} else {
10091017
System.err.println("Could not create \"drawable-xhdpi\" folder.");
10101018
}
1019+
if (buildIcon144.getParentFile().mkdirs()) {
1020+
Util.copyFile(mode.getContentFile("icons/" + ICON_144), buildIcon144);
1021+
} else {
1022+
System.err.println("Could not create \"drawable-xxhdpi\" folder.");
1023+
}
1024+
if (buildIcon192.getParentFile().mkdirs()) {
1025+
Util.copyFile(mode.getContentFile("icons/" + ICON_192), buildIcon192);
1026+
} else {
1027+
System.err.println("Could not create \"drawable-xxxhdpi\" folder.");
1028+
}
10111029
} catch (IOException e) {
10121030
e.printStackTrace();
10131031
//throw new SketchException("Could not get Android icons");
@@ -1035,6 +1053,16 @@ private void writeRes(File resFolder,
10351053
Util.copyFile(localIcon96, buildIcon96);
10361054
}
10371055
}
1056+
if (localIcon144.exists()) {
1057+
if (new File(resFolder, "drawable-xxhdpi").mkdirs()) {
1058+
Util.copyFile(localIcon144, buildIcon144);
1059+
}
1060+
}
1061+
if (localIcon192.exists()) {
1062+
if (new File(resFolder, "drawable-xxxhdpi").mkdirs()) {
1063+
Util.copyFile(localIcon192, buildIcon192);
1064+
}
1065+
}
10381066
} catch (IOException e) {
10391067
System.err.println("Problem while copying icons.");
10401068
e.printStackTrace();

0 commit comments

Comments
 (0)