mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Add UI to invoke device specific settings Activity
Currently the icon in the card is hidden for all devices, since the functionality is not implemented yet
This commit is contained in:
parent
f92626f4a5
commit
7c918ee191
@ -150,6 +150,9 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
holder.batteryIcon.setImageLevel(200);
|
||||
}
|
||||
|
||||
//device specific settings
|
||||
holder.deviceSpecificSettingsView.setVisibility(coordinator.supportsDeviceSpecificSettings(device) ? View.VISIBLE : View.GONE);
|
||||
|
||||
//fetch activity data
|
||||
holder.fetchActivityDataBox.setVisibility((device.isInitialized() && coordinator.supportsActivityDataFetching()) ? View.VISIBLE : View.GONE);
|
||||
holder.fetchActivityData.setOnClickListener(new View.OnClickListener()
|
||||
@ -472,6 +475,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
LinearLayout batteryStatusBox;
|
||||
TextView batteryStatusLabel;
|
||||
ImageView batteryIcon;
|
||||
ImageView deviceSpecificSettingsView;
|
||||
LinearLayout fetchActivityDataBox;
|
||||
ImageView fetchActivityData;
|
||||
ProgressBar busyIndicator;
|
||||
@ -504,6 +508,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
batteryStatusBox = view.findViewById(R.id.device_battery_status_box);
|
||||
batteryStatusLabel = view.findViewById(R.id.battery_status);
|
||||
batteryIcon = view.findViewById(R.id.device_battery_status);
|
||||
deviceSpecificSettingsView = view.findViewById(R.id.device_specific_settings);
|
||||
fetchActivityDataBox = view.findViewById(R.id.device_action_fetch_activity_box);
|
||||
fetchActivityData = view.findViewById(R.id.device_action_fetch_activity);
|
||||
busyIndicator = view.findViewById(R.id.device_busy_indicator);
|
||||
|
@ -152,4 +152,9 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
||||
|
||||
@Override
|
||||
public boolean supportsUnicodeEmojis() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean supportsDeviceSpecificSettings(GBDevice device) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -278,4 +278,9 @@ public interface DeviceCoordinator {
|
||||
* Indicates whether the device supports unicode emojis.
|
||||
*/
|
||||
boolean supportsUnicodeEmojis();
|
||||
|
||||
/**
|
||||
* Indicates whether the device supports device specific settings (not per device type or family, but unique per device).
|
||||
*/
|
||||
boolean supportsDeviceSpecificSettings(GBDevice device);
|
||||
}
|
||||
|
@ -139,12 +139,31 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/device_specific_settings"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/device_image"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_toEndOf="@id/device_battery_status_box"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="4dp"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="@color/secondarytext"
|
||||
card_view:srcCompat="@drawable/ic_settings" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/device_fm_frequency_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/device_image"
|
||||
android:layout_toEndOf="@id/device_battery_status_box"
|
||||
android:layout_toEndOf="@id/device_specific_settings"
|
||||
android:layout_margin="4dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -178,7 +197,6 @@
|
||||
android:layout_toEndOf="@id/device_fm_frequency_box"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/controlcenter_take_screenshot"
|
||||
android:padding="4dp"
|
||||
android:scaleType="fitXY"
|
||||
card_view:srcCompat="@drawable/ic_led_color"
|
||||
|
Loading…
Reference in New Issue
Block a user