All Projects → tuanhav95 → Dragview

tuanhav95 / Dragview

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

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Dragview

Superembed.js
Fluid width for YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more embedded videos.
Stars: ✭ 615 (+259.65%)
Mutual labels:  library, youtube
DraggablePanel
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.
Stars: ✭ 94 (-45.03%)
Mutual labels:  youtube, draggable
Arabiccompetitiveprogramming
The repository contains the ENGLISH description files attached to the video series in my ARABIC algorithms channel.
Stars: ✭ 675 (+294.74%)
Mutual labels:  library, youtube
Android Dev Sources
All those Android development sources that you need to be and stay awesome!
Stars: ✭ 434 (+153.8%)
Mutual labels:  library, youtube
Scrollbooster
Enjoyable content drag-to-scroll library
Stars: ✭ 775 (+353.22%)
Mutual labels:  library, draggable
Mirrordiffkit
Graduation from messy XCTAssertEqual messages.
Stars: ✭ 168 (-1.75%)
Mutual labels:  library
Emailintentbuilder
An Android Library for the creation of SendTo Intents with mailto: URI
Stars: ✭ 168 (-1.75%)
Mutual labels:  library
Bttn.css
Awesome buttons for awesome projects!
Stars: ✭ 2,004 (+1071.93%)
Mutual labels:  library
Nodetube
Open-source YouTube alternative that offers video, audio and image uploads, livestreaming and built-in monetization
Stars: ✭ 2,066 (+1108.19%)
Mutual labels:  youtube
Media Watermark
GPU/CPU-based iOS Watermark Library for Image and Video Overlay
Stars: ✭ 170 (-0.58%)
Mutual labels:  library
Mctrl
C library providing set of additional user interface controls for Windows, intended to be complementary to standard Win32API controls from USER32.DLL and COMCTL32.DLL.
Stars: ✭ 169 (-1.17%)
Mutual labels:  library
Binarypack
The fastest and most memory efficient binary serialization library for .NET Standard 2.1, powered by dynamic IL generation
Stars: ✭ 169 (-1.17%)
Mutual labels:  library
Showroom
Stars: ✭ 168 (-1.75%)
Mutual labels:  library
Libwacom
libwacom is a tablet description library
Stars: ✭ 169 (-1.17%)
Mutual labels:  library
Focusoverlay
Library for creating animated overlays on focused elements
Stars: ✭ 167 (-2.34%)
Mutual labels:  library
Libgrape Lite
🍇 A C++ library for parallel graph processing 🍇
Stars: ✭ 169 (-1.17%)
Mutual labels:  library
Rrule
JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
Stars: ✭ 2,249 (+1215.2%)
Mutual labels:  library
Ablemusicplayer
🎵 A Youtube Music like app with a Spotify like design - ad free and open source. Feel free to PR. NOTE: BEING REWRITTEN, HENCE THE REPO WILL BE INACTIVE FOR A WHILE
Stars: ✭ 167 (-2.34%)
Mutual labels:  youtube
Acl Anthology
Data and software for building the ACL Anthology.
Stars: ✭ 168 (-1.75%)
Mutual labels:  library
Ng Aquila
Angular UI Component library for the Open Insurance Platform
Stars: ✭ 170 (-0.58%)
Mutual labels:  library

DragView

Alt text

Download

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
    
    
    	dependencies {
	        implementation 'com.github.tuanhav95:DragView:1.1.0'
	}

Using Detail code java

  • Xml
   <com.tuanhav95.drag.DragView
        android:id="@+id/dragView"
        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
        dragView.setDragListener(object : DragView.DragListener {
            override fun onChangeState(state: DragView.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 { dragView.maximize() }
        btnMin.setOnClickListener { dragView.minimize() }
        btnClose.setOnClickListener { dragView.close() }

Custom Detail code java

  • Custom
        class DragSource @JvmOverloads constructor(
        	context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
	) : DragView(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.tuanhav95.example.custom.DragSource
        android:id="@+id/dragView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:height_when_max="300dp"
        app:height_when_min="58dp"
        app:state="MIN" />
  • Code
        dragView.setDragListener(object : DragView.DragListener {
            override fun onChangeState(state: DragView.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 { dragView.maximize() }
        btnMin.setOnClickListener { dragView.minimize() }
        btnClose.setOnClickListener { dragView.close() }

Hello

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