bug in context.kt of project clock-main
Maintainers usually reply within 7 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The crash is a ClassCastException in getSelectedDaysString in Context.kt, which the stack trace places in the org.fossify.commons extensions, called from AlarmsAdapter.kt around line 206. Start with the line that converts the week_days_short string array to a list and casts it, then check how the Clock alarm list reaches that path. Done when the alarm list renders without a crash, with Sunday-first both on and off, and the day-string output is unchanged.
Written by the indexing model from the issue text.
Description
Checklist
- I can reproduce the bug with the latest version given here.
- I made sure that there are no existing issues - open or closed - to which I could contribute my information.
- I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
- I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
- I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
- This issue contains only one bug.
- I have read and understood the contribution guidelines.
Affected app version
latest version. I cannot reach the menu, fails before
Affected Android/Custom ROM version
Android 15
Affected device model
Samsung Galaxy S21
How did you install the app?
Built from source
Steps to reproduce the bug
Fails imediately after launch
bug in Context.kt in the line :
val weekDays = resources.getStringArray(R.array.week_days_short).toList() as ArrayList
source code :
// format day bits to strings like "Mon, Tue, Wed"
fun Context.getSelectedDaysString(bitMask: Int): String {
val dayBits = arrayListOf(MONDAY_BIT, TUESDAY_BIT, WEDNESDAY_BIT, THURSDAY_BIT, FRIDAY_BIT, SATURDAY_BIT, SUNDAY_BIT)
val weekDays = resources.getStringArray(R.array.week_days_short).toList() as ArrayList
if (baseConfig.isSundayFirst) {
dayBits.moveLastItemToFront()
weekDays.moveLastItemToFront()
}
var days = ""
dayBits.forEachIndexed { index, bit ->
if (bitMask and bit != 0) {
days += "${weekDays[index]}, "
}
}
return days.trim().trimEnd(',')
}
E FATAL EXCEPTION: main (Fix with AI)
Process: org.fossify.clock.debug, PID: 17361
java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList
at org.fossify.commons.extensions.ContextKt.getSelectedDaysString(Context.kt:636)
at org.fossify.clock.adapters.AlarmsAdapter.getAlarmSelectedDaysString(AlarmsAdapter.kt:206)
at org.fossify.clock.adapters.AlarmsAdapter.getAlarmSelectedDaysString$default(AlarmsAdapter.kt:198)
at org.fossify.clock.adapters.AlarmsAdapter.setupView(AlarmsAdapter.kt:154)
at org.fossify.clock.adapters.AlarmsAdapter.onBindViewHolder$lambda$0(AlarmsAdapter.kt:103)
at org.fossify.clock.adapters.AlarmsAdapter$$ExternalSyntheticLambda3.invoke(D8$$SyntheticClass:0)
at org.fossify.commons.adapters.MyRecyclerViewAdapter$ViewHolder.bindView(MyRecyclerViewAdapter.kt:321)
at org.fossify.clock.adapters.AlarmsAdapter.onBindViewHolder(AlarmsAdapter.kt:98)
at org.fossify.clock.adapters.AlarmsAdapter.onBindViewHolder(AlarmsAdapter.kt:34)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4012)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1131)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:919)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at androidx.viewpager.widget.ViewPager.onLayout(ViewPager.java:1775)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1131)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at com.google.android.material.appbar.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:145)
at com.google.android.material.appbar.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:43)
at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:2461)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:918)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:345)
at android.widget.FrameLayout.onLayout(FrameLayout.java:283)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
2026-05-17 14:29:22.696 17361-17361 AndroidRuntime org.fossify.clock.debug E at android.widget.FrameLayout.layoutChildren(FrameLayout.java:345) (Fix with AI)
at android.widget.FrameLayout.onLayout(FrameLayout.java:283)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:345)
at android.widget.FrameLayout.onLayout(FrameLayout.java:283)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1891)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1729)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1638)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:345)
at android.widget.FrameLayout.onLayout(FrameLayout.java:283)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:1101)
at android.view.View.layout(View.java:26738)
at android.view.ViewGroup.layout(ViewGroup.java:6815)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:5900)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4977)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3708)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:12542)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1751)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1760)
at android.view.Choreographer.doCallbacks(Choreographer.java:1216)
at android.view.Choreographer.doFrame(Choreographer.java:1142)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1707)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:342)
at android.app.ActivityThread.main(ActivityThread.java:9634)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Expected behavior
.
Actual behavior
.
Screenshots/Screen recordings
No response
Additional information
No response
- Dominant language
- Kotlin
- Stars
- 706
- Forks
- 73
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FossifyOrg/Clock
-
feature request needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FossifyOrg/Clock#504 · 1 comment ·
Maintainers usually reply within 7 days
-
feature request needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FossifyOrg/Clock#492 ·
Maintainers usually reply within 7 days
-
feature request needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FossifyOrg/Clock#491 ·
Maintainers usually reply within 7 days
-
feature request needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
FossifyOrg/Clock#446 ·
Maintainers usually reply within 7 days
-
bug needs triage
Difficulty 2/5 Under an hour Newbie friendliness 74/100
FossifyOrg/Clock#439 ·
Maintainers usually reply within 7 days
All issues in FossifyOrg/Clock
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Kotlin/kotlin-lsp#288 ·
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chrisbanes/haze#1536 ·
Maintainers usually reply within 1 day
-
Cassiopeia drops the `präsentiert von` credit printed in the event bodyPossibly taken A pull request linked to this issue is open or already merged. Openafk-ok area:data-quality importer size:S
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
enorm-labs/event-junkie#3166 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
rajpreetcodes/Skills_MCP_Server#25 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
com-lihaoyi/mill#7776 ·
Maintainers usually reply within 1 day