Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_youyou
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_youyou
Commits
9c512e82
Commit
9c512e82
authored
Mar 11, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
强升代码优化
parent
cedec2f8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
3 deletions
+72
-3
VersionUpdatePresenter.java
.../wenshu/youyou/mvp/presenters/VersionUpdatePresenter.java
+19
-3
UpdateService.java
...rc/main/java/com/wenshu/youyou/service/UpdateService.java
+14
-0
gradle.properties
gradle.properties
+39
-0
No files found.
app/src/main/java/com/wenshu/youyou/mvp/presenters/VersionUpdatePresenter.java
View file @
9c512e82
...
...
@@ -8,7 +8,9 @@ import android.content.Intent;
import
android.content.ServiceConnection
;
import
android.net.Uri
;
import
android.os.IBinder
;
import
androidx.appcompat.app.AlertDialog
;
import
android.text.TextUtils
;
import
android.text.method.ScrollingMovementMethod
;
import
android.view.KeyEvent
;
...
...
@@ -57,6 +59,7 @@ public class VersionUpdatePresenter {
Button
btnDuUpdate
;
private
Subscription
subscription
;
private
UpdateService
mUpdateService
;
public
void
updateVersion
(
Activity
activity
)
{
if
(
activity
==
null
)
...
...
@@ -211,6 +214,16 @@ public class VersionUpdatePresenter {
btnDuUpdate
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
TextUtils
.
equals
(
btnDuUpdate
.
getText
(),
"立即安装"
))
{
if
(
mUpdateService
!=
null
)
{
mUpdateService
.
autoInstallApk
();
}
else
{
ToastUtil
.
show
(
loanApplication
.
getApplicationContext
(),
"安装失败!"
);
System
.
exit
(
0
);
}
return
;
}
boolean
url
=
CommonUtils
.
isUrl
(
appFileUrl
);
if
(
url
)
{
updateApp
(
appFileUrl
,
granted
);
...
...
@@ -255,10 +268,10 @@ public class VersionUpdatePresenter {
public
void
onServiceConnected
(
ComponentName
name
,
IBinder
service
)
{
// //返回一个MsgService对象
UpdateService
u
pdateService
=
((
UpdateService
.
UpdateBinder
)
service
).
getService
();
mU
pdateService
=
((
UpdateService
.
UpdateBinder
)
service
).
getService
();
//
// //注册回调接口来接收下载进度的变化
u
pdateService
.
setUpdateNotification
(
new
UpdateService
.
UpdateNotification
()
{
mU
pdateService
.
setUpdateNotification
(
new
UpdateService
.
UpdateNotification
()
{
@Override
public
void
updateProgress
(
int
progress
)
{
if
(
pbDuUpdating
!=
null
)
{
...
...
@@ -271,7 +284,10 @@ public class VersionUpdatePresenter {
@Override
public
void
finishProgress
()
{
if
(
btnDuUpdate
!=
null
)
{
btnDuUpdate
.
setEnabled
(
true
);
btnDuUpdate
.
setText
(
"立即安装"
);
}
}
});
...
...
app/src/main/java/com/wenshu/youyou/service/UpdateService.java
View file @
9c512e82
...
...
@@ -16,9 +16,11 @@ import androidx.core.app.NotificationCompat;
import
androidx.core.content.FileProvider
;
import
android.widget.RemoteViews
;
import
com.wenshu.youyou.MintsApplication
;
import
com.wenshu.youyou.R
;
import
com.wenshu.youyou.common.Constant
;
import
com.wenshu.youyou.ui.activitys.MainActivity
;
import
com.wenshu.youyou.utils.ToastUtil
;
import
java.io.File
;
import
java.io.FileOutputStream
;
...
...
@@ -202,6 +204,18 @@ public class UpdateService extends Service {
}).
start
();
}
/**
* 安装 apk 文件
*/
public
void
autoInstallApk
()
{
if
(
updateFile
!=
null
)
{
autoInstallApk
(
updateFile
);
}
else
{
ToastUtil
.
show
(
MintsApplication
.
getContext
(),
"安装失败!"
);
System
.
exit
(
0
);
}
}
/**
* 安装 apk 文件
*/
...
...
gradle.properties
0 → 100755
View file @
9c512e82
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
DEBUG_URL
=
"http://39.97.65.143:9082/api/"
#DEBUG_URL="http://192.168.31.193:8101/"
RELEASE_URL="https://api.mints-id.com/gsnew-api/"
RELEASE_KEY_PASSWORD
=
mints.youyou
RELEASE_KEY_ALIAS
=
mints_youyou
RELEASE_STORE_PASSWORD
=
mints.youyou
RELEASE_STORE_FILE
=
mints_youyou.jks
#ShareSDK
RELEASE_SHARESDK_KEY
=
328d2edfe42fa
RELEASE_SHARESDK_SECRET
=
3586272d2ddd7d9de497cdede529ced3
#友盟
RELEASE_UMENG_KEY
=
604869326ee47d382b7ae112
#JPush
RELEASE_JPUSH_KEY
=
35f3e95b2d3f0b63ca5a4a0e
android.useAndroidX
=
true
android.enableJetifier
=
true
\ No newline at end of file
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