Restored geocoder into app.

master
Tomasz Półgrabia 2016-09-27 22:03:53 +02:00
parent b0a52e0d15
commit 0e5aa11b7a
6 changed files with 21 additions and 20 deletions

View File

@ -80,5 +80,5 @@ dependencies {
compile project(':panoramiobindings') compile project(':panoramiobindings')
compile project(':urbanexplorerutils') compile project(':urbanexplorerutils')
compile project(':wikibinding') compile project(':wikibinding')
// compile project(':googleutils') compile project(':googleutils')
} }

View File

@ -2,14 +2,13 @@ package pl.tpolgrabia.urbanexplorer.callbacks.geocoder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback;
import pl.tpolgrabia.urbanexplorer.fragments.HomeFragment; import pl.tpolgrabia.urbanexplorer.fragments.HomeFragment;
//import pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback;
/** /**
* Created by tpolgrabia on 21.09.16. * Created by tpolgrabia on 21.09.16.
*/ */
public class GeocodedLocationCallback { public class GeocodedLocationCallback implements LocationGeoCoderCallback {
// implements LocationGeoCoderCallback {
private static final Logger lg = LoggerFactory.getLogger(GeocodedLocationCallback.class); private static final Logger lg = LoggerFactory.getLogger(GeocodedLocationCallback.class);
private HomeFragment homeFragment; private HomeFragment homeFragment;
@ -17,7 +16,7 @@ public class GeocodedLocationCallback {
this.homeFragment = homeFragment; this.homeFragment = homeFragment;
} }
// @Override @Override
public void callback(int code, String message, String googleStatus, String geocodedLocation) { public void callback(int code, String message, String googleStatus, String geocodedLocation) {
lg.debug("Geocoded result code {}, message {}, status: {}, value {}", lg.debug("Geocoded result code {}, message {}, status: {}, value {}",
code, message, googleStatus, geocodedLocation); code, message, googleStatus, geocodedLocation);

View File

@ -2,13 +2,13 @@ package pl.tpolgrabia.urbanexplorer.callbacks.wiki;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback;
import pl.tpolgrabia.urbanexplorer.fragments.WikiLocationsFragment; import pl.tpolgrabia.urbanexplorer.fragments.WikiLocationsFragment;
/** /**
* Created by tpolgrabia on 24.09.16. * Created by tpolgrabia on 24.09.16.
*/ */
public class WikiLocationGeoCoderCallback { public class WikiLocationGeoCoderCallback implements LocationGeoCoderCallback {
// implements LocationGeoCoderCallback {
private static final Logger lg = LoggerFactory.getLogger(WikiLocationGeoCoderCallback.class); private static final Logger lg = LoggerFactory.getLogger(WikiLocationGeoCoderCallback.class);
private WikiLocationsFragment wikiLocationsFragment; private WikiLocationsFragment wikiLocationsFragment;
@ -16,7 +16,7 @@ public class WikiLocationGeoCoderCallback {
this.wikiLocationsFragment = wikiLocationsFragment; this.wikiLocationsFragment = wikiLocationsFragment;
} }
// @Override @Override
public void callback(int code, String message, String googleStatus, String geocodedLocation) { public void callback(int code, String message, String googleStatus, String geocodedLocation) {
lg.debug("Geocoded result code {}, message {}, status: {}, value {}", lg.debug("Geocoded result code {}, message {}, status: {}, value {}",
code, message, googleStatus, geocodedLocation); code, message, googleStatus, geocodedLocation);

View File

@ -16,6 +16,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// import pl.tpolgrabia.googleutils.utils.GeocoderUtils; // import pl.tpolgrabia.googleutils.utils.GeocoderUtils;
import pl.tpolgrabia.googleutils.utils.GeocoderUtils;
import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils; import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils;
import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.AppConstants;
import pl.tpolgrabia.urbanexplorer.MainActivity; import pl.tpolgrabia.urbanexplorer.MainActivity;
@ -55,7 +56,7 @@ public class HomeFragment extends Fragment {
private ArrayList<PanoramioImageInfo> photos; private ArrayList<PanoramioImageInfo> photos;
private boolean noMorePhotos; private boolean noMorePhotos;
private String currentGeocodedLocation; private String currentGeocodedLocation;
// private GeocoderUtils geocoderUtils; private GeocoderUtils geocoderUtils;
public HomeFragment() { public HomeFragment() {
// Required empty public constructor // Required empty public constructor
@ -78,7 +79,7 @@ public class HomeFragment extends Fragment {
final StandardLocationListener locationCallback = mainActivity.getLocationCallback(); final StandardLocationListener locationCallback = mainActivity.getLocationCallback();
locationCallback.addCallback(new PanoramioLocationCallback(this)); locationCallback.addCallback(new PanoramioLocationCallback(this));
locationCallback.addProviderCallback(new PanoramioProviderCallback(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() { public void updateGeocodedLocation() {
@ -94,10 +95,10 @@ public class HomeFragment extends Fragment {
return; return;
} }
// geocoderUtils.getGeoCodedLocation( geocoderUtils.getGeoCodedLocation(
// currLocation.getLatitude(), currLocation.getLatitude(),
// currLocation.getLongitude(), currLocation.getLongitude(),
// new GeocodedLocationCallback(this)); new GeocodedLocationCallback(this));
} }

View File

@ -15,6 +15,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pl.tpolgrabia.googleutils.utils.GeocoderUtils;
import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.AppConstants;
import pl.tpolgrabia.urbanexplorer.MainActivity; import pl.tpolgrabia.urbanexplorer.MainActivity;
import pl.tpolgrabia.urbanexplorer.R; import pl.tpolgrabia.urbanexplorer.R;
@ -44,7 +45,7 @@ public class WikiLocationsFragment extends Fragment {
private ArrayList<WikiAppObject> appObjects = new ArrayList<>(); private ArrayList<WikiAppObject> appObjects = new ArrayList<>();
private int lastFetchSize = -1; private int lastFetchSize = -1;
private String currentGeocodedLocation; private String currentGeocodedLocation;
//private GeocoderUtils geocoderUtils; private GeocoderUtils geocoderUtils;
public WikiLocationsFragment() { public WikiLocationsFragment() {
// Required empty public constructor // Required empty public constructor
@ -61,7 +62,7 @@ public class WikiLocationsFragment extends Fragment {
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
appObjects = WikiCacheUtils.loadWikiObjectsFromCache(getActivity(), savedInstanceState); appObjects = WikiCacheUtils.loadWikiObjectsFromCache(getActivity(), savedInstanceState);
// geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY); geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY);
} }
@Override @Override
@ -126,7 +127,7 @@ public class WikiLocationsFragment extends Fragment {
} }
private void updateGeocodedLocation() { private void updateGeocodedLocation() {
// geocoderUtils.getGeoCodedLocation(new WikiLocationGeoCoderCallback(this)); geocoderUtils.getGeoCodedLocation(new WikiLocationGeoCoderCallback(this));
} }
public void updateLocationInfo() { public void updateLocationInfo() {

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 24 compileSdkVersion 21
buildToolsVersion "24.0.2" buildToolsVersion "24.0.2"
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 24 targetSdkVersion 21
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
@ -21,7 +21,7 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' 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 'org.slf4j:slf4j-api:1.7.21'
compile 'com.github.tony19:logback-android-core:1.1.1-6' compile 'com.github.tony19:logback-android-core:1.1.1-6'