1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 11:05:49 +01:00

Fossil Hybrid HR: Restructure settings menus for calibration, file management and physical buttons

This commit is contained in:
Arjan Schrijver 2021-05-06 21:12:53 +02:00 committed by Gitea
parent 1a197dc07f
commit be73e84829
4 changed files with 86 additions and 84 deletions

View File

@ -21,10 +21,8 @@ import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -46,7 +44,6 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -63,7 +60,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fos
import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.Version; import nodomain.freeyourgadget.gadgetbridge.util.Version;
import static nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.WidgetSettingsActivity.RESULT_CODE_WIDGET_DELETED;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_COMMAND_UPDATE_WIDGETS; import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_COMMAND_UPDATE_WIDGETS;
public class HRConfigActivity extends AbstractGBActivity implements View.OnClickListener, DialogInterface.OnClickListener, AdapterView.OnItemClickListener { public class HRConfigActivity extends AbstractGBActivity implements View.OnClickListener, DialogInterface.OnClickListener, AdapterView.OnItemClickListener {
@ -86,9 +82,7 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
setContentView(R.layout.activity_qhybrid_hr_settings); setContentView(R.layout.activity_qhybrid_hr_settings);
findViewById(R.id.qhybrid_action_add).setOnClickListener(this); findViewById(R.id.qhybrid_action_add).setOnClickListener(this);
findViewById(R.id.qhybrid_file_management_trigger).setOnClickListener(this);
findViewById(R.id.qhybrid_apps_management_trigger).setOnClickListener(this); findViewById(R.id.qhybrid_apps_management_trigger).setOnClickListener(this);
findViewById(R.id.calibration_trigger).setOnClickListener(this);
sharedPreferences = GBApplication.getPrefs().getPreferences(); sharedPreferences = GBApplication.getPrefs().getPreferences();
@ -437,12 +431,8 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
.setPositiveButton("ok", this) .setPositiveButton("ok", this)
.setTitle("create action") .setTitle("create action")
.show(); .show();
} else if(v.getId() == R.id.qhybrid_file_management_trigger) {
startActivity(new Intent(getApplicationContext(), FileManagementActivity.class));
} else if(v.getId() == R.id.qhybrid_apps_management_trigger) { } else if(v.getId() == R.id.qhybrid_apps_management_trigger) {
startActivity(new Intent(getApplicationContext(), AppsManagementActivity.class)); startActivity(new Intent(getApplicationContext(), AppsManagementActivity.class));
} else if(v.getId() == R.id.calibration_trigger) {
startActivity(new Intent(getApplicationContext(), CalibrationActivity.class));
} }
} }

View File

@ -118,22 +118,10 @@
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/qhybrid_file_management_trigger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="File management" />
<Button <Button
android:id="@+id/qhybrid_apps_management_trigger" android:id="@+id/qhybrid_apps_management_trigger"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Apps management" /> android:text="Apps management" />
<Button
android:id="@+id/calibration_trigger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Calibration" />
</LinearLayout> </LinearLayout>

View File

@ -1166,4 +1166,8 @@
<string name="qhybrid_title_apps_management">Apps management</string> <string name="qhybrid_title_apps_management">Apps management</string>
<string name="qhybrid_title_calibration">Calibration</string> <string name="qhybrid_title_calibration">Calibration</string>
<string name="fossil_hr_warning_firmware_too_new">Some functions are disabled because the firmware of the watch is too new</string> <string name="fossil_hr_warning_firmware_too_new">Some functions are disabled because the firmware of the watch is too new</string>
<string name="pref_title_physical_buttons">Physical buttons</string>
<string name="pref_summary_physical_buttons">Configure the functionality of the physical buttons on the watch</string>
<string name="qhybrid_summary_file_management">Upload and download files</string>
<string name="qhybrid_summary_calibration">Calibrate the watch hands</string>
</resources> </resources>

View File

@ -2,70 +2,75 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference <PreferenceScreen
android:defaultValue="weatherApp" android:key="button_configuration"
android:entries="@array/pref_hybridhr_buttonfunctions" android:title="@string/pref_title_physical_buttons"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:summary="@string/pref_summary_physical_buttons">
android:key="button_1_function_short" <ListPreference
android:summary="%s" android:defaultValue="weatherApp"
android:title="@string/pref_title_upper_button_function_short" /> android:entries="@array/pref_hybridhr_buttonfunctions"
<ListPreference android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:defaultValue="weatherApp" android:key="button_1_function_short"
android:entries="@array/pref_hybridhr_buttonfunctions" android:summary="%s"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:title="@string/pref_title_upper_button_function_short" />
android:key="button_1_function_long" <ListPreference
android:summary="%s" android:defaultValue="weatherApp"
android:title="@string/pref_title_upper_button_function_long" /> android:entries="@array/pref_hybridhr_buttonfunctions"
<!-- supported FW does not support double click android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
<ListPreference android:key="button_1_function_long"
android:defaultValue="weatherApp" android:summary="%s"
android:entries="@array/pref_hybridhr_buttonfunctions" android:title="@string/pref_title_upper_button_function_long" />
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" <!-- supported FW does not support double click
android:key="button_1_function_double" <ListPreference
android:summary="%s" android:defaultValue="weatherApp"
android:title="@string/pref_title_upper_button_function_double" /> android:entries="@array/pref_hybridhr_buttonfunctions"
--> android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_double"
android:summary="%s"
android:title="@string/pref_title_upper_button_function_double" />
-->
<ListPreference <ListPreference
android:defaultValue="commuteApp" android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions" android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_short" android:key="button_2_function_short"
android:summary="%s" android:summary="%s"
android:title="@string/pref_title_middle_button_function_short" /> android:title="@string/pref_title_middle_button_function_short" />
<!-- supported FW does not support double click <!-- supported FW does not support double click
<ListPreference <ListPreference
android:defaultValue="commuteApp" android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions" android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_double" android:key="button_2_function_double"
android:summary="%s" android:summary="%s"
android:title="@string/pref_title_middle_button_function_double" /> android:title="@string/pref_title_middle_button_function_double" />
--> -->
<ListPreference <ListPreference
android:defaultValue="musicApp" android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions" android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_short" android:key="button_3_function_short"
android:summary="%s" android:summary="%s"
android:title="@string/pref_title_lower_button_function_short" /> android:title="@string/pref_title_lower_button_function_short" />
<ListPreference <ListPreference
android:defaultValue="musicApp" android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions" android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_long" android:key="button_3_function_long"
android:summary="%s" android:summary="%s"
android:title="@string/pref_title_lower_button_function_long" /> android:title="@string/pref_title_lower_button_function_long" />
<!-- supported FW does not support double click <!-- supported FW does not support double click
<ListPreference <ListPreference
android:defaultValue="musicApp" android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions" android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values" android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_double" android:key="button_3_function_double"
android:summary="%s" android:summary="%s"
android:title="@string/pref_title_lower_button_function_double" /> android:title="@string/pref_title_lower_button_function_double" />
--> -->
</PreferenceScreen>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
@ -88,4 +93,19 @@
android:title="@string/pref_title_vibration_strength" android:title="@string/pref_title_vibration_strength"
app:showSeekBarValue="true" /> app:showSeekBarValue="true" />
<Preference
android:title="@string/qhybrid_title_calibration"
android:summary="@string/qhybrid_summary_calibration">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.CalibrationActivity" />
</Preference>
<Preference
android:title="@string/qhybrid_title_file_management"
android:summary="@string/qhybrid_summary_file_management">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.FileManagementActivity" />
</Preference>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>