Add java8 support

This commit is contained in:
Karim Abou Zeid 2017-12-18 20:23:03 +01:00
commit 7793cc822d
44 changed files with 512 additions and 929 deletions

View file

@ -33,12 +33,7 @@ public abstract class DialogAsyncTask<Params, Progress, Result> extends AsyncTas
protected void onPreExecute() {
super.onPreExecute();
if (delay > 0) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
initAndShowDialog();
}
}, delay);
new Handler().postDelayed(this::initAndShowDialog, delay);
} else {
initAndShowDialog();
}

View file

@ -38,20 +38,17 @@ public class UpdateToastMediaScannerCompletionListener implements MediaScannerCo
public void onScanCompleted(final String path, final Uri uri) {
Activity activity = activityWeakReference.get();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast toast = toastWeakReference.get();
if (toast != null) {
if (uri == null) {
failed++;
} else {
scanned++;
}
String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : "");
toast.setText(text);
toast.show();
activity.runOnUiThread(() -> {
Toast toast = toastWeakReference.get();
if (toast != null) {
if (uri == null) {
failed++;
} else {
scanned++;
}
String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : "");
toast.setText(text);
toast.show();
}
});
}