mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 12:05:37 +02:00
Fossil HR: added button to delete background
This commit is contained in:
parent
379fa746a3
commit
bbf60248c3
@ -125,6 +125,15 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
findViewById(R.id.qhybrid_unset_background).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(QHybridSupport.QHYBRID_COMMAND_SET_BACKGROUND_IMAGE);
|
||||||
|
intent.putIntegerArrayListExtra("EXTRA_PIXELS", null);
|
||||||
|
LocalBroadcastManager.getInstance(HRConfigActivity.this).sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for (int i = 0; i < widgetButtonsMapping.size(); i++) {
|
for (int i = 0; i < widgetButtonsMapping.size(); i++) {
|
||||||
final int widgetButtonId = widgetButtonsMapping.keyAt(i);
|
final int widgetButtonId = widgetButtonsMapping.keyAt(i);
|
||||||
findViewById(widgetButtonId).setOnClickListener(new View.OnClickListener() {
|
findViewById(widgetButtonId).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -187,6 +187,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBackgroundImage(byte[] pixels) {
|
public void setBackgroundImage(byte[] pixels) {
|
||||||
|
if(pixels == null){
|
||||||
|
getBackgroundFile().delete();
|
||||||
|
this.backGroundImage = null;
|
||||||
|
}else{
|
||||||
this.backGroundImage = AssetImageFactory.createAssetImage(pixels, 0, 0, 0);
|
this.backGroundImage = AssetImageFactory.createAssetImage(pixels, 0, 0, 0);
|
||||||
try {
|
try {
|
||||||
FileOutputStream fos = new FileOutputStream(getBackgroundFile(), false);
|
FileOutputStream fos = new FileOutputStream(getBackgroundFile(), false);
|
||||||
@ -195,6 +199,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
GB.log("error saving background", GB.ERROR, e);
|
GB.log("error saving background", GB.ERROR, e);
|
||||||
GB.toast("error persistent saving background", Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast("error persistent saving background", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
renderWidgets();
|
renderWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +96,26 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="add widget" />
|
android:text="add widget" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:weightSum="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/qhybrid_unset_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="delete background"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/qhybrid_set_background"
|
android:id="@+id/qhybrid_set_background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="set background" />
|
android:text="set background"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user