You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Update CallbackEvents
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
package com.topjohnwu.magisk.components;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
import java.util.Locale;
|
||||
import com.topjohnwu.magisk.utils.CallbackEvent;
|
||||
|
||||
public class Activity extends AppCompatActivity {
|
||||
|
||||
@@ -19,6 +19,22 @@ public class Activity extends AppCompatActivity {
|
||||
applyOverrideConfiguration(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (this instanceof CallbackEvent.Listener) {
|
||||
((CallbackEvent.Listener) this).registerEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (this instanceof CallbackEvent.Listener) {
|
||||
((CallbackEvent.Listener) this).unregisterEvents();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagiskManager getApplicationContext() {
|
||||
return (MagiskManager) super.getApplicationContext();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.topjohnwu.magisk.components;
|
||||
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.utils.CallbackEvent;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
public class Fragment extends android.support.v4.app.Fragment {
|
||||
@@ -9,4 +10,19 @@ public class Fragment extends android.support.v4.app.Fragment {
|
||||
return Utils.getMagiskManager(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (this instanceof CallbackEvent.Listener) {
|
||||
((CallbackEvent.Listener) this).registerEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (this instanceof CallbackEvent.Listener) {
|
||||
((CallbackEvent.Listener) this).unregisterEvents();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user