From 6b868fa82401fbacf48c0adbddefa27f1fc41323 Mon Sep 17 00:00:00 2001
From: TwistedUmbrellaX <1173913+AbandonedCart@users.noreply.github.com>
Date: Thu, 28 Mar 2024 18:39:04 -0400
Subject: [PATCH] fix: not meant to be quoted (#300)
* fix not meant to be quoted
* fix: thought he was slick
hiding in plain sight
* fix: it's not THAT important
* fix: flexible day / night borders
---
.../widgets/statistics/ProfileStatsWidget.kt | 10 +++----
.../drawable-night/widget_stats_rounded.xml | 27 +++++++++++++++++++
.../res/drawable/widget_stats_rounded.xml | 2 +-
app/src/main/res/values/strings.xml | 8 +++---
4 files changed, 36 insertions(+), 11 deletions(-)
create mode 100644 app/src/main/res/drawable-night/widget_stats_rounded.xml
diff --git a/app/src/main/java/ani/dantotsu/widgets/statistics/ProfileStatsWidget.kt b/app/src/main/java/ani/dantotsu/widgets/statistics/ProfileStatsWidget.kt
index 06202ea0..4cb5df0c 100644
--- a/app/src/main/java/ani/dantotsu/widgets/statistics/ProfileStatsWidget.kt
+++ b/app/src/main/java/ani/dantotsu/widgets/statistics/ProfileStatsWidget.kt
@@ -113,10 +113,8 @@ class ProfileStatsWidget : AppWidgetProvider() {
launchIO {
val userPref = PrefManager.getVal(PrefName.AnilistUserId, "")
- val userId = if (userPref.isNotEmpty()) userPref.toInt() else Anilist.userid
- ?: if (Anilist.query.getUserData()) Anilist.userid else null
- userId?.let {
- val respond = Anilist.query.getUserProfile(it)
+ if (userPref.isNotEmpty()) {
+ val respond = Anilist.query.getUserProfile(userPref.toInt())
respond?.data?.user?.let { user ->
withContext(Dispatchers.Main) {
val views = RemoteViews(context.packageName, R.layout.statistics_widget).apply {
@@ -195,7 +193,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
)
val intent = Intent(context, ProfileActivity::class.java)
- .putExtra("userId", it)
+ .putExtra("userId", userPref.toInt())
val pendingIntent = PendingIntent.getActivity(
context, 0, intent, PendingIntent.FLAG_IMMUTABLE
)
@@ -205,7 +203,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
appWidgetManager.updateAppWidget(appWidgetId, views)
}
} ?: showLoginCascade(context, appWidgetManager, appWidgetId)
- } ?: showLoginCascade(context, appWidgetManager, appWidgetId)
+ } else showLoginCascade(context, appWidgetManager, appWidgetId)
}
}
diff --git a/app/src/main/res/drawable-night/widget_stats_rounded.xml b/app/src/main/res/drawable-night/widget_stats_rounded.xml
new file mode 100644
index 00000000..933eab8b
--- /dev/null
+++ b/app/src/main/res/drawable-night/widget_stats_rounded.xml
@@ -0,0 +1,27 @@
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/widget_stats_rounded.xml b/app/src/main/res/drawable/widget_stats_rounded.xml
index 933eab8b..2b32dd96 100644
--- a/app/src/main/res/drawable/widget_stats_rounded.xml
+++ b/app/src/main/res/drawable/widget_stats_rounded.xml
@@ -14,7 +14,7 @@
android:right="-3dp"
android:bottom="-50dp">
-
+
Popular Manga
Username
- "Chapters Read "
- "Chapters\nRead "
- "Episodes Watched "
- "Episodes\nWatched "
+ Chapters Read
+ Chapters\nRead
+ Episodes Watched
+ Episodes\nWatched
Continue Reading
Continue Watching
Recommended