mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-02-22 09:54:45 +01:00
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.mikepenz:aboutlibraries-core:$about_libraries"
|
||||||
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
|
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
|
||||||
implementation "io.coil-kt:coil:0.11.0"
|
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-analytics:17.4.1'
|
||||||
playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.6'
|
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-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.firebase:firebase-crashlytics:17.0.0'
|
||||||
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
android:supportsRtl="false"
|
android:supportsRtl="false"
|
||||||
android:theme="@style/WulkanowyTheme"
|
android:theme="@style/WulkanowyTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
|
||||||
|
tools:replace="android:supportsRtl,android:allowBackup">
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.modules.splash.SplashActivity"
|
android:name=".ui.modules.splash.SplashActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Bundle
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import com.thelittlefireman.appkillermanager.AppKillerManager
|
||||||
import com.yariksoffice.lingver.Lingver
|
import com.yariksoffice.lingver.Lingver
|
||||||
import dagger.android.support.AndroidSupportInjection
|
import dagger.android.support.AndroidSupportInjection
|
||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
@ -50,6 +51,13 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
|||||||
true
|
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?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
@ -119,6 +127,19 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
|||||||
.show()
|
.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() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
|
@ -58,6 +58,10 @@ class SettingsPresenter @Inject constructor(
|
|||||||
view?.showForceSyncDialog()
|
view?.showForceSyncDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onFixSyncIssuesClicked() {
|
||||||
|
view?.showFixSyncDialog()
|
||||||
|
}
|
||||||
|
|
||||||
fun onForceSyncDialogSubmit() {
|
fun onForceSyncDialogSubmit() {
|
||||||
view?.run {
|
view?.run {
|
||||||
val successString = syncSuccessString
|
val successString = syncSuccessString
|
||||||
|
@ -19,4 +19,5 @@ interface SettingsView : BaseView {
|
|||||||
fun setSyncInProgress(inProgress: Boolean)
|
fun setSyncInProgress(inProgress: Boolean)
|
||||||
|
|
||||||
fun showForceSyncDialog()
|
fun showForceSyncDialog()
|
||||||
|
fun showFixSyncDialog()
|
||||||
}
|
}
|
||||||
|
@ -329,6 +329,9 @@
|
|||||||
<string name="pref_notify_header">Powiadomienia</string>
|
<string name="pref_notify_header">Powiadomienia</string>
|
||||||
<string name="pref_notify_switch">Pokazuj 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_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_notify_debug_switch">Pokazuj powiadomienia debugowania</string>
|
||||||
<string name="pref_services_header">Synchronizacja</string>
|
<string name="pref_services_header">Synchronizacja</string>
|
||||||
<string name="pref_services_switch">Automatyczna aktualizacja</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_interval">services_interval</string>
|
||||||
<string name="pref_key_services_wifi_only">services_disable_wifi_only</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_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_enable">notifications_enable</string>
|
||||||
<string name="pref_key_notifications_upcoming_lessons_enable">notifications_upcoming_lessons_enable</string>
|
<string name="pref_key_notifications_upcoming_lessons_enable">notifications_upcoming_lessons_enable</string>
|
||||||
<string name="pref_key_notification_debug">notification_debug</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_header">Notifications</string>
|
||||||
<string name="pref_notify_switch">Show 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_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_notify_debug_switch">Show debug notifications</string>
|
||||||
|
|
||||||
<string name="pref_services_header">Synchronization</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">
|
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
@ -32,8 +32,8 @@
|
|||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="@bool/pref_default_timetable_show_timers"
|
app:defaultValue="@bool/pref_default_timetable_show_timers"
|
||||||
app:iconSpaceReserved="false"
|
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
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="@bool/pref_default_grade_statistics_list"
|
app:defaultValue="@bool/pref_default_grade_statistics_list"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
@ -95,6 +95,10 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:title="@string/pref_notify_header">
|
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
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="@bool/pref_default_notifications_enable"
|
app:defaultValue="@bool/pref_default_notifications_enable"
|
||||||
app:dependency="services_enable"
|
app:dependency="services_enable"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user