show the folder name on the widget too, if selected so
This commit is contained in:
parent
5a330ece55
commit
fcde3beba1
2 changed files with 21 additions and 6 deletions
|
@ -14,12 +14,11 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.AppWidgetTarget
|
||||
import com.simplemobiletools.commons.extensions.setBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setText
|
||||
import com.simplemobiletools.commons.extensions.setVisibleIf
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.activities.MediaActivity
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import com.simplemobiletools.gallery.pro.extensions.directoryDB
|
||||
import com.simplemobiletools.gallery.pro.extensions.getFileSignature
|
||||
import com.simplemobiletools.gallery.pro.extensions.widgetsDB
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.models.Widget
|
||||
|
||||
class MyWidgetProvider : AppWidgetProvider() {
|
||||
|
@ -36,8 +35,12 @@ class MyWidgetProvider : AppWidgetProvider() {
|
|||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
Thread {
|
||||
context.widgetsDB.getWidgets().forEach {
|
||||
val views = RemoteViews(context.packageName, R.layout.widget)
|
||||
views.setBackgroundColor(R.id.widget_holder, context.config.widgetBgColor)
|
||||
val views = RemoteViews(context.packageName, R.layout.widget).apply {
|
||||
setBackgroundColor(R.id.widget_holder, context.config.widgetBgColor)
|
||||
setVisibleIf(R.id.widget_folder_name, context.config.showWidgetFolderName)
|
||||
setTextColor(R.id.widget_folder_name, context.config.widgetTextColor)
|
||||
setText(R.id.widget_folder_name, context.getFolderNameFromPath(it.folderPath))
|
||||
}
|
||||
|
||||
val path = context.directoryDB.getDirectoryThumbnail(it.folderPath)
|
||||
val options = RequestOptions()
|
||||
|
|
|
@ -12,4 +12,16 @@
|
|||
android:layout_height="wrap_content"
|
||||
tools:src="@mipmap/ic_launcher"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_folder_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/widget_imageview"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:lines="1"
|
||||
android:padding="@dimen/tiny_margin"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
tools:text="@string/internal"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue