adding some widget config related code style tweaks
This commit is contained in:
parent
a198b1f65d
commit
c8530ea110
3 changed files with 20 additions and 31 deletions
|
@ -58,7 +58,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.28.3'
|
||||
implementation 'com.simplemobiletools:commons:5.28.24'
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'androidx.media:media:1.1.0'
|
||||
|
|
|
@ -6,10 +6,10 @@ import android.content.Intent
|
|||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.onSeekBarChangeListener
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import com.simplemobiletools.musicplayer.R
|
||||
|
@ -22,11 +22,11 @@ import kotlinx.android.synthetic.main.widget_config.*
|
|||
import kotlinx.android.synthetic.main.widget_controls.*
|
||||
|
||||
class WidgetConfigureActivity : SimpleActivity() {
|
||||
private var mBgAlpha = 0.0f
|
||||
private var mBgAlpha = 0f
|
||||
private var mWidgetId = 0
|
||||
private var mBgColor = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mTextColor = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
|
@ -58,9 +58,12 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
config_bg_seekbar.setOnSeekBarChangeListener(seekbarChangeListener)
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBackgroundColor()
|
||||
config_bg_seekbar.onSeekBarChangeListener {
|
||||
mBgAlpha = it / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
mTextColor = config.widgetTextColor
|
||||
updateTextColor()
|
||||
|
@ -138,15 +141,4 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val seekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
mBgAlpha = progress.toFloat() / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
@ -12,23 +11,22 @@
|
|||
layout="@layout/widget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:layout_marginTop="@dimen/activity_margin"/>
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:layout_marginBottom="@dimen/activity_margin" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_bg_color"
|
||||
android:layout_width="@dimen/widget_colorpicker_size"
|
||||
android:layout_height="@dimen/widget_colorpicker_size"
|
||||
android:layout_above="@+id/config_text_color"/>
|
||||
android:layout_above="@+id/config_text_color" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_bg_seekbar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignBottom="@+id/config_bg_color"
|
||||
android:layout_alignTop="@+id/config_bg_color"
|
||||
android:layout_alignBottom="@+id/config_bg_color"
|
||||
android:layout_toEndOf="@+id/config_bg_color"
|
||||
android:layout_toRightOf="@+id/config_bg_color"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<SeekBar
|
||||
|
@ -36,28 +34,27 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"/>
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_text_color"
|
||||
android:layout_width="@dimen/widget_colorpicker_size"
|
||||
android:layout_height="@dimen/widget_colorpicker_size"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/config_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/config_text_color"
|
||||
android:layout_alignBottom="@+id/config_text_color"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@+id/config_text_color"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/big_text_size"/>
|
||||
android:textSize="@dimen/big_text_size" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue