File tree Expand file tree Collapse file tree 5 files changed +27
-7
lines changed
app/src/main/java/com/brian/csdnblog Expand file tree Collapse file tree 5 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 44import android .app .Application ;
55import android .content .Context ;
66import android .content .Intent ;
7+ import android .os .StrictMode ;
78
89import com .brian .csdnblog .activity .MainTabActivity ;
910import com .brian .csdnblog .manager .BrianUncaughtExceptionHandler ;
@@ -38,6 +39,7 @@ public void onCreate() {
3839// MobclickAgent.setCatchUncaughtExceptions(true);
3940 }
4041 PushManager .getInstance ().initPushMsg (this );
42+ setStrictModeEnable (Config .isDebug );
4143 }
4244 }
4345
@@ -64,6 +66,24 @@ protected void attachBaseContext(Context base) {
6466 super .attachBaseContext (base );
6567 }
6668
69+ private void setStrictModeEnable (boolean enable ) {
70+ if (!enable ) {
71+ return ;
72+ }
73+ StrictMode .setThreadPolicy (new StrictMode .ThreadPolicy .Builder ()
74+ .detectDiskReads ()
75+ .detectDiskWrites ()
76+ .detectNetwork ()
77+ .penaltyLog ()
78+ .build ());
79+
80+ StrictMode .setVmPolicy (new StrictMode .VmPolicy .Builder ()
81+ .detectLeakedSqlLiteObjects ()
82+ .penaltyLog ()
83+ .penaltyDeath ()
84+ .build ());
85+ }
86+
6787 public void exit () {
6888 MobclickAgent .onKillProcess (getApplicationContext ());
6989 System .exit (0 );
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ public void onClick(View v) {
129129 Bloger bloger = Bloger .fromJson (item .blogerJson );
130130 if (bloger != null ) {
131131 BlogerBlogListActivity .startActivity (getActivity (), mType , bloger );
132+ UsageStatsManager .sendUsageData (UsageStatsManager .USAGE_BLOGER_ENTR , "bloglist" );
132133 }
133134 }
134135 }
Original file line number Diff line number Diff line change @@ -83,16 +83,13 @@ private void createShortCut() {
8383
8484 /**
8585 * 通过当前的版本号与preference记录的版本号进行比对
86- *
87- * @return
8886 */
8987 private boolean isFirstLaunch () {
90- boolean isFirstLaunch = true ;
9188 int versionCode = CommonPreference .getInstance ().getVersionCode ();
92-
9389 LogUtil .i (TAG , "version_code=" + versionCode );
9490
95- if (versionCode < UIUtil .getVersionCode (SplashActivity .this )) {
91+ boolean isFirstLaunch ;
92+ if (versionCode < UIUtil .getVersionCode (getApplication ())) {
9693 isFirstLaunch = true ;
9794 } else {
9895 isFirstLaunch = false ;
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ public static String getBlogName(int type) {
126126 break ;
127127 case TypeManager .TYPE_WEB_OTHER :
128128 default :
129- name = "OTHER" ;
129+ name = "OTHER" + webType ;
130130 break ;
131131 }
132132
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ public class UsageStatsManager {
2525 public static final String USAGE_MAIN_TAB = "main_tab" ;
2626 public static final String USAGE_BLOG_COUNT = "blog_count" ;
2727 public static final String USAGE_FAVO = "blog_favo" ;
28-
28+
29+ public static final String USAGE_BLOGER_ENTR = "bloger_entrance" ;
30+
2931 public static final String MENU_LIST = "menu_list" ;
3032 public static final String USAGE_SEARCH = "search" ;
3133 public static final String USAGE_FEEDBACK = "feedback" ;
You can’t perform that action at this time.
0 commit comments