Remove unused classes
This commit is contained in:
parent
1b8a80a393
commit
2ab8e7fd71
2 changed files with 0 additions and 99 deletions
|
|
@ -1,68 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.misc;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Aidan Follestad (afollestad)
|
|
||||||
*/
|
|
||||||
public class LagTracker {
|
|
||||||
|
|
||||||
private static LagTracker mSingleton;
|
|
||||||
private static Map<String, Long> mMap;
|
|
||||||
private boolean mEnabled = true;
|
|
||||||
|
|
||||||
private LagTracker() {
|
|
||||||
mMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LagTracker get() {
|
|
||||||
if (mSingleton == null)
|
|
||||||
mSingleton = new LagTracker();
|
|
||||||
return mSingleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LagTracker enable() {
|
|
||||||
mEnabled = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LagTracker disable() {
|
|
||||||
mEnabled = false;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start(String key) {
|
|
||||||
final long start = System.nanoTime();
|
|
||||||
if (!mEnabled) {
|
|
||||||
if (!mMap.isEmpty())
|
|
||||||
mMap.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mMap.put(key, start);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void end(String key) {
|
|
||||||
final long end = System.nanoTime();
|
|
||||||
if (!mEnabled) {
|
|
||||||
if (!mMap.isEmpty())
|
|
||||||
mMap.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!mMap.containsKey(key))
|
|
||||||
throw new IllegalStateException("No start time found for " + key);
|
|
||||||
long start = mMap.get(key);
|
|
||||||
long diff = end - start;
|
|
||||||
print(key, diff);
|
|
||||||
mMap.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void print(String key, long diff) {
|
|
||||||
long ms = TimeUnit.NANOSECONDS.toMillis(diff);
|
|
||||||
long s = TimeUnit.NANOSECONDS.toSeconds(diff);
|
|
||||||
Log.d("LagTracker", "[" + key + " completed in]: " + diff + " ns (" + ms + "ms, " + s + "s)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.misc;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.transition.Transition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Karim Abou Zeid (kabouzeid)
|
|
||||||
*/
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public abstract class SimpleTransitionListener implements Transition.TransitionListener {
|
|
||||||
@Override
|
|
||||||
public void onTransitionStart(Transition transition) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransitionEnd(Transition transition) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransitionCancel(Transition transition) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransitionPause(Transition transition) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransitionResume(Transition transition) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue