From 6a51f72da495e011a3bd8b204509a9d9df6d72ee Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 11 Jun 2017 00:36:59 +0300 Subject: [PATCH] Added stroke and cache for data --- .../java/fishrungames/yelpmapapp/DataProvider.kt | 8 ++++++++ .../java/fishrungames/yelpmapapp/DetailFragment.kt | 2 +- app/src/main/res/layout/detail_fragment.xml | 12 ++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt b/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt index 231116d..6b91614 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/DataProvider.kt @@ -106,6 +106,10 @@ class DataProvider( fun requestBusinessDetail(id: String) { + if (reviewListCache.containsKey(id) && reviewListCache[id] != null) + { + onUpdateReviewList(reviewListCache[id]!!) + } Ion.with(context) .load("https://api.yelp.com/v3/businesses/${id}") @@ -129,6 +133,10 @@ class DataProvider( fun requestReviewList(id: String) { + if (businessDetailCache.containsKey(id) && businessDetailCache[id] != null) + { + onUpdateBusinessDetail(businessDetailCache[id]!!) + } Ion.with(context) .load("https://api.yelp.com/v3/businesses/${id}/reviews") diff --git a/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt b/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt index e50a699..bdd32f3 100755 --- a/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt +++ b/app/src/main/java/fishrungames/yelpmapapp/DetailFragment.kt @@ -43,7 +43,7 @@ class DetailFragment : Fragment() 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 diff --git a/app/src/main/res/layout/detail_fragment.xml b/app/src/main/res/layout/detail_fragment.xml index e99af4b..65f2fda 100755 --- a/app/src/main/res/layout/detail_fragment.xml +++ b/app/src/main/res/layout/detail_fragment.xml @@ -46,7 +46,11 @@ android:text="Toolbar Title" android:textColor="#ffffff" android:textSize="22sp" - android:textStyle="bold" /> + android:textStyle="bold" + android:shadowColor="#000000" + android:shadowDx="1.5" + android:shadowDy="1.3" + android:shadowRadius="1.6"/> + android:textStyle="bold" + android:shadowColor="#000000" + android:shadowDx="1.5" + android:shadowDy="1.3" + android:shadowRadius="1.6"/>