Skip to content

Commit 8d956a5

Browse files
Merge pull request #3026 from nextcloud/fix/widget-content
fix(widget): content color
2 parents fd410df + e57a7f6 commit 8d956a5

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: Build debug APK
7575
run: bash ./gradlew assembleDev --stacktrace --no-configuration-cache
7676
- name: Upload APK
77-
uses: actions/upload-artifact@v6
77+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
7878
with:
7979
name: app-dev-debug
8080
path: app/build/outputs/apk/dev/debug/app-dev-debug.apk

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import android.util.Log
1414
import android.view.View
1515
import android.widget.RemoteViews
1616
import android.widget.RemoteViewsService.RemoteViewsFactory
17+
import androidx.core.content.ContextCompat
1718
import androidx.core.net.toUri
19+
import com.nextcloud.android.common.ui.util.PlatformThemeUtil
1820
import it.niedermann.owncloud.notes.R
1921
import it.niedermann.owncloud.notes.edit.EditNoteActivity
2022
import it.niedermann.owncloud.notes.persistence.NotesRepository
@@ -148,6 +150,14 @@ class NoteListWidgetFactory internal constructor(private val context: Context, i
148150
} else {
149151
setViewVisibility(R.id.widget_entry_category, View.VISIBLE)
150152
setTextViewText(R.id.widget_entry_category, note.category)
153+
154+
val textColorId = if (PlatformThemeUtil.isDarkMode(context)) {
155+
R.color.text_color
156+
} else {
157+
R.color.category_border
158+
}
159+
val textColor = ContextCompat.getColor(context, textColorId)
160+
setTextColor(R.id.widget_entry_category, textColor)
151161
}
152162

153163
val starIconId = if (note.favorite) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!--
2+
~ Nextcloud Notes - Android Client
3+
~
4+
~ SPDX-FileCopyrightText: 2017-2026 Nextcloud GmbH and Nextcloud contributors
5+
~ SPDX-FileCopyrightText: 2017-2026 Alper Ozturk <alper.ozturk@nextcloud.com>
6+
~ SPDX-License-Identifier: GPL-3.0-or-later
7+
-->
8+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
9+
android:shape="rectangle">
10+
<solid android:color="@color/category_widget_background" />
11+
<stroke
12+
android:width="1dip"
13+
android:color="@color/category_border" />
14+
<corners android:radius="8dp" />
15+
</shape>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
android:layout_gravity="center_vertical"
4646
android:paddingHorizontal="8dp"
4747
android:paddingVertical="4dp"
48-
android:background="@drawable/border"
48+
android:background="@drawable/category_widget_background"
4949
android:textSize="12sp"
50-
android:textColor="@color/category_border"
5150
android:gravity="center"
5251
android:visibility="gone"
5352
tools:visibility="visible"

app/src/main/res/values-night/colors.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@
4242
<color name="action_mode_background">#1E1E1E</color>
4343
<color name="fontAppbar">@android:color/white</color>
4444
<color name="primary_button_text_color">#000000</color>
45+
46+
<color name="category_widget_background">@color/material_dynamic_secondary20</color>
47+
<color name="category_border">@color/transparent</color>
4548
</resources>

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@
5757
<color name="online">#2D7B41</color>
5858
<color name="busy">#DB0606</color>
5959
<color name="offline">@color/high_emphasis_text</color>
60+
61+
<color name="category_widget_background">@color/transparent</color>
6062
</resources>

0 commit comments

Comments
 (0)