Skip to content
Snippets Groups Projects
Unverified Commit cbfc2b8f authored by Kolya Opahle's avatar Kolya Opahle Committed by GitHub
Browse files

Unreliable background priority (EXPOSUREAPP-3094) (#1356)


* Removed background priority settings from the settings ui

* Revert "Removed background priority settings from the settings ui"

This reverts commit c0447a1a52da6a4bc33aac01ceb28afce049cf98.

* Removed background priority switch from settings ui and replaced with intent to open settings,
also replaced in notification on first launch

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

* Card is now always visible and changed text

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

* Revert "Card is now always visible and changed text"

This reverts commit cae7c0fcc4575c67fb1a3d12b8a304a2416543f0.

* Added new german strings to status card and made it permanently visible

* Removed unnecessary constraint layout from xml file

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

* Removed additional unneeded constraint layout

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
Co-authored-by: default avatarRalf Gehrer <ralfgehrer@users.noreply.github.com>
parent 71346d52
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,7 @@ class MainActivity : AppCompatActivity(), HasAndroidInjector {
R.string.onboarding_energy_optimized_dialog_button_negative,
false, {
// go to battery optimization
startActivitySafely(powerManagement.disableBatteryOptimizationsIntent)
startActivitySafely(powerManagement.toBatteryOptimizationSettingsIntent)
}, {
// keep battery optimization enabled
showManualCheckingRequiredDialog()
......
......@@ -38,19 +38,12 @@ class SettingsBackgroundPriorityFragment :
}
private fun setButtonOnClickListener() {
val switch = binding.settingsSwitchRowBackgroundPriority.settingsSwitchRowSwitch
val switchRow = binding.settingsSwitchRowBackgroundPriority.settingsSwitchRow
val settingsRow = binding.settingsRowBackgroundPriority
// enable background priority
setOf(switch, switchRow).forEach {
it.setOnClickListener {
val isPriorityEnabled = settingsViewModel.isBackgroundPriorityEnabled.value == true
if (!isPriorityEnabled) {
(requireActivity() as MainActivity).apply {
startActivitySafely(powerManagement.disableBatteryOptimizationsIntent)
}
}
settingsRow.setOnClickListener {
(requireActivity() as MainActivity).apply {
startActivitySafely(powerManagement.toBatteryOptimizationSettingsIntent)
}
}
......
......@@ -57,20 +57,51 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/settings_switch_row_background_priority"
layout="@layout/include_settings_switch_row"
android:layout_width="@dimen/match_constraint"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/settings_row_background_priority"
style="@style/row"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_small"
app:enabled="@{!settingsViewModel.isBackgroundPriorityEnabled()}"
android:focusable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_background_priority_header_details">
<TextView
android:id="@+id/settings_row_background_priority_header_subtitle"
style="@style/subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/settings_background_priority_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/settings_row_background_priority_header_body"
style="@style/body2Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_mega_tiny"
android:accessibilityLiveRegion="assertive"
android:text="@{FormatterSettingsHelper.formatStatus(settingsViewModel.isBackgroundPriorityEnabled())}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_row_background_priority_header_subtitle" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include
layout="@layout/include_divider"
android:layout_width="0dp"
android:layout_height="@dimen/card_divider"
android:layout_marginStart="@dimen/guideline_start"
android:layout_marginEnd="@dimen/guideline_end"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_background_priority_header_details"
app:showDivider="@{true}"
app:status="@{settingsViewModel.isBackgroundPriorityEnabled()}"
app:statusText="@{FormatterSettingsHelper.formatStatus(settingsViewModel.isBackgroundPriorityEnabled())}"
app:subtitle="@{@string/settings_background_priority_title}" />
app:layout_constraintTop_toBottomOf="@+id/settings_row_background_priority" />
<include
android:id="@+id/settings_tracing_status_connection"
......@@ -78,13 +109,12 @@
android:layout_width="@dimen/match_constraint"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_small"
android:visibility="@{FormatterHelper.formatVisibility(settingsViewModel.isBackgroundPriorityEnabled())}"
app:body="@{@string/settings_background_priority_card_body}"
app:buttonText="@{@string/settings_background_priority_card_button}"
app:headline="@{@string/settings_background_priority_card_headline}"
app:layout_constraintEnd_toStartOf="@+id/guideline_card_end"
app:layout_constraintStart_toStartOf="@+id/guideline_card_start"
app:layout_constraintTop_toBottomOf="@id/settings_switch_row_background_priority" />
app:layout_constraintTop_toBottomOf="@id/settings_row_background_priority" />
<include layout="@layout/merge_guidelines_side" />
......
......@@ -624,11 +624,11 @@
<!-- XACT: settings(background priority) - illustraction description -->
<string name="settings_background_priority_illustration_description" />
<!-- XTXT: settings(background priority) - explains user what to do on card if background priority is enabled -->
<string name="settings_background_priority_card_body">"Um die priorisierte Hintergrundaktivität auszuschalten, deaktivieren Sie sie bitte in den Geräte-Einstellungen."</string>
<string name="settings_background_priority_card_body">"Sie können die priorisierte Hintergrundaktivität in den Einstellungen Ihres Smartphones ein- beziehungsweise ausschalten."</string>
<!-- XBUT: settings(background priority) - go to operating system settings button on card -->
<string name="settings_background_priority_card_button">"Geräte-Einstellungen öffnen"</string>
<string name="settings_background_priority_card_button">"Smartphone-Einstellungen öffnen"</string>
<!-- XHED : settings(background priority) - headline on card about the current status and what to do -->
<string name="settings_background_priority_card_headline">"Priorisierte Hintergrundaktivität ausschalten"</string>
<string name="settings_background_priority_card_headline">"Priorisierte Hintergrundaktivität ändern"</string>
<!-- ####################################
App Information
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment