├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── layout │ │ │ │ ├── dummy.xml │ │ │ │ ├── constraint.xml │ │ │ │ ├── loader_layout.xml │ │ │ │ ├── activity_maps.xml │ │ │ │ ├── fragment_favourite_locations.xml │ │ │ │ └── card_address.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── ic_star_defualt_24dp.xml │ │ │ │ ├── ic_star_favourites_24dp.xml │ │ │ │ ├── ic_drive_eta_black_24dp.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── lingaraj │ │ │ │ └── hourglass │ │ │ │ └── in │ │ │ │ └── letswalk │ │ │ │ ├── Constants.java │ │ │ │ ├── letswalkscreen │ │ │ │ ├── LocationRequestCallback.java │ │ │ │ ├── GeoDecoderCallback.java │ │ │ │ ├── RepoCallbacks.java │ │ │ │ ├── di │ │ │ │ │ ├── LetsWalkActivityComponent.java │ │ │ │ │ ├── MainScreenBindingModule.java │ │ │ │ │ └── FavouriteLocationsComponent.java │ │ │ │ ├── FusedLocationCallback.java │ │ │ │ ├── LetsWalkViewModel.java │ │ │ │ ├── AddressAdapter.java │ │ │ │ ├── parser │ │ │ │ │ └── PolyLineParser.java │ │ │ │ ├── FavouriteLocationsFragment.java │ │ │ │ ├── Repository.java │ │ │ │ ├── AppLocationManager.java │ │ │ │ └── LetsWalkActivity.java │ │ │ │ ├── GoogleAPIStatusException.java │ │ │ │ ├── di │ │ │ │ ├── ActivityScope.java │ │ │ │ ├── ForScreen.java │ │ │ │ ├── FragmentScope.java │ │ │ │ ├── components │ │ │ │ │ ├── ScreenComponent.java │ │ │ │ │ └── ApplicationComponent.java │ │ │ │ ├── DisposableManager.java │ │ │ │ ├── ViewModelKey.java │ │ │ │ ├── modules │ │ │ │ │ ├── ScreenModule.java │ │ │ │ │ ├── ApplicationModule.java │ │ │ │ │ ├── ActivityBindingModule.java │ │ │ │ │ ├── ViewModelBindingModule.java │ │ │ │ │ └── NetworkModule.java │ │ │ │ ├── injectors │ │ │ │ │ ├── Injector.java │ │ │ │ │ ├── ActivityInjector.java │ │ │ │ │ └── FragmentInjector.java │ │ │ │ └── BaseViewModelFactory.java │ │ │ │ ├── rest │ │ │ │ ├── response │ │ │ │ │ ├── Location.java │ │ │ │ │ ├── Legs.java │ │ │ │ │ ├── distanceresponse │ │ │ │ │ │ ├── Row.java │ │ │ │ │ │ ├── Distance.java │ │ │ │ │ │ ├── Element.java │ │ │ │ │ │ └── DistanceResult.java │ │ │ │ │ ├── OverviewPolyLine.java │ │ │ │ │ ├── Route.java │ │ │ │ │ ├── DirectionResults.java │ │ │ │ │ └── Steps.java │ │ │ │ ├── di │ │ │ │ │ └── RestAPISModule.java │ │ │ │ └── DirectionAPIEndpoints.java │ │ │ │ ├── utils │ │ │ │ ├── DistanceCalculator.java │ │ │ │ └── MarshmallowPermissions.java │ │ │ │ └── BaseApplication.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── lingaraj │ │ │ └── hourglass │ │ │ └── in │ │ │ ├── ridegmap │ │ │ └── ExampleUnitTest.java │ │ │ └── letswalk │ │ │ └── letswalkscreen │ │ │ └── LetsWalkViewModelTest.java │ ├── androidTest │ │ └── java │ │ │ └── lingaraj │ │ │ └── hourglass │ │ │ └── in │ │ │ └── ridegmap │ │ │ └── ExampleInstrumentedTest.java │ ├── release │ │ └── res │ │ │ └── values │ │ │ └── google_maps_api.xml │ └── debug │ │ └── res │ │ └── values │ │ └── google_maps_api.xml ├── proguard-rules.pro ├── build.gradle └── app.iml ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gmap.iml ├── .gitignore ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/letswalk/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/Constants.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk; 2 | 3 | public class Constants { 4 | public static final String INSTANCE_ID = "instance_id"; 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/LocationRequestCallback.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen; 2 | 3 | public interface LocationRequestCallback { 4 | void onLocationRequestCancelled(); 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 20sp 5 | 8dp 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/GeoDecoderCallback.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen; 2 | 3 | import android.location.Address; 4 | 5 | public interface GeoDecoderCallback { 6 | void decodedAddressDetails(Address address); 7 | } 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 04 12:33:12 IST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dummy.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/GoogleAPIStatusException.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk; 2 | 3 | public class GoogleAPIStatusException extends Exception { 4 | public GoogleAPIStatusException() { 5 | super("GOOGLE MAPS API Status does not return okay"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | #9E9E9E 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/ActivityScope.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import javax.inject.Scope; 6 | 7 | @Scope 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface ActivityScope { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/ForScreen.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import javax.inject.Qualifier; 6 | 7 | @Qualifier 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface ForScreen { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/FragmentScope.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import javax.inject.Scope; 6 | 7 | @Scope 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface FragmentScope { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/Location.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | public class Location { 4 | private double lat; 5 | private double lng; 6 | 7 | public double getLat() { 8 | return lat; 9 | } 10 | 11 | public double getLng() { 12 | return lng; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/Legs.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class Legs implements Serializable { 7 | private List steps; 8 | 9 | public List getSteps() { 10 | return steps; 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/constraint.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/RepoCallbacks.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen; 2 | 3 | import android.location.Address; 4 | import com.google.android.gms.maps.model.PolylineOptions; 5 | import java.util.List; 6 | 7 | public interface RepoCallbacks { 8 | void onSuccess(List polyLines); 9 | void onFailure(); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/distanceresponse/Row.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response.distanceresponse; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class Row implements Serializable { 7 | private List elements; 8 | 9 | public List getElements() { 10 | return elements; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_defualt_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_favourites_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/OverviewPolyLine.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.io.Serializable; 5 | 6 | public class OverviewPolyLine implements Serializable { 7 | 8 | @SerializedName("points") 9 | public String points; 10 | 11 | public String getPoints() { 12 | return points; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/distanceresponse/Distance.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response.distanceresponse; 2 | 3 | import java.io.Serializable; 4 | 5 | class Distance implements Serializable { 6 | private String text; 7 | private long value; 8 | 9 | public String getText() { 10 | return text; 11 | } 12 | 13 | public long getValue() { 14 | return value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/components/ScreenComponent.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.components; 2 | 3 | import dagger.android.AndroidInjector; 4 | import lingaraj.hourglass.in.letswalk.di.DisposableManager; 5 | import lingaraj.hourglass.in.letswalk.di.ForScreen; 6 | 7 | public interface ScreenComponent extends AndroidInjector { 8 | 9 | @ForScreen 10 | DisposableManager disposableManager(); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/test/java/lingaraj/hourglass/in/ridegmap/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.ridegmap; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test public void addition_isCorrect() { 14 | assertEquals(4, 2 + 2); 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/Route.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.List; 5 | 6 | public class Route { 7 | @SerializedName("overview_polyline") private OverviewPolyLine overviewPolyLine; 8 | 9 | private List legs; 10 | 11 | public OverviewPolyLine getOverviewPolyLine() { 12 | return overviewPolyLine; 13 | } 14 | 15 | public List getLegs() { 16 | return legs; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/DisposableManager.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di; 2 | 3 | import io.reactivex.disposables.CompositeDisposable; 4 | import io.reactivex.disposables.Disposable; 5 | 6 | public class DisposableManager { 7 | 8 | private final CompositeDisposable compositeDisposable = new CompositeDisposable(); 9 | 10 | public void add(Disposable... disposables) { 11 | compositeDisposable.addAll(disposables); 12 | } 13 | 14 | public void dispose() { 15 | compositeDisposable.clear(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/ViewModelKey.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di; 2 | 3 | import androidx.lifecycle.ViewModel; 4 | import dagger.MapKey; 5 | import java.lang.annotation.Documented; 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | @Documented 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @MapKey 15 | public @interface ViewModelKey { 16 | Class value(); 17 | } -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/di/RestAPISModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.di; 2 | 3 | import dagger.Module; 4 | import dagger.Provides; 5 | import javax.inject.Singleton; 6 | import lingaraj.hourglass.in.letswalk.rest.DirectionAPIEndpoints; 7 | import retrofit2.Retrofit; 8 | 9 | @Module 10 | public abstract class RestAPISModule { 11 | 12 | 13 | @Provides @Singleton 14 | static DirectionAPIEndpoints providesDirectionsAPIEndpoints(Retrofit retrofit) { 15 | return retrofit.create(DirectionAPIEndpoints.class); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/distanceresponse/Element.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response.distanceresponse; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Element implements Serializable { 6 | 7 | private Distance distance; 8 | private Distance duration; 9 | private String status; 10 | 11 | public Distance getDistance() { 12 | return distance; 13 | } 14 | 15 | public Distance getDuration() { 16 | return duration; 17 | } 18 | 19 | public String getStatus() { 20 | return status; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/DirectionResults.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.io.Serializable; 5 | import java.util.List; 6 | 7 | public class DirectionResults implements Serializable { 8 | 9 | private String status; 10 | @SerializedName("routes") 11 | private List routes; 12 | 13 | public String getStatus() { 14 | return status; 15 | } 16 | 17 | 18 | public List getRoutes() { 19 | return routes; 20 | }} 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/Steps.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Steps implements Serializable { 6 | private Location start_location; 7 | private Location end_location; 8 | private OverviewPolyLine polyline; 9 | 10 | public Location getStart_location() { 11 | return start_location; 12 | } 13 | 14 | public Location getEnd_location() { 15 | return end_location; 16 | } 17 | 18 | public OverviewPolyLine getPolyline() { 19 | return polyline; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/modules/ScreenModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.modules; 2 | import dagger.Module; 3 | import dagger.Provides; 4 | import lingaraj.hourglass.in.letswalk.di.DisposableManager; 5 | import lingaraj.hourglass.in.letswalk.di.ForScreen; 6 | import lingaraj.hourglass.in.letswalk.di.FragmentScope; 7 | 8 | @Module 9 | public abstract class ScreenModule { 10 | 11 | @Provides 12 | @FragmentScope 13 | @ForScreen 14 | static DisposableManager provideDisposableManager() { 15 | return new DisposableManager(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_drive_eta_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/response/distanceresponse/DistanceResult.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest.response.distanceresponse; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class DistanceResult implements Serializable { 7 | private String status; 8 | private List destination_address; 9 | private List origin_addresses; 10 | private List rows; 11 | 12 | public String getStatus() { 13 | return status; 14 | } 15 | 16 | public List getDestination_address() { 17 | return destination_address; 18 | } 19 | 20 | public List getOrigin_addresses() { 21 | return origin_addresses; 22 | } 23 | 24 | public List getRows() { 25 | return rows; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/di/LetsWalkActivityComponent.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen.di; 2 | 3 | import dagger.Subcomponent; 4 | import dagger.android.AndroidInjector; 5 | import lingaraj.hourglass.in.letswalk.di.ActivityScope; 6 | import lingaraj.hourglass.in.letswalk.letswalkscreen.LetsWalkActivity; 7 | 8 | @ActivityScope 9 | @Subcomponent(modules = { 10 | MainScreenBindingModule.class, 11 | 12 | }) 13 | public interface LetsWalkActivityComponent extends AndroidInjector { 14 | 15 | @Subcomponent.Builder 16 | abstract class Builder extends AndroidInjector.Builder { 17 | 18 | @Override 19 | public void seedInstance(LetsWalkActivity instance) { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/utils/DistanceCalculator.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.utils; 2 | 3 | public class DistanceCalculator { 4 | public static double distance(double lat1, double lon1, double lat2, double lon2) { 5 | double theta = lon1 - lon2; 6 | double dist = Math.sin(deg2rad(lat1)) 7 | * Math.sin(deg2rad(lat2)) 8 | + Math.cos(deg2rad(lat1)) 9 | * Math.cos(deg2rad(lat2)) 10 | * Math.cos(deg2rad(theta)); 11 | dist = Math.acos(dist); 12 | dist = rad2deg(dist); 13 | dist = dist * 60 * 1.1515; 14 | return (dist); 15 | } 16 | 17 | private static double deg2rad(double deg) { 18 | return (deg * Math.PI / 180.0); 19 | } 20 | 21 | private static double rad2deg(double rad) { 22 | return (rad * 180.0 / Math.PI); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/modules/ApplicationModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.modules; 2 | 3 | import com.patloew.rxlocation.RxLocation; 4 | import dagger.Module; 5 | import dagger.Provides; 6 | import lingaraj.hourglass.in.letswalk.BaseApplication; 7 | 8 | @Module 9 | public class ApplicationModule { 10 | 11 | private final BaseApplication baseApplication; 12 | private final RxLocation rxLocation; 13 | 14 | public ApplicationModule(BaseApplication baseApplication) { 15 | this.baseApplication = baseApplication; 16 | this.rxLocation = new RxLocation(baseApplication); 17 | } 18 | 19 | @Provides 20 | BaseApplication providesApplicationContext(){ 21 | return baseApplication; 22 | } 23 | 24 | @Provides 25 | RxLocation providesRxLocation(){ return rxLocation;} 26 | } 27 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/di/MainScreenBindingModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen.di; 2 | 3 | import androidx.fragment.app.Fragment; 4 | import dagger.Binds; 5 | import dagger.Module; 6 | import dagger.android.AndroidInjector; 7 | import dagger.android.support.FragmentKey; 8 | import dagger.multibindings.IntoMap; 9 | import lingaraj.hourglass.in.letswalk.letswalkscreen.FavouriteLocationsFragment; 10 | 11 | @Module(subcomponents = { 12 | FavouriteLocationsComponent.class 13 | 14 | }) 15 | public abstract class MainScreenBindingModule { 16 | 17 | @Binds 18 | @IntoMap 19 | @FragmentKey(FavouriteLocationsFragment.class) 20 | abstract AndroidInjector.Factory bindSplashController(FavouriteLocationsComponent.Builder builder); 21 | 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/modules/ActivityBindingModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.modules; 2 | 3 | import android.app.Activity; 4 | import dagger.Binds; 5 | import dagger.Module; 6 | import dagger.android.ActivityKey; 7 | import dagger.android.AndroidInjector; 8 | import dagger.multibindings.IntoMap; 9 | import lingaraj.hourglass.in.letswalk.letswalkscreen.LetsWalkActivity; 10 | import lingaraj.hourglass.in.letswalk.letswalkscreen.di.LetsWalkActivityComponent; 11 | 12 | @Module(subcomponents = { 13 | LetsWalkActivityComponent.class 14 | }) 15 | public abstract class ActivityBindingModule { 16 | 17 | @Binds 18 | @IntoMap 19 | @ActivityKey(LetsWalkActivity.class) 20 | abstract AndroidInjector.Factory provideMainActivityInjector(LetsWalkActivityComponent.Builder builder); 21 | 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /app/src/androidTest/java/lingaraj/hourglass/in/ridegmap/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.ridegmap; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { 18 | @Test public void useAppContext() { 19 | // Context of the app under test. 20 | Context appContext = InstrumentationRegistry.getTargetContext(); 21 | 22 | assertEquals("lingaraj.hourglass.in.ridegmap", appContext.getPackageName()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | android.enableJetifier=true 10 | android.useAndroidX=true 11 | android.enableAapt2=false 12 | org.gradle.jvmargs=-Xmx1536m 13 | # When configured, Gradle will run in incubating parallel mode. 14 | # This option should only be used with decoupled projects. More details, visit 15 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 16 | # org.gradle.parallel=true 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/modules/ViewModelBindingModule.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.modules; 2 | 3 | import androidx.lifecycle.ViewModel; 4 | import androidx.lifecycle.ViewModelProvider; 5 | import dagger.Binds; 6 | import dagger.Module; 7 | import dagger.multibindings.IntoMap; 8 | import lingaraj.hourglass.in.letswalk.di.BaseViewModelFactory; 9 | import lingaraj.hourglass.in.letswalk.di.ViewModelKey; 10 | import lingaraj.hourglass.in.letswalk.letswalkscreen.LetsWalkViewModel; 11 | 12 | @Module 13 | public abstract class ViewModelBindingModule { 14 | 15 | @Binds 16 | @IntoMap 17 | @ViewModelKey(LetsWalkViewModel.class) 18 | abstract ViewModel providesLetsWalkViewModel(LetsWalkViewModel letsWalkViewModel); 19 | 20 | @Binds 21 | abstract ViewModelProvider.Factory bindsViewModelFactory(BaseViewModelFactory baseViewModelFactory); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/rest/DirectionAPIEndpoints.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.rest; 2 | 3 | import io.reactivex.Single; 4 | import lingaraj.hourglass.in.letswalk.rest.response.DirectionResults; 5 | import lingaraj.hourglass.in.letswalk.rest.response.distanceresponse.DistanceResult; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.Query; 8 | 9 | public interface DirectionAPIEndpoints { 10 | 11 | @GET("/maps/api/directions/json") 12 | Single getJson(@Query("origin") String origin,@Query("destination") String destination,@Query("waypoints") String waypoints,@Query("mode") String mode, @Query("key") String Key); 13 | 14 | @GET("/maps/api/distancematrix/json") 15 | Single getDistance(@Query("origins") String origin,@Query("destinations") String destination,@Query("mode") String mode, @Query("key") String Key); 16 | } 17 | -------------------------------------------------------------------------------- /gmap.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/release/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | YOUR_KEY_HERE 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Let\'s Walk 3 | Map 4 | Sorry, you cannot mark more than four locations in map 5 | Loading 6 | Please Provide Necessary Permissions to Continue! 7 | Grant Permissions 8 | Favourites 9 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vitae nunc et sapien tristique ornare ut in diam. Etiam non sapien vitae turpis pulvinar ullamcorper nec vitae justo. Donec convallis porttitor sem, eu semper arcu faucibus in. Nunc ligula erat, ornare vitae odio vel, interdum elementum neque. 10 | California 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/components/ApplicationComponent.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.components; 2 | 3 | import dagger.Component; 4 | import javax.inject.Singleton; 5 | import lingaraj.hourglass.in.letswalk.BaseApplication; 6 | import lingaraj.hourglass.in.letswalk.di.modules.ActivityBindingModule; 7 | import lingaraj.hourglass.in.letswalk.di.modules.ApplicationModule; 8 | import lingaraj.hourglass.in.letswalk.di.modules.NetworkModule; 9 | import lingaraj.hourglass.in.letswalk.di.modules.ViewModelBindingModule; 10 | import lingaraj.hourglass.in.letswalk.rest.di.RestAPISModule; 11 | 12 | @Singleton 13 | @Component(modules = { 14 | ApplicationModule.class, 15 | ViewModelBindingModule.class, 16 | NetworkModule.class, 17 | RestAPISModule.class, 18 | ActivityBindingModule.class 19 | }) 20 | public interface ApplicationComponent { 21 | void inject(BaseApplication baseApplication); 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/letswalkscreen/di/FavouriteLocationsComponent.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.letswalkscreen.di; 2 | 3 | import dagger.Subcomponent; 4 | import dagger.android.AndroidInjector; 5 | import lingaraj.hourglass.in.letswalk.di.FragmentScope; 6 | import lingaraj.hourglass.in.letswalk.di.components.ScreenComponent; 7 | import lingaraj.hourglass.in.letswalk.di.modules.ScreenModule; 8 | import lingaraj.hourglass.in.letswalk.letswalkscreen.FavouriteLocationsFragment; 9 | 10 | 11 | @FragmentScope 12 | @Subcomponent(modules ={ ScreenModule.class } ) 13 | public interface FavouriteLocationsComponent extends ScreenComponent { 14 | 15 | @Subcomponent.Builder 16 | abstract class Builder extends AndroidInjector.Builder { 17 | 18 | @Override 19 | public void seedInstance(FavouriteLocationsFragment instance) { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | /*/build/ 3 | 4 | # Crashlytics configuations 5 | com_crashlytics_export_strings.xml 6 | 7 | # Local configuration file (sdk path, etc) 8 | local.properties 9 | 10 | # Gradle generated files 11 | .gradle/ 12 | 13 | # Signing files 14 | .signing/ 15 | 16 | # User-specific configurations 17 | .idea/ 18 | .idea/libraries/ 19 | .idea/workspace.xml 20 | .idea/tasks.xml 21 | .idea/.name 22 | .idea/compiler.xml 23 | .idea/copyright/profiles_settings.xml 24 | .idea/encodings.xml 25 | .idea/misc.xml 26 | .idea/modules.xml 27 | .idea/scopes/scope_settings.xml 28 | .idea/vcs.xml 29 | .idea/caches/ 30 | .idea/codeStyles/ 31 | 32 | # OS-specific files 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db 40 | 41 | app/.idea/workspace.xml 42 | build/intermediates/dex-cache/cache.xml 43 | build/android-profile/* 44 | build/generated/* 45 | build/intermediates/progurad-files/* 46 | 47 | /openCVLibrary310 48 | openCVLibrary310/build.gradle 49 | -------------------------------------------------------------------------------- /app/src/main/java/lingaraj/hourglass/in/letswalk/di/injectors/Injector.java: -------------------------------------------------------------------------------- 1 | package lingaraj.hourglass.in.letswalk.di.injectors; 2 | 3 | import android.app.Activity; 4 | import androidx.fragment.app.Fragment; 5 | import lingaraj.hourglass.in.letswalk.letswalkscreen.FavouriteLocationsFragment; 6 | import lingaraj.hourglass.in.letswalk.letswalkscreen.LetsWalkActivity; 7 | 8 | public class Injector { 9 | 10 | private Injector() { 11 | 12 | } 13 | 14 | public static void inject(Activity activity) { 15 | ActivityInjector.get(activity).inject(activity); 16 | } 17 | 18 | public static void clearComponent(Activity activity) { 19 | ActivityInjector.get(activity).clear(activity); 20 | } 21 | 22 | public static void inject(Fragment fragment) { 23 | FragmentInjector.get(fragment.getActivity()).inject(fragment); 24 | } 25 | 26 | public static void clearComponent(Fragment fragment) { 27 | FragmentInjector.get(fragment.getActivity()).clear(fragment); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loader_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 21 | 26 |