Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 93ee1b54 authored by alperozturk's avatar alperozturk
Browse files

fix category

parent a41ac3b8
Loading
Loading
Loading
Loading
+1 −21
Original line number Original line Diff line number Diff line
@@ -133,8 +133,6 @@ class NoteListWidgetFactory internal constructor(private val context: Context, i
            createNoteIntent = getCreateNoteIntent(localAccount)
            createNoteIntent = getCreateNoteIntent(localAccount)
        }
        }


        val category = getCategoryTitle(context)

        return RemoteViews(context.packageName, R.layout.widget_entry).apply {
        return RemoteViews(context.packageName, R.layout.widget_entry).apply {
            setOnClickFillInIntent(R.id.widget_note_list_entry, openNoteIntent)
            setOnClickFillInIntent(R.id.widget_note_list_entry, openNoteIntent)


@@ -142,11 +140,7 @@ class NoteListWidgetFactory internal constructor(private val context: Context, i
                setOnClickFillInIntent(R.id.widget_entry_fav_icon, createNoteIntent)
                setOnClickFillInIntent(R.id.widget_entry_fav_icon, createNoteIntent)
            }
            }


            if (category != null) {
            setTextViewText(R.id.widget_entry_content_tv, (note.title + data?.category))
                setTextViewText(R.id.widget_entry_content_tv, category)
            } else {
                setTextViewText(R.id.widget_entry_content_tv, note.title)
            }


            val starIconId = if (note.favorite) {
            val starIconId = if (note.favorite) {
                R.drawable.ic_star_yellow_24dp
                R.drawable.ic_star_yellow_24dp
@@ -157,20 +151,6 @@ class NoteListWidgetFactory internal constructor(private val context: Context, i
        }
        }
    }
    }


    private fun getCategoryTitle(context: Context): String? {
        val widgetData = data ?: return null

        return when (widgetData.mode) {
            NotesListWidgetData.MODE_DISPLAY_STARRED -> context.getString(R.string.label_favorites)
            NotesListWidgetData.MODE_DISPLAY_CATEGORY -> if ("" == widgetData.category)
                context.getString(R.string.action_uncategorized)
            else
                widgetData.category

            else -> context.getString(R.string.app_name)
        }
    }

    override fun getLoadingView(): RemoteViews? {
    override fun getLoadingView(): RemoteViews? {
        return null
        return null
    }
    }