All Projects → stfalcon-studio → swipeable-button

stfalcon-studio / swipeable-button

Licence: Apache-2.0 license
Android Swipeable button like in iOS unlock screen. Made by Stfalcon

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to swipeable-button

iron-swipeable-pages
[Polymer 1.x] Element that enables switching between different pages by swiping gesture.
Stars: ✭ 51 (-38.55%)
Mutual labels:  swipe
drag-to-close
Android library that provides a view group which allows to finish an activity by dragging a view.
Stars: ✭ 69 (-16.87%)
Mutual labels:  swipe
react-native-viewpager-carousel
a flexible viewpager library with carousel functionality
Stars: ✭ 39 (-53.01%)
Mutual labels:  swipe
vue-product-carousel
Simple product carousel with hot image replacement, Zoom and Swipe mode
Stars: ✭ 37 (-55.42%)
Mutual labels:  swipe
react-swipe-component
Swipe bindings for react
Stars: ✭ 48 (-42.17%)
Mutual labels:  swipe
Flare
A full-fledged unofficial Angular-based Tinder web client
Stars: ✭ 23 (-72.29%)
Mutual labels:  swipe
RNSlidingButton
React Native Button component which support Slide event to perform action.
Stars: ✭ 19 (-77.11%)
Mutual labels:  swipe
skeleton-carousel
Carousel component. Horizontal and vertical swipe navigation
Stars: ✭ 31 (-62.65%)
Mutual labels:  swipe
login screen ui
A Customise login screen UI developed in Flutter.
Stars: ✭ 13 (-84.34%)
Mutual labels:  custom-button
gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (-62.65%)
Mutual labels:  swipe
react-native-segment-control
Swipeable SegmentedControl component for React Native apps
Stars: ✭ 21 (-74.7%)
Mutual labels:  swipe
swipeablerecyclerview
SwipeableRecyclerView provides a wrapper class SwipeItemTouchHelperCallback which can be used to add Dragging capability to your RecyclerView items. You can make use of DataBinding to bind it via XML.
Stars: ✭ 16 (-80.72%)
Mutual labels:  swipe
simple gesture detector
Easy to use, reliable and lightweight gesture detector for Flutter apps, exposing simple API for basic gestures
Stars: ✭ 26 (-68.67%)
Mutual labels:  swipe
MetalRecyclerPagerView
RecyclerView implementation for Android which makes it look and feel like ViewPager with item margins support (mutliple views effect).
Stars: ✭ 26 (-68.67%)
Mutual labels:  swipe
FavFighters
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 32 (-61.45%)
Mutual labels:  swipe
kikder-dating-swipe-app
❤️ Kik App, you know? 💑 Kikder™ is a dating webapp that integrates the Kik, uses the HorOrNot game and the Tinder swipe. The F.A.S.T. Game Approach! The web app uses a custom lightweight MVC framework.
Stars: ✭ 21 (-74.7%)
Mutual labels:  swipe
react-native-swipe-close-image
A React native swipe to close image
Stars: ✭ 18 (-78.31%)
Mutual labels:  swipe
slider-manager
simple wrapper to create sliders focused on animations
Stars: ✭ 28 (-66.27%)
Mutual labels:  swipe
XamarinItemTouchHelper
Basic example of using ItemTouchHelper to add drag & drop and swipe-to-dismiss to RecyclerView for Xamarin
Stars: ✭ 35 (-57.83%)
Mutual labels:  swipe
vue-bottom-navigation
Vue bottom navigation
Stars: ✭ 56 (-32.53%)
Mutual labels:  swipe

swipeable-button

Who we are

Need iOS and Android apps, MVP development or prototyping? Contact us via [email protected]. We develop software since 2009, and we're known experts in this field. Check out our portfolio and see more libraries from stfalcon-studio.

Download

Download via Gradle: compile 'com.github.stfalcon:swipeable-button:0.1.0'

Usage

Just put this code into your layout:

