Commit 25086179 authored by jianglx's avatar jianglx

新版 版本检测

parent f28ee4aa
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
flavorDimensions "default" flavorDimensions "default"
versionCode 153 versionCode 150
versionName "1.5.3" versionName "1.5.0"
multiDexEnabled true multiDexEnabled true
...@@ -115,8 +115,7 @@ dependencies { ...@@ -115,8 +115,7 @@ dependencies {
api 'com.jakewharton:butterknife:9.0.0-rc1' api 'com.jakewharton:butterknife:9.0.0-rc1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// 进程保护
implementation 'com.fanjun:keeplive:1.1.10'
debugApi 'com.squareup.leakcanary:leakcanary-android:1.6.1' debugApi 'com.squareup.leakcanary:leakcanary-android:1.6.1'
releaseApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1' releaseApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
api 'cn.jiguang.sdk:jpush:3.3.4' api 'cn.jiguang.sdk:jpush:3.3.4'
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="#464546" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="#E7C48B" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="#AAAEBA" />
</shape>
\ No newline at end of file
...@@ -10,25 +10,19 @@ import android.view.View; ...@@ -10,25 +10,19 @@ import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper; import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper;
import com.ruiwenliu.wrapper.util.AppUtils; import com.ruiwenliu.wrapper.util.AppUtils;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cookie;
import com.rv.home.rv.module.ApiConfig; import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.login.RegisteredActivity; import com.rv.home.rv.module.ui.login.RegisteredActivity;
import com.rv.component.utils.RvCache;
import com.rv.rvmine.R; import com.rv.rvmine.R;
import com.rv.rvmine.R2; import com.rv.rvmine.R2;
import com.rv.version.DownListenerManager;
import com.rv.version.bean.VersionCheckBean; import com.rv.version.bean.VersionCheckBean;
import com.rv.version.util.UpdateAppUtils; import com.rv.version.util.UpdateAppUtils;
import com.yuyife.okgo.OkGoUtil;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
...@@ -36,23 +30,23 @@ import java.util.Map; ...@@ -36,23 +30,23 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import io.reactivex.schedulers.Schedulers;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_SET;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.sequence; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.sequence;
/** /**
* 设置 * 设置
*/ */
public class SettingActivity extends BaseStatusActivity<CommonPresenter> { public class SettingActivity extends BaseStatusActivity<CommonPresenter> implements DownListenerManager.DownListener {
@BindView(R2.id.tv_version) @BindView(R2.id.tv_version)
TextView tvVersion; TextView tvVersion;
private UpdateAppUtils updateAppUtils; private UpdateAppUtils updateAppUtils;
private VersionCheckBean versionCheckBean = null; private VersionCheckBean versionCheckBean = null;
private String versionName;
@Override @Override
protected int setLayout() { protected int setLayout() {
return R.layout.activity_setting; return R.layout.activity_setting;
...@@ -67,8 +61,16 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -67,8 +61,16 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(getString(R.string.setting_title)); titleView.setTitle(getString(R.string.setting_title));
isShowLoadingError = false; isShowLoadingError = false;
}
DownListenerManager.getInstance().addDownListener(this);
versionName = UpdateAppUtils.getAppVersionName(this);
if (DownListenerManager.getInstance().isDown()) {
tvVersion.setText("下载中_" + DownListenerManager.getInstance().getProgress() + "%");
} else {
tvVersion.setText("当前版本 V" + versionName);
}
}
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
...@@ -86,7 +88,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -86,7 +88,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
tvVersion.setText("已是最新版本V" + UpdateAppUtils.getAppVersionName(this)); tvVersion.setText("已是最新版本V" + UpdateAppUtils.getAppVersionName(this));
} }
} }
break; break;
default: default:
break; break;
...@@ -102,6 +103,12 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -102,6 +103,12 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
} }
} }
@Override
public void onDestroy() {
super.onDestroy();
DownListenerManager.getInstance().removeDownListener(this);
}
@OnClick({R2.id.rl_item_change_password, R2.id.ll_item_app_push, R2.id.rl_item_clear_cache, R2.id.rl_item_check_for_updates, R2.id.rl_item_about_us, R2.id.tv_out_sign}) @OnClick({R2.id.rl_item_change_password, R2.id.ll_item_app_push, R2.id.rl_item_clear_cache, R2.id.rl_item_check_for_updates, R2.id.rl_item_about_us, R2.id.tv_out_sign})
public void onViewClicked(View view) { public void onViewClicked(View view) {
...@@ -117,6 +124,8 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -117,6 +124,8 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
//清除缓存 //清除缓存
showToast("亲,该功能还在开发中。。。"); showToast("亲,该功能还在开发中。。。");
} else if (id == R.id.rl_item_check_for_updates) { } else if (id == R.id.rl_item_check_for_updates) {
if (!DownListenerManager.getInstance().isDown())
//检查更新 //检查更新
if (versionCheckBean != null && versionCheckBean.isRel() == false) { if (versionCheckBean != null && versionCheckBean.isRel() == false) {
...@@ -166,8 +175,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -166,8 +175,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
private void checkVersion() { private void checkVersion() {
Map<String, Object> headMap = new LinkedHashMap<>(); Map<String, Object> headMap = new LinkedHashMap<>();
String versionName = UpdateAppUtils.getAppVersionName(this);
tvVersion.setText("当前版本 V" + versionName);
if (!TextUtils.isEmpty(versionName)) { if (!TextUtils.isEmpty(versionName)) {
mPresenter.getData(0, String.format(ApiConfig.HTTP_URL_VERSION_CHECK, versionName), VersionCheckBean.class, headMap, false); mPresenter.getData(0, String.format(ApiConfig.HTTP_URL_VERSION_CHECK, versionName), VersionCheckBean.class, headMap, false);
} }
...@@ -186,4 +193,29 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -186,4 +193,29 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
break; break;
} }
} }
@Override
public void pending() {
tvVersion.setText("下载准备中...");
}
@Override
public void paused() {
tvVersion.setText("下载暂停");
}
@Override
public void progress(int progerss) {
tvVersion.setText("下载中_" + progerss + "%");
}
@Override
public void completed() {
tvVersion.setText("下载完成");
}
@Override
public void error() {
tvVersion.setText("下载异常");
}
} }
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:drawableRight="@drawable/common_icon_rig_black"
android:drawablePadding="@dimen/size_3" android:drawablePadding="@dimen/size_3"
android:textColor="#999999" android:textColor="#999999"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
......
...@@ -9,6 +9,7 @@ import android.os.Bundle; ...@@ -9,6 +9,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
...@@ -204,6 +205,12 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -204,6 +205,12 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
public void call(boolean isVoice) { public void call(boolean isVoice) {
presenter.realDial(isVoice ? 1 : 2, null); presenter.realDial(isVoice ? 1 : 2, null);
} }
@Override
public void sendCancel(ChatMessage message) {
message.setMessageType(MessageTypeEnum.CANCEL);
presenter.readySend(message);
}
}; };
public static Intent getIntent(Context context, String targetUserId, String targetName) { public static Intent getIntent(Context context, String targetUserId, String targetName) {
...@@ -263,6 +270,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -263,6 +270,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
mChatFaceViewStub = findViewById(R.id.chat_face_view_stub); mChatFaceViewStub = findViewById(R.id.chat_face_view_stub);
recycleContent = findViewById(R.id.recycle_content); recycleContent = findViewById(R.id.recycle_content);
recycleContent.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); recycleContent.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recycleContent.setItemAnimator(new DefaultItemAnimator());
adapter = new ChatContentAdapter(getApplicationContext(), mLoginUserId, messages, clickItemListener); adapter = new ChatContentAdapter(getApplicationContext(), mLoginUserId, messages, clickItemListener);
recycleContent.setAdapter(adapter); recycleContent.setAdapter(adapter);
recycleContent.addOnScrollListener(new RecyclerView.OnScrollListener() { recycleContent.addOnScrollListener(new RecyclerView.OnScrollListener() {
......
...@@ -4,11 +4,13 @@ import android.content.Context; ...@@ -4,11 +4,13 @@ import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
...@@ -17,12 +19,14 @@ import com.bumptech.glide.request.RequestOptions; ...@@ -17,12 +19,14 @@ import com.bumptech.glide.request.RequestOptions;
import com.ruiwenliu.wrapper.bean.UserInfoBean; import com.ruiwenliu.wrapper.bean.UserInfoBean;
import com.ruiwenliu.wrapper.util.glide.GlideManager; import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.component.utils.CacheEnum; import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.DisplayUtil;
import com.rv.component.utils.RvCache; import com.rv.component.utils.RvCache;
import com.rv.im.ChatHolderFactory; import com.rv.im.ChatHolderFactory;
import com.rv.im.R; import com.rv.im.R;
import com.rv.im.audio_x.VoiceAnimView; import com.rv.im.audio_x.VoiceAnimView;
import com.rv.im.audio_x.VoicePlayer; import com.rv.im.audio_x.VoicePlayer;
import com.rv.im.db.service.ChatMessageServiceImp; import com.rv.im.db.service.ChatMessageServiceImp;
import com.rv.im.db.service.IChatMessageService;
import com.rv.im.db.table.ChatMessage; import com.rv.im.db.table.ChatMessage;
import com.rv.im.glide.GlideOptions; import com.rv.im.glide.GlideOptions;
import com.rv.im.glide.TransformationUtils; import com.rv.im.glide.TransformationUtils;
...@@ -52,6 +56,12 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -52,6 +56,12 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
void voicePlay(ChatMessage message); void voicePlay(ChatMessage message);
void call(boolean isVoice); void call(boolean isVoice);
/******
* 撤销
* @param message
*/
void sendCancel(ChatMessage message);
} }
public ChatContentAdapter(Context context, String mLoginUserId, List<ChatMessage> list, OnClickItemListener listener) { public ChatContentAdapter(Context context, String mLoginUserId, List<ChatMessage> list, OnClickItemListener listener) {
...@@ -205,11 +215,57 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -205,11 +215,57 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
holder.tvRead.setVisibility(View.GONE); holder.tvRead.setVisibility(View.GONE);
} }
holder.ivFailed.setOnClickListener(v -> listener.reSend(bean)); holder.ivFailed.setOnClickListener(v -> listener.reSend(bean));
// holder.chatText.setOnLongClickListener(v -> {
// if (System.currentTimeMillis() - bean.getTimeSend() > 60 * 5 * 1000) {
// // 删除
// showPopwindow(0, holder.itemView, bean);
// } else {
// // 撤销
// showPopwindow(1, holder.itemView, bean);
// }
// return false;
// });
if (!TextUtils.isEmpty(myHeaderUrl)) { if (!TextUtils.isEmpty(myHeaderUrl)) {
GlideManager.getInstance(mContext).loadImage(myHeaderUrl, holder.ivHeader); GlideManager.getInstance(mContext).loadImage(myHeaderUrl, holder.ivHeader);
} }
} }
private void showPopwindow(int type, View view, ChatMessage message) {
View contentView = LayoutInflater.from(mContext).inflate(R.layout.view_chat_content_del, null);
final PopupWindow popupWindow = new PopupWindow(contentView, DisplayUtil.dip2px(mContext, 200f), DisplayUtil.dip2px(mContext, 40f));
popupWindow.setOutsideTouchable(true);
popupWindow.setTouchable(true);
TextView tvDel = contentView.findViewById(R.id.tv_del);
if (type == 0) {
tvDel.setText("删除");
} else {
tvDel.setText("撤销");
}
tvDel.setOnClickListener(v -> {
if (type == 0) { /// 删除
getDbService().deleteMessage(message);
notifyItemRemoved(messageList.indexOf(message));
messageList.remove(message);
} else { // 撤销
if (listener != null) {
listener.sendCancel(message);
notifyItemRemoved(messageList.indexOf(message));
messageList.remove(message);
}
}
popupWindow.dismiss();
});
popupWindow.showAtLocation(view, Gravity.CENTER_HORIZONTAL, 0, 0);
}
public IChatMessageService getDbService() {
return ChatMessageServiceImp.getInstance(mContext);
}
private void setFromTextContentView(ChatMessage bean, MsgFromTextHolder holder) { private void setFromTextContentView(ChatMessage bean, MsgFromTextHolder holder) {
showTime(holder.tvSendTime, bean); showTime(holder.tvSendTime, bean);
......
...@@ -98,6 +98,26 @@ public class MessageDao { ...@@ -98,6 +98,26 @@ public class MessageDao {
} }
} }
/*****
* 删除消息
* @param message
*/
public void deleteMessage(ChatMessage message){
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return;
}
if (message == null) {
LogUtil.e(TAG, "message is null");
return;
}
try {
dao.delete(message);
} catch (SQLException e) {
e.printStackTrace();
}
}
/******* /*******
* 判断是否存在该消息 * 判断是否存在该消息
* @param message * @param message
......
...@@ -95,6 +95,11 @@ public class ChatMessageServiceImp implements IChatMessageService { ...@@ -95,6 +95,11 @@ public class ChatMessageServiceImp implements IChatMessageService {
return dao.getPages(userId); return dao.getPages(userId);
} }
@Override
public void deleteMessage(ChatMessage message) {
dao.deleteMessage(message);
}
public void release() { public void release() {
instance = null; instance = null;
} }
......
...@@ -30,4 +30,6 @@ public interface IChatMessageService { ...@@ -30,4 +30,6 @@ public interface IChatMessageService {
int getPages(String userId); int getPages(String userId);
void deleteMessage(ChatMessage message) ;
} }
...@@ -9,7 +9,9 @@ public enum MessageTypeEnum { ...@@ -9,7 +9,9 @@ public enum MessageTypeEnum {
PIC(2, "图片"), PIC(2, "图片"),
VOICE(3, "语音"), VOICE(3, "语音"),
VOLTE_CALL(5, "语音通话"), VOLTE_CALL(5, "语音通话"),
VIDEO_CALL(6, "视频通话"); VIDEO_CALL(6, "视频通话"),
CANCEL(7,"撤销") ;
private int type; private int type;
private String name; private String name;
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_marginRight="@dimen/size_20"
android:layout_marginLeft="@dimen/size_20"
android:layout_height="@dimen/size_50"
android:gravity="center"
android:background="@color/white">
<TextView
android:id="@+id/tv_del"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_12" />
</LinearLayout>
...@@ -234,7 +234,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -234,7 +234,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
for (MemberListBean.MemberCard card : listBean.getData()) { for (MemberListBean.MemberCard card : listBean.getData()) {
MemberItemView view = new MemberItemView(this); MemberItemView view = new MemberItemView(this);
view.setData(card); view.setData(card);
view.setHasAgree(hasAgree); // view.setHasAgree(hasAgree);
view.setListener(payListener); view.setListener(payListener);
if (listBean.getData().indexOf(card) == listBean.getData().size() - 1) if (listBean.getData().indexOf(card) == listBean.getData().size() - 1)
view.hiddenLine(); view.hiddenLine();
...@@ -295,15 +295,15 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -295,15 +295,15 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
@Override @Override
public void checkAgreement(boolean b) { public void checkAgreement(boolean b) {
hasAgree = b; hasAgree = b;
int count = ll_cardview_content.getChildCount(); // int count = ll_cardview_content.getChildCount();
if (count > 0) { // if (count > 0) {
for (int i = 0; i < count; i++) { // for (int i = 0; i < count; i++) {
View view = ll_cardview_content.getChildAt(i); // View view = ll_cardview_content.getChildAt(i);
if (view instanceof MemberItemView) { // if (view instanceof MemberItemView) {
((MemberItemView) view).setHasAgree(hasAgree); // ((MemberItemView) view).setHasAgree(hasAgree);
} // }
} // }
} // }
} }
}; };
......
...@@ -19,10 +19,10 @@ public class MemberItemView extends LinearLayout { ...@@ -19,10 +19,10 @@ public class MemberItemView extends LinearLayout {
private TextView tv_member_type; private TextView tv_member_type;
private MemberCardView mcv_discount, mcv_free_day, mcv_free_outdoors; private MemberCardView mcv_discount, mcv_free_day, mcv_free_outdoors;
private TextView tv_describe; private TextView tv_describe;
private Button btn_buy; // private Button btn_buy;
private View viewLine; private View viewLine;
private boolean hasAgree = false; // private boolean hasAgree = false;
private MemberCenterActivity.PayListener listener; private MemberCenterActivity.PayListener listener;
private MemberListBean.MemberCard memberCard = null; private MemberListBean.MemberCard memberCard = null;
...@@ -37,9 +37,9 @@ public class MemberItemView extends LinearLayout { ...@@ -37,9 +37,9 @@ public class MemberItemView extends LinearLayout {
initView(); initView();
} }
public void setHasAgree(boolean hasAgree) { // public void setHasAgree(boolean hasAgree) {
this.hasAgree = hasAgree; // this.hasAgree = hasAgree;
} // }
public void setData(MemberListBean.MemberCard card) { public void setData(MemberListBean.MemberCard card) {
this.memberCard = card; this.memberCard = card;
...@@ -61,7 +61,7 @@ public class MemberItemView extends LinearLayout { ...@@ -61,7 +61,7 @@ public class MemberItemView extends LinearLayout {
mcv_free_day = view.findViewById(R.id.mcv_free_day); mcv_free_day = view.findViewById(R.id.mcv_free_day);
mcv_free_outdoors = view.findViewById(R.id.mcv_free_outdoors); mcv_free_outdoors = view.findViewById(R.id.mcv_free_outdoors);
tv_describe = view.findViewById(R.id.tv_describe); tv_describe = view.findViewById(R.id.tv_describe);
btn_buy = view.findViewById(R.id.btn_buy); // btn_buy = view.findViewById(R.id.btn_buy);
viewLine = view.findViewById(R.id.view_line); viewLine = view.findViewById(R.id.view_line);
addView(view); addView(view);
} }
...@@ -69,28 +69,28 @@ public class MemberItemView extends LinearLayout { ...@@ -69,28 +69,28 @@ public class MemberItemView extends LinearLayout {
private void setData() { private void setData() {
if (!TextUtils.isEmpty(memberCard.getName())) { if (!TextUtils.isEmpty(memberCard.getName())) {
tv_member_type.setText(memberCard.getName()); tv_member_type.setText(memberCard.getName());
btn_buy.setText("立即开通" + memberCard.getName()); // btn_buy.setText("立即开通" + memberCard.getName());
if (memberCard.getLevel() == 1) { // if (memberCard.getLevel() == 1) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member);
} else if (memberCard.getLevel() == 2) { // } else if (memberCard.getLevel() == 2) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member);
} else { // } else {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member);
} // }
} }
btn_buy.setOnClickListener(new View.OnClickListener() { // btn_buy.setOnClickListener(new View.OnClickListener() {
@Override // @Override
public void onClick(View view) { // public void onClick(View view) {
if (!hasAgree) { // if (!hasAgree) {
Toast.makeText(getContext(), "需同意服务协议", Toast.LENGTH_SHORT).show(); // Toast.makeText(getContext(), "需同意服务协议", Toast.LENGTH_SHORT).show();
return; // return;
} // }
if (listener != null) { // if (listener != null) {
listener.pay(memberCard); // listener.pay(memberCard);
} // }
} // }
}); // });
if (!TextUtils.isEmpty(memberCard.getDescribe())) { if (!TextUtils.isEmpty(memberCard.getDescribe())) {
tv_describe.setText(memberCard.getDescribe()); tv_describe.setText(memberCard.getDescribe());
} }
......
...@@ -75,18 +75,18 @@ ...@@ -75,18 +75,18 @@
android:layout_marginBottom="13dp" android:layout_marginBottom="13dp"
android:textSize="@dimen/dp_10" /> android:textSize="@dimen/dp_10" />
<Button <!--<Button-->
android:visibility="gone" <!--android:visibility="gone"-->
android:id="@+id/btn_buy" <!--android:id="@+id/btn_buy"-->
android:layout_width="match_parent" <!--android:layout_width="match_parent"-->
android:layout_height="@dimen/dp_40" <!--android:layout_height="@dimen/dp_40"-->
android:layout_marginLeft="@dimen/size_20" <!--android:layout_marginLeft="@dimen/size_20"-->
android:layout_marginTop="13dp" <!--android:layout_marginTop="13dp"-->
android:layout_marginRight="@dimen/size_20" <!--android:layout_marginRight="@dimen/size_20"-->
android:background="@drawable/shape_rv_bg_dark_yellow" <!--android:background="@drawable/shape_rv_bg_dark_yellow"-->
android:gravity="center" <!--android:gravity="center"-->
android:textColor="@color/white" <!--android:textColor="@color/white"-->
android:textSize="@dimen/text_16" /> <!--android:textSize="@dimen/text_16" />-->
<View <View
android:id="@+id/view_line" android:id="@+id/view_line"
......
...@@ -31,6 +31,10 @@ android { ...@@ -31,6 +31,10 @@ android {
pro { pro {
} }
} }
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
} }
......
...@@ -10,12 +10,6 @@ ...@@ -10,12 +10,6 @@
<application> <application>
<receiver android:name="com.rv.version.receiver.UpdateAppReceiver">
<intent-filter>
<action android:name="teprinciple.update" />
</intent-filter>
</receiver>
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"
......
package com.rv.version;
import android.os.Handler;
import android.os.Looper;
import java.util.ArrayList;
import java.util.List;
public class DownListenerManager {
private static DownListenerManager instance = null;
private boolean isDown = false; // 是否正在下载
private List<DownListener> listeners;
private int progress = 0;
private Handler mHandler = new Handler(Looper.getMainLooper());
private DownListenerManager() {
listeners = new ArrayList<>();
}
public static DownListenerManager getInstance() {
if (instance == null) {
instance = new DownListenerManager();
}
return instance;
}
public boolean isDown() {
return isDown;
}
public void setDown(boolean down) {
isDown = down;
}
public int getProgress() {
return progress;
}
public void setProgress(int progress) {
this.progress = progress;
}
public void addDownListener(DownListener listener) {
listeners.add(listener);
}
public void removeDownListener(DownListener listener) {
listeners.remove(listener);
}
public void notifyPendChange() {
setProgress(progress);
if (listeners.size() <= 0) {
return;
}
mHandler.post(() -> {
for (DownListener listener : listeners) {
listener.pending();
}
});
}
public void notifyProgressChange(final int progress) {
setProgress(progress);
if (listeners.size() <= 0) {
return;
}
mHandler.post(() -> {
for (DownListener listener : listeners) {
listener.progress(progress);
}
});
}
public void notifyCompletedChange() {
if (listeners.size() <= 0) {
return;
}
mHandler.post(() -> {
for (DownListener listener : listeners) {
listener.completed();
}
});
}
public void notifyPausedChange() {
if (listeners.size() <= 0) {
return;
}
mHandler.post(() -> {
for (DownListener listener : listeners) {
listener.paused();
}
});
}
public void notifyErrorChange() {
if (listeners.size() <= 0) {
return;
}
mHandler.post(() -> {
for (DownListener listener : listeners) {
listener.error();
}
});
}
public interface DownListener {
void pending();
void paused();
void progress(int progress);
void completed();
void error();
}
}
package com.rv.version;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ruiwenliu.wrapper.dialog.BaseDialog;
/**********
* 强制升级界面
*/
public class UpdateForceDialog extends BaseDialog implements DownListenerManager.DownListener {
private TextView tvDownloadInfo;
public UpdateForceDialog(Context context, int themeResId) {
super(context, themeResId);
DownListenerManager.getInstance().addDownListener(this);
setDialogParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
setCancelable(false);
tvDownloadInfo = findViewById(R.id.tv_download_info);
}
public UpdateForceDialog(@NonNull Context context) {
this(context, 0);
}
@Override
public int getViewLayout() {
return R.layout.dialog_update_force_view;
}
@Override
public void pending() {
tvDownloadInfo.setText("下载准备中...");
}
@Override
public void paused() {
tvDownloadInfo.setText("下载暂停中...");
}
@Override
public void progress(int progress) {
tvDownloadInfo.setText("下载中..." + progress + "%");
}
@Override
public void completed() {
tvDownloadInfo.setText("下载完成");
dismiss();
}
@Override
public void error() {
tvDownloadInfo.setText("下载失败");
setCancelable(true);
}
@Override
public void dismiss() {
super.dismiss();
DownListenerManager.getInstance().removeDownListener(this);
}
}
package com.rv.version;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.Button;
import com.ruiwenliu.wrapper.dialog.BaseDialog;
/**********
* 升级界面
*/
public class UpdateUnforceDialog extends BaseDialog implements DownListenerManager.DownListener {
private Button btnKnow;
public UpdateUnforceDialog(Context context, int themeResId) {
super(context, themeResId);
DownListenerManager.getInstance().addDownListener(this);
setDialogParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
setCancelable(false);
btnKnow = findViewById(R.id.btn_know);
btnKnow.setOnClickListener(v -> dismiss());
}
public UpdateUnforceDialog(@NonNull Context context) {
this(context, 0);
}
@Override
public int getViewLayout() {
return R.layout.dialog_update_unforce_view;
}
@Override
public void pending() {
}
@Override
public void paused() {
}
@Override
public void progress(int progress) {
}
@Override
public void completed() {
dismiss();
}
@Override
public void error() {
setCancelable(true);
}
@Override
public void dismiss() {
super.dismiss();
DownListenerManager.getInstance().removeDownListener(this);
}
}
package com.rv.version; package com.rv.version;
import android.app.Dialog; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -18,7 +16,6 @@ import android.widget.TextView; ...@@ -18,7 +16,6 @@ import android.widget.TextView;
import com.ruiwenliu.wrapper.dialog.BaseDialog; import com.ruiwenliu.wrapper.dialog.BaseDialog;
import com.rv.version.bean.UpdateBean; import com.rv.version.bean.UpdateBean;
import com.rv.version.receiver.UpdateAppReceiver;
public class VersionUpdateDialog extends BaseDialog { public class VersionUpdateDialog extends BaseDialog {
...@@ -29,7 +26,7 @@ public class VersionUpdateDialog extends BaseDialog { ...@@ -29,7 +26,7 @@ public class VersionUpdateDialog extends BaseDialog {
public VersionUpdateDialog(Context context, int themeResId) { public VersionUpdateDialog(Context context, int themeResId) {
super(context, themeResId); super(context, themeResId);
setDialogParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); setDialogParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
} }
@Override @Override
...@@ -47,6 +44,10 @@ public class VersionUpdateDialog extends BaseDialog { ...@@ -47,6 +44,10 @@ public class VersionUpdateDialog extends BaseDialog {
private ImageView imgClose; private ImageView imgClose;
private DownloadListener mListener; private DownloadListener mListener;
private UpdateForceDialog forceDialog;
private UpdateUnforceDialog updateUnforceDialog;
public Builder(Context context, DownloadListener listener) { public Builder(Context context, DownloadListener listener) {
mContext = context; mContext = context;
this.mListener = listener; this.mListener = listener;
...@@ -81,23 +82,27 @@ public class VersionUpdateDialog extends BaseDialog { ...@@ -81,23 +82,27 @@ public class VersionUpdateDialog extends BaseDialog {
this.txtContent = layout.findViewById(R.id.txt_content); this.txtContent = layout.findViewById(R.id.txt_content);
this.btn_update = layout.findViewById(R.id.btn_update); this.btn_update = layout.findViewById(R.id.btn_update);
this.imgClose = layout.findViewById(R.id.img_close); this.imgClose = layout.findViewById(R.id.img_close);
this.btn_update.setOnClickListener(new View.OnClickListener() { this.btn_update.setOnClickListener(view -> {
@Override
public void onClick(View view) {
if (mListener != null) { if (mListener != null) {
mListener.download(); mListener.download();
if (mContext instanceof Activity && "MainActivity".equals(((Activity) mContext).getClass().getSimpleName()))
if (updateBean.getForce()) { // 强制更新
if (forceDialog == null)
forceDialog = new UpdateForceDialog(mContext, R.style.DialogActivityTheme);
forceDialog.show();
} else {
if (updateUnforceDialog == null)
updateUnforceDialog = new UpdateUnforceDialog(mContext, R.style.DialogActivityTheme);
updateUnforceDialog.show();
} }
dialog.dismiss(); DownListenerManager.getInstance().notifyPendChange();
} }
});
this.imgClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss(); dialog.dismiss();
}
}); });
this.imgClose.setOnClickListener(view -> dialog.dismiss());
if (this.updateBean != null) { if (this.updateBean != null) {
if (!TextUtils.isEmpty(this.updateBean.getUpdateInfo())) { if (!TextUtils.isEmpty(this.updateBean.getUpdateInfo())) {
txtContent.setText(Html.fromHtml(this.updateBean.getUpdateInfo())); txtContent.setText(Html.fromHtml(this.updateBean.getUpdateInfo()));
......
package com.rv.version.receiver;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import com.rv.version.R;
import com.rv.version.util.DownloadAppUtils;
import com.rv.version.util.UpdateAppUtils;
import java.io.File;
/**
* Created by Teprinciple on 2017/11/3.
*/
public class UpdateAppReceiver extends BroadcastReceiver {
private String notificationChannel = "1001";
@Override
public void onReceive(Context context, Intent intent) {
int progress = intent.getIntExtra("progress", 0);
String title = intent.getStringExtra("title");
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// 显示通知栏
int notifyId = 1;
if (UpdateAppUtils.showNotification) {
showNotification(context, notifyId, progress, title, notificationChannel, nm);
}
// 下载完成
if (progress == 100) {
handleDownloadComplete(context, notifyId, nm);
}
}
/**
* 下载完成后的逻辑
*/
private void handleDownloadComplete(Context context, int notifyId, NotificationManager nm) {
// 关闭通知栏
if (nm != null) {
nm.cancel(notifyId);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
nm.deleteNotificationChannel(notificationChannel);
}
}
// 安装apk
if (!TextUtils.isEmpty(DownloadAppUtils.downloadUpdateApkFilePath)) {
toInstall(context);
}
}
/**
* 通知栏显示
*/
private void showNotification(Context context, int notifyId, int progress, String title, String notificationChannel, NotificationManager nm) {
String notificationName = "notification";
// 适配8.0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// 通知渠道
NotificationChannel channel = new NotificationChannel(notificationChannel, notificationName, NotificationManager.IMPORTANCE_MIN);
channel.enableLights(false); // 是否在桌面icon右上角展示小红点
channel.setShowBadge(false); // 是否在久按桌面图标时显示此渠道的通知
channel.enableVibration(false);
channel.setVibrationPattern(new long[]{0});
channel.setSound(null, null);
// 最后在notificationmanager中创建该通知渠道
nm.createNotificationChannel(channel);
}
Notification.Builder builder = new Notification.Builder(context);
builder.setVibrate(null);
builder.setVibrate(new long[]{0l});
//NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(notificationChannel);
}
if (progress == -1) {
builder.setContentTitle("下载准备中 " + title);
builder.setSmallIcon(R.drawable.logo);
// builder.setProgress(100, progress, false);
} else {
builder.setContentTitle("正在下载 " + title);
builder.setSmallIcon(R.drawable.logo);
builder.setProgress(100, progress, false);
}
Notification notification = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification = builder.build();
} else {
notification = builder.getNotification();
}
nm.notify(notifyId, notification);
}
/**
* 跳转安装
*/
private void toInstall(Context context) {
Intent i = new Intent(Intent.ACTION_VIEW);
File apkFile = new File(DownloadAppUtils.downloadUpdateApkFilePath);
if (!apkFile.exists() || !apkFile.isFile()) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(
context, context.getPackageName() + ".fileprovider", apkFile);
i.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
i.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
}
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
\ No newline at end of file
...@@ -2,15 +2,13 @@ package com.rv.version.util; ...@@ -2,15 +2,13 @@ package com.rv.version.util;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.os.Environment; import android.os.Environment;
import android.util.Log; import android.util.Log;
import android.widget.Toast;
import com.liulishuo.filedownloader.BaseDownloadTask; import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadLargeFileListener; import com.liulishuo.filedownloader.FileDownloadLargeFileListener;
import com.liulishuo.filedownloader.FileDownloader; import com.liulishuo.filedownloader.FileDownloader;
import com.rv.version.receiver.UpdateAppReceiver; import com.rv.version.DownListenerManager;
import java.io.File; import java.io.File;
...@@ -20,7 +18,7 @@ public class DownloadAppUtils { ...@@ -20,7 +18,7 @@ public class DownloadAppUtils {
public static String downloadUpdateApkFilePath;//下载更新Apk 文件路径 public static String downloadUpdateApkFilePath;//下载更新Apk 文件路径
public static void download(final Context context, String url, final String serverVersionName) { public static void download(final Context context, String url, final String serverVersionName) {
DownListenerManager.getInstance().setDown(true);
String rootPath = null; String rootPath = null;
rootPath = getCachePath(context) + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator; rootPath = getCachePath(context) + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator;
send(context, -1, serverVersionName); send(context, -1, serverVersionName);
...@@ -41,22 +39,29 @@ public class DownloadAppUtils { ...@@ -41,22 +39,29 @@ public class DownloadAppUtils {
@Override @Override
protected void progress(BaseDownloadTask task, long soFarBytes, long totalBytes) { protected void progress(BaseDownloadTask task, long soFarBytes, long totalBytes) {
DownListenerManager.getInstance().notifyProgressChange((int) (soFarBytes * 100.0 / totalBytes));
send(context, (int) (soFarBytes * 100.0 / totalBytes), serverVersionName); send(context, (int) (soFarBytes * 100.0 / totalBytes), serverVersionName);
} }
@Override @Override
protected void paused(BaseDownloadTask task, long soFarBytes, long totalBytes) { protected void paused(BaseDownloadTask task, long soFarBytes, long totalBytes) {
Log.e(TAG, "paused"); Log.e(TAG, "paused");
DownListenerManager.getInstance().notifyPausedChange();
} }
@Override @Override
protected void completed(BaseDownloadTask task) { protected void completed(BaseDownloadTask task) {
send(context, 100, serverVersionName); send(context, 100, serverVersionName);
DownListenerManager.getInstance().notifyCompletedChange();
DownListenerManager.getInstance().setDown(false);
} }
@Override @Override
protected void error(BaseDownloadTask task, Throwable e) { protected void error(BaseDownloadTask task, Throwable e) {
Toast.makeText(context, "下载出错", Toast.LENGTH_SHORT).show(); DownListenerManager.getInstance().notifyErrorChange();
DownListenerManager.getInstance().setDown(false);
// Toast.makeText(context, "下载出错", Toast.LENGTH_SHORT).show();
} }
@Override @Override
......
...@@ -157,12 +157,7 @@ public class UpdateAppUtils { ...@@ -157,12 +157,7 @@ public class UpdateAppUtils {
.show(); .show();
} }
private VersionUpdateDialog.Builder.DownloadListener listener = new VersionUpdateDialog.Builder.DownloadListener() { private VersionUpdateDialog.Builder.DownloadListener listener = () -> preDownLoad();
@Override
public void download() {
preDownLoad();
}
};
private static final int PERMISSION_CODE = 1001; private static final int PERMISSION_CODE = 1001;
......
...@@ -2,4 +2,9 @@ ...@@ -2,4 +2,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" /> <corners android:radius="30dp" />
<solid android:color="@color/gray_FFB74B" /> <solid android:color="@color/gray_FFB74B" />
<gradient
android:angle="0"
android:endColor="#FF9730"
android:startColor="#FBB554" />
</shape> </shape>
\ No newline at end of file
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
<!--背景颜色--> <!--背景颜色-->
<solid android:color="#ffffff" /> <solid android:color="#ffffff" />
<!--设置圆角的角度--> <!--设置圆角的角度-->
<corners android:radius="15dp" /> <corners android:radius="5dp" />
</shape> </shape>
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/icon_version_loading"
android:fromDegrees="0.0"
android:pivotX="50.0%"
android:pivotY="50.0%"
android:toDegrees="360.0" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_25"
android:layout_marginRight="@dimen/size_25"
android:background="@drawable/dialog_content_bg"
android:gravity="center_horizontal"
android:orientation="vertical">
<ProgressBar
android:id="@+id/loading"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="38dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/down_anim" />
<TextView
android:id="@+id/tv_download_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginBottom="38dp"
android:gravity="center"
android:text="下载详情"
android:textColor="#333333"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_25"
android:layout_marginRight="@dimen/size_25"
android:background="@drawable/dialog_content_bg"
android:gravity="center_horizontal"
android:orientation="vertical">
<ProgressBar
android:id="@+id/loading"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="38dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/down_anim" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="下载中..."
android:textColor="#171413"
android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="可在【个人中心-设置】中查看进度"
android:textColor="#666666"
android:textSize="@dimen/sp_12" />
<Button
android:id="@+id/btn_know"
android:layout_width="match_parent"
android:layout_height="@dimen/size_40"
android:layout_marginLeft="13sp"
android:layout_marginTop="@dimen/size_25"
android:layout_marginRight="13sp"
android:layout_marginBottom="13sp"
android:background="@drawable/bg_version_btn"
android:gravity="center"
android:text="知道了"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:scaleType="centerCrop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dialog_img_height" android:layout_height="@dimen/dialog_img_height"
android:scaleType="centerCrop"
android:src="@drawable/icon_dialog_top" /> android:src="@drawable/icon_dialog_top" />
<TextView <TextView
...@@ -25,17 +25,18 @@ ...@@ -25,17 +25,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="更新提示" android:text="更新提示"
android:textColor="#ff5e5e5e" android:textColor="#171413"
android:textSize="18sp" /> android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<TextView <TextView
android:layout_marginTop="@dimen/size_5"
android:id="@+id/tv_version_name" android:id="@+id/tv_version_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_5"
android:gravity="center" android:gravity="center"
android:textColor="#ff5e5e5e" android:textColor="#171413"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
<TextView <TextView
...@@ -44,19 +45,20 @@ ...@@ -44,19 +45,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:gravity="left" android:gravity="left"
android:lineSpacingMultiplier="1.5"
android:paddingLeft="13dp" android:paddingLeft="13dp"
android:paddingRight="13dp" android:paddingRight="13dp"
android:textColor="#ff5e5e5e" android:textColor="#666666"
android:textSize="16sp" /> android:textSize="@dimen/sp_12" />
<Button <Button
android:id="@+id/btn_update" android:id="@+id/btn_update"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_40" android:layout_height="@dimen/size_40"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="13sp"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="13sp"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="13sp"
android:layout_marginBottom="@dimen/size_15" android:layout_marginBottom="13sp"
android:background="@drawable/bg_version_btn" android:background="@drawable/bg_version_btn"
android:gravity="center" android:gravity="center"
android:text="立即更新" android:text="立即更新"
...@@ -69,7 +71,7 @@ ...@@ -69,7 +71,7 @@
android:id="@+id/img_close" android:id="@+id/img_close"
android:layout_width="@dimen/size_30" android:layout_width="@dimen/size_30"
android:layout_height="@dimen/size_30" android:layout_height="@dimen/size_30"
android:layout_marginTop="10dp" android:layout_marginTop="20dp"
android:src="@drawable/home_icon_close" /> android:src="@drawable/home_icon_close" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment