mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-23 03:50:07 +01:00
use rounded corners at the widget background
This commit is contained in:
parent
b48e3432df
commit
ae0ac64278
@ -57,7 +57,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.26.8'
|
||||
implementation 'com.simplemobiletools:commons:5.26.9'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||
|
||||
kapt 'androidx.room:room-compiler:2.2.5'
|
||||
|
@ -78,12 +78,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
mTextColor = extras?.getInt(CUSTOMIZED_WIDGET_TEXT_COLOR) ?: config.widgetTextColor
|
||||
}
|
||||
|
||||
if (mBgColor == 1) {
|
||||
mBgColor = Color.BLACK
|
||||
mBgAlpha = .2f
|
||||
} else {
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255f
|
||||
}
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
config_bg_seekbar.apply {
|
||||
|
@ -7,8 +7,8 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.widget.RemoteViews
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.getLaunchIntent
|
||||
import com.simplemobiletools.commons.extensions.setBackgroundColor
|
||||
import com.simplemobiletools.commons.helpers.WIDGET_TEXT_COLOR
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.notes.pro.R
|
||||
@ -31,7 +31,7 @@ class MyWidgetProvider : AppWidgetProvider() {
|
||||
for (widgetId in appWidgetIds) {
|
||||
val widget = context.widgetsDB.getWidgetWithWidgetId(widgetId) ?: continue
|
||||
val views = RemoteViews(context.packageName, R.layout.widget)
|
||||
views.setBackgroundColor(R.id.notes_widget_holder, widget.widgetBgColor)
|
||||
views.applyColorFilter(R.id.notes_widget_background, widget.widgetBgColor)
|
||||
setupAppOpenIntent(context, views, R.id.notes_widget_holder, widget)
|
||||
|
||||
Intent(context, WidgetService::class.java).apply {
|
||||
@ -60,4 +60,4 @@ class MyWidgetProvider : AppWidgetProvider() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,23 @@
|
||||
<?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/notes_widget_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notes_widget_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/notes_widget_listview"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/notes_widget_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"/>
|
||||
android:divider="@null" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -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:id="@+id/widget_text_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -12,7 +11,7 @@
|
||||
android:background="@null"
|
||||
android:gravity="left"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_text_center"
|
||||
@ -21,7 +20,7 @@
|
||||
android:background="@null"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_text_right"
|
||||
@ -30,6 +29,6 @@
|
||||
android:background="@null"
|
||||
android:gravity="right"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user