Skip to content

Commit

Permalink
Temporarily turn off the weather image feature to fix a crash
Browse files Browse the repository at this point in the history
Workaround for #1196
  • Loading branch information
aaronbrethorst committed Apr 2, 2024
1 parent cf499e3 commit 76aefc1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions onebusaway-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode 140
versionName "2.13.0"
versionCode 141
versionName "2.13.1"

multiDexEnabled true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@
public class WeatherUtils {

public static void setWeatherImage(ImageView imageView, String weatherCondition, Context context) {
// TODO FIXME: This is temporarily commented out because it was causing a large number
// of crashes in 2.13.0.
// See https://github.com/OneBusAway/onebusaway-android/issues/1196

String resName = weatherCondition.replace("-", "_");
int resId = context.getResources().getIdentifier(resName, "drawable", context.getPackageName());
if (resId != 0) {
// Adjusting scale for fog and wind icons.
if(weatherCondition.equals("fog") || weatherCondition.equals("wind")){
imageView.setScaleType(ImageView.ScaleType.CENTER);
}
imageView.setImageResource(resId);
} else {
// Default
imageView.setImageResource(R.drawable.clear_day);
}
// String resName = weatherCondition.replace("-", "_");
//
// int resId = context.getResources().getIdentifier(resName, "drawable", context.getPackageName());
//
// if (resId != 0) {
// // Adjusting scale for fog and wind icons.
// if(weatherCondition.equals("fog") || weatherCondition.equals("wind")){
// imageView.setScaleType(ImageView.ScaleType.CENTER);
// }
// imageView.setImageResource(resId);
// } else {
// // Default
// imageView.setImageResource(R.drawable.clear_day);
// }
}

public static void setWeatherTemp(TextView weatherTempTxtView, double temp) {
Expand Down
1 change: 1 addition & 0 deletions onebusaway-android/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@

<ImageView
android:id="@+id/weatherStateImageView"
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:scaleType="centerCrop"
Expand Down

0 comments on commit 76aefc1

Please sign in to comment.