Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor WeatherUtils.java #1208

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void setWeatherImage(ImageView imageView, String weatherCondition)
// Adjusting scale for fog and wind icons.
if (weatherCondition.equals("fog") || weatherCondition.equals("wind")) {
imageView.setScaleType(ImageView.ScaleType.CENTER);
}else{
} else {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
imageView.setImageResource(getWeatherDrawableRes(resName));
Expand All @@ -41,13 +41,10 @@ public static void setWeatherTemp(TextView weatherTempTxtView, double temp) {
}

public static void toggleWeatherViewVisibility(boolean shouldShow, View weatherView) {
if (weatherView != null) {
if (shouldShow) {
weatherView.setVisibility(View.VISIBLE);
} else {
weatherView.setVisibility(View.GONE);
}
if (weatherView == null) {
return;
}
weatherView.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
}


Expand Down Expand Up @@ -81,8 +78,7 @@ public static String getDefaultUserTemp() {
Locale locale = Locale.getDefault();
String countryCode = locale.getCountry();

if ("US".equals(countryCode) || "BS".equals(countryCode) ||
"KY".equals(countryCode) || "LR".equals(countryCode)) {
if ("US".equals(countryCode) || "BS".equals(countryCode) || "KY".equals(countryCode) || "LR".equals(countryCode)) {
return "F";
} else {
return "C";
Expand Down
Loading