diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java index da8d0052b..9dfe2c0e4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.BitmapDrawable; @@ -51,7 +50,6 @@ import org.xml.sax.InputSource; import java.io.BufferedWriter; import java.io.File; -import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.StringReader; @@ -64,7 +62,6 @@ import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.SimpleTimeZone; @@ -77,8 +74,6 @@ import io.wax911.emojify.EmojiUtils; import de.greenrobot.dao.query.QueryBuilder; import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.R; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; import nodomain.freeyourgadget.gadgetbridge.database.DBHelper; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; @@ -94,7 +89,6 @@ import nodomain.freeyourgadget.gadgetbridge.entities.CalendarSyncState; import nodomain.freeyourgadget.gadgetbridge.entities.CalendarSyncStateDao; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; @@ -644,9 +638,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { // clone the data from super.getHeaders() so we can write to it Map h = new HashMap<>(super.getHeaders()); if (headers != null) { - Iterator iter = headers.keySet().iterator(); - while (iter.hasNext()) { - String key = iter.next(); + for (String key : headers.keySet()) { String value = headers.get(key); h.put(key, value); } @@ -847,7 +839,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { if (EmojiUtils.getAllEmojis()==null) EmojiManager.initEmojiData(GBApplication.getContext()); for(Emoji emoji : EmojiUtils.getAllEmojis()) - if (word.contains(emoji.getEmoji())) hasEmoji = true; + if (word.contains(emoji.getEmoji())) { + hasEmoji = true; + break; + } // if we had emoji, ensure we create 3 bit color (not 1 bit B&W) return "\0"+bitmapToEspruinoString(textToBitmap(word), hasEmoji ? BangleJSBitmapStyle.RGB_3BPP_TRANSPARENT : BangleJSBitmapStyle.MONOCHROME_TRANSPARENT); } @@ -895,7 +890,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { for (int i=0;i> 3) + headerLen]; + byte[] bmp = new byte[(((height * width * bpp) + 7) >> 3) + headerLen]; bmp[0] = (byte)width; bmp[1] = (byte)height; bmp[2] = (byte)(bpp + (isTransparent?128:0));