Git Product home page Git Product logo

android-circlemenu's Introduction

Circle Menu

This is a simple implementation of a circle menu for Android applications.

Deprecated

ConstraintLayout 1.1.0 is now supporting circular positioning, which makes the use of this library deprecated.

Screenshots

Circle menu screenshot

Download

Grab via Maven

<dependency>
    <groupId>com.github.szugyi</groupId>
    <artifactId>Android-CircleMenu</artifactId>
    <version>2.0.0</version>
</dependency>

or Gradle:

compile 'com.github.szugyi:Android-CircleMenu:2.0.0'

Snapshots of the development version are available in Sonatype's snapshots repository.

Android-CircleMenu requires Android 4.0.

Attributes

  • firstChildPosition ([East, South, West, North]) - The angle where the first child of the CircleLayout will be put. Possible values are: East - to the right, South - to the bottom, West - to the left, North - to the top. Default: South
  • isRotating (boolean) - Determines wether the child views are rotatable or not. Default: true
  • speed (integer) - You can set the speed of the rotation. NOTE: The higher the value, the faster the rotation. It must be greater than 0. Values between 10 - 100 should work well. Default: 25
  • radius (dimension) - The radius of the circle can be defined using dps or pixels.

EventListeners

  • OnItemClickListener - Called when a child view is tapped. If the isRotating attribute is set to true, then called only if the tapped view is already on the firstChildPosition.
  • OnItemSelectedListener - If the isRotating attribute is set to true, then it is called when the view is rotated to the firstChildPosition. Otherwise it is called with the OnItemClickListener when the child is tapped.
  • OnCenterClickListener - Called when the center of the CircleLayout is tapped.
  • OnRotationFinishedListener - If the isRotating attribute is set to true, then it is called when the rotation is finished, and passes the view which is on the firstChildPosition. Otherwise it is never called.

Changelog

Description about the changes made to each version of the project can be found in the CHANGELOG.md file.

Credits

Special thanks to Balázs Varga, who helped me during the implementation of this custom view.

A lot of code snippets have been used from this great tutorial: http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-a-rotating-dialer/

The icons used in the example app are from: http://flaticons.net/

android-circlemenu's People

Contributors

dmsherazi avatar sungerk avatar szugyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-circlemenu's Issues

TranslateAnimation for the CircleImageView

I need to Apply Translate Animation for all the CircleImageView whenever a Circle layout is Called.
To do that, where should I call the Translate Animation method. So that the Animation method will be called Everytime my Activity starts.

implement a central icon

Hi, Thank you for this wonderful & super useful widget.
Would it be possible to implement an icon in the center. When the icon is clicked, the menu would pop-up? At that point the icon changes to a cancel icon. When that icon is clicked again, the circle menu closes. You can see an example in iOS here. https://github.com/Ramotion/circle-menu

Ideally, the central button could be placed any where (say center point of the North-East quadrant), and if the radius was set to that half the size of the quadrant, the menu would show up in that North-East quadrant

Thanks in advance.

hello dear

I have issues
int layoutId = extras.getInt(ARG_LAYOUT);
i need jest sample activity working without all activity

thank you and have nice day

Image in center of CircleView

I'd like to display an clickable imageview in the center of the circle view. Is there a way to do so without altering your code?

Thanks!

Problem with new intent

Hello Sir,,,
In this part of code i cant start new intent! is it the right way?

my code :

case R.id.main_cloud_image:
// Handle cloud click

                Intent myIntent = new Intent(getApplicationContext(), CloudOpen.class);
                startActivityForResult(myIntent, 0);
                break;

by the way I LOVE IT SO MUCH and THANNNK YOOOU 👍

Getting Wrong id of items

I rotated the circle_layout with below code

RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	rotate.setDuration(10000);
	rotate.setInterpolator(new LinearInterpolator());
	rotate.setRepeatCount(Animation.INFINITE);
	com.szugyi.circlemenu.view.CircleLayout  image= (com.szugyi.circlemenu.view.CircleLayout)findViewById(R.id.circle_layout);
	image.startAnimation(rotate);

Now when I click on items they show toasts of different items id ,click is getting wrong in this scenario .

Zoom image item during rotate

Thank you for your project. It's magic.
But I'd like to zoom out and zoom in image item gradually based on its angle when rotate.
How can I solve my problem?
See your answer soon.
Thanks, again.

cricle menu

this code is not working properly if i include odd no icons like... if i include 7 icons the rotation and and placement of icons are not proper.

菜单滚动

1,如何点击CircleLayout外的一个按钮,实现CircleLayout滚动到我想的菜单
2,菜单数为奇数十,能否让最下面的菜单位于顶部

Do something when the wheel rotating

Hi,
I'm really graceful for this awesome work. Thanks a lot!

