List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:Main.java
/** * Returns the month and release date of the movie * * @param releaseDate release date in yyyy-MM-dd format * @return month and year/* ww w . j a va 2s .co m*/ */ @NonNull public static String getDisplayReleaseDate(String releaseDate) { if (TextUtils.isEmpty(releaseDate)) { return ""; } try { Calendar calendar = Calendar.getInstance(); calendar.setTime(DATE_FORMAT.parse(releaseDate)); return calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH) + " " + calendar.get(Calendar.YEAR); } catch (ParseException e) { return ""; } }
From source file:com.jayway.restassured.itest.java.XMLValidationITest.java
@BeforeClass public static void setUpBeforeClass() { Locale.setDefault(Locale.ENGLISH); }
From source file:Main.java
/** * Translate a MIME standard character set name into the Java * equivalent.//from w ww. j a va 2s.c o m * * @param charset The MIME standard name. * * @return The Java equivalent for this name. */ private static String javaCharset(String charset) { // nothing in, nothing out. if (charset == null) { return null; } String mappedCharset = MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH)); // if there is no mapping, then the original name is used. Many of the MIME character set // names map directly back into Java. The reverse isn't necessarily true. if (mappedCharset == null) { return charset; } return mappedCharset; }
From source file:om.edu.squ.squportal.portlet.dps.utility.UtilProperty.java
public static String getMessage(String code, Object[] args) { activateResource(); return resourceBundle.getMessage(code, args, Locale.ENGLISH); }
From source file:Main.java
public static void fixBitmapRotationExif(String filePath, Activity activityForScreenOrientation) { try {// w w w . ja v a 2 s . com ExifInterface exif = new ExifInterface(filePath); int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); if (exifOrientation == ExifInterface.ORIENTATION_UNDEFINED && Build.MANUFACTURER.toLowerCase(Locale.ENGLISH).contains("htc")) return; boolean flippedHorizontally = false, flippedVertically = false; int angle = 0; if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) { angle += 90; } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) { angle += 180; } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) { angle += 270; } else if (exifOrientation == ExifInterface.ORIENTATION_FLIP_HORIZONTAL) { flippedHorizontally = true; } else if (exifOrientation == ExifInterface.ORIENTATION_FLIP_VERTICAL) { flippedVertically = true; } else if (exifOrientation == ExifInterface.ORIENTATION_TRANSPOSE) { angle += 90; flippedVertically = true; } else if (exifOrientation == ExifInterface.ORIENTATION_TRANSVERSE) { angle -= 90; flippedVertically = true; } int orientation; if (activityForScreenOrientation != null) { orientation = getScreenOrientation(activityForScreenOrientation); if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { angle += 90; } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) { angle += 180; } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) { angle += 270; } } orientation = 0; angle = angle % 360; if (angle == -90 && flippedVertically && !flippedHorizontally) { orientation = ExifInterface.ORIENTATION_TRANSVERSE; } else if (angle == -270 && flippedVertically && !flippedHorizontally) { orientation = ExifInterface.ORIENTATION_TRANSPOSE; } else if (angle == -90 && !flippedVertically && flippedHorizontally) { orientation = ExifInterface.ORIENTATION_TRANSPOSE; } else if (angle == -270 && !flippedVertically && flippedHorizontally) { orientation = ExifInterface.ORIENTATION_TRANSVERSE; } else { while (angle < 0) { angle += 360; } switch (angle) { case 0: if (flippedHorizontally) { orientation = ExifInterface.ORIENTATION_FLIP_HORIZONTAL; } else if (flippedVertically) { orientation = ExifInterface.ORIENTATION_FLIP_VERTICAL; } break; case 90: orientation = ExifInterface.ORIENTATION_ROTATE_90; break; case 180: orientation = ExifInterface.ORIENTATION_ROTATE_180; break; case 270: orientation = ExifInterface.ORIENTATION_ROTATE_270; break; } } if (orientation != exifOrientation) { exif.setAttribute(ExifInterface.TAG_ORIENTATION, ((Integer) orientation).toString()); exif.saveAttributes(); } } catch (IOException e) { Log.w("TAG", "-- Error in setting image"); } }
From source file:ch.citux.td.util.FormatUtils.java
public static String formatTime(long duration) { long hours = duration / 3600; long minutes = (duration % 3600) / 60; long seconds = duration % 60; if (hours > 0) { return String.format(Locale.ENGLISH, "%d:%02d:%02d", hours, minutes, seconds); } else {/*from w w w. j a v a2 s. co m*/ return String.format(Locale.ENGLISH, "%d:%02d", minutes, seconds); } }
From source file:net.firejack.platform.core.utils.MessageResolver.java
/** * @param message//from ww w .ja v a 2s. c o m * @param locale * @param args * @return */ public static String messageFormatting(String message, Locale locale, Object... args) { if (locale == null) locale = Locale.ENGLISH; String messageI18n = message; try { if (messageSource != null) { messageI18n = messageSource.getMessage(message, args, locale); // if (args != null) { // messageI18n = MessageFormat.format(messageI18n, args); // } } } catch (MissingResourceException e) { logger.warn("Can't find message: " + message, e); } return messageI18n; }
From source file:Main.java
public static String getAndroidVersionName(int sdkLevel) { if (sdkLevel < 0) { return androidVersionNames[0]; }//from w ww . ja v a 2s . co m if (sdkLevel >= androidVersionNames.length) { return String.format(Locale.ENGLISH, "v%d", sdkLevel); } return androidVersionNames[sdkLevel]; }
From source file:net.eledge.android.toolkit.db.internal.SQLBuilder.java
public static String getFieldName(Field field) { Column column = field.getAnnotation(Column.class); return StringUtils.defaultIfBlank(column.name(), field.getName().toLowerCase(Locale.ENGLISH)); }
From source file:Main.java
public static Bitmap getBitmapByFixingRotationForFile(String filePath, Bitmap sourceBitmap, Activity activityForScreenOrientation, boolean freeSourceBitmap) { try {/*from w ww. ja v a 2 s .co m*/ ExifInterface exif = new ExifInterface(filePath); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); if (orientation == ExifInterface.ORIENTATION_UNDEFINED && Build.MANUFACTURER.toLowerCase(Locale.ENGLISH).contains("htc")) return null; boolean flippedHorizontally = false, flippedVertically = false; int angle = 0; if (orientation == ExifInterface.ORIENTATION_ROTATE_90) { angle += 90; } else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) { angle += 180; } else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) { angle += 270; } else if (orientation == ExifInterface.ORIENTATION_FLIP_HORIZONTAL) { flippedHorizontally = true; } else if (orientation == ExifInterface.ORIENTATION_FLIP_VERTICAL) { flippedVertically = true; } else if (orientation == ExifInterface.ORIENTATION_TRANSPOSE) { angle += 90; flippedVertically = true; } else if (orientation == ExifInterface.ORIENTATION_TRANSVERSE) { angle -= 90; flippedVertically = true; } if (activityForScreenOrientation != null) { orientation = getScreenOrientation(activityForScreenOrientation); if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { angle += 90; } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) { angle += 180; } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) { angle += 270; } } Bitmap bmp = sourceBitmap; if (bmp == null) { bmp = BitmapFactory.decodeFile(filePath, null); } if (angle != 0) { Matrix mat = new Matrix(); mat.postRotate(angle); if (flippedHorizontally) { mat.postScale(-1.f, 1.f); } if (flippedVertically) { mat.postScale(1.f, -1.f); } Bitmap rotated = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mat, true); if (freeSourceBitmap || bmp != sourceBitmap) { bmp.recycle(); } bmp = rotated; } return bmp; } catch (IOException e) { Log.w("TAG", "-- Error in setting image"); } catch (OutOfMemoryError oom) { Log.w("TAG", "-- OOM Error in setting image"); } return null; }