https://github.com/boybeak/starter
A quick starter package for android developer.
https://github.com/boybeak/starter
drag-exit imagepicker permission-android starter
Last synced: about 1 year ago
JSON representation
A quick starter package for android developer.
- Host: GitHub
- URL: https://github.com/boybeak/starter
- Owner: boybeak
- License: apache-2.0
- Created: 2018-06-25T03:11:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-19T07:09:40.000Z (over 4 years ago)
- Last Synced: 2025-05-13T00:48:27.142Z (about 1 year ago)
- Topics: drag-exit, imagepicker, permission-android, starter
- Language: Java
- Homepage:
- Size: 4.3 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Starter
中文[Readme.md](https://github.com/boybeak/Starter/blob/master/README_cn.md)
There are 4 libraries in this project:[ **Starter**](https://github.com/boybeak/Starter#starter--), [**Drag-Exit**](https://github.com/boybeak/Starter#drag-exit--), [**Permission**](https://github.com/boybeak/Starter#permission--), [**Picker**](https://github.com/boybeak/Starter#picker--), [**SAFR**](https://github.com/boybeak/Starter#safr--)
## Starter[  ](https://bintray.com/boybeak/nulldreams/starter/_latestVersion)
This is a quick start package, including BaseActivity, BaseFragment and utils classes;
```groovy
implementation 'com.github.boybeak:starter:x.y.z'
```
#### Starter structure
| package | class | description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [**activity**](https://github.com/boybeak/Starter/wiki/activity) | [BaseActivity](https://github.com/boybeak/Starter/wiki/activity#baseactivity),[BaseDragExitActivity](https://github.com/boybeak/Starter/wiki/activity#basedragexitactivity),[DataBindingActivity](https://github.com/boybeak/Starter/wiki/activity#basedragexitactivity),DataBindingToolbarActivity,DragExitToolbarActivity, SrlRvActivity, [ToolbarActivity](https://github.com/boybeak/Starter/wiki/activity#toolbaractivity),ToolbarViewPagerActivity | Some basic activities |
| [**adapter**](https://github.com/boybeak/Starter/wiki/adapter) | [DataBindingAdapter](https://github.com/boybeak/Starter/wiki/adapter#databindingadapter),[FooterAdapter](https://github.com/boybeak/Starter/wiki/adapter#footeradapter),BaseLayoutImpl,AbsDataBindingHolder, [DataChange](https://github.com/boybeak/Starter/wiki/adapter#datachange) | Only some main class a presented |
| [**broadcast**](https://github.com/boybeak/Starter/wiki/broadcast) | AbsReceiver, BroadcastUtils | Add isRegistered state in AbsReceiver.Use this with **BroadcastUtils** |
| [**fragment**](https://github.com/boybeak/Starter/wiki/fragment) | BaseFragment, BaseDialogFragment, BaseBottomDialogFragment, RefreshListFragment, PaginationFragment | |
| [**mvc**](https://github.com/boybeak/Starter/wiki/mvc) | | It's not too useful |
| [**retrofit**](https://github.com/boybeak/Starter/wiki/retrofit) | SimpleCallback, SimpleListCallback, SafeCallback, SafeListCallback | Some quick retrofit callback |
| [**utils**](https://github.com/boybeak/Starter/wiki/utils) | AssetUtil, Connectivity, FileUtil, ImeUtil | Some useful utils |
| [**widget**](https://github.com/boybeak/Starter/wiki/widget) | BottomHideBehavior, Chip, EmptyView, OnScrollBottomListener, PagerStateAdapter, ProgressBar, RatioCardView, RatioImageView,RatioViewPager, SearchBar, SimpleViewPagerFragmentAdapter | |
| [Others](https://github.com/boybeak/Starter/wiki/Others) | [CrashHandler](https://github.com/boybeak/Starter/wiki/Others/_edit#crashhandler), GetNothingImpl, ILife, [Intents](https://github.com/boybeak/Starter/wiki/Others/_edit#intents), [Memory](https://github.com/boybeak/Starter/wiki/Others/_edit#memory), [Router](https://github.com/boybeak/Starter/wiki/Others/_edit#router), [SafeHandler](https://github.com/boybeak/Starter/wiki/Others/_edit#safehandler) | |
[See full wiki document](https://github.com/boybeak/Starter/wiki)
## Drag-Exit[  ](https://bintray.com/boybeak/nulldreams/drag-exit/_latestVersion)
```groovy
implementation 'com.github.boybeak:drag-exit:x.y.z'
```

There's only one FrameLayout's sub class **DragExitLayout**. Use the layout like this:
```xml
```
```kotlin
class DragExitActivity : AppCompatActivity() {
private val dragListener = object : DragExitLayout.OnExitListener {
override fun onExit() {
finish()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
super.setContentView(R.layout.activity_drag_exit)
drag_exit_layout.setOnExitListener(dragListener)
web_view.webViewClient = WebViewClient()
web_view.webChromeClient = WebChromeClient()
web_view.loadUrl("https://github.com/boybeak/Starter")
}
}
```
Some attributes as below:
- **activeEdges** - *enum*: 3 values are available, **left**, **right** and **both**, which edge can active the drag gesture.
- **exitLineRatio** - *float*: Available values in range (0, 1), the exit action trigger ratio of layout width.
- **stuckEffect** - *boolean*: Whether should the child view stuck at exitLineRation position or not.
- **lazy** - *float*: Available values in range (0, 1). If set to 0.5, your finger move 100 pixels, the child view actually move 50 pixels.
- **alphaEffect** - *boolean*: Whether the child view change its alpha when moving.
- **alphaMin** - *float*: The minimum value of the child view can be. Once the child view moves to exitLineRation position, the alpha will be alphaMin.
- **scaleEffect** - *boolean*, same as alphaEffect
- **scaleMin** - *float*: same as alphaMin
More about **exitLineRatio** see the image below:
If set exitLineRation to 0.25.

> Don't forget use a transparent theme to your activity if you want a drag-exit activity. Or you can use **BaseDragExitActivity** or **DragExitToolbarActivity** in the **Starter** library.
## Permission[  ](https://bintray.com/boybeak/nulldreams/permission/_latestVersion)
This is a permission helper. Quickly grant permissions.
```groovy
implementation 'com.github.boybeak:permission:x.y.z'
```
```kotlin
PH.ask(Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO).go(this, object : Callback {
override fun onGranted(permissions: MutableList) {
//TODO do what you want
}
override fun onDenied(permission: String) {
//TODO do what you want
}
})
```
**PH** is short for Permission Helper.
## Picker[  ](https://bintray.com/boybeak/nulldreams/picker/_latestVersion)
A helper library for getting images and videos quickly.
```groovy
implementation 'com.github.boybeak:picker:x.y.z'
```
```kotlin
// Get multiple images from gallery
Picker.gallery().image().multiple(true)
.go(this@PickerActivity, object : MultipleCallback {
override fun onGet(id: String, uris: MutableList, files: MutableList) {
adapter!!.addAll(files, Converter { data, _ -> FileImpl(data) }).autoNotify()
}
override fun onCancel(id: String) {
}
})
```
```kotlin
// Get one image from camera
val dir = File(externalCacheDir, "images")
if (!dir.exists()) {
dir.mkdirs()
}
val cameraTempFile = File(dir, System.currentTimeMillis().toString() + ".jpg")
val uri = FileProvider.getUriForFile(this@PickerActivity, "$packageName.provider", cameraTempFile)
Picker.camera().image().output(uri, cameraTempFile)
.go(this@PickerActivity, object : SingleCallback {
override fun onGet(id: String, uri: Uri, file: File) {
adapter!!.add(FileImpl(file)).autoNotify()
}
override fun onCancel(id: String) {
}
})
```
With this library, you can get images easily from gallery and camera. Support getting multiple images and videos from gallery, and getting one image or video from camera.
## SAFR[  ](https://bintray.com/boybeak/nulldreams/safr/_latestVersion)
```groovy
implementation 'com.github.boybeak:safr:x.y.z'
```
**SAFR** is short for **startActivityForResult**.
```kotlin
SAFR.newInstance().extras {
//fill data here
}.byAction(Intent.ACTION_GET_CONTENT)
.startActivityForResult(this, 100, object : Callback {
override fun onResult(requestCode: Int, resultCode: Int, data: Intent?) {
}
})
```