diff --git a/app/src/main/java/com/codigoparallevar/minicards/bridge/ProgramakerBridgeService.java b/app/src/main/java/com/codigoparallevar/minicards/bridge/ProgramakerBridgeService.java
index 1cfc94e..c97733e 100644
--- a/app/src/main/java/com/codigoparallevar/minicards/bridge/ProgramakerBridgeService.java
+++ b/app/src/main/java/com/codigoparallevar/minicards/bridge/ProgramakerBridgeService.java
@@ -21,6 +21,12 @@ import com.codigoparallevar.minicards.types.functional.Tuple2;
import com.codigoparallevar.minicards.ui_helpers.DoAsync;
import com.programaker.api.ProgramakerApi;
+enum ServiceState {
+ LOADING,
+ RUNNING,
+ STOPPED,
+}
+
public class ProgramakerBridgeService extends Service {
public static final String BridgeUserNotificationChannel = "PROGRAMAKER_BRIDGE_USER_NOTIFICATION";
public static final CharSequence BridgeUserNotificationChannelName = "User notifications";
@@ -41,10 +47,10 @@ public class ProgramakerBridgeService extends Service {
@Override
public void onCreate() {
- setBridgeStatusNotification(getString(R.string.bridge_service_not_started), true);
+ setBridgeStatusNotification(getString(R.string.bridge_service_not_started), ServiceState.LOADING);
}
- private void setBridgeStatusNotification(String title, boolean stopped) {
+ private void setBridgeStatusNotification(String title, ServiceState state) {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationManager != null;
@@ -72,13 +78,19 @@ public class ProgramakerBridgeService extends Service {
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
- if (stopped) {
+ if (state == ServiceState.STOPPED) {
builder.addAction(R.drawable.ic_start, getString(R.string.start_bridge), startPendingIntent)
.setSmallIcon(R.drawable.ic_vector_stopped_icon);
}
else {
- builder.addAction(R.drawable.ic_cancel, getString(R.string.stop_bridge), stopPendingIntent)
- .setSmallIcon(R.drawable.ic_vector_icon);
+ builder.addAction(R.drawable.ic_cancel, getString(R.string.stop_bridge), stopPendingIntent);
+
+ if (state == ServiceState.RUNNING) {
+ builder.setSmallIcon(R.drawable.ic_vector_icon);
+ }
+ else {
+ builder.setSmallIcon(R.drawable.ic_vector_icon_loading);
+ }
}
Notification notification = builder.build();
@@ -148,7 +160,7 @@ public class ProgramakerBridgeService extends Service {
bridgeId);
ProgramakerBridgeService.this.bridge.start(
() -> { // On ready
- setBridgeStatusNotification(getString(R.string.bridge_service_online), false);
+ setBridgeStatusNotification(getString(R.string.bridge_service_online), ServiceState.RUNNING);
if (config.getBridgeConnectionId() == null) {
new DoAsync().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
new Tuple2<>(
@@ -178,14 +190,14 @@ public class ProgramakerBridgeService extends Service {
}, "ServiceStartArguments");
thread.setPriority(Process.THREAD_PRIORITY_BACKGROUND);
- setBridgeStatusNotification(getString(R.string.bridge_service_starting), false);
+ setBridgeStatusNotification(getString(R.string.bridge_service_starting), ServiceState.LOADING);
thread.start();
}
private void onBridgeFailedAfterConnected() {
if (!stopped) {
Log.e(LogTag, "Bridge stopped after connected. Waiting 10s then restarting");
- setBridgeStatusNotification(getString(R.string.bridge_service_failed_restarting), false);
+ setBridgeStatusNotification(getString(R.string.bridge_service_failed_restarting), ServiceState.LOADING);
try {
Thread.sleep(WAIT_TIME_BEFORE_RESTART_MILLIS);
} catch (InterruptedException e) {
@@ -208,6 +220,6 @@ public class ProgramakerBridgeService extends Service {
if (bridge != null) {
bridge.stop();
}
- setBridgeStatusNotification(getString(R.string.bridge_service_failed_stopping), true);
+ setBridgeStatusNotification(getString(R.string.bridge_service_failed_stopping), ServiceState.STOPPED);
}
}
diff --git a/app/src/main/res/drawable/ic_vector_icon.xml b/app/src/main/res/drawable/ic_vector_icon.xml
index 38f9ad0..2b0607a 100644
--- a/app/src/main/res/drawable/ic_vector_icon.xml
+++ b/app/src/main/res/drawable/ic_vector_icon.xml
@@ -1,12 +1,32 @@
-
-
+ android:height="328.9dp" android:viewportHeight="328.9"
+ android:viewportWidth="321.8" android:width="321.8dp" xmlns:android="http://schemas.android.com/apk/res/android">
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_vector_icon_loading.xml b/app/src/main/res/drawable/ic_vector_icon_loading.xml
new file mode 100644
index 0000000..b1665fb
--- /dev/null
+++ b/app/src/main/res/drawable/ic_vector_icon_loading.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_vector_stopped_icon.xml b/app/src/main/res/drawable/ic_vector_stopped_icon.xml
index 130730a..64131b0 100644
--- a/app/src/main/res/drawable/ic_vector_stopped_icon.xml
+++ b/app/src/main/res/drawable/ic_vector_stopped_icon.xml
@@ -1,16 +1,35 @@
-
-
-
+ android:height="328.9dp" android:viewportHeight="328.9"
+ android:viewportWidth="321.8" android:width="321.8dp" xmlns:android="http://schemas.android.com/apk/res/android">
+
+
+
+
+
+
+
+
diff --git a/asset-src/ic_vector_icon.svg b/asset-src/ic_vector_icon.svg
index aa13b0a..1b1d9bd 100644
--- a/asset-src/ic_vector_icon.svg
+++ b/asset-src/ic_vector_icon.svg
@@ -9,9 +9,9 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2693"
- width="322"
- height="328.6"
- viewBox="0 0 322 328.6"
+ width="321.8"
+ height="328.9"
+ viewBox="0 0 321.8 328.9"
sodipodi:docname="ic_vector_icon.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)">
+ transform="translate(-14.56,-8.523)">
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 174.8,42.35 27.3,-12.96 c 0,0 -10.7,-20.629 -26.8,-20.865 C 159.1,8.29 147.4,29.39 147.4,29.39 Z"
+ id="path2082" />
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 202.1,29.39 174.8,42.35 266.9,253.4 124,156.4 86.49,167.1 336.4,337.4 Z"
+ id="path2074" />
+
+
+
+
+
diff --git a/asset-src/ic_vector_icon_as_paths.svg b/asset-src/ic_vector_icon_as_paths.svg
new file mode 100644
index 0000000..a83ffa5
--- /dev/null
+++ b/asset-src/ic_vector_icon_as_paths.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/asset-src/ic_vector_icon_loading.svg b/asset-src/ic_vector_icon_loading.svg
new file mode 100644
index 0000000..4603c87
--- /dev/null
+++ b/asset-src/ic_vector_icon_loading.svg
@@ -0,0 +1,115 @@
+
+
diff --git a/asset-src/ic_vector_stopped_icon.svg b/asset-src/ic_vector_stopped_icon.svg
index b5637a2..a7e3b39 100644
--- a/asset-src/ic_vector_stopped_icon.svg
+++ b/asset-src/ic_vector_stopped_icon.svg
@@ -7,13 +7,13 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
- sodipodi:docname="ic_vector_stopped_icon.svg"
- viewBox="0 0 322 328.6"
- height="328.6"
- width="322"
+ version="1.1"
id="svg2693"
- version="1.1">
+ width="321.8"
+ height="328.9"
+ viewBox="0 0 321.8 328.9"
+ sodipodi:docname="ic_vector_stopped_icon.svg"
+ inkscape:version="1.0 (4035a4fb49, 2020-05-01)">
@@ -29,52 +29,73 @@
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1364"
+ inkscape:window-height="746"
+ id="namedview2695"
+ showgrid="false"
+ inkscape:zoom="1.322"
+ inkscape:cx="162.3"
+ inkscape:cy="166.8"
+ inkscape:window-x="0"
+ inkscape:window-y="20"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g2701"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ id="g2701"
+ transform="translate(-14.56,-8.523)">
+ transform="translate(14.56,8.523)"
+ d="M 132.8 20.87 L 98.26 99.06 L 127.2 108 L 160.2 33.83 L 202.8 131.3 L 240.8 143 L 187.5 20.87 L 132.8 20.87 z M 238.5 213.2 L 252.3 244.9 L 321.8 328.9 L 276.5 224.9 L 238.5 213.2 z "
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2072" />
+ transform="translate(14.56,8.523)"
+ d="M 132.8 20.87 L 98.26 99.06 L 127.2 108 L 160.2 33.83 L 219 136.3 L 240.9 143.1 L 187.5 20.87 L 132.8 20.87 z M 80.45 164.4 L 321.8 328.9 L 252.3 244.9 L 178.2 194.5 L 80.45 164.4 z M 268.4 222.4 L 297.9 273.9 L 276.6 224.9 L 268.4 222.4 z "
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2048" />
+ transform="rotate(17.15)"
+ style="fill:#000000;fill-opacity:1;stroke-width:0;stroke-linecap:square;paint-order:fill markers stroke"
+ id="rect3049-0"
+ width="266.5"
+ height="29.25"
+ x="91.38"
+ y="88.73" />
+
+
+
+
+