修改BUG
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:exported="true" />
|
||||
android:exported="true"
|
||||
/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -11,9 +11,11 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -23,6 +25,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.BuildConfig;
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
import com.blankj.utilcode.util.ServiceUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.example.modulecircle.fragment.CircleFragment;
|
||||
import com.example.modulenews.fragment.NewsFragment;
|
||||
@@ -44,6 +47,7 @@ import com.qxcm.moduleutil.dialog.HeavenGiftDialog;
|
||||
import com.qxcm.moduleutil.dialog.RechargeDialogFragment;
|
||||
import com.qxcm.moduleutil.event.RoomOutEvent;
|
||||
import com.qxcm.moduleutil.event.UnreadCountEvent;
|
||||
import com.qxcm.moduleutil.service.EMqttService;
|
||||
import com.qxcm.moduleutil.utils.ARouteConstants;
|
||||
import com.qxcm.moduleutil.utils.ImageLoader;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
@@ -82,7 +86,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
// ServiceUtils.startService(EMqttService.class);
|
||||
checkTab(getIntent().getIntExtra("tab", -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
fragments = new Fragment[]{
|
||||
@@ -313,9 +316,31 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
// super.onBackPressed();
|
||||
ActivityUtils.startHomeActivity();
|
||||
|
||||
// moveTaskToBack(true);
|
||||
super.onBackPressed();
|
||||
}
|
||||
private long exitTime = 0;
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (System.currentTimeMillis() - exitTime > 2000) {
|
||||
Toast.makeText(this, "再按一次退出程序", Toast.LENGTH_SHORT).show();
|
||||
exitTime = System.currentTimeMillis();
|
||||
} else {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
@@ -357,6 +382,8 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
});
|
||||
|
||||
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
||||
|
||||
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -391,40 +418,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
MvpPre.userNews();
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void newMessage(NewsMessageEvent newsMessageEvent) {
|
||||
// refreshUnread();
|
||||
// }
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void logOut(LogOutEvent logOutEvent) {
|
||||
// MyApplication.getInstance().reLogin();
|
||||
// }
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void backHomeEvent(BackHomeEvent event) {
|
||||
// mBinding.rlMedia.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// mBinding.rlMedia.performClick();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void appUpdate(AppUpdateModel appUpdateModel) {
|
||||
// if (appUpdateModel.getVersionCode() > BuildConfig.VERSION_CODE) {
|
||||
// if (appUpdateDialog == null) {
|
||||
// appUpdateDialog = new AppUpdateDialog(this);
|
||||
// appUpdateDialog.setAppUpdateModel(appUpdateModel);
|
||||
// if (appUpdateModel.getForceUpdate() == 1) {
|
||||
// appUpdateDialog.setCanceledOnTouchOutside(false);
|
||||
// }
|
||||
// }
|
||||
// appUpdateDialog.show();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void appUpdate(AppUpdateModel appUpdateModel) {
|
||||
@@ -491,4 +484,10 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// moveTaskToBack(true);
|
||||
// }
|
||||
}
|
||||
@@ -24,12 +24,17 @@ import com.qxcm.moduleutil.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class HomePresenter extends BasePresenter<HomeContacts.View> implements HomeContacts.IHomePre {
|
||||
|
||||
HomeContacts.View mView;
|
||||
|
||||
public HomePresenter(HomeContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView=view;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +48,9 @@ public class HomePresenter extends BasePresenter<HomeContacts.View> implements H
|
||||
|
||||
@Override
|
||||
public void onNext(AppUpdateModel appUpdataModel) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().appUpdate(appUpdataModel);
|
||||
}
|
||||
});
|
||||
@@ -340,6 +348,9 @@ public class HomePresenter extends BasePresenter<HomeContacts.View> implements H
|
||||
|
||||
@Override
|
||||
public void onNext(FirstChargeBean myInfoResp) {
|
||||
if (MvpRef==null){
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().myInfoSuccess(myInfoResp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user