mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Intent extra handling : Use instanceof pattern matching
This commit is contained in:
committed by
José Rebelo
parent
602e4e15b2
commit
12605bd749
+8
-8
@@ -1057,14 +1057,14 @@ public class BangleJSDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
String key = iter.next();
|
||||
Object value = extra.get(key);
|
||||
|
||||
if (value instanceof Boolean) {
|
||||
in.putExtra(key, (Boolean) value);
|
||||
} else if (value instanceof Integer) {
|
||||
in.putExtra(key, (Integer) value);
|
||||
} else if (value instanceof Long) {
|
||||
in.putExtra(key, (Long) value);
|
||||
} else if (value instanceof Double) {
|
||||
in.putExtra(key, (Double) value);
|
||||
if (value instanceof Boolean boolExtra) {
|
||||
in.putExtra(key, boolExtra);
|
||||
} else if (value instanceof Integer integerExtra) {
|
||||
in.putExtra(key, integerExtra);
|
||||
} else if (value instanceof Long longExtra) {
|
||||
in.putExtra(key, longExtra);
|
||||
} else if (value instanceof Double doubleExtra) {
|
||||
in.putExtra(key, doubleExtra);
|
||||
} else {
|
||||
in.putExtra(key, value.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user