All Projects → skydoves → Doublelift

skydoves / Doublelift

Licence: apache-2.0
🦋 Expands and collapses a layout horizontally and vertically sequentially.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Doublelift

Expytableview
Make your table view expandable just by implementing one method.
Stars: ✭ 348 (+1.46%)
Mutual labels:  expandable, collapse
Fole
Fole is a simple library to collapse and expand a TextView.
Stars: ✭ 67 (-80.47%)
Mutual labels:  expandable, collapse
Expandablelayout
🦚 An expandable layout that shows a two-level layout with an indicator.
Stars: ✭ 448 (+30.61%)
Mutual labels:  expandable, collapse
TreeView
"TreeView - sub-cells simplified" (c). Enable subcells in UITableView with a single drop-in extension. CocoaPod:
Stars: ✭ 54 (-84.26%)
Mutual labels:  collapse, expandable
Grouprecyclerviewadapter
可增删改查、可动画展开收起、可吸附悬浮动态可配置的分组列表
Stars: ✭ 41 (-88.05%)
Mutual labels:  expandable, collapse
Accordion-Collapse-react-native
React native Accordion/Collapse component, very good to use in toggles & show/hide content
Stars: ✭ 147 (-57.14%)
Mutual labels:  collapse, expandable
Stickyscrollview
Sticky header and footer for android ScrollView.
Stars: ✭ 284 (-17.2%)
Mutual labels:  android-ui
Elasticprogressbar
Elastic Progress Bar Renew!
Stars: ✭ 314 (-8.45%)
Mutual labels:  android-ui
Cornersheet
Behavior to expand view from corner
Stars: ✭ 274 (-20.12%)
Mutual labels:  android-ui
Carbon
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.
Stars: ✭ 2,942 (+757.73%)
Mutual labels:  android-ui
Flexibleadapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience :-)
Stars: ✭ 3,482 (+915.16%)
Mutual labels:  expandable
Oneadapter
A Viewholderless Adapter for RecyclerView, who supports builtin diffing, states (paging, empty...), events (clicking, swiping...), and more.
Stars: ✭ 321 (-6.41%)
Mutual labels:  android-ui
Avatar View
Avatar ImageView with user's name first letter Drawable placeholder
Stars: ✭ 309 (-9.91%)
Mutual labels:  android-ui
Bottomdrawer
BottomSheet with animations
Stars: ✭ 291 (-15.16%)
Mutual labels:  android-ui
Android Login
Stars: ✭ 317 (-7.58%)
Mutual labels:  android-ui
Spotlight
Android Library that lights items for tutorials or walk-throughs etc...
Stars: ✭ 3,143 (+816.33%)
Mutual labels:  android-ui
Expenso
📊 A Minimal Expense Tracker App built to demonstrate the use of modern android architecture component with MVVM Architecture
Stars: ✭ 325 (-5.25%)
Mutual labels:  android-ui
Touchdemo
Custom touch handling in Android
Stars: ✭ 273 (-20.41%)
Mutual labels:  android-ui
Autocomplete
Simple yet powerful autocomplete behavior for EditTexts, to avoid working with MultiAutoCompleteTextView APIs.
Stars: ✭ 307 (-10.5%)
Mutual labels:  android-ui
Proswipebutton
A swipe button for Android with a circular progress bar for async operations
Stars: ✭ 319 (-7%)
Mutual labels:  android-ui

DoubleLift

License API Build Status Build Status Javadoc

🦋 Expands and collapses a layout horizontally and vertically sequentially.
Inspired by "Viewing Labels" from the Trello.

Including in your project

Maven Central Jitpack

Gradle

Add below codes to your root build.gradle file (not your module build.gradle file).

allprojects {
    repositories {
        mavenCentral()
    }
}

And add a dependency code to your module's build.gradle file.

dependencies {
    implementation "com.github.skydoves:doublelift:1.0.4"
}

Usage

Add following XML namespace inside your XML layout file.

xmlns:app="http://schemas.android.com/apk/res-auto"

DoubleLiftLayout

Here is a basic example of implementing DoubleLiftLayout.

