新增APk内置更新功能
This commit is contained in:
@@ -19,19 +19,18 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
||||
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@@ -40,6 +39,7 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.VersionUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.APKUpdateCustomPopup;
|
||||
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.main.R;
|
||||
@@ -99,6 +99,11 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener<
|
||||
data1.setName(WordUtil.getString(R.string.versions));
|
||||
list.add(data1);
|
||||
|
||||
SettingBean data2 = new SettingBean();
|
||||
data2.setId(25);
|
||||
data2.setName(WordUtil.getString(R.string.check_the_new_version));
|
||||
list.add(data2);
|
||||
|
||||
SettingBean bean = new SettingBean();
|
||||
bean.setName(WordUtil.getString(R.string.setting_exit));
|
||||
bean.setLast(true);
|
||||
@@ -280,6 +285,13 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener<
|
||||
clearCache(position);
|
||||
} else if (bean.getId() == 21) {//清除缓存
|
||||
startActivity(new Intent(SettingActivity.this, MsgSettActivity.class));
|
||||
} else if (bean.getId() == 25) {//版本更新
|
||||
if (!IMLoginManager.get(mContext).getApkVerNew()) {
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(new APKUpdateCustomPopup(mContext))
|
||||
.show();
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (bean.getId() == 17) {//意见反馈要在url上加版本号和设备号
|
||||
|
||||
@@ -12,10 +12,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.LogUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.main.BuildConfig;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.bean.SettingBean;
|
||||
|
||||
@@ -47,17 +46,17 @@ public class SettingAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
SettingBean bean = mList.get(position);
|
||||
if(bean.getId()==19){
|
||||
LogUtil.shareFile(context);
|
||||
}
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
SettingBean bean = mList.get(position);
|
||||
if (bean.getId() == 19) {
|
||||
LogUtil.shareFile(context);
|
||||
}
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -75,7 +74,7 @@ public class SettingAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
SettingBean bean = mList.get(position);
|
||||
if (bean.getId() == 19 || bean.getId() == Constants.SETTING_UPDATE_ID || bean.getId() == Constants.SETTING_CLEAR_CACHE) {
|
||||
if (bean.getId() == 19 || bean.getId() == 25|| bean.getId() == Constants.SETTING_UPDATE_ID || bean.getId() == Constants.SETTING_CLEAR_CACHE) {
|
||||
return VERSION;
|
||||
} else if (bean.isLast()) {
|
||||
return LAST;
|
||||
@@ -147,6 +146,16 @@ public class SettingAdapter extends RecyclerView.Adapter {
|
||||
} else if (bean.getId() == 19) {
|
||||
mText.setText(DeviceUtils.getVersionName(itemView.getContext()));
|
||||
mText.setTextColor(Color.parseColor("#969696"));
|
||||
} else if (bean.getId() == 25) {
|
||||
if (IMLoginManager.get(itemView.getContext()).getApkVerNew()) {
|
||||
mText.setText(itemView.getContext().getString(R.string.latest_version));
|
||||
mText.setTextColor(Color.parseColor("#969696"));
|
||||
|
||||
} else {
|
||||
mText.setText(itemView.getContext().getString(R.string.discover_a_new_version));
|
||||
mText.setTextColor(Color.parseColor("#b3d465"));
|
||||
}
|
||||
|
||||
} else {
|
||||
mText.setText(mVersionString);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -38,6 +39,7 @@ import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -99,6 +101,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
private boolean firstInto = true;
|
||||
private Banner banner_me;
|
||||
private LinearLayout lt_advertisement;
|
||||
private View redPoint;
|
||||
|
||||
public MainMeViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@@ -109,9 +112,11 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
return R.layout.view_main_me;
|
||||
}
|
||||
|
||||
@SuppressLint("WrongViewCast")
|
||||
@Override
|
||||
public void init() {
|
||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||
redPoint = findViewById(R.id.red_point);
|
||||
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@@ -175,6 +180,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
redPoint.setVisibility(IMLoginManager.get(mContext).getApkVerNew() ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,7 +318,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
SVGAViewUtils.playEndClear(gift_svga,false);
|
||||
SVGAViewUtils.playEndClear(gift_svga, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -441,11 +447,11 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
} else if (bean.getId() == 4) {
|
||||
url = HtmlConfig.SHOP + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
WebViewActivity.forward(mContext, url);
|
||||
} else if(bean.getId() == 3) {//我的等级
|
||||
Constants.myIntoIndex=2;
|
||||
} else if (bean.getId() == 3) {//我的等级
|
||||
Constants.myIntoIndex = 2;
|
||||
Constants.isTitle = false;
|
||||
ZhuangBanActivity.forward(mContext, url);
|
||||
}else{
|
||||
} else {
|
||||
WebViewActivity.forward(mContext, url);
|
||||
}
|
||||
|
||||
@@ -462,8 +468,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
} else if (i == R.id.signature) {
|
||||
mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
}
|
||||
else if (i == R.id.lt_star_coin) {
|
||||
} else if (i == R.id.lt_star_coin) {
|
||||
mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
||||
} else if (i == R.id.btn_coin) {
|
||||
mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0));
|
||||
@@ -483,8 +488,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -476,18 +476,18 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="@drawable/bg_me_data"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
@@ -502,11 +502,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical"
|
||||
android:clickable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:focusable="false"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="6dp">
|
||||
|
||||
@@ -534,10 +534,10 @@
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@mipmap/icon_more_gray"
|
||||
android:clickable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:focusable="false"
|
||||
android:background="@mipmap/icon_more_gray" />
|
||||
android:focusableInTouchMode="false" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -657,6 +657,19 @@
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/red_point"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_toEndOf="@id/tv_setting"
|
||||
android:background="@drawable/background_ff5075"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user