提交 3310387f 编写于 作者: F fancy

检查更新,用户可手动关闭

上级 acae5229
......@@ -19,6 +19,7 @@ import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.o2.webview.O2WebViewActivity
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.core.service.DownloadAPKService
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.model.bo.O2AppUpdateBean
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.*
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.extension.edit
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.extension.gone
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils.extension.visible
import net.zoneland.x.bpm.mobile.v1.zoneXBPM.widgets.dialog.O2AlertIconEnum
......@@ -56,14 +57,22 @@ class AboutActivity : AppCompatActivity() {
BitmapUtil.setImageFromFile(path!!, image_about_logo)
}
if (BuildConfig.NEED_UPDATE) {
ll_about_check_version.visible()
relative_about_check_version.visible()
relative_about_check_version.setOnClickListener {
checkAppUpdate()
}
val isOpen = O2SDKManager.instance().prefs().getBoolean(O2.PRE_APP_AUTO_CHECK_UPDATE_KEY, true)
switch_about_check_version.isChecked = isOpen
switch_about_check_version.setOnCheckedChangeListener { _, isChecked ->
O2SDKManager.instance().prefs().edit {
putBoolean(O2.PRE_APP_AUTO_CHECK_UPDATE_KEY, isChecked);
}
}
} else {
relative_about_check_version.gone()
ll_about_check_version.gone()
}
// if (AndroidUtils.isHuaweiChannel(this)) {
if (!BuildConfig.InnerServer) {
ll_about_user_secret.visible()
relative_about_secret.setOnClickListener {
O2WebViewActivity.openWebView(this@AboutActivity, getString(R.string.secret), "https://www.o2oa.net/secret.html")
......@@ -71,9 +80,7 @@ class AboutActivity : AppCompatActivity() {
relative_about_user_service.setOnClickListener {
O2WebViewActivity.openWebView(this@AboutActivity, getString(R.string.user_service), "https://www.o2oa.net/userService.html")
}
// } else {
// ll_about_user_secret.gone()
// }
}
}
......
......@@ -62,7 +62,13 @@ class LaunchActivity : BaseMVPActivity<LaunchContract.View, LaunchContract.Prese
NetworkConnectStatusReceiver { isConnected ->
Log.d("LaunchActivity", "网络连接情况变化,isConnected:$isConnected")
if (isConnected && mCheckNetwork == false){
checkAppUpdate()
val isOpen = O2SDKManager.instance().prefs().getBoolean(O2.PRE_APP_AUTO_CHECK_UPDATE_KEY, true)
// 用户自行开关检查
if (isOpen) {
checkAppUpdate()
} else {
launch()
}
}
}
}
......@@ -187,7 +193,13 @@ class LaunchActivity : BaseMVPActivity<LaunchContract.View, LaunchContract.Prese
// 是否检查更新
if (BuildConfig.NEED_UPDATE) {
Log.d("LaunchActivity","检查应用内更新")
checkAppUpdate()
val isOpen = O2SDKManager.instance().prefs().getBoolean(O2.PRE_APP_AUTO_CHECK_UPDATE_KEY, true)
// 用户自行开关检查
if (isOpen) {
checkAppUpdate()
} else {
launch()
}
} else {
Log.d("LaunchActivity","不需要应用内更新。。。。。。。")
launch()
......@@ -286,9 +298,12 @@ class LaunchActivity : BaseMVPActivity<LaunchContract.View, LaunchContract.Prese
private fun launch() {
// 应用市场上架需要同意协议
// if (AndroidUtils.isHuaweiChannel(this)) {
val isAgree = O2SDKManager.instance().prefs().getBoolean(O2.PRE_APP_PRIVACY_AGREE_KEY, false)
// 自主打包的 不显示
if (BuildConfig.InnerServer){
trueLaunch()
} else {
val isAgree =
O2SDKManager.instance().prefs().getBoolean(O2.PRE_APP_PRIVACY_AGREE_KEY, false)
if (!isAgree) {
val pd = PrivacyDialogFragment()
pd.setOnClickBtnListener(object : PrivacyDialogFragment.OnClickBtnListener {
......@@ -305,12 +320,8 @@ class LaunchActivity : BaseMVPActivity<LaunchContract.View, LaunchContract.Prese
} else {
trueLaunch()
}
// } else {
// O2SDKManager.instance().prefs().edit {
// putBoolean(O2.PRE_APP_PRIVACY_AGREE_KEY, true)
// }
// trueLaunch()
// }
}
}
private fun trueLaunch() {
......
......@@ -28,7 +28,6 @@ class FileReaderActivity : BaseO2BindActivity() {
private val viewModel: FileReaderViewModel by lazy { ViewModelProviders.of(this).get(FileReaderViewModel::class.java) }
// private var mTbsReaderView: TbsReaderView?=null
private var wordReadView: WordReadView? = null
......@@ -51,25 +50,26 @@ class FileReaderActivity : BaseO2BindActivity() {
override fun afterSetContentView(savedInstanceState: Bundle?) {
setupToolBar(getString(R.string.file_preview), true)
filePath = intent.extras?.getString(file_reader_file_path_key) ?: ""
XLog.info("打开文件 :$filePath")
if (TextUtils.isEmpty(filePath)) {
XToast.toastShort(this, "文件路径为空!")
finish()
return
}
if(WordReadHelper.initFinish()){
wordReadView = WordReadView(this)
wordReadView?.setFileListener { filePath ->
cannotOpenFile(filePath)
}
// mTbsReaderView = TbsReaderView(this) { arg, arg1, arg2 ->
// XLog.info("arg:$arg, 1:$arg1, 2:$arg2")
// }
fl_file_reader_container.addView(wordReadView, FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT))
filePath = intent.extras?.getString(file_reader_file_path_key) ?: ""
XLog.info("打开文件 :$filePath")
if (!TextUtils.isEmpty(filePath)) {
openFileWithTBS(filePath)
}
openFileWithTBS(filePath)
} else {
O2DialogSupport.openAlertDialog(this, "文件预览器内核还在加载中,请稍后再试!", {
finish()
O2DialogSupport.openConfirmDialog(this, "文件预览器内核未下载完成,使用其它应用打开文件?", { _ ->
val f = File(filePath)
AndroidUtils.openFileWithDefaultApp(this@FileReaderActivity, f)
finish()
})
// XToast.toastShort(this, "文件预览器内核还在加载中,请稍后再试!")
}
}
......@@ -89,43 +89,17 @@ class FileReaderActivity : BaseO2BindActivity() {
override fun onDestroy() {
wordReadView?.destroy()
// mTbsReaderView?.onStop()
super.onDestroy()
}
private fun share() {
val file = File(filePath)
AndroidUtils.shareFile(this, file)
}
private fun openFileWithTBS(file: String) {
XLog.info("打开文件:$file")
wordReadView?.loadFile(file)
// val type = getFileType(file)
// val b = mTbsReaderView?.preOpen(type, false)
// if (b == true) {
// val bund = Bundle()
// bund.putString(TbsReaderView.KEY_FILE_PATH, file)
// bund.putString(TbsReaderView.KEY_TEMP_PATH, FileExtensionHelper.getXBPMTempFolder(this))
// mTbsReaderView?.openFile(bund)
// }else {
// XLog.error("type is error , $type")
// XToast.toastShort(this, getString(R.string.message_file_type_cannot_be_previewed))
// fl_file_reader_container.removeAllViews()
// val btn = Button(this)
// btn.text = getString(R.string.message_use_other_application_open_file)
// val param = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
// param.gravity = Gravity.CENTER
// fl_file_reader_container.addView(btn, param)
// btn.setOnClickListener {
// val f = File(file)
// AndroidUtils.openFileWithDefaultApp(this, f)
// finish()
// }
// }
}
private fun cannotOpenFile(filePath: String) {
......
......@@ -44,13 +44,35 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_large"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/spacing_normal"
android:background="@drawable/white_background_selector">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="自动检查更新"
android:textSize="@dimen/font_normal"
android:textColor="@color/z_color_text_primary_dark"/>
<Switch
android:id="@+id/switch_about_check_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<!--检查更新-->
<RelativeLayout
android:id="@+id/relative_about_check_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:padding="@dimen/spacing_normal"
android:background="@drawable/white_background_selector">
<TextView
......@@ -77,7 +99,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_large"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/relative_about_user_service"
......@@ -104,6 +125,7 @@
android:id="@+id/relative_about_secret"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:padding="@dimen/spacing_normal"
android:background="@drawable/white_background_selector">
<TextView
......
......@@ -158,6 +158,8 @@ object O2 {
val PRE_APP_PRIVACY_AGREE_KEY = "PRE_APP_PRIVACY_AGREE_KEY" // 是否同意隐私政策
val PRE_APP_AUTO_CHECK_UPDATE_KEY = "PRE_APP_AUTO_CHECK_UPDATE_KEY" // 是否自动检查更新
val BUSINESS_TYPE_MESSAGE_CENTER = 0//信息中心
val BUSINESS_TYPE_WORK_CENTER = 1//工作中心
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册