mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 21:45:27 +00:00
Unbind Butterknife-injected views in fragment's onDestroyView()
This commit is contained in:
parent
e81bc4f044
commit
a718f9bbfd
@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class InstallFragment extends Fragment implements CallbackHandler.EventListener {
|
public class InstallFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
public static List<String> blockList;
|
public static List<String> blockList;
|
||||||
public static String bootBlock = null;
|
public static String bootBlock = null;
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.current_version_title) TextView currentVersionTitle;
|
@BindView(R.id.current_version_title) TextView currentVersionTitle;
|
||||||
@BindView(R.id.install_title) TextView installTitle;
|
@BindView(R.id.install_title) TextView installTitle;
|
||||||
@BindView(R.id.block_spinner) Spinner spinner;
|
@BindView(R.id.block_spinner) Spinner spinner;
|
||||||
@ -44,7 +46,7 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View v = inflater.inflate(R.layout.install_fragment, container, false);
|
View v = inflater.inflate(R.layout.install_fragment, container, false);
|
||||||
ButterKnife.bind(this, v);
|
unbinder = ButterKnife.bind(this, v);
|
||||||
detectButton.setOnClickListener(v1 -> toAutoDetect());
|
detectButton.setOnClickListener(v1 -> toAutoDetect());
|
||||||
currentVersionTitle.setText(getString(R.string.current_magisk_title, StatusFragment.magiskVersionString));
|
currentVersionTitle.setText(getString(R.string.current_magisk_title, StatusFragment.magiskVersionString));
|
||||||
installTitle.setText(getString(R.string.install_magisk_title, StatusFragment.remoteMagiskVersion));
|
installTitle.setText(getString(R.string.install_magisk_title, StatusFragment.remoteMagiskVersion));
|
||||||
@ -109,4 +111,10 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
CallbackHandler.unRegister(blockDetectionDone, this);
|
CallbackHandler.unRegister(blockDetectionDone, this);
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class LogFragment extends Fragment {
|
public class LogFragment extends Fragment {
|
||||||
|
|
||||||
private static final String MAGISK_LOG = "/cache/magisk.log";
|
private static final String MAGISK_LOG = "/cache/magisk.log";
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.txtLog) TextView txtLog;
|
@BindView(R.id.txtLog) TextView txtLog;
|
||||||
@BindView(R.id.svLog) ScrollView svLog;
|
@BindView(R.id.svLog) ScrollView svLog;
|
||||||
@BindView(R.id.hsvLog) HorizontalScrollView hsvLog;
|
@BindView(R.id.hsvLog) HorizontalScrollView hsvLog;
|
||||||
@ -61,7 +63,7 @@ public class LogFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.log_fragment, container, false);
|
View view = inflater.inflate(R.layout.log_fragment, container, false);
|
||||||
ButterKnife.bind(this, view);
|
unbinder = ButterKnife.bind(this, view);
|
||||||
|
|
||||||
txtLog.setTextIsSelectable(true);
|
txtLog.setTextIsSelectable(true);
|
||||||
|
|
||||||
@ -82,6 +84,12 @@ public class LogFragment extends Fragment {
|
|||||||
new LogManager().read();
|
new LogManager().read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.menu_log, menu);
|
inflater.inflate(R.menu.menu_log, menu);
|
||||||
|
@ -25,9 +25,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class MagiskHideFragment extends Fragment implements CallbackHandler.EventListener {
|
public class MagiskHideFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ public class MagiskHideFragment extends Fragment implements CallbackHandler.Even
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.magisk_hide_fragment, container, false);
|
View view = inflater.inflate(R.layout.magisk_hide_fragment, container, false);
|
||||||
ButterKnife.bind(this, view);
|
unbinder = ButterKnife.bind(this, view);
|
||||||
|
|
||||||
PackageManager packageManager = getActivity().getPackageManager();
|
PackageManager packageManager = getActivity().getPackageManager();
|
||||||
|
|
||||||
@ -108,6 +110,12 @@ public class MagiskHideFragment extends Fragment implements CallbackHandler.Even
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrigger(CallbackHandler.Event event) {
|
public void onTrigger(CallbackHandler.Event event) {
|
||||||
Logger.dev("MagiskHideFragment: UI refresh");
|
Logger.dev("MagiskHideFragment: UI refresh");
|
||||||
|
@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class ModulesFragment extends Fragment implements CallbackHandler.EventListener {
|
public class ModulesFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ public class ModulesFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
|
|
||||||
private static final int FETCH_ZIP_CODE = 2;
|
private static final int FETCH_ZIP_CODE = 2;
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.empty_rv) TextView emptyTv;
|
@BindView(R.id.empty_rv) TextView emptyTv;
|
||||||
@ -44,7 +46,7 @@ public class ModulesFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.modules_fragment, container, false);
|
View view = inflater.inflate(R.layout.modules_fragment, container, false);
|
||||||
ButterKnife.bind(this, view);
|
unbinder = ButterKnife.bind(this, view);
|
||||||
|
|
||||||
fabio.setOnClickListener(v -> {
|
fabio.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
@ -105,6 +107,12 @@ public class ModulesFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateUI() {
|
private void updateUI() {
|
||||||
ModuleHelper.getModuleList(listModules);
|
ModuleHelper.getModuleList(listModules);
|
||||||
if (listModules.size() == 0) {
|
if (listModules.size() == 0) {
|
||||||
|
@ -27,11 +27,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class ReposFragment extends Fragment implements CallbackHandler.EventListener {
|
public class ReposFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
public static final CallbackHandler.Event repoLoadDone = new CallbackHandler.Event();
|
public static final CallbackHandler.Event repoLoadDone = new CallbackHandler.Event();
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.empty_rv) TextView emptyTv;
|
@BindView(R.id.empty_rv) TextView emptyTv;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@ -57,8 +59,7 @@ public class ReposFragment extends Fragment implements CallbackHandler.EventList
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.repos_fragment, container, false);
|
View view = inflater.inflate(R.layout.repos_fragment, container, false);
|
||||||
|
unbinder = ButterKnife.bind(this, view);
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
|
|
||||||
mSectionedAdapter = new
|
mSectionedAdapter = new
|
||||||
SimpleSectionedRecyclerViewAdapter(getActivity(), R.layout.section,
|
SimpleSectionedRecyclerViewAdapter(getActivity(), R.layout.section,
|
||||||
@ -121,6 +122,12 @@ public class ReposFragment extends Fragment implements CallbackHandler.EventList
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
private void reloadRepos() {
|
private void reloadRepos() {
|
||||||
ModuleHelper.getRepoLists(mUpdateRepos, mInstalledRepos, mOthersRepos);
|
ModuleHelper.getRepoLists(mUpdateRepos, mInstalledRepos, mOthersRepos);
|
||||||
fUpdateRepos.clear();
|
fUpdateRepos.clear();
|
||||||
|
@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
import butterknife.BindColor;
|
import butterknife.BindColor;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.Unbinder;
|
||||||
|
|
||||||
public class StatusFragment extends Fragment implements CallbackHandler.EventListener {
|
public class StatusFragment extends Fragment implements CallbackHandler.EventListener {
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
|
|||||||
public static final CallbackHandler.Event updateCheckDone = new CallbackHandler.Event();
|
public static final CallbackHandler.Event updateCheckDone = new CallbackHandler.Event();
|
||||||
public static final CallbackHandler.Event safetyNetDone = new CallbackHandler.Event();
|
public static final CallbackHandler.Event safetyNetDone = new CallbackHandler.Event();
|
||||||
|
|
||||||
|
private Unbinder unbinder;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
|
||||||
@BindView(R.id.magisk_status_container) View magiskStatusContainer;
|
@BindView(R.id.magisk_status_container) View magiskStatusContainer;
|
||||||
@ -74,7 +76,7 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View v = inflater.inflate(R.layout.status_fragment, container, false);
|
View v = inflater.inflate(R.layout.status_fragment, container, false);
|
||||||
ButterKnife.bind(this, v);
|
unbinder = ButterKnife.bind(this, v);
|
||||||
|
|
||||||
defaultColor = magiskUpdateText.getCurrentTextColor();
|
defaultColor = magiskUpdateText.getCurrentTextColor();
|
||||||
|
|
||||||
@ -161,6 +163,12 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
unbinder.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
private static void checkMagiskInfo() {
|
private static void checkMagiskInfo() {
|
||||||
List<String> ret = Shell.sh("getprop magisk.version");
|
List<String> ret = Shell.sh("getprop magisk.version");
|
||||||
if (ret.get(0).length() == 0) {
|
if (ret.get(0).length() == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user