fix(home-widget): update default image caption & rename totalMemories

This commit is contained in:
Prateek Sunal
2025-05-16 15:07:45 +05:30
parent 9b1eacf736
commit a518bbd608
8 changed files with 24 additions and 24 deletions

View File

@@ -32,13 +32,13 @@ class EnteAlbumsWidgetProvider : HomeWidgetProvider() {
val views =
RemoteViews(context.packageName, R.layout.albums_widget_layout)
.apply {
val totalMemories =
widgetData.getInt("totalMemories", 0)
val totalAlbums =
widgetData.getInt("totalAlbums", 0)
var randomNumber = -1
var imagePath: String? = null
if (totalMemories > 0) {
if (totalAlbums > 0) {
randomNumber =
(0 until totalMemories!!).random()
(0 until totalAlbums!!).random()
imagePath =
widgetData.getString(
"albums_widget_" +

View File

@@ -32,13 +32,13 @@ class EntePeopleWidgetProvider : HomeWidgetProvider() {
val views =
RemoteViews(context.packageName, R.layout.people_widget_layout)
.apply {
val totalMemories =
widgetData.getInt("totalMemories", 0)
val totalPeople =
widgetData.getInt("totalPeople", 0)
var randomNumber = -1
var imagePath: String? = null
if (totalMemories > 0) {
if (totalPeople > 0) {
randomNumber =
(0 until totalMemories!!).random()
(0 until totalPeople!!).random()
imagePath =
widgetData.getString(
"people_widget_" +

View File

@@ -72,7 +72,7 @@
android:id="@+id/widget_placeholder_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your albums will appear here"
android:text="Go to Settings->General to customise the widget"
android:textSize="14sp"
android:gravity="center_horizontal"
android:textColor="@color/widget_text_color"

View File

@@ -72,7 +72,7 @@
android:id="@+id/widget_placeholder_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your memories will appear here"
android:text="Go to Settings->General to customise the widget"
android:textSize="14sp"
android:gravity="center_horizontal"
android:textColor="@color/widget_text_color"

View File

@@ -72,7 +72,7 @@
android:id="@+id/widget_placeholder_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="People related photos will appear here"
android:text="Go to Settings->General to customise the widget"
android:textSize="14sp"
android:gravity="center_horizontal"
android:textColor="@color/widget_text_color"

View File

@@ -39,13 +39,13 @@ struct Provider: TimelineProvider {
direction: .backward
)!
var totalMemories =
data?.integer(forKey: "totalMemories")
var totalAlbums =
data?.integer(forKey: "totalAlbums")
if totalMemories != nil && totalMemories! > 0 {
let count = totalMemories! > 5 ? 5 : totalMemories
if totalAlbums != nil && totalAlbums! > 0 {
let count = totalAlbums! > 5 ? 5 : totalAlbums
for offset in 0..<count! {
let randomInt = Int.random(in: 0..<totalMemories!)
let randomInt = Int.random(in: 0..<totalAlbums!)
let entryDate = Calendar.current.date(
byAdding: .minute, value: minutes * offset, to: currentDate
)!
@@ -189,7 +189,7 @@ struct EnteAlbumWidgetEntryView: View {
.aspectRatio(contentMode: .fit)
.padding(8)
Text("Your albums will appear here")
Text("Go to Settings->General to customise the widget")
.font(.custom("Inter", size: 14, relativeTo: .caption))
.foregroundStyle(.white) // Tint-aware color
.multilineTextAlignment(.center)

View File

@@ -190,7 +190,7 @@ struct EnteMemoryWidgetEntryView: View {
.aspectRatio(contentMode: .fit)
.padding(8)
Text("Your memories will appear here")
Text("Go to Settings->General to customise the widget")
.font(.custom("Inter", size: 14, relativeTo: .caption))
.foregroundStyle(.white) // Tint-aware color
.multilineTextAlignment(.center)

View File

@@ -39,13 +39,13 @@ struct Provider: TimelineProvider {
direction: .backward
)!
var totalMemories =
data?.integer(forKey: "totalMemories")
var totalPeople =
data?.integer(forKey: "totalPeople")
if totalMemories != nil && totalMemories! > 0 {
let count = totalMemories! > 5 ? 5 : totalMemories
if totalPeople != nil && totalPeople! > 0 {
let count = totalPeople! > 5 ? 5 : totalPeople
for offset in 0..<count! {
let randomInt = Int.random(in: 0..<totalMemories!)
let randomInt = Int.random(in: 0..<totalPeople!)
let entryDate = Calendar.current.date(
byAdding: .minute, value: minutes * offset, to: currentDate
)!
@@ -189,7 +189,7 @@ struct EntePeopleWidgetEntryView: View {
.aspectRatio(contentMode: .fit)
.padding(8)
Text("See People you wish to appear here")
Text("Go to Settings->General to customise the widget")
.font(.custom("Inter", size: 14, relativeTo: .caption))
.foregroundStyle(.white) // Tint-aware color
.multilineTextAlignment(.center)