Remove EventBus usage

This commit is contained in:
Ensar Sarajčić 2023-10-02 18:24:02 +02:00
parent 163e053e1d
commit ee9a539cf5
10 changed files with 143 additions and 221 deletions

View File

@ -105,8 +105,6 @@ android {
dependencies { dependencies {
implementation(libs.simple.tools.commons) implementation(libs.simple.tools.commons)
implementation(libs.androidx.constraintlayout)
implementation(libs.eventbus)
implementation(libs.bundles.lifecycle) implementation(libs.bundles.lifecycle)
implementation(libs.bundles.compose) implementation(libs.bundles.compose)
debugImplementation(libs.bundles.compose.preview) debugImplementation(libs.bundles.compose.preview)

View File

@ -1,6 +0,0 @@
# EventBus
-keepattributes *Annotation*
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

View File

@ -12,20 +12,20 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewModelScope
import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple
import com.simplemobiletools.commons.compose.theme.AppThemeSurface import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.getContrastColor import com.simplemobiletools.commons.extensions.getContrastColor
import com.simplemobiletools.commons.extensions.getFormattedDuration import com.simplemobiletools.commons.extensions.getFormattedDuration
import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.helpers.SleepTimer
import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown import com.simplemobiletools.flashlight.helpers.stopSleepTimerCountDown
import com.simplemobiletools.flashlight.models.Events
import com.simplemobiletools.flashlight.screens.BrightDisplayScreen import com.simplemobiletools.flashlight.screens.BrightDisplayScreen
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import org.greenrobot.eventbus.EventBus import kotlinx.coroutines.flow.launchIn
import org.greenrobot.eventbus.Subscribe import kotlinx.coroutines.flow.onEach
import org.greenrobot.eventbus.ThreadMode
import kotlin.system.exitProcess import kotlin.system.exitProcess
class BrightDisplayActivity : ComponentActivity() { class BrightDisplayActivity : ComponentActivity() {
@ -113,17 +113,16 @@ class BrightDisplayActivity : ComponentActivity() {
val backgroundColor = _backgroundColor.asStateFlow() val backgroundColor = _backgroundColor.asStateFlow()
init { init {
EventBus.getDefault().register(this) SleepTimer.timeLeft
} .onEach { seconds ->
_timerText.value = seconds.getFormattedDuration()
_timerVisible.value = true
@Subscribe(threadMode = ThreadMode.MAIN) if (seconds == 0) {
fun sleepTimerChanged(event: Events.SleepTimerChanged) { exitProcess(0)
_timerText.value = event.seconds.getFormattedDuration() }
_timerVisible.value = true }
.launchIn(viewModelScope)
if (event.seconds == 0) {
exitProcess(0)
}
} }
fun updateBackgroundColor(color: Int) { fun updateBackgroundColor(color: Int) {
@ -133,10 +132,5 @@ class BrightDisplayActivity : ComponentActivity() {
fun hideTimer() { fun hideTimer() {
_timerVisible.value = false _timerVisible.value = false
} }
override fun onCleared() {
super.onCleared()
EventBus.getDefault().unregister(this)
}
} }
} }

View File

@ -23,6 +23,7 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewModelScope
import com.google.android.material.math.MathUtils import com.google.android.material.math.MathUtils
import com.simplemobiletools.commons.compose.extensions.onEventValue import com.simplemobiletools.commons.compose.extensions.onEventValue
import com.simplemobiletools.commons.compose.theme.AppThemeSurface import com.simplemobiletools.commons.compose.theme.AppThemeSurface
@ -39,14 +40,8 @@ import com.simplemobiletools.flashlight.dialogs.SleepTimerCustomDialog
import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.extensions.startAboutActivity import com.simplemobiletools.flashlight.extensions.startAboutActivity
import com.simplemobiletools.flashlight.helpers.* import com.simplemobiletools.flashlight.helpers.*
import com.simplemobiletools.flashlight.models.Events
import com.simplemobiletools.flashlight.screens.MainScreen import com.simplemobiletools.flashlight.screens.MainScreen
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.map
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.* import java.util.*
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -173,8 +168,6 @@ class MainActivity : ComponentActivity() {
} }
private fun launchAbout() { private fun launchAbout() {
val licenses = LICENSE_EVENT_BUS
val faqItems = arrayListOf( val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons), FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons) FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons)
@ -185,7 +178,7 @@ class MainActivity : ComponentActivity() {
faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons)) faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons))
} }
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) startAboutActivity(R.string.app_name, 0, BuildConfig.VERSION_NAME, faqItems, true)
} }
private fun checkAppOnSDCard() { private fun checkAppOnSDCard() {
@ -323,14 +316,33 @@ class MainActivity : ComponentActivity() {
private val preferences = application.config private val preferences = application.config
private lateinit var camera: MyCameraImpl
init {
camera = MyCameraImpl.newInstance(application, object : CameraTorchListener {
override fun onTorchEnabled(isEnabled: Boolean) {
camera.onTorchEnabled(isEnabled)
if (isEnabled && camera.supportsBrightnessControl()) {
_brightnessBarValue.value = camera.getCurrentBrightnessLevel().toFloat() / camera.getMaximumBrightnessLevel()
}
}
override fun onTorchUnavailable() {
camera.onCameraNotAvailable()
}
})
if (preferences.turnFlashlightOn) {
camera.enableFlashlight()
}
}
private val _timerText: MutableStateFlow<String> = MutableStateFlow("00:00") private val _timerText: MutableStateFlow<String> = MutableStateFlow("00:00")
val timerText = _timerText.asStateFlow() val timerText = _timerText.asStateFlow()
private val _timerVisible: MutableStateFlow<Boolean> = MutableStateFlow(false) private val _timerVisible: MutableStateFlow<Boolean> = MutableStateFlow(false)
val timerVisible = _timerVisible.asStateFlow() val timerVisible = _timerVisible.asStateFlow()
private val _flashlightOn: MutableStateFlow<Boolean> = MutableStateFlow(false) val flashlightOn = camera.flashlightOnFlow
val flashlightOn = _flashlightOn.asStateFlow()
val brightnessBarVisible = flashlightOn.map { val brightnessBarVisible = flashlightOn.map {
it && camera.supportsBrightnessControl() it && camera.supportsBrightnessControl()
@ -350,38 +362,31 @@ class MainActivity : ComponentActivity() {
private val _stroboscopeBarValue: MutableStateFlow<Float> = MutableStateFlow(0f) private val _stroboscopeBarValue: MutableStateFlow<Float> = MutableStateFlow(0f)
val stroboscopeBarValue = _stroboscopeBarValue.asStateFlow() val stroboscopeBarValue = _stroboscopeBarValue.asStateFlow()
private lateinit var camera: MyCameraImpl
init { init {
EventBus.getDefault().register(this) _stroboscopeBarValue.value = preferences.stroboscopeProgress.toFloat() / MAX_STROBO_DELAY
camera = MyCameraImpl.newInstance(application, object : CameraTorchListener { SleepTimer.timeLeft
override fun onTorchEnabled(isEnabled: Boolean) { .onEach { seconds ->
camera.onTorchEnabled(isEnabled) _timerText.value = seconds.getFormattedDuration()
if (isEnabled && camera.supportsBrightnessControl()) { _timerVisible.value = true
_brightnessBarValue.value = camera.getCurrentBrightnessLevel().toFloat() / camera.getMaximumBrightnessLevel()
if (seconds == 0) {
exitProcess(0)
} }
} }
.launchIn(viewModelScope)
override fun onTorchUnavailable() { MyCameraImpl.cameraError
camera.onCameraNotAvailable() .onEach { getApplication<Application>().toast(R.string.camera_error) }
} .launchIn(viewModelScope)
})
if (preferences.turnFlashlightOn) {
camera.enableFlashlight()
}
_stroboscopeBarValue.value = preferences.stroboscopeProgress.toFloat() / MAX_STROBO_DELAY camera.stroboscopeDisabled
} .onEach { _stroboscopeActive.value = false }
.launchIn(viewModelScope)
@Subscribe(threadMode = ThreadMode.MAIN) camera.sosDisabled
fun sleepTimerChanged(event: Events.SleepTimerChanged) { .onEach { _sosActive.value = false }
_timerText.value = event.seconds.getFormattedDuration() .launchIn(viewModelScope)
_timerVisible.value = true
if (event.seconds == 0) {
exitProcess(0)
}
} }
fun hideTimer() { fun hideTimer() {
@ -412,7 +417,6 @@ class MainActivity : ComponentActivity() {
} }
fun onResume() { fun onResume() {
checkState(MyCameraImpl.isFlashlightOn)
camera.handleCameraSetup() camera.handleCameraSetup()
if (preferences.turnFlashlightOn) { if (preferences.turnFlashlightOn) {
@ -428,34 +432,8 @@ class MainActivity : ComponentActivity() {
} }
} }
private fun checkState(isEnabled: Boolean) {
_flashlightOn.value = isEnabled
}
@Subscribe
fun stateChangedEvent(event: Events.StateChanged) {
checkState(event.isEnabled)
}
@Subscribe
fun stopStroboscope(event: Events.StopStroboscope) {
_stroboscopeActive.value = false
}
@Subscribe
fun stopSOS(event: Events.StopSOS) {
_sosActive.value = false
}
@Subscribe
fun cameraUnavailable(event: Events.CameraUnavailable) {
getApplication<Application>().toast(R.string.camera_error)
_flashlightOn.value = false
}
override fun onCleared() { override fun onCleared() {
super.onCleared() super.onCleared()
EventBus.getDefault().unregister(this)
releaseCamera() releaseCamera()
} }

View File

@ -7,8 +7,9 @@ import android.os.Handler
import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.helpers.isTiramisuPlus import com.simplemobiletools.commons.helpers.isTiramisuPlus
import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.models.Events import kotlinx.coroutines.CoroutineScope
import org.greenrobot.eventbus.EventBus import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
internal class CameraFlash( internal class CameraFlash(
private val context: Context, private val context: Context,
@ -17,6 +18,8 @@ internal class CameraFlash(
private val manager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager private val manager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager
private val cameraId: String private val cameraId: String
private val scope = CoroutineScope(Dispatchers.Default)
private val torchCallback = object : CameraManager.TorchCallback() { private val torchCallback = object : CameraManager.TorchCallback() {
override fun onTorchModeChanged(cameraId: String, enabled: Boolean) { override fun onTorchModeChanged(cameraId: String, enabled: Boolean) {
cameraTorchListener?.onTorchEnabled(enabled) cameraTorchListener?.onTorchEnabled(enabled)
@ -46,10 +49,9 @@ internal class CameraFlash(
} }
} catch (e: Exception) { } catch (e: Exception) {
context.showErrorToast(e) context.showErrorToast(e)
val mainRunnable = Runnable { scope.launch {
EventBus.getDefault().post(Events.CameraUnavailable()) MyCameraImpl.cameraError.emit(Unit)
} }
Handler(context.mainLooper).post(mainRunnable)
} }
} }

View File

@ -7,8 +7,13 @@ import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.R
import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.extensions.updateWidgets import com.simplemobiletools.flashlight.extensions.updateWidgets
import com.simplemobiletools.flashlight.models.Events import kotlinx.coroutines.CoroutineScope
import org.greenrobot.eventbus.EventBus import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
class MyCameraImpl private constructor(val context: Context, private var cameraTorchListener: CameraTorchListener? = null) { class MyCameraImpl private constructor(val context: Context, private var cameraTorchListener: CameraTorchListener? = null) {
var stroboFrequency = 1000L var stroboFrequency = 1000L
@ -35,9 +40,13 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
@Volatile @Volatile
private var isSOSRunning = false private var isSOSRunning = false
val cameraError = MutableSharedFlow<Unit>()
fun newInstance(context: Context, cameraTorchListener: CameraTorchListener? = null) = MyCameraImpl(context, cameraTorchListener) fun newInstance(context: Context, cameraTorchListener: CameraTorchListener? = null) = MyCameraImpl(context, cameraTorchListener)
} }
private val scope = CoroutineScope(Dispatchers.Default)
private val cameraFlash: CameraFlash? private val cameraFlash: CameraFlash?
get() { get() {
if (MyCameraImpl.cameraFlash == null) { if (MyCameraImpl.cameraFlash == null) {
@ -51,6 +60,15 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
stroboFrequency = context.config.stroboscopeFrequency stroboFrequency = context.config.stroboscopeFrequency
} }
private val _flashlightOn = MutableStateFlow(false)
val flashlightOnFlow = _flashlightOn.asStateFlow()
private val _sosDisabled = MutableSharedFlow<Unit>()
val sosDisabled = _sosDisabled.asSharedFlow()
private val _stroboscopeDisabled = MutableSharedFlow<Unit>()
val stroboscopeDisabled = _stroboscopeDisabled.asSharedFlow()
fun toggleFlashlight() { fun toggleFlashlight() {
isFlashlightOn = !isFlashlightOn isFlashlightOn = !isFlashlightOn
checkFlashlight() checkFlashlight()
@ -89,7 +107,9 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
fun stopStroboscope() { fun stopStroboscope() {
shouldStroboscopeStop = true shouldStroboscopeStop = true
EventBus.getDefault().post(Events.StopStroboscope()) scope.launch {
_stroboscopeDisabled.emit(Unit)
}
} }
fun toggleSOS(): Boolean { fun toggleSOS(): Boolean {
@ -129,7 +149,9 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
fun stopSOS() { fun stopSOS() {
shouldStroboscopeStop = true shouldStroboscopeStop = true
EventBus.getDefault().post(Events.StopSOS()) scope.launch {
_sosDisabled.emit(Unit)
}
} }
private fun tryInitCamera(): Boolean { private fun tryInitCamera(): Boolean {
@ -146,8 +168,13 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
if (MyCameraImpl.cameraFlash == null) { if (MyCameraImpl.cameraFlash == null) {
MyCameraImpl.cameraFlash = CameraFlash(context, cameraTorchListener) MyCameraImpl.cameraFlash = CameraFlash(context, cameraTorchListener)
} }
scope.launch {
_flashlightOn.emit(isFlashlightOn)
}
} catch (e: Exception) { } catch (e: Exception) {
EventBus.getDefault().post(Events.CameraUnavailable()) scope.launch {
cameraError.emit(Unit)
}
} }
} }
@ -209,7 +236,9 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
private fun stateChanged(isEnabled: Boolean) { private fun stateChanged(isEnabled: Boolean) {
isFlashlightOn = isEnabled isFlashlightOn = isEnabled
EventBus.getDefault().post(Events.StateChanged(isEnabled)) scope.launch {
_flashlightOn.emit(isEnabled)
}
context.updateWidgets(isEnabled) context.updateWidgets(isEnabled)
} }
@ -276,10 +305,14 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
shouldStroboscopeStop = false shouldStroboscopeStop = false
if (isStroboSOS) { if (isStroboSOS) {
isSOSRunning = false isSOSRunning = false
EventBus.getDefault().post(Events.StopSOS()) scope.launch {
_sosDisabled.emit(Unit)
}
} else { } else {
isStroboscopeRunning = false isStroboscopeRunning = false
EventBus.getDefault().post(Events.StopStroboscope()) scope.launch {
_stroboscopeDisabled.emit(Unit)
}
} }
when { when {

View File

@ -7,23 +7,51 @@ import android.content.Intent
import android.os.CountDownTimer import android.os.CountDownTimer
import com.simplemobiletools.commons.helpers.isSPlus import com.simplemobiletools.commons.helpers.isSPlus
import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.extensions.config
import com.simplemobiletools.flashlight.models.Events import kotlinx.coroutines.CoroutineScope
import org.greenrobot.eventbus.EventBus import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.launch
import kotlin.system.exitProcess import kotlin.system.exitProcess
private var isActive = false object SleepTimer {
private var sleepTimer: CountDownTimer? = null private var sleepTimer: CountDownTimer? = null
private val _timeLeft = MutableSharedFlow<Int>()
val timeLeft = _timeLeft.asSharedFlow()
private val scope = CoroutineScope(Dispatchers.Default)
internal fun Context.toggleSleepTimer() { fun cancel() {
if (isActive) { sleepTimer?.cancel()
stopSleepTimerCountDown() sleepTimer = null
} else { }
startSleepTimerCountDown()
context(Context)
fun startTimer() {
val millisInFuture = config.sleepInTS - System.currentTimeMillis() + 1000L
sleepTimer?.cancel()
sleepTimer = object : CountDownTimer(millisInFuture, 1000) {
override fun onTick(millisUntilFinished: Long) {
val seconds = (millisUntilFinished / 1000).toInt()
scope.launch {
_timeLeft.emit(seconds)
}
}
override fun onFinish() {
config.sleepInTS = 0
scope.launch {
_timeLeft.emit(0)
}
stopSleepTimerCountDown()
exitProcess(0)
}
}
sleepTimer?.start()
} }
} }
internal fun Context.startSleepTimerCountDown() { internal fun Context.startSleepTimerCountDown() {
val millisInFuture = config.sleepInTS - System.currentTimeMillis() + 1000L
(getSystemService(Context.ALARM_SERVICE) as AlarmManager).apply { (getSystemService(Context.ALARM_SERVICE) as AlarmManager).apply {
if (!isSPlus() || canScheduleExactAlarms()) { if (!isSPlus() || canScheduleExactAlarms()) {
setExactAndAllowWhileIdle( setExactAndAllowWhileIdle(
@ -39,30 +67,12 @@ internal fun Context.startSleepTimerCountDown() {
) )
} }
} }
sleepTimer?.cancel() SleepTimer.startTimer()
sleepTimer = object : CountDownTimer(millisInFuture, 1000) {
override fun onTick(millisUntilFinished: Long) {
val seconds = (millisUntilFinished / 1000).toInt()
EventBus.getDefault().post(Events.SleepTimerChanged(seconds))
}
override fun onFinish() {
config.sleepInTS = 0
EventBus.getDefault().post(Events.SleepTimerChanged(0))
stopSleepTimerCountDown()
exitProcess(0)
}
}
sleepTimer?.start()
isActive = true
} }
internal fun Context.stopSleepTimerCountDown() { internal fun Context.stopSleepTimerCountDown() {
(getSystemService(Context.ALARM_SERVICE) as AlarmManager).cancel(getShutDownPendingIntent()) (getSystemService(Context.ALARM_SERVICE) as AlarmManager).cancel(getShutDownPendingIntent())
sleepTimer?.cancel() SleepTimer.cancel()
sleepTimer = null
isActive = false
config.sleepInTS = 0 config.sleepInTS = 0
} }

View File

@ -1,13 +0,0 @@
package com.simplemobiletools.flashlight.models
class Events {
class StateChanged(val isEnabled: Boolean)
class CameraUnavailable
class StopStroboscope
class StopSOS
class SleepTimerChanged(val seconds: Int)
}

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/config_torch_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/config_torch_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/config_torch_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/config_widget_color"
android:layout_marginBottom="@dimen/activity_margin"
android:gravity="center">
<ImageView
android:id="@+id/config_image"
android:layout_width="@dimen/main_button_size"
android:layout_height="@dimen/main_button_size"
android:background="@drawable/ic_flashlight_vector" />
</RelativeLayout>
<ImageView
android:id="@+id/config_widget_color"
android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size"
android:layout_above="@+id/config_save"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout
android:id="@+id/config_widget_seekbar_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/config_widget_color"
android:layout_alignBottom="@+id/config_widget_color"
android:layout_marginStart="@dimen/medium_margin"
android:layout_toEndOf="@+id/config_widget_color"
android:background="@drawable/widget_config_seekbar_background">
<com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_widget_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout>
<Button
android:id="@+id/config_save"
style="@style/MyWidgetConfigSaveStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/tiny_margin"
android:text="@string/ok" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -2,12 +2,9 @@
#jetbrains #jetbrains
kotlin = "1.9.10" kotlin = "1.9.10"
#AndroidX #AndroidX
androidx-constraintlayout = "2.1.4"
androidx-customView = "1.2.0-alpha02" androidx-customView = "1.2.0-alpha02"
androidx-customViewPooling = "1.0.0" androidx-customViewPooling = "1.0.0"
androidx-lifecycle = "2.7.0-alpha02" androidx-lifecycle = "2.7.0-alpha02"
#EventBus
eventbusVersion = "3.3.1"
#Simple tools #Simple tools
simple-commons = "b7dd6ad428" simple-commons = "b7dd6ad428"
#Compose #Compose
@ -29,7 +26,6 @@ app-version-versionCode = "65"
app-version-versionName = "5.10.0" app-version-versionName = "5.10.0"
[libraries] [libraries]
#AndroidX #AndroidX
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-customView = { module = "androidx.customview:customview", version.ref = "androidx-customView" } androidx-customView = { module = "androidx.customview:customview", version.ref = "androidx-customView" }
androidx-customViewPooling = { module = "androidx.customview:customview-poolingcontainer", version.ref = "androidx-customViewPooling" } androidx-customViewPooling = { module = "androidx.customview:customview-poolingcontainer", version.ref = "androidx-customViewPooling" }
#Android X lifecycle #Android X lifecycle
@ -37,8 +33,6 @@ androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-kt
androidx-lifecycle-viewModel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewModel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewModel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewModel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } androidx-lifecycle-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
#EventBus
eventbus = { module = "org.greenrobot:eventbus", version.ref = "eventbusVersion" }
#Simple Mobile Tools #Simple Mobile Tools
simple-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons", version.ref = "simple-commons" } simple-tools-commons = { module = "com.github.SimpleMobileTools:Simple-Commons", version.ref = "simple-commons" }
#Compose #Compose