Added detail view
This commit is contained in:
parent
1a6611c087
commit
ad3b15db3b
@ -2,6 +2,7 @@ package fishrungames.yelpmapapp
|
||||
|
||||
import android.support.v4.app.Fragment
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.AppBarLayout
|
||||
import android.support.v7.widget.LinearLayoutCompat
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
|
||||
@ -11,7 +12,12 @@ import android.view.View
|
||||
import fishrungames.yelpmapapp.records.BusinessDetailRecord
|
||||
import fishrungames.yelpmapapp.records.ReviewListRecord
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.util.Log
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.koushikdutta.ion.Ion
|
||||
import fishrungames.yelpmapapp.records.MapMarkerRecord
|
||||
import org.w3c.dom.Text
|
||||
|
||||
|
||||
/**
|
||||
@ -25,19 +31,62 @@ class DetailFragment : Fragment()
|
||||
|
||||
var mapMarkerRecord : MapMarkerRecord? = null
|
||||
|
||||
var backdropImageView : ImageView? = null
|
||||
|
||||
var backgroundTitleTextView : TextView? = null
|
||||
var toolbarTitleTextView : TextView? = null
|
||||
|
||||
var detailCoordinatorChangeOffset : Int = 0
|
||||
var detailCoordinatorOffset : Int = 0
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
detailCoordinatorChangeOffset = context.resources.getInteger(R.integer.detailCoordinatorChangeOffset)
|
||||
detailCoordinatorOffset = context.resources.getInteger(R.integer.detailCoordinatorOffset)
|
||||
|
||||
val rootView = inflater!!.inflate(R.layout.detail_fragment, container, false)
|
||||
|
||||
val appBarLayout = rootView.findViewById(R.id.appBarLayout) as AppBarLayout
|
||||
|
||||
appBarLayout.addOnOffsetChangedListener {
|
||||
_, verticalOffset ->
|
||||
run {
|
||||
if (-verticalOffset > detailCoordinatorChangeOffset) {
|
||||
val alpha = (-verticalOffset - detailCoordinatorChangeOffset).toFloat() / (detailCoordinatorOffset - detailCoordinatorChangeOffset).toFloat()
|
||||
toolbarTitleTextView?.alpha = alpha
|
||||
backgroundTitleTextView?.alpha = 1F - alpha
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbarTitleTextView?.alpha = 0F
|
||||
backgroundTitleTextView?.alpha = 1F
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val detailRecyclerView = rootView.findViewById(R.id.detailRecyclerView) as RecyclerView
|
||||
|
||||
backdropImageView = rootView.findViewById(R.id.backdropImageView) as ImageView
|
||||
|
||||
backgroundTitleTextView = rootView.findViewById(R.id.backgroundTitleTextView) as TextView
|
||||
toolbarTitleTextView = rootView.findViewById(R.id.toolbarTitleTextView) as TextView
|
||||
|
||||
detailRecyclerView.layoutManager = LinearLayoutManager(this.context)
|
||||
|
||||
mapMarkerRecord = arguments?.getSerializable("mapMarkerRecord") as? MapMarkerRecord
|
||||
|
||||
if (mapMarkerRecord != null && mapMarkerRecord!!.id != null) {
|
||||
|
||||
detailRecyclerAdapter = DetailRecyclerAdapter()
|
||||
Ion.with(backdropImageView)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.error(R.drawable.placeholder)
|
||||
.fadeIn(true)
|
||||
.load(mapMarkerRecord!!.image_url)
|
||||
|
||||
toolbarTitleTextView?.text = mapMarkerRecord!!.name
|
||||
backgroundTitleTextView?.text = mapMarkerRecord!!.name
|
||||
|
||||
detailRecyclerAdapter = DetailRecyclerAdapter(context, mapMarkerRecord!!)
|
||||
|
||||
detailRecyclerView.adapter = detailRecyclerAdapter
|
||||
|
||||
@ -51,11 +100,29 @@ class DetailFragment : Fragment()
|
||||
|
||||
fun updateBusinessDetail(businessDetailRecord : BusinessDetailRecord)
|
||||
{
|
||||
if (businessDetailRecord.id != null && businessDetailRecord.id == mapMarkerRecord?.id) {
|
||||
|
||||
Ion.with(backdropImageView)
|
||||
.error(R.drawable.placeholder)
|
||||
.fadeIn(true)
|
||||
.load(businessDetailRecord.image_url)
|
||||
|
||||
toolbarTitleTextView?.text = businessDetailRecord.name
|
||||
backgroundTitleTextView?.text = mapMarkerRecord!!.name
|
||||
|
||||
detailRecyclerAdapter?.businessDetailRecord = businessDetailRecord
|
||||
|
||||
detailRecyclerAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateReviewList(reviewListRecordPair : Pair<String, ReviewListRecord>)
|
||||
{
|
||||
if (reviewListRecordPair.first == mapMarkerRecord?.id) {
|
||||
|
||||
detailRecyclerAdapter?.reviewListRecordPair = reviewListRecordPair
|
||||
|
||||
detailRecyclerAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,21 @@
|
||||
package fishrungames.yelpmapapp
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.view.LayoutInflater
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import com.koushikdutta.ion.Ion
|
||||
import fishrungames.yelpmapapp.records.BusinessDetailRecord
|
||||
import fishrungames.yelpmapapp.records.MapMarkerRecord
|
||||
import fishrungames.yelpmapapp.records.ReviewListRecord
|
||||
import java.text.DecimalFormat
|
||||
|
||||
|
||||
/**
|
||||
@ -17,8 +23,11 @@ import android.view.LayoutInflater
|
||||
*/
|
||||
|
||||
|
||||
class DetailRecyclerAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
class DetailRecyclerAdapter(val context : Context, val mapMarkerRecord : MapMarkerRecord) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
var businessDetailRecord : BusinessDetailRecord? = null
|
||||
|
||||
var reviewListRecordPair : Pair<String, ReviewListRecord>? = null
|
||||
|
||||
internal class PhoneViewHolder(v: View) : RecyclerView.ViewHolder(v) {
|
||||
|
||||
@ -32,42 +41,182 @@ class DetailRecyclerAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
}
|
||||
|
||||
internal class ReviewTitleViewHolder(v: View) : RecyclerView.ViewHolder(v) {
|
||||
|
||||
var noReviewsTextView: TextView = v.findViewById(R.id.noReviewsTextView) as TextView
|
||||
|
||||
var progressBar: ProgressBar = v.findViewById(R.id.progressBar) as ProgressBar
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal class RatingViewHolder(v: View) : RecyclerView.ViewHolder(v) {
|
||||
|
||||
var ratingTextView : TextView = v.findViewById(R.id.ratingTextView) as TextView
|
||||
|
||||
val starImageView1 = v.findViewById(R.id.starImageView1) as ImageView
|
||||
val starImageView2 = v.findViewById(R.id.starImageView2) as ImageView
|
||||
val starImageView3 = v.findViewById(R.id.starImageView3) as ImageView
|
||||
val starImageView4 = v.findViewById(R.id.starImageView4) as ImageView
|
||||
val starImageView5 = v.findViewById(R.id.starImageView5) as ImageView
|
||||
|
||||
}
|
||||
|
||||
internal class ReviewViewHolder(v: View) : RecyclerView.ViewHolder(v) {
|
||||
|
||||
var nameTextView : TextView = v.findViewById(R.id.nameTextView) as TextView
|
||||
|
||||
var messageTextView : TextView = v.findViewById(R.id.messageTextView) as TextView
|
||||
|
||||
var dateTextView : TextView = v.findViewById(R.id.dateTextView) as TextView
|
||||
|
||||
var ratingTextView : TextView = v.findViewById(R.id.ratingTextView) as TextView
|
||||
|
||||
val starImageView1 = v.findViewById(R.id.starImageView1) as ImageView
|
||||
val starImageView2 = v.findViewById(R.id.starImageView2) as ImageView
|
||||
val starImageView3 = v.findViewById(R.id.starImageView3) as ImageView
|
||||
val starImageView4 = v.findViewById(R.id.starImageView4) as ImageView
|
||||
val starImageView5 = v.findViewById(R.id.starImageView5) as ImageView
|
||||
|
||||
val profilePictureImageView = v.findViewById(R.id.profilePictureImageView) as ImageView
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
// Just as an example, return 0 or 2 depending on position
|
||||
// Note that unlike in ListView adapters, types don't have to be contiguous
|
||||
return position % 2
|
||||
return position
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
when (viewType) {
|
||||
0 -> {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_rating, parent, false)
|
||||
return RatingViewHolder(v)
|
||||
}
|
||||
1 -> {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_phone, parent, false)
|
||||
return PhoneViewHolder(v)
|
||||
}
|
||||
else -> {
|
||||
2 -> {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_address, parent, false)
|
||||
return AddressViewHolder(v)
|
||||
}
|
||||
3 -> {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_review_title, parent, false)
|
||||
return ReviewTitleViewHolder(v)
|
||||
}
|
||||
else -> {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.recycler_review, parent, false)
|
||||
return ReviewViewHolder(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (holder.itemViewType) {
|
||||
0 -> {
|
||||
val ratingViewHolder = holder as RatingViewHolder
|
||||
|
||||
val rating = businessDetailRecord?.rating ?: (mapMarkerRecord.rating ?: 0.0)
|
||||
|
||||
val formatter = DecimalFormat("#0.00")
|
||||
|
||||
ratingViewHolder.ratingTextView.text = formatter.format(rating)
|
||||
|
||||
ratingViewHolder.starImageView1.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 0.0)))
|
||||
ratingViewHolder.starImageView2.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 1.0)))
|
||||
ratingViewHolder.starImageView3.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 2.0)))
|
||||
ratingViewHolder.starImageView4.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 3.0)))
|
||||
ratingViewHolder.starImageView5.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 4.0)))
|
||||
|
||||
}
|
||||
1 -> {
|
||||
val phoneViewHolder = holder as PhoneViewHolder
|
||||
|
||||
phoneViewHolder.phoneTextView.text = "+86 15000929180"
|
||||
if (businessDetailRecord?.display_phone != null) {
|
||||
|
||||
phoneViewHolder.phoneTextView.text = businessDetailRecord?.display_phone
|
||||
}
|
||||
else
|
||||
{
|
||||
phoneViewHolder.phoneTextView.text = mapMarkerRecord.display_phone
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
2 -> {
|
||||
val addressViewHolder = holder as AddressViewHolder
|
||||
|
||||
addressViewHolder.addressTextView.text = "555 First avenue"
|
||||
if (businessDetailRecord?.location?.display_address != null) {
|
||||
|
||||
addressViewHolder.addressTextView.text = businessDetailRecord?.location?.display_address?.joinToString(" ")
|
||||
}
|
||||
else
|
||||
{
|
||||
addressViewHolder.addressTextView.text = mapMarkerRecord.location?.display_address?.joinToString(" ")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
3 -> {
|
||||
val reviewTitleViewHolder = holder as ReviewTitleViewHolder
|
||||
|
||||
if (reviewListRecordPair == null)
|
||||
{
|
||||
reviewTitleViewHolder.progressBar.visibility = VISIBLE
|
||||
reviewTitleViewHolder.noReviewsTextView.visibility = GONE
|
||||
}
|
||||
else
|
||||
{
|
||||
reviewTitleViewHolder.progressBar.visibility = GONE
|
||||
reviewTitleViewHolder.noReviewsTextView.visibility = if (getReviewCount() > 0) GONE else VISIBLE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else -> {
|
||||
val reviewViewHolder = holder as ReviewViewHolder
|
||||
|
||||
val reviewRecord = reviewListRecordPair?.second?.reviews?.get(position - 4)
|
||||
|
||||
if (reviewRecord != null) {
|
||||
|
||||
reviewViewHolder.nameTextView.text = reviewRecord.user?.name
|
||||
|
||||
reviewViewHolder.messageTextView.text = reviewRecord.text
|
||||
|
||||
reviewViewHolder.dateTextView.text = reviewRecord.time_created
|
||||
|
||||
val rating = reviewRecord.rating ?: 0.0
|
||||
val formatter = DecimalFormat("#0.00")
|
||||
|
||||
reviewViewHolder.ratingTextView.text = formatter.format(rating)
|
||||
|
||||
reviewViewHolder.starImageView1.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 0.0)))
|
||||
reviewViewHolder.starImageView2.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 1.0)))
|
||||
reviewViewHolder.starImageView3.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 2.0)))
|
||||
reviewViewHolder.starImageView4.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 3.0)))
|
||||
reviewViewHolder.starImageView5.setImageDrawable(ContextCompat.getDrawable(context, Utils.getStarRatingId(rating, 4.0)))
|
||||
|
||||
Ion.with(reviewViewHolder.profilePictureImageView)
|
||||
.placeholder(R.drawable.placeholder)
|
||||
.error(R.drawable.placeholder)
|
||||
.fadeIn(true)
|
||||
.load(reviewRecord.user?.image_url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return 2
|
||||
|
||||
return 4 + getReviewCount()
|
||||
}
|
||||
|
||||
private fun getReviewCount() : Int {
|
||||
return reviewListRecordPair?.second?.reviews?.count() ?: 0
|
||||
}
|
||||
}
|
26
app/src/main/java/fishrungames/yelpmapapp/Utils.kt
Executable file
26
app/src/main/java/fishrungames/yelpmapapp/Utils.kt
Executable file
@ -0,0 +1,26 @@
|
||||
package fishrungames.yelpmapapp
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
|
||||
|
||||
class Utils {
|
||||
companion object {
|
||||
fun getStarRatingId(rating : Double, s : Double) : Int {
|
||||
|
||||
if (rating < 0.25 + s)
|
||||
{
|
||||
return R.drawable.ic_star_border_black_48dp
|
||||
}
|
||||
if (rating < 0.75 + s)
|
||||
{
|
||||
return R.drawable.ic_star_half_black_48dp
|
||||
}
|
||||
|
||||
return R.drawable.ic_star_black_48dp
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +1,19 @@
|
||||
package fishrungames.yelpmapapp
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
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
|
||||
|
||||
|
||||
|
||||
import fishrungames.yelpmapapp.Utils.Companion.getStarRatingId
|
||||
import java.text.DecimalFormat
|
||||
|
||||
|
||||
/**
|
||||
@ -21,15 +24,43 @@ class YelpInfoWindowProvider(val activity: Activity) : InfoWindowAdapter {
|
||||
|
||||
private val myContentsView: View = activity.layoutInflater.inflate(R.layout.yelp_info_contents, null)
|
||||
|
||||
var lastClickedMapMarker : MapMarkerClusterItem? = null
|
||||
|
||||
override fun getInfoContents(marker: Marker): View {
|
||||
|
||||
if (lastClickedMapMarker != null)
|
||||
{
|
||||
val nameTextView = myContentsView.findViewById(R.id.nameTextView) as TextView
|
||||
val addressTextView = myContentsView.findViewById(R.id.addressTextView) as TextView
|
||||
val ratingTextView = myContentsView.findViewById(R.id.ratingTextView) as TextView
|
||||
|
||||
//val contentsView = activity.layoutInflater.inflate(R.layout.yelp_info_contents, null)
|
||||
|
||||
//myContentsView.layoutParams = LinearLayout.LayoutParams(500, RelativeLayout.LayoutParams.WRAP_CONTENT)
|
||||
val starImageView1 = myContentsView.findViewById(R.id.starImageView1) as ImageView
|
||||
val starImageView2 = myContentsView.findViewById(R.id.starImageView2) as ImageView
|
||||
val starImageView3 = myContentsView.findViewById(R.id.starImageView3) as ImageView
|
||||
val starImageView4 = myContentsView.findViewById(R.id.starImageView4) as ImageView
|
||||
val starImageView5 = myContentsView.findViewById(R.id.starImageView5) as ImageView
|
||||
|
||||
//myContentsView.findViewById(R.id.title) = marker.title
|
||||
//myContentsView.findViewById(R.id.snippet).text = marker.snippet
|
||||
nameTextView.text = lastClickedMapMarker?.mapMarkerRecord?.name
|
||||
|
||||
addressTextView.text = lastClickedMapMarker?.mapMarkerRecord?.location?.display_address?.joinToString(" ")
|
||||
|
||||
|
||||
if (lastClickedMapMarker?.mapMarkerRecord?.rating != null) {
|
||||
|
||||
val rating = lastClickedMapMarker?.mapMarkerRecord?.rating!!
|
||||
|
||||
val formatter = DecimalFormat("#0.00")
|
||||
ratingTextView.text = formatter.format(rating)
|
||||
|
||||
starImageView1.setImageDrawable(ContextCompat.getDrawable(activity, getStarRatingId(rating, 0.0)))
|
||||
starImageView2.setImageDrawable(ContextCompat.getDrawable(activity, getStarRatingId(rating, 1.0)))
|
||||
starImageView3.setImageDrawable(ContextCompat.getDrawable(activity, getStarRatingId(rating, 2.0)))
|
||||
starImageView4.setImageDrawable(ContextCompat.getDrawable(activity, getStarRatingId(rating, 3.0)))
|
||||
starImageView5.setImageDrawable(ContextCompat.getDrawable(activity, getStarRatingId(rating, 4.0)))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return myContentsView
|
||||
}
|
||||
@ -38,4 +69,4 @@ class YelpInfoWindowProvider(val activity: Activity) : InfoWindowAdapter {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -152,10 +152,11 @@ class YelpMapActivity : MapsActivity(), ClusterManager.OnClusterItemInfoWindowCl
|
||||
}
|
||||
|
||||
override fun onClusterItemClick(item: MapMarkerClusterItem): Boolean {
|
||||
// Does nothing, but you could go into the user's profile page, for example.
|
||||
|
||||
lastClickedMapMarker = item
|
||||
|
||||
yelpInfoWindowProvider?.lastClickedMapMarker = item
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ class HandleReviewListResponseAsyncTask(val id: String, val onUpdateReviewList :
|
||||
|
||||
try {
|
||||
|
||||
val recordType = object : TypeToken<BusinessDetailRecord?>() {}.type
|
||||
val recordType = object : TypeToken<ReviewListRecord?>() {}.type
|
||||
|
||||
val result = Gson().fromJson<ReviewListRecord?>(response[0], recordType)
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
@ -20,4 +22,4 @@ data class BusinessDetailRecord(
|
||||
val location : LocationRecord?,
|
||||
val coordinates: CoordinatesRecord?,
|
||||
val photos : List<String>?
|
||||
)
|
||||
) : Serializable
|
||||
|
@ -1,8 +1,10 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
|
||||
data class CategoryRecord(val alias: String?,
|
||||
val title: String?)
|
||||
val title: String?) : Serializable
|
||||
|
@ -1,8 +1,10 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
|
||||
data class CoordinatesRecord(val latitude: Double?,
|
||||
val longitude: Double?)
|
||||
val longitude: Double?) : Serializable
|
||||
|
@ -1,5 +1,7 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
@ -14,4 +16,4 @@ data class LocationRecord(
|
||||
val state: String?,
|
||||
val display_address: List<String>?,
|
||||
val cross_streets: String?
|
||||
)
|
||||
) : Serializable
|
||||
|
@ -11,8 +11,12 @@ import com.google.gson.annotations.SerializedName
|
||||
|
||||
|
||||
data class MapMarkerRecord (
|
||||
@SerializedName("id") val id: String?,
|
||||
@SerializedName("name") val name: String?,
|
||||
@SerializedName("image_url") val image_url: String?,
|
||||
@SerializedName("coordinates") val coordinates: CoordinatesRecord?
|
||||
val id: String?,
|
||||
val name: String?,
|
||||
val image_url: String?,
|
||||
val coordinates: CoordinatesRecord?,
|
||||
val location: LocationRecord?,
|
||||
val rating: Double?,
|
||||
val phone : String?,
|
||||
val display_phone : String?
|
||||
) : Serializable
|
||||
|
@ -1,9 +1,11 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
|
||||
data class ReviewListRecord(
|
||||
val reviews: List<ReviewRecord>?,
|
||||
val total: Int?)
|
||||
val total: Int?) : Serializable
|
||||
|
@ -1,5 +1,7 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
@ -9,4 +11,4 @@ data class ReviewRecord(
|
||||
val user: ReviewUserRecord?,
|
||||
val text: String?,
|
||||
val time_created: String?,
|
||||
val url: String?)
|
||||
val url: String?) : Serializable
|
||||
|
@ -1,9 +1,11 @@
|
||||
package fishrungames.yelpmapapp.records
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by mephi on 10.06.2017.
|
||||
*/
|
||||
|
||||
data class ReviewUserRecord(
|
||||
val image_url: String?,
|
||||
val name: String?)
|
||||
val name: String?) : Serializable
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 78 KiB |
BIN
app/src/main/res/drawable/empty_profile.png
Executable file
BIN
app/src/main/res/drawable/empty_profile.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable/placeholder.png
Executable file
BIN
app/src/main/res/drawable/placeholder.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
@ -10,7 +10,7 @@
|
||||
>
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/main.appbar"
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
@ -18,33 +18,53 @@
|
||||
>
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/main.collapsing"
|
||||
android:id="@+id/collapsing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:expandedTitleMarginStart="48dp"
|
||||
app:expandedTitleMarginEnd="64dp"
|
||||
>
|
||||
app:expandedTitleMarginStart="48dp"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main.backdrop"
|
||||
android:id="@+id/backdropImageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:fitsSystemWindows="true"
|
||||
android:src="@drawable/bkgtest"
|
||||
app:layout_collapseMode="parallax"
|
||||
/>
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/placeholder"
|
||||
app:layout_collapseMode="parallax" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/backgroundTitleTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:text="Toolbar Title"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/main.toolbar"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:layout_collapseMode="pin"
|
||||
/>
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbarTitleTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:text="Toolbar Title"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
</android.support.v7.widget.Toolbar>
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
|
61
app/src/main/res/layout/recycler_rating.xml
Executable file
61
app/src/main/res/layout/recycler_rating.xml
Executable file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ratingTitleTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rating:"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ratingTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5.0" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
110
app/src/main/res/layout/recycler_review.xml
Executable file
110
app/src/main/res/layout/recycler_review.xml
Executable file
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profilePictureImageView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="10dp"
|
||||
app:srcCompat="@drawable/empty_profile" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="TextView"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ratingTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView1"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView3"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView4"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/starImageView5"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_star_border_black_48dp"
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/messageTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/separatorImageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:srcCompat="@android:color/black" />
|
||||
|
||||
</LinearLayout>
|
25
app/src/main/res/layout/recycler_review_title.xml
Executable file
25
app/src/main/res/layout/recycler_review_title.xml
Executable file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reviews:"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
|
||||
<TextView
|
||||
android:id="@+id/noReviewsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No reviews yet"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
@ -11,7 +11,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:id="@+id/nameTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dp"
|
||||
@ -19,19 +19,25 @@
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/separatorImageView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@android:color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/ratingTitleTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rating:"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ratingTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5.0" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -73,18 +79,26 @@
|
||||
app:srcCompat="@drawable/ic_star_border_black_48dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/separatorImageView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@android:color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:id="@+id/addressTitleTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Address:"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:id="@+id/addressTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="123 Main" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
5
app/src/main/res/values/dim.xml
Executable file
5
app/src/main/res/values/dim.xml
Executable file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="detail_background_height">300dp</dimen>
|
||||
|
||||
</resources>
|
9
app/src/main/res/values/integers.xml
Executable file
9
app/src/main/res/values/integers.xml
Executable file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<integer name="detailCoordinatorChangeOffset">300</integer>
|
||||
<integer name="detailCoordinatorOffset">488</integer>
|
||||
|
||||
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user