统一日志管理
This commit is contained in:
@@ -24,7 +24,8 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.BatteryManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.king.zxing.util.LogUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
@@ -34,8 +35,6 @@ import java.util.concurrent.RejectedExecutionException;
|
||||
*/
|
||||
final class InactivityTimer {
|
||||
|
||||
private static final String TAG = InactivityTimer.class.getSimpleName();
|
||||
|
||||
private static final long INACTIVITY_DELAY_MS = 5 * 60 * 1000L;
|
||||
|
||||
private final Activity activity;
|
||||
@@ -56,7 +55,7 @@ final class InactivityTimer {
|
||||
try {
|
||||
inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} catch (RejectedExecutionException ree) {
|
||||
Log.w(TAG, "Couldn't schedule inactivity task; ignoring");
|
||||
LogUtils.w( "Couldn't schedule inactivity task; ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +65,13 @@ final class InactivityTimer {
|
||||
activity.unregisterReceiver(powerStatusReceiver);
|
||||
registered = false;
|
||||
} else {
|
||||
Log.w(TAG, "PowerStatusReceiver was never registered?");
|
||||
LogUtils.w( "PowerStatusReceiver was never registered?");
|
||||
}
|
||||
}
|
||||
|
||||
void onResume() {
|
||||
if (registered) {
|
||||
Log.w(TAG, "PowerStatusReceiver was already registered?");
|
||||
LogUtils.w( "PowerStatusReceiver was already registered?");
|
||||
} else {
|
||||
activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
registered = true;
|
||||
@@ -130,7 +129,7 @@ final class InactivityTimer {
|
||||
protected Object doInBackground(Object... objects) {
|
||||
try {
|
||||
Thread.sleep(INACTIVITY_DELAY_MS);
|
||||
Log.i(TAG, "Finishing activity due to inactivity");
|
||||
LogUtils.i( "Finishing activity due to inactivity");
|
||||
Activity activity = weakReference.get();
|
||||
if(activity!=null){
|
||||
activity.finish();
|
||||
|
||||
Reference in New Issue
Block a user