Fix sleep timer crash, removed discord etc

This commit is contained in:
h4h13 2019-06-16 23:40:28 +05:30
parent 933bf70068
commit 55807200d5
48 changed files with 104 additions and 281 deletions

View file

@ -18,6 +18,7 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.widget.Toast;
import java.lang.ref.WeakReference;
@ -57,7 +58,17 @@ public class UpdateToastMediaScannerCompletionListener implements MediaScannerCo
}
String text = " " + String.format(scannedFiles, scanned, toBeScanned.length) + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : "");
toast.setText(text);
toast.show();
try {
if (toast.getView().isShown()) {
toast.cancel();
}
if (Build.VERSION.SDK_INT < 28 && toast.getView().isShown()) {
toast.cancel();
}
toast.show();
} catch (Exception e) {
e.printStackTrace();
}
});
}
}