diff --git a/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt b/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt index 678523e..e2ec812 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt @@ -3,9 +3,13 @@ package fishrungames.yelpmapapp import android.app.Activity import android.content.Context import android.view.View +import android.widget.LinearLayout import com.google.android.gms.maps.model.Marker import android.widget.TextView import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter +import android.widget.RelativeLayout + + @@ -13,12 +17,17 @@ import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter * Created by mephi on 10.06.2017. */ -internal class MyInfoWindowAdapter(val activity: Activity) : InfoWindowAdapter { +class YelpInfoWindowProvider(val activity: Activity) : InfoWindowAdapter { private val myContentsView: View = activity.layoutInflater.inflate(R.layout.yelp_info_contents, null) override fun getInfoContents(marker: Marker): View { + + //val contentsView = activity.layoutInflater.inflate(R.layout.yelp_info_contents, null) + + //myContentsView.layoutParams = LinearLayout.LayoutParams(500, RelativeLayout.LayoutParams.WRAP_CONTENT) + //myContentsView.findViewById(R.id.title) = marker.title //myContentsView.findViewById(R.id.snippet).text = marker.snippet diff --git a/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt b/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt index cba73f2..e31dcc4 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt @@ -10,6 +10,9 @@ import com.google.android.gms.maps.model.LatLng import java.util.* import com.google.maps.android.clustering.ClusterManager import com.google.android.gms.maps.CameraUpdateFactory +import android.widget.Toast + + @@ -21,13 +24,15 @@ import com.google.android.gms.maps.CameraUpdateFactory */ -class YelpMapActivity : MapsActivity() +class YelpMapActivity : MapsActivity(), GoogleMap.OnInfoWindowClickListener { val handler = Handler() val dataProvider = DataProvider(this, this::handleMarkersUpdated) + var yelpInfoWindowProvider : YelpInfoWindowProvider? = null + private var mClusterManager: ClusterManager? = null val markerMap = mutableMapOf() @@ -45,6 +50,12 @@ class YelpMapActivity : MapsActivity() } + googleMap.setOnInfoWindowClickListener(this) + + yelpInfoWindowProvider = YelpInfoWindowProvider(this) + + googleMap.setInfoWindowAdapter(yelpInfoWindowProvider) + setUpClusterer(googleMap) } @@ -137,5 +148,10 @@ class YelpMapActivity : MapsActivity() } + override fun onInfoWindowClick(marker: Marker) { + Toast.makeText(this, "Info window clicked", + Toast.LENGTH_SHORT).show() + } + } \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_star_black_48dp.png b/app/src/main/res/drawable-hdpi/ic_star_black_48dp.png new file mode 100755 index 0000000..54d3065 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_star_black_48dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_star_border_black_48dp.png b/app/src/main/res/drawable-hdpi/ic_star_border_black_48dp.png new file mode 100755 index 0000000..f10d427 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_star_border_black_48dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_star_half_black_48dp.png b/app/src/main/res/drawable-hdpi/ic_star_half_black_48dp.png new file mode 100755 index 0000000..9106ffa Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_star_half_black_48dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_star_black_48dp.png b/app/src/main/res/drawable-mdpi/ic_star_black_48dp.png new file mode 100755 index 0000000..c636ce8 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_star_black_48dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_star_border_black_48dp.png b/app/src/main/res/drawable-mdpi/ic_star_border_black_48dp.png new file mode 100755 index 0000000..4f978e7 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_star_border_black_48dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_star_half_black_48dp.png b/app/src/main/res/drawable-mdpi/ic_star_half_black_48dp.png new file mode 100755 index 0000000..779c880 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_star_half_black_48dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_star_black_48dp.png b/app/src/main/res/drawable-xhdpi/ic_star_black_48dp.png new file mode 100755 index 0000000..7be2280 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_star_black_48dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_star_border_black_48dp.png b/app/src/main/res/drawable-xhdpi/ic_star_border_black_48dp.png new file mode 100755 index 0000000..041aa6b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_star_border_black_48dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_star_half_black_48dp.png b/app/src/main/res/drawable-xhdpi/ic_star_half_black_48dp.png new file mode 100755 index 0000000..98731ad Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_star_half_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_star_black_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_star_black_48dp.png new file mode 100755 index 0000000..918a395 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_star_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_star_border_black_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_star_border_black_48dp.png new file mode 100755 index 0000000..ca0f0f9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_star_border_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_star_half_black_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_star_half_black_48dp.png new file mode 100755 index 0000000..8b4a28f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_star_half_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_star_black_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_star_black_48dp.png new file mode 100755 index 0000000..67e25d5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_star_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_star_border_black_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_star_border_black_48dp.png new file mode 100755 index 0000000..8ececaa Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_star_border_black_48dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_star_half_black_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_star_half_black_48dp.png new file mode 100755 index 0000000..0a93ddc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_star_half_black_48dp.png differ diff --git a/app/src/main/res/layout/yelp_info_contents.xml b/app/src/main/res/layout/yelp_info_contents.xml index fc0ef08..1f19224 100755 --- a/app/src/main/res/layout/yelp_info_contents.xml +++ b/app/src/main/res/layout/yelp_info_contents.xml @@ -1,6 +1,90 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file