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.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
@ -46,7 +44,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
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.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;
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);
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.calibration_trigger).setOnClickListener(this);
sharedPreferences = GBApplication.getPrefs().getPreferences();
@ -437,12 +431,8 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
.setPositiveButton("ok", this)
.setTitle("create action")
.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) {
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>
<Button
android:id="@+id/qhybrid_file_management_trigger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="File management" />
<Button
android:id="@+id/qhybrid_apps_management_trigger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apps management" />
<Button
android:id="@+id/calibration_trigger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Calibration" />
</LinearLayout>

View File

@ -1166,4 +1166,8 @@
<string name="qhybrid_title_apps_management">Apps management</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="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>

View File

@ -2,70 +2,75 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
android:defaultValue="weatherApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_short"
android:summary="%s"
android:title="@string/pref_title_upper_button_function_short" />
<ListPreference
android:defaultValue="weatherApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_long"
android:summary="%s"
android:title="@string/pref_title_upper_button_function_long" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="weatherApp"
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" />
-->
<PreferenceScreen
android:key="button_configuration"
android:title="@string/pref_title_physical_buttons"
android:summary="@string/pref_summary_physical_buttons">
<ListPreference
android:defaultValue="weatherApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_short"
android:summary="%s"
android:title="@string/pref_title_upper_button_function_short" />
<ListPreference
android:defaultValue="weatherApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_long"
android:summary="%s"
android:title="@string/pref_title_upper_button_function_long" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="weatherApp"
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
android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_short"
android:summary="%s"
android:title="@string/pref_title_middle_button_function_short" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_double"
android:summary="%s"
android:title="@string/pref_title_middle_button_function_double" />
-->
<ListPreference
android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_short"
android:summary="%s"
android:title="@string/pref_title_middle_button_function_short" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="commuteApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_2_function_double"
android:summary="%s"
android:title="@string/pref_title_middle_button_function_double" />
-->
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_short"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_short" />
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_long"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_long" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_double"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_double" />
-->
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_short"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_short" />
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_long"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_long" />
<!-- supported FW does not support double click
<ListPreference
android:defaultValue="musicApp"
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_3_function_double"
android:summary="%s"
android:title="@string/pref_title_lower_button_function_double" />
-->
</PreferenceScreen>
<SwitchPreference
android:defaultValue="false"
@ -88,4 +93,19 @@
android:title="@string/pref_title_vibration_strength"
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>