diff --git a/app/build.gradle b/app/build.gradle index b06da77..ace7330 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,4 +80,5 @@ dependencies { compile project(':panoramiobindings') compile project(':urbanexplorerutils') compile project(':wikibinding') + // 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 0f6d636..08fd2c1 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 @@ -3,12 +3,13 @@ package pl.tpolgrabia.urbanexplorer.callbacks.geocoder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pl.tpolgrabia.urbanexplorer.fragments.HomeFragment; -import pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback; +//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; @@ -16,7 +17,7 @@ public class GeocodedLocationCallback implements LocationGeoCoderCallback { 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 a99ac3d..8cd43e6 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 @@ -7,7 +7,8 @@ import pl.tpolgrabia.urbanexplorer.fragments.WikiLocationsFragment; /** * Created by tpolgrabia on 24.09.16. */ -public class WikiLocationGeoCoderCallback implements pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback { +public class WikiLocationGeoCoderCallback { + // implements LocationGeoCoderCallback { private static final Logger lg = LoggerFactory.getLogger(WikiLocationGeoCoderCallback.class); private WikiLocationsFragment wikiLocationsFragment; @@ -15,7 +16,7 @@ public class WikiLocationGeoCoderCallback implements pl.tpolgrabia.urbanexplorer 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 1eda814..e7d5ae0 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.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.panoramiobindings.utils.PanoramioUtils; import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.MainActivity; @@ -54,7 +55,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 @@ -77,7 +78,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() { @@ -93,10 +94,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 65065db..ba20c30 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java @@ -44,7 +44,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 +61,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 +126,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/.gitignore b/googleutils/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/googleutils/.gitignore @@ -0,0 +1 @@ +/build diff --git a/googleutils/build.gradle b/googleutils/build.gradle new file mode 100644 index 0000000..b3a0e4f --- /dev/null +++ b/googleutils/build.gradle @@ -0,0 +1,35 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 24 + buildToolsVersion "24.0.2" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:24.2.1' + + 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-classic:1.1.1-6') { + // workaround issue #73 + exclude group: 'com.google.android', module: 'android' + } + + compile 'com.googlecode.android-query:android-query:0.25.9' + compile project(path: ':urbanexplorerutils') +} diff --git a/googleutils/proguard-rules.pro b/googleutils/proguard-rules.pro new file mode 100644 index 0000000..f253a1f --- /dev/null +++ b/googleutils/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /home/tpolgrabia/bin/android-sdk-linux/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/googleutils/src/androidTest/java/pl/tpolgrabia/googleutils/ApplicationTest.java b/googleutils/src/androidTest/java/pl/tpolgrabia/googleutils/ApplicationTest.java new file mode 100644 index 0000000..2ca0f26 --- /dev/null +++ b/googleutils/src/androidTest/java/pl/tpolgrabia/googleutils/ApplicationTest.java @@ -0,0 +1,13 @@ +package pl.tpolgrabia.googleutils; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/googleutils/src/main/AndroidManifest.xml b/googleutils/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3667b43 --- /dev/null +++ b/googleutils/src/main/AndroidManifest.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/urbanexplorerutils/src/main/java/pl/tpolgrabia/urbanexplorerutils/callbacks/LocationGeoCoderCallback.java b/googleutils/src/main/java/pl/tpolgrabia/googleutils/callback/LocationGeoCoderCallback.java similarity index 81% rename from urbanexplorerutils/src/main/java/pl/tpolgrabia/urbanexplorerutils/callbacks/LocationGeoCoderCallback.java rename to googleutils/src/main/java/pl/tpolgrabia/googleutils/callback/LocationGeoCoderCallback.java index 8340d64..d159ec4 100644 --- a/urbanexplorerutils/src/main/java/pl/tpolgrabia/urbanexplorerutils/callbacks/LocationGeoCoderCallback.java +++ b/googleutils/src/main/java/pl/tpolgrabia/googleutils/callback/LocationGeoCoderCallback.java @@ -1,4 +1,4 @@ -package pl.tpolgrabia.urbanexplorerutils.callbacks; +package pl.tpolgrabia.googleutils.callback; /** * Created by Tomasz Półgrabia (c310702) on 20.09.2016. diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/GeocoderUtils.java b/googleutils/src/main/java/pl/tpolgrabia/googleutils/utils/GeocoderUtils.java similarity index 95% rename from app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/GeocoderUtils.java rename to googleutils/src/main/java/pl/tpolgrabia/googleutils/utils/GeocoderUtils.java index e061979..c735dd3 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/GeocoderUtils.java +++ b/googleutils/src/main/java/pl/tpolgrabia/googleutils/utils/GeocoderUtils.java @@ -1,4 +1,4 @@ -package pl.tpolgrabia.urbanexplorer.utils; +package pl.tpolgrabia.googleutils.utils; import android.content.Context; import android.location.Location; @@ -9,10 +9,8 @@ import org.json.JSONArray; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback; -import pl.tpolgrabia.urbanexplorerutils.constants.UtilConstants; +import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback; import pl.tpolgrabia.urbanexplorerutils.utils.LocationUtils; -import pl.tpolgrabia.wikibinding.utils.WikiUtils; /** * Created by tpolgrabia on 26.09.16. diff --git a/googleutils/src/main/res/values/strings.xml b/googleutils/src/main/res/values/strings.xml new file mode 100644 index 0000000..4bc2c86 --- /dev/null +++ b/googleutils/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + GoogleUtils + diff --git a/googleutils/src/test/java/pl/tpolgrabia/googleutils/ExampleUnitTest.java b/googleutils/src/test/java/pl/tpolgrabia/googleutils/ExampleUnitTest.java new file mode 100644 index 0000000..cfcc255 --- /dev/null +++ b/googleutils/src/test/java/pl/tpolgrabia/googleutils/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package pl.tpolgrabia.googleutils; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 46e5dbb..059a823 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':panoramiobindings', ':urbanexplorerutils', ':wikibinding' +include ':app', ':panoramiobindings', ':urbanexplorerutils', ':wikibinding', ':googleutils' diff --git a/wikibinding/src/main/java/pl/tpolgrabia/wikibinding/utils/WikiUtils.java b/wikibinding/src/main/java/pl/tpolgrabia/wikibinding/utils/WikiUtils.java index 8e4fc40..0f1a656 100644 --- a/wikibinding/src/main/java/pl/tpolgrabia/wikibinding/utils/WikiUtils.java +++ b/wikibinding/src/main/java/pl/tpolgrabia/wikibinding/utils/WikiUtils.java @@ -13,7 +13,6 @@ import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pl.tpolgrabia.urbanexplorerutils.callbacks.LocationGeoCoderCallback; import pl.tpolgrabia.wikibinding.callback.WikiAppResponseCallback; import pl.tpolgrabia.wikibinding.callback.WikiResponseCallback; import pl.tpolgrabia.wikibinding.callback.WikiStatus;