mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Log activity/fragment life cycle
This commit is contained in:
parent
3826ca76d5
commit
42a4de8931
3 changed files with 53 additions and 6 deletions
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -37,6 +38,24 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
Log.i(Helper.TAG, "Resume " + this.getClass().getName());
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
Log.i(Helper.TAG, "Pause " + this.getClass().getName());
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
Log.i(Helper.TAG, "Config " + this.getClass().getName());
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
Log.i(Helper.TAG, "Destroy " + this.getClass().getName());
|
Log.i(Helper.TAG, "Destroy " + this.getClass().getName());
|
||||||
|
|
|
@ -92,7 +92,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.i(Helper.TAG, "View create");
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_view);
|
setContentView(R.layout.activity_view);
|
||||||
|
@ -256,7 +255,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
Log.i(Helper.TAG, "View post create");
|
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
drawerToggle.syncState();
|
drawerToggle.syncState();
|
||||||
}
|
}
|
||||||
|
@ -270,7 +268,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
Log.i(Helper.TAG, "View resume");
|
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||||
|
@ -288,7 +285,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.i(Helper.TAG, "View pause");
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||||
lbm.unregisterReceiver(receiver);
|
lbm.unregisterReceiver(receiver);
|
||||||
|
@ -296,14 +292,12 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
Log.i(Helper.TAG, "View configuration changed");
|
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
drawerToggle.onConfigurationChanged(newConfig);
|
drawerToggle.onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
Log.i(Helper.TAG, "View destroyed");
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.faircode.email;
|
package eu.faircode.email;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
@ -19,12 +22,31 @@ public class FragmentEx extends Fragment {
|
||||||
updateSubtitle();
|
updateSubtitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
Log.i(Helper.TAG, "Create " + this.getClass().getName());
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
Log.i(Helper.TAG, "Activity " + this.getClass().getName());
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
Log.i(Helper.TAG, "Resume " + this.getClass().getName());
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateSubtitle();
|
updateSubtitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
Log.i(Helper.TAG, "Pause " + this.getClass().getName());
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetach() {
|
public void onDetach() {
|
||||||
super.onDetach();
|
super.onDetach();
|
||||||
|
@ -35,6 +57,18 @@ public class FragmentEx extends Fragment {
|
||||||
im.hideSoftInputFromWindow(focused.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
im.hideSoftInputFromWindow(focused.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
Log.i(Helper.TAG, "Config " + this.getClass().getName());
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
Log.i(Helper.TAG, "Destroy " + this.getClass().getName());
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSubtitle() {
|
private void updateSubtitle() {
|
||||||
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
|
Loading…
Reference in a new issue