Rename callbackevents to topic/subscribers

This commit is contained in:
topjohnwu
2017-08-04 00:12:11 +08:00
parent 2ecbca303b
commit 8e7b8825f5
16 changed files with 137 additions and 137 deletions
@@ -8,7 +8,7 @@ import android.view.WindowManager;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.CallbackEvent;
import com.topjohnwu.magisk.utils.Topic;
public class Activity extends AppCompatActivity {
@@ -22,15 +22,15 @@ public class Activity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (this instanceof CallbackEvent.Listener) {
((CallbackEvent.Listener) this).registerEvents();
if (this instanceof Topic.Subscriber) {
((Topic.Subscriber) this).subscribeTopics();
}
}
@Override
protected void onDestroy() {
if (this instanceof CallbackEvent.Listener) {
((CallbackEvent.Listener) this).unregisterEvents();
if (this instanceof Topic.Subscriber) {
((Topic.Subscriber) this).unsubscribeTopics();
}
super.onDestroy();
}
@@ -1,7 +1,7 @@
package com.topjohnwu.magisk.components;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.utils.CallbackEvent;
import com.topjohnwu.magisk.utils.Topic;
import com.topjohnwu.magisk.utils.Utils;
public class Fragment extends android.support.v4.app.Fragment {
@@ -13,15 +13,15 @@ public class Fragment extends android.support.v4.app.Fragment {
@Override
public void onResume() {
super.onResume();
if (this instanceof CallbackEvent.Listener) {
((CallbackEvent.Listener) this).registerEvents();
if (this instanceof Topic.Subscriber) {
((Topic.Subscriber) this).subscribeTopics();
}
}
@Override
public void onPause() {
if (this instanceof CallbackEvent.Listener) {
((CallbackEvent.Listener) this).unregisterEvents();
if (this instanceof Topic.Subscriber) {
((Topic.Subscriber) this).unsubscribeTopics();
}
super.onPause();
}