From 9dca01a0eecd0ccd3f80dd995c64378e0482d19f Mon Sep 17 00:00:00 2001 From: June Date: Mon, 31 Jan 2022 02:00:42 +0000 Subject: [PATCH] Replace valueOf with their respective data type functions --- .../org/grapheneos/pdfviewer/GestureHelper.java | 2 +- .../java/org/grapheneos/pdfviewer/Utils.java | 16 ++++++++-------- .../loader/DocumentPropertiesLoader.java | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/grapheneos/pdfviewer/GestureHelper.java b/app/src/main/java/org/grapheneos/pdfviewer/GestureHelper.java index f86dd8c..3b8002d 100644 --- a/app/src/main/java/org/grapheneos/pdfviewer/GestureHelper.java +++ b/app/src/main/java/org/grapheneos/pdfviewer/GestureHelper.java @@ -33,7 +33,7 @@ class GestureHelper { final ScaleGestureDetector scaleDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() { - float SPAN_RATIO = 600; + final float SPAN_RATIO = 600; float initialSpan; float prevNbStep; diff --git a/app/src/main/java/org/grapheneos/pdfviewer/Utils.java b/app/src/main/java/org/grapheneos/pdfviewer/Utils.java index 9cb0183..ffc8411 100644 --- a/app/src/main/java/org/grapheneos/pdfviewer/Utils.java +++ b/app/src/main/java/org/grapheneos/pdfviewer/Utils.java @@ -10,9 +10,9 @@ import java.util.Calendar; public class Utils { public static String parseFileSize(long fileSize) { - final double kb = fileSize / 1000; + final double kb = fileSize / 1000d; - if (kb == 0) { + if (kb == 0d) { return fileSize + " Bytes"; } @@ -46,7 +46,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid year", position); } - year = Integer.valueOf(field); + year = Integer.parseInt(field); if (year > currentYear) { year = currentYear; } @@ -67,7 +67,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid month", position); } - month = Integer.valueOf(field) - 1; + month = Integer.parseInt(field) - 1; if (month > 11) { throw new ParseException("Invalid month", position); } @@ -78,7 +78,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid day", position); } - day = Integer.valueOf(field); + day = Integer.parseInt(field); if (day > 31) { throw new ParseException("Invalid day", position); } @@ -89,7 +89,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid hours", position); } - hours = Integer.valueOf(field); + hours = Integer.parseInt(field); if (hours > 23) { throw new ParseException("Invalid hours", position); } @@ -100,7 +100,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid minutes", position); } - minutes = Integer.valueOf(field); + minutes = Integer.parseInt(field); if (minutes > 59) { throw new ParseException("Invalid minutes", position); } @@ -111,7 +111,7 @@ public class Utils { if (!TextUtils.isDigitsOnly(field)) { throw new ParseException("Invalid seconds", position); } - seconds = Integer.valueOf(field); + seconds = Integer.parseInt(field); if (seconds > 59) { throw new ParseException("Invalid seconds", position); } diff --git a/app/src/main/java/org/grapheneos/pdfviewer/loader/DocumentPropertiesLoader.java b/app/src/main/java/org/grapheneos/pdfviewer/loader/DocumentPropertiesLoader.java index f271c05..0b341ca 100644 --- a/app/src/main/java/org/grapheneos/pdfviewer/loader/DocumentPropertiesLoader.java +++ b/app/src/main/java/org/grapheneos/pdfviewer/loader/DocumentPropertiesLoader.java @@ -59,7 +59,7 @@ public class DocumentPropertiesLoader extends AsyncTaskLoader final int indexSize = mCursor.getColumnIndex(OpenableColumns.SIZE); if (indexSize >= 0) { - final long fileSize = Long.valueOf(mCursor.getString(indexSize)); + final long fileSize = Long.parseLong(mCursor.getString(indexSize)); properties.add(getProperty(null, names[1], Utils.parseFileSize(fileSize))); }