Skip to content

Commit

Permalink
Apply finishing touches on release 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Tarazi committed Aug 18, 2016
1 parent c72a156 commit e3f37aa
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 122 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
*jks
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img alt="Get it on Google Play" src="http://steverichey.github.io/google-play-badge-svg/img/en_get.svg" />
</a>

It uses the [Yelp API](https://www.yelp.com/developers) to query for restaurants and uses the standard Android location API. It also uses [Google Maps Android API](https://developers.google.com/maps/documentation/android-api/) for displaying the location of a restaurant.
It uses the [Yelp API](https://www.yelp.com/developers) to query for restaurants and uses [Google Play Services location API](https://developers.google.com/android/reference/com/google/android/gms/location/package-summary). It also uses [Google Maps Android API](https://developers.google.com/maps/documentation/android-api/) for displaying the location of a restaurant.

## Description

Expand Down
32 changes: 1 addition & 31 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties
gradle.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Android Studio
.idea/
.gradle
/*/local.properties
/*/out
/*/*/build
/*/*/production
*.iml
*.iws
*.ipr
*~
*.swp
*.jks
*.iml
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.christarazi:MaterialShowcaseView:1.0.6'
compile 'com.github.deano2390:MaterialShowcaseView:1.1.0'
compile 'org.sufficientlysecure:html-textview:1.3'
compile 'com.github.arimorty:floatingsearchview:2.0.1'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(toolbar);
}

@Override
protected void onPause() {
super.onPause();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.chris.randomrestaurantgenerator.fragments;

import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
Expand All @@ -22,7 +23,7 @@ public class AboutFragment extends Fragment {

RelativeLayout rootLayout;
ImageView icon;
TextView appVerion;
TextView appVersion;
TextView githubLink;
HtmlTextView htmlAbout;

Expand All @@ -39,13 +40,19 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
e.printStackTrace();
}

appVerion = (TextView) rootLayout.findViewById(R.id.appVersion);
appVerion.setText(String.format("Version: %s", BuildConfig.VERSION_NAME));
appVersion = (TextView) rootLayout.findViewById(R.id.appVersion);
appVersion.setText(String.format("Version: %s", BuildConfig.VERSION_NAME));

githubLink = (TextView) rootLayout.findViewById(R.id.githubLink);
githubLink.setMovementMethod(LinkMovementMethod.getInstance());

String htmlLink = "<a href='https://github.com/christarazi/random-restaurant-generator'> Source code</a>";
githubLink.setText(Html.fromHtml(htmlLink));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
githubLink.setText(Html.fromHtml(htmlLink, Html.FROM_HTML_MODE_LEGACY));
}
else {
githubLink.setText(Html.fromHtml(htmlLink));
}

htmlAbout = (HtmlTextView) rootLayout.findViewById(R.id.htmlAbout);
htmlAbout.setHtmlFromRawResource(getActivity(), R.raw.about, new HtmlTextView.RemoteImageGetter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ public class MainActivityFragment extends Fragment implements
AsyncTask initialYelpQuery;
AsyncTask backgroundYelpQuery;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand Down Expand Up @@ -478,7 +473,6 @@ public void onPause() {
backgroundYelpQuery.cancel(true);

locationHelper.pauseAndSaveLocationUpdates();
Toast.makeText(getContext(), "onPause", Toast.LENGTH_SHORT).show();
}

@Override
Expand All @@ -495,14 +489,15 @@ public void onResume() {
public void onDestroy() {
super.onDestroy();
mapView.onDestroy();
Log.d("RRG", "Destroyed");

// Try to cancel the AsyncTask.
if (initialYelpQuery != null && initialYelpQuery.getStatus() == AsyncTask.Status.RUNNING)
initialYelpQuery.cancel(true);

if (backgroundYelpQuery != null && backgroundYelpQuery.getStatus() == AsyncTask.Status.RUNNING)
backgroundYelpQuery.cancel(true);

Log.d("RRG", "onDestroy");
}

// Google Maps API callback for MapFragment.
Expand Down Expand Up @@ -598,7 +593,7 @@ private MaterialShowcaseView buildShowcaseView(View target, uk.co.deanwild.mater
return new MaterialShowcaseView.Builder(getActivity())
.setTarget(target)
.setShape(shape)
.setMaskColour(Color.rgb(0, 166, 237))
.setMaskColour(Color.argb(230, 0, 166, 237))
.setContentText(contentText)
.setDismissText("GOT IT")
.build();
Expand Down Expand Up @@ -756,7 +751,7 @@ else if (e.getMessage().contains("No value for"))
/**
* Convert JSON to a Restaurant object that encapsulates a restaurant from Yelp.
*
* @param obj: JSONObejct that holds all restaurant info.
* @param obj: JSONObject that holds all restaurant info.
* @return Restaurant or null if an error occurs.
*/
private Restaurant convertJSONToRestaurant(JSONObject obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ protected Restaurant(Parcel in) {
reviewCount = in.readInt();
url = in.readString();
if (in.readByte() == 0x01) {
categories = new ArrayList<String>();
categories = new ArrayList<>();
in.readList(categories, String.class.getClassLoader());
} else {
categories = null;
}
if (in.readByte() == 0x01) {
address = new ArrayList<String>();
address = new ArrayList<>();
in.readList(address, String.class.getClassLoader());
} else {
address = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Arrays;
import java.util.List;

import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
Expand Down Expand Up @@ -138,7 +137,7 @@ public void onPermissionsDenied(int requestCode, List<String> perms) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(activity, R.string.string_lcoation_perm_manual, Toast.LENGTH_SHORT).show();
Toast.makeText(activity, R.string.string_location_perm_manual, Toast.LENGTH_SHORT).show();
}
};

Expand All @@ -149,17 +148,6 @@ public void onClick(DialogInterface dialog, int which) {
R.string.settings, R.string.cancel, onClickListener, Arrays.asList(PERMISSIONS));
}

// Called by EasyPermissions when permissions are granted to automatically start acquiring location.
@AfterPermissionGranted(RC_LOCATION_PERM)
private void locationPermissionsGranted() {
Log.d("RRG", "locationPermissionsGranted");
if (EasyPermissions.hasPermissions(activity, PERMISSIONS))
requestLocation();
else
EasyPermissions.requestPermissions(activity, activity.getString(R.string.string_location_permission_required),
RC_LOCATION_PERM, PERMISSIONS);
}

public void checkLocationSettings() {
PendingResult<LocationSettingsResult> result =
LocationServices.SettingsApi.checkLocationSettings(
Expand Down Expand Up @@ -215,8 +203,10 @@ public void pauseAndSaveLocationUpdates() {
progressDialog.dismiss();
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleClient, this);

if (mCurrentLocation != null)
if (mCurrentLocation != null) {
mLastLocation = mCurrentLocation;
Log.d("RRG", "Saved location on pause");
}
}

public void dismissLocationUpdater() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.chris.randomrestaurantgenerator.utils.SavedListHolder;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.Locale;

/**
Expand Down Expand Up @@ -118,7 +117,6 @@ protected Void doInBackground(Restaurant... params) {
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
ArrayList<Restaurant> r = dbHelper.getAll();
}
}

Expand All @@ -133,7 +131,6 @@ protected Void doInBackground(Restaurant... params) {
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
ArrayList<Restaurant> r = dbHelper.getAll();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.chris.randomrestaurantgenerator.utils.SavedListHolder;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.Locale;

/**
Expand Down Expand Up @@ -149,7 +148,6 @@ protected Void doInBackground(Restaurant... params) {
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
ArrayList<Restaurant> r = dbHelper.getAll();
}
}
}
3 changes: 3 additions & 0 deletions app/src/main/res/raw/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ <h2>Libraries</h2>
<li><a href="https://github.com/deano2390/MaterialShowcaseView">MaterialShowcaseView</a> (Apache License v2)</li>
<li><a href="https://github.com/arimorty/floatingsearchview/">Floating Search View</a> (Apache License v2)</li>
<li><a href="https://github.com/castorflex/SmoothProgressBar">Smooth Progress Bar</a> (Apache License v2)</li>
<li><a href="https://github.com/googlesamples/easypermissions">EasyPermissions</a> (Apache
License v2)
</li>
<li>Icons used from <a href="https://materialdesignicons.com">materialdesignicons.com</a></li>
</ul>
</body>
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<string name="string_button_text_generate">GENERATE</string>
<string name="string_button_text_loading">LOADING…</string>
<string name="string_empty_saved_list">You don\'t have any restaurants saved.</string>
<string name="string_location_is_off">Location is off. Please enable Location in your settings.</string>
<string name="string_getting_location">Getting location…</string>
<string name="string_current_location">Current Location</string>
<string name="string_location_not_found">"Location has not been found yet. Please try again. Acquiring GPS signal may take up to a minute on some devices."</string>
Expand All @@ -19,6 +18,6 @@
<string name="cancel">Cancel</string>
<string name="string_location_permission_required">Location permission are required to use GPS.</string>
<string name="string_location_perm_rationale">Location permissions have been denied. Please enable them manually in settings.</string>
<string name="string_lcoation_perm_manual">Location permissions denied. Please enter location manually.</string>
<string name="string_location_perm_manual">Location permissions denied. Please enter location manually.</string>

</resources>

0 comments on commit e3f37aa

Please sign in to comment.