mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Fossil HR: removed per-widget circle settings
This commit is contained in:
parent
b2a6b4b03b
commit
e0c09f259f
@ -1,5 +1,6 @@
|
|||||||
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
|
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -188,7 +189,6 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
|
|||||||
JSONObject widgetObject = new JSONObject();
|
JSONObject widgetObject = new JSONObject();
|
||||||
widgetObject
|
widgetObject
|
||||||
.put("name", widget.getName())
|
.put("name", widget.getName())
|
||||||
.put("drawCircle", widget.getDrawCircle())
|
|
||||||
.put("elements", elementArray);
|
.put("elements", elementArray);
|
||||||
|
|
||||||
widgetArray.put(widgetObject);
|
widgetArray.put(widgetObject);
|
||||||
@ -209,7 +209,7 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
|
|||||||
for (int i = 0; i < customWidgets.length(); i++) {
|
for (int i = 0; i < customWidgets.length(); i++) {
|
||||||
JSONObject customWidgetObject = customWidgets.getJSONObject(i);
|
JSONObject customWidgetObject = customWidgets.getJSONObject(i);
|
||||||
CustomWidget widget = new CustomWidget(
|
CustomWidget widget = new CustomWidget(
|
||||||
customWidgetObject.getString("name"), 0, 0, "default", false // FIXME: handle force white background
|
customWidgetObject.getString("name"), 0, 0, "default" // FIXME: handle force white background
|
||||||
);
|
);
|
||||||
JSONArray elements = customWidgetObject.getJSONArray("elements");
|
JSONArray elements = customWidgetObject.getJSONArray("elements");
|
||||||
|
|
||||||
@ -475,6 +475,7 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
|
|||||||
super(HRConfigActivity.this, 0, objects);
|
super(HRConfigActivity.this, 0, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ResourceType")
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||||
|
@ -50,10 +50,9 @@ public class WidgetSettingsActivity extends AbstractGBActivity {
|
|||||||
if(getIntent().hasExtra("EXTRA_WIDGET")){
|
if(getIntent().hasExtra("EXTRA_WIDGET")){
|
||||||
subject = (CustomWidget) getIntent().getExtras().get("EXTRA_WIDGET");
|
subject = (CustomWidget) getIntent().getExtras().get("EXTRA_WIDGET");
|
||||||
((EditText) findViewById(R.id.qhybrid_widget_name)).setText(subject.getName());
|
((EditText) findViewById(R.id.qhybrid_widget_name)).setText(subject.getName());
|
||||||
((CheckBox)findViewById(R.id.qhybrid_widget_circle)).setChecked(subject.getDrawCircle());
|
|
||||||
resultCode = RESULT_CODE_WIDGET_UPDATED;
|
resultCode = RESULT_CODE_WIDGET_UPDATED;
|
||||||
}else{
|
}else{
|
||||||
subject = new CustomWidget("", 0, 63, "default", false); // FIXME: handle force white background
|
subject = new CustomWidget("", 0, 63, "default"); // FIXME: handle force white background
|
||||||
resultCode = RESULT_CODE_WIDGET_CREATED;
|
resultCode = RESULT_CODE_WIDGET_CREATED;
|
||||||
findViewById(R.id.qhybrid_widget_delete).setEnabled(false);
|
findViewById(R.id.qhybrid_widget_delete).setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -96,13 +95,6 @@ public class WidgetSettingsActivity extends AbstractGBActivity {
|
|||||||
showElementDialog(null);
|
showElementDialog(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
((CheckBox)findViewById(R.id.qhybrid_widget_circle)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
|
||||||
subject.setDrawCircle(b);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showElementDialog(@Nullable final CustomWidgetElement element){
|
private void showElementDialog(@Nullable final CustomWidgetElement element){
|
||||||
|
@ -199,8 +199,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
customWidget.getString("name"),
|
customWidget.getString("name"),
|
||||||
positionMap.get(position),
|
positionMap.get(position),
|
||||||
63,
|
63,
|
||||||
fontColor,
|
fontColor
|
||||||
drawCircle
|
|
||||||
);
|
);
|
||||||
JSONArray elements = customWidget.getJSONArray("elements");
|
JSONArray elements = customWidget.getJSONArray("elements");
|
||||||
|
|
||||||
@ -266,7 +265,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
boolean backgroundDrawn = false;
|
boolean backgroundDrawn = false;
|
||||||
|
|
||||||
if(widget.getDrawCircle() && !backgroundDrawn){
|
if(!backgroundDrawn){
|
||||||
Paint circlePaint = new Paint();
|
Paint circlePaint = new Paint();
|
||||||
circlePaint.setColor(forceWhiteBackground ? Color.WHITE : Color.BLACK);
|
circlePaint.setColor(forceWhiteBackground ? Color.WHITE : Color.BLACK);
|
||||||
circlePaint.setStyle(Paint.Style.FILL);
|
circlePaint.setStyle(Paint.Style.FILL);
|
||||||
|
@ -9,22 +9,12 @@ public class CustomWidget extends Widget {
|
|||||||
private ArrayList<CustomWidgetElement> elements = new ArrayList<>();
|
private ArrayList<CustomWidgetElement> elements = new ArrayList<>();
|
||||||
private int angle, distance;
|
private int angle, distance;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean drawCircle;
|
|
||||||
|
|
||||||
public CustomWidget(String name, int angle, int distance, String fontColor, boolean drawCircle) {
|
public CustomWidget(String name, int angle, int distance, String fontColor) {
|
||||||
super(null, angle, distance, fontColor);
|
super(null, angle, distance, fontColor);
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.drawCircle = drawCircle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getDrawCircle(){
|
|
||||||
return this.drawCircle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDrawCircle(boolean drawCircle){
|
|
||||||
this.drawCircle = drawCircle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAngle() {
|
public int getAngle() {
|
||||||
|
@ -43,12 +43,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="add element" />
|
android:text="add element" />
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="draw circle"
|
|
||||||
android:id="@+id/qhybrid_widget_circle" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
Loading…
Reference in New Issue
Block a user