From 5b5ba0bde76974f9986cebb37d7f54c93d46b494 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 11 Jun 2017 00:51:16 +0300 Subject: [PATCH] Minor refactoring --- .../fishrungames/yelpmapapp/DataProvider.kt | 7 ++++--- .../fishrungames/yelpmapapp/DetailFragment.kt | 6 +++--- .../yelpmapapp/YelpInfoWindowProvider.kt | 8 ++------ .../yelpmapapp/YelpMapActivity.kt | 13 ++---------- .../HandleBusinessDetailResponseAsyncTask.kt | 1 - .../HandleReviewListResponseAsyncTask.kt | 4 +--- .../yelpmapapp/google/MapsActivity.kt | 12 +++++------ .../yelpmapapp/records/MapMarkerRecord.kt | 2 -- app/src/main/res/layout/activity_maps.xml | 4 ++-- app/src/main/res/layout/detail_fragment.xml | 20 +++++++++---------- app/src/main/res/layout/recycler_address.xml | 4 ++-- app/src/main/res/layout/recycler_rating.xml | 4 ++-- app/src/main/res/layout/recycler_review.xml | 8 ++++---- .../main/res/layout/recycler_review_title.xml | 7 ++++--- .../main/res/layout/yelp_info_contents.xml | 10 +++++----- app/src/main/res/values/strings.xml | 9 +++++++++ 16 files changed, 56 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt b/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt index 6b91614..374082d 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt @@ -12,6 +12,7 @@ import fishrungames.yelpmapapp.records.MapMarkerRecord import fishrungames.yelpmapapp.records.ReviewListRecord import java.util.* + /** * Created by mephi on 09.06.2017. */ @@ -100,7 +101,7 @@ class DataProvider( } HandleMapMarkersResponseAsyncTask(onUpdateMapMarkers).execute(result) - }; + } } @@ -128,7 +129,7 @@ class DataProvider( } HandleBusinessDetailResponseAsyncTask(this::handleUpdateBusinessDetail).execute(result) - }; + } } fun requestReviewList(id: String) @@ -155,7 +156,7 @@ class DataProvider( } HandleReviewListResponseAsyncTask(id, this::handleUpdateReviewList).execute(result) - }; + } } fun handleUpdateBusinessDetail(businessDetailRecord : BusinessDetailRecord?) diff --git a/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt b/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt index bdd32f3..ac02c55 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt @@ -3,7 +3,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 import android.view.ViewGroup @@ -12,12 +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 + /** diff --git a/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt b/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt index 927ef32..0c99cec 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/YelpInfoWindowProvider.kt @@ -1,17 +1,13 @@ 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 @@ -69,4 +65,4 @@ class YelpInfoWindowProvider(val activity: Activity) : InfoWindowAdapter { return null } - } \ No newline at end of file +} \ No newline at end of file diff --git a/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt b/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt index f6825cd..38dddc2 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/YelpMapActivity.kt @@ -2,11 +2,10 @@ package fishrungames.yelpmapapp import android.location.Location import android.os.Bundle -import android.os.Handler + import com.google.android.gms.maps.GoogleMap 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 fishrungames.yelpmapapp.google.MapsActivity import fishrungames.yelpmapapp.records.BusinessDetailRecord @@ -47,10 +46,6 @@ class YelpMapActivity : MapsActivity(), ClusterManager.OnClusterItemInfoWindowCl googleMap.setOnInfoWindowClickListener(this) - //yelpInfoWindowProvider = YelpInfoWindowProvider(this) - - //googleMap.setInfoWindowAdapter(yelpInfoWindowProvider) - setUpClusterer(googleMap) } @@ -107,10 +102,6 @@ class YelpMapActivity : MapsActivity(), ClusterManager.OnClusterItemInfoWindowCl mClusterManager?.markerCollection?.setOnInfoWindowAdapter(yelpInfoWindowProvider) - //mClusterManager?.markerCollection?.setOnInfoWindowClickListener(this) - - //mClusterManager?.setOnClusterItemInfoWindowClickListener(this) - mClusterManager?.setOnClusterItemClickListener(this) } diff --git a/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleBusinessDetailResponseAsyncTask.kt b/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleBusinessDetailResponseAsyncTask.kt index 3d3c294..deab8a1 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleBusinessDetailResponseAsyncTask.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleBusinessDetailResponseAsyncTask.kt @@ -5,7 +5,6 @@ import com.google.gson.JsonObject import com.google.gson.Gson import com.google.gson.reflect.TypeToken import fishrungames.yelpmapapp.records.BusinessDetailRecord -import fishrungames.yelpmapapp.records.MapMarkerRecord /** diff --git a/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleReviewListResponseAsyncTask.kt b/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleReviewListResponseAsyncTask.kt index d1062b3..a5290dd 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleReviewListResponseAsyncTask.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/asyncTasks/HandleReviewListResponseAsyncTask.kt @@ -4,8 +4,6 @@ import android.os.AsyncTask import com.google.gson.JsonObject import com.google.gson.Gson import com.google.gson.reflect.TypeToken -import fishrungames.yelpmapapp.records.BusinessDetailRecord -import fishrungames.yelpmapapp.records.MapMarkerRecord import fishrungames.yelpmapapp.records.ReviewListRecord @@ -30,7 +28,7 @@ class HandleReviewListResponseAsyncTask(val id: String, val onUpdateReviewList : if (result != null) { - resultPair = Pair(id, result); + resultPair = Pair(id, result) } } diff --git a/app/src/main/java/fishrungames/yelpmapapp/google/MapsActivity.kt b/app/src/main/java/fishrungames/yelpmapapp/google/MapsActivity.kt index b61f328..dcb9bca 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/google/MapsActivity.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/google/MapsActivity.kt @@ -5,11 +5,11 @@ import android.content.pm.PackageManager import android.location.Location -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.location.LocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationServices; +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.api.GoogleApiClient +import com.google.android.gms.location.LocationListener +import com.google.android.gms.location.LocationRequest +import com.google.android.gms.location.LocationServices import android.os.Bundle @@ -122,7 +122,7 @@ open class MapsActivity : AppCompatActivity(), OnMapReadyCallback, LocationListe AlertDialog.Builder(this) .setTitle("Location Permission Needed") .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, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), diff --git a/app/src/main/java/fishrungames/yelpmapapp/records/MapMarkerRecord.kt b/app/src/main/java/fishrungames/yelpmapapp/records/MapMarkerRecord.kt index b986311..69a9eb0 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/records/MapMarkerRecord.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/records/MapMarkerRecord.kt @@ -1,8 +1,6 @@ package fishrungames.yelpmapapp.records import java.io.Serializable -import com.google.gson.annotations.SerializedName - /** diff --git a/app/src/main/res/layout/activity_maps.xml b/app/src/main/res/layout/activity_maps.xml index 700efd3..1c13d61 100755 --- a/app/src/main/res/layout/activity_maps.xml +++ b/app/src/main/res/layout/activity_maps.xml @@ -19,12 +19,12 @@ android:orientation="vertical"> diff --git a/app/src/main/res/layout/detail_fragment.xml b/app/src/main/res/layout/detail_fragment.xml index 65f2fda..bdf6d7d 100755 --- a/app/src/main/res/layout/detail_fragment.xml +++ b/app/src/main/res/layout/detail_fragment.xml @@ -43,14 +43,14 @@ android:layout_gravity="bottom|left" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" - android:text="Toolbar Title" + android:text="" android:textColor="#ffffff" - android:textSize="22sp" + android:textSize="24sp" android:textStyle="bold" android:shadowColor="#000000" - android:shadowDx="1.5" - android:shadowDy="1.3" - android:shadowRadius="1.6"/> + android:shadowDx="0" + android:shadowDy="0" + android:shadowRadius="1.8"/> + android:shadowDx="0" + android:shadowDy="0" + android:shadowRadius="1.8"/> diff --git a/app/src/main/res/layout/recycler_address.xml b/app/src/main/res/layout/recycler_address.xml index 4b929cc..4c64e36 100755 --- a/app/src/main/res/layout/recycler_address.xml +++ b/app/src/main/res/layout/recycler_address.xml @@ -7,12 +7,12 @@ android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Address:" + android:text="@string/addressTitle" android:textAppearance="@style/TextAppearance.AppCompat.Medium"/> \ No newline at end of file diff --git a/app/src/main/res/layout/recycler_rating.xml b/app/src/main/res/layout/recycler_rating.xml index e43b8af..0010649 100755 --- a/app/src/main/res/layout/recycler_rating.xml +++ b/app/src/main/res/layout/recycler_rating.xml @@ -8,14 +8,14 @@ android:id="@+id/ratingTitleTextView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Rating:" + android:text="@string/ratingTitle" android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> + android:text="@string/notSet" /> diff --git a/app/src/main/res/layout/recycler_review_title.xml b/app/src/main/res/layout/recycler_review_title.xml index 11ab767..c8d3cc9 100755 --- a/app/src/main/res/layout/recycler_review_title.xml +++ b/app/src/main/res/layout/recycler_review_title.xml @@ -7,13 +7,14 @@ android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Reviews:" - android:textAppearance="@style/TextAppearance.AppCompat.Medium"/> + android:layout_marginTop="12dp" + android:text="@string/reviewsTitle" + android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> + android:text="@string/notSet" /> + android:text="@string/notSet" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 00c45f1..e1a0739 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,13 @@ YelpMapApp Yelp Map App + + Address: + Phone: + Rating: + Reviews: + No reviews yet + Not set + +