From cf0f1291444bd1211021f06fc5ef8a98905f44c5 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Tue, 14 Mar 2023 16:02:35 -0700 Subject: [PATCH] Resolve "Failed to inflate ..." warnings. After merging 39a2d3e, "Failed to inflate ColorStateList" warnings overwhelm logcat output. This may be Android version specific. But on an API 30 avd, this makes it difficult to spot other errors while debugging. Full traceback below. https://stackoverflow.com/questions/71746801/getting-failed-to-inflate-colorstatelist-leaving-it-to-the-framework-when-usi suggests a fix, applied here. Traceback (slightly reformatted): ``` 2023-03-14 15:02:00.951 6324-6324 ResourcesCompat com.cheogram.android W Failed to inflate ColorStateList, leaving it to the framework java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0400eb a=-1} at android.content.res.TypedArray.getColor(TypedArray.java:528) at androidx.core.content.res.ColorStateListInflaterCompat.inflate(ColorStateListInflaterCompat.java:160) at androidx.core.content.res.ColorStateListInflaterCompat.createFromXmlInner(ColorStateListInflaterCompat.java:125) at androidx.core.content.res.ColorStateListInflaterCompat.createFromXml(ColorStateListInflaterCompat.java:104) at androidx.core.content.res.ResourcesCompat.inflateColorStateList(ResourcesCompat.java:262) at androidx.core.content.res.ResourcesCompat.getColorStateList(ResourcesCompat.java:236) at androidx.core.content.ContextCompat.getColorStateList(ContextCompat.java:519) at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:48) at com.google.android.material.resources.MaterialResources.getColorStateList(MaterialResources.java:65) at com.google.android.material.imageview.ShapeableImageView.(ShapeableImageView.java:114) at com.google.android.material.imageview.ShapeableImageView.(ShapeableImageView.java:92) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:852) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126) at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95) at eu.siacs.conversations.ui.adapter.ConversationAdapter.onCreateViewHolder(ConversationAdapter.java:50) at eu.siacs.conversations.ui.adapter.ConversationAdapter.onCreateViewHolder(ConversationAdapter.java:34) at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7078) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6235) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) 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:22844) W at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout(DecorView.java:784) at android.view.View.layout(View.java:22844) at android.view.ViewGroup.layout(ViewGroup.java:6389) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3475) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2943) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1948) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8177) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:731) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) ``` --- src/main/res/layout/account_row.xml | 1 + src/main/res/layout/activity_edit_account.xml | 1 + src/main/res/layout/activity_manage_accounts.xml | 2 ++ src/main/res/layout/activity_muc_details.xml | 1 + src/main/res/layout/activity_rtp_session.xml | 1 + src/main/res/layout/contact.xml | 1 + src/main/res/layout/conversation_list_row.xml | 1 + src/main/res/layout/message_received.xml | 1 + src/main/res/layout/message_sent.xml | 1 + src/main/res/layout/message_status.xml | 1 + src/main/res/layout/search_result_item.xml | 1 + 11 files changed, 12 insertions(+) diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index 2a0a0f71958e68d0161b22444a82ba2ff0f396ff..010bbd4be7181ad82fd59ddf54e05270c9d4552f 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -16,6 +16,7 @@ android:layout_height="48dp" android:layout_alignParentLeft="true" android:contentDescription="@string/account_image_description" + app:strokeColor="@color/custom_theme_accent" app:shapeAppearance="@style/ShapeAppearanceOverlay.Photo" /> diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 3898ef049cc4b16024fe2fe8b7e17364ebe9381a..48b9d1a429741316880bf49c81e90d5f1bb15aed 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -47,6 +47,7 @@ android:layout_width="@dimen/avatar_on_details_screen_size" android:layout_height="@dimen/avatar_on_details_screen_size" android:layout_alignParentStart="true" + app:strokeColor="@color/custom_theme_accent" app:shapeAppearance="@style/ShapeAppearanceOverlay.Photo" android:layout_marginEnd="@dimen/avatar_item_distance" android:layout_alignParentLeft="true" diff --git a/src/main/res/layout/activity_rtp_session.xml b/src/main/res/layout/activity_rtp_session.xml index e90fc50f7c788200226730dcbbfd04384906b605..29fc024527b97c5c1cd29b0c34c84ff44fcb9d4a 100644 --- a/src/main/res/layout/activity_rtp_session.xml +++ b/src/main/res/layout/activity_rtp_session.xml @@ -104,6 +104,7 @@ android:layout_width="@dimen/publish_avatar_size" android:layout_height="@dimen/publish_avatar_size" android:layout_centerInParent="true" + app:strokeColor="@color/custom_theme_accent" app:shapeAppearance="@style/ShapeAppearanceOverlay.IncomingCall" /> diff --git a/src/main/res/layout/contact.xml b/src/main/res/layout/contact.xml index 279dd6f944b21b3e41435a57ddff255271fae02e..7c8bfbd82dfcb1ff823ea955becb8babeba707ac 100644 --- a/src/main/res/layout/contact.xml +++ b/src/main/res/layout/contact.xml @@ -14,6 +14,7 @@ android:layout_height="48dp" android:layout_alignParentLeft="true" android:scaleType="centerCrop" + app:strokeColor="@color/custom_theme_accent" app:shapeAppearance="@style/ShapeAppearanceOverlay.Photo" />