forked from codeestX/GeekNews
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
137 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
app/src/main/java/com/codeest/geeknews/component/InitializeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.codeest.geeknews.component; | ||
|
||
import android.app.IntentService; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
import com.codeest.geeknews.app.App; | ||
import com.codeest.geeknews.app.Constants; | ||
import com.codeest.geeknews.util.SystemUtil; | ||
import com.codeest.geeknews.widget.AppBlockCanaryContext; | ||
import com.github.moduth.blockcanary.BlockCanary; | ||
import com.orhanobut.logger.Logger; | ||
import com.squareup.leakcanary.LeakCanary; | ||
import com.tencent.bugly.crashreport.CrashReport; | ||
import com.tencent.smtt.sdk.QbSdk; | ||
|
||
import static com.codeest.geeknews.util.LogUtil.isDebug; | ||
|
||
/** | ||
* Created by codeest on 2017/2/12. | ||
*/ | ||
|
||
public class InitializeService extends IntentService { | ||
|
||
private static final String ACTION_INIT = "initApplication"; | ||
|
||
public InitializeService() { | ||
super("InitializeService"); | ||
} | ||
|
||
public static void start(Context context) { | ||
Intent intent = new Intent(context, InitializeService.class); | ||
intent.setAction(ACTION_INIT); | ||
context.startService(intent); | ||
} | ||
|
||
@Override | ||
protected void onHandleIntent(Intent intent) { | ||
if (intent != null) { | ||
final String action = intent.getAction(); | ||
if (ACTION_INIT.equals(action)) { | ||
initApplication(); | ||
} | ||
} | ||
} | ||
|
||
private void initApplication() { | ||
//初始化日志 | ||
Logger.init(getPackageName()).hideThreadInfo(); | ||
|
||
//初始化错误收集 | ||
// CrashHandler.init(new CrashHandler(getApplicationContext())); | ||
initBugly(); | ||
|
||
//初始化内存泄漏检测 | ||
LeakCanary.install(App.getInstance()); | ||
|
||
//初始化过度绘制检测 | ||
BlockCanary.install(getApplicationContext(), new AppBlockCanaryContext()).start(); | ||
|
||
//初始化tbs x5 webview | ||
QbSdk.allowThirdPartyAppDownload(true); | ||
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() { | ||
@Override | ||
public void onCoreInitFinished() { | ||
} | ||
|
||
@Override | ||
public void onViewInitFinished(boolean b) { | ||
} | ||
}); | ||
} | ||
|
||
private void initBugly() { | ||
Context context = getApplicationContext(); | ||
String packageName = context.getPackageName(); | ||
String processName = SystemUtil.getProcessName(android.os.Process.myPid()); | ||
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context); | ||
strategy.setUploadProcess(processName == null || processName.equals(packageName)); | ||
CrashReport.initCrashReport(context, Constants.BUGLY_ID, isDebug, strategy); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/geeknews/model/bean/NightModeEvent.java → .../geeknews/model/event/NightModeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eest/geeknews/model/bean/SearchEvent.java → ...est/geeknews/model/event/SearchEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...codeest/geeknews/model/http/GankApis.java → ...est/geeknews/model/http/api/GankApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...m/codeest/geeknews/model/http/MyApis.java → ...deest/geeknews/model/http/api/MyApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...codeest/geeknews/model/http/VtexApis.java → ...est/geeknews/model/http/api/VtexApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...deest/geeknews/model/http/WeChatApis.java → ...t/geeknews/model/http/api/WeChatApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...odeest/geeknews/model/http/ZhihuApis.java → ...st/geeknews/model/http/api/ZhihuApis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...est/geeknews/model/http/ApiException.java → ...ws/model/http/exception/ApiException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...geeknews/model/http/GankHttpResponse.java → ...model/http/response/GankHttpResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...geeknews/model/http/GoldHttpResponse.java → ...model/http/response/GoldHttpResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/geeknews/model/http/MyHttpResponse.java → ...s/model/http/response/MyHttpResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/geeknews/model/http/WXHttpResponse.java → ...s/model/http/response/WXHttpResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.