<com.skydoves.doublelift.DoubleLiftLayout
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  app:doubleLift_foldedWidth="50dp" // sets the width size when collapsed.
  app:doubleLift_foldedHeight="10dp" // sets the height size when collapsed.
  app:doubleLift_horizontalDuration="400" // sets the duration of horizontal lifting.
  app:doubleLift_verticalDuration="300" // sets the duration of vertical lifting.
  app:doubleLift_cornerRadius="4dp" // sets the corner radius.
  app:doubleLift_autoExpand="false" // expand initially or not.
  app:doubleLift_startOrientation="horizontal"
  app:doubleLift_animation="bounce" // sets the lifting animation when expanding and collapsing
  >

  <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="Feature"
    android:textColor="@color/white_87"
    android:textStyle="bold" />
    
  // something complicated views or layouts
  
</com.skydoves.doublelift.DoubleLiftLayout>

Create using builder class

We can create an instance of DoubleLiftLayout using the DoubleLiftLayout.Builder class.

Java

DoubleLiftLayout doubleLiftLayout = new DoubleLiftLayout.Builder(context)
    .setFoldedWidth(200)
    .setFoldedHeight(100)
    .setCornerRadius(6)
    .setLiftHorizontalDuration(400)
    .setLiftVerticalDuration(200)
    .setOnExpandListener(new OnExpandListener() {
      @Override public void onExpand(boolean isExpanded) {
        toast("expanded: " + isExpanded);
      }
    }).build();

Kotlin

val myDoubleLiftLayout = DoubleLiftLayout.Builder(context)
  .setFoldedWidth(200)
  .setFoldedHeight(100)
  .setCornerRadius(6)
  .setLiftHorizontalDuration(400)
  .setLiftVerticalDuration(200)
  .setOnExpandListener { toast("expanded: $it") }
  .build()

Or we can create using the kotlin-dsl.

val myDoubleLiftLayout = doubleLiftLayout(this) {
  setFoldedWidth(200)
  setFoldedHeight(100)
  setCornerRadius(6)
  setLiftHorizontalDuration(400)
  setLiftVerticalDuration(200)
  setOnExpandListener { toast("expanded: $it") }
}

Expand and Collapse

We can expand and collapse using the below methods.

doubleLiftLayout.expand(); // expand the width and height size sequentially.
doubleLiftLayout.collapse(); // collapse the width and height size sequentially.

or we can do something after expanded using lambda in Kotlin.

doubleLiftLayout.expand { toast("expanded!") }
doubleLiftLayout.collapse { toast("collapsed!") }

OnExpandListener

We can listen to the DoubleLiftLayout is expanded or collapsed.

Java

.setOnExpandListener(new OnExpandListener() {
  @Override public void onExpand(boolean isExpanded) {
    toast("expanded: " + isExpanded);
  }
}

Kotlin

doubleLiftLayout.onExpandListener = object : OnExpandListener {
  override fun onExpand(isExpanded: Boolean) {
    toast("Expanded : $it")
  }
}

// or we can listen using a lambda expression.
doubleLiftLayout.setOnExpandListener {
  if (it) {
    toast("expanded")
  } else {
    toast("collapse")
  }
}

LiftAnimation

We can customize the expanding and collapsing animation.

LiftAnimation.NORMAL
LiftAnimation.ACCELERATE
LiftAnimation.BOUNCE
NORMAL ACCELERATE BOUNCE

DoubleLiftLayout Attributes

Attributes Type Default Description
foldedWidth Dimension 0 sets the width size when collapsed.
foldedHeight Dimension 0 ets the height size when collapsed.
horizontalDuration Long 500L sets the duration of horizontal lifting.
verticalDuration Long 300L sets the duration of vertical lifting.
cornerRadius Dimension 4dp sets the corner radius.
autoExpand Boolean false invkoe expand() method initially or not.
startOrientation LiftStartOrientation LiftStartOrientation.HORIZONTAL sets the starting orientation of the lifting.
animation LiftAnimation LiftAnimation.NORMAL sets the lifting animation when expanding and collapsing

Find this library useful? ❤️

Support it by joining stargazers for this repository. ⭐️
And follow me for my next creations! 🤩

License

Copyright 2019 skydoves (Jaewoong Eum)

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].