mirror of
https://github.com/danog/termux-api.git
synced 2024-11-26 20:04:42 +01:00
Fix some Android Studio warnings
This commit is contained in:
parent
cdb18598b2
commit
10b60b14df
@ -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));
|
||||
}
|
||||
});
|
||||
|
@ -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) {
|
||||
|
@ -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<File> subDirs = new Stack<>();
|
||||
File currentPath = new File(filePath);
|
||||
while (currentPath != null && currentPath.isDirectory() && currentPath.canRead()) {
|
||||
File[] fileList = null;
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user