diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 56c15d8..75c3ddf 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -131,73 +131,69 @@ - - + + - - - - - - - - - - - - - - + + + + + + - - + + - - + + + + + + + + + - - + + - - + + + + + - - + + - - - - - - - - - - - - + + + + + + - - + + - + @@ -216,18 +212,8 @@ - - - - - - - - - - - - + + @@ -1636,7 +1622,7 @@ @@ -2003,10 +1990,10 @@ - @@ -2031,6 +2018,8 @@ + + @@ -2045,7 +2034,16 @@ - + + + + + + + + @@ -2117,6 +2115,10 @@ @@ -2178,17 +2180,6 @@ - - - - - - - - - @@ -2455,29 +2446,29 @@ - + - + - + - - + + - - + + @@ -2503,34 +2494,18 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -2549,20 +2524,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2600,20 +2567,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2632,20 +2591,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2664,20 +2615,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2732,20 +2675,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2764,20 +2699,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2796,20 +2723,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2828,20 +2747,12 @@ - - - - - - - - - - - - - - + + + + + + @@ -2907,13 +2818,6 @@ - - - - - - - @@ -2921,13 +2825,6 @@ - - - - - - - @@ -2942,17 +2839,6 @@ - - - - - - - - - - - @@ -3004,75 +2890,103 @@ - + - + - + - - - - - - - - - - - - - - - - - - + + - + - + - + - - - - - - - - - - - - + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/README.md b/README.md index b07204e..fff491a 100644 --- a/README.md +++ b/README.md @@ -27,25 +27,28 @@ If you push code, please make sure it builds correctly. Feel free to use pull re - Currently location defaults to Minneapolis (Fix this!) - Only really useful to use search - If no bathroom within 30(ish?) miles, no results are given by refuge restrooms api, so a toast displays to the user that no bathrooms are nearby -- Max locations shown initially = 20 +- Max locations shown initially: gps = 20, search = 75 - Searching with no GPS will move camera to first location found, and shows a toast saying locations were found ## TODO - [x] Search bar + - [ ] Search by address option -- need to translate address to lat/lng + - [ ] Auto-complete search - [ ] Get and set nearby location when gps is disabled (currently defaults to Minneapolis) - [ ] Populate map with nearby pins like when gps is enabled - [ ] Add list view to Drawer menu like in the original app w\ BathroomSpecsViewUpdater, DetailViewActivity (files in older commits) - [ ] Feature to save bathrooms for offline use - [ ] Detailed info button like in ios app, Add bathroom rating to info window - [ ] Indicate red markers vs blue markers for accessibility -- [ ] Settings +- [ ] Settings Menu - [ ] Add option to turn of navigation so that the blue line doesn't appear on map. - - [ ] Select number of bathrooms to show 1-50. + - [ ] Select number of bathrooms to show 1-99 (increase default) - [ ] Style - [x] Style Feedback Form better - [ ] Navigation drawer icons - [ ] Style text directions section -- directions.html - [ ] Better add bathroom section, currently just a webview + - [x] Style webview in the meantime - [ ] Contact form without email client - [ ] Update text directions while on tab - [ ] Actionbar activity depreciated (HttpClient as well) @@ -54,6 +57,9 @@ If you push code, please make sure it builds correctly. Feel free to use pull re ## Bugs - [ ] Screen rotation re-updates map to initial closest location - [ ] Turning location off after it's been on doesn't grab last known location on app reopen +- [x] Going back from text directions removes polyline +- [x] GPS not enabled message shows after every search +- [x] Searching a second time doesn't remove first search pins ## Screenshots ![](/app/src/main/res/drawable-hdpi/Screenshots/screen1.png?raw=true) diff --git a/app/build.gradle b/app/build.gradle index afc8d4b..1abd84a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { applicationId "org.refugerestrooms" minSdkVersion 14 targetSdkVersion 22 - versionCode 3 - versionName "1.01" + versionCode 4 + versionName "1.1" } buildTypes { release { diff --git a/app/src/main/java/org/refugerestrooms/servers/Server.java b/app/src/main/java/org/refugerestrooms/servers/Server.java index 0b1654a..3e47f8f 100644 --- a/app/src/main/java/org/refugerestrooms/servers/Server.java +++ b/app/src/main/java/org/refugerestrooms/servers/Server.java @@ -51,11 +51,12 @@ private RemoteCallTask setSearchTerm(String searchTerm) { @Override public URI buildUrl() throws URISyntaxException { if(!location) - // limit per_page=20 so only the 20 nearest/most relevant results display - return new URI("http://www.refugerestrooms.org:80/api/v1/restrooms/search.json?per_page=20&query=" + Uri.encode(searchTerm, "UTF-8")); + // limit per_page=75 so only the 75 most relevant results display for search + return new URI("http://www.refugerestrooms.org:80/api/v1/restrooms/search.json?per_page=75&query=" + Uri.encode(searchTerm, "UTF-8")); else { // Refuge Restrooms API bathrooms queried // http://www.refugerestrooms.org/api/docs/#!/restrooms/GET_version_restrooms_search_format + // limit per_page=20 so only the 20 nearest relevant results display for search return new URI("http://www.refugerestrooms.org:80/api/v1/restrooms/by_location.json?per_page=20&" + searchTerm); } } diff --git a/app/src/main/java/org/refugerestrooms/views/AddBathroomClient.java b/app/src/main/java/org/refugerestrooms/views/AddBathroomClient.java index e2b7b00..083a7dd 100644 --- a/app/src/main/java/org/refugerestrooms/views/AddBathroomClient.java +++ b/app/src/main/java/org/refugerestrooms/views/AddBathroomClient.java @@ -4,6 +4,8 @@ * Created by Refuge Restrooms on 7/14/2015. */ +import android.view.View; +import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; @@ -22,6 +24,8 @@ saying that the bathroom was submitted successfully (only navigation away from p Bathrooms are submitted correctly, but should probably do this without a text_directions. Note: the restroom submitted successfully message is from the refuge restrooms site, not the app. */ + view.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); + view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); if(url.equals(currentUrl)) { view.loadUrl(url); } @@ -29,12 +33,25 @@ saying that the bathroom was submitted successfully (only navigation away from p return true; } - // Removes header, footer -- areas where people can navigate away from the add a bathroom page @Override - public void onPageFinished(WebView view, String url) { + public void onPageFinished(final WebView view, String url) { + // Removes header, footer -- areas where people can navigate away from the add a bathroom page view.loadUrl("javascript:(function() { " + - "document.getElementsByTagName('header')[0].style.display='none'; " + - "document.getElementsByTagName('footer')[0].style.display='none';" + + "document.getElementsByTagName('header')[0].style.display='none'; " + + "document.getElementsByTagName('footer')[0].style.display='none';" + + "document.body.style.marginLeft=\"5%\";" + + "document.body.style.marginRight=\"5%\";" + + "document.body.style.backgroundColor=\"#e9e9e9\";" + + "document.body.style.color=\"#8377AF\";" + + "document.getElementsByTagName('h5')[0].style.display='none';" + + "document.getElementsByClassName('guess-btn')[0].style.display='none';" + "})()"); + // Time Delay to prevent display showing before javascript finishes + view.postDelayed(new Runnable() { + public void run() { + view.setVisibility(View.VISIBLE); + } + }, 50); + } } diff --git a/app/src/main/java/org/refugerestrooms/views/MainActivity.java b/app/src/main/java/org/refugerestrooms/views/MainActivity.java index dc7b9c3..0f90348 100644 --- a/app/src/main/java/org/refugerestrooms/views/MainActivity.java +++ b/app/src/main/java/org/refugerestrooms/views/MainActivity.java @@ -92,7 +92,8 @@ public class MainActivity extends ActionBarActivity LatLng currentPosition; boolean mUpdatesRequested; private boolean mInProgress; - + public boolean doNotDisplayDialog = false; + public boolean onSearchAction = false; protected LatLng start; protected LatLng end; // temp lat/lng for setting up initial map @@ -431,7 +432,6 @@ void showErrorDialog(int code) { */ private CharSequence mTitle; private String mLocationTitle; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -467,8 +467,11 @@ public void onStatusChanged(String provider, int status, Bundle extras) {} } if (!gps_enabled) { - Dialog dialog = createDialog(); - dialog.show(); + // Added if statement to prevent dialog box from re-showing on search + if (!doNotDisplayDialog) { + Dialog dialog = createDialog(); + dialog.show(); + } // Tries to get data from network otherwise try { @@ -567,8 +570,11 @@ private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); - //use the query to search + // Use the query to search Server mServer = new Server(this); + // Boolean to prevent "gps not enabled" dialog box from re-showing on search + doNotDisplayDialog = true; + onSearchAction = true; mServer.performSearch(query, false); } } @@ -849,6 +855,11 @@ public void onSearchResults(List results) { numLocations = results.size(); currentLoc = new int[numLocations]; lastLoc = new int[numLocations]; + if (onSearchAction) { + // clear map markers before new displaying additional search results + mMap.clear(); + onSearchAction = false; + } for (int i = 0; i < numLocations; i++) { diff --git a/app/src/main/res/drawable-hdpi/Screenshots/screen5.png b/app/src/main/res/drawable-hdpi/Screenshots/screen5.png index 7bd2f7a..625a84e 100644 Binary files a/app/src/main/res/drawable-hdpi/Screenshots/screen5.png and b/app/src/main/res/drawable-hdpi/Screenshots/screen5.png differ diff --git a/app/src/main/res/layout/add_bathroom.xml b/app/src/main/res/layout/add_bathroom.xml index 20f9390..2ce66a4 100644 --- a/app/src/main/res/layout/add_bathroom.xml +++ b/app/src/main/res/layout/add_bathroom.xml @@ -1,6 +1,13 @@ - + \ No newline at end of file + android:visibility="invisible" + /> + \ No newline at end of file