MainActivity: Warn users if battery optimizations are enabled

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-11-30 16:55:44 +05:30
parent f4226ac9ef
commit acd2e7a586
8 changed files with 187 additions and 4 deletions

View File

@@ -20,9 +20,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillColor="@android:color/white"
android:pathData="M4,19h16v-7h2v8a1,1 0,0 1,-1 1H3a1,1 0,0 1,-1 -1v-8h2v7zM14,9h5l-7,7 -7,-7h5V3h4v6z" />
</vector>

View File

@@ -20,9 +20,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillColor="@android:color/white"
android:pathData="M12,22C6.477,22 2,17.523 2,12S6.477,2 12,2s10,4.477 10,10 -4.477,10 -10,10zM12,20a8,8 0,1 0,0 -16,8 8,0 0,0 0,16zM11,7h2v2h-2L11,7zM11,11h2v6h-2v-6z" />
</vector>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/divider"
android:orientation="vertical"
android:padding="@dimen/padding_large"
android:showDividers="middle">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_icon"
android:layout_width="@dimen/icon_size_category"
android:layout_height="@dimen/icon_size_category"
android:src="@drawable/ic_download_manager"
android:layout_centerVertical="true"
app:tint="@color/colorAccent" />
<TextView
android:id="@+id/txt_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginBottom="@dimen/margin_normal"
android:layout_toEndOf="@id/img_icon"
android:maxLines="1"
android:text="@string/device_doze_title"
android:textAlignment="viewStart"
android:textColor="?android:textColorPrimary"
android:textSize="18sp" />
</RelativeLayout>
<TextView
android:id="@+id/txt_line2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="10"
android:text="@string/device_doze_subtitle"
android:textAlignment="viewStart" />
<TextView
android:id="@+id/txt_line3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_changelog"
android:maxLines="10"
android:text="@string/device_doze_description"
android:textAlignment="viewStart" />
<TextView
android:id="@+id/txt_line4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="10"
android:text="@string/device_doze_extra"
android:textAlignment="viewStart"
android:textColor="@color/colorRed" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_secondary"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="0dp"
android:layout_height="@dimen/height_button"
android:layout_weight="1"
android:text="@string/action_ignore" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_primary"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="0dp"
android:layout_height="@dimen/height_button"
android:layout_weight="1"
android:text="@string/action_disable" />
</LinearLayout>
</LinearLayout>

View File

@@ -19,9 +19,17 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_download_manager"
android:icon="@drawable/ic_download"
android:title="@string/title_download_manager"
app:showAsAction="always" />
</menu>
<item
android:id="@+id/menu_doze_info"
android:icon="@drawable/ic_menu_about"
android:title="@string/device_doze_title"
android:visible="false"
app:showAsAction="always" />
</menu>

View File

@@ -458,4 +458,9 @@
android:name="extra"
app:argType="string" />
</dialog>
<dialog
android:id="@+id/dozeWarningSheet"
android:name="com.aurora.store.view.ui.sheets.DozeWarningSheet"
android:label="DozeWarningSheet"
tools:layout="@layout/sheet_doze_warning"/>
</navigation>

View File

@@ -396,7 +396,10 @@
<string name="android_market_desc">Android Market was an online store offering software applications designed for Android devices, retired in 2017.</string>
<string name="app_link_amazon_appstore" translatable="false">www.amazon.com</string>
<string name="amazon_appstore_desc">Amazon Appstore is an app store for Android-compatible platforms operated by Amazon.</string>
<string name="device_doze_title">Battery optimizations detected!</string>
<string name="device_doze_subtitle">Aurora Store can not install download or update apps in background due to battery optimizations.</string>
<string name="device_doze_description">Please, disable battery optimizations to allow background operations.</string>
<string name="device_doze_extra">Optionally you can choose to keep the optimizations enabled, but then you won\'t be able to take benefit of background downloads and automated updates, so choice is yours.</string>
<string name="pref_self_update_title">Self-updates</string>
<string name="pref_self_update_summary">Check and notify if a new stable version of Aurora Store is available</string>
</resources>