Skip to content

Commit 58c9dfb

Browse files
alperozturk96backportbot[bot]
authored andcommitted
fix category
Signed-off-by: alperozturk <[email protected]>
1 parent f3832e8 commit 58c9dfb

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

app/src/main/java/it/niedermann/owncloud/notes/widget/notelist/NoteListWidgetFactory.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.content.Context
1111
import android.content.Intent
1212
import android.os.Bundle
1313
import android.util.Log
14+
import android.view.View
1415
import android.widget.RemoteViews
1516
import android.widget.RemoteViewsService.RemoteViewsFactory
1617
import androidx.core.net.toUri
@@ -140,7 +141,14 @@ class NoteListWidgetFactory internal constructor(private val context: Context, i
140141
setOnClickFillInIntent(R.id.widget_entry_fav_icon, createNoteIntent)
141142
}
142143

143-
setTextViewText(R.id.widget_entry_content_tv, (note.title + data?.category))
144+
setTextViewText(R.id.widget_entry_title, note.title)
145+
146+
if (note.category.isEmpty()) {
147+
setViewVisibility(R.id.widget_entry_category, View.GONE)
148+
} else {
149+
setViewVisibility(R.id.widget_entry_category, View.VISIBLE)
150+
setTextViewText(R.id.widget_entry_category, note.category)
151+
}
144152

145153
val starIconId = if (note.favorite) {
146154
R.drawable.ic_star_yellow_24dp

app/src/main/res/layout/widget_entry.xml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--
33
~ Nextcloud Notes - Android Client
44
~
5-
~ SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
5+
~ SPDX-FileCopyrightText: 2017-2025 Nextcloud GmbH and Nextcloud contributors
66
~ SPDX-License-Identifier: GPL-3.0-or-later
77
-->
88
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
@@ -12,6 +12,7 @@
1212
android:layout_width="match_parent"
1313
android:layout_height="wrap_content"
1414
android:orientation="horizontal"
15+
android:gravity="center"
1516
android:paddingVertical="@dimen/spacer_1x"
1617
android:paddingStart="@null"
1718
android:paddingEnd="@dimen/spacer_1hx">
@@ -22,24 +23,33 @@
2223
android:layout_height="@dimen/widget_note_list_fav_icon_height"
2324
android:layout_gravity="center_vertical"
2425
android:contentDescription="@string/widget_entry_fav_contentDescription"
25-
android:foregroundGravity="center_vertical"
2626
android:paddingStart="@dimen/widget_note_list_inner_padding"
2727
android:paddingEnd="@dimen/widget_note_list_outer_padding"
2828
app:srcCompat="@drawable/ic_star_yellow_24dp" />
2929

3030
<TextView
31-
android:id="@+id/widget_entry_content_tv"
31+
android:id="@+id/widget_entry_title"
3232
android:layout_width="0dp"
33-
android:layout_height="wrap_content"
34-
android:layout_gravity="center_vertical"
33+
android:layout_height="match_parent"
3534
android:layout_weight="1"
36-
android:ellipsize="end"
37-
android:gravity="center_vertical"
38-
android:lines="1"
39-
android:paddingStart="@dimen/widget_note_list_inner_padding"
40-
android:paddingEnd="@dimen/widget_note_list_outer_padding"
35+
android:layout_gravity="center_vertical"
36+
android:textStyle="bold"
4137
android:textColor="@color/widget_foreground"
4238
android:textSize="14sp"
43-
tools:text="@tools:sample/lorem/random" />
39+
tools:text="First note" />
4440

41+
<TextView
42+
android:id="@+id/widget_entry_category"
43+
android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:layout_gravity="center_vertical"
46+
android:paddingHorizontal="8dp"
47+
android:paddingVertical="4dp"
48+
android:background="@drawable/border"
49+
android:textSize="12sp"
50+
android:textColor="@color/category_border"
51+
android:gravity="center"
52+
android:visibility="gone"
53+
tools:visibility="visible"
54+
tools:text="Important"/>
4555
</LinearLayout>

0 commit comments

Comments
 (0)