Commit 25086179 authored by jianglx's avatar jianglx

新版 版本检测

parent f28ee4aa
......@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
flavorDimensions "default"
versionCode 153
versionName "1.5.3"
versionCode 150
versionName "1.5.0"
multiDexEnabled true
......@@ -115,8 +115,7 @@ dependencies {
api 'com.jakewharton:butterknife: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.fanjun:keeplive:1.1.10'
debugApi 'com.squareup.leakcanary:leakcanary-android:1.6.1'
releaseApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
api 'cn.jiguang.sdk:jpush:3.3.4'
......
......@@ -10,12 +10,15 @@ import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
......@@ -25,9 +28,6 @@ import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.android.arouter.launcher.ARouter;
import com.fanjun.keeplive.KeepLive;
import com.fanjun.keeplive.config.ForegroundNotification;
import com.fanjun.keeplive.config.KeepLiveService;
import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.MessageEventLogout;
......@@ -63,8 +63,9 @@ import com.rv.share.WebViewActivity;
import com.rv.share.view.PromotionDialog;
import com.rv.tourism.R2;
import com.rv.tourism.TourismFragment;
import com.rv.version.DownListenerManager;
import com.rv.version.bean.VersionCheckBean;
import com.rv.version.receiver.UpdateAppReceiver;
import com.rv.version.util.DownloadAppUtils;
import com.rv.version.util.UpdateAppUtils;
import com.xxfc.discovery.DiscoveryFragment;
import com.xxfc.discovery.api.DiscoveryApi;
......@@ -75,6 +76,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
......@@ -87,7 +89,11 @@ import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
public class MainActivity extends BaseActivity<CommonPresenter>{
public class MainActivity extends BaseActivity<CommonPresenter> implements DownListenerManager.DownListener {
private boolean hasGetVersionInfo = false; // 判断是否已经获取过版本信息
private VersionCheckBean versionCheckBean = null;
private static final String TAG = MainActivity.class.getSimpleName();
......@@ -135,9 +141,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
private String imPassword;
private String[] permissions = new String[]{android.Manifest.permission.READ_PHONE_STATE,
android.Manifest.permission.CAMERA, android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CALL_PHONE};
public static Intent getIntent(Context context) {
return new Intent(context, MainActivity.class);
}
......@@ -153,6 +156,7 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
StatusBarUtil.setRootViewFitsSystemWindows(mActivity, false);
AudioOrVideoController.init(getApplicationContext(), logoutListener);
EventBus.getDefault().register(this);
DownListenerManager.getInstance().addDownListener(this);
}
......@@ -166,7 +170,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
viewPager.setOffscreenPageLimit(5);
setCurrent(TYPE_HOME_PAGE);
registerNetWorkListener();
registerUpdate();
initNotification();
SwitchFragment.setFragmentSelected(postion -> setCurrent(postion));
......@@ -184,25 +187,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
}
}
private UpdateAppReceiver updateAppReceiver = null;
private void registerUpdate() {
if (updateAppReceiver == null) {
updateAppReceiver = new UpdateAppReceiver();
}
IntentFilter filter = new IntentFilter();
filter.addAction("teprinciple.update");
registerReceiver(updateAppReceiver, filter);
}
public void unRegisterUpdateReceiver() {
if (updateAppReceiver != null) {
unregisterReceiver(updateAppReceiver);
updateAppReceiver = null;
}
}
private void initNotification() {
BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(mActivity);
builder.statusBarDrawable = R.drawable.logo_title;
......@@ -213,12 +197,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
| Notification.DEFAULT_LIGHTS; // 设置为铃声、震动、呼吸灯闪烁都要
JPushInterface.setPushNotificationBuilder(1, builder);
JPushInterface.setDefaultPushNotificationBuilder(builder);
// CustomPushNotificationBuilder builder2 = new CustomPushNotificationBuilder(mActivity, R.layout.customer_notitfication_layout, R.id.icon, R.id.title, R.id.text,R.id.time);
// builder2.statusBarDrawable = R.drawable.logo_title;
// builder2.layoutIconDrawable = R.mipmap.logo;
// builder2.developerArg0 = "developerArg2";
// JPushInterface.setPushNotificationBuilder(2, builder2);
}
......@@ -248,17 +226,10 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
public void onShowResult(int requestType, BaseBean result) {
switch (requestType) {
case 0:
VersionCheckBean versionCheckBean = (VersionCheckBean) result;
versionCheckBean = (VersionCheckBean) result;
if (versionCheckBean != null && versionCheckBean.isRel() == false) {
if (versionCheckBean != null && !TextUtils.isEmpty(versionCheckBean.getData().getDownloadUrl())) {
updateAppUtils.serverVersionCode(versionCheckBean.getData().getWeigh())
.serverVersionName(versionCheckBean.getData().getVersionName())
.apkPath(versionCheckBean.getData().getDownloadUrl())
.updateInfo(versionCheckBean.getData().getContent())
.apkSize(versionCheckBean.getData().getPackagesize())
.isForce(versionCheckBean.getData().getIsCompel() == 0 ? false : true)
.update();
checkUpdateInfo();
}
}
break;
......@@ -312,6 +283,16 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
}
}
private void checkUpdateInfo() {
updateAppUtils.serverVersionCode(versionCheckBean.getData().getWeigh())
.serverVersionName(versionCheckBean.getData().getVersionName())
.apkPath(versionCheckBean.getData().getDownloadUrl())
.updateInfo(versionCheckBean.getData().getContent())
.apkSize(versionCheckBean.getData().getPackagesize())
.isForce(versionCheckBean.getData().getIsCompel() == 0 ? false : true)
.update();
}
/**
* 设置token时间检测
*/
......@@ -467,6 +448,7 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
* 检测版本
*/
private void checkVersion() {
hasGetVersionInfo = true;
Map<String, Object> headMap = new LinkedHashMap<>();
String versionName = updateAppUtils.getAppVersionName(this);
if (!TextUtils.isEmpty(versionName)) {
......@@ -491,38 +473,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
}
}
private void initKeepLive() {
// 定义前台服务的默认样式。即标题、描述和图标
ForegroundNotification foregroundNotification = new ForegroundNotification("IM核心", "进程守护中", R.mipmap.logo,
//定义前台服务的通知点击事件
(context, intent) -> {
});
//启动保活服务
KeepLive.startWork(getApplication(), KeepLive.RunMode.ENERGY, foregroundNotification,
//你需要保活的服务,如socket连接、定时任务等,建议不用匿名内部类的方式在这里写
new KeepLiveService() {
/**
* 运行中
* 由于服务可能会多次自动启动,该方法可能重复调用
*/
@Override
public void onWorking() {
Log.e("xuan", "onWorking: ");
}
/**
* 服务终止
* 由于服务可能会被多次终止,该方法可能重复调用,需同onWorking配套使用,如注册和注销broadcast
*/
@Override
public void onStop() {
Log.e("xuan", "onStop: ");
}
}
);
}
/**
* 判断是否登录
*
......@@ -592,13 +542,16 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
public void onResume() {
super.onResume();
imLogin();
if (hasGetVersionInfo && versionCheckBean != null && versionCheckBean.getData() != null && versionCheckBean.getData().getIsCompel() == 1 && !TextUtils.isEmpty(versionCheckBean.getData().getDownloadUrl()))
checkUpdateInfo();
}
@Override
public void onDestroy() {
super.onDestroy();
DownListenerManager.getInstance().removeDownListener(this);
destory();
unRegisterUpdateReceiver();
// unRegisterUpdateReceiver();
if (netReceiver != null) {
unregisterReceiver(netReceiver);
netReceiver = null;
......@@ -670,11 +623,6 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
ImSetting.logout();
showLogoutDialog();
// startActivity(LoginRvActivity.getIntent(getApplicationContext(), 0));
// showToast("退出成功!");
// if (mAdapter != null) {
// ((MineFragment) mAdapter.getItem(4)).signOut();
// }
}
private void showLogoutDialog() {
......@@ -686,14 +634,9 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
dialog1.dismiss();
finish();
}).show();
// WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
// params.type = WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
// dialog.getWindow().setAttributes(params);
// dialog.getWindow().getAttributes().gravity = Gravity.CENTER;
// dialog.show();
}
void destory() {
private void destory() {
if (imServiceConnection != null) {
try {
unbindService(imServiceConnection);
......@@ -705,10 +648,58 @@ public class MainActivity extends BaseActivity<CommonPresenter>{
EventBus.getDefault().unregister(this);
}
private AudioOrVideoController.LogoutListener logoutListener = new AudioOrVideoController.LogoutListener() {
@Override
public void logout() {
private AudioOrVideoController.LogoutListener logoutListener = () -> {
}
};
@Override
public void pending() {
}
@Override
public void paused() {
}
@Override
public void progress(int progerss) {
}
@Override
public void completed() {
// 安装apk
if (!TextUtils.isEmpty(DownloadAppUtils.downloadUpdateApkFilePath)) {
toInstall();
}
}
@Override
public void error() {
}
/**
* 跳转安装
*/
private void toInstall() {
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(
this, 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);
startActivity(i);
}
}
<?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;
import android.widget.TextView;
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.BaseStatusActivity;
import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper;
import com.ruiwenliu.wrapper.util.AppUtils;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cookie;
import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.login.RegisteredActivity;
import com.rv.component.utils.RvCache;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.version.DownListenerManager;
import com.rv.version.bean.VersionCheckBean;
import com.rv.version.util.UpdateAppUtils;
import com.yuyife.okgo.OkGoUtil;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -36,23 +30,23 @@ import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
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_SET;
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)
TextView tvVersion;
private UpdateAppUtils updateAppUtils;
private VersionCheckBean versionCheckBean = null;
private String versionName;
@Override
protected int setLayout() {
return R.layout.activity_setting;
......@@ -67,8 +61,16 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(getString(R.string.setting_title));
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
protected void loadData(Bundle savedInstanceState, Intent intent) {
......@@ -86,7 +88,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
tvVersion.setText("已是最新版本V" + UpdateAppUtils.getAppVersionName(this));
}
}
break;
default:
break;
......@@ -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})
public void onViewClicked(View view) {
......@@ -117,22 +124,24 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
//清除缓存
showToast("亲,该功能还在开发中。。。");
} else if (id == R.id.rl_item_check_for_updates) {
//检查更新
if (versionCheckBean != null && versionCheckBean.isRel() == false) {
if (versionCheckBean != null && !TextUtils.isEmpty(versionCheckBean.getData().getDownloadUrl())) {
updateAppUtils.serverVersionCode(versionCheckBean.getData().getWeigh())
.serverVersionName(versionCheckBean.getData().getVersionName())
.apkPath(versionCheckBean.getData().getDownloadUrl())
.updateInfo(versionCheckBean.getData().getContent())
.apkSize(versionCheckBean.getData().getPackagesize())
.isForce(versionCheckBean.getData().getIsCompel() == 0 ? false : true)
.isShowToast(true)
.update();
if (!DownListenerManager.getInstance().isDown())
//检查更新
if (versionCheckBean != null && versionCheckBean.isRel() == false) {
if (versionCheckBean != null && !TextUtils.isEmpty(versionCheckBean.getData().getDownloadUrl())) {
updateAppUtils.serverVersionCode(versionCheckBean.getData().getWeigh())
.serverVersionName(versionCheckBean.getData().getVersionName())
.apkPath(versionCheckBean.getData().getDownloadUrl())
.updateInfo(versionCheckBean.getData().getContent())
.apkSize(versionCheckBean.getData().getPackagesize())
.isForce(versionCheckBean.getData().getIsCompel() == 0 ? false : true)
.isShowToast(true)
.update();
}
} else {
Toast.makeText(getApplicationContext(), "当前已是最新版本", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getApplicationContext(), "当前已是最新版本", Toast.LENGTH_SHORT).show();
}
} else if (id == R.id.rl_item_about_us) {
//关于我们
......@@ -166,8 +175,6 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
private void checkVersion() {
Map<String, Object> headMap = new LinkedHashMap<>();
String versionName = UpdateAppUtils.getAppVersionName(this);
tvVersion.setText("当前版本 V" + versionName);
if (!TextUtils.isEmpty(versionName)) {
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> {
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 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableRight="@drawable/common_icon_rig_black"
android:drawablePadding="@dimen/size_3"
android:textColor="#999999"
android:textSize="@dimen/sp_12" />
......
......@@ -9,6 +9,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
......@@ -204,6 +205,12 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
public void call(boolean isVoice) {
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) {
......@@ -263,6 +270,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
mChatFaceViewStub = findViewById(R.id.chat_face_view_stub);
recycleContent = findViewById(R.id.recycle_content);
recycleContent.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recycleContent.setItemAnimator(new DefaultItemAnimator());
adapter = new ChatContentAdapter(getApplicationContext(), mLoginUserId, messages, clickItemListener);
recycleContent.setAdapter(adapter);
recycleContent.addOnScrollListener(new RecyclerView.OnScrollListener() {
......
......@@ -4,11 +4,13 @@ import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
......@@ -17,12 +19,14 @@ import com.bumptech.glide.request.RequestOptions;
import com.ruiwenliu.wrapper.bean.UserInfoBean;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.DisplayUtil;
import com.rv.component.utils.RvCache;
import com.rv.im.ChatHolderFactory;
import com.rv.im.R;
import com.rv.im.audio_x.VoiceAnimView;
import com.rv.im.audio_x.VoicePlayer;
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.glide.GlideOptions;
import com.rv.im.glide.TransformationUtils;
......@@ -52,6 +56,12 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
void voicePlay(ChatMessage message);
void call(boolean isVoice);
/******
* 撤销
* @param message
*/
void sendCancel(ChatMessage message);
}
public ChatContentAdapter(Context context, String mLoginUserId, List<ChatMessage> list, OnClickItemListener listener) {
......@@ -205,11 +215,57 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
holder.tvRead.setVisibility(View.GONE);
}
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)) {
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) {
showTime(holder.tvSendTime, bean);
......
......@@ -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
......
......@@ -95,6 +95,11 @@ public class ChatMessageServiceImp implements IChatMessageService {
return dao.getPages(userId);
}
@Override
public void deleteMessage(ChatMessage message) {
dao.deleteMessage(message);
}
public void release() {
instance = null;
}
......
......@@ -30,4 +30,6 @@ public interface IChatMessageService {
int getPages(String userId);
void deleteMessage(ChatMessage message) ;
}
......@@ -9,7 +9,9 @@ public enum MessageTypeEnum {
PIC(2, "图片"),
VOICE(3, "语音"),
VOLTE_CALL(5, "语音通话"),
VIDEO_CALL(6, "视频通话");
VIDEO_CALL(6, "视频通话"),
CANCEL(7,"撤销") ;
private int type;
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> {
for (MemberListBean.MemberCard card : listBean.getData()) {
MemberItemView view = new MemberItemView(this);
view.setData(card);
view.setHasAgree(hasAgree);
// view.setHasAgree(hasAgree);
view.setListener(payListener);
if (listBean.getData().indexOf(card) == listBean.getData().size() - 1)
view.hiddenLine();
......@@ -295,15 +295,15 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
@Override
public void checkAgreement(boolean b) {
hasAgree = b;
int count = ll_cardview_content.getChildCount();
if (count > 0) {
for (int i = 0; i < count; i++) {
View view = ll_cardview_content.getChildAt(i);
if (view instanceof MemberItemView) {
((MemberItemView) view).setHasAgree(hasAgree);
}
}
}
// int count = ll_cardview_content.getChildCount();
// if (count > 0) {
// for (int i = 0; i < count; i++) {
// View view = ll_cardview_content.getChildAt(i);
// if (view instanceof MemberItemView) {
// ((MemberItemView) view).setHasAgree(hasAgree);
// }
// }
// }
}
};
......
......@@ -19,10 +19,10 @@ public class MemberItemView extends LinearLayout {
private TextView tv_member_type;
private MemberCardView mcv_discount, mcv_free_day, mcv_free_outdoors;
private TextView tv_describe;
private Button btn_buy;
// private Button btn_buy;
private View viewLine;
private boolean hasAgree = false;
// private boolean hasAgree = false;
private MemberCenterActivity.PayListener listener;
private MemberListBean.MemberCard memberCard = null;
......@@ -37,9 +37,9 @@ public class MemberItemView extends LinearLayout {
initView();
}
public void setHasAgree(boolean hasAgree) {
this.hasAgree = hasAgree;
}
// public void setHasAgree(boolean hasAgree) {
// this.hasAgree = hasAgree;
// }
public void setData(MemberListBean.MemberCard card) {
this.memberCard = card;
......@@ -61,7 +61,7 @@ public class MemberItemView extends LinearLayout {
mcv_free_day = view.findViewById(R.id.mcv_free_day);
mcv_free_outdoors = view.findViewById(R.id.mcv_free_outdoors);
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);
addView(view);
}
......@@ -69,28 +69,28 @@ public class MemberItemView extends LinearLayout {
private void setData() {
if (!TextUtils.isEmpty(memberCard.getName())) {
tv_member_type.setText(memberCard.getName());
btn_buy.setText("立即开通" + memberCard.getName());
if (memberCard.getLevel() == 1) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member);
} else if (memberCard.getLevel() == 2) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member);
} else {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member);
}
// btn_buy.setText("立即开通" + memberCard.getName());
// if (memberCard.getLevel() == 1) {
// btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member);
// } else if (memberCard.getLevel() == 2) {
// btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member);
// } else {
// btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member);
// }
}
btn_buy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!hasAgree) {
Toast.makeText(getContext(), "需同意服务协议", Toast.LENGTH_SHORT).show();
return;
}
if (listener != null) {
listener.pay(memberCard);
}
}
});
// btn_buy.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// if (!hasAgree) {
// Toast.makeText(getContext(), "需同意服务协议", Toast.LENGTH_SHORT).show();
// return;
// }
// if (listener != null) {
// listener.pay(memberCard);
// }
// }
// });
if (!TextUtils.isEmpty(memberCard.getDescribe())) {
tv_describe.setText(memberCard.getDescribe());
}
......
......@@ -75,18 +75,18 @@
android:layout_marginBottom="13dp"
android:textSize="@dimen/dp_10" />
<Button
android:visibility="gone"
android:id="@+id/btn_buy"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/size_20"
android:layout_marginTop="13dp"
android:layout_marginRight="@dimen/size_20"
android:background="@drawable/shape_rv_bg_dark_yellow"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/text_16" />
<!--<Button-->
<!--android:visibility="gone"-->
<!--android:id="@+id/btn_buy"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="@dimen/dp_40"-->
<!--android:layout_marginLeft="@dimen/size_20"-->
<!--android:layout_marginTop="13dp"-->
<!--android:layout_marginRight="@dimen/size_20"-->
<!--android:background="@drawable/shape_rv_bg_dark_yellow"-->
<!--android:gravity="center"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="@dimen/text_16" />-->
<View
android:id="@+id/view_line"
......
......@@ -31,6 +31,10 @@ android {
pro {
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
......
......@@ -10,12 +10,6 @@
<application>
<receiver android:name="com.rv.version.receiver.UpdateAppReceiver">
<intent-filter>
<action android:name="teprinciple.update" />
</intent-filter>
</receiver>
<provider
android:name="android.support.v4.content.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;
import android.app.Dialog;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.annotation.NonNull;
import android.text.Html;
import android.text.TextUtils;
......@@ -18,9 +16,8 @@ import android.widget.TextView;
import com.ruiwenliu.wrapper.dialog.BaseDialog;
import com.rv.version.bean.UpdateBean;
import com.rv.version.receiver.UpdateAppReceiver;
public class VersionUpdateDialog extends BaseDialog {
public class VersionUpdateDialog extends BaseDialog {
public VersionUpdateDialog(@NonNull Context context) {
super(context);
......@@ -29,7 +26,7 @@ public class VersionUpdateDialog extends BaseDialog {
public VersionUpdateDialog(Context context, int 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
......@@ -47,6 +44,10 @@ public class VersionUpdateDialog extends BaseDialog {
private ImageView imgClose;
private DownloadListener mListener;
private UpdateForceDialog forceDialog;
private UpdateUnforceDialog updateUnforceDialog;
public Builder(Context context, DownloadListener listener) {
mContext = context;
this.mListener = listener;
......@@ -81,22 +82,26 @@ public class VersionUpdateDialog extends BaseDialog {
this.txtContent = layout.findViewById(R.id.txt_content);
this.btn_update = layout.findViewById(R.id.btn_update);
this.imgClose = layout.findViewById(R.id.img_close);
this.btn_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.download();
}
dialog.dismiss();
this.btn_update.setOnClickListener(view -> {
if (mListener != null) {
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();
}
DownListenerManager.getInstance().notifyPendChange();
}
dialog.dismiss();
});
this.imgClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
this.imgClose.setOnClickListener(view -> dialog.dismiss());
if (this.updateBean != null) {
if (!TextUtils.isEmpty(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;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadLargeFileListener;
import com.liulishuo.filedownloader.FileDownloader;
import com.rv.version.receiver.UpdateAppReceiver;
import com.rv.version.DownListenerManager;
import java.io.File;
......@@ -20,7 +18,7 @@ public class DownloadAppUtils {
public static String downloadUpdateApkFilePath;//下载更新Apk 文件路径
public static void download(final Context context, String url, final String serverVersionName) {
DownListenerManager.getInstance().setDown(true);
String rootPath = null;
rootPath = getCachePath(context) + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator;
send(context, -1, serverVersionName);
......@@ -41,22 +39,29 @@ public class DownloadAppUtils {
@Override
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);
}
@Override
protected void paused(BaseDownloadTask task, long soFarBytes, long totalBytes) {
Log.e(TAG, "paused");
DownListenerManager.getInstance().notifyPausedChange();
}
@Override
protected void completed(BaseDownloadTask task) {
send(context, 100, serverVersionName);
DownListenerManager.getInstance().notifyCompletedChange();
DownListenerManager.getInstance().setDown(false);
}
@Override
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
......
......@@ -157,12 +157,7 @@ public class UpdateAppUtils {
.show();
}
private VersionUpdateDialog.Builder.DownloadListener listener = new VersionUpdateDialog.Builder.DownloadListener() {
@Override
public void download() {
preDownLoad();
}
};
private VersionUpdateDialog.Builder.DownloadListener listener = () -> preDownLoad();
private static final int PERMISSION_CODE = 1001;
......
......@@ -2,4 +2,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="@color/gray_FFB74B" />
<gradient
android:angle="0"
android:endColor="#FF9730"
android:startColor="#FBB554" />
</shape>
\ No newline at end of file
......@@ -3,5 +3,5 @@
<!--背景颜色-->
<solid android:color="#ffffff" />
<!--设置圆角的角度-->
<corners android:radius="15dp" />
<corners android:radius="5dp" />
</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 @@
android:orientation="vertical">
<ImageView
android:scaleType="centerCrop"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_img_height"
android:scaleType="centerCrop"
android:src="@drawable/icon_dialog_top" />
<TextView
......@@ -25,17 +25,18 @@
android:layout_height="wrap_content"
android:gravity="center"
android:text="更新提示"
android:textColor="#ff5e5e5e"
android:textSize="18sp" />
android:textColor="#171413"
android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<TextView
android:layout_marginTop="@dimen/size_5"
android:id="@+id/tv_version_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_5"
android:gravity="center"
android:textColor="#ff5e5e5e"
android:textColor="#171413"
android:textSize="@dimen/sp_14" />
<TextView
......@@ -44,19 +45,20 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="left"
android:lineSpacingMultiplier="1.5"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:textColor="#ff5e5e5e"
android:textSize="16sp" />
android:textColor="#666666"
android:textSize="@dimen/sp_12" />
<Button
android:id="@+id/btn_update"
android:layout_width="match_parent"
android:layout_height="@dimen/size_40"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_15"
android:layout_marginLeft="13sp"
android:layout_marginTop="13sp"
android:layout_marginRight="13sp"
android:layout_marginBottom="13sp"
android:background="@drawable/bg_version_btn"
android:gravity="center"
android:text="立即更新"
......@@ -69,7 +71,7 @@
android:id="@+id/img_close"
android:layout_width="@dimen/size_30"
android:layout_height="@dimen/size_30"
android:layout_marginTop="10dp"
android:layout_marginTop="20dp"
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