diff --git a/app/src/main/java/com/termux/api/JobSchedulerAPI.java b/app/src/main/java/com/termux/api/JobSchedulerAPI.java index 29fa3dd..bfea0c3 100644 --- a/app/src/main/java/com/termux/api/JobSchedulerAPI.java +++ b/app/src/main/java/com/termux/api/JobSchedulerAPI.java @@ -12,6 +12,7 @@ import com.termux.api.util.ResultReturner; import java.io.File; import java.io.PrintWriter; +import java.util.Locale; public class JobSchedulerAPI { @@ -93,15 +94,13 @@ public class JobSchedulerAPI { ResultReturner.returnData(apiReceiver, intent, new ResultReturner.ResultWriter() { @Override public void writeResult(PrintWriter out) { - out.println(String.format("Pending job %d %s", j.getId(), j.toString())); + out.println(String.format(Locale.ENGLISH, "Pending job %d %s", j.getId(), j.toString())); } }); } ComponentName serviceComponent = new ComponentName(context, SchedulerJobService.class); - JobInfo.Builder builder = null; - ; - builder = new JobInfo.Builder(jobId, serviceComponent) + JobInfo.Builder builder = new JobInfo.Builder(jobId, serviceComponent) .setExtras(extras) .setRequiredNetworkType(networkTypeCode) .setRequiresCharging(charging) @@ -125,7 +124,7 @@ public class JobSchedulerAPI { ResultReturner.returnData(apiReceiver, intent, new ResultReturner.ResultWriter() { @Override public void writeResult(PrintWriter out) { - out.println(String.format("Scheduled job %d to call %s every %d ms - response %d", + out.println(String.format(Locale.ENGLISH,"Scheduled job %d to call %s every %d ms - response %d", jobId, scriptPath, periodicMillis, scheduleResponse)); } }); diff --git a/app/src/main/java/com/termux/api/MediaPlayerAPI.java b/app/src/main/java/com/termux/api/MediaPlayerAPI.java index a1abf0f..1f3bf4e 100644 --- a/app/src/main/java/com/termux/api/MediaPlayerAPI.java +++ b/app/src/main/java/com/termux/api/MediaPlayerAPI.java @@ -200,7 +200,7 @@ public class MediaPlayerAPI { public MediaCommandResult handle(MediaPlayer player, Context context, Intent intent) { MediaCommandResult result = new MediaCommandResult(); - File mediaFile = null; + File mediaFile; try { mediaFile = new File(intent.getStringExtra("file")); } catch (NullPointerException e) { diff --git a/app/src/main/java/com/termux/api/MediaScannerAPI.java b/app/src/main/java/com/termux/api/MediaScannerAPI.java index 6d76dbb..f0cab62 100644 --- a/app/src/main/java/com/termux/api/MediaScannerAPI.java +++ b/app/src/main/java/com/termux/api/MediaScannerAPI.java @@ -54,7 +54,7 @@ public class MediaScannerAPI { private static void scanFilesRecursively(PrintWriter out, Context context, String[] filePaths, Integer[] totalScanned, Boolean verbose) { for (String filePath : filePaths) { - Stack subDirs = new Stack(); + Stack subDirs = new Stack<>(); File currentPath = new File(filePath); while (currentPath != null && currentPath.isDirectory() && currentPath.canRead()) { File[] fileList = null; diff --git a/app/src/main/java/com/termux/api/ShareAPI.java b/app/src/main/java/com/termux/api/ShareAPI.java index de11117..4c2d47b 100644 --- a/app/src/main/java/com/termux/api/ShareAPI.java +++ b/app/src/main/java/com/termux/api/ShareAPI.java @@ -90,7 +90,7 @@ public class ShareAPI { if (contentTypeExtra == null) { String fileName = fileToShare.getName(); int lastDotIndex = fileName.lastIndexOf('.'); - String fileExtension = fileName.substring(lastDotIndex + 1, fileName.length()); + String fileExtension = fileName.substring(lastDotIndex + 1); MimeTypeMap mimeTypes = MimeTypeMap.getSingleton(); // Lower casing makes it work with e.g. "JPG": contentTypeToUse = mimeTypes.getMimeTypeFromExtension(fileExtension.toLowerCase()); diff --git a/app/src/main/java/com/termux/api/TextToSpeechAPI.java b/app/src/main/java/com/termux/api/TextToSpeechAPI.java index 452eb52..81d21ee 100644 --- a/app/src/main/java/com/termux/api/TextToSpeechAPI.java +++ b/app/src/main/java/com/termux/api/TextToSpeechAPI.java @@ -192,7 +192,7 @@ public class TextToSpeechAPI { } private static Locale getLocale(String language, String region, String variant) { - Locale result = null; + Locale result; if (region != null) { if (variant != null) { result = new Locale(language, region, variant);