mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Fossil Hybrid HR: Show in appmanager which watchfaces are outdated
This commit is contained in:
@@ -55,6 +55,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.activities.ExternalPebbleJSActivity;
|
import nodomain.freeyourgadget.gadgetbridge.activities.ExternalPebbleJSActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAppAdapter;
|
import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAppAdapter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.QHybridConstants;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
@@ -129,6 +130,9 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
|||||||
|
|
||||||
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, appVersion, appType, previewImage);
|
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, appVersion, appType, previewImage);
|
||||||
app.setOnDevice(true);
|
app.setOnDevice(true);
|
||||||
|
if ((mGBDevice.getType() == DeviceType.FOSSILQHYBRID) && (app.getType() == GBDeviceApp.Type.WATCHFACE) && (!QHybridConstants.HYBRIDHR_WATCHFACE_VERSION.equals(appVersion))) {
|
||||||
|
app.setUpToDate(false);
|
||||||
|
}
|
||||||
if (filterApp(app)) {
|
if (filterApp(app)) {
|
||||||
appList.add(app);
|
appList.add(app);
|
||||||
}
|
}
|
||||||
@@ -201,7 +205,11 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
|||||||
try {
|
try {
|
||||||
String jsonstring = FileUtils.getStringFromFile(jsonFile);
|
String jsonstring = FileUtils.getStringFromFile(jsonFile);
|
||||||
JSONObject json = new JSONObject(jsonstring);
|
JSONObject json = new JSONObject(jsonstring);
|
||||||
cachedAppList.add(new GBDeviceApp(json, configFile.exists(), getAppPreviewImage(baseName)));
|
GBDeviceApp app = new GBDeviceApp(json, configFile.exists(), getAppPreviewImage(baseName));
|
||||||
|
if ((mGBDevice.getType() == DeviceType.FOSSILQHYBRID) && (app.getType() == GBDeviceApp.Type.WATCHFACE) && (!QHybridConstants.HYBRIDHR_WATCHFACE_VERSION.equals(app.getVersion()))) {
|
||||||
|
app.setUpToDate(false);
|
||||||
|
}
|
||||||
|
cachedAppList.add(app);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.info("could not read json file for " + baseName);
|
LOG.info("could not read json file for " + baseName);
|
||||||
if (mGBDevice.getType() == DeviceType.PEBBLE) {
|
if (mGBDevice.getType() == DeviceType.PEBBLE) {
|
||||||
|
@@ -87,6 +87,11 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
|||||||
appVersionAuthor = GBApplication.getContext().getString(R.string.appversion_by_creator, deviceApp.getVersion(), deviceApp.getCreator());
|
appVersionAuthor = GBApplication.getContext().getString(R.string.appversion_by_creator, deviceApp.getVersion(), deviceApp.getCreator());
|
||||||
}
|
}
|
||||||
holder.mDeviceAppVersionAuthorLabel.setText(appVersionAuthor);
|
holder.mDeviceAppVersionAuthorLabel.setText(appVersionAuthor);
|
||||||
|
if (deviceApp.isUpToDate()) {
|
||||||
|
holder.mDeviceAppOutdated.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
holder.mDeviceAppOutdated.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
// FIXME: replace with small icons
|
// FIXME: replace with small icons
|
||||||
String appNameLabelText = deviceApp.getName();
|
String appNameLabelText = deviceApp.getName();
|
||||||
holder.mDeviceAppNameLabel.setText(appNameLabelText);
|
holder.mDeviceAppNameLabel.setText(appNameLabelText);
|
||||||
@@ -148,6 +153,7 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
|||||||
public class AppViewHolder extends RecyclerView.ViewHolder {
|
public class AppViewHolder extends RecyclerView.ViewHolder {
|
||||||
final TextView mDeviceAppVersionAuthorLabel;
|
final TextView mDeviceAppVersionAuthorLabel;
|
||||||
final TextView mDeviceAppNameLabel;
|
final TextView mDeviceAppNameLabel;
|
||||||
|
final TextView mDeviceAppOutdated;
|
||||||
final ImageView mDeviceImageView;
|
final ImageView mDeviceImageView;
|
||||||
final ImageView mDragHandle;
|
final ImageView mDragHandle;
|
||||||
final ImageView mPreviewImage;
|
final ImageView mPreviewImage;
|
||||||
@@ -156,6 +162,7 @@ public class GBDeviceAppAdapter extends RecyclerView.Adapter<GBDeviceAppAdapter.
|
|||||||
super(itemView);
|
super(itemView);
|
||||||
mDeviceAppVersionAuthorLabel = (TextView) itemView.findViewById(R.id.item_details);
|
mDeviceAppVersionAuthorLabel = (TextView) itemView.findViewById(R.id.item_details);
|
||||||
mDeviceAppNameLabel = (TextView) itemView.findViewById(R.id.item_name);
|
mDeviceAppNameLabel = (TextView) itemView.findViewById(R.id.item_name);
|
||||||
|
mDeviceAppOutdated = (TextView) itemView.findViewById(R.id.item_watchapp_outdated);
|
||||||
mDeviceImageView = (ImageView) itemView.findViewById(R.id.item_image);
|
mDeviceImageView = (ImageView) itemView.findViewById(R.id.item_image);
|
||||||
mDragHandle = (ImageView) itemView.findViewById(R.id.drag_handle);
|
mDragHandle = (ImageView) itemView.findViewById(R.id.drag_handle);
|
||||||
mPreviewImage = (ImageView) itemView.findViewById(R.id.item_preview_image);
|
mPreviewImage = (ImageView) itemView.findViewById(R.id.item_preview_image);
|
||||||
|
@@ -213,7 +213,7 @@ public class HybridHRWatchfaceFactory {
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
LOG.warn("Could not generate configuration", e);
|
LOG.warn("Could not generate configuration", e);
|
||||||
}
|
}
|
||||||
FossilAppWriter appWriter = new FossilAppWriter(context, "1.0", code, icons, layout, displayName, config);
|
FossilAppWriter appWriter = new FossilAppWriter(context, QHybridConstants.HYBRIDHR_WATCHFACE_VERSION, code, icons, layout, displayName, config);
|
||||||
return appWriter.getWapp();
|
return appWriter.getWapp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
/* Copyright (C) 2022 Arjan Schrijver
|
||||||
|
|
||||||
|
This file is part of Gadgetbridge.
|
||||||
|
|
||||||
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Gadgetbridge is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
|
||||||
|
|
||||||
|
public final class QHybridConstants {
|
||||||
|
public static final String HYBRIDHR_WATCHFACE_VERSION = "1.1";
|
||||||
|
}
|
@@ -34,6 +34,7 @@ public class GBDeviceApp {
|
|||||||
private boolean isOnDevice;
|
private boolean isOnDevice;
|
||||||
private final boolean configurable;
|
private final boolean configurable;
|
||||||
private final Bitmap previewImage;
|
private final Bitmap previewImage;
|
||||||
|
private boolean isUpToDate = true;
|
||||||
|
|
||||||
public GBDeviceApp(UUID uuid, String name, String creator, String version, Type type, Bitmap previewImage) {
|
public GBDeviceApp(UUID uuid, String name, String creator, String version, Type type, Bitmap previewImage) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
@@ -151,4 +152,12 @@ public class GBDeviceApp {
|
|||||||
public boolean isConfigurable() {
|
public boolean isConfigurable() {
|
||||||
return configurable;
|
return configurable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUpToDate(boolean isUpToDate) {
|
||||||
|
this.isUpToDate = isUpToDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUpToDate() {
|
||||||
|
return isUpToDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,12 +61,26 @@
|
|||||||
android:text="Item Name"
|
android:text="Item Name"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/item_details"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Item Description"
|
android:orientation="horizontal">
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
<TextView
|
||||||
|
android:id="@+id/item_details"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Item Description"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_watchapp_outdated"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:text="@string/appmanager_item_outdated"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textColor="@android:color/holo_red_dark" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -96,6 +96,7 @@
|
|||||||
<string name="appmanager_weather_install_provider">Install the Weather Notification app</string>
|
<string name="appmanager_weather_install_provider">Install the Weather Notification app</string>
|
||||||
<string name="app_configure">Configure</string>
|
<string name="app_configure">Configure</string>
|
||||||
<string name="app_move_to_top">Move to top</string>
|
<string name="app_move_to_top">Move to top</string>
|
||||||
|
<string name="appmanager_item_outdated">(outdated)</string>
|
||||||
<!-- Strings related to AppBlacklist -->
|
<!-- Strings related to AppBlacklist -->
|
||||||
<string name="title_activity_notification_management">Notification settings</string>
|
<string name="title_activity_notification_management">Notification settings</string>
|
||||||
<string name="blacklist_all_for_notifications">Blacklist all for notifications</string>
|
<string name="blacklist_all_for_notifications">Blacklist all for notifications</string>
|
||||||
|
Reference in New Issue
Block a user