Log when activities start and stop

Remove BriarRecyclerView log messages
This commit is contained in:
Torsten Grote
2018-10-22 11:46:14 -03:00
parent 389b2b5b8e
commit 5c28b60a6b
2 changed files with 10 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ import org.briarproject.briar.api.android.ScreenFilterMonitor.AppDetails;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
@@ -42,6 +43,8 @@ import static android.arch.lifecycle.Lifecycle.State.STARTED;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE; import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT; import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
import static java.util.logging.Level.INFO;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS; import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS;
/** /**
@@ -51,6 +54,8 @@ import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOT
public abstract class BaseActivity extends AppCompatActivity public abstract class BaseActivity extends AppCompatActivity
implements DestroyableContext, OnTapFilteredListener { implements DestroyableContext, OnTapFilteredListener {
private final static Logger LOG = getLogger(BaseActivity.class.getName());
@Inject @Inject
protected ScreenFilterMonitor screenFilterMonitor; protected ScreenFilterMonitor screenFilterMonitor;
@@ -119,6 +124,8 @@ public abstract class BaseActivity extends AppCompatActivity
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
if (LOG.isLoggable(INFO))
LOG.info("Starting " + this.getClass().getSimpleName());
for (ActivityLifecycleController alc : lifecycleControllers) { for (ActivityLifecycleController alc : lifecycleControllers) {
alc.onActivityStart(); alc.onActivityStart();
} }
@@ -137,6 +144,8 @@ public abstract class BaseActivity extends AppCompatActivity
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
if (LOG.isLoggable(INFO))
LOG.info("Stopping " + this.getClass().getSimpleName());
for (ActivityLifecycleController alc : lifecycleControllers) { for (ActivityLifecycleController alc : lifecycleControllers) {
alc.onActivityStop(); alc.onActivityStop();
} }

View File

@@ -20,17 +20,12 @@ import android.widget.TextView;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import java.util.logging.Logger;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static org.briarproject.briar.android.util.UiUtils.MIN_DATE_RESOLUTION; import static org.briarproject.briar.android.util.UiUtils.MIN_DATE_RESOLUTION;
public class BriarRecyclerView extends FrameLayout { public class BriarRecyclerView extends FrameLayout {
private static final Logger LOG =
Logger.getLogger(BriarRecyclerView.class.getName());
private final Handler handler = new Handler(Looper.getMainLooper()); private final Handler handler = new Handler(Looper.getMainLooper());
private RecyclerView recyclerView; private RecyclerView recyclerView;
@@ -39,6 +34,7 @@ public class BriarRecyclerView extends FrameLayout {
private TextView emptyText, emptyAction; private TextView emptyText, emptyAction;
private ProgressBar progressBar; private ProgressBar progressBar;
private RecyclerView.AdapterDataObserver emptyObserver; private RecyclerView.AdapterDataObserver emptyObserver;
@Nullable
private Runnable refresher = null; private Runnable refresher = null;
private boolean isScrollingToEnd = false; private boolean isScrollingToEnd = false;
@@ -217,18 +213,15 @@ public class BriarRecyclerView extends FrameLayout {
throw new IllegalStateException("Need to call setAdapter() first!"); throw new IllegalStateException("Need to call setAdapter() first!");
} }
refresher = () -> { refresher = () -> {
LOG.info("Updating Content...");
Adapter adapter = recyclerView.getAdapter(); Adapter adapter = recyclerView.getAdapter();
adapter.notifyItemRangeChanged(0, adapter.getItemCount()); adapter.notifyItemRangeChanged(0, adapter.getItemCount());
handler.postDelayed(refresher, MIN_DATE_RESOLUTION); handler.postDelayed(refresher, MIN_DATE_RESOLUTION);
}; };
LOG.info("Adding Handler Callback");
handler.postDelayed(refresher, MIN_DATE_RESOLUTION); handler.postDelayed(refresher, MIN_DATE_RESOLUTION);
} }
public void stopPeriodicUpdate() { public void stopPeriodicUpdate() {
if (refresher != null) { if (refresher != null) {
LOG.info("Removing Handler Callback");
handler.removeCallbacks(refresher); handler.removeCallbacks(refresher);
refresher = null; refresher = null;
} }