mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 01:55:50 +01:00
Fossil Hybrid HR: Show app versions
This commit is contained in:
parent
6625437a5f
commit
951772626c
@ -122,11 +122,12 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||
for (int i = 0; i < appCount; i++) {
|
||||
String appName = intent.getStringExtra("app_name" + i);
|
||||
String appCreator = intent.getStringExtra("app_creator" + i);
|
||||
String appVersion = intent.getStringExtra("app_version" + i);
|
||||
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid" + i));
|
||||
GBDeviceApp.Type appType = GBDeviceApp.Type.values()[intent.getIntExtra("app_type" + i, 0)];
|
||||
Bitmap previewImage = getAppPreviewImage(uuid.toString());
|
||||
|
||||
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, "", appType, previewImage);
|
||||
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, appVersion, appType, previewImage);
|
||||
app.setOnDevice(true);
|
||||
if (filterApp(app)) {
|
||||
appList.add(app);
|
||||
|
@ -47,7 +47,7 @@ public class FossilAppWriter {
|
||||
this.mContext = context;
|
||||
if (this.mContext == null) throw new AssertionError("context cannot be null");
|
||||
this.version = version;
|
||||
if (!this.version.matches("^[0-9]\\.[0-9]\\.[0-9]\\.[0-9]$")) throw new AssertionError("Version must be in x.x.x.x format");
|
||||
if (!this.version.matches("^[0-9]\\.[0-9]$")) throw new AssertionError("Version must be in x.x format");
|
||||
this.code = code;
|
||||
if (this.code.size() == 0) throw new AssertionError("At least one code file InputStream must be supplied");
|
||||
this.icons = icons;
|
||||
@ -75,10 +75,12 @@ public class FossilAppWriter {
|
||||
int offsetFileEnd = offsetConfig + configData.length;
|
||||
|
||||
ByteArrayOutputStream filePart = new ByteArrayOutputStream();
|
||||
filePart.write(0x1); // 1 = watchface, 2 = app
|
||||
String[] versionParts = this.version.split("\\.");
|
||||
for (String versionPart : versionParts) {
|
||||
filePart.write(Integer.valueOf(versionPart).byteValue());
|
||||
}
|
||||
filePart.write(0x0);
|
||||
filePart.write(intToLEBytes(0));
|
||||
filePart.write(intToLEBytes(0));
|
||||
filePart.write(intToLEBytes(offsetCode));
|
||||
|
@ -135,7 +135,9 @@ public class FossilFileReader {
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
buf.position(8); // skip file handle and version
|
||||
int fileSize = buf.getInt();
|
||||
foundVersion = (int)buf.get() + "." + (int)buf.get() + "." + (int)buf.get() + "." + (int)buf.get();
|
||||
buf.get(); // 1 = watchface, 2 = app
|
||||
foundVersion = (int)buf.get() + "." + (int)buf.get();
|
||||
buf.get(); // unknown
|
||||
mAppKeys.put("version", foundVersion);
|
||||
buf.position(buf.position() + 8); // skip null bytes
|
||||
jerryStart = buf.getInt();
|
||||
|
@ -211,7 +211,7 @@ public class HybridHRWatchfaceFactory {
|
||||
} catch (JSONException e) {
|
||||
LOG.warn("Could not generate configuration", e);
|
||||
}
|
||||
FossilAppWriter appWriter = new FossilAppWriter(context, "1.2.0.0", code, icons, layout, displayName, config);
|
||||
FossilAppWriter appWriter = new FossilAppWriter(context, "1.0", code, icons, layout, displayName, config);
|
||||
return appWriter.getWapp();
|
||||
}
|
||||
|
||||
|
@ -334,6 +334,7 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
||||
for (int i = 0; i < appCount; i++) {
|
||||
appInfoIntent.putExtra("app_name" + i, appInfoEvent.apps[i].getName());
|
||||
appInfoIntent.putExtra("app_creator" + i, appInfoEvent.apps[i].getCreator());
|
||||
appInfoIntent.putExtra("app_version" + i, appInfoEvent.apps[i].getVersion());
|
||||
appInfoIntent.putExtra("app_uuid" + i, appInfoEvent.apps[i].getUUID().toString());
|
||||
appInfoIntent.putExtra("app_type" + i, appInfoEvent.apps[i].getType().ordinal());
|
||||
}
|
||||
|
@ -38,10 +38,11 @@ public class ApplicationsListRequest extends FileLookupAndGetRequest{
|
||||
buffer.get(); // null byte
|
||||
byte handle = buffer.get();
|
||||
int hash = buffer.getInt();
|
||||
String version = String.format(
|
||||
"%d.%d.%d.%d",
|
||||
buffer.get(), buffer.get(), buffer.get(), buffer.get()
|
||||
);
|
||||
buffer.get(); // unknown
|
||||
int version_minor = buffer.get();
|
||||
int version_major = buffer.get();
|
||||
buffer.get(); // unknown
|
||||
String version = String.format("%d.%d", version_major, version_minor);
|
||||
applicationInfos.add(new ApplicationInformation(
|
||||
name,
|
||||
version,
|
||||
|
Loading…
Reference in New Issue
Block a user