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
val dirRequest = | |
registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri: Uri? -> | |
uri?.let { folderUri -> | |
contentResolver.takePersistableUriPermission( | |
folderUri, | |
Intent.FLAG_GRANT_READ_URI_PERMISSION | |
) | |
//use picked uri android |
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
http://www.java2s.com/example/java-api/android/provider/documentscontract/builddocumenturiusingtree-2-0.html |
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
buildFeatures { | |
viewBinding true | |
} | |
// activity and lifecycle | |
implementation 'androidx.activity:activity-ktx:1.5.1' | |
implementation 'androidx.fragment:fragment-ktx:1.5.2' | |
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" | |
implementation 'androidx.lifecycle:lifecycle-common-java8:2.5.1' |
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
<application | |
android:resizeableActivity="false" |
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
private fun giveMeCenterPosition(): Int { | |
val firstPos = layoutManager!!.findFirstVisibleItemPosition() | |
val lastPos = layoutManager!!.findLastVisibleItemPosition() | |
val middle = abs(lastPos - firstPos) / 2 + firstPos | |
return middle | |
} |
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
package moozy.com.moozy.gestures; | |
import android.content.Context; | |
import android.view.GestureDetector; | |
import android.view.GestureDetector.SimpleOnGestureListener; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.View.OnTouchListener; | |
public class OnSwipeTouchListener implements OnTouchListener { |
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
package cc.cubone.turbo.core.app; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.view.View; | |
/** | |
* Fragment for handling view after it has been created and visible to user for the first time. | |
* | |
* <p>Specially in {@link android.support.v4.view.ViewPager}, the page will be created beforehand |