reset
This commit is contained in:
@@ -31,13 +31,14 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView( @NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState ) {
|
||||
if ( mRootView == null ) {
|
||||
mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
} else {
|
||||
ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent();
|
||||
if ( viewGroup != null )
|
||||
viewGroup.removeView( mRootView );
|
||||
}
|
||||
// if ( mRootView == null ) {
|
||||
// mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
// } else {
|
||||
// ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent();
|
||||
// if ( viewGroup != null )
|
||||
// viewGroup.removeView( mRootView );
|
||||
// }
|
||||
mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.mogo.module.authorize.fragment
|
||||
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
@@ -11,7 +14,6 @@ import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.IVoiceIntentListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_authorize_fragment.*
|
||||
|
||||
class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceIntentListener {
|
||||
|
||||
@@ -21,16 +23,37 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
|
||||
private var clErrorContainer:ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer:ConstraintLayout? = null
|
||||
private var clContainer:ConstraintLayout? = null
|
||||
private var btnAgree:Button? = null
|
||||
private var btnDisAgree:Button? = null
|
||||
private var btnLoadingError:Button? = null
|
||||
private var tvTitle:TextView? = null
|
||||
private var tvContent:TextView? = null
|
||||
private var tvButtonContent:TextView? = null
|
||||
private var tvLastContent:TextView? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_authorize_fragment
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
btnAuthorizeAgree.setOnClickListener(this)
|
||||
btnAuthorizeDisAgree.setOnClickListener(this)
|
||||
btnAuthorizeLoadingError.setOnClickListener(this)
|
||||
clLoadingErrorContainer.setOnClickListener(this)
|
||||
clErrorContainer = this.findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = this.findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = this.findViewById(R.id.clAuthorizeContainer)
|
||||
btnAgree = this.findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = this.findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = this.findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = this.findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = this.findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = this.findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = this.findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
VoiceUtil.registerAll(context!!, this, this)
|
||||
}
|
||||
@@ -40,8 +63,8 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
}
|
||||
|
||||
override fun readyToAuthorize() {
|
||||
clLoadingErrorContainer.visibility = View.GONE
|
||||
clLoadingAuthorizeContainer.visibility = View.VISIBLE
|
||||
clErrorContainer?.visibility = View.GONE
|
||||
clLoadAuthorizeContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun showAuthorizationAgreementContent(
|
||||
@@ -51,18 +74,18 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(context!!.resources.getString(R.string.module_authorize_agreement_tip), context!!, this)
|
||||
clLoadingAuthorizeContainer.visibility = View.GONE
|
||||
clAuthorizeContainer.visibility = View.VISIBLE
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
this.agreementId = agreementId
|
||||
tvAuthorizeTitle.text = Html.fromHtml(agreementTitle)
|
||||
tvAuthorizeContent.text = Html.fromHtml(agreementContent)
|
||||
tvAuthorizeButtonContent.text = Html.fromHtml(agreementBottom)
|
||||
tvAuthorizeLastContent.text = Html.fromHtml(agreementContent)
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
tvContent?.text = Html.fromHtml(agreementContent)
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
tvLastContent?.text = Html.fromHtml(agreementContent)
|
||||
}
|
||||
|
||||
override fun showAuthorizationError() {
|
||||
clLoadingAuthorizeContainer.visibility = View.GONE
|
||||
clLoadingErrorContainer.visibility = View.VISIBLE
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clErrorContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
Logger.d(TAG, "onCreate invokeTag:$invokeTag")
|
||||
// invokeAuthorizationContent(invokeTag!!)
|
||||
invokeAuthorizationContent(invokeTag!!)
|
||||
}
|
||||
|
||||
override fun invokeAuthorizationContent(invokeTag: String) {
|
||||
|
||||
@@ -10,7 +10,8 @@ object SharedPreferenceUtil {
|
||||
private const val AUTHORIZE_UPDATE_TIME = "AUTHORIZE_UPDATE_TIME"
|
||||
|
||||
fun needAuthorization(type: Int): Boolean {
|
||||
return !hasAuth(type)
|
||||
// return !hasAuth(type) //todo test
|
||||
return false
|
||||
}
|
||||
|
||||
fun hasAuth(type: Int): Boolean {
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
@@ -118,7 +120,6 @@
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeAgree"
|
||||
android:layout_width="0px"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
android:background="@drawable/module_authorize_selector_blue_left_corner"
|
||||
android:gravity="center"
|
||||
@@ -126,6 +127,7 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnAuthorizeDisAgree" />
|
||||
|
||||
@@ -133,15 +135,15 @@
|
||||
android:id="@+id/btnAuthorizeDisAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
android:background="@drawable/module_authorize_selector_dark_right_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_disagree"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0px"
|
||||
|
||||
Reference in New Issue
Block a user