Coder Social home page Coder Social logo

allangleexpandablebutton's Introduction

AllAngleExpandableButton

An button menu that can expand from any angle to any angle as you like.
It support two type of button, text button and icon button.You can define the button style as you like, such as button size, button background color, text size, button shadow and so on.

screenshot

###Add to your project

  • step1:Add it in your root build.gradle at the end of repositories:
    allprojects {
        repositories {
            ...
	        maven { url "https://jitpack.io" }
        }
    }
  • step2:Add the dependency:
    dependencies {
        compile 'com.github.uin3566:AllAngleExpandableButton:v1.2.0'
    }

###Usage Declare an AllAngleExpandableButton inside your XML file as show below, but note that the layout_width and layout_height is useless, the size of AllAngleExpandableButton is decided by aebMainButtonSizeDp and aebButtonElevation together at last.

<com.fangxu.allangleexpandablebutton.AllAngleExpandableButton
    android:id="@+id/button_expandable"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="100dp"
    app:aebAnimDurationMillis="175"
    app:aebButtonElevation="4dp"
    app:aebButtonGapDp="25dp"
    app:aebEndAngleDegree="90"
    app:aebIsSelectionMode="false"
    app:aebMainButtonRotateAnimDurationMillis="250"
    app:aebMainButtonRotateDegree="-135"
    app:aebMainButtonSizeDp="56dp"
    app:aebMainButtonTextColor="#ffff5656"
    app:aebMainButtonTextSizeSp="20dp"
    app:aebMaskBackgroundColor="@color/transparent"
    app:aebRippleColor="@color/red"
    app:aebRippleEffect="true"
    app:aebStartAngleDegree="90"
    app:aebSubButtonSizeDp="56dp"
    app:aebSubButtonTextColor="#ff0000ff"
    app:aebSubButtonTextSizeSp="18dp"
    app:aebBlurBackground="true"
    app:aebBlurRadius=10/>

use AllAngleExpandableButton in java code like this:

  • step1: define an ArrayList to store button infos and set the list to AllAngleExpandableButton
    AllAngleExpandableButton button = (AllAngleExpandableButton)findViewById(R.id.button_expandable);
    final List<ButtonData> buttonDatas = new ArrayList<>();
    int[] drawable = {R.drawable.plus, R.drawable.mark, R.drawable.settings, R.drawable.heart};
    for (int i = 0; i < drawable.length; i++) {
        ButtonData buttonData = ButtonData.buildIconButton(context, drawable[i], 0);
        buttonDatas.add(buttonData);
    }
    button.setButtonDatas(buttonDatas);
  • step2: add listener to AllAngleExpandableButton
    button.setButtonEventListener(new ButtonEventListener() {
        @Override
        public void onButtonClicked(int index) {
            //do whatever you want,the param index is counted from startAngle to endAngle,  
	        //the value is from 1 to buttonCount - 1(buttonCount if aebIsSelectionMode=true)
        }

        @Override
        public void onExpand() {
            
        }

        @Override
        public void onCollapse() {

        }
    });

###Attributes all of the attributes are listed below:

attribute value type defalut value description
aebStartAngleDegree integer 90 the start angle of the expand buttons
aebEndAngleDegree integer 90 the end angle of the expand buttons
aebMaskBackgroundColor color Color.TRANSPARENT the fullscreen background color when the buttons are expanded
aebIsSelectionMode boolean false if true,when a sub button is selected,the main button is setted as the selected sub button
aebAnimDurationMillis integer 225 expand and collapse animator duration in time milliseconds.
aebMainButtonRotateAnimDurationMillis integer 300 the main button rotate animator duration in time milliseconds
aebMainButtonRotateDegree integer 0 main button rotate degree while expanding
aebButtonElevation dimen 4dp used for draw the button shadow.
aebRippleEffect boolean true ripple effect on main button when it's touched
aebRippleColor color depends on button background ripple effect color, default is the light color of the button background
aebMainButtonSizeDp dimen 60 the size of the main button
aebMainButtonTextSizeSp dimen 20 the size of the main button text
aebMainButtonTextColor color Color.BLACK the color of the main button text
aebSubButtonSizeDp dimen 60 the size of the sub button
aebSubButtonTextSizeSp dimen 20 the size of the sub button text
aebSubButtonTextColor color Color.BLACK the color of the sub button text
aebButtonGapDp dimen 50dp the distance of main button and sub button.
aebBlurBackground boolean false if true, show blur background when expanded
aebBlurRadius float 10 blur radius

###License

Copyright (c) 2016 uin3566 <[email protected]>

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.

allangleexpandablebutton's People

Contributors

uin3566 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

allangleexpandablebutton's Issues

enable LongClistener on fab

Hi, i tried overiding your libray to enable longClickListener on the fab , the use case , i want it to act as a clickable button , so onLongClick --> donot expand --> dosomething (launch activity);

Is it doable ??

Thanks .

build error

alway nation“can't resolve com.github.dcendents.android-maven”

ExpandMoveCoordinate为空

Attempt to read from field 'float com.fangxu.allangleexpandablebutton.AllAngleExpandableButton$MaskView$ExpandMoveCoordinate.moveX' on a null object reference

你好,我有用你的AllAngleExpandableButton,感谢你的付出,但是我遇到了这个问题,请问是怎么导致的呢?代码片段如下:

if(this.allAngleExpandableButton.expanded) {
                    AllAngleExpandableButton.MaskView.ExpandMoveCoordinate radius = (AllAngleExpandableButton.MaskView.ExpandMoveCoordinate)this.expandDesCoordinateMap.get(buttonData);
                    moveX = this.allAngleExpandableButton.expandProgress * radius.moveX;
                    moveY = this.allAngleExpandableButton.expandProgress * -radius.moveY;
                    matrix.postTranslate(moveX, moveY);
                }

另外,如果界面已经渲染了AllAngleExpandableButton,那要怎样改他的visibility呢?(我试过更改,可是好像因为动画的原因会无效)

Unsupported method: BaseConfig.getApplicationIdSuffix().

Could not find method compile() for arguments [com.github.uin3566:AllAngleExpandableButton:v1.2.0] on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@3d81a6ff.

Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-36-generic

Click is not working on Top of MapView inside a ViewPager

I'm using 'AllAngleExpandableButton' widget in a fragment on top of a MapView, that fragment is inside a ViewPager. When i click on the button , it doesn't perform any action. Seems like AllAngleExpandableButton is not accepting touch events in this case.

运行错误

添加依赖后按照你的步骤走 然后报错 找到原因 需要添加
renderscriptTargetApi 18
renderscriptSupportModeEnabled true

Button Shadow

Can we a property for button shadow in style. Right now its showing continuously shadow over main button or whenever we click a button a black background is shown.
Here is the screenshot.

screenshot_20161003-180149

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.