huawei: Watchface: Allow watchfaces without preview

This commit is contained in:
Vitaliy Tomin 2024-04-16 18:04:06 +08:00
parent 378ca31bc0
commit 57f5658739
1 changed files with 4 additions and 2 deletions

View File

@ -66,8 +66,10 @@ public class HuaweiFwHelper {
GBZipFile watchfacePackage = new GBZipFile(uriHelper.openInputStream());
String xmlDescription = new String(watchfacePackage.getFileFromZip("description.xml"));
watchfaceDescription = new HuaweiWatchfaceManager.WatchfaceDescription(xmlDescription);
final byte[] preview = watchfacePackage.getFileFromZip("preview/cover.jpg");
watchfacePreviewBitmap = BitmapFactory.decodeByteArray(preview, 0, preview.length);
if (watchfacePackage.fileExists("preview/cover.jpg")) {
final byte[] preview = watchfacePackage.getFileFromZip("preview/cover.jpg");
watchfacePreviewBitmap = BitmapFactory.decodeByteArray(preview, 0, preview.length);
}
fw = watchfacePackage.getFileFromZip("com.huawei.watchface");
fileSize = fw.length;