zend10 / AL-chan

Unofficial Android client for AniList, a place where you can track Anime and Manga.
GNU General Public License v3.0
255 stars 11 forks source link

App crashes when entry is viewed that has a priority (Unknown color) #107

Closed TheAkio closed 1 year ago

TheAkio commented 1 year ago

AL-chan version: 1,9.0 (I joined the beta so shouldn't this be some 2.x version?)

When an entry with priority comes into view, the app crashes. Checking with adb logcat, I found the following exception:

11-26 14:50:47.201 13473 13473 E AndroidRuntime: FATAL EXCEPTION: main
11-26 14:50:47.201 13473 13473 E AndroidRuntime: Process: com.zen.alchan, PID: 13473
11-26 14:50:47.201 13473 13473 E AndroidRuntime: java.lang.IllegalArgumentException: Unknown color
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.graphics.Color.parseColor(Color.java:1399)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.zen.alchan.ui.medialist.BaseMediaListRvAdapter$ItemViewHolder.getPriorityColor(BaseMediaListRvAdapter.kt:118)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.zen.alchan.ui.medialist.MediaListLinearRvAdapter$ListItemViewHolder.bind(MediaListLinearRvAdapter.kt:78)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.zen.alchan.ui.medialist.MediaListLinearRvAdapter$ListItemViewHolder.bind(MediaListLinearRvAdapter.kt:45)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.zen.alchan.ui.base.BaseRecyclerViewAdapter.onBindViewHolder(BaseRecyclerViewAdapter.kt:16)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.zen.alchan.ui.base.BaseRecyclerViewAdapter.onBindViewHolder(BaseRecyclerViewAdapter.kt:6)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:938)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:233)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:344)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8212)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
11-26 14:50:47.201 13473 13473 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

I can also reproduce this by setting a priority to any entry. I already tried reinstalling / deleting all data but the issue persists. It looks like the priority is not saved on AniList but somewhere else on the device. Is there some workaround to get the priority data (or all data) deleted? The priority is stored on AniList but I can't find a way to edit/remove it on the Website

TheAkio commented 1 year ago

Using the following GraphQL request I was able to update the priority on AniList to keep AL-chan from crashing:

{
    "query": "mutation($id:Int $mediaId:Int $priority:Int){SaveMediaListEntry(id:$id mediaId:$mediaId priority:$priority){id mediaId priority}}",
    "variables": {
        "priority": 0,
        "mediaId": <Insert Media ID here>
    }
}
TheAkio commented 1 year ago

Looks like this only happens for priority 1 because a "#" is missing here: https://github.com/zend10/AL-chan/blob/2b96fc5f20f42d54104df470318c6058ffd56414/app/src/main/java/com/zen/alchan/ui/medialist/BaseMediaListRvAdapter.kt#L120

zend10 commented 1 year ago

Thanks for the help.