mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
Fossil Hybrid HR: Add choice between hiding text and showing circle on custom widget timeout
This commit is contained in:
parent
d1062a30b2
commit
88218a1273
Binary file not shown.
15
app/src/main/assets/fossil_hr/widget_bg_error.rle
Normal file
15
app/src/main/assets/fossil_hr/widget_bg_error.rle
Normal file
@ -0,0 +1,15 @@
|
||||
LLi
|
||||
6
0 , ( $ $
!
|
||||
|
||||
"
&
%
#
|
||||
!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!
#
|
||||
%
&
"
|
||||
|
||||
!
$ $ ( , 0
6
|
||||
i˙˙
|
@ -44,6 +44,7 @@ import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
@ -353,6 +354,8 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem
|
||||
String widgetName = layoutItem.getString("name");
|
||||
String widgetTimezone = null;
|
||||
int widgetUpdateTimeout = -1;
|
||||
boolean widgetTimeoutHideText = true;
|
||||
boolean widgetTimeoutShowCircle = true;
|
||||
switch (widgetName) {
|
||||
case "dateSSE":
|
||||
widgetName = "widgetDate";
|
||||
@ -400,11 +403,15 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem
|
||||
widgetName = "widgetCustom";
|
||||
JSONObject widgetData = layoutItem.getJSONObject("data");
|
||||
widgetUpdateTimeout = widgetData.getInt("update_timeout");
|
||||
widgetTimeoutHideText = widgetData.getBoolean("timeout_hide_text");
|
||||
widgetTimeoutShowCircle = widgetData.getBoolean("timeout_show_circle");
|
||||
widgets.add(new HybridHRWatchfaceWidget(widgetName,
|
||||
layoutItem.getJSONObject("pos").getInt("x"),
|
||||
layoutItem.getJSONObject("pos").getInt("y"),
|
||||
widgetColor,
|
||||
widgetUpdateTimeout));
|
||||
widgetUpdateTimeout,
|
||||
widgetTimeoutHideText,
|
||||
widgetTimeoutShowCircle));
|
||||
} else {
|
||||
widgets.add(new HybridHRWatchfaceWidget(widgetName,
|
||||
layoutItem.getJSONObject("pos").getInt("x"),
|
||||
@ -615,6 +622,14 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem
|
||||
if ((widget != null) && (widget.getUpdateTimeout() >= 0)) {
|
||||
updateTimeout.setText(Integer.toString(widget.getUpdateTimeout()));
|
||||
}
|
||||
final CheckBox timeoutHideText = layout.findViewById(R.id.watchface_widget_timeout_hide_text);
|
||||
if ((widget != null) && (widget.getTimeoutHideText())) {
|
||||
timeoutHideText.setChecked(widget.getTimeoutHideText());
|
||||
}
|
||||
final CheckBox timeoutShowCircle = layout.findViewById(R.id.watchface_widget_timeout_show_circle);
|
||||
if ((widget != null) && (widget.getTimeoutShowCircle())) {
|
||||
timeoutShowCircle.setChecked(widget.getTimeoutShowCircle());
|
||||
}
|
||||
// Show certain input fields only when the relevant TZ widget is selected
|
||||
typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
@ -673,11 +688,13 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem
|
||||
LOG.warn("Error parsing input", e);
|
||||
return;
|
||||
}
|
||||
boolean selectedTimeoutHideText = timeoutHideText.isChecked();
|
||||
boolean selectedTimeoutShowCircle = timeoutShowCircle.isChecked();
|
||||
HybridHRWatchfaceWidget widgetConfig;
|
||||
if (selectedType.equals("widget2ndTZ")) {
|
||||
widgetConfig = new HybridHRWatchfaceWidget(selectedType, selectedPosX, selectedPosY, colorSpinner.getSelectedItemPosition(), selectedTZ);
|
||||
} else if (selectedType.equals("widgetCustom")) {
|
||||
widgetConfig = new HybridHRWatchfaceWidget(selectedType, selectedPosX, selectedPosY, colorSpinner.getSelectedItemPosition(), selectedUpdateTimeout);
|
||||
widgetConfig = new HybridHRWatchfaceWidget(selectedType, selectedPosX, selectedPosY, colorSpinner.getSelectedItemPosition(), selectedUpdateTimeout, selectedTimeoutHideText, selectedTimeoutShowCircle);
|
||||
} else {
|
||||
widgetConfig = new HybridHRWatchfaceWidget(selectedType, selectedPosX, selectedPosY, colorSpinner.getSelectedItemPosition());
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ public class HybridHRWatchfaceFactory {
|
||||
if (widgetDesc.getUpdateTimeout() >= 0) {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("update_timeout", widgetDesc.getUpdateTimeout());
|
||||
data.put("timeout_hide_text", widgetDesc.getTimeoutHideText());
|
||||
data.put("timeout_show_circle", widgetDesc.getTimeoutShowCircle());
|
||||
widget.put("data", data);
|
||||
}
|
||||
break;
|
||||
@ -179,6 +181,7 @@ public class HybridHRWatchfaceFactory {
|
||||
if (includeWidget("widgetCalories") > 0) icons.put("icCalories", context.getAssets().open("fossil_hr/icCalories.rle"));
|
||||
if (includeWidget("widgetActiveMins") > 0) icons.put("icActiveMins", context.getAssets().open("fossil_hr/icActiveMins.rle"));
|
||||
if (includeWidget("widgetChanceOfRain") > 0) icons.put("icRainChance", context.getAssets().open("fossil_hr/icRainChance.rle"));
|
||||
if (includeWidget("widgetCustom") > 0) icons.put("widget_bg_error.rle", context.getAssets().open("fossil_hr/widget_bg_error.rle"));
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Unable to read asset file", e);
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ public class HybridHRWatchfaceWidget {
|
||||
private int color = 0;
|
||||
private String timezone;
|
||||
private int updateTimeout = -1;
|
||||
private boolean timeoutHideText = true;
|
||||
private boolean timeoutShowCircle = true;
|
||||
|
||||
public static int COLOR_WHITE = 0;
|
||||
public static int COLOR_BLACK = 1;
|
||||
@ -48,9 +50,11 @@ public class HybridHRWatchfaceWidget {
|
||||
this(widgetType, posX, posY, color);
|
||||
this.timezone = timezone;
|
||||
}
|
||||
public HybridHRWatchfaceWidget(String widgetType, int posX, int posY, int color, int updateTimeout) {
|
||||
public HybridHRWatchfaceWidget(String widgetType, int posX, int posY, int color, int updateTimeout, boolean timeoutHideText, boolean timeoutShowCircle) {
|
||||
this(widgetType, posX, posY, color);
|
||||
this.updateTimeout = updateTimeout;
|
||||
this.timeoutHideText = timeoutHideText;
|
||||
this.timeoutShowCircle = timeoutShowCircle;
|
||||
}
|
||||
|
||||
|
||||
@ -106,4 +110,10 @@ public class HybridHRWatchfaceWidget {
|
||||
public int getUpdateTimeout() {
|
||||
return updateTimeout;
|
||||
}
|
||||
public boolean getTimeoutHideText() {
|
||||
return timeoutHideText;
|
||||
}
|
||||
public boolean getTimeoutShowCircle() {
|
||||
return timeoutShowCircle;
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,22 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/watchface_dialog_widget_timeout_hide_text" />
|
||||
<CheckBox
|
||||
android:id="@+id/watchface_widget_timeout_hide_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/watchface_dialog_widget_timeout_show_circle" />
|
||||
<CheckBox
|
||||
android:id="@+id/watchface_widget_timeout_show_circle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1390,5 +1390,7 @@
|
||||
<string name="watchface_widget_type_custom">Custom widget</string>
|
||||
<string name="watchface_dialog_widget_timezone">Time zone:</string>
|
||||
<string name="watchface_dialog_widget_update_timeout">Update timeout in minutes:</string>
|
||||
<string name="watchface_dialog_widget_timeout_hide_text">Hide text on timeout:</string>
|
||||
<string name="watchface_dialog_widget_timeout_show_circle">Show circle on timeout:</string>
|
||||
|
||||
</resources>
|
||||
|
2
external/fossil-hr-watchface
vendored
2
external/fossil-hr-watchface
vendored
@ -1 +1 @@
|
||||
Subproject commit 8855d1735b07939f483759cb7e836a8418f30515
|
||||
Subproject commit 44a70cf7c3a783d07d0fdab8b4b15e677da63af2
|
Loading…
Reference in New Issue
Block a user