|
|
@@ -10,6 +10,7 @@ import androidx.appcompat.app.AlertDialog;
|
|
|
import com.itant.shibei.R;
|
|
|
import com.itant.shibei.bean.UpgradeBean;
|
|
|
import com.itant.shibei.common.ICommonView;
|
|
|
+import com.itant.shibei.manager.UserInfoManager;
|
|
|
import com.itant.shibei.tool.SystemTool;
|
|
|
import com.itant.shibei.ui.home.about.upgrade.UpgradePresenter;
|
|
|
import com.miekir.common.utils.ActivityTool;
|
|
|
@@ -27,23 +28,20 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
|
|
|
|
|
|
private static final String TITLE_FORMAT = "伊甸园 v%s%s";
|
|
|
|
|
|
+ private TextView tv_title;
|
|
|
+ private TextView tv_desc;
|
|
|
+ private TextView tv_active;
|
|
|
+ private View ll_about;
|
|
|
+
|
|
|
@InjectPresenter
|
|
|
UpgradePresenter upgradePresenter;
|
|
|
|
|
|
@Override
|
|
|
protected void onViewInit() {
|
|
|
- TextView tv_title = rootView.findViewById(R.id.tv_title);
|
|
|
- TextView tv_desc = rootView.findViewById(R.id.tv_desc);
|
|
|
- TextView tv_active = rootView.findViewById(R.id.tv_active);
|
|
|
- // todo 判断是否已激活
|
|
|
- boolean isActive = false;
|
|
|
- String title = String.format(TITLE_FORMAT, SystemTool.getVersionName(getActivity()), isActive ? "(已激活)" : "(未激活)");
|
|
|
- tv_title.setText(title);
|
|
|
-
|
|
|
- if (isActive) {
|
|
|
- tv_desc.setVisibility(View.GONE);
|
|
|
- tv_active.setVisibility(View.GONE);
|
|
|
- }
|
|
|
+ tv_title = rootView.findViewById(R.id.tv_title);
|
|
|
+ tv_desc = rootView.findViewById(R.id.tv_desc);
|
|
|
+ tv_active = rootView.findViewById(R.id.tv_active);
|
|
|
+ ll_about = rootView.findViewById(R.id.ll_about);
|
|
|
|
|
|
rootView.findViewById(R.id.tv_feedback).setOnClickListener(this);
|
|
|
rootView.findViewById(R.id.tv_update).setOnClickListener(this);
|
|
|
@@ -52,6 +50,32 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
|
|
|
rootView.findViewById(R.id.tv_active).setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
+ super.setUserVisibleHint(isVisibleToUser);
|
|
|
+ // 判断是否已激活
|
|
|
+ if (!UserInfoManager.getInstance().isLogin()) {
|
|
|
+ if (ll_about == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ll_about.setVisibility(View.GONE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ll_about.setVisibility(View.VISIBLE);
|
|
|
+
|
|
|
+ boolean isActive = UserInfoManager.getInstance().getBeiUser().isVip;
|
|
|
+ String title = String.format(TITLE_FORMAT, SystemTool.getVersionName(getActivity()), isActive ? "(已激活)" : "(未激活)");
|
|
|
+ tv_title.setText(title);
|
|
|
+ if (isActive) {
|
|
|
+ tv_desc.setVisibility(View.GONE);
|
|
|
+ tv_active.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ tv_desc.setVisibility(View.VISIBLE);
|
|
|
+ tv_active.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onLazyLoad() {
|
|
|
|
|
|
@@ -95,8 +119,7 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
|
|
|
public void onCommonResult(boolean success, String message, UpgradeBean resultBean) {
|
|
|
dismissLoading();
|
|
|
// 获取到了版本信息
|
|
|
- if (success &&
|
|
|
- resultBean != null &&
|
|
|
+ if (success && resultBean != null &&
|
|
|
SystemTool.getVersionCode(getActivity()) < resultBean.versionCode &&
|
|
|
!TextUtils.isEmpty(resultBean.url)) {
|
|
|
AlertDialog alertDialog = new AlertDialog.Builder(getActivity())
|