Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputMethodManager leaks minibar because isFocusable() is true #1

Open
1951FDG opened this issue Jul 15, 2019 · 0 comments
Open

InputMethodManager leaks minibar because isFocusable() is true #1

1951FDG opened this issue Jul 15, 2019 · 0 comments

Comments

@1951FDG
Copy link

1951FDG commented Jul 15, 2019

Hi,

Detected the leak with LeakCanary, this bug will show on sdkInt 15..27:
https://issuetracker.google.com/issues/37043700

Default suggested styling inherits from Base.Widget.AppCompat.AutoCompleteTextView whose parent is Widget.EditText, which defines:

<item name="focusable">true</item>
<item name="focusableInTouchMode">true</item>
<item name="clickable">true</item>

Hence the memory error. To fix this, I propose the following simple style:

<com.mayurrokade.minibar.MinibarView
    android:id="@+id/minibarView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal|center_vertical"
    android:includeFontPadding="false"
    android:minHeight="32dp"
    android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse"
    app:layout_constraintTop_toTopOf="parent" />

A minimum height is also set and includeFontPadding is set to false, to ensure text is centered properly.

Another thing, before showing minibar, I have to add the line:

minibarView.translationZ = 0.0f

Do you know why this is necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant