Skip to content

Commit 99f9675

Browse files
support for setting radius of menu from Java code. Fixes saurabharora90#9
1 parent 86aaa26 commit 99f9675

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ API
118118
Currently the library offers the following API's
119119

120120
- `toggleMenu`: Open or close the menu depending on its current state.
121+
- `setRadius`: Set the radius of the arc menu.
121122
- `isMenuOpened`: Returns whether the menu is opened or closed.
122123
- `setAnimationTime`: Controls the animation time to transition the menu from close to open state and vice versa. The time is represented in milli-seconds
123124
- `setStateChangeListener`: Allows you to listen to the state changes of the Menu, i.e. `onMenuOpened` and `onMenuClosed` events

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
8+
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
1111

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Oct 21 11:34:03 PDT 2015
1+
#Sat Jan 30 19:46:37 SGT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

library/src/main/java/com/sa90/materialarcmenu/ArcMenu.java

+6
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,10 @@ public void setAnimationTime(long animationTime) {
412412
public void setStateChangeListener(StateChangeListener stateChangeListener) {
413413
this.mStateChangeListener = stateChangeListener;
414414
}
415+
416+
@SuppressWarnings("unused")
417+
public void setRadius(float radius) {
418+
this.mFinalRadius = radius;
419+
invalidate();
420+
}
415421
}

samples/src/main/java/com/sa90/arcdemo/MainActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) {
2323
setSupportActionBar(toolbar);
2424

2525
arcMenu = (ArcMenu) findViewById(R.id.arcMenu);
26-
//arcMenu.setAnimationTime(600);
26+
arcMenu.setRadius(getResources().getDimension(R.dimen.radius));
2727

2828
arcMenu.setStateChangeListener(new StateChangeListener() {
2929
@Override

samples/src/main/res/values/dimens.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<dimen name="activity_horizontal_margin">16dp</dimen>
44
<dimen name="activity_vertical_margin">16dp</dimen>
55

6-
<dimen name="fab_margin">16dp</dimen>
6+
<dimen name="radius">250dp</dimen>
77
</resources>

0 commit comments

Comments
 (0)