Initial commit
This commit is contained in:
76
sources/com/ubt/jimu/base/mvp/HbBaseActivity.java
Normal file
76
sources/com/ubt/jimu/base/mvp/HbBaseActivity.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.ubt.jimu.base.mvp;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.base.event.MessageEvent;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpPresenter;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class HbBaseActivity<T extends BaseMvpPresenter> extends BaseActivity implements BaseRxView, SingleClickListener {
|
||||
private long lastClickTime = 0;
|
||||
protected T mPresenter;
|
||||
|
||||
public abstract T createPresenter();
|
||||
|
||||
public abstract int getLayoutResId();
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseView
|
||||
public void hideLoadingDialog() {
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
public boolean isRegistEventBus() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
setContentView(getLayoutResId());
|
||||
super.onCreate(bundle);
|
||||
if (isRegistEventBus()) {
|
||||
EventBus.b().c(this);
|
||||
}
|
||||
if (this.mPresenter == null) {
|
||||
this.mPresenter = createPresenter();
|
||||
}
|
||||
T t = this.mPresenter;
|
||||
if (t != null) {
|
||||
t.attachModelView(this);
|
||||
}
|
||||
getLifecycle().a(this.mPresenter);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
T t = this.mPresenter;
|
||||
if (t != null) {
|
||||
t.detachView();
|
||||
getLifecycle().b(this.mPresenter);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onReceiveMessage(MessageEvent messageEvent) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseView
|
||||
public void showLoadingDialog(String str) {
|
||||
showLoading(str);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseView
|
||||
public void showToast(int i) {
|
||||
ToastView.a(this, getResources().getString(i), ToastView.Type.NORMAL).a();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user