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
This commit is contained in:
TwistedUmbrellaX 2024-03-28 18:39:04 -04:00 committed by GitHub
parent 7951c2cf37
commit 6b868fa824
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 11 deletions

View file

@ -113,10 +113,8 @@ class ProfileStatsWidget : AppWidgetProvider() {
launchIO { launchIO {
val userPref = PrefManager.getVal(PrefName.AnilistUserId, "") val userPref = PrefManager.getVal(PrefName.AnilistUserId, "")
val userId = if (userPref.isNotEmpty()) userPref.toInt() else Anilist.userid if (userPref.isNotEmpty()) {
?: if (Anilist.query.getUserData()) Anilist.userid else null val respond = Anilist.query.getUserProfile(userPref.toInt())
userId?.let {
val respond = Anilist.query.getUserProfile(it)
respond?.data?.user?.let { user -> respond?.data?.user?.let { user ->
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
val views = RemoteViews(context.packageName, R.layout.statistics_widget).apply { val views = RemoteViews(context.packageName, R.layout.statistics_widget).apply {
@ -195,7 +193,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
) )
val intent = Intent(context, ProfileActivity::class.java) val intent = Intent(context, ProfileActivity::class.java)
.putExtra("userId", it) .putExtra("userId", userPref.toInt())
val pendingIntent = PendingIntent.getActivity( val pendingIntent = PendingIntent.getActivity(
context, 0, intent, PendingIntent.FLAG_IMMUTABLE context, 0, intent, PendingIntent.FLAG_IMMUTABLE
) )
@ -205,7 +203,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
appWidgetManager.updateAppWidget(appWidgetId, views) appWidgetManager.updateAppWidget(appWidgetId, views)
} }
} ?: showLoginCascade(context, appWidgetManager, appWidgetId) } ?: showLoginCascade(context, appWidgetManager, appWidgetId)
} ?: showLoginCascade(context, appWidgetManager, appWidgetId) } else showLoginCascade(context, appWidgetManager, appWidgetId)
} }
} }

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<corners
android:topLeftRadius="28dp"
android:topRightRadius="28dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"/>
</shape>
</item>
<item
android:left="-3dp"
android:right="-3dp"
android:bottom="-50dp">
<shape>
<stroke android:width="2dp" android:color="@color/bg_white" />
<corners
android:topLeftRadius="28dp"
android:topRightRadius="28dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"/>
</shape>
</item>
</layer-list>

View file

@ -14,7 +14,7 @@
android:right="-3dp" android:right="-3dp"
android:bottom="-50dp"> android:bottom="-50dp">
<shape> <shape>
<stroke android:width="2dp" android:color="@color/bg_white" /> <stroke android:width="2dp" android:color="@color/bg_black" />
<corners <corners
android:topLeftRadius="28dp" android:topLeftRadius="28dp"
android:topRightRadius="28dp" android:topRightRadius="28dp"

View file

@ -49,10 +49,10 @@
<string name="popular_manga">Popular Manga</string> <string name="popular_manga">Popular Manga</string>
<string name="username">Username</string> <string name="username">Username</string>
<string name="chapters_read">"Chapters Read "</string> <string name="chapters_read">Chapters Read</string>
<string name="chapters_read_n">"Chapters\nRead "</string> <string name="chapters_read_n">Chapters\nRead</string>
<string name="episodes_watched">"Episodes Watched "</string> <string name="episodes_watched">Episodes Watched</string>
<string name="episodes_watched_n">"Episodes\nWatched "</string> <string name="episodes_watched_n">Episodes\nWatched</string>
<string name="continue_reading">Continue Reading</string> <string name="continue_reading">Continue Reading</string>
<string name="continue_watching">Continue Watching</string> <string name="continue_watching">Continue Watching</string>
<string name="recommended">Recommended</string> <string name="recommended">Recommended</string>