Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.

Overview

Please switch to DragView, for the best support, thank you

DraggablePanel

Alt text Alt text Alt text
Alt text Alt text Alt text

Download

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
    
    
    	dependencies {
	        implementation 'com.github.hoanganhtuan95ptit:DraggablePanel:1.2.5'
	}

Using Detail code java

  • Xml
        <com.hoanganhtuan95ptit.draggable.DraggablePanel
                android:id="@+id/draggablePanel"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:height_when_max="300dp"
                app:height_when_min="80dp"
                app:margin_bottom_when_min="8dp"
                app:margin_edge_when_min="8dp"
                app:percent_when_middle="0.9"
                app:state="MIN" />
Alt text Alt text
  • Listener
        draggablePanel.setDraggableListener(object : DraggablePanel.DraggableListener {
            override fun onChangeState(state: DraggablePanel.State) {
            }

            override fun onChangePercent(percent: Float) {
                alpha.alpha = 1 - percent
            }

        })
  • Add frame
        supportFragmentManager.beginTransaction().add(R.id.frameFirst, TopFragment()).commit() // add frame top
        supportFragmentManager.beginTransaction().add(R.id.frameSecond, BottomFragment()).commit() // add frame bottom

Alt text

  • Action
        btnMax.setOnClickListener { draggablePanel.maximize() }// maximize
        btnMin.setOnClickListener { draggablePanel.minimize() }//minimizeo
        btnClose.setOnClickListener { draggablePanel.close() }//close

Custom Detail code java

  • Custom
        class DraggableSource @JvmOverloads constructor(
                context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
        ) : DraggablePanel(context, attrs, defStyleAttr) {
        
            var mWidthWhenMax = 0
        
            var mWidthWhenMiddle = 0
        
            var mWidthWhenMin = 0
        
            init {
                getFrameFirst().addView(inflate(R.layout.layout_top))
                getFrameSecond().addView(inflate(R.layout.layout_bottom))
            }
        
            override fun initFrame() {
                mWidthWhenMax = width
        
                mWidthWhenMiddle = (width - mPercentWhenMiddle * mMarginEdgeWhenMin).toInt()
        
                mWidthWhenMin = mHeightWhenMin * 22 / 9
        
                super.initFrame()
            }
        
            override fun refreshFrameFirst() {
                super.refreshFrameFirst()
        
                val width = if (mCurrentPercent < mPercentWhenMiddle) {
                    (mWidthWhenMax - (mWidthWhenMax - mWidthWhenMiddle) * mCurrentPercent)
                } else {
                    (mWidthWhenMiddle - (mWidthWhenMiddle - mWidthWhenMin) * (mCurrentPercent - mPercentWhenMiddle) / (1 - mPercentWhenMiddle))
                }
        
                frameTop.reWidth(width.toInt())
            }
        }
  • Xml
        <com.hoanganhtuan95ptit.example.custom.DraggableSource
                android:id="@+id/draggablePanel"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:height_when_max="300dp"
                app:height_when_min="80dp"
                app:margin_bottom_when_min="8dp"
                app:margin_edge_when_min="8dp"
                app:percent_when_middle="0.9"
                app:state="MIN" />
  • Code
        draggablePanel.setDraggableListener(object : DraggablePanel.DraggableListener {
            override fun onChangeState(state: DraggablePanel.State) {
            }

            override fun onChangePercent(percent: Float) {
                alpha.alpha = 1 - percent
                shadow.alpha = percent
            }

        })

        supportFragmentManager.beginTransaction().add(R.id.frameTop, TopFragment()).commit()
        supportFragmentManager.beginTransaction().add(R.id.frameBottom, BottomFragment()).commit()

        btnMax.setOnClickListener { draggablePanel.maximize() }
        btnMin.setOnClickListener { draggablePanel.minimize() }
        btnClose.setOnClickListener { draggablePanel.close() }
You might also like...
Added support to modify text size and indicator width based on the original TabLayout.
Added support to modify text size and indicator width based on the original TabLayout.

XTabLayout——可修改选中项字体大小和指示器长度的TabLayout XTabLayout是基于design包中的TabLayout进行了功能的扩展,在保留原有功能的基础上,增加了修改选中项字体大小、修改指示器长度以及限制屏幕显示范围内显示的Tab个数。 集成步骤: 1.添加XTabLayo

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

