adding some widget config related improvements

This commit is contained in:
tibbi 2022-04-25 22:44:58 +02:00
parent 124ba79c05
commit 1d25512053
5 changed files with 26 additions and 18 deletions

View file

@ -77,7 +77,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:63a9866b86' implementation 'com.github.SimpleMobileTools:Simple-Commons:c8c3073668'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'

View file

@ -301,7 +301,8 @@
<receiver <receiver
android:name=".helpers.MyWidgetProvider" android:name=".helpers.MyWidgetProvider"
android:exported="true" android:exported="true"
android:icon="@drawable/img_widget_preview"> android:icon="@drawable/img_widget_preview"
android:label="@string/folder">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </intent-filter>

View file

@ -48,6 +48,13 @@ class WidgetConfigureActivity : SimpleActivity() {
config_text_color.setOnClickListener { pickTextColor() } config_text_color.setOnClickListener { pickTextColor() }
folder_picker_value.setOnClickListener { changeSelectedFolder() } folder_picker_value.setOnClickListener { changeSelectedFolder() }
config_image_holder.setOnClickListener { changeSelectedFolder() } config_image_holder.setOnClickListener { changeSelectedFolder() }
updateTextColors(folder_picker_holder)
val primaryColor = getProperPrimaryColor()
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
config_save.setTextColor(mTextColor)
folder_picker_holder.background = ColorDrawable(getProperBackgroundColor())
folder_picker_show_folder_name.isChecked = config.showWidgetFolderName folder_picker_show_folder_name.isChecked = config.showWidgetFolderName
handleFolderNameDisplay() handleFolderNameDisplay()
folder_picker_show_folder_name_holder.setOnClickListener { folder_picker_show_folder_name_holder.setOnClickListener {
@ -55,9 +62,6 @@ class WidgetConfigureActivity : SimpleActivity() {
handleFolderNameDisplay() handleFolderNameDisplay()
} }
updateTextColors(folder_picker_holder)
folder_picker_holder.background = ColorDrawable(getProperBackgroundColor())
getCachedDirectories(false, false) { getCachedDirectories(false, false) {
mDirectories = it mDirectories = it
val path = it.firstOrNull()?.path val path = it.firstOrNull()?.path
@ -122,15 +126,13 @@ class WidgetConfigureActivity : SimpleActivity() {
private fun updateBackgroundColor() { private fun updateBackgroundColor() {
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha) mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
config_save.setBackgroundColor(mBgColor)
config_image_holder.setBackgroundColor(mBgColor) config_image_holder.setBackgroundColor(mBgColor)
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK) config_bg_color.setFillWithStroke(mBgColor, mBgColor)
} }
private fun updateTextColor() { private fun updateTextColor() {
config_save.setTextColor(mTextColor)
config_folder_name.setTextColor(mTextColor) config_folder_name.setTextColor(mTextColor)
config_text_color.setFillWithStroke(mTextColor, Color.BLACK) config_text_color.setFillWithStroke(mTextColor, mTextColor)
} }
private fun pickBackgroundColor() { private fun pickBackgroundColor() {

View file

@ -84,7 +84,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_save" /> 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"
@ -92,35 +93,40 @@
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:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" /> android:paddingRight="@dimen/activity_margin" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
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="@dimen/widget_colorpicker_size" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="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:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:text="@string/ok" android:text="@string/ok"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textFontWeight="400"
android:textSize="@dimen/big_text_size" /> android:textSize="@dimen/big_text_size" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<appwidget-provider <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="com.simplemobiletools.gallery.pro.activities.WidgetConfigureActivity" android:configure="com.simplemobiletools.gallery.pro.activities.WidgetConfigureActivity"
android:initialLayout="@layout/widget" android:initialLayout="@layout/widget"
android:previewImage="@drawable/img_widget_preview"
android:minWidth="@dimen/widget_initial_size" android:minWidth="@dimen/widget_initial_size"
android:minHeight="40dp" android:minHeight="40dp"
android:minResizeWidth="40dp" android:minResizeWidth="40dp"
android:minResizeHeight="40dp" android:minResizeHeight="40dp"
android:resizeMode="horizontal|vertical"/> android:previewImage="@drawable/img_widget_preview"
android:resizeMode="horizontal|vertical" />