项目作者: sinadalvand

项目描述 :
🎈 Float Option Button is a Float Action Button (fab) with two option button drawer that can expand and collapse with many custom attrs
高级语言: Kotlin
项目地址: git://github.com/sinadalvand/FloatOptionButton.git
创建时间: 2020-03-18T07:54:23Z
项目社区:https://github.com/sinadalvand/FloatOptionButton

开源协议:Apache License 2.0

下载


FloatOptionButton

Developer
Lisense
Download

🎈 Float Option Button is a Float Action Button (fab) with two option button drawer that can expand and collapse with many custom attrs

screenshot

Gradle & Maven

  1. implementation 'ir.sinadalvand.libs:floatoptionbutton:1.0.2'
  1. <dependency>
  2. <groupId>ir.sinadalvand.libs</groupId>
  3. <artifactId>floatoptionbutton</artifactId>
  4. <version>1.0.2</version>
  5. <type>pom</type>
  6. </dependency>

How use this Fob :

  1. <ir.sinadalvand.floatoptionbutton.FloatOptionButton
  2. android:id="@+id/floatOptionButton"
  3. app:fob_animDuration="300" ==> animation duration to open or close
  4. app:fob_autoCollapseInClick="false" ==> auto collapse after click on any button of this view
  5. app:fob_backgroundColor="#f66767" ==> color background of expanded rabon
  6. app:fob_buttonColor="@android:color/white" ==> main button color (center float action button)
  7. app:fob_scale="3.5" ==> scale size of option width against collapse size
  8. app:fob_open="false" ==> if true view will be expanded as default
  9. app:fob_leftIcon="@drawable/ic_image" ==> left button icon as Drawable
  10. app:fob_rightIcon="@drawable/ic_airplay" ==> right button icon as Drawable
  11. app:fob_mainIcon="@drawable/ic_lock" ==> main button (center button) icon as Drawable
  12. app:fob_scaleWidth="100dp" ==> width fix size for expanded (it will overrite to fob_scale)
  13. />

Buttons click Listener: :

  1. floatOptionButton.setFloatOptionListener(object :FloatOptionButtonListener{
  2. override fun mainButtonClicked(view: View) {
  3. // main button clicked! (center button)
  4. }
  5. override fun leftButtonClicked(view: View) {
  6. // left button clicked! (center button)
  7. }
  8. override fun rightButtonClicked(view: View) {
  9. // right button clicked! (center button)
  10. }
  11. })

For toggle between Collapse and Expanded :

  1. floatOptionButton.toggle()

For Collapse:

  1. floatOptionButton.collapse()

For Expand:

  1. floatOptionButton.expand()

and also can set all thr xml attrs by code:

  1. floatOptionButton.setMainButtonColor(color: Int)
  2. floatOptionButton.setSidesButtonColor(color: Int)
  3. floatOptionButton.setFobBackgroundColor(color: Int)
  4. floatOptionButton.setMainButtonIcon(res: Int)
  5. floatOptionButton.setLeftButtonIcon(res: Int)
  6. floatOptionButton.setRightButtonIcon(res: Int)
  7. floatOptionButton.isOpen(boolean: Boolean)
  8. floatOptionButton.setScale(scale: Float)
  9. floatOptionButton.setAnimationDuration(duration: Int)
  10. floatOptionButton.setMaxWidth(width: Int)

and if you want to apply more customization , you can get buttons by :

  1. floatOptionButton.getMainButton() ==> FloatingActionButton
  2. floatOptionButton.getRightButton() ==> ImageView
  3. floatOptionButton.getLeftButton() ==> ImageView

License

  1. Copyright 2019 Sina Dalvand
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.