Permalink
Browse files

Fully switch to vector icons, delete icon pngs, add spaghetti tutoria…

…l hint
  • Loading branch information...
stefanhaustein committed Apr 24, 2017
1 parent 8802976 commit 9ca699ea2021917c3ad1b171b14ea552889ac312
Showing with 88 additions and 24 deletions.
  1. +4 −0 build.gradle
  2. +11 −24 flowgrid-swt/src/main/java/org/flowgrid/swt/ResourceManager.java
  3. BIN flowgrid-swt/src/main/resources/icons/ic_fast_forward_black_24dp.png
  4. BIN flowgrid-swt/src/main/resources/icons/ic_fast_forward_white_24dp.png
  5. +9 −0 flowgrid-swt/src/main/resources/icons/ic_fast_forward_white_24dp.xml
  6. BIN flowgrid-swt/src/main/resources/icons/ic_menu_black_24dp.png
  7. BIN flowgrid-swt/src/main/resources/icons/ic_menu_white_24dp.png
  8. +9 −0 flowgrid-swt/src/main/resources/icons/ic_menu_white_24dp.xml
  9. BIN flowgrid-swt/src/main/resources/icons/ic_more_vert_black_24dp.png
  10. BIN flowgrid-swt/src/main/resources/icons/ic_more_vert_white_24dp.png
  11. +9 −0 flowgrid-swt/src/main/resources/icons/ic_more_vert_white_24dp.xml
  12. BIN flowgrid-swt/src/main/resources/icons/ic_pause_black_24dp.png
  13. BIN flowgrid-swt/src/main/resources/icons/ic_pause_white_24dp.png
  14. +9 −0 flowgrid-swt/src/main/resources/icons/ic_pause_white_24dp.xml
  15. BIN flowgrid-swt/src/main/resources/icons/ic_play_arrow_black_24dp.png
  16. BIN flowgrid-swt/src/main/resources/icons/ic_play_arrow_white_24dp.png
  17. +9 −0 flowgrid-swt/src/main/resources/icons/ic_play_arrow_white_24dp.xml
  18. BIN flowgrid-swt/src/main/resources/icons/ic_slow_motion_video_black_24dp.png
  19. BIN flowgrid-swt/src/main/resources/icons/ic_slow_motion_video_white_24dp.png
  20. +9 −0 flowgrid-swt/src/main/resources/icons/ic_slow_motion_video_white_24dp.xml
  21. BIN flowgrid-swt/src/main/resources/icons/ic_stop_black_24dp.png
  22. BIN flowgrid-swt/src/main/resources/icons/ic_stop_white_24dp.png
  23. +9 −0 flowgrid-swt/src/main/resources/icons/ic_stop_white_24dp.xml
  24. BIN flowgrid-swt/src/main/resources/icons/ic_volume_mute_black_24dp.png
  25. BIN flowgrid-swt/src/main/resources/icons/ic_volume_mute_white_24dp.png
  26. +9 −0 flowgrid-swt/src/main/resources/icons/ic_volume_mute_white_24dp.xml
  27. +1 −0 flowgrid-swt/src/main/resources/install/missions/Spaghetti.fgo
View
@@ -13,6 +13,10 @@ buildscript {
}
}
+configurations.all {
+ resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
+}
+
allprojects {
repositories {
jcenter()
@@ -6,6 +6,7 @@
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.flowgrid.model.ArrayType;
@@ -146,31 +147,17 @@ public Image getIcon(Icon id) {
int expectedSize = Math.round(24 * pixelPerDp);
- if (is != null) {
- System.out.println(vectorResName);
- AndroidVectorDrawable avd = AndroidVectorDrawable.read(display, is, pixelPerDp);
- image = new Image(display, expectedSize, expectedSize);
- GC gc = new GC(image);
- avd.draw(gc);
- } else {
- String resourceName = "/icons/ic_" + id.name().toLowerCase() + (dark ? "_white_24dp.png" : "_black_24dp.png");
- is = getClass().getResourceAsStream(resourceName);
- if (is == null) {
- throw new RuntimeException("Resource not found: " + resourceName);
- }
- image = new Image(display, is);
-
- Rectangle bounds = image.getBounds();
-
- if (bounds.width != expectedSize || bounds.height != expectedSize) {
- Image scaledImage = new Image(display, expectedSize, expectedSize);
- GC gc = new GC(scaledImage);
- gc.setAntialias(SWT.ON);
- gc.drawImage(image, 0, 0, bounds.width, bounds.height, 0, 0, expectedSize, expectedSize);
- image = scaledImage;
- }
+ AndroidVectorDrawable avd = AndroidVectorDrawable.read(display, is, pixelPerDp);
+ image = new Image(display, expectedSize, expectedSize);
+ GC gc = new GC(image);
+ if (expectedSize != 24) {
+ Transform transform = new Transform(display);
+ gc.getTransform(transform);
+ transform.scale(expectedSize/24f, expectedSize/24f);
+ gc.setTransform(transform);
+ transform.dispose();
}
-
+ avd.draw(gc);
icons.put(id, image);
}
return image;
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M4,18l8.5,-6L4,6v12zM13,6v12l8.5,-6L13,6z"/>
+</vector>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
+</vector>
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
+</vector>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
+</vector>
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M8,5v14l11,-7z"/>
+</vector>
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M13.05,9.79L10,7.5v9l3.05,-2.29L16,12zM13.05,9.79L10,7.5v9l3.05,-2.29L16,12zM13.05,9.79L10,7.5v9l3.05,-2.29L16,12zM11,4.07L11,2.05c-2.01,0.2 -3.84,1 -5.32,2.21L7.1,5.69c1.11,-0.86 2.44,-1.44 3.9,-1.62zM5.69,7.1L4.26,5.68C3.05,7.16 2.25,8.99 2.05,11h2.02c0.18,-1.46 0.76,-2.79 1.62,-3.9zM4.07,13L2.05,13c0.2,2.01 1,3.84 2.21,5.32l1.43,-1.43c-0.86,-1.1 -1.44,-2.43 -1.62,-3.89zM5.68,19.74C7.16,20.95 9,21.75 11,21.95v-2.02c-1.46,-0.18 -2.79,-0.76 -3.9,-1.62l-1.42,1.43zM22,12c0,5.16 -3.92,9.42 -8.95,9.95v-2.02C16.97,19.41 20,16.05 20,12s-3.03,-7.41 -6.95,-7.93L13.05,2.05C18.08,2.58 22,6.84 22,12z"/>
+</vector>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M6,6h12v12H6z"/>
+</vector>
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7,9v6h4l5,5V4l-5,5H7z"/>
+</vector>
@@ -1,6 +1,7 @@
{
"name": "Spaghetti",
+ "documentation": "Can you resolve this spaghetti code?",
"kind": "operation",
"asyncInput": true,
"passedWithStars": 0,

0 comments on commit 9ca699e

Please sign in to comment.