Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_street
Commits
918b73af
Commit
918b73af
authored
Jul 23, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加站内升级功能已完成
数据库数据的依赖问题已经解决
parent
bf04b134
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
919 additions
and
76 deletions
+919
-76
build.gradle
app/build.gradle
+6
-9
EnterDestinationAdapter.kt
.../java/com/mints/street/adapter/EnterDestinationAdapter.kt
+4
-3
ItemEnterDestinationAdapter.kt
...a/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
+39
-13
UpgradeInfo.kt
app/src/main/java/com/mints/street/bean/UpgradeInfo.kt
+16
-0
ScenicSpotDao.kt
app/src/main/java/com/mints/street/db/ScenicSpotDao.kt
+35
-35
DownloadEvent.java
...c/main/java/com/mints/street/eventbean/DownloadEvent.java
+50
-0
MainActivity.kt
app/src/main/java/com/mints/street/main/MainActivity.kt
+5
-5
FeaturedExperienceFragment.kt
...va/com/mints/street/main/vr/FeaturedExperienceFragment.kt
+1
-1
FreeZoneFragment.kt
...rc/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
+6
-1
FreeZoneViewModel.kt
...c/main/java/com/mints/street/main/vr/FreeZoneViewModel.kt
+12
-2
UpdateServices.java
...c/main/java/com/mints/street/services/UpdateServices.java
+177
-0
UpdateHelper.java
app/src/main/java/com/mints/street/utils/UpdateHelper.java
+91
-0
DownloadDialog.java
...n/java/com/mints/street/widget/dialog/DownloadDialog.java
+124
-0
UpdateDialog.kt
.../main/java/com/mints/street/widget/dialog/UpdateDialog.kt
+157
-0
item_enter_destination_adapter.xml
app/src/main/res/layout/item_enter_destination_adapter.xml
+5
-5
main_dialog_download_fragment.xml
app/src/main/res/layout/main_dialog_download_fragment.xml
+55
-0
main_update_dialog.xml
app/src/main/res/layout/main_update_dialog.xml
+130
-0
ic_update_bg.webp
app/src/main/res/mipmap-xxhdpi/ic_update_bg.webp
+0
-0
ic_update_btn_bg.webp
app/src/main/res/mipmap-xxhdpi/ic_update_btn_bg.webp
+0
-0
config.gradle
config.gradle
+5
-0
build.gradle
mvvmhabit/build.gradle
+1
-2
No files found.
app/build.gradle
View file @
918b73af
...
...
@@ -3,6 +3,8 @@ apply plugin: 'com.android.application'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android-extensions'
apply
plugin:
'kotlin-kapt'
apply
plugin:
"kotlin-noarg"
apply
plugin:
"kotlin-allopen"
android
{
...
...
@@ -189,14 +191,9 @@ dependencies {
//room数据库
def
room_version
=
"2.3.0"
implementation
"androidx.room:room-runtime:$room_version"
annotationProcessor
"androidx.room:room-compiler:$room_version"
// use kapt for Kotlin
// optional - RxJava support for Room
implementation
"androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation
"androidx.room:room-guava:$room_version"
// Test helpers
testImplementation
"androidx.room:room-testing:$room_version"
api
rootProject
.
ext
.
dependencies
[
"room-runtime"
]
api
rootProject
.
ext
.
dependencies
[
"room-rxjava2"
]
api
rootProject
.
ext
.
dependencies
[
"room-guava"
]
kapt
rootProject
.
ext
.
dependencies
[
"room-compiler"
]
}
\ No newline at end of file
app/src/main/java/com/mints/street/adapter/EnterDestinationAdapter.kt
View file @
918b73af
...
...
@@ -13,6 +13,7 @@ import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.EnterDestinationAdapterBinding
import
com.mints.street.main.vr.FreeZoneViewModel
import
me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter
...
...
@@ -21,8 +22,8 @@ import me.tatarka.bindingcollectionadapter2.ItemBinding
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class
EnterDestinationAdapter
(
val
context
:
Context
):
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
class
EnterDestinationAdapter
(
val
context
:
Context
,
val
bean
:
List
<
VrmapBean
.
Abroad
>?
):
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
bean
,
1
)
{
private
var
vLayout
:
VirtualLayoutManager
?
=
null
...
...
@@ -37,7 +38,7 @@ class EnterDestinationAdapter(val context: Context):
holder
.
binding
.
listView
.
layoutManager
=
vLayout
holder
.
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
,
true
))
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
,
true
,
bean
))
}
...
...
app/src/main/java/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
View file @
918b73af
package
com.mints.street.adapter
import
android.content.Context
import
android.graphics.Point
import
android.util.DisplayMetrics
import
android.view.Display
import
com.alibaba.android.vlayout.layout.LinearLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.utils.ImageLoader
import
com.mints.street.R
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/9.
* @param isMultipleLayout 是否是多布局
*/
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
val
isMultipleLayout
:
Boolean
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
private
val
isMultipleLayout
:
Boolean
,
val
list
:
List
<
VrmapBean
.
Abroad
>?
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
list
,
1
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
position
:
Int
)
{
var
a
=
context
.
resources
.
displayMetrics
;
var
a
=
context
.
resources
.
displayMetrics
;
val
bgLayoutParams
=
holder
.
binding
.
bg
.
layoutParams
if
(
isMultipleLayout
)
{
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
}
else
{
if
(
isMultipleLayout
)
{
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
}
else
{
bgLayoutParams
.
width
=
a
.
widthPixels
}
list
?.
let
{
it
->
holder
.
binding
.
tvName
.
text
=
it
[
position
].
name
holder
.
binding
.
tvNumberPeople
.
text
=
"人数"
it
[
position
].
img
?.
let
{
url
->
for
(
index
in
it
.
indices
)
{
when
(
index
)
{
0
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image1
).
start
()
}
1
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image2
).
start
()
}
2
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image3
).
start
()
}
}
}
}
}
}
override
fun
getItemCount
()
=
2
override
fun
getItemCount
()
=
list
?.
size
?:
0
override
fun
onCreateLayoutHelper
()
=
LinearLayoutHelper
()
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_enter_destination_adapter
}
app/src/main/java/com/mints/street/bean/UpgradeInfo.kt
0 → 100644
View file @
918b73af
package
com.mints.street.bean
/**
*
* @author 冯瑞雨
* @date 2021/7/23
*/
class
UpgradeInfo
(
var
title
:
String
?
,
var
name
:
String
?
,
var
content
:
String
?
,
var
versionName
:
String
?
,
var
v_code
:
String
?
,
var
downloadUrl
:
String
,
var
apkMd5
:
String
?
,
var
isForce
:
Boolean
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/street/db/ScenicSpotDao.kt
View file @
918b73af
...
...
@@ -18,41 +18,41 @@ interface ScenicSpotDao {
*/
@Query
(
"SELECT * FROM vr_scenic_spot"
)
fun
getVRFreeZoneAll
():
List
<
ScenicSpotBean
>
/**
* 删除 VR 免费专区
*/
@Delete
fun
deleteVRFreeZoneAll
(
list
:
List
<
ScenicSpotBean
>)
/**
* 获取 国外的 免费专区
*/
@Query
(
"SELECT * FROM foreign_scenic_spots WHERE is_free = 1"
)
fun
getForeignFreeAll
(
list
:
List
<
ForeignScenicSpots
>)
/**
* 获取 国外的 收费(精选体验)
*/
@Query
(
"SELECT * FROM foreign_scenic_spots WHERE is_free = 2"
)
fun
getForeignTollAll
(
list
:
List
<
ForeignScenicSpots
>)
/**
* 添加 VR 国外
*/
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
fun
addForeignAll
(
list
:
List
<
ForeignScenicSpots
>)
/**
* 删除 VR 国外免费
*/
@Query
(
"DELETE FROM foreign_scenic_spots WHERE is_free =1"
)
fun
deleteForeignFreeAll
()
/**
* 删除 VR 国外收费
*/
@Query
(
"DELETE FROM foreign_scenic_spots WHERE is_free =2"
)
fun
deleteForeignTollAll
()
//
//
/**
//
* 删除 VR 免费专区
//
*/
//
@Delete
//
fun deleteVRFreeZoneAll(list:List<ScenicSpotBean>)
//
//
/**
//
* 获取 国外的 免费专区
//
*/
//
@Query("SELECT * FROM foreign_scenic_spots WHERE is_free = 1")
//
fun getForeignFreeAll(list:List<ForeignScenicSpots>)
//
//
/**
//
* 获取 国外的 收费(精选体验)
//
*/
//
@Query("SELECT * FROM foreign_scenic_spots WHERE is_free = 2")
//
fun getForeignTollAll(list:List<ForeignScenicSpots>)
//
//
/**
//
* 添加 VR 国外
//
*/
//
@Insert(onConflict = OnConflictStrategy.REPLACE)
//
fun addForeignAll(list:List<ForeignScenicSpots>)
//
//
/**
//
* 删除 VR 国外免费
//
*/
//
@Query("DELETE FROM foreign_scenic_spots WHERE is_free =1")
//
fun deleteForeignFreeAll()
//
/**
//
* 删除 VR 国外收费
//
*/
//
@Query("DELETE FROM foreign_scenic_spots WHERE is_free =2")
//
fun deleteForeignTollAll()
...
...
app/src/main/java/com/mints/street/eventbean/DownloadEvent.java
0 → 100644
View file @
918b73af
package
com
.
mints
.
street
.
eventbean
;
/**
* @author 冯瑞雨
* @date 2019/10/23 16:29
*/
public
class
DownloadEvent
{
/**
* apk 的大小
*/
private
long
apkSize
;
/**
* 下载的进度 百分比
*/
private
int
apkCurrentProgress
;
/**
* 下载当前进度
*/
private
long
apkSchedule
;
public
long
getApkSize
()
{
return
apkSize
;
}
public
void
setApkSize
(
long
apkSize
)
{
this
.
apkSize
=
apkSize
;
}
public
int
getApkCurrentProgress
()
{
return
apkCurrentProgress
;
}
public
void
setApkCurrentProgress
(
int
apkCurrentProgress
)
{
this
.
apkCurrentProgress
=
apkCurrentProgress
;
}
public
long
getApkSchedule
()
{
return
apkSchedule
;
}
public
void
setApkSchedule
(
long
apkSchedule
)
{
this
.
apkSchedule
=
apkSchedule
;
}
public
DownloadEvent
(
long
apkSize
,
int
apkCurrentProgress
,
long
apkSchedule
)
{
this
.
apkSize
=
apkSize
;
this
.
apkCurrentProgress
=
apkCurrentProgress
;
this
.
apkSchedule
=
apkSchedule
;
}
}
app/src/main/java/com/mints/street/main/MainActivity.kt
View file @
918b73af
package
com.mints.street.main
import
android.Manifest
import
android.content.Intent
import
android.os.Bundle
import
android.view.KeyEvent
import
android.view.View
...
...
@@ -15,19 +14,17 @@ import com.fry.base.utils.ImageLoader
import
com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.bean.UpgradeInfo
import
com.mints.street.databinding.ActivityMainBinding
import
com.mints.street.main.home.HomeFragment
import
com.mints.street.main.home.SearchMapActivity
import
com.mints.street.main.my.MyFragment
import
com.mints.street.main.vr.VRFragment
import
com.mints.street.manager.UmengManager
import
com.mints.street.manager.oaid.OaidManager
import
com.mints.street.utils.UpdateHelper
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.umeng.analytics.MobclickAgent
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
,
MainViewModel
>()
{
...
...
@@ -75,6 +72,9 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
.
subscribe
{
}
UpdateHelper
.
processUpdate
(
this
@MainActivity
,
UpgradeInfo
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
false
))
}
...
...
app/src/main/java/com/mints/street/main/vr/FeaturedExperienceFragment.kt
View file @
918b73af
...
...
@@ -40,6 +40,6 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
false
))
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
false
,
null
))
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
View file @
918b73af
...
...
@@ -22,6 +22,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridMapAdapter
:
GridMapAdapter
?
=
null
private
var
enterDestinationAdapter
:
EnterDestinationAdapter
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
...
...
@@ -48,13 +49,17 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
EnterDestinationAdapter
(
context
!!
))
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
<
VrmapBean
>
{
if
(
enterDestinationAdapter
==
null
){
enterDestinationAdapter
=
EnterDestinationAdapter
(
context
!!
,
it
.
abroad
)
mAdapter
?.
addAdapter
(
enterDestinationAdapter
)
}
if
(
gridMapAdapter
==
null
){
gridMapAdapter
=
GridMapAdapter
(
context
!!
,
it
.
internal
)
mAdapter
?.
addAdapter
(
gridMapAdapter
)
...
...
app/src/main/java/com/mints/street/main/vr/FreeZoneViewModel.kt
View file @
918b73af
...
...
@@ -5,6 +5,8 @@ import androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.VipBean
import
com.mints.street.bean.VrmapBean
import
com.mints.street.db.AppDatabase
import
com.mints.street.db.ScenicSpotBean
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.BaseViewModel
...
...
@@ -24,11 +26,19 @@ class FreeZoneViewModel(application: Application):BaseViewModel(application) {
this
@FreeZoneViewModel
,
true
){
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
VrmapBean
>)
{
VrmapBean
.
value
=
response
.
result
KLog
.
e
(
"vrPlaces"
,
"请求成功"
)
val
a
:
MutableList
<
ScenicSpotBean
>
=
ArrayList
()
for
(
item
in
response
.
result
.
internal
!!
){
a
.
add
(
ScenicSpotBean
(
name
=
item
.
name
,
url
=
item
.
url
,
starRating
=
item
.
stars
,
images
=
item
.
img
))
}
// AppDatabase.instance().scenicSpotDao().addVRFreeZoneAll(a)
// for(item in AppDatabase.instance().scenicSpotDao().getVRFreeZoneAll()){
// KLog.e("AppDatabase.instance().scenicSpotDao().getVRFreeZoneAll()",item.toString())
// }
}
override
fun
onError
(
e
:
Throwable
)
{
KLog
.
e
(
"vrPlaces"
,
"请求失败"
)
KLog
.
e
(
"vrPlaces"
,
"请求失败
: $e
"
)
}
}
)
...
...
app/src/main/java/com/mints/street/services/UpdateServices.java
0 → 100644
View file @
918b73af
package
com
.
mints
.
street
.
services
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.os.IBinder
;
import
com.fry.base.utils.NotificationUtils
;
import
com.mints.street.BuildConfig
;
import
com.mints.street.eventbean.DownloadEvent
;
import
com.mints.street.utils.UpdateHelper
;
import
java.io.File
;
import
me.goldze.mvvmhabit.bus.RxBus
;
import
me.goldze.mvvmhabit.http.DownLoadManager
;
import
me.goldze.mvvmhabit.http.download.ProgressCallBack
;
import
me.goldze.mvvmhabit.utils.AppUtils
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
me.goldze.mvvmhabit.utils.Utils
;
import
okhttp3.ResponseBody
;
/**
* 升级下载服务
*
* @author 冯瑞雨
* @date 2021/7/23
*/
public
class
UpdateServices
extends
Service
{
public
static
final
String
VERSION_CODE_KEY
=
"versionCode"
;
public
static
final
String
DOWNLOAD_URL_KEY
=
"url"
;
public
static
final
String
APK_MD5
=
"apkMd5"
;
public
static
final
String
IS_FORCED_UPDATE_KEY
=
"isForcedUpdate"
;
private
boolean
isForcedUpdate
;
/***
* 文件存放的路径
*/
private
String
destFileDir
;
/***
* 文件存放的名称
*/
private
String
destFileName
=
"last-"
+
BuildConfig
.
VERSION_CODE
+
".apk"
;
private
String
targetVersionName
;
private
NotificationUtils
mNotificationUtils
;
private
boolean
hasDownloading
=
false
;
@Override
public
IBinder
onBind
(
Intent
intent
)
{
return
null
;
}
@Override
public
void
onStart
(
Intent
intent
,
int
startId
)
{
super
.
onStart
(
intent
,
startId
);
}
@Override
public
void
onCreate
()
{
super
.
onCreate
();
destFileDir
=
UpdateHelper
.
getDownloadDir
(
this
);
}
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
if
(
intent
==
null
)
{
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
}
if
(
intent
.
hasExtra
(
VERSION_CODE_KEY
))
{
targetVersionName
=
intent
.
getStringExtra
(
VERSION_CODE_KEY
);
destFileName
=
UpdateHelper
.
getFileName
(
targetVersionName
);
}
if
(
mNotificationUtils
==
null
)
{
mNotificationUtils
=
new
NotificationUtils
(
getBaseContext
());
}
//启动线程开始执行下载任务
if
(!
hasDownloading
&&
intent
.
hasExtra
(
DOWNLOAD_URL_KEY
))
{
startForeground
(
1
,
mNotificationUtils
.
getNotification
(
"下载"
,
"准备下载"
).
build
());
downFile
(
intent
.
getStringExtra
(
DOWNLOAD_URL_KEY
));
}
if
(
intent
.
hasExtra
(
IS_FORCED_UPDATE_KEY
))
{
isForcedUpdate
=
intent
.
getBooleanExtra
(
IS_FORCED_UPDATE_KEY
,
false
);
}
/**
* 这个常量是{@link #onStartCommand}方法的其中一个返回值:如果这个服务的进程在这个服务
* 已经启动(也就是{@link #onStartCommand}方法已经运行完了)之后因为系统资源紧张等问题
* 被系统关闭了,这个服务会被系统用最近一次启动这个服务所用的Intent重新启动它。这个Intent
* 会被系统一直保存到{@link #stopSelf(int)}方法被调用为止。这种情况下,服务当中的
* {@link #onStartCommand(Intent, int, int)}里面的intent不会是null。因为这种服务只
* 会在所有启动它的intent都执行完了的情况下才不会重新启动。
*/
return
Service
.
START_REDELIVER_INTENT
;
/*super.onStartCommand(intent, flags, startId);*/
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
}
//下载更新文件
private
void
downFile
(
final
String
url
)
{
if
(
hasDownloading
)
{
return
;
}
DownLoadManager
.
getInstance
().
load
(
url
,
new
ProgressCallBack
<
ResponseBody
>(
destFileDir
,
destFileName
)
{
@Override
public
void
onStart
()
{
super
.
onStart
();
hasDownloading
=
true
;
ToastUtils
.
showShort
(
"开始下载!"
);
}
@Override
public
void
onSuccess
(
ResponseBody
o
)
{
//如果md5为空,则不校验文件是否合法
ToastUtils
.
showShort
(
"文件下载成功!"
);
installApk
(
destFileDir
+
"/"
+
destFileName
);
if
(
isForcedUpdate
)
{
RxBus
.
getDefault
().
post
(
new
DownloadEvent
(
0
,
100
,
0
));
}
hasDownloading
=
false
;
//停止掉当前的服务
stopSelf
();
}
@Override
public
void
progress
(
long
progress
,
long
total
)
{
//更新状态栏上的下载进度信息
int
processValue
=
(
int
)
((
progress
/
(
double
)
total
)
*
100
);
if
(
isForcedUpdate
)
{
RxBus
.
getDefault
().
post
(
new
DownloadEvent
(
total
,
processValue
,
progress
));
}
else
{
mNotificationUtils
.
sendNotificationProgress
(
"升级"
,
"已下载"
+
processValue
+
"%"
,
processValue
,
null
);
}
}
@Override
public
void
onError
(
Throwable
e
)
{
//如果断网,会抛IO异常
e
.
printStackTrace
();
ToastUtils
.
showShort
(
"文件下载失败!"
);
File
file
=
new
File
(
destFileDir
+
File
.
separator
+
destFileName
);
if
(
file
.
exists
())
{
file
.
delete
();
}
// nm.cancel(notificationId);
hasDownloading
=
false
;
//停止掉当前的服务
stopSelf
();
// progressDialog.dismiss();
}
@Override
public
void
onCompleted
()
{
// progressDialog.dismiss();
//下载完成后清除所有下载信息,执行安装提示
// nm.cancel(notificationId);
hasDownloading
=
false
;
//停止掉当前的服务
stopSelf
();
}
});
}
private
void
installApk
(
String
s
)
{
AppUtils
.
installApk
(
Utils
.
getContext
(),
s
);
}
}
app/src/main/java/com/mints/street/utils/UpdateHelper.java
0 → 100644
View file @
918b73af
package
com
.
mints
.
street
.
utils
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
com.lxj.xpopup.interfaces.OnConfirmListener
;
import
com.mints.street.bean.UpgradeInfo
;
import
com.mints.street.widget.dialog.UpdateDialog
;
import
java.io.File
;
import
androidx.appcompat.app.AppCompatActivity
;
import
me.goldze.mvvmhabit.utils.AppUtils
;
import
me.goldze.mvvmhabit.utils.CommonDialogUtils
;
/**
* @author jeme
* @date 2019/12/29
*/
public
class
UpdateHelper
{
/***
* 普通升级
*/
public
static
final
int
UPDATE
=
1
;
/***
* 强制升级
*/
public
static
final
int
FORCE_UPDATE
=
2
;
/***
* 处理升级功能
*/
public
static
void
processUpdate
(
AppCompatActivity
appCompatActivity
,
UpgradeInfo
upgradeInfoBean
)
{
UpdateDialog
.
showDialog
(
appCompatActivity
,
upgradeInfoBean
);
}
/***
* 检查升级文件合法性
*/
public
static
boolean
checkUpdateFile
(
Context
context
,
String
appVersionCode
,
String
md5
)
{
if
(
TextUtils
.
isEmpty
(
md5
))
{
return
false
;
}
String
dir
=
getDownloadDir
(
context
);
File
file
=
new
File
(
String
.
format
(
"%s%s%s"
,
dir
,
File
.
separator
,
appVersionCode
));
if
(
file
.
exists
())
{
String
md5_
=
me
.
goldze
.
mvvmhabit
.
utils
.
FileUtils
.
getFileMD5
(
file
);
return
TextUtils
.
equals
(
md5
,
md5_
);
}
return
false
;
}
public
static
String
getDownloadDir
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
return
context
.
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
).
getPath
();
}
else
{
return
Environment
.
getExternalStorageDirectory
().
getPath
();
}
}
public
static
String
getFileName
(
String
newVersionCode
)
{
return
String
.
format
(
"last-%s.apk"
,
newVersionCode
);
}
private
static
void
showInstallDialog
(
AppCompatActivity
activity
,
String
appVersion
)
{
CommonDialogUtils
.
showMessage
(
activity
,
"安装"
,
"新包已经下载成功,是否直接安装?"
,
"确定"
,
"取消"
,
new
OnConfirmListener
()
{
@Override
public
void
onConfirm
()
{
AppUtils
.
installApk
(
activity
,
String
.
format
(
"%s%s%s"
,
getDownloadDir
(
activity
),
File
.
separator
,
getFileName
(
appVersion
)));
}
},
null
,
false
);
/* TDialogHelper.selectDialog(activity,"安装","新包已经下载成功,是否直接安装?")
.setOnViewClickListener(new OnViewClickListener() {
@Override
public void onViewClick(BindViewHolder viewHolder, View view, TDialog tDialog) {
if(view.getId() == R.id.tv_confirm){
AppUtils.installApk(activity,
String.format("%s%s%s",getDownloadDir(activity),
File.separator,getFileName(appVersion)));
}
tDialog.dismiss();
}
}).create().show();*/
}
}
app/src/main/java/com/mints/street/widget/dialog/DownloadDialog.java
0 → 100644
View file @
918b73af
package
com
.
mints
.
street
.
widget
.
dialog
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Bundle
;
import
android.util.DisplayMetrics
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.mints.street.R
;
import
com.mints.street.eventbean.DownloadEvent
;
import
java.text.DecimalFormat
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.functions.Consumer
;
import
me.goldze.mvvmhabit.bus.RxBus
;
import
me.goldze.mvvmhabit.bus.RxSubscriptions
;
import
me.goldze.mvvmhabit.utils.Utils
;
/**
* @author 冯瑞雨
* @date 2019/10/23 14:54
*/
public
class
DownloadDialog
extends
DialogFragment
{
private
TextView
tvDownloadSchedule
,
tvDownloadSize
,
tvApkSize
;
private
ProgressBar
progressBar
;
private
Disposable
mSubscribe
;
private
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
private
double
apkSize
;
public
static
DownloadDialog
newInstance
()
{
Bundle
args
=
new
Bundle
();
DownloadDialog
fragment
=
new
DownloadDialog
();
fragment
.
setArguments
(
args
);
return
fragment
;
}
@Override
public
void
onStart
()
{
super
.
onStart
();
Window
window
=
getDialog
().
getWindow
();
window
.
setBackgroundDrawable
(
new
ColorDrawable
());
DisplayMetrics
dm
=
new
DisplayMetrics
();
getActivity
().
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
dm
);
window
.
setLayout
(
WindowManager
.
LayoutParams
.
WRAP_CONTENT
,
WindowManager
.
LayoutParams
.
WRAP_CONTENT
);
WindowManager
.
LayoutParams
params
=
window
.
getAttributes
();
params
.
gravity
=
Gravity
.
CENTER
;
window
.
setAttributes
(
params
);
setCancelable
(
false
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
inflate
=
inflater
.
inflate
(
R
.
layout
.
main_dialog_download_fragment
,
container
,
false
);
return
inflate
;
}
@Override
public
void
onViewCreated
(
@NonNull
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
tvDownloadSchedule
=
view
.
findViewById
(
R
.
id
.
tv_download_schedule
);
tvDownloadSize
=
view
.
findViewById
(
R
.
id
.
tv_download_size
);
progressBar
=
view
.
findViewById
(
R
.
id
.
pb_progress_bar
);
tvApkSize
=
view
.
findViewById
(
R
.
id
.
tv_apk_size
);
mSubscribe
=
RxBus
.
getDefault
().
toObservable
(
DownloadEvent
.
class
).
subscribe
(
new
Consumer
<
DownloadEvent
>()
{
@Override
public
void
accept
(
DownloadEvent
downloadEvent
)
throws
Exception
{
Utils
.
getHandler
().
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
apkSize
==
0
){
apkSize
=
downloadEvent
.
getApkSize
()/(
1024
f
*
1024
f
);
if
(
tvApkSize
!=
null
)
{
tvApkSize
.
setText
(
String
.
format
(
"/%sM"
,
df
.
format
(
apkSize
)));
}
}
if
(
tvDownloadSchedule
!=
null
)
{
tvDownloadSchedule
.
setText
(
String
.
format
(
"下载%s%%"
,
downloadEvent
.
getApkCurrentProgress
()));
}
if
(
progressBar
!=
null
)
{
progressBar
.
setProgress
(
downloadEvent
.
getApkCurrentProgress
());
}
if
(
tvDownloadSize
!=
null
)
{
tvDownloadSize
.
setText
(
String
.
format
(
"%sM"
,
df
.
format
(
downloadEvent
.
getApkSchedule
()/(
1024
f
*
1024
f
))));
}
if
(
downloadEvent
.
getApkSize
()
==
0
&&
downloadEvent
.
getApkSchedule
()==
0
){
tvDownloadSize
.
setText
(
String
.
format
(
"%sM"
,
df
.
format
(
apkSize
)));
}
}
});
}
});
RxSubscriptions
.
add
(
mSubscribe
);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
RxSubscriptions
.
remove
(
mSubscribe
);
}
}
app/src/main/java/com/mints/street/widget/dialog/UpdateDialog.kt
0 → 100644
View file @
918b73af
package
com.mints.street.widget.dialog
import
android.Manifest
import
android.annotation.SuppressLint
import
android.annotation.TargetApi
import
android.content.Intent
import
android.net.Uri
import
android.os.Build
import
android.provider.Settings
import
android.text.TextUtils
import
android.view.View
import
androidx.fragment.app.FragmentActivity
import
com.fry.base.utils.SpannableUtils
import
com.lxj.xpopup.XPopup
import
com.lxj.xpopup.core.CenterPopupView
import
com.lxj.xpopup.interfaces.SimpleCallback
import
com.mints.street.R
import
com.mints.street.bean.UpgradeInfo
import
com.mints.street.services.UpdateServices
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.main_update_dialog.view.*
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
/**
*
* @author 冯瑞雨
* @date 2021/7/23
*/
class
UpdateDialog
(
val
activity
:
FragmentActivity
,
val
upgradeInfoBean
:
UpgradeInfo
)
:
CenterPopupView
(
activity
)
{
companion
object
{
@JvmStatic
fun
showDialog
(
activity
:
FragmentActivity
,
upgradeInfoBean
:
UpgradeInfo
):
UpdateDialog
{
return
XPopup
.
Builder
(
activity
)
.
setPopupCallback
(
object
:
SimpleCallback
()
{
override
fun
onBackPressed
():
Boolean
{
if
(!
upgradeInfoBean
.
isForce
)
{
//非强制升级
return
false
}
return
true
}
})
.
dismissOnBackPressed
(!
upgradeInfoBean
.
isForce
)
.
dismissOnTouchOutside
(
false
/*!upgradeInfoBean.isForce*/
)
.
asCustom
(
UpdateDialog
(
activity
,
upgradeInfoBean
))
.
show
()
as
UpdateDialog
}
}
override
fun
getImplLayoutId
()
=
R
.
layout
.
main_update_dialog
override
fun
onCreate
()
{
super
.
onCreate
()
initView
()
initClick
()
}
private
fun
initView
()
{
tv_update_content
.
text
=
upgradeInfoBean
.
content
tv_tip
.
text
=
SpannableUtils
.
getGradientTxt
(
upgradeInfoBean
.
title
,
intArrayOf
(
0
xFFFFDA81
.
toInt
(),
0
xFFFFF1D5
.
toInt
(),
0
xFFFFEDAA
.
toInt
()),
null
)
tv_title
.
text
=
SpannableUtils
.
getGradientTxt
(
upgradeInfoBean
.
name
,
intArrayOf
(
0
xFFFFD56F
.
toInt
(),
0
xFFFFF1DA
.
toInt
(),
0
xFFFFEC98
.
toInt
()),
null
)
if
(
upgradeInfoBean
.
isForce
)
{
//强制升级
stv_download_next
.
visibility
=
View
.
GONE
}
else
{
//普通升级
stv_download_next
.
visibility
=
View
.
VISIBLE
}
}
private
fun
initClick
()
{
stv_download_next
.
setOnClickListener
{
this
.
dismiss
()
}
RxUtils
.
onMultiClick
(
stv_download_now
){
permissionStorage
()
}
}
@SuppressLint
(
"CheckResult"
)
private
fun
permissionStorage
()
{
//请求存储权限
val
rxPermissions
=
RxPermissions
(
activity
)
rxPermissions
.
request
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
.
subscribe
{
grant
:
Boolean
->
if
(
grant
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
// 8.0 检测是否允许安装apk
val
b
:
Boolean
=
activity
.
packageManager
.
canRequestPackageInstalls
()
if
(
b
)
{
startDownload
()
}
else
{
permissionInstall
()
}
}
else
{
startDownload
()
}
}
else
{
if
(
upgradeInfoBean
.
isForce
)
{
AppManager
.
getAppManager
().
finishAllActivity
()
}
else
{
dismiss
()
}
ToastUtils
.
showLong
(
"请前往系统设置里允许读写权限"
)
}
}
}
/**
* 8.0安装新版本APK权限
*/
@TargetApi
(
Build
.
VERSION_CODES
.
O
)
@SuppressLint
(
"CheckResult"
)
private
fun
permissionInstall
()
{
//请求安装权限
val
rxPermissions
=
RxPermissions
(
activity
)
rxPermissions
.
request
(
Manifest
.
permission
.
REQUEST_INSTALL_PACKAGES
)
.
subscribe
{
grant
:
Boolean
->
if
(
grant
)
{
startDownload
()
}
else
{
//跳转到安装未知应用界面
val
packageURI
=
Uri
.
parse
(
"package:"
+
activity
.
packageName
)
val
intent
=
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
,
packageURI
)
activity
.
startActivity
(
intent
)
}
}
}
private
fun
startDownload
()
{
if
(
TextUtils
.
isEmpty
(
upgradeInfoBean
.
downloadUrl
))
{
return
}
//打开服务
val
intent
=
Intent
(
activity
,
UpdateServices
::
class
.
java
)
intent
.
putExtra
(
UpdateServices
.
DOWNLOAD_URL_KEY
,
upgradeInfoBean
.
downloadUrl
)
intent
.
putExtra
(
UpdateServices
.
VERSION_CODE_KEY
,
upgradeInfoBean
.
v_code
)
if
(
upgradeInfoBean
.
isForce
)
{
//强制更新
//弹出新的进度框
intent
.
putExtra
(
UpdateServices
.
IS_FORCED_UPDATE_KEY
,
true
)
DownloadDialog
.
newInstance
().
show
(
activity
.
supportFragmentManager
,
""
)
}
else
{
//后台下载
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
activity
.
startForegroundService
(
intent
)
}
else
{
activity
.
startService
(
intent
)
}
dismiss
()
}
}
\ No newline at end of file
app/src/main/res/layout/item_enter_destination_adapter.xml
View file @
918b73af
...
...
@@ -21,7 +21,7 @@
app:layout_constraintTop_toTopOf=
"parent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android
:text=
"测试"
tools
:text=
"测试"
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
...
...
@@ -34,7 +34,7 @@
android:id=
"@+id/tv_number_people"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android
:text=
"人数"
tools
:text=
"人数"
android:drawableStart=
"@mipmap/search_hot_icon"
android:textColor=
"@color/black"
android:textSize=
"12sp"
...
...
@@ -54,7 +54,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/image2"
android
:src=
"@mipmap/bg_fl"
tools
:src=
"@mipmap/bg_fl"
/>
<ImageView
android:layout_marginStart=
"10dp"
...
...
@@ -64,7 +64,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/image1"
app:layout_constraintEnd_toStartOf=
"@id/image3"
android
:src=
"@mipmap/bg_fl"
tools
:src=
"@mipmap/bg_fl"
/>
<ImageView
...
...
@@ -75,7 +75,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/image2"
app:layout_constraintEnd_toEndOf=
"parent"
android
:src=
"@mipmap/bg_fl"
tools
:src=
"@mipmap/bg_fl"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
app/src/main/res/layout/main_dialog_download_fragment.xml
0 → 100644
View file @
918b73af
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_gravity=
"center"
>
<TextView
android:id=
"@+id/tv_download_schedule"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"下载0%"
android:textSize=
"14sp"
android:textColor=
"@color/white"
/>
<ProgressBar
android:layout_marginTop=
"10dp"
app:layout_constraintTop_toBottomOf=
"@id/tv_download_schedule"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginLeft=
"10dp"
android:id=
"@+id/pb_progress_bar"
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"200dp"
android:layout_height=
"8dp"
android:max=
"100"
tools:progress=
"80"
/>
<TextView
android:id=
"@+id/tv_download_size"
app:layout_constraintTop_toBottomOf=
"@+id/pb_progress_bar"
app:layout_constraintStart_toStartOf=
"@+id/pb_progress_bar"
android:layout_marginTop=
"10dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"0M"
android:textSize=
"14sp"
android:textColor=
"@color/white"
/>
<TextView
android:id=
"@+id/tv_apk_size"
app:layout_constraintTop_toBottomOf=
"@+id/pb_progress_bar"
app:layout_constraintStart_toEndOf=
"@id/tv_download_size"
android:layout_marginTop=
"10dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"/0M"
android:textSize=
"14sp"
android:textColor=
"@color/white"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/main_update_dialog.xml
0 → 100644
View file @
918b73af
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@mipmap/ic_update_bg"
>
<TextView
android:id=
"@+id/tv_tip"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"27dp"
android:paddingStart=
"4dp"
android:paddingEnd=
"4dp"
android:text=
"发现新版本"
android:textColor=
"@color/white"
android:textSize=
"14sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
android:layout_width=
"18dp"
android:layout_height=
"0.5dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"@id/tv_tip"
app:layout_constraintBottom_toBottomOf=
"@id/tv_tip"
app:layout_constraintEnd_toStartOf=
"@id/tv_tip"
/>
<View
android:layout_width=
"18dp"
android:layout_height=
"0.5dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"@id/tv_tip"
app:layout_constraintBottom_toBottomOf=
"@id/tv_tip"
app:layout_constraintStart_toEndOf=
"@id/tv_tip"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"50dp"
android:textColor=
"@color/white"
android:textSize=
"22sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"V3.0.0诚邀更新"
/>
<!-- <View
android:layout_width="0dp"
android:layout_height="0dp"
app:stv_solid="@color/white"
app:stv_corner="6dp"
app:stv_left_top_corner="false"
app:stv_left_bottom_corner="true"
app:stv_right_top_corner="false"
app:stv_right_bottom_corner="true"
app:layout_constraintTop_toTopOf="@id/sv_update_container"
app:layout_constraintBottom_toBottomOf="parent"/>-->
<androidx.core.widget.NestedScrollView
android:id=
"@+id/sv_update_container"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_margin=
"10dp"
android:minHeight=
"110dp"
app:layout_constraintTop_toBottomOf=
"@id/tv_title"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_update_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:textSize=
"13sp"
tools:text=
"1、我的关注,一件找货更方便,我的关注,一件找货更方便\n
1、新增【爱拼团】活动,立享超低\n
1、新增【爱拼团】活动,立享超低\n
1、新增【爱拼团】活动,立享超低"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<TextView
android:id=
"@+id/stv_download_next"
android:layout_width=
"0dp"
android:layout_height=
"42dp"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"17dp"
android:layout_marginEnd=
"5dp"
android:layout_weight=
"1"
android:background=
"@mipmap/ic_update_btn_bg"
android:gravity=
"center"
android:text=
"下次再说"
android:textColor=
"@color/white"
android:textSize=
"16sp"
app:layout_constraintEnd_toStartOf=
"@id/stv_download_now"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/sv_update_container"
tools:visibility=
"gone"
/>
<com.coorchice.library.SuperTextView
android:id=
"@+id/stv_download_now"
android:layout_width=
"0dp"
android:layout_height=
"42dp"
android:layout_marginStart=
"5dp"
android:layout_marginTop=
"17dp"
android:layout_marginEnd=
"20dp"
android:layout_marginBottom=
"20dp"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"现在升级"
android:textColor=
"@color/white"
android:textSize=
"16sp"
app:stv_shaderEnable=
"true"
app:stv_corner=
"4dp"
app:stv_shaderStartColor=
"#9A885B"
app:stv_shaderEndColor=
"#C3B387"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/stv_download_next"
app:layout_constraintTop_toBottomOf=
"@id/sv_update_container"
app:layout_goneMarginStart=
"20dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/ic_update_bg.webp
0 → 100644
View file @
918b73af
File added
app/src/main/res/mipmap-xxhdpi/ic_update_btn_bg.webp
0 → 100644
View file @
918b73af
File added
config.gradle
View file @
918b73af
...
...
@@ -84,6 +84,11 @@ ext {
//阿里路由框架
"arouter-api"
:
"com.alibaba:arouter-api:1.5.0"
,
"arouter-compiler"
:
"com.alibaba:arouter-compiler:1.2.2"
,
//room
"room-runtime"
:
"androidx.room:room-runtime:2.2.5"
,
"room-rxjava2"
:
"androidx.room:room-rxjava2:2.2.5"
,
"room-compiler"
:
"androidx.room:room-compiler:2.2.5"
,
"room-guava"
:
"androidx.room:room-guava:2.2.5"
,
"constraint-layout"
:
'androidx.constraintlayout:constraintlayout:1.1.3'
,
//图片选择和拍照功能
...
...
mvvmhabit/build.gradle
View file @
918b73af
...
...
@@ -22,9 +22,8 @@ android {
}
dependencies
{
//implementation
fileTree(include: ['*.jar','*.aar'], dir: 'libs')
api
fileTree
(
include:
[
'*.jar'
,
'*.aar'
],
dir:
'libs'
)
compileOnly
files
(
'libs\\xpopup-release.aar'
)
//support
api
rootProject
.
ext
.
support
[
"support-v4"
]
api
rootProject
.
ext
.
support
[
"appcompat-v7"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment