From d9b55bceab93f3f14799a5a16c391e695ea812ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C3=B3=C5=82grabia?= Date: Thu, 6 Oct 2016 20:37:54 +0200 Subject: [PATCH] Preparings to allow user set all settings for google places. --- .../urbanexplorer/AppConstants.java | 4 +- .../urbanexplorer/fragments/HomeFragment.java | 1 + .../fragments/PlacesFragment.java | 16 ++ .../fragments/WikiLocationsFragment.java | 1 + app/src/main/res/values/strings.xml | 231 ++++++++++++++++++ app/src/main/res/xml/urban_expl_settings.xml | 24 ++ .../constants/GooglePlacesConstants.java | 2 - 7 files changed, 274 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java index 204d295..ae5695a 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/AppConstants.java @@ -14,13 +14,11 @@ public class AppConstants { public static final String PREF_GPS_UPDATE_FREQ = "pref_gps_update_freq"; public static final String PREF_GPS_DISTANCE_FREQ = "pref_gps_distance_freq"; public static final String PHOTO_BACKSTACK = "PHOTO_BACKSTACK"; - static final int HOME_FRAGMENT_ID = 0; - static final int WIKI_FRAGMENT_ID = 1; static final String FRAG_ID = "FRAG_ID"; static final int SETTINGS_ID_INTENT_REQUEST_ID = 2; static final String PHOTO_INFO = "PHOTO_INFO"; static final String SAVED_CONFIG_KEY = "SAVED_CONFIG_KEY"; public static final String GOOGLE_API_KEY = "AIzaSyBAJoK-pu_qnQ0U8EGjM1Zkz_g8oJV4w2g"; public static final String DEF_WIKI_COUNTRY_CODE = "en"; - public static final Double DEF_PLACES_RADIUS = 10000.0; + public static final Double DEF_PLACES_RADIUS = 5000.0; } 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 975fa82..ee832ce 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java @@ -229,6 +229,7 @@ public class HomeFragment extends Fragment { @Subscribe public void refresh(RefreshEvent refreshEvent) { + lg.debug("Refreshing event..."); lg.trace("Fetch panoramio photos"); final FragmentActivity activity = getActivity(); if (activity == null) { diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java index 30a21ed..7d10bb6 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java @@ -10,6 +10,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.greenrobot.eventbus.EventBus; @@ -96,6 +97,11 @@ public class PlacesFragment extends Fragment { return; } + Toast.makeText(getActivity(), + String.format("Location changed: %.3f,%.3f", + location.getLatitude(), location.getLongitude()), + Toast.LENGTH_SHORT).show(); + places = null; nextPageToken = null; noMoreResults = false; @@ -208,8 +214,13 @@ public class PlacesFragment extends Fragment { private void fetchNearbyPlacesAndPresent(Location location) { if (!semaphore.tryAcquire()) { // running + lg.debug("Active fetching nearby, quitting..."); return; } + Toast.makeText(getActivity(), + String.format("Fetching nearby places %.3f,%.3f", location.getLatitude(), location.getLongitude()), + Toast.LENGTH_SHORT).show(); + GooglePlacesRequest request = new GooglePlacesRequest(); request.setLocation(location); @@ -222,10 +233,12 @@ public class PlacesFragment extends Fragment { if (!semaphore.tryAcquire()) { // running + lg.debug("Active fetching nearby, quitting..."); return; } if (noMoreResults) { + lg.debug("There is no results, quitting..."); semaphore.release(); return; } @@ -311,6 +324,9 @@ public class PlacesFragment extends Fragment { @Subscribe public void refresh(RefreshEvent event) { + lg.debug("Refreshing event..."); + Toast.makeText(getActivity(), "Refreshing event google places", Toast.LENGTH_SHORT).show(); + pageId = 0L; places = null; nextPageToken = null; noMoreResults = false; 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 1d764d6..12e627e 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/WikiLocationsFragment.java @@ -161,6 +161,7 @@ public class WikiLocationsFragment extends Fragment { @Subscribe public void refresh(RefreshEvent event) { + lg.debug("Refreshing event..."); appObjects.clear(); fetchWikiLocations(); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 596ea10..adfb6ff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,4 +54,235 @@ Upload date: Location: Panoramio url: + + + accounting + airport + amusement_park + aquarium + art_gallery + atm + bakery + bank + bar + beauty_salon + bicycle_store + book_store + bowling_alley + bus_station + cafe + campground + car_dealer + car_rental + car_repair + car_wash + casino + cemetery + church + city_hall + clothing_store + convenience_store + courthouse + dentist + department_store + doctor + electrician + electronics_store + embassy + fire_station + florist + funeral_home + furniture_store + gas_station + gym + hair_care + hardware_store + hindu_temple + home_goods_store + hospital + insurance_agency + jewelry_store + laundry + lawyer + library + liquor_store + local_government_office + locksmith + lodging + meal_delivery + meal_takeaway + mosque + movie_rental + movie_theater + moving_company + museum + night_club + painter + park + parking + pet_store + pharmacy + physiotherapist + plumber + police + post_office + real_estate_agency + restaurant + roofing_contractor + rv_park + school + shoe_store + shopping_mall + spa + stadium + storage + store + subway_station + synagogue + taxi_stand + train_station + transit_station + travel_agency + university + veterinary_care + zoo + + + + airport + amusement_park + aquarium + art_gallery + bar + beauty_salon + bowling_alley + cafe + campground + casino + cemetery + church + city_hall + clothing_store + department_store + embassy + gym + hair_care + hindu_temple + jewelry_store + liquor_store + meal_delivery + meal_takeaway + mosque + museum + night_club + park + restaurant + rv_park + shoe_store + shopping_mall + spa + stadium + store + subway_station + synagogue + taxi_stand + train_station + transit_station + travel_agency + university + zoo + + + + Accounting + Airport + Amusement park + Aquarium + Art gallery + ATM + Bakery + Bank + Bar + Beauty salon + Bicycle store + Book store + Bowling alley + Bus station + Cafe + Campground + Car dealer + Car rental + Car repair + Car wash + Casino + Cemetery + Church + City hall + Clothing store + Convenience store + Courthouse + Dentist + Department store + Doctor + Electrician + Electronics store + Embassy + Fire station + Florist + Funeral home + Furniture store + Gas station + Gym + Hair care + Hardware store + Hindu temple + Home goods store + Hospital + Insurance agency + Jewelry store + Laundry + Lawyer + Library + Liquor store + Local government office + Locksmith + Lodging + Meal delivery + Meal takeaway + Mosque + Movie rental + Movie theater + Moving company + Museum + Night club + Painter + Park + Parking + Pet store + Pharmacy + Physiotherapist + Plumber + Police + Post office + Real estate agency + Restaurant + Roofing contractor + Rv park + School + Shoe store + Shopping mall + SPA + Stadium + Storage + Store + Subway station + Synagogue + Taxi stand + Train station + Transit station + Travel agency + University + Veterinary care + Zoo + diff --git a/app/src/main/res/xml/urban_expl_settings.xml b/app/src/main/res/xml/urban_expl_settings.xml index 3c42f20..87665c1 100644 --- a/app/src/main/res/xml/urban_expl_settings.xml +++ b/app/src/main/res/xml/urban_expl_settings.xml @@ -67,6 +67,30 @@ android:inputType="numberDecimal" /> + + + + + + + + + + +