Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Remove reflection lookup for MarkerViewAdapter initialization #12218

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
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 @@ -637,7 +637,7 @@ private static class ImageMarkerViewAdapter extends MapboxMap.MarkerViewAdapter<
private LayoutInflater inflater;

ImageMarkerViewAdapter(Context context) {
super(context);
super(context, MarkerView.class);
inflater = LayoutInflater.from(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.sources.Source;

import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
import java.util.List;

Expand Down Expand Up @@ -2525,10 +2524,9 @@ public abstract static class MarkerViewAdapter<U extends MarkerView> {
*
* @param context the context associated to a MapView
*/
@SuppressWarnings("unchecked")
public MarkerViewAdapter(Context context) {
public MarkerViewAdapter(Context context, Class<U> persistentClass) {
this.context = context;
persistentClass = (Class<U>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
this.persistentClass = persistentClass;
viewReusePool = new Pools.SimplePool<>(10000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private static class CountryAdapter extends MapboxMap.MarkerViewAdapter<CountryM
private MapboxMap mapboxMap;

CountryAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
super(context);
super(context, CountryMarkerView.class);
this.inflater = LayoutInflater.from(context);
this.mapboxMap = mapboxMap;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ public static class TextAdapter extends MapboxMap.MarkerViewAdapter<TextMarkerVi
private MapboxMap mapboxMap;

public TextAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
super(context);
super(context, TextMarkerView.class);
this.inflater = LayoutInflater.from(context);
this.mapboxMap = mapboxMap;
}
Expand Down