underwindfall / Powerpermission
Licence: apache-2.0
Android Permission lib PowerPermission makes handling runtime permissions extremely easy.
Stars: ✭ 103
Programming Languages
kotlin
9241 projects
Projects that are alternatives of or similar to Powerpermission
Sunset-hadith
Islamic app written with Kotlin, using KTOR + coroutines + flow + MVVM + Android Jetpack + Navigation component. Old version using RxJava + Retrofit + OKHttp
Stars: ✭ 26 (-74.76%)
Mutual labels: coroutines, rxjava2, livedata
Kpermissions
A Kotlin library which helps to request runtime permissions in Android.
Stars: ✭ 253 (+145.63%)
Mutual labels: rxjava2, coroutines, livedata
Fountain
Android Kotlin paged endpoints made easy
Stars: ✭ 175 (+69.9%)
Mutual labels: rxjava2, coroutines, livedata
eyepetizer kotlin
一款仿开眼短视频App,分别采用MVP、MVVM两种模式实现。一、组件化 + Kotlin + MVP + RxJava + Retrofit + OkHttp 二、组件化 + Kotlin + MVVM + LiveData + DataBinding + Coroutines + RxJava + Retrofit + OkHttp
Stars: ✭ 83 (-19.42%)
Mutual labels: coroutines, rxjava2, livedata
Mvvmsmart
基于谷歌最新AAC架构,MVVM设计模式的一套快速开发库,整合ViewModel+Lifecycles+Navigation+DataBinding+LiveData+Okhttp+Retrofit+RxJava+Glide等主流模块,满足日常开发需求。使用该框架可以快速开发高质量、易维护的Android应用。 项目组会持续维护,请放心使用.欢迎Start并Fork交流.
Stars: ✭ 382 (+270.87%)
Mutual labels: rxjava2, livedata
Kotlin Mvvm Covid19
This repository contains simple COVID19 data monitoring with android stack MVVM, Live Data, Koin, RxJava, RxBinding, Offline first with simple caching, etc
Stars: ✭ 372 (+261.17%)
Mutual labels: rxjava2, livedata
Refactored Umbrella
Example of Flow + LiveData w/ Room as single source of truth for data in an MVVM architecture
Stars: ✭ 100 (-2.91%)
Mutual labels: coroutines, livedata
Sample Code Movies
This repository contains sample code. Its purpose being, to quickly demonstrate Android and software development in general, clean code, best practices, testing and all those other must know goodies.
Stars: ✭ 81 (-21.36%)
Mutual labels: coroutines, livedata
Architecturecomponentsdemo
Kotlin demo project that uses some Android Architecture Components (ViewModel and LiveData) with Dagger 2 and Coroutines
Stars: ✭ 269 (+161.17%)
Mutual labels: coroutines, livedata
Netdiscovery
NetDiscovery 是一款基于 Vert.x、RxJava 2 等框架实现的通用爬虫框架/中间件。
Stars: ✭ 573 (+456.31%)
Mutual labels: rxjava2, coroutines
Base Mvvm
App built to showcase basic Android View components like ViewPager, RecyclerView(homogeneous and heterogeneous items), NavigationDrawer, Animated Vector Drawables, Collapsing Toolbar Layout etc. housed in a MVVM architecture
Stars: ✭ 18 (-82.52%)
Mutual labels: rxjava2, livedata
Jetpack Wanandroid
Kotlin+Jetpack+Coroutines+Retrofit+koin 完成的MVVM 组件化客户端 🔥🔥
Stars: ✭ 353 (+242.72%)
Mutual labels: coroutines, livedata
News Sample App
A sample news app which demonstrates clean architecture and best practices for developing android app
Stars: ✭ 334 (+224.27%)
Mutual labels: rxjava2, livedata
Mvvmarms
Android MVVM Architecture Components based on MVPArms and Android Architecture Components.
Stars: ✭ 425 (+312.62%)
Mutual labels: rxjava2, livedata
Moko Mvvm
Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 329 (+219.42%)
Mutual labels: coroutines, livedata
Offlinesampleapp
Sample Offline-First MVVM app that uses Android Priority Job Queue, Room, Retrofit2, LiveData, LifecycleObserver, RxJava2, Dagger Android
Stars: ✭ 653 (+533.98%)
Mutual labels: rxjava2, livedata
Newssync
Sample application with MVVM pattern using RxJava and Architecture Components
Stars: ✭ 46 (-55.34%)
Mutual labels: rxjava2, livedata
Wanandroid
Jetpack MVVM For Wanandroid 最佳实践 !
Stars: ✭ 1,004 (+874.76%)
Mutual labels: coroutines, livedata
Retrokotlin
Simple Android app to show how unit testing with MockWebServer and Architecture Components (ViewModel + LiveData)
Stars: ✭ 55 (-46.6%)
Mutual labels: rxjava2, livedata
Pufferdb
🐡 An Android & JVM key-value storage powered by Protobuf and Coroutines
Stars: ✭ 91 (-11.65%)
Mutual labels: rxjava2, coroutines
PowerPermission
中文文档
English Documentation |Table of Contents
Introducation
PowerPermission
is a library to simplify process of demanding RuntimePermission.
You find an
example application
in this Repo or downloading directly here. Here are some different points compare with other libraries:
- support asking permissions in
AppCompatActivity
andFragment(include ChildFragment)
- support custom rational view after user refuse permission
- support ability to choose permissions to display rational views
- support different interface (RxJava2,RxJava3,Coroutines,LiveData)
How to Download
Basic
implementation "com.qifan.powerpermission:powerpermission:1.4.0"
Other API Support
implementation "com.qifan.powerpermission:powerpermission-rxjava2:1.4.0"
implementation "com.qifan.powerpermission:powerpermission-rxjava3:1.4.0"
implementation "com.qifan.powerpermission:powerpermission-coroutines:1.4.0"
implementation "com.qifan.powerpermission:powerpermission-livedata:1.4.0"
OverView
Package Name | Role | Usage |
---|---|---|
powerpermission | Basic core package | implementation "com.qifan.powerpermission:powerpermission:1.4.0" |
powerpermission-rxjava2 | Support RxJava2 | implementation "com.qifan.powerpermission:powerpermission-rxjava2:1.4.0" |
powerpermission-rxjava3 | Support RxJava3 | implementation "com.qifan.powerpermission:powerpermission-rxjava3:1.4.0" |
powerpermission-coroutines | Support Kotlin Coroutine | implementation "com.qifan.powerpermission:powerpermission-coroutines:1.4.0" |
powerpermission-livedata | Support Android LiveData | implementation "com.qifan.powerpermission:powerpermission-livedata:1.4.0" |
How to use
Simple Usage
Singleton
PowerPermission.init()
.requestPermissions(
context = this@ExampleActivity,
permissions = *arrayOf(
Manifest.permission.CAMERA
)
) { permissionResult ->
when {
permissionResult.hasAllGranted() -> {
doPermissionAllGrantedWork(permissionResult.granted())
}
permissionResult.hasRational() -> {
doPermissionReasonWork(permissionResult.rational())
}
permissionResult.hasPermanentDenied() -> {
doPermissionPermanentWork(permissionResult.permanentDenied())
}
}
}
Extension
- Require in Activity
askPermissions(
Manifest.permission.CAMERA,
Manifest.permission.READ_CALENDAR
) { permissionResult ->
//do whatever you want
}
- Require in Fragment
askPermissions(
Manifest.permission.CAMERA,
Manifest.permission.READ_CALENDAR
) { permissionResult ->
//do whatever you want
}
- Require in ChildFragment
askPermissions(
Manifest.permission.CAMERA,
Manifest.permission.READ_CALENDAR
) { permissionResult ->
//do whatever you want
}
RxJava/RxKotlin
Basic Usage
simpleRequestButton.setOnClickListener {
askPermissionsRx(Manifest.permission.CAMERA)
}
Use with RxBinding
rxBindingRequestButton.clicks()
.throttleFirst(1L, TimeUnit.SECONDS)
.flatMap {
askPermissionsRx(Manifest.permission.CAMERA)
}
Coroutine
simpleRequestButton.setOnClickListener {
launch {
val result = awaitAskPermissions(
Manifest.permission.CAMERA,
rationaleDelegate = dialogRationaleDelegate
)
//do something for this permission result
// handlePermissionRequest(result)
}
}
Livedata
simpleRequestButton.setOnClickListener {
observeAskPermissions(
Manifest.permission.CAMERA,
rationaleDelegate = dialogRationaleDelegate
).observe(this, Observer{ result->
//do something for this permission result
// handlePermissionRequest(result)
})
}
Rationale Interface
Custom View
In PowerPermission
it have a interface
which called RationaleDelegate
, it should be used as bridge to create your proper
delegation class to implement this interface
.
It provide two basic public declaration functions,
- displayRationale
//aims to display a view to explain reason to user why request permissions
fun displayRationale(
vararg permission: Permission,
message: String,
actionCallback: RationaleActionCallback
)
- onDismissView
//aims to simply disappear view and do some clean work etc.
fun onDismissView()
PS: PowerPermission
has already provided a class called DialogRationaleDelegate.kt
to display a classic dialog view you can take a look at it and find more inspiration.
Choose those permissions are rational
- RationaleData
It's a
data class
used as choose which permission or permissions to display rationale view. And what kind of message will be displayed in your rational view. example:
RationaleData(
rationalPermission = Manifest.permission.CAMERA,
message = message
)
RationaleData(
rationalPermissions = listOf(Manifest.permission.CAMERA),
message = message
)
License
Copyright (C) 2020 Qifan Yang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].