Replace valueOf with their respective data type functions

This commit is contained in:
June 2022-01-31 02:00:42 +00:00 committed by Daniel Micay
parent d48b1d3efc
commit 9dca01a0ee
3 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ class GestureHelper {
final ScaleGestureDetector scaleDetector = new ScaleGestureDetector(context, final ScaleGestureDetector scaleDetector = new ScaleGestureDetector(context,
new ScaleGestureDetector.SimpleOnScaleGestureListener() { new ScaleGestureDetector.SimpleOnScaleGestureListener() {
float SPAN_RATIO = 600; final float SPAN_RATIO = 600;
float initialSpan; float initialSpan;
float prevNbStep; float prevNbStep;

View File

@ -10,9 +10,9 @@ import java.util.Calendar;
public class Utils { public class Utils {
public static String parseFileSize(long fileSize) { 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"; return fileSize + " Bytes";
} }
@ -46,7 +46,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid year", position); throw new ParseException("Invalid year", position);
} }
year = Integer.valueOf(field); year = Integer.parseInt(field);
if (year > currentYear) { if (year > currentYear) {
year = currentYear; year = currentYear;
} }
@ -67,7 +67,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid month", position); throw new ParseException("Invalid month", position);
} }
month = Integer.valueOf(field) - 1; month = Integer.parseInt(field) - 1;
if (month > 11) { if (month > 11) {
throw new ParseException("Invalid month", position); throw new ParseException("Invalid month", position);
} }
@ -78,7 +78,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid day", position); throw new ParseException("Invalid day", position);
} }
day = Integer.valueOf(field); day = Integer.parseInt(field);
if (day > 31) { if (day > 31) {
throw new ParseException("Invalid day", position); throw new ParseException("Invalid day", position);
} }
@ -89,7 +89,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid hours", position); throw new ParseException("Invalid hours", position);
} }
hours = Integer.valueOf(field); hours = Integer.parseInt(field);
if (hours > 23) { if (hours > 23) {
throw new ParseException("Invalid hours", position); throw new ParseException("Invalid hours", position);
} }
@ -100,7 +100,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid minutes", position); throw new ParseException("Invalid minutes", position);
} }
minutes = Integer.valueOf(field); minutes = Integer.parseInt(field);
if (minutes > 59) { if (minutes > 59) {
throw new ParseException("Invalid minutes", position); throw new ParseException("Invalid minutes", position);
} }
@ -111,7 +111,7 @@ public class Utils {
if (!TextUtils.isDigitsOnly(field)) { if (!TextUtils.isDigitsOnly(field)) {
throw new ParseException("Invalid seconds", position); throw new ParseException("Invalid seconds", position);
} }
seconds = Integer.valueOf(field); seconds = Integer.parseInt(field);
if (seconds > 59) { if (seconds > 59) {
throw new ParseException("Invalid seconds", position); throw new ParseException("Invalid seconds", position);
} }

View File

@ -59,7 +59,7 @@ public class DocumentPropertiesLoader extends AsyncTaskLoader<List<CharSequence>
final int indexSize = mCursor.getColumnIndex(OpenableColumns.SIZE); final int indexSize = mCursor.getColumnIndex(OpenableColumns.SIZE);
if (indexSize >= 0) { 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))); properties.add(getProperty(null, names[1], Utils.parseFileSize(fileSize)));
} }