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

Let's embed the ImageView as direct child of ArcMenu #4

Closed
wants to merge 3 commits into from

Conversation

gipi
Copy link
Contributor

@gipi gipi commented Dec 8, 2012

This is not intended to be merged as is, but rather a proof of concept in order to have indications about its correctness: I don't know the code very well so maybe some changes are against author's intent.

With these changes is possible to indicate the buttons for the ArcMenu directly in the XML like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <com.capricorn.ArcMenu
        android:id="@+id/arc_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <ImageView
            android:id="@+id/camera_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/composer_camera"
            android:onClick="on_click_camera"
        />
        <ImageView
            android:id="@+id/music_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/composer_music"
            android:onClick="on_click_music"
        />
        <ImageView
            android:id="@+id/place_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/composer_place"
            android:onClick="on_click_place"
        />
    </com.capricorn.ArcMenu>
</LinearLayout>

where the on_click_* functions are defined in the Activity or Fragment. These functions are intended to be like the following

    public void on_click_camera(View v) {
        Toast.makeText(MainActivity.this, "Hi!", Toast.LENGTH_SHORT).show();
        mArcMenu.offMenuAnimation(v);
    }

where offMenuAnimation (bad name I know, someone can suggest one?) dismiss the main menu.

@gipi
Copy link
Contributor Author

gipi commented Dec 13, 2012

Ok, but when we use a ListView we are not adding its items one by one, we use an adapter. An adapter is nice but in my opinion is overkilling: this menu is first of all an UI element and in this way should be managed, using a XML. For example now it's not possible to split the work between a designer and a developer, is all in code. Also is not possible to keep open the menu after a click in an item.

However is a simple change made the code get any view that is a child of ArcMenu.

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

Successfully merging this pull request may close these issues.

None yet

2 participants