From 0e5aa11b7a53289ed650636678fd11b33e709819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C3=B3=C5=82grabia?= Date: Tue, 27 Sep 2016 22:03:53 +0200 Subject: [PATCH] Restored geocoder into app. --- app/build.gradle | 2 +- .../geocoder/GeocodedLocationCallback.java | 7 +++---- .../wiki/WikiLocationGeoCoderCallback.java | 6 +++--- .../urbanexplorer/fragments/HomeFragment.java | 13 +++++++------ .../fragments/WikiLocationsFragment.java | 7 ++++--- googleutils/build.gradle | 6 +++--- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ace7330..d450bb3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,5 +80,5 @@ dependencies { compile project(':panoramiobindings') compile project(':urbanexplorerutils') compile project(':wikibinding') - // compile project(':googleutils') + compile project(':googleutils') } diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/geocoder/GeocodedLocationCallback.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/geocoder/GeocodedLocationCallback.java index 08fd2c1..f4377b8 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/geocoder/GeocodedLocationCallback.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/geocoder/GeocodedLocationCallback.java @@ -2,14 +2,13 @@ package pl.tpolgrabia.urbanexplorer.callbacks.geocoder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback; import pl.tpolgrabia.urbanexplorer.fragments.HomeFragment; -//import pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback; /** * Created by tpolgrabia on 21.09.16. */ -public class GeocodedLocationCallback { - // implements LocationGeoCoderCallback { +public class GeocodedLocationCallback implements LocationGeoCoderCallback { private static final Logger lg = LoggerFactory.getLogger(GeocodedLocationCallback.class); private HomeFragment homeFragment; @@ -17,7 +16,7 @@ public class GeocodedLocationCallback { this.homeFragment = homeFragment; } - // @Override + @Override public void callback(int code, String message, String googleStatus, String geocodedLocation) { lg.debug("Geocoded result code {}, message {}, status: {}, value {}", code, message, googleStatus, geocodedLocation); diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/wiki/WikiLocationGeoCoderCallback.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/wiki/WikiLocationGeoCoderCallback.java index 8cd43e6..1419a47 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/wiki/WikiLocationGeoCoderCallback.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/callbacks/wiki/WikiLocationGeoCoderCallback.java @@ -2,13 +2,13 @@ package pl.tpolgrabia.urbanexplorer.callbacks.wiki; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback; import pl.tpolgrabia.urbanexplorer.fragments.WikiLocationsFragment; /** * Created by tpolgrabia on 24.09.16. */ -public class WikiLocationGeoCoderCallback { - // implements LocationGeoCoderCallback { +public class WikiLocationGeoCoderCallback implements LocationGeoCoderCallback { private static final Logger lg = LoggerFactory.getLogger(WikiLocationGeoCoderCallback.class); private WikiLocationsFragment wikiLocationsFragment; @@ -16,7 +16,7 @@ public class WikiLocationGeoCoderCallback { this.wikiLocationsFragment = wikiLocationsFragment; } - // @Override + @Override public void callback(int code, String message, String googleStatus, String geocodedLocation) { lg.debug("Geocoded result code {}, message {}, status: {}, value {}", code, message, googleStatus, geocodedLocation); diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java index e7d5ae0..d776939 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java @@ -16,6 +16,7 @@ import org.greenrobot.eventbus.Subscribe; import org.slf4j.Logger; import org.slf4j.LoggerFactory; // import pl.tpolgrabia.googleutils.utils.GeocoderUtils; +import pl.tpolgrabia.googleutils.utils.GeocoderUtils; import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils; import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.MainActivity; @@ -55,7 +56,7 @@ public class HomeFragment extends Fragment { private ArrayList photos; private boolean noMorePhotos; private String currentGeocodedLocation; - // private GeocoderUtils geocoderUtils; + private GeocoderUtils geocoderUtils; public HomeFragment() { // Required empty public constructor @@ -78,7 +79,7 @@ public class HomeFragment extends Fragment { final StandardLocationListener locationCallback = mainActivity.getLocationCallback(); locationCallback.addCallback(new PanoramioLocationCallback(this)); locationCallback.addProviderCallback(new PanoramioProviderCallback(this)); - //geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY); + geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY); } public void updateGeocodedLocation() { @@ -94,10 +95,10 @@ public class HomeFragment extends Fragment { return; } -// geocoderUtils.getGeoCodedLocation( -// currLocation.getLatitude(), -// currLocation.getLongitude(), -// new GeocodedLocationCallback(this)); + geocoderUtils.getGeoCodedLocation( + currLocation.getLatitude(), + currLocation.getLongitude(), + new GeocodedLocationCallback(this)); } diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java index ba20c30..094276c 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java @@ -15,6 +15,7 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import pl.tpolgrabia.googleutils.utils.GeocoderUtils; import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.MainActivity; import pl.tpolgrabia.urbanexplorer.R; @@ -44,7 +45,7 @@ public class WikiLocationsFragment extends Fragment { private ArrayList appObjects = new ArrayList<>(); private int lastFetchSize = -1; private String currentGeocodedLocation; - //private GeocoderUtils geocoderUtils; + private GeocoderUtils geocoderUtils; public WikiLocationsFragment() { // Required empty public constructor @@ -61,7 +62,7 @@ public class WikiLocationsFragment extends Fragment { public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); appObjects = WikiCacheUtils.loadWikiObjectsFromCache(getActivity(), savedInstanceState); - // geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY); + geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY); } @Override @@ -126,7 +127,7 @@ public class WikiLocationsFragment extends Fragment { } private void updateGeocodedLocation() { - // geocoderUtils.getGeoCodedLocation(new WikiLocationGeoCoderCallback(this)); + geocoderUtils.getGeoCodedLocation(new WikiLocationGeoCoderCallback(this)); } public void updateLocationInfo() { diff --git a/googleutils/build.gradle b/googleutils/build.gradle index b3a0e4f..404c7d3 100644 --- a/googleutils/build.gradle +++ b/googleutils/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 24 + compileSdkVersion 21 buildToolsVersion "24.0.2" defaultConfig { minSdkVersion 16 - targetSdkVersion 24 + targetSdkVersion 21 versionCode 1 versionName "1.0" } @@ -21,7 +21,7 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:24.2.1' + compile 'com.android.support:appcompat-v7:21.0.3' compile 'org.slf4j:slf4j-api:1.7.21' compile 'com.github.tony19:logback-android-core:1.1.1-6'