diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java index cae7f5429..da396868c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java @@ -35,6 +35,8 @@ import android.os.Handler; import android.provider.MediaStore; import android.text.InputType; import android.util.DisplayMetrics; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.ImageView; @@ -44,6 +46,9 @@ import android.widget.RadioGroup; import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.annotation.NonNull; + +import org.jetbrains.annotations.NotNull; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -107,8 +112,6 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem findViewById(R.id.button_set_background).setOnClickListener(this); findViewById(R.id.button_add_widget).setOnClickListener(this); findViewById(R.id.button_watchface_settings).setOnClickListener(this); - findViewById(R.id.button_preview_watchface).setOnClickListener(this); - findViewById(R.id.button_save_watchface).setOnClickListener(this); } @Override @@ -130,6 +133,26 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem } } + // Add action bar buttons + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.activity_hybridhr_watchface_designer_actionbar, menu); + return super.onCreateOptionsMenu(menu); + } + + // Handle action bar button presses + @Override + public boolean onOptionsItemSelected(@NonNull @NotNull MenuItem item) { + int id = item.getItemId(); + if (id == R.id.button_save_watchface) { + sendToWatch(false); + finish(); + } else if (id == R.id.button_preview_watchface) { + sendToWatch(true); + } + return super.onOptionsItemSelected(item); + } + @Override public void onClick(View v) { if (v.getId() == R.id.button_edit_name) { @@ -158,10 +181,6 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem startActivityForResult(intent, 42); } else if (v.getId() == R.id.button_add_widget) { showWidgetEditPopup(-1); - } else if (v.getId() == R.id.button_preview_watchface) { - sendToWatch(true); - } else if (v.getId() == R.id.button_save_watchface) { - sendToWatch(false); } } diff --git a/app/src/main/res/drawable/ic_done.xml b/app/src/main/res/drawable/ic_done.xml new file mode 100644 index 000000000..899cbb684 --- /dev/null +++ b/app/src/main/res/drawable/ic_done.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_watch_bw.xml b/app/src/main/res/drawable/ic_watch_bw.xml new file mode 100644 index 000000000..e242792f1 --- /dev/null +++ b/app/src/main/res/drawable/ic_watch_bw.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml b/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml index a67a052da..b9016c536 100644 --- a/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml +++ b/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml @@ -63,17 +63,5 @@ android:enabled="false" android:text="Watchface settings" /> -