Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 65bf2c1

Browse files
committed
remove visibility modifier private from companion objects
1 parent 9f22eaf commit 65bf2c1

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

sampleapp/src/main/java/io/matthewnelson/sampleapp/ui/fragments/settings/library/BackgroundManagerOptions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import io.matthewnelson.sampleapp.R
99

1010
class BackgroundManagerOptions(view: View, prefs: Prefs) {
1111

12-
private companion object {
12+
companion object {
1313
// Spinner BackgroundManager Policy
1414
const val RESPECT_RESOURCES = "Stop Service After"
1515
const val FOREGROUND = "Run In Foreground"

sampleapp/src/main/java/io/matthewnelson/sampleapp/ui/fragments/settings/library/ControllerOptions.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import kotlin.math.absoluteValue
1313

1414
class ControllerOptions(view: View, prefs: Prefs) {
1515

16-
private companion object {
17-
const val DISABLED = "Don't Stop Service"
18-
const val ENABLED = "Stop Service"
16+
companion object {
17+
const val DO_NOT_STOP_SERVICE = "Don't Stop Service"
18+
const val STOP_SERVICE = "Stop Service"
1919

2020
const val DEBUG = "Debug"
2121
const val RELEASE = "Release"
@@ -103,8 +103,8 @@ class ControllerOptions(view: View, prefs: Prefs) {
103103

104104
private fun initSpinnerControllerDisableStopOnTaskRemoved(context: Context) {
105105
val categoryDisable = arrayOf(
106-
DISABLED,
107-
ENABLED
106+
DO_NOT_STOP_SERVICE,
107+
STOP_SERVICE
108108
)
109109
adapterDisableStopOnTaskRemoved = ArrayAdapter(context, R.layout.spinner_list_item, categoryDisable)
110110
adapterDisableStopOnTaskRemoved.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
@@ -164,10 +164,10 @@ class ControllerOptions(view: View, prefs: Prefs) {
164164
when (parent.adapter) {
165165
adapterDisableStopOnTaskRemoved -> {
166166
disableStopServiceOnTaskRemoved = when (item.toString()) {
167-
DISABLED -> {
167+
DO_NOT_STOP_SERVICE -> {
168168
true
169169
}
170-
ENABLED -> {
170+
STOP_SERVICE -> {
171171
false
172172
}
173173
else -> {

sampleapp/src/main/java/io/matthewnelson/sampleapp/ui/fragments/settings/library/SettingsLibraryFragment.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import io.matthewnelson.sampleapp.App
8080
import io.matthewnelson.sampleapp.R
8181
import io.matthewnelson.sampleapp.ui.fragments.dashboard.DashboardFragment
8282
import io.matthewnelson.topl_service.lifecycle.BackgroundManager
83+
import io.matthewnelson.topl_service.util.ServiceConsts.BackgroundPolicy
8384

8485
class SettingsLibraryFragment : Fragment() {
8586

@@ -150,7 +151,17 @@ class SettingsLibraryFragment : Fragment() {
150151
controllerOptions.buildConfigDebug
151152
)
152153
} catch (e: Exception) {
153-
Toast.makeText(context, e.message, Toast.LENGTH_LONG).show()
154+
e.message?.let {
155+
val msg = if (it.contains(BackgroundPolicy.RUN_IN_FOREGROUND))
156+
"Selected Controller option\n" +
157+
">>> ${ControllerOptions.DO_NOT_STOP_SERVICE} <<<\n" +
158+
"requires BackgroundManager Policy of\n" +
159+
">>> ${BackgroundManagerOptions.FOREGROUND} <<< and\n" +
160+
">>> ${BackgroundManagerOptions.KILL_APP} <<<"
161+
else
162+
it
163+
DashboardFragment.showMessage(msg, 8_000L, true)
164+
}
154165
return
155166
}
156167

0 commit comments

Comments
 (0)