adding some widget related improvements

This commit is contained in:
tibbi 2022-05-20 21:12:53 +02:00
parent 314d9b511d
commit 1956b270bc
8 changed files with 29 additions and 24 deletions

View file

@ -62,11 +62,11 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:11bb9a6377' implementation 'com.github.SimpleMobileTools:Simple-Commons:bc0d61dacb'
implementation 'me.grantland:autofittextview:0.2.1' implementation 'me.grantland:autofittextview:0.2.1'
implementation 'net.objecthunter:exp4j:0.4.8' implementation 'net.objecthunter:exp4j:0.4.8'
kapt 'androidx.room:room-compiler:2.3.0' kapt 'androidx.room:room-compiler:2.4.2'
implementation 'androidx.room:room-runtime:2.3.0' implementation 'androidx.room:room-runtime:2.4.2'
annotationProcessor 'androidx.room:room-compiler:2.3.0' annotationProcessor 'androidx.room:room-compiler:2.4.2'
} }

View file

@ -41,6 +41,9 @@ class WidgetConfigureActivity : SimpleActivity() {
config_save.setOnClickListener { saveConfig() } config_save.setOnClickListener { saveConfig() }
config_bg_color.setOnClickListener { pickBackgroundColor() } config_bg_color.setOnClickListener { pickBackgroundColor() }
config_text_color.setOnClickListener { pickTextColor() } config_text_color.setOnClickListener { pickTextColor() }
val primaryColor = getProperPrimaryColor()
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
} }
private fun initVariables() { private fun initVariables() {
@ -95,13 +98,11 @@ class WidgetConfigureActivity : SimpleActivity() {
private fun updateBackgroundColor() { private fun updateBackgroundColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha) mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
widget_background.applyColorFilter(mBgColor) widget_background.applyColorFilter(mBgColor)
config_save.setBackgroundColor(mBgColor) config_bg_color.setFillWithStroke(mBgColor, mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
} }
private fun updateTextColor() { private fun updateTextColor() {
config_text_color.setFillWithStroke(mTextColor, Color.BLACK) config_text_color.setFillWithStroke(mTextColor, mTextColor)
config_save.setTextColor(mTextColor)
val viewIds = intArrayOf( val viewIds = intArrayOf(
R.id.btn_0, R.id.btn_1, R.id.btn_2, R.id.btn_3, R.id.btn_4, R.id.btn_5, R.id.btn_6, R.id.btn_7, R.id.btn_8, R.id.btn_0, R.id.btn_1, R.id.btn_2, R.id.btn_3, R.id.btn_4, R.id.btn_5, R.id.btn_6, R.id.btn_7, R.id.btn_8,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?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:id="@+id/config_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_margin="@dimen/activity_margin" android:layout_margin="@dimen/activity_margin">
android:paddingBottom="@dimen/activity_margin">
<ImageView <ImageView
android:id="@+id/widget_background" android:id="@+id/widget_background"
@ -28,7 +28,8 @@
android:id="@+id/config_bg_color" android:id="@+id/config_bg_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@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"
android:layout_margin="@dimen/tiny_margin" />
<RelativeLayout <RelativeLayout
android:id="@+id/config_bg_seekbar_holder" android:id="@+id/config_bg_seekbar_holder"
@ -36,16 +37,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@+id/config_bg_color" android:layout_alignTop="@+id/config_bg_color"
android:layout_alignBottom="@+id/config_bg_color" android:layout_alignBottom="@+id/config_bg_color"
android:layout_marginStart="@dimen/medium_margin"
android:layout_toEndOf="@+id/config_bg_color" android:layout_toEndOf="@+id/config_bg_color"
android:background="@android:color/white"> android:background="@drawable/widget_config_seekbar_background">
<SeekBar <com.simplemobiletools.commons.views.MySeekBar
android:id="@+id/config_bg_seekbar" android:id="@+id/config_bg_seekbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" /> android:paddingEnd="@dimen/activity_margin" />
</RelativeLayout> </RelativeLayout>
@ -53,20 +55,22 @@
android:id="@+id/config_text_color" android:id="@+id/config_text_color"
android:layout_width="@dimen/widget_colorpicker_size" android:layout_width="@dimen/widget_colorpicker_size"
android:layout_height="@dimen/widget_colorpicker_size" android:layout_height="@dimen/widget_colorpicker_size"
android:layout_alignParentBottom="true" /> android:layout_alignParentBottom="true"
android:layout_margin="@dimen/tiny_margin" />
<Button <Button
android:id="@+id/config_save" android:id="@+id/config_save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_alignTop="@+id/config_text_color"
android:layout_alignBottom="@+id/config_text_color"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@drawable/widget_config_seekbar_background"
android:fontFamily="sans-serif-light" android:fontFamily="sans-serif-light"
android:paddingLeft="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:text="@string/ok" android:text="@string/ok"
android:textColor="@android:color/white" android:textColor="@color/dark_grey"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" /> android:textSize="@dimen/big_text_size" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.6.10' ext.kotlin_version = '1.6.21'
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.2' classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong