forked from github/wulkanowy-mirror
Add app killer manager to settings (#808)
This commit is contained in:
parent
b95b529015
commit
131ba7dbb1
@ -177,11 +177,12 @@ dependencies {
|
||||
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
|
||||
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
|
||||
implementation "io.coil-kt:coil:0.11.0"
|
||||
implementation "io.github.wulkanowy:AppKillerManager:c33b658"
|
||||
|
||||
playImplementation 'com.google.firebase:firebase-analytics:17.4.1'
|
||||
playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.6'
|
||||
playImplementation "com.google.firebase:firebase-inappmessaging-ktx:19.0.6"
|
||||
playImplementation 'com.google.firebase:firebase-messaging:20.1.6'
|
||||
playImplementation 'com.google.firebase:firebase-messaging:20.1.7'
|
||||
playImplementation 'com.google.firebase:firebase-crashlytics:17.0.0'
|
||||
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
||||
|
||||
|
@ -18,7 +18,8 @@
|
||||
android:supportsRtl="false"
|
||||
android:theme="@style/WulkanowyTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
|
||||
tools:replace="android:supportsRtl,android:allowBackup">
|
||||
<activity
|
||||
android:name=".ui.modules.splash.SplashActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
@ -6,6 +6,7 @@ import android.os.Bundle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.thelittlefireman.appkillermanager.AppKillerManager
|
||||
import com.yariksoffice.lingver.Lingver
|
||||
import dagger.android.support.AndroidSupportInjection
|
||||
import io.github.wulkanowy.R
|
||||
@ -50,6 +51,13 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
||||
true
|
||||
}
|
||||
}
|
||||
findPreference<Preference>(getString(R.string.pref_key_notifications_fix_issues))?.run {
|
||||
isVisible = AppKillerManager.isDeviceSupported() && AppKillerManager.isAnyActionAvailable(requireContext())
|
||||
setOnPreferenceClickListener {
|
||||
presenter.onFixSyncIssuesClicked()
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
@ -119,6 +127,19 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun showFixSyncDialog() {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle(R.string.pref_notify_fix_sync_issues)
|
||||
.setMessage(R.string.pref_notify_fix_sync_issues_message)
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ -> }
|
||||
.setPositiveButton(R.string.pref_notify_fix_sync_issues_settings_button) { _, _ ->
|
||||
AppKillerManager.doActionPowerSaving(requireContext())
|
||||
AppKillerManager.doActionAutoStart(requireContext())
|
||||
AppKillerManager.doActionNotification(requireContext())
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||
|
@ -58,6 +58,10 @@ class SettingsPresenter @Inject constructor(
|
||||
view?.showForceSyncDialog()
|
||||
}
|
||||
|
||||
fun onFixSyncIssuesClicked() {
|
||||
view?.showFixSyncDialog()
|
||||
}
|
||||
|
||||
fun onForceSyncDialogSubmit() {
|
||||
view?.run {
|
||||
val successString = syncSuccessString
|
||||
|
@ -19,4 +19,5 @@ interface SettingsView : BaseView {
|
||||
fun setSyncInProgress(inProgress: Boolean)
|
||||
|
||||
fun showForceSyncDialog()
|
||||
fun showFixSyncDialog()
|
||||
}
|
||||
|
@ -329,6 +329,9 @@
|
||||
<string name="pref_notify_header">Powiadomienia</string>
|
||||
<string name="pref_notify_switch">Pokazuj powiadomienia</string>
|
||||
<string name="pref_notify_upcoming_lessons_switch">Pokazuj powiadomienia o następnych lekcjach</string>
|
||||
<string name="pref_notify_fix_sync_issues">Napraw problemy z synchronizacją i powiadomieniami</string>
|
||||
<string name="pref_notify_fix_sync_issues_message">Na twoim urządzeniu mogą występować problemy z synchronizacją danych i powiadomieniami.\n\nBy je naprawić, dodaj Wulkanowego do autostartu i wyłącz optymalizację/oszczędzanie baterii w ustawieniach systemowych telefonu.</string>
|
||||
<string name="pref_notify_fix_sync_issues_settings_button">Przejdź do ustawień</string>
|
||||
<string name="pref_notify_debug_switch">Pokazuj powiadomienia debugowania</string>
|
||||
<string name="pref_services_header">Synchronizacja</string>
|
||||
<string name="pref_services_switch">Automatyczna aktualizacja</string>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<string name="pref_key_services_interval">services_interval</string>
|
||||
<string name="pref_key_services_wifi_only">services_disable_wifi_only</string>
|
||||
<string name="pref_key_services_force_sync">services_force_sync</string>
|
||||
<string name="pref_key_notifications_fix_issues">notifications_fix_issues</string>
|
||||
<string name="pref_key_notifications_enable">notifications_enable</string>
|
||||
<string name="pref_key_notifications_upcoming_lessons_enable">notifications_upcoming_lessons_enable</string>
|
||||
<string name="pref_key_notification_debug">notification_debug</string>
|
||||
|
@ -366,6 +366,9 @@
|
||||
<string name="pref_notify_header">Notifications</string>
|
||||
<string name="pref_notify_switch">Show notifications</string>
|
||||
<string name="pref_notify_upcoming_lessons_switch">Show upcoming lesson notifications</string>
|
||||
<string name="pref_notify_fix_sync_issues">Fix synchronization & notifications issues</string>
|
||||
<string name="pref_notify_fix_sync_issues_message">Your device may have data synchronization issues and with notifications.\n\nTo fix them, you need to add Wulkanowy to the autostart and turn off battery optimization/saving in the phone settings.</string>
|
||||
<string name="pref_notify_fix_sync_issues_settings_button">Go to settings</string>
|
||||
<string name="pref_notify_debug_switch">Show debug notifications</string>
|
||||
|
||||
<string name="pref_services_header">Synchronization</string>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--suppress AndroidElementNotAllowed -->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
@ -32,13 +32,13 @@
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_timetable_show_timers"
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/pref_view_timetable_show_timers"
|
||||
app:key="@string/pref_key_timetable_show_timers" />
|
||||
app:key="@string/pref_key_timetable_show_timers"
|
||||
app:title="@string/pref_view_timetable_show_timers" />
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_grade_statistics_list"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_grade_statistics_list"
|
||||
app:title="@string/pref_view_grade_statistics_list"/>
|
||||
app:title="@string/pref_view_grade_statistics_list" />
|
||||
<ListPreference
|
||||
app:defaultValue="@string/pref_default_timetable_show_whole_class"
|
||||
app:entries="@array/timetable_show_whole_class_entries"
|
||||
@ -95,6 +95,10 @@
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/pref_notify_header">
|
||||
<Preference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_notifications_fix_issues"
|
||||
app:title="@string/pref_notify_fix_sync_issues" />
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_notifications_enable"
|
||||
app:dependency="services_enable"
|
||||
|
Loading…
Reference in New Issue
Block a user