This file contains hidden or 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 void setupLazarusContingency(final Context context, final Activity launcher) { | |
final PendingIntent relaunch = PendingIntent.getActivity( | |
context, 0, new Intent(context, launcher.getClass()), PendingIntent.FLAG_ONE_SHOT) | |
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { | |
void uncaughtException(final Thread thread, final Throwable ex) { | |
Log.wtf(context.getPackageName(), "Exception not handled, relaunching", ex); | |
final AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); | |
alarmManager.set(AlarmManager.RTC, System.currentTimeMillis(), intent); | |
System.exit(0); | |
} |
This file contains hidden or 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
private static final String toCamelCaseSplit( | |
final String delim, final String src) | |
{ | |
final String[] tokens = src.split(delim); | |
final StringBuilder builder = new StringBuilder(); | |
int lastIndex = 0; | |
for (final String token : tokens) { | |
if (token.isEmpty()) continue; | |
builder.append(token.toLowerCase()); | |
if (builder.length() > token.length()) |
This file contains hidden or 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
private static final String toCamelCase( | |
final char delim, final String src) | |
{ | |
final StringBuilder builder = new StringBuilder(); | |
int lastIndex = 0; | |
while (lastIndex < src.length()) { | |
final int index = src.indexOf(delim, lastIndex); | |
if (index == lastIndex) | |
{ | |
lastIndex++; |