mirror of
https://github.com/leanote/leanote-android.git
synced 2025-10-16 15:28:38 +00:00
add auto upgrade feature
This commit is contained in:
@@ -109,5 +109,6 @@ dependencies {
|
||||
compile 'com.github.houxg:FlexLayout:1.2'
|
||||
|
||||
compile 'net.danlew:android.joda:2.9.5'
|
||||
compile 'com.tencent.bugly:crashreport:2.4.0'
|
||||
compile group: 'com.tencent.bugly', name: 'crashreport_upgrade', version: '1.2.1'
|
||||
|
||||
}
|
||||
|
@@ -53,6 +53,10 @@
|
||||
android:label="NoteSyncService" />
|
||||
|
||||
<activity android:name=".ui.SearchActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.bugly.beta.ui.BetaActivity"
|
||||
android:theme="@android:style/Theme.Translucent" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -3,15 +3,18 @@ package org.houxg.leamonax;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.facebook.stetho.Stetho;
|
||||
import com.raizlabs.android.dbflow.config.FlowConfig;
|
||||
import com.raizlabs.android.dbflow.config.FlowManager;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
|
||||
import net.danlew.android.joda.JodaTimeAndroid;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.houxg.leamonax.ui.MainActivity;
|
||||
|
||||
public class Leamonax extends Application {
|
||||
|
||||
@@ -25,7 +28,8 @@ public class Leamonax extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mContext = this;
|
||||
CrashReport.initCrashReport(this, BuildConfig.BUGLY_KEY, BuildConfig.DEBUG);
|
||||
initBugly();
|
||||
|
||||
EventBus.builder()
|
||||
.logNoSubscriberMessages(false)
|
||||
.sendNoSubscriberEvent(false)
|
||||
@@ -35,4 +39,37 @@ public class Leamonax extends Application {
|
||||
Stetho.initializeWithDefaults(this);
|
||||
JodaTimeAndroid.init(this);
|
||||
}
|
||||
|
||||
private void initBugly() {
|
||||
Beta.canShowUpgradeActs.add(MainActivity.class);
|
||||
Beta.upgradeCheckPeriod = 60 * 1000; // 1 minute
|
||||
|
||||
Resources res = getResources();
|
||||
Beta.strToastYourAreTheLatestVersion =res.getString(R.string.your_are_the_latest_version);
|
||||
Beta.strToastCheckUpgradeError =res.getString(R.string.check_upgrade_error);
|
||||
Beta.strToastCheckingUpgrade =res.getString(R.string.checking_upgrade);
|
||||
Beta.strNotificationDownloading =res.getString(R.string.downloading);
|
||||
Beta.strNotificationClickToView =res.getString(R.string.click_to_view);
|
||||
Beta.strNotificationClickToInstall =res.getString(R.string.click_to_install);
|
||||
Beta.strNotificationClickToRetry =res.getString(R.string.click_to_retry);
|
||||
Beta.strNotificationClickToContinue =res.getString(R.string.continue_download);
|
||||
Beta.strNotificationDownloadSucc =res.getString(R.string.download_successful);
|
||||
Beta.strNotificationDownloadError =res.getString(R.string.download_error);
|
||||
Beta.strNotificationHaveNewVersion =res.getString(R.string.have_new_version);
|
||||
Beta.strNetworkTipsMessage =res.getString(R.string.should_continue_download);
|
||||
Beta.strNetworkTipsTitle =res.getString(R.string.network_prompt);
|
||||
Beta.strNetworkTipsConfirmBtn =res.getString(R.string.continue_download);
|
||||
Beta.strNetworkTipsCancelBtn =res.getString(R.string.cancel);
|
||||
Beta.strUpgradeDialogVersionLabel =res.getString(R.string.version);
|
||||
Beta.strUpgradeDialogFileSizeLabel =res.getString(R.string.file_size);
|
||||
Beta.strUpgradeDialogUpdateTimeLabel =res.getString(R.string.update_time);
|
||||
Beta.strUpgradeDialogFeatureLabel =res.getString(R.string.what_s_new);
|
||||
Beta.strUpgradeDialogUpgradeBtn =res.getString(R.string.upgrade_now);
|
||||
Beta.strUpgradeDialogInstallBtn =res.getString(R.string.install);
|
||||
Beta.strUpgradeDialogRetryBtn =res.getString(R.string.retry);
|
||||
Beta.strUpgradeDialogContinueBtn =res.getString(R.string.continue_text);
|
||||
Beta.strUpgradeDialogCancelBtn =res.getString(R.string.next_time);
|
||||
|
||||
Bugly.init(this, BuildConfig.BUGLY_KEY, BuildConfig.DEBUG);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package org.houxg.leamonax.ui;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
@@ -66,7 +66,7 @@
|
||||
<string name="thanks">致谢</string>
|
||||
<string name="time_yesterday">昨天 %s</string>
|
||||
<string name="title">标题</string>
|
||||
<string name="untitled"></string>
|
||||
<string name="untitled">未命名</string>
|
||||
<string name="use_custom_host">使用自定义服务器</string>
|
||||
<string name="use_leanote_host">使用Leanote.com</string>
|
||||
<string name="user_name">用户名</string>
|
||||
@@ -76,4 +76,25 @@
|
||||
<string name="feedback">反馈</string>
|
||||
<string name="sign_up">注册</string>
|
||||
<string name="note_not_found">找不到该笔记,请重试</string>
|
||||
<string name="your_are_the_latest_version">你已经是最新版了</string>
|
||||
<string name="check_upgrade_error">检查新版本失败,请稍后重试</string>
|
||||
<string name="checking_upgrade">正在检查,请稍候</string>
|
||||
<string name="downloading">正在下载</string>
|
||||
<string name="click_to_view">点击查看</string>
|
||||
<string name="click_to_install">点击安装</string>
|
||||
<string name="click_to_retry">点击重试</string>
|
||||
<string name="download_successful">下载完成</string>
|
||||
<string name="download_error">下载失败</string>
|
||||
<string name="have_new_version">有新版本</string>
|
||||
<string name="should_continue_download">你已切换到移动网络,是否继续当前下载?</string>
|
||||
<string name="network_prompt">网络提示</string>
|
||||
<string name="continue_download">继续下载</string>
|
||||
<string name="file_size">包大小</string>
|
||||
<string name="update_time">更新时间</string>
|
||||
<string name="what_s_new">更新说明</string>
|
||||
<string name="upgrade_now">立即更新</string>
|
||||
<string name="install">安装</string>
|
||||
<string name="retry">重试</string>
|
||||
<string name="continue_text">继续</string>
|
||||
<string name="next_time">下次再说</string>
|
||||
</resources>
|
@@ -75,4 +75,26 @@
|
||||
<string name="feedback">Feedback</string>
|
||||
<string name="sign_up">Sign up</string>
|
||||
<string name="note_not_found">Note not found, please try again</string>
|
||||
<string name="check_upgrade_error">An error occurs while checking latest version, please try again</string>
|
||||
<string name="checking_upgrade">Checking latest version, please wait</string>
|
||||
<string name="click_to_install">Click to install</string>
|
||||
<string name="click_to_retry">Click to retry</string>
|
||||
<string name="click_to_view">Click to view</string>
|
||||
<string name="continue_download">Continue download</string>
|
||||
<string name="continue_text">Continue</string>
|
||||
<string name="download_error">Download failed</string>
|
||||
<string name="download_successful">Dowload finished</string>
|
||||
<string name="downloading">Dowloading</string>
|
||||
<string name="what_s_new">What\'s new</string>
|
||||
<string name="file_size">File size</string>
|
||||
<string name="have_new_version">Have new version</string>
|
||||
<string name="install">Install</string>
|
||||
<string name="network_prompt">Network prompt</string>
|
||||
<string name="next_time">Next time</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="should_continue_download">You already switch to mobile network, would you like to continue download?</string>
|
||||
<string name="update_time">Update time</string>
|
||||
<string name="upgrade_now">Upgrade now</string>
|
||||
<string name="your_are_the_latest_version">You are using latest version</string>
|
||||
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user