An Android library that help you to build app with swipe back gesture.
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

SwipeBack is an android library that can finish a activity by using gesture.
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

A very simple arc layout library for Android
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

A floating menu library for Android.
A floating menu library for Android.

Hover Hover is a floating menu implementation for Android. Goals The goals of Hover are to: Provide an easy-to-use, out-of-the-box floating menu imple

Simple android library to present an animated ferris wheel
Simple android library to present an animated ferris wheel

Ferris Wheel View Overview An Android Library used to implement an animated Ferris Wheel in android. API SDK 15+ Written in Kotlin Supports landscape

Android Library that lights items for tutorials or walk-throughs etc...
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

It's an Android library that allows you to use Layout as RadioButton or CheckBox.
It's an Android library that allows you to use Layout as RadioButton or CheckBox.

Android - CompoundLayout It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gra

Comments
  • Error in version 1.2.5

    Error in version 1.2.5

    E/InputEventReceiver: Exception dispatching input event. E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback E/MessageQueue-JNI: java.lang.IllegalArgumentException: Starting value need to be in between min value and max value at androidx.dynamicanimation.animation.DynamicAnimation.startAnimationInternal(DynamicAnimation.java:620) at androidx.dynamicanimation.animation.DynamicAnimation.start(DynamicAnimation.java:580) at androidx.dynamicanimation.animation.SpringAnimation.start(SpringAnimation.java:136) at com.hoanganhtuan95ptit.draggable.utils.UtilsExtensionsKt.springAnimation(UtilsExtensions.kt:40) at com.hoanganhtuan95ptit.draggable.DraggablePanel.springYAnim(DraggablePanel.kt:542) at com.hoanganhtuan95ptit.draggable.DraggablePanel.minToMaxAnim(DraggablePanel.kt:512) at com.hoanganhtuan95ptit.draggable.DraggablePanel.access$minToMaxAnim(DraggablePanel.kt:19) at com.hoanganhtuan95ptit.draggable.DraggablePanel$1.handleUp(DraggablePanel.kt:177) at com.hoanganhtuan95ptit.draggable.DraggablePanel$1.onTouchEvent(DraggablePanel.kt:145) at com.hoanganhtuan95ptit.draggable.widget.DragFrame.onTouchEvent(DragFrame.kt:19) at android.view.View.dispatchTouchEvent(View.java:8529) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2463) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2194) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2469) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2208) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2472) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1779) at android.app.Activity.dispatchTouchEvent(Activity.java:2776) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2433) at android.view.View.dispatchPointerEvent(View.java:8719) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4118) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3978) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3540) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3593) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3559) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3669) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3567) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3726) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3540) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3593) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3559) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3567) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3540) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5864) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5838) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5809) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImp

    opened by irgiwithproton 0
  • That Library have java version?

    That Library have java version?

    Hello, i want to create a app like that example but my project created with java. I found "pedrovgs/DraggablePanel" but it archived. I cant use it. Can i found that library's java version?

    opened by cemalsayin 5
Owner
Hoàng Anh Tuấn
Hoàng Anh Tuấn
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

null 33 Dec 8, 2022
Android component which presents a dismissible view from the bottom of the screen

BottomSheet BottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replaceme

Flipboard 4.5k Dec 28, 2022
ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way

ConstraintLayout is a layout manager for Android which allows you to position and size widgets in a flexible way. It's available for both the Android view system and Jetpack Compose.

Android Jetpack 970 Jan 6, 2023
This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout.

android-PullRefreshLayout This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout. Demo Usage Add dependency. dependencie

星一 2.1k Dec 3, 2022
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022
A togglelayout that can be used in setting interface

ToggleExpandLayout A togglelayout that can be used in setting interface. Originally designed by dribbble. And the author said that's why he designed t

Rongchan Liu 893 Dec 6, 2022
null 2.4k Dec 30, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Nov 21, 2022
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!

RecyclerRefreshLayout English | 中文版 RecyclerRefreshLayout based on the {@link android.support.v4.widget.SwipeRefreshLayout} The RecyclerRefreshLayout

dinus_developer 1.7k Nov 10, 2022