Skip to content

Commit

Permalink
Merge pull request #3297 from Navid200/Navid_2024_01_19
Browse files Browse the repository at this point in the history
Ascending volume to medium instead of maximum
  • Loading branch information
jamorham committed May 15, 2024
2 parents db904ab + 79a4d3b commit c967ee7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ protected void VibrateNotifyMakeNoise(Context context, AlertType alert, String b
}
volumeFrac = Math.max(volumeFrac, 0); // Limit volumeFrac to values greater than and equal to 0
volumeFrac = Math.min(volumeFrac, 1); // Limit volumeFrac to values less than and equal to 1
if (Pref.getBooleanDefaultFalse("ascending_volume_to_medium") && profile == ALERT_PROFILE_ASCENDING) { // If ascending volume profile is chosen and ascending_volume_to_medium is enabled
volumeFrac = Math.min(volumeFrac, (float) 0.7); // Clamp the ascending volume at the medium level.
}
if (profile == ALERT_PROFILE_MEDIUM) {
volumeFrac = (float) 0.7;
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,10 @@
<string name="summary_notification_channels_grouping">Whether notifications should be grouped together. Incompatible with \'Number Item in Notification Area\' option</string>
<string name="title_notification_channels_grouping">Group notifications together</string>
<string name="summary_delay_ascending_3min">For ascending volume profile, delay the start of the alert sound by 3 minutes. The vibration (if enabled) starts as soon as the alert triggers regardless of this setting.</string>
<string name="title_ascending_volume">Ascending Volume settings</string>
<string name="title_delay_ascending_3min">Delay Ascending Volume</string>
<string name="summary_ascending_volume_to_medium">When enabled, ascending volume profile will ascend to medium volume instead of maximum</string>
<string name="title_ascending_volume_to_medium">Ascend to medium</string>
<string name="summary_play_sound_for_initial_calibration">Play sound when Initial Calibration is requested</string>
<string name="title_play_sound_for_initial_calibration">Initial Alert</string>
<string name="category_noisy_readings">Noisy Readings</string>
Expand Down
87 changes: 51 additions & 36 deletions app/src/main/res/xml/pref_notifications.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,44 +93,59 @@
android:summary="@string/create_shortcut"
android:title="@string/shortcut_to_bg_alerts" />

<CheckBoxPreference
android:defaultValue="false"
android:key="disable_alerts_stale_data"
android:summary="@string/suppress_alerts_missed_readings"
android:title="@string/suppress_alerts_if_missed_readings" />
<EditTextPreference
android:defaultValue="15"
android:dependency="disable_alerts_stale_data"
android:inputType="number"
android:key="disable_alerts_stale_data_minutes"
android:summary="@string/suppress_alerts_after"
android:title="@string/suppress_alerts_after" />

<CheckBoxPreference
android:defaultValue="false"
android:key="use_notification_channels"
android:summary="@string/summary_use_notification_channels"
android:title="@string/title_use_notification_channels" />

<CheckBoxPreference
android:defaultValue="false"
android:dependency="use_notification_channels"
android:key="ongoing_notification_channel"
android:summary="@string/summary_ongoing_notification_channel"
android:title="@string/title_ongoing_notification_channel" />
<PreferenceScreen
android:key="suppress_alerts_screen"
android:title="@string/suppress_alerts_if_missed_readings">
<CheckBoxPreference
android:defaultValue="false"
android:key="disable_alerts_stale_data"
android:summary="@string/suppress_alerts_missed_readings"
android:title="@string/suppress_alerts_if_missed_readings" />
<EditTextPreference
android:defaultValue="15"
android:dependency="disable_alerts_stale_data"
android:inputType="number"
android:key="disable_alerts_stale_data_minutes"
android:summary="@string/suppress_alerts_after"
android:title="@string/suppress_alerts_after" />
</PreferenceScreen>

<CheckBoxPreference
android:defaultValue="false"
android:dependency="use_notification_channels"
android:key="notification_channels_grouping"
android:summary="@string/summary_notification_channels_grouping"
android:title="@string/title_notification_channels_grouping" />
<PreferenceScreen
android:key="Notification_Channels_screen"
android:title="@string/title_use_notification_channels">
<CheckBoxPreference
android:defaultValue="false"
android:key="use_notification_channels"
android:summary="@string/summary_use_notification_channels"
android:title="@string/title_use_notification_channels" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="use_notification_channels"
android:key="ongoing_notification_channel"
android:summary="@string/summary_ongoing_notification_channel"
android:title="@string/title_ongoing_notification_channel" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="use_notification_channels"
android:key="notification_channels_grouping"
android:summary="@string/summary_notification_channels_grouping"
android:title="@string/title_notification_channels_grouping" />
</PreferenceScreen>

<CheckBoxPreference
android:defaultValue="true"
android:key="delay_ascending_3min"
android:summary="@string/summary_delay_ascending_3min"
android:title="@string/title_delay_ascending_3min" />
<PreferenceScreen
android:key="ascending_volume_settings"
android:title="@string/title_ascending_volume">
<CheckBoxPreference
android:defaultValue="true"
android:key="delay_ascending_3min"
android:summary="@string/summary_delay_ascending_3min"
android:title="@string/title_delay_ascending_3min" />
<CheckBoxPreference
android:defaultValue="false"
android:key="ascending_volume_to_medium"
android:summary="@string/summary_ascending_volume_to_medium"
android:title="@string/title_ascending_volume_to_medium" />
</PreferenceScreen>

</PreferenceScreen>

Expand Down

0 comments on commit c967ee7

Please sign in to comment.