├── source
├── PeruTravel
│ ├── .idea
│ │ ├── .name
│ │ ├── copyright
│ │ │ └── profiles_settings.xml
│ │ ├── encodings.xml
│ │ ├── modules.xml
│ │ ├── runConfigurations.xml
│ │ ├── compiler.xml
│ │ ├── gradle.xml
│ │ └── misc.xml
│ ├── app
│ │ ├── .gitignore
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── emedinaa
│ │ │ │ │ │ └── perutravel
│ │ │ │ │ │ ├── data
│ │ │ │ │ │ ├── datasource
│ │ │ │ │ │ │ ├── db
│ │ │ │ │ │ │ │ ├── readme.txt
│ │ │ │ │ │ │ │ └── DbPlaceDataStore.java
│ │ │ │ │ │ │ ├── preferences
│ │ │ │ │ │ │ │ ├── readme.txt
│ │ │ │ │ │ │ │ └── PreferencesPlaceDataStore.java
│ │ │ │ │ │ │ ├── PlaceDataStore.java
│ │ │ │ │ │ │ ├── PlaceDataStoreFactory.java
│ │ │ │ │ │ │ └── rest
│ │ │ │ │ │ │ │ ├── RestPlaceDataStore.java
│ │ │ │ │ │ │ │ └── ApiClient.java
│ │ │ │ │ │ ├── model
│ │ │ │ │ │ │ ├── BaseResponse.java
│ │ │ │ │ │ │ ├── PlaceResponse.java
│ │ │ │ │ │ │ └── PlaceEntity.java
│ │ │ │ │ │ ├── mapper
│ │ │ │ │ │ │ └── PlaceDataMapper.java
│ │ │ │ │ │ └── repository
│ │ │ │ │ │ │ └── PlaceDataRepository.java
│ │ │ │ │ │ ├── presentation
│ │ │ │ │ │ ├── view
│ │ │ │ │ │ │ ├── BaseView.java
│ │ │ │ │ │ │ └── MainView.java
│ │ │ │ │ │ ├── presenter
│ │ │ │ │ │ │ ├── Presenter.java
│ │ │ │ │ │ │ └── PlacePresenter.java
│ │ │ │ │ │ ├── utils
│ │ │ │ │ │ │ └── media
│ │ │ │ │ │ │ │ ├── ImageLoader.java
│ │ │ │ │ │ │ │ ├── PicassoILoader.java
│ │ │ │ │ │ │ │ ├── GlideILoader.java
│ │ │ │ │ │ │ │ └── ImageLoaderHelper.java
│ │ │ │ │ │ ├── ui
│ │ │ │ │ │ │ ├── recycler
│ │ │ │ │ │ │ │ ├── RecyclerClickListener.java
│ │ │ │ │ │ │ │ ├── MarginDecoration.java
│ │ │ │ │ │ │ │ └── RecyclerTouchListener.java
│ │ │ │ │ │ │ ├── BaseActivity.java
│ │ │ │ │ │ │ ├── PlaceActivity.java
│ │ │ │ │ │ │ └── MainActivity.java
│ │ │ │ │ │ └── adapter
│ │ │ │ │ │ │ └── PlaceAdapter.java
│ │ │ │ │ │ └── domain
│ │ │ │ │ │ ├── repository
│ │ │ │ │ │ ├── RepositoryCallback.java
│ │ │ │ │ │ └── PlaceRepository.java
│ │ │ │ │ │ ├── interactor
│ │ │ │ │ │ ├── PlaceCallback.java
│ │ │ │ │ │ └── PlaceInteractor.java
│ │ │ │ │ │ └── model
│ │ │ │ │ │ └── Place.java
│ │ │ │ ├── res
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ ├── dimens.xml
│ │ │ │ │ │ ├── colors.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── mipmap
│ │ │ │ │ │ ├── ic_back.png
│ │ │ │ │ │ └── ic_white_back.png
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── values-w820dp
│ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ │ ├── row_place.xml
│ │ │ │ │ │ └── activity_place.xml
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── emedinaa
│ │ │ │ │ └── perutravel
│ │ │ │ │ └── ExampleUnitTest.java
│ │ │ └── androidTest
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── emedinaa
│ │ │ │ └── perutravel
│ │ │ │ └── ApplicationTest.java
│ │ ├── proguard-rules.pro
│ │ ├── build.gradle
│ │ └── json
│ │ │ └── places.json
│ ├── settings.gradle
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
└── PeruTravelLayers
│ ├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap
│ │ │ │ │ ├── ic_back.png
│ │ │ │ │ └── ic_white_back.png
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-w820dp
│ │ │ │ │ └── dimens.xml
│ │ │ │ └── layout
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── row_place.xml
│ │ │ │ │ └── activity_place.xml
│ │ │ ├── ic_launcher-web.png
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── emedinaa
│ │ │ │ │ └── perutravel
│ │ │ │ │ └── presentation
│ │ │ │ │ ├── view
│ │ │ │ │ ├── BaseView.java
│ │ │ │ │ └── MainView.java
│ │ │ │ │ ├── presenter
│ │ │ │ │ ├── Presenter.java
│ │ │ │ │ └── PlacePresenter.java
│ │ │ │ │ ├── utils
│ │ │ │ │ └── media
│ │ │ │ │ │ ├── ImageLoader.java
│ │ │ │ │ │ ├── PicassoILoader.java
│ │ │ │ │ │ ├── GlideILoader.java
│ │ │ │ │ │ └── ImageLoaderHelper.java
│ │ │ │ │ ├── ui
│ │ │ │ │ ├── recycler
│ │ │ │ │ │ ├── RecyclerClickListener.java
│ │ │ │ │ │ ├── MarginDecoration.java
│ │ │ │ │ │ └── RecyclerTouchListener.java
│ │ │ │ │ ├── BaseActivity.java
│ │ │ │ │ ├── PlaceActivity.java
│ │ │ │ │ └── MainActivity.java
│ │ │ │ │ └── adapter
│ │ │ │ │ └── PlaceAdapter.java
│ │ │ └── AndroidManifest.xml
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── emedinaa
│ │ │ │ └── perutravel
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── emedinaa
│ │ │ └── perutravel
│ │ │ └── ApplicationTest.java
│ ├── json
│ │ ├── places_error.json
│ │ └── places.json
│ ├── proguard-rules.pro
│ └── build.gradle
│ ├── data
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── emedinaa
│ │ │ │ └── perutravel
│ │ │ │ └── data
│ │ │ │ ├── datasource
│ │ │ │ ├── PlaceDataStore.java
│ │ │ │ ├── db
│ │ │ │ │ └── DbPlaceDataStore.java
│ │ │ │ ├── preferences
│ │ │ │ │ └── PreferencesPlaceDataStore.java
│ │ │ │ ├── PlaceDataStoreFactory.java
│ │ │ │ └── rest
│ │ │ │ │ ├── RestPlaceDataStore.java
│ │ │ │ │ └── ApiClient.java
│ │ │ │ ├── model
│ │ │ │ ├── BaseResponse.java
│ │ │ │ ├── PlaceResponse.java
│ │ │ │ └── PlaceEntity.java
│ │ │ │ ├── mapper
│ │ │ │ └── PlaceDataMapper.java
│ │ │ │ └── repository
│ │ │ │ └── PlaceDataRepository.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── emedinaa
│ │ │ │ └── perutravel
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── emedinaa
│ │ │ └── perutravel
│ │ │ └── ApplicationTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
│ ├── domain
│ ├── .gitignore
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── emedinaa
│ │ └── perutravel
│ │ └── domain
│ │ ├── repository
│ │ ├── RepositoryCallback.java
│ │ └── PlaceRepository.java
│ │ ├── interactor
│ │ ├── PlaceCallback.java
│ │ └── PlaceInteractor.java
│ │ └── model
│ │ └── Place.java
│ ├── settings.gradle
│ ├── .idea
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── gradle.xml
│ ├── compiler.xml
│ └── misc.xml
│ ├── .gitignore
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── server.properties
│ ├── gradle.properties
│ ├── build.gradle
│ ├── gradlew.bat
│ └── gradlew
├── video.gif
├── video.mp4
├── screenshot1.png
├── screenshot2.png
├── .gitignore
└── README.md
/source/PeruTravel/.idea/.name:
--------------------------------------------------------------------------------
1 | PeruTravel
--------------------------------------------------------------------------------
/source/PeruTravel/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/source/PeruTravel/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':domain', ':data'
2 |
--------------------------------------------------------------------------------
/video.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/video.gif
--------------------------------------------------------------------------------
/video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/video.mp4
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/db/readme.txt:
--------------------------------------------------------------------------------
1 | sqlite
--------------------------------------------------------------------------------
/screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/screenshot1.png
--------------------------------------------------------------------------------
/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/screenshot2.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/preferences/readme.txt:
--------------------------------------------------------------------------------
1 | sqlite
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PeruTravel
3 |
4 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | data
3 |
4 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PeruTravel
3 |
4 |
--------------------------------------------------------------------------------
/source/PeruTravel/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/source/PeruTravel/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap/ic_back.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/json/places_error.json:
--------------------------------------------------------------------------------
1 | {
2 | "code": 2002,
3 | "message": "Version is disabled or provided wrong application info (application id or secret key)"
4 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap/ic_white_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap/ic_white_back.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap/ic_back.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravel/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap/ic_white_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap/ic_white_back.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emedinaa/android-clean-architecture/HEAD/source/PeruTravelLayers/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/source/PeruTravelLayers/server.properties:
--------------------------------------------------------------------------------
1 | BACKENDLESS_APP_ID="E324073C-E9A4-FE14-FFFE-BFDA5C701700"
2 | BACKENDLESS_REST_KEY="169F9E06-12BA-4B02-FF83-C97E29C5BE00"
3 | BACKENDLESS_PATH= "http://api.backendless.com"
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | sourceCompatibility = 1.7
4 | targetCompatibility = 1.7
5 |
6 | dependencies {
7 | compile fileTree(dir: 'libs', include: ['*.jar'])
8 | }
--------------------------------------------------------------------------------
/source/PeruTravel/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri May 20 14:28:07 PET 2016
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/view/BaseView.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.view;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public interface BaseView {
7 |
8 | void showLoading();
9 | void hideLoading();
10 | }
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 06 12:29:34 PET 2017
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-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/view/BaseView.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.view;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface BaseView {
9 |
10 | Context getContext();
11 | }
12 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 4dp
6 |
7 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 4dp
6 |
7 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/presenter/Presenter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.presenter;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public interface Presenter {
7 |
8 | void addView(T view);
9 | void removeView(T view);
10 | }
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/presenter/Presenter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.presenter;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public interface Presenter {
7 |
8 | void addView(T view);
9 | void removeView(T view);
10 | }
11 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/domain/repository/RepositoryCallback.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.repository;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public interface RepositoryCallback {
7 |
8 | void onError(Object object);
9 | void onSuccess(Object object);
10 | }
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/src/main/java/com/emedinaa/perutravel/domain/repository/RepositoryCallback.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.repository;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public interface RepositoryCallback {
7 |
8 | void onError(Object object);
9 | void onSuccess(Object object);
10 | }
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/PlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource;
2 |
3 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface PlaceDataStore {
9 |
10 | void loadPlaces(RepositoryCallback repositoryCallback);
11 | }
12 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/src/main/java/com/emedinaa/perutravel/domain/repository/PlaceRepository.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.repository;
2 |
3 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface PlaceRepository {
9 |
10 | void loadPlaces(final PlaceCallback placeCallback);
11 | }
12 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/PlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource;
2 |
3 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface PlaceDataStore {
9 |
10 | void loadPlaces(RepositoryCallback repositoryCallback);
11 | }
12 |
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface ImageLoader {
9 |
10 | void load(String url,ImageView imageView);
11 | void loadLocal(String path, ImageView imageView);
12 | }
13 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public interface ImageLoader {
9 |
10 | void load(String url,ImageView imageView);
11 | void loadLocal(String path, ImageView imageView);
12 | }
13 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/RecyclerClickListener.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by emedinaa on 14/10/15.
7 | */
8 | public interface RecyclerClickListener {
9 | public void onClick(View view, int position);
10 |
11 | public void onLongClick(View view, int position);
12 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/RecyclerClickListener.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by emedinaa on 14/10/15.
7 | */
8 | public interface RecyclerClickListener {
9 | public void onClick(View view, int position);
10 |
11 | public void onLongClick(View view, int position);
12 | }
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/domain/interactor/PlaceCallback.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.interactor;
2 |
3 | import com.emedinaa.perutravel.domain.model.Place;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by emedinaa on 16/04/16.
9 | */
10 | public interface PlaceCallback {
11 |
12 | void onPlaceSuccess(List places);
13 | void onPlaceError(String message);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/test/java/com/emedinaa/perutravel/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #1C1C1C
7 | #585858
8 | #E6E6E6
9 | #FFFFFF
10 |
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/test/java/com/emedinaa/perutravel/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #1C1C1C
7 | #585858
8 | #E6E6E6
9 | #FFFFFF
10 |
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/test/java/com/emedinaa/perutravel/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/src/main/java/com/emedinaa/perutravel/domain/interactor/PlaceCallback.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.interactor;
2 |
3 | import com.emedinaa.perutravel.domain.model.Place;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by emedinaa on 16/04/16.
9 | */
10 | public interface PlaceCallback {
11 |
12 | void onPlaceSuccess(List places);
13 | void onPlaceError(String message);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/androidTest/java/com/emedinaa/perutravel/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/domain/repository/PlaceRepository.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.repository;
2 |
3 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
4 | import com.emedinaa.perutravel.domain.model.Place;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by emedinaa on 16/04/16.
10 | */
11 | public interface PlaceRepository {
12 |
13 | void loadPlaces(final PlaceCallback placeCallback);
14 | }
15 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/androidTest/java/com/emedinaa/perutravel/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/androidTest/java/com/emedinaa/perutravel/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/view/MainView.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.view;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.emedinaa.perutravel.domain.model.Place;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by emedinaa on 16/04/16.
11 | */
12 | public interface MainView extends BaseView {
13 |
14 | void renderPlaces(List places);
15 | void showErrorMessage(String message);
16 | void gotoPlace(Bundle bundle);
17 | }
18 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/PicassoILoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PicassoILoader implements ImageLoader {
9 |
10 | @Override
11 | public void load(String url, ImageView imageView) {
12 |
13 | }
14 |
15 | @Override
16 | public void loadLocal(String path, ImageView imageView) {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/PicassoILoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PicassoILoader implements ImageLoader {
9 |
10 | @Override
11 | public void load(String url, ImageView imageView) {
12 |
13 | }
14 |
15 | @Override
16 | public void loadLocal(String path, ImageView imageView) {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/db/DbPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.db;
2 |
3 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
4 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
5 |
6 | /**
7 | * Created by emedinaa on 16/04/16.
8 | */
9 | public class DbPlaceDataStore implements PlaceDataStore {
10 |
11 | public DbPlaceDataStore() {
12 |
13 | }
14 |
15 |
16 | @Override
17 | public void loadPlaces(RepositoryCallback repositoryCallback) {
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/view/MainView.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.view;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 |
6 | import com.emedinaa.perutravel.domain.model.Place;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by emedinaa on 16/04/16.
12 | */
13 | public interface MainView extends BaseView {
14 |
15 | void showLoading();
16 | void hideLoading();
17 | void renderPlaces(List places);
18 | void showErrorMessage(String message);
19 | void gotoPlace(Bundle bundle);
20 | }
21 |
--------------------------------------------------------------------------------
/source/PeruTravel/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/db/DbPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.db;
2 |
3 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
4 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
5 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
6 |
7 | /**
8 | * Created by emedinaa on 16/04/16.
9 | */
10 | public class DbPlaceDataStore implements PlaceDataStore {
11 |
12 | public DbPlaceDataStore() {
13 |
14 | }
15 |
16 |
17 | @Override
18 | public void loadPlaces(RepositoryCallback repositoryCallback) {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/domain/interactor/PlaceInteractor.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.interactor;
2 |
3 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PlaceInteractor {
9 |
10 | private final PlaceRepository placeRepository;
11 |
12 | public PlaceInteractor(PlaceRepository placeRepository) {
13 | this.placeRepository = placeRepository;
14 | }
15 |
16 | public void loadPlaces( final PlaceCallback placeCallback)
17 | {
18 | placeRepository.loadPlaces(placeCallback);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/src/main/java/com/emedinaa/perutravel/domain/interactor/PlaceInteractor.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.interactor;
2 |
3 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PlaceInteractor {
9 |
10 | private final PlaceRepository placeRepository;
11 |
12 | public PlaceInteractor(PlaceRepository placeRepository) {
13 | this.placeRepository = placeRepository;
14 | }
15 |
16 | public void loadPlaces( final PlaceCallback placeCallback)
17 | {
18 | placeRepository.loadPlaces(placeCallback);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/emedinaa/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/preferences/PreferencesPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.preferences;
2 |
3 | import android.content.Context;
4 |
5 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
6 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
7 |
8 | /**
9 | * Created by em on 22/04/16.
10 | */
11 | public class PreferencesPlaceDataStore implements PlaceDataStore {
12 |
13 | private final Context context;
14 | public PreferencesPlaceDataStore(Context context) {
15 | this.context= context;
16 | }
17 |
18 | @Override
19 | public void loadPlaces(RepositoryCallback repositoryCallback) {
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/GlideILoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | import com.bumptech.glide.Glide;
6 |
7 | import java.io.File;
8 |
9 | /**
10 | * Created by emedinaa on 16/04/16.
11 | */
12 | public class GlideILoader implements ImageLoader{
13 |
14 | @Override
15 | public void load(String url, ImageView imageView)
16 | {
17 | Glide.with(imageView.getContext()).load(url).into(imageView);
18 | }
19 |
20 | @Override
21 | public void loadLocal(String path, ImageView imageView) {
22 | Glide.with(imageView.getContext()).load(new File(path)).into(imageView);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/emedinaa/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/GlideILoader.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | import android.widget.ImageView;
4 |
5 | import com.bumptech.glide.Glide;
6 |
7 | import java.io.File;
8 |
9 | /**
10 | * Created by emedinaa on 16/04/16.
11 | */
12 | public class GlideILoader implements ImageLoader{
13 |
14 | @Override
15 | public void load(String url, ImageView imageView)
16 | {
17 | Glide.with(imageView.getContext()).load(url).into(imageView);
18 | }
19 |
20 | @Override
21 | public void loadLocal(String path, ImageView imageView) {
22 | Glide.with(imageView.getContext()).load(new File(path)).into(imageView);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/em/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/preferences/PreferencesPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.preferences;
2 |
3 | import android.content.Context;
4 |
5 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
6 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
7 |
8 | /**
9 | * Created by em on 22/04/16.
10 | */
11 | public class PreferencesPlaceDataStore implements PlaceDataStore {
12 |
13 | private final Context context;
14 | public PreferencesPlaceDataStore(Context context) {
15 | this.context= context;
16 | }
17 |
18 | @Override
19 | public void loadPlaces(RepositoryCallback repositoryCallback) {
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/model/BaseResponse.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class BaseResponse {
7 |
8 | private static final int SUCCESS=0;
9 | private int code;
10 | private String message;
11 |
12 |
13 | public boolean isSuccess()
14 | {
15 | if(this.code==SUCCESS)return true;
16 | return false;
17 | }
18 |
19 | public int getCode() {
20 | return this.code;
21 | }
22 |
23 | public void setCode(int code) {
24 | this.code = code;
25 | }
26 |
27 | public String getMessage() {
28 | return this.message;
29 | }
30 |
31 | public void setMessage(String message) {
32 | this.message = message;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/model/BaseResponse.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class BaseResponse {
7 |
8 | private static final int SUCCESS=0;
9 | private int code;
10 | private String message;
11 |
12 |
13 | public boolean isSuccess()
14 | {
15 | if(this.code==SUCCESS)return true;
16 | return false;
17 | }
18 |
19 | public int getCode() {
20 | return this.code;
21 | }
22 |
23 | public void setCode(int code) {
24 | this.code = code;
25 | }
26 |
27 | public String getMessage() {
28 | return this.message;
29 | }
30 |
31 | public void setMessage(String message) {
32 | this.message = message;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/MarginDecoration.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | /**
4 | * Created by emedinaa on 14/10/15.
5 | */
6 | import android.content.Context;
7 | import android.graphics.Rect;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.View;
10 |
11 | import com.emedinaa.perutravel.R;
12 |
13 |
14 | public class MarginDecoration extends RecyclerView.ItemDecoration {
15 | private int margin;
16 |
17 | public MarginDecoration(Context context) {
18 | margin = context.getResources().getDimensionPixelSize(R.dimen.item_margin);
19 | }
20 |
21 | @Override
22 | public void getItemOffsets(
23 | Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
24 | outRect.set(margin, margin, margin, margin);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/MarginDecoration.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | /**
4 | * Created by emedinaa on 14/10/15.
5 | */
6 | import android.content.Context;
7 | import android.graphics.Rect;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.View;
10 |
11 | import com.emedinaa.perutravel.R;
12 |
13 |
14 | public class MarginDecoration extends RecyclerView.ItemDecoration {
15 | private int margin;
16 |
17 | public MarginDecoration(Context context) {
18 | margin = context.getResources().getDimensionPixelSize(R.dimen.item_margin);
19 | }
20 |
21 | @Override
22 | public void getItemOffsets(
23 | Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
24 | outRect.set(margin, margin, margin, margin);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/source/PeruTravel/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/source/PeruTravelLayers/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/ImageLoaderHelper.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class ImageLoaderHelper {
7 |
8 | public static final int GLIDE=1;
9 | public static final int PICASSO=2;
10 |
11 | private int type=GLIDE;
12 | private ImageLoader imageLoader;
13 |
14 | public ImageLoaderHelper(int type) {
15 | this.type = type;
16 | imageLoader= factory();
17 | }
18 |
19 | public ImageLoader getLoader() {
20 | return imageLoader;
21 | }
22 |
23 | private ImageLoader factory()
24 | {
25 | switch (type)
26 | {
27 | case PICASSO:
28 | return new PicassoILoader();
29 | case GLIDE:
30 | return new GlideILoader();
31 | default:
32 | return new GlideILoader();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/utils/media/ImageLoaderHelper.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.utils.media;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class ImageLoaderHelper {
7 |
8 | public static final int GLIDE=1;
9 | public static final int PICASSO=2;
10 |
11 | private int type=GLIDE;
12 | private ImageLoader imageLoader;
13 |
14 | public ImageLoaderHelper(int type) {
15 | this.type = type;
16 | imageLoader= factory();
17 | }
18 |
19 | public ImageLoader getLoader() {
20 | return imageLoader;
21 | }
22 |
23 | private ImageLoader factory()
24 | {
25 | switch (type)
26 | {
27 | case PICASSO:
28 | return new PicassoILoader();
29 | case GLIDE:
30 | return new GlideILoader();
31 | default:
32 | return new GlideILoader();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 | //global variables
21 | ext{
22 | //sdk and tools
23 | minSdkVersion = 14
24 | targetSdkVersion = 23
25 | compileSdkVersion = 23
26 | buildToolsVersion = '23.0.3'
27 | supportLibraryVersion= '23.4.0'
28 |
29 | //dependencies versions
30 | retrofit= '2.1.0'
31 | okhttpLogging='3.3.1'
32 | okhttpGson= '2.1.0'
33 | okhttp = '2.5.0'
34 |
35 | glide='3.7.0'
36 | butterknife= '7.0.1'
37 |
38 | }
39 | task clean(type: Delete) {
40 | delete rootProject.buildDir
41 | }
42 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
17 |
21 |
22 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
17 |
21 |
22 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/model/PlaceResponse.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PlaceResponse extends BaseResponse{
9 |
10 | private int offset;
11 | private List data;
12 | private Object nextPage;
13 | private int totalObjects;
14 |
15 | public int getOffset() {
16 | return offset;
17 | }
18 |
19 | public void setOffset(int offset) {
20 | this.offset = offset;
21 | }
22 |
23 | public List getData() {
24 | return data;
25 | }
26 |
27 | public void setData(List data) {
28 | this.data = data;
29 | }
30 |
31 | public Object getNextPage() {
32 | return nextPage;
33 | }
34 |
35 | public void setNextPage(Object nextPage) {
36 | this.nextPage = nextPage;
37 | }
38 |
39 | public int getTotalObjects() {
40 | return totalObjects;
41 | }
42 |
43 | public void setTotalObjects(int totalObjects) {
44 | this.totalObjects = totalObjects;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/model/PlaceResponse.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class PlaceResponse extends BaseResponse{
9 |
10 | private int offset;
11 | private List data;
12 | private Object nextPage;
13 | private int totalObjects;
14 |
15 | public int getOffset() {
16 | return offset;
17 | }
18 |
19 | public void setOffset(int offset) {
20 | this.offset = offset;
21 | }
22 |
23 | public List getData() {
24 | return data;
25 | }
26 |
27 | public void setData(List data) {
28 | this.data = data;
29 | }
30 |
31 | public Object getNextPage() {
32 | return nextPage;
33 | }
34 |
35 | public void setNextPage(Object nextPage) {
36 | this.nextPage = nextPage;
37 | }
38 |
39 | public int getTotalObjects() {
40 | return totalObjects;
41 | }
42 |
43 | public void setTotalObjects(int totalObjects) {
44 | this.totalObjects = totalObjects;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.os.Bundle;
6 | import android.support.design.widget.Snackbar;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.view.View;
9 | import android.widget.TextView;
10 |
11 | import butterknife.ButterKnife;
12 |
13 | /**
14 | * Created by emedinaa on 16/04/16.
15 | */
16 | public class BaseActivity extends AppCompatActivity{
17 |
18 | protected void injectView()
19 | {
20 | ButterKnife.bind(this);
21 | }
22 | protected void showMessage(View container, String message)
23 | {
24 | Snackbar snackbar = Snackbar
25 | .make(container,message, Snackbar.LENGTH_LONG);
26 | snackbar.setActionTextColor(Color.RED);
27 | View sbView = snackbar.getView();
28 | TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
29 | textView.setTextColor(Color.WHITE);
30 | snackbar.show();
31 | }
32 |
33 | protected void next(Bundle bundle, Class> activity,boolean destroy) {
34 | Intent intent= new Intent(this,activity);
35 | if(bundle!=null){intent.putExtras(bundle);}
36 | startActivity(intent);
37 | if(destroy)finish();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.os.Bundle;
6 | import android.support.design.widget.Snackbar;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.view.View;
9 | import android.widget.TextView;
10 |
11 | import butterknife.ButterKnife;
12 |
13 | /**
14 | * Created by emedinaa on 16/04/16.
15 | */
16 | public class BaseActivity extends AppCompatActivity{
17 |
18 | protected void injectView()
19 | {
20 | ButterKnife.bind(this);
21 | }
22 | protected void showMessage(View container, String message)
23 | {
24 | Snackbar snackbar = Snackbar
25 | .make(container,message, Snackbar.LENGTH_LONG);
26 | snackbar.setActionTextColor(Color.RED);
27 | View sbView = snackbar.getView();
28 | TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
29 | textView.setTextColor(Color.WHITE);
30 | snackbar.show();
31 | }
32 |
33 | protected void next(Bundle bundle, Class> activity,boolean destroy) {
34 | Intent intent= new Intent(this,activity);
35 | if(bundle!=null){intent.putExtras(bundle);}
36 | startActivity(intent);
37 | if(destroy)finish();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/model/PlaceEntity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class PlaceEntity {
7 |
8 | private String objectId;
9 | private String title;
10 | private String desc;
11 | private String photo;
12 | private String city;
13 | private String color;
14 |
15 |
16 | public String getObjectId() {
17 | return objectId;
18 | }
19 |
20 | public void setObjectId(String objectId) {
21 | this.objectId = objectId;
22 | }
23 |
24 | public String getTitle() {
25 | return title;
26 | }
27 |
28 | public void setTitle(String title) {
29 | this.title = title;
30 | }
31 |
32 | public String getDesc() {
33 | return desc;
34 | }
35 |
36 | public void setDesc(String desc) {
37 | this.desc = desc;
38 | }
39 |
40 | public String getPhoto() {
41 | return photo;
42 | }
43 |
44 | public void setPhoto(String photo) {
45 | this.photo = photo;
46 | }
47 |
48 | public String getCity() {
49 | return city;
50 | }
51 |
52 | public void setCity(String city) {
53 | this.city = city;
54 | }
55 |
56 | public String getColor() {
57 | return color;
58 | }
59 |
60 | public void setColor(String color) {
61 | this.color = color;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/model/PlaceEntity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.model;
2 |
3 | /**
4 | * Created by emedinaa on 16/04/16.
5 | */
6 | public class PlaceEntity {
7 |
8 | private String objectId;
9 | private String title;
10 | private String desc;
11 | private String photo;
12 | private String city;
13 | private String color;
14 |
15 |
16 | public String getObjectId() {
17 | return objectId;
18 | }
19 |
20 | public void setObjectId(String objectId) {
21 | this.objectId = objectId;
22 | }
23 |
24 | public String getTitle() {
25 | return title;
26 | }
27 |
28 | public void setTitle(String title) {
29 | this.title = title;
30 | }
31 |
32 | public String getDesc() {
33 | return desc;
34 | }
35 |
36 | public void setDesc(String desc) {
37 | this.desc = desc;
38 | }
39 |
40 | public String getPhoto() {
41 | return photo;
42 | }
43 |
44 | public void setPhoto(String photo) {
45 | this.photo = photo;
46 | }
47 |
48 | public String getCity() {
49 | return city;
50 | }
51 |
52 | public void setCity(String city) {
53 | this.city = city;
54 | }
55 |
56 | public String getColor() {
57 | return color;
58 | }
59 |
60 | public void setColor(String color) {
61 | this.color = color;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/domain/model/Place.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class Place implements Serializable {
9 | private String id;
10 | private String nick;
11 | private String title;
12 | private String desc;
13 | private String photo;
14 | private String headerColor;
15 |
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | public void setId(String id) {
21 | this.id = id;
22 | }
23 |
24 | public String getNick() {
25 | return nick;
26 | }
27 |
28 | public void setNick(String nick) {
29 | this.nick = nick;
30 | }
31 |
32 | public String getTitle() {
33 | return title;
34 | }
35 |
36 | public void setTitle(String title) {
37 | this.title = title;
38 | }
39 |
40 | public String getDesc() {
41 | return desc;
42 | }
43 |
44 | public void setDesc(String desc) {
45 | this.desc = desc;
46 | }
47 |
48 | public String getPhoto() {
49 | return photo;
50 | }
51 |
52 | public void setPhoto(String photo) {
53 | this.photo = photo;
54 | }
55 |
56 | public String getHeaderColor() {
57 | return headerColor;
58 | }
59 |
60 | public void setHeaderColor(String headerColor) {
61 | this.headerColor = headerColor;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/domain/src/main/java/com/emedinaa/perutravel/domain/model/Place.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.domain.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by emedinaa on 16/04/16.
7 | */
8 | public class Place implements Serializable {
9 | private String id;
10 | private String nick;
11 | private String title;
12 | private String desc;
13 | private String photo;
14 | private String headerColor;
15 |
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | public void setId(String id) {
21 | this.id = id;
22 | }
23 |
24 | public String getNick() {
25 | return nick;
26 | }
27 |
28 | public void setNick(String nick) {
29 | this.nick = nick;
30 | }
31 |
32 | public String getTitle() {
33 | return title;
34 | }
35 |
36 | public void setTitle(String title) {
37 | this.title = title;
38 | }
39 |
40 | public String getDesc() {
41 | return desc;
42 | }
43 |
44 | public void setDesc(String desc) {
45 | this.desc = desc;
46 | }
47 |
48 | public String getPhoto() {
49 | return photo;
50 | }
51 |
52 | public void setPhoto(String photo) {
53 | this.photo = photo;
54 | }
55 |
56 | public String getHeaderColor() {
57 | return headerColor;
58 | }
59 |
60 | public void setHeaderColor(String headerColor) {
61 | this.headerColor = headerColor;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.emedinaa.perutravel"
9 | minSdkVersion 14
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | productFlavors {
21 | devel {
22 | buildConfigField 'String', 'HOST', '"http://api.backendless.com"'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 | testCompile 'junit:junit:4.12'
30 | compile 'com.android.support:appcompat-v7:23.2.1'
31 |
32 | compile 'com.android.support:support-v4:23.2.1'
33 | compile 'com.android.support:design:23.2.1'
34 | compile 'com.android.support:cardview-v7:23.2.1'
35 | compile 'com.android.support:recyclerview-v7:23.2.1'
36 |
37 | //RETROFIT https://github.com/square/retrofit
38 | compile 'com.squareup.retrofit:retrofit:1.9.0'
39 |
40 | //GSON https://github.com/google/gson
41 | compile 'com.google.code.gson:gson:2.6.2'
42 |
43 | //GLIDE https://github.com/bumptech/glide
44 | compile 'com.github.bumptech.glide:glide:3.7.0'
45 |
46 | //OKHTTP
47 | compile 'com.squareup.okhttp:okhttp:2.5.0'
48 |
49 | //BUTTERKNIFE https://github.com/JakeWharton/butterknife
50 | compile 'com.jakewharton:butterknife:7.0.1'
51 | }
52 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/PlaceDataStoreFactory.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource;
2 |
3 | import android.content.Context;
4 |
5 | import com.emedinaa.perutravel.data.datasource.db.DbPlaceDataStore;
6 | import com.emedinaa.perutravel.data.datasource.preferences.PreferencesPlaceDataStore;
7 | import com.emedinaa.perutravel.data.datasource.rest.RestPlaceDataStore;
8 |
9 | /**
10 | * Created by em on 22/04/16.
11 | */
12 | public class PlaceDataStoreFactory {
13 |
14 | public static final int DB=1;
15 | public static final int CLOUD=2;
16 | public static final int PREFERENCES=3;
17 |
18 | private final Context context;
19 |
20 | public PlaceDataStoreFactory(Context context) {
21 |
22 | if (context == null) {
23 | throw new IllegalArgumentException("Constructor parameters cannot be null!!!");
24 | }
25 | this.context = context;
26 | }
27 |
28 | public PlaceDataStore create(int dataSource)
29 | {
30 | PlaceDataStore placeDataStore=null;
31 |
32 | switch (dataSource)
33 | {
34 | case CLOUD:
35 | placeDataStore= createCloudDataStore();
36 | break;
37 | case DB:
38 | placeDataStore= new DbPlaceDataStore();
39 | break;
40 | case PREFERENCES:
41 | placeDataStore= new PreferencesPlaceDataStore(context);
42 | break;
43 | }
44 | return placeDataStore;
45 | }
46 |
47 |
48 | public PlaceDataStore createCloudDataStore() {
49 |
50 | return new RestPlaceDataStore();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/PlaceDataStoreFactory.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource;
2 |
3 | import android.content.Context;
4 |
5 | import com.emedinaa.perutravel.data.datasource.db.DbPlaceDataStore;
6 | import com.emedinaa.perutravel.data.datasource.preferences.PreferencesPlaceDataStore;
7 | import com.emedinaa.perutravel.data.datasource.rest.RestPlaceDataStore;
8 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
9 |
10 | /**
11 | * Created by em on 22/04/16.
12 | */
13 | public class PlaceDataStoreFactory {
14 |
15 | public static final int DB=1;
16 | public static final int CLOUD=2;
17 | public static final int PREFERENCES=3;
18 |
19 | private final Context context;
20 |
21 | public PlaceDataStoreFactory(Context context) {
22 |
23 | if (context == null) {
24 | throw new IllegalArgumentException("Constructor parameters cannot be null!!!");
25 | }
26 | this.context = context.getApplicationContext();
27 | }
28 |
29 | public PlaceDataStore create(int dataSource)
30 | {
31 | PlaceDataStore placeDataStore=null;
32 |
33 | switch (dataSource)
34 | {
35 | case CLOUD:
36 | placeDataStore= createCloudDataStore();
37 | break;
38 | case DB:
39 | placeDataStore= new DbPlaceDataStore();
40 | break;
41 | case PREFERENCES:
42 | placeDataStore= new PreferencesPlaceDataStore(context);
43 | break;
44 | }
45 | return placeDataStore;
46 | }
47 |
48 |
49 | public PlaceDataStore createCloudDataStore() {
50 |
51 | return new RestPlaceDataStore();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/mapper/PlaceDataMapper.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.mapper;
2 |
3 | import com.emedinaa.perutravel.data.model.PlaceEntity;
4 | import com.emedinaa.perutravel.data.model.PlaceResponse;
5 | import com.emedinaa.perutravel.domain.model.Place;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by emedinaa on 16/04/16.
12 | */
13 | public class PlaceDataMapper {
14 |
15 | public Place transform(PlaceEntity placeEntity)
16 | {
17 | Place place= new Place();
18 | if(placeEntity==null)return place;
19 | place.setId(placeEntity.getObjectId());
20 | place.setTitle(placeEntity.getTitle() != null ? placeEntity.getTitle() : "");
21 | place.setDesc(placeEntity.getDesc() != null ? placeEntity.getDesc() : "");
22 | place.setNick(placeEntity.getCity()!=null?placeEntity.getCity():"");
23 | place.setHeaderColor(placeEntity.getColor());
24 | place.setPhoto(placeEntity.getPhoto());
25 | return place;
26 | }
27 |
28 | public List transformResponse(PlaceResponse placeResponse)
29 | {
30 | List places= new ArrayList<>();
31 | if(placeResponse==null)return places;
32 | for (PlaceEntity placeEntity:placeResponse.getData()) {
33 | places.add(transform(placeEntity));
34 | }
35 | return places;
36 | }
37 |
38 | public List transformList(List placeEntities)
39 | {
40 | List places= new ArrayList<>();
41 | if(placeEntities==null)return places;
42 |
43 | for (PlaceEntity placeEntity:placeEntities) {
44 | places.add(transform(placeEntity));
45 | }
46 |
47 | return places;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/mapper/PlaceDataMapper.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.mapper;
2 |
3 | import com.emedinaa.perutravel.data.model.PlaceEntity;
4 | import com.emedinaa.perutravel.data.model.PlaceResponse;
5 | import com.emedinaa.perutravel.domain.model.Place;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by emedinaa on 16/04/16.
12 | */
13 | public class PlaceDataMapper {
14 |
15 | public Place transform(PlaceEntity placeEntity)
16 | {
17 | Place place= new Place();
18 | if(placeEntity==null)return place;
19 | place.setId(placeEntity.getObjectId());
20 | place.setTitle(placeEntity.getTitle() != null ? placeEntity.getTitle() : "");
21 | place.setDesc(placeEntity.getDesc() != null ? placeEntity.getDesc() : "");
22 | place.setNick(placeEntity.getCity()!=null?placeEntity.getCity():"");
23 | place.setHeaderColor(placeEntity.getColor());
24 | place.setPhoto(placeEntity.getPhoto());
25 | return place;
26 | }
27 |
28 | public List transformResponse(PlaceResponse placeResponse)
29 | {
30 | List places= new ArrayList<>();
31 | if(placeResponse==null)return places;
32 | for (PlaceEntity placeEntity:placeResponse.getData()) {
33 | places.add(transform(placeEntity));
34 | }
35 | return places;
36 | }
37 |
38 | public List transformList(List placeEntities)
39 | {
40 | List places= new ArrayList<>();
41 | if(placeEntities==null)return places;
42 |
43 | for (PlaceEntity placeEntity:placeEntities) {
44 | places.add(transform(placeEntity));
45 | }
46 |
47 | return places;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/presenter/PlacePresenter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.presenter;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
6 | import com.emedinaa.perutravel.domain.interactor.PlaceInteractor;
7 | import com.emedinaa.perutravel.domain.model.Place;
8 | import com.emedinaa.perutravel.presentation.view.MainView;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by emedinaa on 16/04/16.
14 | */
15 | public class PlacePresenter implements Presenter, PlaceCallback{
16 | private static final String TAG = "PlacePresenter";
17 | private MainView mainView;
18 | private final PlaceInteractor placeInteractor;
19 |
20 | public PlacePresenter(PlaceInteractor placeInteractor) {
21 | this.placeInteractor = placeInteractor;
22 | }
23 |
24 | public void loadPlaces()
25 | {
26 | this.mainView.showLoading();
27 | placeInteractor.loadPlaces(this);
28 | }
29 |
30 | public void selectedPlace(Place place)
31 | {
32 | Bundle bundle= new Bundle();
33 | bundle.putSerializable("PLACE",place);
34 | this.mainView.gotoPlace(bundle);
35 | }
36 |
37 | @Override
38 | public void addView(MainView view) {
39 | this.mainView= view;
40 | }
41 |
42 | @Override
43 | public void removeView(MainView view) {
44 | this.mainView=null;
45 | }
46 |
47 | @Override
48 | public void onPlaceSuccess(List places) {
49 | this.mainView.hideLoading();
50 | this.mainView.renderPlaces(places);
51 | }
52 |
53 | @Override
54 | public void onPlaceError(String message) {
55 | this.mainView.hideLoading();
56 | this.mainView.showErrorMessage(message);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.compileSdkVersion
5 | buildToolsVersion rootProject.buildToolsVersion
6 |
7 | defaultConfig {
8 | applicationId "com.emedinaa.perutravel"
9 | minSdkVersion rootProject.minSdkVersion
10 | targetSdkVersion rootProject.targetSdkVersion
11 | versionCode 2
12 | versionName "1.1"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | /*productFlavors {
21 | devel {
22 | buildConfigField 'String', 'HOST', '"http://api.backendless.com"'
23 | }
24 | }*/
25 |
26 | /*compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_7
28 | targetCompatibility JavaVersion.VERSION_1_7
29 | }*/
30 | }
31 |
32 | configurations {
33 | devDebugCompile
34 | prodDebugCompile
35 | devReleaseCompile
36 | prodReleaseCompile
37 | }
38 |
39 | dependencies {
40 | compile fileTree(dir: 'libs', include: ['*.jar'])
41 | testCompile 'junit:junit:4.12'
42 | compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
43 | compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
44 | compile "com.android.support:design:$rootProject.supportLibraryVersion"
45 | compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
46 | compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
47 |
48 | compile "com.github.bumptech.glide:glide:$rootProject.glide"
49 | compile "com.jakewharton:butterknife:$rootProject.butterknife"
50 | compile project(':domain')
51 | compile project(':data')
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/rest/RestPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.rest;
2 |
3 | import android.util.Log;
4 |
5 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
6 | import com.emedinaa.perutravel.data.datasource.rest.ApiClient;
7 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
8 | import com.emedinaa.perutravel.data.model.PlaceResponse;
9 | import com.emedinaa.perutravel.domain.model.Place;
10 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
11 |
12 | import java.util.List;
13 |
14 | import retrofit.Callback;
15 | import retrofit.RetrofitError;
16 | import retrofit.client.Response;
17 |
18 | /**
19 | * Created by emedinaa on 16/04/16.
20 | */
21 | public class RestPlaceDataStore implements PlaceDataStore {
22 |
23 | private static final String TAG = "RestPlaceDataS";
24 | private ApiClient.ServicesApiInterface servicesApiInterface;
25 |
26 | public RestPlaceDataStore() {
27 | servicesApiInterface= ApiClient.getMyApiClient();
28 | }
29 |
30 | @Override
31 | public void loadPlaces(final RepositoryCallback repositoryCallback) {
32 | servicesApiInterface.places(new Callback() {
33 | @Override
34 | public void success(PlaceResponse placeResponse, Response response) {
35 | if(placeResponse!=null) {
36 | repositoryCallback.onSuccess(placeResponse);
37 | }else{
38 | repositoryCallback.onError("");
39 | }
40 | }
41 |
42 | @Override
43 | public void failure(RetrofitError error) {
44 | String message="";
45 | if(error!=null) {
46 | message= error.getMessage();
47 | }
48 | Log.v(TAG,"error "+message);
49 | repositoryCallback.onError(message);
50 | }
51 | });
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/datasource/rest/ApiClient.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.rest;
2 |
3 | import com.emedinaa.perutravel.BuildConfig;
4 | import com.emedinaa.perutravel.data.model.PlaceResponse;
5 | import com.squareup.okhttp.OkHttpClient;
6 |
7 | import java.util.concurrent.TimeUnit;
8 |
9 | import retrofit.Callback;
10 | import retrofit.RestAdapter;
11 | import retrofit.client.OkClient;
12 | import retrofit.http.GET;
13 | import retrofit.http.Headers;
14 |
15 | /**
16 | * Created by emedinaa on 16/04/16.
17 | */
18 | public class ApiClient {
19 |
20 | private static final String TAG = "ApiClient";
21 | private static ServicesApiInterface servicesApiInterface;
22 |
23 | public static ServicesApiInterface getMyApiClient() {
24 |
25 | if (servicesApiInterface == null) {
26 |
27 | RestAdapter restAdapter = new RestAdapter.Builder()
28 | .setEndpoint(BuildConfig.HOST)
29 | .setClient(new OkClient(getClient()))
30 | .setLogLevel(RestAdapter.LogLevel.FULL)
31 | .build();
32 |
33 | servicesApiInterface = restAdapter.create(ServicesApiInterface.class);
34 | }
35 | return servicesApiInterface;
36 | }
37 |
38 | public interface ServicesApiInterface {
39 |
40 | @Headers({
41 | "Content-Type: application/json",
42 | "application-id: DA9284B5-938D-38A8-FFB5-ED28F8E07A00",
43 | "secret-key: 513FB962-5397-99F4-FF6D-F56D4FAF9B00",
44 | "application-type: REST"
45 | })
46 | //
47 | @GET("/v1/data/Place")
48 | void places( Callback callback);
49 | }
50 |
51 | private static OkHttpClient getClient() {
52 | OkHttpClient client = new OkHttpClient();
53 | client.setConnectTimeout(2, TimeUnit.MINUTES);
54 | client.setReadTimeout(2, TimeUnit.MINUTES);
55 | return client;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/layout/row_place.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
26 |
27 |
33 |
34 |
40 |
41 |
42 |
47 |
48 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/layout/row_place.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
26 |
27 |
33 |
34 |
40 |
41 |
42 |
47 |
48 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/RecyclerTouchListener.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.GestureDetector;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 |
9 | /**
10 | * Created by emedinaa on 14/10/15.
11 | */
12 | public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
13 |
14 | private GestureDetector gestureDetector;
15 | private RecyclerClickListener recyclerClickListener;
16 |
17 | public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final RecyclerClickListener recyclerClickListener) {
18 |
19 | this.recyclerClickListener = recyclerClickListener;
20 |
21 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener(){
22 | @Override
23 | public boolean onSingleTapUp(MotionEvent e) {
24 | return true;
25 | }
26 |
27 | @Override
28 | public void onLongPress(MotionEvent e) {
29 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
30 | if (child != null && recyclerClickListener != null){
31 | recyclerClickListener.onLongClick(child, recyclerView.getChildPosition(child));
32 | }
33 | }
34 | });
35 | }
36 |
37 | @Override
38 | public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
39 | View child = rv.findChildViewUnder(e.getX(), e.getY());
40 | if (child != null && recyclerClickListener != null && gestureDetector.onTouchEvent(e)){
41 | recyclerClickListener.onClick(child, rv.getChildPosition(child));
42 | }
43 |
44 | return false;
45 | }
46 |
47 | @Override
48 | public void onTouchEvent(RecyclerView rv, MotionEvent e) {
49 | }
50 |
51 | @Override
52 | public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
53 |
54 | }
55 |
56 |
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/recycler/RecyclerTouchListener.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui.recycler;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.GestureDetector;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 |
9 | /**
10 | * Created by emedinaa on 14/10/15.
11 | */
12 | public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
13 |
14 | private GestureDetector gestureDetector;
15 | private RecyclerClickListener recyclerClickListener;
16 |
17 | public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final RecyclerClickListener recyclerClickListener) {
18 |
19 | this.recyclerClickListener = recyclerClickListener;
20 |
21 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener(){
22 | @Override
23 | public boolean onSingleTapUp(MotionEvent e) {
24 | return true;
25 | }
26 |
27 | @Override
28 | public void onLongPress(MotionEvent e) {
29 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
30 | if (child != null && recyclerClickListener != null){
31 | recyclerClickListener.onLongClick(child, recyclerView.getChildPosition(child));
32 | }
33 | }
34 | });
35 | }
36 |
37 | @Override
38 | public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
39 | View child = rv.findChildViewUnder(e.getX(), e.getY());
40 | if (child != null && recyclerClickListener != null && gestureDetector.onTouchEvent(e)){
41 | recyclerClickListener.onClick(child, rv.getChildPosition(child));
42 | }
43 |
44 | return false;
45 | }
46 |
47 | @Override
48 | public void onTouchEvent(RecyclerView rv, MotionEvent e) {
49 | }
50 |
51 | @Override
52 | public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
53 |
54 | }
55 |
56 |
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/rest/RestPlaceDataStore.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.rest;
2 |
3 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
4 | import com.emedinaa.perutravel.data.model.PlaceResponse;
5 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
6 |
7 | import retrofit2.Call;
8 | import retrofit2.Callback;
9 | import retrofit2.Response;
10 |
11 | /**
12 | * Created by emedinaa on 16/04/16.
13 | */
14 | public class RestPlaceDataStore implements PlaceDataStore {
15 |
16 | private static final String TAG = "RestPlaceDataS";
17 | private ApiClient.ServicesApiInterface servicesApiInterface;
18 |
19 | public RestPlaceDataStore() {
20 | servicesApiInterface= ApiClient.getMyApiClient();
21 | }
22 |
23 | @Override
24 | public void loadPlaces(final RepositoryCallback repositoryCallback) {
25 |
26 | Call call= servicesApiInterface.places();
27 | call.enqueue(new Callback() {
28 | @Override
29 | public void onResponse(Call call, Response response) {
30 | if(response.isSuccessful()){
31 | PlaceResponse placeResponse= response.body();
32 | if(placeResponse!=null){
33 | repositoryCallback.onSuccess(placeResponse);
34 | }else{
35 | repositoryCallback.onError("");
36 | }
37 | }else{
38 | repositoryCallback.onError("");
39 | }
40 | }
41 |
42 | @Override
43 | public void onFailure(Call call, Throwable t) {
44 | String message;
45 | try {
46 | message= new StringBuffer().append(t.getMessage()).toString();
47 | }catch (NullPointerException e) {
48 | message=e.getMessage();
49 | }
50 | repositoryCallback.onError(message);
51 | }
52 | });
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.compileSdkVersion
5 | buildToolsVersion rootProject.buildToolsVersion
6 |
7 | defaultConfig {
8 | minSdkVersion rootProject.minSdkVersion
9 | targetSdkVersion rootProject.targetSdkVersion
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 |
14 |
15 | buildTypes {
16 | def Properties serverProperties = new Properties()
17 | serverProperties.load(new FileInputStream(file('../server.properties')))
18 |
19 | debug{
20 | buildConfigField "String", "API_URL", serverProperties["BACKENDLESS_PATH"]
21 | buildConfigField "String", "APP_ID", serverProperties["BACKENDLESS_APP_ID"]
22 | buildConfigField "String", "REST_KEY", serverProperties["BACKENDLESS_REST_KEY"]
23 | }
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
27 | buildConfigField "String", "API_URL", serverProperties["BACKENDLESS_PATH"]
28 | buildConfigField "String", "APP_ID", serverProperties["BACKENDLESS_APP_ID"]
29 | buildConfigField "String", "REST_KEY", serverProperties["BACKENDLESS_REST_KEY"]
30 | }
31 | }
32 |
33 | }
34 |
35 | dependencies {
36 | compile fileTree(dir: 'libs', include: ['*.jar'])
37 | testCompile 'junit:junit:4.12'
38 | compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
39 |
40 | compile project(':domain')
41 |
42 | //RETROFIT https://github.com/square/retrofit
43 | //compile 'com.squareup.retrofit:retrofit:1.9.0'
44 | compile "com.squareup.retrofit2:retrofit:$rootProject.retrofit"
45 |
46 | //INTERCEPTOR
47 | compile "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpLogging"
48 |
49 | //GSON https://github.com/google/gson
50 | //compile 'com.google.code.gson:gson:2.6.2'
51 | compile "com.squareup.retrofit2:converter-gson:$rootProject.okhttpGson"
52 |
53 | //OKHTTP
54 | compile "com.squareup.okhttp:okhttp:$rootProject.okhttp"
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/repository/PlaceDataRepository.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.repository;
2 |
3 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
4 | import com.emedinaa.perutravel.data.datasource.PlaceDataStoreFactory;
5 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
6 | import com.emedinaa.perutravel.data.model.PlaceResponse;
7 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
8 | import com.emedinaa.perutravel.domain.model.Place;
9 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
10 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Created by em on 22/04/16.
16 | */
17 | public class PlaceDataRepository implements PlaceRepository {
18 |
19 | private static final String TAG = "UserDataRepository";
20 | private final PlaceDataStoreFactory placeDataStoreFactory;
21 | private final PlaceDataMapper placeDataMapper;
22 |
23 | public PlaceDataRepository(PlaceDataStoreFactory placeDataStoreFactory, PlaceDataMapper placeDataMapper) {
24 | this.placeDataStoreFactory = placeDataStoreFactory;
25 | this.placeDataMapper = placeDataMapper;
26 | }
27 |
28 | @Override
29 | public void loadPlaces(final PlaceCallback placeCallback) {
30 | final PlaceDataStore placeDataStore= this.placeDataStoreFactory.create(PlaceDataStoreFactory.CLOUD);
31 | placeDataStore.loadPlaces(new RepositoryCallback() {
32 | @Override
33 | public void onError(Object object) {
34 | String message = "";
35 | if(object!=null){
36 | message= object.toString();
37 | }
38 | placeCallback.onPlaceError(message);
39 |
40 | }
41 |
42 | @Override
43 | public void onSuccess(Object object) {
44 | PlaceResponse placeResponse= ((PlaceResponse)(object));
45 | List places= placeDataMapper.transformResponse(placeResponse);
46 |
47 | placeCallback.onPlaceSuccess(places);
48 | }
49 | });
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/source/PeruTravel/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/data/src/main/java/com/emedinaa/perutravel/data/datasource/rest/ApiClient.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.datasource.rest;
2 |
3 | import com.emedinaa.perutravel.data.BuildConfig;
4 | import com.emedinaa.perutravel.data.model.PlaceResponse;
5 |
6 | import okhttp3.OkHttpClient;
7 | import okhttp3.logging.HttpLoggingInterceptor;
8 | import retrofit2.Call;
9 | import retrofit2.Retrofit;
10 | import retrofit2.converter.gson.GsonConverterFactory;
11 | import retrofit2.http.GET;
12 | import retrofit2.http.Headers;
13 |
14 | /**
15 | * Created by emedinaa on 16/04/16.
16 | */
17 | public class ApiClient {
18 |
19 | private static final String TAG = "ApiClient";
20 | private static ServicesApiInterface servicesApiInterface;
21 | private static OkHttpClient.Builder httpClient;
22 |
23 |
24 |
25 | public static ServicesApiInterface getMyApiClient() {
26 |
27 | if (servicesApiInterface == null) {
28 |
29 | Retrofit.Builder builder =new Retrofit.Builder()
30 | .baseUrl(BuildConfig.API_URL)
31 | .addConverterFactory(GsonConverterFactory.create());
32 | httpClient =new OkHttpClient.Builder();
33 | httpClient.addInterceptor(interceptor());
34 |
35 | Retrofit retrofit = builder.client(httpClient.build()).build();
36 | servicesApiInterface = retrofit.create(ServicesApiInterface.class);
37 | }
38 | return servicesApiInterface;
39 | }
40 |
41 | public interface ServicesApiInterface {
42 |
43 | @Headers({
44 | "Content-Type: application/json",
45 | "application-id: "+BuildConfig.APP_ID,
46 | "secret-key: "+BuildConfig.REST_KEY,
47 | "application-type: REST"
48 | })
49 | @GET("/v1/data/Place")
50 | Call places();
51 |
52 | //Dynamic headers
53 | //Call places(@HeaderMap Map headers);
54 | }
55 |
56 |
57 | private static HttpLoggingInterceptor interceptor(){
58 | HttpLoggingInterceptor httpLoggingInterceptor= new HttpLoggingInterceptor();
59 | httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
60 | return httpLoggingInterceptor;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/presenter/PlacePresenter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.presenter;
2 |
3 | import android.os.Bundle;
4 | import android.util.Log;
5 |
6 | import com.emedinaa.perutravel.data.datasource.PlaceDataStoreFactory;
7 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
8 | import com.emedinaa.perutravel.data.repository.PlaceDataRepository;
9 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
10 | import com.emedinaa.perutravel.domain.interactor.PlaceInteractor;
11 | import com.emedinaa.perutravel.domain.model.Place;
12 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
13 | import com.emedinaa.perutravel.presentation.view.MainView;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * Created by emedinaa on 16/04/16.
19 | */
20 | public class PlacePresenter implements Presenter, PlaceCallback{
21 | private static final String TAG = "PlacePresenter";
22 | private MainView mainView;
23 | private PlaceInteractor placeInteractor;
24 |
25 | public void loadPlaces()
26 | {
27 | this.mainView.showLoading();
28 | placeInteractor.loadPlaces(this);
29 | }
30 | public void selectedPlace(Place place)
31 | {
32 | Bundle bundle= new Bundle();
33 | bundle.putSerializable("PLACE",place);
34 | this.mainView.gotoPlace(bundle);
35 | }
36 |
37 | @Override
38 | public void addView(MainView view) {
39 | this.mainView= view;
40 | //PlaceRepository placeRepository= new PlaceManagerRepository(new PlaceDataMapper());
41 | PlaceRepository placeRepository= new PlaceDataRepository(new PlaceDataStoreFactory(this.mainView.getContext()),new PlaceDataMapper());
42 | placeInteractor= new PlaceInteractor(placeRepository);
43 | }
44 |
45 | @Override
46 | public void removeView(MainView view) {
47 | this.mainView=null;
48 | }
49 |
50 | @Override
51 | public void onPlaceSuccess(List places) {
52 | Log.v(TAG, "onPlaceSuccess " + places);
53 | this.mainView.hideLoading();
54 | this.mainView.renderPlaces(places);
55 | }
56 |
57 | @Override
58 | public void onPlaceError(String message) {
59 | this.mainView.hideLoading();
60 | this.mainView.showErrorMessage(message);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/data/repository/PlaceDataRepository.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.data.repository;
2 |
3 | import com.emedinaa.perutravel.data.datasource.PlaceDataStore;
4 | import com.emedinaa.perutravel.data.datasource.PlaceDataStoreFactory;
5 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
6 | import com.emedinaa.perutravel.data.model.PlaceEntity;
7 | import com.emedinaa.perutravel.data.model.PlaceResponse;
8 | import com.emedinaa.perutravel.domain.interactor.PlaceCallback;
9 | import com.emedinaa.perutravel.domain.model.Place;
10 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
11 | import com.emedinaa.perutravel.domain.repository.RepositoryCallback;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * Created by em on 22/04/16.
17 | */
18 | public class PlaceDataRepository implements PlaceRepository {
19 |
20 | private static final String TAG = "UserDataRepository";
21 | private final PlaceDataStoreFactory placeDataStoreFactory;
22 | private final PlaceDataMapper placeDataMapper;
23 |
24 | public PlaceDataRepository(PlaceDataStoreFactory placeDataStoreFactory, PlaceDataMapper placeDataMapper) {
25 | this.placeDataStoreFactory = placeDataStoreFactory;
26 | this.placeDataMapper = placeDataMapper;
27 | }
28 |
29 | @Override
30 | public void loadPlaces(final PlaceCallback placeCallback) {
31 | final PlaceDataStore placeDataStore= this.placeDataStoreFactory.create(PlaceDataStoreFactory.CLOUD);
32 | placeDataStore.loadPlaces(new RepositoryCallback() {
33 | @Override
34 | public void onError(Object object) {
35 | String message = "";
36 | if(object!=null){
37 | message= object.toString();
38 | }
39 | placeCallback.onPlaceError(message);
40 |
41 | }
42 |
43 | @Override
44 | public void onSuccess(Object object) {
45 | //List placeEntities= ((PlaceResponse)(object)).getData();
46 | PlaceResponse placeResponse= ((PlaceResponse)(object));
47 |
48 | List places= placeDataMapper.transformResponse(placeResponse);
49 | //List places= placeDataMapper.transformList(placeEntities);
50 |
51 | placeCallback.onPlaceSuccess(places);
52 | }
53 | });
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/PlaceActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import com.emedinaa.perutravel.R;
11 | import com.emedinaa.perutravel.domain.model.Place;
12 | import com.emedinaa.perutravel.presentation.utils.media.ImageLoaderHelper;
13 |
14 | import butterknife.Bind;
15 |
16 | public class PlaceActivity extends BaseActivity {
17 |
18 | @Bind(R.id.toolbar)Toolbar toolbar;
19 | @Bind(R.id.iviPlace)ImageView iviPlace;
20 | @Bind(R.id.tviTitle)TextView tviTitle;
21 | @Bind(R.id.tviDesc)TextView tviDesc;
22 |
23 | private Place place;
24 | private ImageLoaderHelper imageLoaderHelper;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_place);
30 | extras();
31 | injectView();
32 | ui();
33 | populate();
34 | }
35 |
36 | private void ui() {
37 |
38 | setSupportActionBar(toolbar);
39 | toolbar.setContentInsetsAbsolute(0, 0);
40 |
41 | //events
42 | toolbar.findViewById(R.id.iviBack).setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 | closeApp();
46 | }
47 | });
48 |
49 | imageLoaderHelper= new ImageLoaderHelper(ImageLoaderHelper.GLIDE);
50 | }
51 |
52 | private void closeApp() {
53 | finish();
54 | }
55 |
56 | private void populate() {
57 | if(place!=null)
58 | {
59 | int color= place!=null?(Color.parseColor(place.getHeaderColor())):(R.color.white);
60 | toolbar.setBackgroundColor(color);
61 | ((TextView)(toolbar.findViewById(R.id.tviToolbar))).setText(place.getNick());
62 |
63 | tviTitle.setText(place.getTitle());
64 | tviDesc.setText(place.getDesc());
65 | imageLoaderHelper.getLoader().load(place.getPhoto(),iviPlace);
66 | }
67 | }
68 |
69 | private void extras() {
70 | if (getIntent() != null) {
71 | Bundle bundle = getIntent().getExtras();
72 | if (bundle != null) {
73 | place = (Place) bundle.getSerializable("PLACE");
74 | }
75 | }
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/PlaceActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import com.emedinaa.perutravel.R;
11 | import com.emedinaa.perutravel.domain.model.Place;
12 | import com.emedinaa.perutravel.presentation.utils.media.ImageLoaderHelper;
13 |
14 | import butterknife.Bind;
15 |
16 | public class PlaceActivity extends BaseActivity {
17 |
18 | @Bind(R.id.toolbar)Toolbar toolbar;
19 | @Bind(R.id.iviPlace)ImageView iviPlace;
20 | @Bind(R.id.tviTitle)TextView tviTitle;
21 | @Bind(R.id.tviDesc)TextView tviDesc;
22 |
23 | private Place place;
24 | private ImageLoaderHelper imageLoaderHelper;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_place);
30 | extras();
31 | injectView();
32 | ui();
33 | populate();
34 | }
35 |
36 | private void ui() {
37 |
38 | setSupportActionBar(toolbar);
39 | toolbar.setContentInsetsAbsolute(0, 0);
40 |
41 | //events
42 | toolbar.findViewById(R.id.iviBack).setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 | closeApp();
46 | }
47 | });
48 |
49 | imageLoaderHelper= new ImageLoaderHelper(ImageLoaderHelper.GLIDE);
50 | }
51 |
52 | private void closeApp() {
53 | finish();
54 | }
55 |
56 | private void populate() {
57 | if(place!=null)
58 | {
59 | int bgColor= place!=null?(Color.parseColor(place.getHeaderColor())):(Color.WHITE);
60 | toolbar.setBackgroundColor(bgColor);
61 | ((TextView)(toolbar.findViewById(R.id.tviToolbar))).setText(place.getNick());
62 |
63 | tviTitle.setText(place.getTitle());
64 | tviDesc.setText(place.getDesc());
65 | imageLoaderHelper.getLoader().load(place.getPhoto(),iviPlace);
66 | }
67 | }
68 |
69 | private void extras() {
70 | if (getIntent() != null) {
71 | Bundle bundle = getIntent().getExtras();
72 | if (bundle != null) {
73 | place = (Place) bundle.getSerializable("PLACE");
74 | }
75 | }
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/source/PeruTravel/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # android-clean-architecture
2 | Sample Android app using clean architecture
3 |
4 | ## 1. Principios de Clean Architecture
5 |
6 | - [Uncle bob´s Clean Architecture ](https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html)
7 |
8 | - Principios S.O.L.I.D
9 |
10 | * Principio de Responsabilidad Única (S: Single responsibility principle)
11 |
12 | * Principio de Abierto/Cerrado (O: Open/closed principle)
13 |
14 | * Principio de Sustitución de Liskov ( L: Liskov substitution principle)
15 |
16 | * Principio de Segregación de Interfaces ( I: Interface segregation principle)
17 |
18 | * Principio de Inversión de Dependencias ( D: Dependency inversion principle))
19 |
20 | ## 2. Clean Architecture en Android
21 |
22 | **Capa de Presentación**
23 |
24 | En la capa de presentación uso el patrón Model-View-Presenter(MVP) para dividir responsabilidades.
25 | En este caso el proyecto de la APP se comporta como la capa de presentación y depende del SDK de Android.
26 |
27 | Elementos :
28 |
29 | - Presenter
30 |
31 | - View
32 |
33 | - Model
34 |
35 |
36 | **Capa de Datos**
37 |
38 | La capa de datos es un módulo Android , uso Retrofit para consumir servicios REST de BackendLess y SqLite para la persistencia local.
39 | En esta capa tambien se encuentran entidades relacionadas a los servicios y a la base de Datos .
40 |
41 | Elementos :
42 |
43 | - Entidades de Datos
44 |
45 | - Implementación de los Interactors dependiente del origen de datos
46 |
47 | - Mappers, permite convertir las entidades de datos a entidades de dominio.
48 |
49 |
50 | **Capa de Dominio**
51 |
52 | La capa de dominio es un módulo Java , donde se encuentran las entidades base para construir la App . Estas entidades deben ser independientes de las entidades usadas en la capa de datos.
53 | Respecto a la comunicación con otras capas, utilizo interfaces , ya sea para declarar casos de uso en los interactor o como callbacks para la respuesta a operaciones en las capas de presentación y de datos.
54 |
55 | Elementos :
56 |
57 | - Entidades de Dominio
58 |
59 | - Interactors
60 |
61 | - Callbacks
62 |
63 | ## 3. Presentación
64 | - Clean Architecture [https://docs.google.com/presentation/d/1Eg2V_0j0UO1V3gvYBMYomsMjS9cxD-p-CldPB68ZQxs/edit?usp=sharing](https://docs.google.com/presentation/d/1Eg2V_0j0UO1V3gvYBMYomsMjS9cxD-p-CldPB68ZQxs/edit?usp=sharing)
65 |
66 | ## 4. Ejemplo
67 |
68 | - Perú Travel APP
69 |
70 | - Video
71 |
72 | 
73 |
74 | - Dependencias :
75 |
76 | * Retrofit 2.0
77 |
78 | * OkHttp 2.5.0
79 |
80 | * OkHttp Logging 3.3.1
81 |
82 | * OkHttp Gson 2.1.0
83 |
84 | * Glide 3.7.0
85 |
86 | * Butterknife 7.0.1
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/adapter/PlaceAdapter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.adapter;
2 |
3 | import android.graphics.Color;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.text.TextUtils;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.emedinaa.perutravel.R;
13 | import com.emedinaa.perutravel.domain.model.Place;
14 | import com.emedinaa.perutravel.presentation.utils.media.ImageLoaderHelper;
15 |
16 | import java.util.List;
17 |
18 | /**
19 | * Created by emedinaa on 16/04/16.
20 | */
21 | public class PlaceAdapter extends RecyclerView.Adapter {
22 | private List places;
23 | private ImageLoaderHelper imageLoaderHelper;
24 | private int DESCLMAX=40;
25 | private String DEFAULTCOLOR="#585858";
26 |
27 | public PlaceAdapter(List places) {
28 | this.places = places;
29 | imageLoaderHelper= new ImageLoaderHelper(ImageLoaderHelper.GLIDE);
30 | }
31 |
32 | public static class ViewHolder extends RecyclerView.ViewHolder
33 | {
34 | public TextView tviNick;
35 | public TextView tviTitle;
36 | public TextView tviDesc;
37 | public ImageView iviPlace;
38 |
39 | public ViewHolder(View v) {
40 | super(v);
41 | tviNick = (TextView) v.findViewById(R.id.tviNick);
42 | tviTitle = (TextView) v.findViewById(R.id.tviTitle);
43 | tviDesc = (TextView) v.findViewById(R.id.tviDesc);
44 | iviPlace = (ImageView) v.findViewById(R.id.iviPlace);
45 | }
46 | }
47 |
48 | @Override
49 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
50 | // create a new view
51 | View v = LayoutInflater.from(parent.getContext())
52 | .inflate(R.layout.row_place, parent, false);
53 | // set the view's size, margins, paddings and layout parameters
54 | ViewHolder vh = new ViewHolder(v);
55 | return vh;
56 | }
57 |
58 | @Override
59 | public void onBindViewHolder(ViewHolder holder, int position) {
60 | Place place = places.get(position);
61 | if (place != null) {
62 | String name= (TextUtils.isEmpty(place.getTitle())?(""):(place.getTitle()));
63 | String desc= (TextUtils.isEmpty(place.getDesc())?(""):(place.getDesc()));
64 | String nick= (TextUtils.isEmpty(place.getNick())?(""):(place.getNick()));
65 | if(nick.length()>=0) nick= nick.substring(0,1);
66 | if(desc.length()>=DESCLMAX) desc= desc.substring(0,DESCLMAX)+"...";
67 | nick= nick.toUpperCase();
68 |
69 | String path= place.getPhoto();
70 | int headerColor=Color.parseColor(place.getHeaderColor()!=null?(place.getHeaderColor()):(DEFAULTCOLOR));
71 | holder.tviTitle.setText(name);
72 | holder.tviDesc.setText(desc);
73 | holder.tviNick.setText(nick);
74 | holder.tviNick.setBackgroundColor(headerColor);
75 | imageLoaderHelper.getLoader().load(path,holder.iviPlace);
76 | }
77 | }
78 |
79 | @Override
80 | public int getItemCount() {
81 | return places.size();
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/adapter/PlaceAdapter.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.adapter;
2 |
3 | import android.graphics.Color;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.text.TextUtils;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.emedinaa.perutravel.R;
13 | import com.emedinaa.perutravel.domain.model.Place;
14 | import com.emedinaa.perutravel.presentation.utils.media.ImageLoaderHelper;
15 |
16 | import java.util.List;
17 |
18 | /**
19 | * Created by emedinaa on 16/04/16.
20 | */
21 | public class PlaceAdapter extends RecyclerView.Adapter {
22 | private List places;
23 | private ImageLoaderHelper imageLoaderHelper;
24 | private int DESCMAX=40;
25 | private String DEFAULTCOLOR="#585858";
26 |
27 | public PlaceAdapter(List places) {
28 | this.places = places;
29 | imageLoaderHelper= new ImageLoaderHelper(ImageLoaderHelper.GLIDE);
30 | }
31 |
32 | public static class ViewHolder extends RecyclerView.ViewHolder
33 | {
34 | public TextView tviNick;
35 | public TextView tviTitle;
36 | public TextView tviDesc;
37 | public ImageView iviPlace;
38 |
39 | public ViewHolder(View v) {
40 | super(v);
41 | tviNick = (TextView) v.findViewById(R.id.tviNick);
42 | tviTitle = (TextView) v.findViewById(R.id.tviTitle);
43 | tviDesc = (TextView) v.findViewById(R.id.tviDesc);
44 | iviPlace = (ImageView) v.findViewById(R.id.iviPlace);
45 | }
46 | }
47 |
48 | @Override
49 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
50 | // create a new view
51 | View v = LayoutInflater.from(parent.getContext())
52 | .inflate(R.layout.row_place, parent, false);
53 | // set the view's size, margins, paddings and layout parameters
54 | ViewHolder vh = new ViewHolder(v);
55 | return vh;
56 | }
57 |
58 | @Override
59 | public void onBindViewHolder(ViewHolder holder, int position) {
60 | Place place = places.get(position);
61 | if (place != null) {
62 | String name= (TextUtils.isEmpty(place.getTitle())?(""):(place.getTitle()));
63 | String desc= (TextUtils.isEmpty(place.getDesc())?(""):(place.getDesc()));
64 | String nick= (TextUtils.isEmpty(place.getNick())?(""):(place.getNick()));
65 | if(nick.length()>=0) nick= nick.substring(0,1);
66 | if(desc.length()>=DESCMAX) desc= desc.substring(0,DESCMAX)+"...";
67 | nick= nick.toUpperCase();
68 |
69 | String path= place.getPhoto();
70 | int headerColor=Color.parseColor(place.getHeaderColor()!=null?(place.getHeaderColor()):(DEFAULTCOLOR));
71 | holder.tviTitle.setText(name);
72 | holder.tviDesc.setText(desc);
73 | holder.tviNick.setText(nick);
74 | holder.tviNick.setBackgroundColor(headerColor);
75 | imageLoaderHelper.getLoader().load(path,holder.iviPlace);
76 | }
77 | }
78 |
79 | @Override
80 | public int getItemCount() {
81 | return places.size();
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/java/com/emedinaa/perutravel/presentation/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.Log;
8 | import android.view.View;
9 |
10 | import com.emedinaa.perutravel.R;
11 | import com.emedinaa.perutravel.domain.model.Place;
12 | import com.emedinaa.perutravel.presentation.adapter.PlaceAdapter;
13 | import com.emedinaa.perutravel.presentation.presenter.PlacePresenter;
14 | import com.emedinaa.perutravel.presentation.ui.recycler.MarginDecoration;
15 | import com.emedinaa.perutravel.presentation.ui.recycler.RecyclerClickListener;
16 | import com.emedinaa.perutravel.presentation.ui.recycler.RecyclerTouchListener;
17 | import com.emedinaa.perutravel.presentation.view.MainView;
18 |
19 | import java.util.List;
20 |
21 | import butterknife.Bind;
22 |
23 | public class MainActivity extends BaseActivity implements MainView {
24 |
25 | private static final String TAG ="MainActivity";
26 |
27 | @Bind(R.id.flayProgress)View flayProgress;
28 | @Bind(R.id.container)View container;
29 | @Bind(R.id.rvPlace)RecyclerView rvPlace;
30 |
31 | private PlacePresenter placePresenter;
32 | private PlaceAdapter placeAdapter;
33 | private List places;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.activity_main);
39 | injectView();
40 | placePresenter= new PlacePresenter();
41 | placePresenter.addView(this);
42 | ui();
43 |
44 | loadPlaces();
45 | }
46 |
47 | private void loadPlaces() {
48 | placePresenter.loadPlaces();
49 | }
50 |
51 | private void ui() {
52 | rvPlace.setHasFixedSize(false);
53 | rvPlace.addItemDecoration(new MarginDecoration(this));
54 | rvPlace.setLayoutManager(new LinearLayoutManager(this));
55 |
56 | rvPlace.addOnItemTouchListener(new RecyclerTouchListener(this, rvPlace, new RecyclerClickListener() {
57 | @Override
58 | public void onClick(View view, int position) {
59 | if(places!=null) {
60 | Place place= places.get(position);
61 | placePresenter.selectedPlace(place);
62 | }
63 | }
64 |
65 | @Override
66 | public void onLongClick(View view, int position) {
67 | }
68 | }));
69 | }
70 |
71 | @Override
72 | public void showLoading() {
73 | flayProgress.setVisibility(View.VISIBLE);
74 | }
75 |
76 | @Override
77 | public void hideLoading() {
78 | flayProgress.setVisibility(View.GONE);
79 | }
80 |
81 | @Override
82 | public void renderPlaces(List places) {
83 | Log.v(TAG, "renderplaces " + places+" size "+places.size());
84 | this.places= places;
85 | placeAdapter= new PlaceAdapter(places);
86 | rvPlace.setAdapter(placeAdapter);
87 | }
88 |
89 | @Override
90 | public void showErrorMessage(String message) {
91 | showMessage(container,message);
92 | }
93 |
94 | @Override
95 | public void gotoPlace(Bundle bundle) {
96 | next(bundle,PlaceActivity.class,false);
97 | }
98 |
99 | @Override
100 | public Context getContext() {
101 | return this;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/src/main/res/layout/activity_place.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
22 |
25 |
34 |
45 |
46 |
47 |
53 |
57 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/res/layout/activity_place.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
22 |
25 |
34 |
45 |
46 |
47 |
53 |
57 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/src/main/java/com/emedinaa/perutravel/presentation/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.emedinaa.perutravel.presentation.ui;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.widget.LinearLayoutManager;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.util.Log;
7 | import android.view.View;
8 |
9 | import com.emedinaa.perutravel.R;
10 | import com.emedinaa.perutravel.data.datasource.PlaceDataStoreFactory;
11 | import com.emedinaa.perutravel.data.mapper.PlaceDataMapper;
12 | import com.emedinaa.perutravel.data.repository.PlaceDataRepository;
13 | import com.emedinaa.perutravel.domain.interactor.PlaceInteractor;
14 | import com.emedinaa.perutravel.domain.model.Place;
15 | import com.emedinaa.perutravel.domain.repository.PlaceRepository;
16 | import com.emedinaa.perutravel.presentation.adapter.PlaceAdapter;
17 | import com.emedinaa.perutravel.presentation.presenter.PlacePresenter;
18 | import com.emedinaa.perutravel.presentation.ui.recycler.MarginDecoration;
19 | import com.emedinaa.perutravel.presentation.ui.recycler.RecyclerClickListener;
20 | import com.emedinaa.perutravel.presentation.ui.recycler.RecyclerTouchListener;
21 | import com.emedinaa.perutravel.presentation.view.MainView;
22 |
23 | import java.util.List;
24 |
25 | import butterknife.Bind;
26 |
27 | public class MainActivity extends BaseActivity implements MainView {
28 |
29 | private static final String TAG ="MainActivity";
30 |
31 | @Bind(R.id.flayProgress)View flayProgress;
32 | @Bind(R.id.container)View container;
33 | @Bind(R.id.rvPlace)RecyclerView rvPlace;
34 |
35 | private PlacePresenter placePresenter;
36 | private PlaceAdapter placeAdapter;
37 | private List places;
38 |
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.activity_main);
43 | injectView();
44 | setupPresenter();
45 | ui();
46 |
47 | loadPlaces();
48 | }
49 |
50 | private void setupPresenter() {
51 | PlaceRepository placeRepository= new PlaceDataRepository(new PlaceDataStoreFactory(getApplicationContext()),new PlaceDataMapper());
52 | PlaceInteractor placeInteractor= new PlaceInteractor(placeRepository);
53 | placePresenter= new PlacePresenter(placeInteractor);
54 | placePresenter.addView(this);
55 | }
56 |
57 | private void loadPlaces() {
58 | placePresenter.loadPlaces();
59 | }
60 |
61 | private void ui() {
62 | rvPlace.setHasFixedSize(false);
63 | rvPlace.addItemDecoration(new MarginDecoration(this));
64 | rvPlace.setLayoutManager(new LinearLayoutManager(this));
65 |
66 | rvPlace.addOnItemTouchListener(new RecyclerTouchListener(this, rvPlace, new RecyclerClickListener() {
67 | @Override
68 | public void onClick(View view, int position) {
69 | if(places!=null) {
70 | Place place= places.get(position);
71 | placePresenter.selectedPlace(place);
72 | }
73 | }
74 |
75 | @Override
76 | public void onLongClick(View view, int position) {
77 | }
78 | }));
79 | }
80 |
81 | @Override
82 | public void showLoading() {
83 | flayProgress.setVisibility(View.VISIBLE);
84 | }
85 |
86 | @Override
87 | public void hideLoading() {
88 | flayProgress.setVisibility(View.GONE);
89 | }
90 |
91 | @Override
92 | public void renderPlaces(List places) {
93 | Log.v(TAG, "renderplaces " + places+" size "+places.size());
94 | this.places= places;
95 | placeAdapter= new PlaceAdapter(places);
96 | rvPlace.setAdapter(placeAdapter);
97 | }
98 |
99 | @Override
100 | public void showErrorMessage(String message) {
101 | showMessage(container,message);
102 | }
103 |
104 | @Override
105 | public void gotoPlace(Bundle bundle) {
106 | next(bundle,PlaceActivity.class,false);
107 | }
108 |
109 | @Override
110 | protected void onDestroy() {
111 | if(placePresenter!=null){placePresenter.removeView(this);}
112 | super.onDestroy();
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/source/PeruTravel/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/source/PeruTravelLayers/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/source/PeruTravel/app/json/places.json:
--------------------------------------------------------------------------------
1 | {
2 | "offset": 0,
3 | "data": [
4 | {
5 | "city": "Puno",
6 | "created": 1461022997000,
7 | "___class": "Place",
8 | "photo": "http://www.go2peru.com/destinos/large/pun_jul06_1315.jpg",
9 | "ownerId": null,
10 | "title": "Lago Titicaca y Puno",
11 | "updated": 1461023013000,
12 | "objectId": "B733A65C-FC35-CCDA-FF57-C34B1C5E7900",
13 | "desc": "Puno está localizado en las alturas de los Andes, a orillas del Titicaca, el lago navegable más alto del mundo habitado por los Uros y con maravillos paisajes. En las islas de Amantani y Taquile podrá tener la experiencia de compartir la vida con sus nativos y hacer turismo vivencial. Tierra del legendario pueblo Aymara y la Cultura Tiahuanaco. Puno es la capital folklórica del Perú. La fiesta de la Virgen de la Candelaria celebrada en febrero, es una extraordinaria oportunidad de vivir las tradiciones del pueblo puneño. Ofrece una excelente alternativa para el turismo arqueológico, de culturas vivas y biodiversidad.",
14 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
15 | },
16 | {
17 | "city": "Iquitos",
18 | "created": 1461022922000,
19 | "___class": "Place",
20 | "photo": "http://www.go2peru.com/destinos/small/cruice1z.jpg",
21 | "ownerId": null,
22 | "title": "Iquitos y Río Amazonas",
23 | "updated": 1461022954000,
24 | "objectId": "68EB54A0-7453-259E-FF15-702D83CC6700",
25 | "desc": "La Selva Amazónica. Un lugar ideal para los amantes del turismo de naturaleza y la biodiversidad y para quienes desean sentir un íntimo contacto con la naturaleza virgen de los bosques amazónicos. Desde Iquitos podrá tomar un crucero en el río Amazonas o alojarse en los albergues y lodges ubicados en plena jungla para explorar la selva y los más audaces y aventureros pueden llegar hasta las áreas naturales protegidas, destacando Pacaya Samiria y Allpahuayo Mishana, con exuberante fauna y flora, ideal para observación de aves, también puede tomar contacto con los aborígenes de la amazonía o conocer los ritos del ayahuasca.",
26 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
27 | },
28 | {
29 | "city": "Cuzco",
30 | "created": 1461022699000,
31 | "___class": "Place",
32 | "photo": "http://www.go2peru.com/destinos/small/cuz_mapi02x_jmz.jpg",
33 | "ownerId": null,
34 | "title": "Cuzco - Machu Picchu - Camino Inca",
35 | "updated": 1461022906000,
36 | "objectId": "58D6FCF1-117A-B740-FFBD-5AAC9479D400",
37 | "desc": "\"La Capital Arqueológica de América\"; constituye el mayor atractivo turístico del Perú y el más visitado. Cuzco fue la más grande ciudad y capital del Imperio Inca, luego fue tomada por los conquistadores españoles. Hoy en día muestra una arquitectura que fusiona el estilo Inca con el español. Su pueblo conserva con orgullo sus costumbres y tradiciones. Un lugar obligado para conocer es la mística y enigmática Machu Picchu la ciudad sagrada de los Incas que los conquistadores nunca conocieron y que fue descubirta a la cultura occidental en 1911, para llegar a ella también a través de la más famosa caminata el Camino Inca. Cuzco, como Machu Picchu, por su valor histórico y por su belleza han sido considerados como Patrimonio de la Humanidad. El Valle Sagrado de los Incas, Choquequirao, el Parque Nacional del Manu y muchos otros fascinantes lugares están esperando por usted.",
38 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
39 | },
40 | {
41 | "city": "Chiclayo",
42 | "created": 1461022671000,
43 | "___class": "Place",
44 | "photo": "http://www.go2peru.com/destinos/small/cix_museotr_25az.jpg",
45 | "ownerId": null,
46 | "title": "Chiclayo",
47 | "updated": 1461022886000,
48 | "objectId": "75CA8BE6-7188-99F5-FFBE-3AF270527800",
49 | "desc": "La ciudad de la Amistad. Chiclayo posee la fortuna de ser la puerta de entrada para los más recientes y espectaculares descubrimientos arqueológicos como el Señor de Sipán en Huaca Rajada, el Señor de Sicán en Batán Grande - Santuario Histórico Bosque de Pómac, el Valle de las Pirámides de Túcume y el Museo Tumbas Reales de Sipán. Gracias a esto, Chiclayo se convierte en el segundo destino, después del Cuzco, por el interés arqueológico e histórico que genera. Chiclayo es la ciudad de los brujos, curanderos y el esoterismo. Además en el circuito de playas podrá apreciar los milenarios caballitos de totora en Pimentel o Eten la 2da ciudad eucarística del Mundo. Tres áreas naturales protegidas ideales para los amantes de la naturaleza y observadores de aves. Posee una de las mejores cocinas del norte del Perú.",
50 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
51 | },
52 | {
53 | "city": "Arequipa",
54 | "created": 1461022505000,
55 | "___class": "Place",
56 | "photo": "http://www.go2peru.com/destinos/small/Aqp_may06_0477z.jpg",
57 | "ownerId": null,
58 | "title": "Arequipa y Valle del Colca",
59 | "updated": 1461022890000,
60 | "objectId": "E35ADC42-F67D-6943-FFE8-6109F6634A00",
61 | "desc": "La ciudad de Arequipa también es conocida como la \"Ciudad Blanca\". Su centro histórico ha sido reconocido como Patrimonio Cultural de la Humanidad por la arquitectura de sus hermosas construcciones coloniales en sillar blanco, destacando sus casonas, iglesias, templos y monasterios como Santa Catalina. Está rodeada de una bella campiña con pueblos con hermosos paisajes. Desde aquí podrá visitar el famoso Valle del Colca y el Cañón del Colca, áreas naturales protegidas como la Reserva Nacional de Salinas y Aguada Blanca y el Santuario Nacional Lagunas de Mejía. En sus montañas y picos nevados, sus pampas o sus ríos son excelentes escenarios para deportes de aventura. Es un destino ideal para conocer monumentos coloniales, culturas vivas y realizar turismo al aire libre disfrutando de aventura, naturaleza y biodiversidad. Arequipa goza de una de las mejores cocinas del Perú.",
62 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
63 | }
64 | ],
65 | "nextPage": null,
66 | "totalObjects": 5
67 | }
--------------------------------------------------------------------------------
/source/PeruTravelLayers/app/json/places.json:
--------------------------------------------------------------------------------
1 | {
2 | "offset": 0,
3 | "data": [
4 | {
5 | "city": "Puno",
6 | "created": 1461022997000,
7 | "___class": "Place",
8 | "photo": "http://www.go2peru.com/destinos/large/pun_jul06_1315.jpg",
9 | "ownerId": null,
10 | "title": "Lago Titicaca y Puno",
11 | "updated": 1461023013000,
12 | "objectId": "B733A65C-FC35-CCDA-FF57-C34B1C5E7900",
13 | "desc": "Puno está localizado en las alturas de los Andes, a orillas del Titicaca, el lago navegable más alto del mundo habitado por los Uros y con maravillos paisajes. En las islas de Amantani y Taquile podrá tener la experiencia de compartir la vida con sus nativos y hacer turismo vivencial. Tierra del legendario pueblo Aymara y la Cultura Tiahuanaco. Puno es la capital folklórica del Perú. La fiesta de la Virgen de la Candelaria celebrada en febrero, es una extraordinaria oportunidad de vivir las tradiciones del pueblo puneño. Ofrece una excelente alternativa para el turismo arqueológico, de culturas vivas y biodiversidad.",
14 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
15 | },
16 | {
17 | "city": "Iquitos",
18 | "created": 1461022922000,
19 | "___class": "Place",
20 | "photo": "http://www.go2peru.com/destinos/small/cruice1z.jpg",
21 | "ownerId": null,
22 | "title": "Iquitos y Río Amazonas",
23 | "updated": 1461022954000,
24 | "objectId": "68EB54A0-7453-259E-FF15-702D83CC6700",
25 | "desc": "La Selva Amazónica. Un lugar ideal para los amantes del turismo de naturaleza y la biodiversidad y para quienes desean sentir un íntimo contacto con la naturaleza virgen de los bosques amazónicos. Desde Iquitos podrá tomar un crucero en el río Amazonas o alojarse en los albergues y lodges ubicados en plena jungla para explorar la selva y los más audaces y aventureros pueden llegar hasta las áreas naturales protegidas, destacando Pacaya Samiria y Allpahuayo Mishana, con exuberante fauna y flora, ideal para observación de aves, también puede tomar contacto con los aborígenes de la amazonía o conocer los ritos del ayahuasca.",
26 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
27 | },
28 | {
29 | "city": "Cuzco",
30 | "created": 1461022699000,
31 | "___class": "Place",
32 | "photo": "http://www.go2peru.com/destinos/small/cuz_mapi02x_jmz.jpg",
33 | "ownerId": null,
34 | "title": "Cuzco - Machu Picchu - Camino Inca",
35 | "updated": 1461022906000,
36 | "objectId": "58D6FCF1-117A-B740-FFBD-5AAC9479D400",
37 | "desc": "\"La Capital Arqueológica de América\"; constituye el mayor atractivo turístico del Perú y el más visitado. Cuzco fue la más grande ciudad y capital del Imperio Inca, luego fue tomada por los conquistadores españoles. Hoy en día muestra una arquitectura que fusiona el estilo Inca con el español. Su pueblo conserva con orgullo sus costumbres y tradiciones. Un lugar obligado para conocer es la mística y enigmática Machu Picchu la ciudad sagrada de los Incas que los conquistadores nunca conocieron y que fue descubirta a la cultura occidental en 1911, para llegar a ella también a través de la más famosa caminata el Camino Inca. Cuzco, como Machu Picchu, por su valor histórico y por su belleza han sido considerados como Patrimonio de la Humanidad. El Valle Sagrado de los Incas, Choquequirao, el Parque Nacional del Manu y muchos otros fascinantes lugares están esperando por usted.",
38 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
39 | },
40 | {
41 | "city": "Chiclayo",
42 | "created": 1461022671000,
43 | "___class": "Place",
44 | "photo": "http://www.go2peru.com/destinos/small/cix_museotr_25az.jpg",
45 | "ownerId": null,
46 | "title": "Chiclayo",
47 | "updated": 1461022886000,
48 | "objectId": "75CA8BE6-7188-99F5-FFBE-3AF270527800",
49 | "desc": "La ciudad de la Amistad. Chiclayo posee la fortuna de ser la puerta de entrada para los más recientes y espectaculares descubrimientos arqueológicos como el Señor de Sipán en Huaca Rajada, el Señor de Sicán en Batán Grande - Santuario Histórico Bosque de Pómac, el Valle de las Pirámides de Túcume y el Museo Tumbas Reales de Sipán. Gracias a esto, Chiclayo se convierte en el segundo destino, después del Cuzco, por el interés arqueológico e histórico que genera. Chiclayo es la ciudad de los brujos, curanderos y el esoterismo. Además en el circuito de playas podrá apreciar los milenarios caballitos de totora en Pimentel o Eten la 2da ciudad eucarística del Mundo. Tres áreas naturales protegidas ideales para los amantes de la naturaleza y observadores de aves. Posee una de las mejores cocinas del norte del Perú.",
50 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
51 | },
52 | {
53 | "city": "Arequipa",
54 | "created": 1461022505000,
55 | "___class": "Place",
56 | "photo": "http://www.go2peru.com/destinos/small/Aqp_may06_0477z.jpg",
57 | "ownerId": null,
58 | "title": "Arequipa y Valle del Colca",
59 | "updated": 1461022890000,
60 | "objectId": "E35ADC42-F67D-6943-FFE8-6109F6634A00",
61 | "desc": "La ciudad de Arequipa también es conocida como la \"Ciudad Blanca\". Su centro histórico ha sido reconocido como Patrimonio Cultural de la Humanidad por la arquitectura de sus hermosas construcciones coloniales en sillar blanco, destacando sus casonas, iglesias, templos y monasterios como Santa Catalina. Está rodeada de una bella campiña con pueblos con hermosos paisajes. Desde aquí podrá visitar el famoso Valle del Colca y el Cañón del Colca, áreas naturales protegidas como la Reserva Nacional de Salinas y Aguada Blanca y el Santuario Nacional Lagunas de Mejía. En sus montañas y picos nevados, sus pampas o sus ríos son excelentes escenarios para deportes de aventura. Es un destino ideal para conocer monumentos coloniales, culturas vivas y realizar turismo al aire libre disfrutando de aventura, naturaleza y biodiversidad. Arequipa goza de una de las mejores cocinas del Perú.",
62 | "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"city\",\"created\",\"___class\",\"photo\",\"ownerId\",\"title\",\"updated\",\"objectId\",\"desc\"],\"relatedObjects\":{}}"
63 | }
64 | ],
65 | "nextPage": null,
66 | "totalObjects": 5
67 | }
--------------------------------------------------------------------------------