Added onSaveInstanceState breadcrumbs

pull/156/head
M66B 6 years ago
parent 922dc619cd
commit ca5c503ee8

@ -37,9 +37,14 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.bugsnag.android.BreadcrumbType;
import com.bugsnag.android.Bugsnag;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener { abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
private boolean contacts; private boolean contacts;
@ -80,6 +85,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
int after = Helper.getSize(outState); int after = Helper.getSize(outState);
Log.i("Saved instance " + this + " size=" + before + "/" + after); Log.i("Saved instance " + this + " size=" + before + "/" + after);
Map<String, String> crumb = new HashMap<>();
crumb.put("name", this.getClass().getName());
crumb.put("before", Integer.toString(before));
crumb.put("after", Integer.toString(after));
Bugsnag.leaveBreadcrumb("onSaveInstanceState", BreadcrumbType.STATE, crumb);
for (String key : outState.keySet()) for (String key : outState.keySet())
Log.i("Saved " + this + " " + key + "=" + outState.get(key)); Log.i("Saved " + this + " " + key + "=" + outState.get(key));
} }

@ -32,6 +32,12 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import com.bugsnag.android.BreadcrumbType;
import com.bugsnag.android.Bugsnag;
import java.util.HashMap;
import java.util.Map;
public class FragmentBase extends Fragment { public class FragmentBase extends Fragment {
private String subtitle = " "; private String subtitle = " ";
private boolean finish = false; private boolean finish = false;
@ -60,6 +66,13 @@ public class FragmentBase extends Fragment {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
int after = Helper.getSize(outState); int after = Helper.getSize(outState);
Log.i("Saved instance " + this + " size=" + before + "/" + after); Log.i("Saved instance " + this + " size=" + before + "/" + after);
Map<String, String> crumb = new HashMap<>();
crumb.put("name", this.getClass().getName());
crumb.put("before", Integer.toString(before));
crumb.put("after", Integer.toString(after));
Bugsnag.leaveBreadcrumb("onSaveInstanceState", BreadcrumbType.STATE, crumb);
for (String key : outState.keySet()) for (String key : outState.keySet())
Log.i("Saved " + this + " " + key + "=" + outState.get(key)); Log.i("Saved " + this + " " + key + "=" + outState.get(key));
} }

Loading…
Cancel
Save