This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.ParseException; | |
import java.util.Date; | |
public class ComparableDate implements Comparable<ComparableDate> { | |
private Date dateTime; | |
public Date getDateTime() { | |
return dateTime; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*This instance of the class show will be registered in the android "Aplpication" instance | |
like activity.getApplication().registerActivityLifecycleCallbacks(new ApplicationTimeSpentTracker()); | |
*/ | |
public class ApplicationTimeSpentTracker implements Application.ActivityLifecycleCallbacks { | |
private int activityReferences = 0; | |
private boolean isActivityChangingConfigurations = false; | |
private long startingTime; | |
private long stopTime; | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.Manifest; | |
import android.app.Activity; | |
import android.content.DialogInterface; | |
import android.content.pm.PackageManager; | |
import android.support.annotation.NonNull; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void debugLog(String msg){ | |
final StackTraceElement stackTrace = new Exception().getStackTrace()[1]; | |
String fileName = stackTrace.getFileName(); | |
if (fileName == null) fileName=""; // It is necessary if you want to use proguard obfuscation. | |
final String info = stackTrace.getMethodName() + " (" + fileName + ":" | |
+ stackTrace.getLineNumber() + ")"; |
NewerOlder