Minor refactoring

This commit is contained in:
Vladislav Khorev 2017-06-11 00:51:16 +03:00
parent 6a51f72da4
commit 5b5ba0bde7
16 changed files with 56 additions and 63 deletions

View File

@ -12,6 +12,7 @@ import fishrungames.yelpmapapp.records.MapMarkerRecord
import fishrungames.yelpmapapp.records.ReviewListRecord import fishrungames.yelpmapapp.records.ReviewListRecord
import java.util.* import java.util.*
/** /**
* Created by mephi on 09.06.2017. * Created by mephi on 09.06.2017.
*/ */
@ -100,7 +101,7 @@ class DataProvider(
} }
HandleMapMarkersResponseAsyncTask(onUpdateMapMarkers).execute(result) HandleMapMarkersResponseAsyncTask(onUpdateMapMarkers).execute(result)
}; }
} }
@ -128,7 +129,7 @@ class DataProvider(
} }
HandleBusinessDetailResponseAsyncTask(this::handleUpdateBusinessDetail).execute(result) HandleBusinessDetailResponseAsyncTask(this::handleUpdateBusinessDetail).execute(result)
}; }
} }
fun requestReviewList(id: String) fun requestReviewList(id: String)
@ -155,7 +156,7 @@ class DataProvider(
} }
HandleReviewListResponseAsyncTask(id, this::handleUpdateReviewList).execute(result) HandleReviewListResponseAsyncTask(id, this::handleUpdateReviewList).execute(result)
}; }
} }
fun handleUpdateBusinessDetail(businessDetailRecord : BusinessDetailRecord?) fun handleUpdateBusinessDetail(businessDetailRecord : BusinessDetailRecord?)

View File

