|
@@ -11,6 +11,7 @@ import android.view.View
|
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
|
import androidx.appcompat.widget.AppCompatButton
|
|
import androidx.appcompat.widget.AppCompatButton
|
|
|
import androidx.appcompat.widget.AppCompatEditText
|
|
import androidx.appcompat.widget.AppCompatEditText
|
|
|
|
|
+import androidx.appcompat.widget.AppCompatImageView
|
|
|
import androidx.fragment.app.DialogFragment
|
|
import androidx.fragment.app.DialogFragment
|
|
|
import com.gyf.immersionbar.BarHide
|
|
import com.gyf.immersionbar.BarHide
|
|
|
import com.gyf.immersionbar.ktx.immersionBar
|
|
import com.gyf.immersionbar.ktx.immersionBar
|
|
@@ -30,6 +31,7 @@ import io.reactivex.schedulers.Schedulers
|
|
|
*/
|
|
*/
|
|
|
class BindingPhoneDialog : DialogFragment() {
|
|
class BindingPhoneDialog : DialogFragment() {
|
|
|
|
|
|
|
|
|
|
+ private var imageClose: AppCompatImageView? = null
|
|
|
private var editPhone: AppCompatEditText? = null
|
|
private var editPhone: AppCompatEditText? = null
|
|
|
private var editCode: AppCompatEditText? = null
|
|
private var editCode: AppCompatEditText? = null
|
|
|
private var btnCode: AppCompatButton? = null
|
|
private var btnCode: AppCompatButton? = null
|
|
@@ -48,16 +50,13 @@ class BindingPhoneDialog : DialogFragment() {
|
|
|
override fun onStart() {
|
|
override fun onStart() {
|
|
|
super.onStart()
|
|
super.onStart()
|
|
|
dialog?.window?.setLayout(
|
|
dialog?.window?.setLayout(
|
|
|
- ViewGroup.LayoutParams.MATCH_PARENT,
|
|
|
|
|
- ViewGroup.LayoutParams.MATCH_PARENT
|
|
|
|
|
|
|
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
|
|
|
)
|
|
)
|
|
|
dialog?.window?.setBackgroundDrawableResource(R.color.transparent)
|
|
dialog?.window?.setBackgroundDrawableResource(R.color.transparent)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onCreateView(
|
|
override fun onCreateView(
|
|
|
- inflater: LayoutInflater,
|
|
|
|
|
- container: ViewGroup?,
|
|
|
|
|
- savedInstanceState: Bundle?
|
|
|
|
|
|
|
+ inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
|
|
): View? {
|
|
): View? {
|
|
|
immersionBar {
|
|
immersionBar {
|
|
|
hideBar(BarHide.FLAG_HIDE_BAR)
|
|
hideBar(BarHide.FLAG_HIDE_BAR)
|
|
@@ -74,6 +73,7 @@ class BindingPhoneDialog : DialogFragment() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun findId(rootView: View) {
|
|
private fun findId(rootView: View) {
|
|
|
|
|
+ imageClose = rootView.findViewById(R.id.imageClose)
|
|
|
editPhone = rootView.findViewById(R.id.editPhone)
|
|
editPhone = rootView.findViewById(R.id.editPhone)
|
|
|
editCode = rootView.findViewById(R.id.editCode)
|
|
editCode = rootView.findViewById(R.id.editCode)
|
|
|
btnCode = rootView.findViewById(R.id.btnCode)
|
|
btnCode = rootView.findViewById(R.id.btnCode)
|
|
@@ -103,6 +103,10 @@ class BindingPhoneDialog : DialogFragment() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ imageClose?.click {
|
|
|
|
|
+ dismiss()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -124,10 +128,8 @@ class BindingPhoneDialog : DialogFragment() {
|
|
|
* 发送验证码
|
|
* 发送验证码
|
|
|
*/
|
|
*/
|
|
|
private fun sendCode() {
|
|
private fun sendCode() {
|
|
|
- BaselibServiceFactory.getService()
|
|
|
|
|
- .getCheckCode(editPhone?.text.toString().trim())
|
|
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .compose(MyRxScheduler.ioMain(mContent!!, true))
|
|
|
|
|
|
|
+ BaselibServiceFactory.getService().getCheckCode(editPhone?.text.toString().trim())
|
|
|
|
|
+ .subscribeOn(Schedulers.io()).compose(MyRxScheduler.ioMain(mContent!!, true))
|
|
|
.subscribe(object : BaseObserver<Any>() {
|
|
.subscribe(object : BaseObserver<Any>() {
|
|
|
override fun onSuccess(t: Any?) {
|
|
override fun onSuccess(t: Any?) {
|
|
|
timer()
|
|
timer()
|
|
@@ -145,8 +147,7 @@ class BindingPhoneDialog : DialogFragment() {
|
|
|
private fun login() {
|
|
private fun login() {
|
|
|
BaselibServiceFactory.getService()
|
|
BaselibServiceFactory.getService()
|
|
|
.largeLoginMsg(editPhone?.text.toString().trim(), editCode?.text.toString().trim())
|
|
.largeLoginMsg(editPhone?.text.toString().trim(), editCode?.text.toString().trim())
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .compose(MyRxScheduler.ioMain(mContent!!, true))
|
|
|
|
|
|
|
+ .subscribeOn(Schedulers.io()).compose(MyRxScheduler.ioMain(mContent!!, true))
|
|
|
.subscribe(object : BaseObserver<String>() {
|
|
.subscribe(object : BaseObserver<String>() {
|
|
|
override fun onSuccess(t: String?) {
|
|
override fun onSuccess(t: String?) {
|
|
|
if (TextUtils.isEmpty(t).not()) {
|
|
if (TextUtils.isEmpty(t).not()) {
|