| author | Da Risk <da_risk@geekorum.com> |
| Wed, 12 Jan 2022 17:29:59 -0400 | |
| changeset 882 | 7a74abf66c49 |
| parent 875 | d422a84b6583 |
| child 943 | 298742859784 |
| permissions | -rw-r--r-- |
| 135 | 1 |
/* |
2 |
* Geekttrss is a RSS feed reader application on the Android Platform. |
|
3 |
* |
|
| 882 | 4 |
* Copyright (C) 2017-2022 by Frederic-Charles Barthelery. |
| 135 | 5 |
* |
6 |
* This file is part of Geekttrss. |
|
7 |
* |
|
8 |
* Geekttrss is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* Geekttrss is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with Geekttrss. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
package com.geekorum.ttrss.settings |
|
22 |
||
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
23 |
import android.content.Context |
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
24 |
import android.os.StrictMode.allowThreadDiskWrites |
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
25 |
import androidx.annotation.Keep |
|
235
adf383200966
Don't use deprecated android.preference use androidx
Da Risk <da_risk@geekorum.com>
parents:
140
diff
changeset
|
26 |
import androidx.preference.PreferenceManager |
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
27 |
import androidx.startup.Initializer |
| 135 | 28 |
import com.geekorum.ttrss.R |
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
29 |
import com.geekorum.ttrss.debugtools.StrictModeInitializer |
|
139
74f1150de442
Add helper method to run with temporary strict mode
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
30 |
import com.geekorum.ttrss.debugtools.withStrictMode |
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
31 |
|
|
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
32 |
@Keep |
|
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
33 |
class SettingsInitializer : Initializer<Unit> {
|
| 135 | 34 |
|
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
35 |
override fun create(context: Context) {
|
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
36 |
withStrictMode(allowThreadDiskWrites()) {
|
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
37 |
PreferenceManager.setDefaultValues(context, R.xml.pref_general, false) |
|
139
74f1150de442
Add helper method to run with temporary strict mode
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
38 |
} |
| 135 | 39 |
} |
40 |
||
|
875
d422a84b6583
app: convert SettingsInitializer to androidx.startup
Da Risk <da_risk@geekorum.com>
parents:
846
diff
changeset
|
41 |
override fun dependencies(): List<Class<out Initializer<*>>> = listOf(StrictModeInitializer::class.java) |
| 135 | 42 |
|
43 |
} |