Enable cleaning for Play store version

pull/206/head
M66B 3 years ago
parent aa4f0dde94
commit 6995682610

@ -766,20 +766,19 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override @Override
public void onFragmentDestroyed(@NonNull FragmentManager fm, @NonNull Fragment f) { public void onFragmentDestroyed(@NonNull FragmentManager fm, @NonNull Fragment f) {
log(fm, f, "onFragmentDestroyed"); log(fm, f, "onFragmentDestroyed");
if (!BuildConfig.PLAY_STORE_RELEASE) try {
try { for (Field field : f.getClass().getDeclaredFields()) {
for (Field field : f.getClass().getDeclaredFields()) { Class<?> type = field.getType();
Class<?> type = field.getType(); if (View.class.isAssignableFrom(type) ||
if (View.class.isAssignableFrom(type) || RecyclerView.Adapter.class.isAssignableFrom(type)) {
RecyclerView.Adapter.class.isAssignableFrom(type)) { Log.i("Clearing " + f.getClass().getSimpleName() + ":" + field.getName());
Log.i("Clearing " + f.getClass().getSimpleName() + ":" + field.getName()); field.setAccessible(true);
field.setAccessible(true); field.set(f, null);
field.set(f, null);
}
} }
} catch (Throwable ex) {
Log.w(ex);
} }
} catch (Throwable ex) {
Log.w(ex);
}
} }
@Override @Override

Loading…
Cancel
Save