diff --git a/app/app.iml b/app/app.iml
index 7f0efb4..dc954d6 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -65,14 +65,6 @@
-
-
-
-
-
-
-
-
@@ -81,9 +73,16 @@
+
+
+
+
+
+
+
+
-
@@ -107,7 +106,8 @@
-
+
+
@@ -140,8 +140,9 @@
+
-
+
diff --git a/app/build.gradle b/app/build.gradle
index 44bd2f4..7c6e523 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -43,6 +43,7 @@ android {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
+
}
retrolambda {
@@ -72,7 +73,8 @@ dependencies {
compile 'com.jakewharton:butterknife:7.0.1'
compile 'jp.wasabeef:recyclerview-animators:2.2.3'
- compile 'com.tencent.bugly:crashreport:latest.release'
+ compile 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.1.5
+ compile 'com.tencent.bugly:nativecrashreport:latest.release' //其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.2.0
debugCompile 'com.github.moduth:blockcanary-android:1.2.1'
releaseCompile 'com.github.moduth:blockcanary-no-op:1.2.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1f8b3ad..521f3c6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -65,6 +65,8 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme.transpant"/>
+
+
diff --git a/app/src/main/java/com/xiecc/seeWeather/base/BaseActivity.java b/app/src/main/java/com/xiecc/seeWeather/base/BaseActivity.java
index 8e0103c..0ec6cf5 100644
--- a/app/src/main/java/com/xiecc/seeWeather/base/BaseActivity.java
+++ b/app/src/main/java/com/xiecc/seeWeather/base/BaseActivity.java
@@ -10,6 +10,7 @@ import android.view.WindowManager;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.xiecc.seeWeather.common.ACache;
import com.xiecc.seeWeather.modules.setting.Setting;
+import rx.subscriptions.CompositeSubscription;
/**
* Created by hugo on 2015/12/16.
@@ -19,6 +20,8 @@ public class BaseActivity extends AppCompatActivity {
public ACache aCache;
public Setting mSetting = null;
+ protected CompositeSubscription compositeSubscription = new CompositeSubscription();
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -80,4 +83,16 @@ public class BaseActivity extends AppCompatActivity {
public void showSnackbar(View view, String s, boolean ture) {
Snackbar.make(view, s, Snackbar.LENGTH_LONG).show();
}
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ //compositeSubscription.clear();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ compositeSubscription.clear();
+ }
}
diff --git a/app/src/main/java/com/xiecc/seeWeather/base/BaseApplication.java b/app/src/main/java/com/xiecc/seeWeather/base/BaseApplication.java
index 515133b..b59dd3f 100644
--- a/app/src/main/java/com/xiecc/seeWeather/base/BaseApplication.java
+++ b/app/src/main/java/com/xiecc/seeWeather/base/BaseApplication.java
@@ -24,12 +24,11 @@ public class BaseApplication extends Application {
// 初始化 retrofit
RetrofitSingleton.init();
CrashHandler.init(new CrashHandler(getApplicationContext()));
- CrashReport.initCrashReport(getApplicationContext(), "900030389", false);
+ CrashReport.initCrashReport(getApplicationContext(), "900028220", false);
BlockCanary.install(this, new AppBlockCanaryContext()).start();
LeakCanary.install(this);
RxUtils.unifiedErrorHandler();
//Thread.setDefaultUncaughtExceptionHandler(new MyUnCaughtExceptionHandler());
-
/**
* 如果存在SD卡则将缓存写入SD卡,否则写入手机内存
*/
diff --git a/app/src/main/java/com/xiecc/seeWeather/base/RxBus.java b/app/src/main/java/com/xiecc/seeWeather/base/RxBus.java
new file mode 100644
index 0000000..1a8b7b5
--- /dev/null
+++ b/app/src/main/java/com/xiecc/seeWeather/base/RxBus.java
@@ -0,0 +1,51 @@
+package com.xiecc.seeWeather.base;
+
+import rx.Observable;
+import rx.subjects.PublishSubject;
+import rx.subjects.SerializedSubject;
+import rx.subjects.Subject;
+
+/**
+ * RxBus
+ * Created by YoKeyword on 2015/6/17.
+ */
+public class RxBus {
+
+ private static volatile RxBus instance;
+ // 主题
+ private final Subject bus;
+
+ // PublishSubject只会把在订阅发生的时间点之后来自原始Observable的数据发射给观察者
+ public RxBus() {
+ bus = new SerializedSubject<>(PublishSubject.create());
+ }
+
+ // 单例RxBus
+ public static RxBus getDefault() {
+ if (instance == null) {
+ synchronized (RxBus.class) {
+ if (instance == null) {
+ instance = new RxBus();
+ }
+ }
+ }
+ return instance;
+ }
+
+ // 提供了一个新的事件
+ public void post(Object o) {
+ bus.onNext(o);
+ }
+
+ // 根据传递的 eventType 类型返回特定类型(eventType)的 被观察者
+ public Observable toObserverable(Class eventType) {
+ return bus.ofType(eventType);
+ // 这里感谢小鄧子的提醒: ofType = filter + cast
+ // return bus.filter(new Func1