| | |
| | | fun <T> Observable<T>.defaultScheduler(): Observable<T> = this.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) |
| | | |
| | | fun Activity.callPhone(phone:String?){ |
| | | // val isAllow = permission(Manifest.permission.CALL_PHONE,"拨号权限",15) |
| | | RxPermissions(this).request(Manifest.permission.CALL_PHONE).subscribe { |
| | | if (it) { |
| | | val p = phone ?: "" |
| | | val intent = Intent(Intent.ACTION_DIAL) |
| | | intent.data = Uri.parse("tel:" + p) |
| | | this.startActivity(intent) |
| | | } else { |
| | | toast("没有拨号权限") |
| | | } |
| | | } |
| | | val p = phone ?: "" |
| | | val intent = Intent(Intent.ACTION_DIAL) |
| | | intent.data = Uri.parse("tel:" + p) |
| | | this.startActivity(intent) |
| | | } |
| | | |
| | | fun Fragment.callPhone(phone:String?){ |