Update AlarmManager Global Settings String

Implements methods that update the AlarmManager Global Settings String
when the user confirms a value in the Dialog. updateAlarmManagerValue
takes the key of the factor being edited and the edited value enterd by
the user in the dialog assigning it as the current value of the key.
This a new string is then rebuilt with the updated values and assigned
to be the new Settings Global String.

Bug: 195056102
Bug: 195055895

Test: Manual
Change-Id: I5776822c665bdfa052f23099d367ba8cf29743df
This commit is contained in:
Joshua
2021-08-11 22:20:48 +00:00
parent 7b2293ef9a
commit 347f58ad6e
2 changed files with 155 additions and 50 deletions

View File

@@ -42,6 +42,7 @@ public class TareFactorDialogFragment extends DialogFragment {
private final String mFactorKey;
private final String mFactorTitle;
private final int mFactorValue;
private final int mFactorPolicy;
private int mFactorEditedValue;
private EditText mFactorValueView;
@@ -53,10 +54,11 @@ public class TareFactorDialogFragment extends DialogFragment {
* @param defaultValue the initial value set for the Factor before any changes
*/
public TareFactorDialogFragment(@NonNull String title, @NonNull String key, int defaultValue,
TareFactorController tareFactorController) {
int factorPolicy, TareFactorController tareFactorController) {
mFactorTitle = title;
mFactorKey = key;
mFactorValue = defaultValue;
mFactorPolicy = factorPolicy;
mTareFactorController = tareFactorController;
}
@@ -84,7 +86,8 @@ public class TareFactorDialogFragment extends DialogFragment {
Log.e(TAG, "Error converting '" + stringValue + "' to integer. Using "
+ mFactorValue + " instead", e);
}
// TODO: Update csv with new factor value
mTareFactorController.updateValue(mFactorKey, mFactorEditedValue,
mFactorPolicy);
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
// When the negative button is clicked do nothing