Coder Social home page Coder Social logo

Comments (13)

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

OK, found the issue. For some reason it must have a container, as such:

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <com.balysv.materialmenu.MaterialMenuView
            android:id="@+id/navButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            app:mm_color="#ffcc0000"
            app:mm_scale="1"
            app:mm_strokeWidth="2"
            app:mm_transformDuration="3000" />
    </FrameLayout>

But why exactly?

from material-menu.

balysv avatar balysv commented on May 12, 2024

Could you provide your full xml for the error? According to the stack, it might be that other layouts are causing it

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

@balysv Here it is after the "fix" (of adding the FrameLayout) .
The layout below mimics the toolbar used for Google Now (the search bar) .

<?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/searchCard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardCornerRadius="4dp"
        app:cardElevation="4dp"
        app:cardPreventCornerOverlap="true"
        app:cardUseCompatPadding="true"
        app:contentPadding="4dp" >

        <LinearLayout
            android:id="@+id/searchCardContent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:minHeight="40dp"
            android:orientation="horizontal" >

            <View
                android:id="@+id/focusStealer"
                android:layout_width="0px"
                android:layout_height="0px"
                android:focusable="true"
                android:focusableInTouchMode="true" />

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <com.balysv.materialmenu.MaterialMenuView
                    android:id="@+id/navButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    app:mm_color="#FF000000" />
            </FrameLayout>

            <com.example.cardstest.EditText
                android:id="@android:id/edit"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@null"
                android:gravity="center_vertical"
                android:hint="Search"
                android:imeOptions="actionSearch"
                android:inputType="phone"
                android:singleLine="true"
                tools:ignore="HardcodedText" />

            <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:background="@null"
                android:padding="4dp"
                android:src="@drawable/ic_av_mic" />
        </LinearLayout>

    </android.support.v7.widget.CardView>

from material-menu.

balysv avatar balysv commented on May 12, 2024

I've recreated the layout in an example project and it MaterialMenuView successfully inflates in all common layouts including CardView. Are you sure it's not your custom EditText causing it? If you can provide any more details, please do and I'll look into it.

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

@balysv Did you remove the FrameLayout?
About the EditText, this is all that it has:

public class EditText extends android.widget.EditText {
private OnBackButtonPressedListener mOnBackButtonPressedListener;

    public interface OnBackButtonPressedListener {
        void onBackPressed();
    }

    public EditText(final Context context) {
        super(context);
    }

    public EditText(final Context context, final AttributeSet attrs) {
        super(context, attrs);
    }

    public EditText(final Context context, final AttributeSet attrs, final int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public EditText(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public void setOnBackButtonPressedListener(final OnBackButtonPressedListener onBackButtonPressedListener) {
        this.mOnBackButtonPressedListener = onBackButtonPressedListener;
    }

    @Override
    public boolean onKeyPreIme(final int keyCode, final KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
            if (mOnBackButtonPressedListener != null)
                mOnBackButtonPressedListener.onBackPressed();
        return super.onKeyPreIme(keyCode, event);
    }
}

It's used to capture the back button when the keyboard is shown.

from material-menu.

balysv avatar balysv commented on May 12, 2024

Yea, I've tried various configurations with no crashes.

from material-menu.

balysv avatar balysv commented on May 12, 2024

Can you provide the full stack given by the exception?

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

I've worked on this project on Eclipse at work, so I can't test it right now. I can try to reproduce it at home with Android-Studio. Can you please let me know what should I add to the dependencies?
I've tried this one:
compile 'com.balysv.materialmenu:material-menu-toolbar:1.x.x'

Is this correct?

from material-menu.

balysv avatar balysv commented on May 12, 2024

You can check the latest version at Releases. Insert that number instead.

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

@balysv Tested at home with just the layout I've sent you (and without the FrameLayout). Works just fine.
Not sure what caused it. Sorry I can't reproduce the issue.
Also, another thing that was weird for me is the animation usage. I remember that each time I wanted to show an animation (example: arrow->burger), I had to set the first state, even if it was already on this state.
And I couldn't reproduce this issue too...
No idea what's going on.

from material-menu.

balysv avatar balysv commented on May 12, 2024

It is likely to have something to do with Eclipse dependency management. I highly recommend using Studio.
I'm closing this issue for now then. Reopen if you find a way to reproduce it.

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

It's at the office, so I can't force anyone to switch. I'm not in charge. I can't even switch myself (and let others use Ecilpse), since it's a different file structure than Eclipse.
Personally, I really like Eclipse, but Google stopped supporting it, so I've moved to Android-Studio. I like its features, but I still see a lot of things that I miss from Eclipse that don't exist there, and I also see a lot of annoyances.

from material-menu.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on May 12, 2024

OK, I've now tried it at the office, and the bug is gone...
I have no idea how and why it happened.
Thank you anyway, and sorry for the false positive.

from material-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.