-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Commit451/kt
Conversion to Kotlin
- Loading branch information
Showing
11 changed files
with
1,561 additions
and
1,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
app/src/main/java/com/commit451/betterviewdraghelper/sample/AllowsForDragFrameLayout.java
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/commit451/betterviewdraghelper/sample/AllowsForDragFrameLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.commit451.betterviewdraghelper.sample | ||
|
||
import android.annotation.TargetApi | ||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.MotionEvent | ||
import android.view.View | ||
import android.widget.FrameLayout | ||
|
||
import com.commit451.translationviewdraghelper.TranslationViewDragHelper | ||
|
||
/** | ||
* FrameLayout that allows dragging its inner views around | ||
*/ | ||
class AllowsForDragFrameLayout : FrameLayout { | ||
|
||
private var viewDragHelper: TranslationViewDragHelper | ||
|
||
private var callback: TranslationViewDragHelper.Callback = object : TranslationViewDragHelper.Callback() { | ||
override fun tryCaptureView(child: View, pointerId: Int): Boolean { | ||
//Any children can be captured | ||
return true | ||
} | ||
|
||
override fun clampViewPositionHorizontal(child: View, left: Int, dx: Int): Int { | ||
//allow full movement along horizontal axis | ||
return left | ||
} | ||
|
||
override fun clampViewPositionVertical(child: View, top: Int, dy: Int): Int { | ||
//allow full movement along vertical axis | ||
return top | ||
} | ||
} | ||
|
||
constructor(context: Context) : super(context) | ||
|
||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) | ||
|
||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) | ||
|
||
@TargetApi(21) | ||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) | ||
|
||
init { | ||
viewDragHelper = TranslationViewDragHelper.create(this, 1.0f, callback) | ||
} | ||
|
||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { | ||
return viewDragHelper.shouldInterceptTouchEvent(ev) | ||
} | ||
|
||
override fun onTouchEvent(event: MotionEvent): Boolean { | ||
viewDragHelper.processTouchEvent(event) | ||
return true | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
app/src/main/java/com/commit451/betterviewdraghelper/sample/MainActivity.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/commit451/betterviewdraghelper/sample/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.commit451.betterviewdraghelper.sample | ||
|
||
import android.os.Bundle | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Tue Oct 30 11:13:29 CDT 2018 | ||
#Tue Oct 08 00:16:41 CDT 2019 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.