@ -3,7 +3,7 @@ package fishrungames.yelpmapapp
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import android.os.Bundle import android.os.Bundle
import android.support.design.widget.AppBarLayout import android.support.design.widget.AppBarLayout
import android.support.v7.widget.LinearLayoutCompat
import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.LinearLayoutManager
import android.view.ViewGroup import android.view.ViewGroup
@ -12,12 +12,12 @@ import android.view.View
import fishrungames.yelpmapapp.records.BusinessDetailRecord import fishrungames.yelpmapapp.records.BusinessDetailRecord
import fishrungames.yelpmapapp.records.ReviewListRecord import fishrungames.yelpmapapp.records.ReviewListRecord
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.util.Log
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import com.koushikdutta.ion.Ion import com.koushikdutta.ion.Ion
import fishrungames.yelpmapapp.records.MapMarkerRecord import fishrungames.yelpmapapp.records.MapMarkerRecord
import org.w3c.dom.Text
/** /**

View File

@ -1,17 +1,13 @@
package fishrungames.yelpmapapp package fishrungames.yelpmapapp
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import com.google.android.gms.maps.model.Marker import com.google.android.gms.maps.model.Marker
import android.widget.TextView import android.widget.TextView
import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter
import android.widget.RelativeLayout
import fishrungames.yelpmapapp.Utils.Companion.getStarRatingId import fishrungames.yelpmapapp.Utils.Companion.getStarRatingId
import java.text.DecimalFormat import java.text.DecimalFormat
@ -69,4 +65,4 @@ class YelpInfoWindowProvider(val activity: Activity) : InfoWindowAdapter {
return null return null
} }
} }

View File

@ -2,11 +2,10 @@ package fishrungames.yelpmapapp
import android.location.Location import android.location.Location
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.Marker import com.google.android.gms.maps.model.Marker
import com.google.maps.android.clustering.Cluster
import java.util.*
import com.google.maps.android.clustering.ClusterManager import com.google.maps.android.clustering.ClusterManager
import fishrungames.yelpmapapp.google.MapsActivity import fishrungames.yelpmapapp.google.MapsActivity
import fishrungames.yelpmapapp.records.BusinessDetailRecord import fishrungames.yelpmapapp.records.BusinessDetailRecord
@ -47,10 +46,6 @@ class YelpMapActivity : MapsActivity(), ClusterManager.OnClusterItemInfoWindowCl
googleMap.setOnInfoWindowClickListener(this) googleMap.setOnInfoWindowClickListener(this)
//yelpInfoWindowProvider = YelpInfoWindowProvider(this)
//googleMap.setInfoWindowAdapter(yelpInfoWindowProvider)
setUpClusterer(googleMap) setUpClusterer(googleMap)
} }
@ -107,10 +102,6 @@ class YelpMapActivity : MapsActivity(), ClusterManager.OnClusterItemInfoWindowCl
mClusterManager?.markerCollection?.setOnInfoWindowAdapter(yelpInfoWindowProvider) mClusterManager?.markerCollection?.setOnInfoWindowAdapter(yelpInfoWindowProvider)
//mClusterManager?.markerCollection?.setOnInfoWindowClickListener(this)
//mClusterManager?.setOnClusterItemInfoWindowClickListener(this)
mClusterManager?.setOnClusterItemClickListener(this) mClusterManager?.setOnClusterItemClickListener(this)
} }

View File

@ -5,7 +5,6 @@ import com.google.gson.JsonObject
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import fishrungames.yelpmapapp.records.BusinessDetailRecord import fishrungames.yelpmapapp.records.BusinessDetailRecord
import fishrungames.yelpmapapp.records.MapMarkerRecord
/** /**

View File

@ -4,8 +4,6 @@ import android.os.AsyncTask
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import fishrungames.yelpmapapp.records.BusinessDetailRecord
import fishrungames.yelpmapapp.records.MapMarkerRecord
import fishrungames.yelpmapapp.records.ReviewListRecord import fishrungames.yelpmapapp.records.ReviewListRecord
@ -30,7 +28,7 @@ class HandleReviewListResponseAsyncTask(val id: String, val onUpdateReviewList :
if (result != null) if (result != null)
{ {
resultPair = Pair<String, ReviewListRecord>(id, result); resultPair = Pair<String, ReviewListRecord>(id, result)
} }
} }

View File

@ -5,11 +5,11 @@ import android.content.pm.PackageManager
import android.location.Location import android.location.Location
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient
import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationListener
import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationRequest
import com.google.android.gms.location.LocationServices; import com.google.android.gms.location.LocationServices
import android.os.Bundle import android.os.Bundle
@ -122,7 +122,7 @@ open class MapsActivity : AppCompatActivity(), OnMapReadyCallback, LocationListe
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle("Location Permission Needed") .setTitle("Location Permission Needed")
.setMessage("This app needs the Location permission, please accept to use location functionality") .setMessage("This app needs the Location permission, please accept to use location functionality")
.setPositiveButton("OK", DialogInterface.OnClickListener { dialogInterface, i -> .setPositiveButton("OK", DialogInterface.OnClickListener { _, i ->
ActivityCompat.requestPermissions(this, ActivityCompat.requestPermissions(this,
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),

View File

@ -1,8 +1,6 @@
package fishrungames.yelpmapapp.records package fishrungames.yelpmapapp.records
import java.io.Serializable import java.io.Serializable
import com.google.gson.annotations.SerializedName
/** /**

View File

@ -19,12 +19,12 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/textView5" android:id="@+id/activityTitleTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="18dp" android:layout_marginLeft="18dp"
android:layout_marginStart="18dp" android:layout_marginStart="18dp"
android:text="Yelp Map App" android:text="@string/title_activity_maps"
android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse" /> android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse" />
</LinearLayout> </LinearLayout>

View File

@ -43,14 +43,14 @@
android:layout_gravity="bottom|left" android:layout_gravity="bottom|left"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:text="Toolbar Title" android:text=""
android:textColor="#ffffff" android:textColor="#ffffff"
android:textSize="22sp" android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
android:shadowColor="#000000" android:shadowColor="#000000"
android:shadowDx="1.5" android:shadowDx="0"
android:shadowDy="1.3" android:shadowDy="0"
android:shadowRadius="1.6"/> android:shadowRadius="1.8"/>
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -64,14 +64,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="left" android:layout_gravity="left"
android:text="Toolbar Title" android:text=""
android:textColor="#ffffff" android:textColor="#ffffff"
android:textSize="22sp" android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
android:shadowColor="#000000" android:shadowColor="#000000"
android:shadowDx="1.5" android:shadowDx="0"
android:shadowDy="1.3" android:shadowDy="0"
android:shadowRadius="1.6"/> android:shadowRadius="1.8"/>
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>

View File

@ -7,12 +7,12 @@
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Address:" android:text="@string/addressTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/> android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView <TextView
android:id="@+id/addressTextView" android:id="@+id/addressTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="123 Main st." android:text="@string/notSet"
android:textAppearance="@style/TextAppearance.AppCompat.Large"/> android:textAppearance="@style/TextAppearance.AppCompat.Large"/>
</LinearLayout> </LinearLayout>

View File

@ -8,14 +8,14 @@
android:id="@+id/ratingTitleTextView" android:id="@+id/ratingTitleTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Rating:" android:text="@string/ratingTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView <TextView
android:id="@+id/ratingTextView" android:id="@+id/ratingTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="5.0" /> android:text="@string/notSet" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -29,14 +29,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="TextView" android:text="@string/notSet"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView <TextView
android:id="@+id/ratingTextView" android:id="@+id/ratingTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TextView" android:text="@string/notSet"
android:textAppearance="@style/TextAppearance.AppCompat.Small" /> android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<LinearLayout <LinearLayout
@ -84,14 +84,14 @@
android:id="@+id/messageTextView" android:id="@+id/messageTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView TextView" android:text="@string/notSet"
android:textAppearance="@style/TextAppearance.AppCompat.Small" /> android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView <TextView
android:id="@+id/dateTextView" android:id="@+id/dateTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TextView" android:text="@string/notSet"
android:textAppearance="@style/TextAppearance.AppCompat.Small" /> android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout> </LinearLayout>

View File

@ -7,13 +7,14 @@
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Reviews:" android:layout_marginTop="12dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/> android:text="@string/reviewsTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView <TextView
android:id="@+id/noReviewsTextView" android:id="@+id/noReviewsTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="No reviews yet" android:text="@string/noReviewsYet"
android:textAppearance="@style/TextAppearance.AppCompat.Large"/> android:textAppearance="@style/TextAppearance.AppCompat.Large"/>
<ProgressBar <ProgressBar

View File

@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
android:text="McDonalds" android:text=""
android:textAppearance="@style/TextAppearance.AppCompat.Large" /> android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<ImageView <ImageView
@ -29,14 +29,14 @@
android:id="@+id/ratingTitleTextView" android:id="@+id/ratingTitleTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Rating:" android:text="@string/ratingTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView <TextView
android:id="@+id/ratingTextView" android:id="@+id/ratingTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="5.0" /> android:text="@string/notSet" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -90,14 +90,14 @@
android:id="@+id/addressTitleTextView" android:id="@+id/addressTitleTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Address:" android:text="@string/addressTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView <TextView
android:id="@+id/addressTextView" android:id="@+id/addressTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="123 Main" /> android:text="@string/notSet" />
</LinearLayout> </LinearLayout>

View File

@ -1,4 +1,13 @@
<resources> <resources>
<string name="app_name">YelpMapApp</string> <string name="app_name">YelpMapApp</string>
<string name="title_activity_maps">Yelp Map App</string> <string name="title_activity_maps">Yelp Map App</string>
<string name="addressTitle">Address:</string>
<string name="phoneTitle">Phone:</string>
<string name="ratingTitle">Rating:</string>
<string name="reviewsTitle">Reviews:</string>
<string name="noReviewsYet">No reviews yet</string>
<string name="notSet">Not set</string>
</resources> </resources>