Skip to content

emre1512/FloatingActionMenu

Repository files navigation

CircleProgressBar

https://github.com/emre1512/FloatingActionMenu https://github.com/emre1512/FloatingActionMenu https://www.apache.org/licenses/LICENSE-2.0 https://github.com/emre1512/FloatingActionMenu

A simple library for creating circular progressbars for Android.

Examples

Installation

  • Get it via gradle: compile 'com.emredavarci:floatingactionmenu:1.0.0'

Usage

  1. Add CircleProgressBar to your layout

Warning: This library allows only 4 menu actions. Not 3, not 5.

      <com.emredavarci.floatingactionmenu.FloatingActionMenu
        xmlns:fam="http://schemas.android.com/apk/res-auto"
        android:id="@+id/floatingMenu"
        android:layout_width="match_parent"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_height="80dp"                // Important! Height and radius values should be same!
        fam:radius="80dp"                 // Important! Height and radius values should be same!
        fam:shadowWidth="2dp" 
        fam:scaleRatio="3"
        fam:duration="200"
        fam:bgColor="#4ad6bd"
        fam:menuIconRotateAngle="225"
        fam:menuIconWidth="30dp"
        fam:menuIconHeight="30dp"
        fam:menuIcon="@drawable/default_menu_icon"
        fam:firstActionIcon="@drawable/fav_icon"
        fam:secondActionIcon="@drawable/share_icon"
        fam:thirdActionIcon="@drawable/search_icon"
        fam:fourthActionIcon="@drawable/settings_icon">
    </com.emredavarci.floatingactionmenu.FloatingActionMenu>
  1. Reach it from your activity/fragment etc.
	FloatingActionMenu menu = (FloatingActionMenu) findViewById(R.id.actionmenu);
        menu.setClickEvent(new FloatingActionMenu.ClickEvent() {
            @Override
            public void onClick(int index) {
                Log.d("TAG", String.valueOf(index)); // index of clicked menu item
            }
        });

You can modify it programmatically if you want

Setters

menu.setRadius(radius); 		 // set radius of button
menu.setShadowWitdth(2); 			// set shadow width
menu.setScaleRatio(3); 		    // set scale ratio of button
menu.setDuration(300); 		    // set duration of opening animation
menu.setBgColor("#FF6FD99D"); 	    // set background color of button
menu.setMenuIconRotateAngle(225); 	  // set menu icon rotate angle
menu.setMenuIconWidth(30); 	   // set menu icon width
menu.setMenuIconHeight(30); 		 // set menu icon height
enu.setMenuIcon(R.drawable.menu_icon); 	// set menu icon
menu.setFirstActionIcon(R.drawable.first_icon);  // set first action icon
menu.setSecondActionIcon(R.drawable.second_icon);   // set second action icon
menu.setThirdActionIcon(R.drawable.third_icon);   // set third action icon
menu.setFourthActionIcon(R.drawable.fourth_icon);    // set fourth action icon

Getters

menu.getRadius();     // get radius of button
menu.getShadowWitdth();      // get shadow width
menu.getScaleRatio();    // get scale ratio of button
menu.getDuration();    // get duration of opening animation
menu.getBgColor();   // get background color of button
menu.getMenuIconRotateAngle();   // get menu icon rotate angle
menu.getMenuIconWidth();  // get menu icon width
menu.getMenuIconHeight();     // get menu icon height
menu.getMenuIcon();       // get menu icon
menu.getFirstActionIcon();  // get first action icon
menu.getSecondActionIcon(); // get second action icon
menu.getThirdActionIcon(); // get third action icon
menu.getFourthActionIcon();  // get fourth action icon

LICENSE

Copyright 2017 M. Emre Davarci

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Releases

No releases published

Packages

No packages published

Languages