mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
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.RequestOptions
|
||||||
import com.bumptech.glide.request.target.AppWidgetTarget
|
import com.bumptech.glide.request.target.AppWidgetTarget
|
||||||
import com.simplemobiletools.commons.extensions.setBackgroundColor
|
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.R
|
||||||
import com.simplemobiletools.gallery.pro.activities.MediaActivity
|
import com.simplemobiletools.gallery.pro.activities.MediaActivity
|
||||||
import com.simplemobiletools.gallery.pro.extensions.config
|
import com.simplemobiletools.gallery.pro.extensions.*
|
||||||
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.models.Widget
|
import com.simplemobiletools.gallery.pro.models.Widget
|
||||||
|
|
||||||
class MyWidgetProvider : AppWidgetProvider() {
|
class MyWidgetProvider : AppWidgetProvider() {
|
||||||
|
@ -36,8 +35,12 @@ class MyWidgetProvider : AppWidgetProvider() {
|
||||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||||
Thread {
|
Thread {
|
||||||
context.widgetsDB.getWidgets().forEach {
|
context.widgetsDB.getWidgets().forEach {
|
||||||
val views = RemoteViews(context.packageName, R.layout.widget)
|
val views = RemoteViews(context.packageName, R.layout.widget).apply {
|
||||||
views.setBackgroundColor(R.id.widget_holder, context.config.widgetBgColor)
|
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 path = context.directoryDB.getDirectoryThumbnail(it.folderPath)
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
|
|
|
@ -12,4 +12,16 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:src="@mipmap/ic_launcher"/>
|
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>
|
</RelativeLayout>
|
||||||
|
|
Loading…
Reference in a new issue