Skip to content

Commit

Permalink
Updated the app icon to be the new layer-style of API 26.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeka committed Sep 14, 2018
1 parent e6a7d4c commit 088eed4
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 12 deletions.
7 changes: 7 additions & 0 deletions .idea/dictionaries/Dean.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/app_icon"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:supportsRtl="true"
tools:replace="android:supportsRtl"
Expand Down
5 changes: 5 additions & 0 deletions client/src/main/res/drawable-anydpi-v26/app_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed client/src/main/res/mipmap-hdpi/app_icon.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed client/src/main/res/mipmap-mdpi/app_icon.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed client/src/main/res/mipmap-xhdpi/app_icon.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package au.com.codeka.warworlds.planetrender.ui;

import org.omg.CORBA.Environment;

import au.com.codeka.warworlds.common.Colour;
import au.com.codeka.warworlds.common.Image;
import au.com.codeka.warworlds.common.PerlinNoise;
Expand All @@ -21,9 +23,11 @@
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import javax.swing.DefaultComboBoxModel;
Expand Down Expand Up @@ -245,31 +249,44 @@ private void initialize() {
}

private String[] getTemplateNames() {
ArrayList<String> fileNames = new ArrayList<>();
File[] files = getSamplesDirectory().listFiles();
if (files == null) {
return new String[] {};
}

ArrayList<String> fileNames = new ArrayList<>();
getTemplateNames(getSamplesDirectory(), "", fileNames);

String[] array = new String[fileNames.size()];
fileNames.toArray(array);
Arrays.sort(array);
return array;
}

private void getTemplateNames(File rootDir, String prefix, List<String> fileNames) {
File[] files = rootDir.listFiles();
if (files == null) {
return;
}

for (File file : files) {
if (file.isDirectory() && !file.getName().startsWith(".")) {
getTemplateNames(file, prefix + file.getName() + File.separator, fileNames);
continue;
}

String name = file.getName();
if (!name.endsWith(".xml")) {
continue;
}
name = name.substring(0, name.length() - 4);
name = name.replace('-', ' ');
fileNames.add(name);
}

String[] array = new String[fileNames.size()];
fileNames.toArray(array);
Arrays.sort(array);
return array;
fileNames.add(prefix + name);
}
}

private String loadTemplate(String name) {
File dir = getSamplesDirectory();
File templateFile = new File(dir, name.replace(' ', '-') + ".xml");
File templateFile = new File(dir, name);
try {
return new String(Files.readAllBytes(Paths.get(templateFile.toString())),
Charset.forName("utf-8"));
Expand All @@ -279,6 +296,6 @@ private String loadTemplate(String name) {
}

private File getSamplesDirectory() {
return new File("xml");
return new File("renderer");
}
}

0 comments on commit 088eed4

Please sign in to comment.