<com.stfalcon.swipeablebutton.SwipeableButton
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

You can use many attributes for more flexibility and convenience of use. Here's the full list:

  • isChecked - Initial state. Boolean. False by default
  • isEnabled - Is button enabled. Boolean. True by default
  • textChecked - Text for checked state
  • textUnchecked - Text for unchecked state
  • textColorChecked - Text color when button is checked
  • textColorUnchecked - Text color when button is unchecked
  • textSize - Text size
  • thresholdStart - Value in range [0..1] indicates how much user needs to swipe to change status from unchecked to checked. 0.5 by default
  • thresholdEnd - Value in range [0..1] indicates how much user needs to swipe to change status from checked to unchecked. 0.5 by default
  • checkedBackground - Button background drawable for checked state.
  • uncheckedBackground - Button background drawable for unchecked state.
  • checkedToggleBackground - Toggle background drawable when button is checked.
  • uncheckedToggleBackground - Toggle background drawable when button is unchecked.
  • checkedIcon - Toggle icon drawable when button is checked
  • uncheckedIcon - Toggle icon drawable when button is unchecked

For example:

<com.stfalcon.swipeablebutton.SwipeableButton
    android:id="@+id/customSwipeButton2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="64dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    app:checkedBackground="@drawable/shape_sample_scrolling_view_checked"
    app:checkedIcon="@drawable/ic_visible"
    app:checkedToggleBackground="@drawable/shape_sample_checked_toggle"
    app:durationAnimation="250"
    app:isClickToSwipeEnable="false"
    app:thresholdEnd="0.3"
    app:thresholdStart="0.7"
    app:textChecked="@string/checked_state_text"
    app:textColorChecked="@color/checkedTextColor"
    app:textColorUnChecked="@color/uncheckedTextColor"
    app:textSize="8sp"
    app:textUnchecked="@string/unchecked_state_text"
    app:uncheckedBackground="@drawable/shape_sample_scrolling_view_unchecked"
    app:uncheckedIcon="@drawable/ic_usvisible"
    app:uncheckedToggleBackground="@drawable/shape_sample_unchecked_toggle" />

Also you can set them programmatically:

swipeableButton.isChecked = true
swipeableButton.isEnable = true
swipeableButton.checkedText = "Checked text"
swipeableButton.uncheckedText = "Unchecked text"
swipeableButton.textSize = resources.getDimensionPixelSize(R.dimen.default_text_size).toFloat()
swipeableButton.swipeProgressToFinish = 0.1
swipeableButton.swipeProgressToStart = 0.3
swipeableButton.checkedTextColor = ContextCompat.getColor(this,R.color.checkedTextColor)
swipeableButton.uncheckedTextColor = ContextCompat.getColor(this,R.color.uncheckedTextColor)
swipeableButton.checkedBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_scrolling_view_checked)
swipeableButton.uncheckedBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_scrolling_view_unchecked)
swipeableButton.checkedToggleBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_checked_toggle)
swipeableButton.uncheckedToggleBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_unchecked_toggle)
swipeableButton.checkedIcon = ContextCompat.getDrawable(this, R.drawable.ic_done_black)
swipeableButton.uncheckedIcon = ContextCompat.getDrawable(this, R.drawable.ic_pause_black)

If you want to change the state programmatically with animation you should use setSwipeButtonState method:

animateBtn.setOnClickListener {
   swipeButton.setSwipeButtonState(!swipeableButton.isChecked)
}

If you want to get event from swipable-button you need to add next listeners:

  • onSwipedListener
  • onSwipedOnListener
  • onSwipedOffListener

Let's take look a small sample:

customSwipeButton.onSwipedListener = {
   Log.d(TAG, "onSwiped")
}
customSwipeButton.onSwipedOnListener = {
   Log.d(TAG, "onSwipedOn")
}
customSwipeButton.onSwipedOffListener = {
   Log.d(TAG, "onSwipedOff")
}

License

Copyright 2018 stfalcon.com

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].