Merge branch 'develop' of https://github.com/SemvdH/Next-Location into develop

This commit is contained in:
RemoMeijer
2021-01-06 19:29:03 +01:00
4 changed files with 18 additions and 5 deletions

View File

@@ -17,7 +17,8 @@
android:supportsRtl="true"
android:theme="@style/Theme.NextLocation"
android:hardwareAccelerated="false">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -20,7 +20,7 @@
},
{
"name":"Het Klooster Breda Schorsmolenstraat 13",
"coordinates":"51.58765659148822, 4.764801414019652"
"coordinates":"51.58775443759389,4.765568874365066"
}
],
"totalDistance": 1073.0,

View File

@@ -16,6 +16,7 @@ import android.widget.TextView;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location;
import com.a1.nextlocation.recyclerview.LocationListManager;
public class LocationDetailFragment extends Fragment {
private static final String TAG = LocationDetailFragment.class.getCanonicalName();
@@ -62,9 +63,11 @@ public class LocationDetailFragment extends Fragment {
}
this.locationImage = view.findViewById(R.id.detail_location_image);
Context context = this.locationImage.getContext();
int id = context.getResources().getIdentifier(this.location.getImageUrl(), "drawable", context.getPackageName());
this.locationImage.setImageResource(id);
if (this.location.getImageUrl() != null) {
int id = requireContext().getResources().getIdentifier(this.location.getImageUrl(), "drawable", requireContext().getPackageName());
this.locationImage.setImageResource(id);
}
return view;
}

View File

@@ -32,4 +32,13 @@ public enum LocationListManager {
this.locationList = locationLoader.load();
}
public Location findByName(String name) {
Location res = null;
for (Location location : this.locationList) {
if (location.getName().equals(name)) res = location;
break;
}
return res;
}
}