However I have a question. So, I want to play a music, when the wheel is rotating. That's okay I can check the isRotating methods return value, but how can play music for ever, when the wheel rotating?
I need an Async task or maybe you have a better idea?
(I used this layout via gradle, so I don't exactly change the source code, if it possible.)

Best regards from a Hungarian android lover! 😉

Adding Item in the center

Hello!
Great library! I ported some of the code to C# and I'm using it in Xamarin.

One question I have is how I would add an item in the middle? I want an item in the middle with 4 buttons around it.

Any pointers would be appreciated!

Thanks again.

Change background color of circle

Fantastic library! Is it possible to change the background color of the circle when adding it dynamically? If so, how would I go about this? Thanks

Rotation of childs

Hi, thanx for your project. Its awesome.

But i wonder, is there any way, when we start to turn, all imageviews' rotations does not change. I want their bottom always directioned to center. How to do this ?

Adding drag and drop

Hi! Thank you for super project!
I'd like to implement drag and drop to this menu then I wrapped each CircleImageView to the LinearLayout to hang a drag listener. Then I prepare CircleLayout class somethink tike this:
LinearLayout lr = (LinearLayout) getChildAt(selected);
CircleImageView view = (CircleImageView) lr.getChildAt(0);
But the images of CircleImageView become invisible!
How can I solve this problem?

How to add title below each image child?

Hi, @szugyi
I'm glad after zooming child views when rotate successfully. And now, I want to add a title or a textview below each image child. I tried to make a customview extending RelativeLayout (contains an imageview and a textview) but the height and width childs are not fill. Do you have any ideas for me?
Thank you very much.

Child icons placing outline of the image . How to reduce the radius

Thanks for the Wonderful Library ..
I have problem diffcult to find the solution ..

Problem is Child Icons are not clear visible. It place end of ViewGroup
How to reduce the radius and show the icon clear visible to center of border/stroke.
screenshot_2016-06-01-17-11-43

and other question it is possible to rotate the background image based upon ACTION_MOVE
Thanks in Advance

Not able to stop the selected child self rotation

Hi,
How to stop the selected child view self rotation. I want circle menu to be rotatable but not the child which is selected. I gone through the circlelayout class but not able to figure out the thing.

Detect whether a gesture was clockwise or anticlockwise?

Thank you for this wonderful & super useful widget.
@szugyi
I wonder how to detect whether a gesture was clockwise or anticlockwise,even through reading the source code ,i don't understand.

// get the quadrant of the start and the end of the fling
            int q1 = getPositionQuadrant(e1.getX() - (circleWidth / 2),
                    circleHeight - e1.getY() - (circleHeight / 2));
            int q2 = getPositionQuadrant(e2.getX() - (circleWidth / 2),
                    circleHeight - e2.getY() - (circleHeight / 2));

            if ((q1 == 2 && q2 == 2 && Math.abs(velocityX) < Math
                    .abs(velocityY))
                    || (q1 == 3 && q2 == 3)
                    || (q1 == 1 && q2 == 3)
                    || (q1 == 4 && q2 == 4 && Math.abs(velocityX) > Math
                    .abs(velocityY))
                    || ((q1 == 2 && q2 == 3) || (q1 == 3 && q2 == 2))
                    || ((q1 == 3 && q2 == 4) || (q1 == 4 && q2 == 3))
                    || (q1 == 2 && q2 == 4 && quadrantTouched[3])
                    || (q1 == 4 && q2 == 2 && quadrantTouched[3])) {
                // the inverted rotations
                animateTo(
                        getCenteredAngle(angle - (velocityX + velocityY) / 25),
                        25000L / speed);
            } else {
                // the normal rotation
                animateTo(
                        getCenteredAngle(angle + (velocityX + velocityY) / 25),
                        25000L / speed);
            }

when q1 == 2 && q2 == 2 && Math.abs(velocityX) < Math
.abs(velocityY)
,i think it also maybe the normal roration,thank you !

Radius

Hi ,
Your library is very awesome .
I have 2 question.
Can i increase the radius of the CircleLayout ? If yes , how ?
How can i make the item bigger when that item is at firstChildPosition ?
Thanks

Inside the layout scrollview

the code:

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <com.szugyi.circlemenu.view.CircleLayoutMenu
            android:id="@+id/main_circle_layout"
            android:layout_width="fill_parent"
            android:layout_height="300dp"
            android:layout_gravity="center_horizontal"
            circle:firstChildPosition="South"
            circle:isRotating="true"
            circle:rotateToCenter="true"
            circle:speed="75" >

When the rotation animation is not good

radial line

is it possible to connect children to center with radial lines?

a little bug

When I have seven icon, click on the left three ICONS no problem, but when click on the three ICONS on the right, there will be a shake!

click to item

I have downloaded ur source code and then i click to the item and it spin to the firstChildPosition , but i cant find where u use this code in your source code . THanks

Child items rotates

Thanks for great library,
when click on the child items its rotates, when can we stop the child items rotates in onItemClickListner.

add my custom CircleImageViews inside CircleLayout

Hello, thanks for great library. I want to achieve following in android :

https://www.youtube.com/watch?v=QB-K_maFoYw

I started with your library. But when i added my wheel images childs are not arranged properly. Here is output screenshot :

https://www.dropbox.com/s/2nxykthqkwy0uot/Wheel.mp4?dl=0

Here is my code :

`

<com.szugyi.circlemenu.view.CircleLayout
    android:id="@+id/circle_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/imgspin"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="-500dp"
    android:foregroundGravity="bottom"
    circle:isRotating="true">


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/local"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/onlineretailers"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/fashion"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/foodrestaurants"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:src="@drawable/groupsavings"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/homeauto"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/holidaysales"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/realestate"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/b2b"
        circle:isRotating="false" />


    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/healthbeauty"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/trialsoffers"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/flashsales"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/travelvacation"
        circle:isRotating="false" />

    <com.szugyi.circlemenu.view.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/dailydeals"
        circle:isRotating="false" />

</com.szugyi.circlemenu.view.CircleLayout>

Please help. Thanks in advance. `

hello dear

Thanks for Library.

I just want to show appreciation.

Thanks to you, I was able to develop the roulette function correctly.
kakaotalk_2017-11-30-14-34-37_photo_49

rotation direction bug

When filing from 1 quadrant to 3 slopes, the direction of rotation is reversed. To be more specific, Fling from upper right to lower left direction reverses direction.
Please check the attached video.

video.zip

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.