tom5079 / FloatingSearchView

Complete Kotlin port of arimorty/FloatingSearchView
Apache License 2.0
18 stars 5 forks source link

Crash when attr/colorSurface is not set #5

Closed EmmanuelMess closed 2 years ago

EmmanuelMess commented 2 years ago

XML file:

<?xml version="1.0" encoding="utf-8"?>
<xyz.quaver.floatingsearchview.FloatingSearchView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/floating_search_view"
    android:layout_margin="@dimen/search_view_margin"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:elevation="8dp"
    android:gravity="center_vertical"
    android:visibility="gone"
    app:dimBackground="false"
    app:searchHint="@string/search_hint"
    app:leftActionMode="showHome"
    app:close_search_on_keyboard_dismiss="true"/>
2022-03-31 02:05:37.475 23293-23293/com.amaze.filemanager.debug E/class com.amaze.filemanager.crashreport.ErrorActivity: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amaze.filemanager.debug/com.amaze.filemanager.ui.activities.MainActivity}: android.view.InflateException: Binary XML file line #51 in com.amaze.filemanager.debug:layout/main_toolbar: Binary XML file line #15 in com.amaze.filemanager.debug:layout/layout_search: Error inflating class xyz.quaver.floatingsearchview.FloatingSearchView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3491)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3643)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2105)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7700)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
     Caused by: android.view.InflateException: Binary XML file line #51 in com.amaze.filemanager.debug:layout/main_toolbar: Binary XML file line #15 in com.amaze.filemanager.debug:layout/layout_search: Error inflating class xyz.quaver.floatingsearchview.FloatingSearchView
     Caused by: android.view.InflateException: Binary XML file line #15 in com.amaze.filemanager.debug:layout/layout_search: Error inflating class xyz.quaver.floatingsearchview.FloatingSearchView
     Caused by: java.lang.reflect.InvocationTargetException
        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:1008)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1248)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1134)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:706)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
        at com.amaze.filemanager.ui.activities.MainActivity.onCreate(MainActivity.java:326)
        at android.app.Activity.performCreate(Activity.java:8000)
        at android.app.Activity.performCreate(Activity.java:7984)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3464)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3643)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2105)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7700)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
2022-03-31 02:05:37.475 23293-23293/com.amaze.filemanager.debug E/class com.amaze.filemanager.crashreport.ErrorActivity: Caused by: java.lang.IllegalArgumentException: xyz.quaver.floatingsearchview.FloatingSearchView requires a value for the com.amaze.filemanager.debug:attr/colorSurface attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant).
        at com.google.android.material.resources.MaterialAttributes.resolveOrThrow(MaterialAttributes.java:69)
        at com.google.android.material.resources.MaterialAttributes.resolveOrThrow(MaterialAttributes.java:84)
        at com.google.android.material.color.MaterialColors.getColor(MaterialColors.java:69)
        at xyz.quaver.floatingsearchview.FloatingSearchView.applyAttributes(FloatingSearchView.kt:614)
        at xyz.quaver.floatingsearchview.FloatingSearchView.<init>(FloatingSearchView.kt:360)
            ... 30 more

Probably needs to be explained in README.

EmmanuelMess commented 2 years ago

Nvm just saw it.