├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── 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
│ │ │ ├── drawable-hdpi
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-mdpi
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-hdpi-v11
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-hdpi-v9
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-mdpi-v11
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-mdpi-v9
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xhdpi-v11
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xhdpi-v9
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xxhdpi-v9
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── drawable-xxhdpi-v11
│ │ │ │ └── ic_report_notif.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── drawable
│ │ │ │ ├── coffee_item_divider.xml
│ │ │ │ ├── ic_approve_24dp.xml
│ │ │ │ └── ic_shopping_cart_24dp.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── view_coffee_count_picker.xml
│ │ │ │ ├── item_coffee.xml
│ │ │ │ ├── item_coffee_detail.xml
│ │ │ │ ├── item_coffee_order_detail.xml
│ │ │ │ ├── activity_coffee_detail.xml
│ │ │ │ ├── activity_coffee_order_details.xml
│ │ │ │ └── activity_coffee_order_list.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── alexzh
│ │ │ │ └── simplecoffeeorder
│ │ │ │ ├── presentation
│ │ │ │ ├── CoffeeDetailPresenter.java
│ │ │ │ ├── CoffeeOrderDetailsPresenter.java
│ │ │ │ ├── CoffeeDetailPresenterImpl.java
│ │ │ │ ├── CoffeeOrderListPresenter.java
│ │ │ │ ├── CoffeeOrderDetailsPresenterImpl.java
│ │ │ │ └── CoffeeOrderListPresenterImpl.java
│ │ │ │ ├── view
│ │ │ │ ├── CoffeeDetailView.java
│ │ │ │ ├── CoffeeOrderListView.java
│ │ │ │ ├── CoffeeOrderDetailsView.java
│ │ │ │ └── activity
│ │ │ │ │ ├── CoffeeDetailActivity.java
│ │ │ │ │ ├── CoffeeOrderDetailsActivity.java
│ │ │ │ │ └── CoffeeOrderListActivity.java
│ │ │ │ ├── utils
│ │ │ │ ├── CoffeeUtils.java
│ │ │ │ └── CoffeeOrderUtils.java
│ │ │ │ ├── model
│ │ │ │ └── Coffee.java
│ │ │ │ ├── CoffeeService.java
│ │ │ │ ├── customview
│ │ │ │ ├── CoffeeCountPicker.java
│ │ │ │ └── recyclerview
│ │ │ │ │ └── DividerItemDecoration.java
│ │ │ │ └── adapter
│ │ │ │ ├── CoffeeDetailAdapter.java
│ │ │ │ ├── CoffeeOrderDetailListViewAdapter.java
│ │ │ │ └── CoffeeOrderListAdapter.java
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── alexzh
│ │ └── simplecoffeeorder
│ │ ├── utils
│ │ └── StringUtils.java
│ │ ├── matchers
│ │ ├── ListViewMatcher.java
│ │ ├── ToolbarMatcher.java
│ │ ├── RootMatcher.java
│ │ └── RecyclerViewMatcher.java
│ │ ├── ServiceIdlingResource.java
│ │ ├── ui
│ │ ├── CoffeeDetailActivityTest.java
│ │ ├── CoffeeOrderListActivityTest.java
│ │ ├── FullOrderTest.java
│ │ └── CoffeeOrderDetailsActivityTest.java
│ │ ├── actions
│ │ └── RecyclerChildViewActions.java
│ │ └── externalapp
│ │ └── SystemAppsTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .idea
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-hdpi/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-mdpi/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xhdpi/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xxhdpi/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi-v11/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-hdpi-v11/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi-v9/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-hdpi-v9/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi-v11/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-mdpi-v11/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi-v9/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-mdpi-v9/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi-v11/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xhdpi-v11/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi-v9/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xhdpi-v9/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi-v9/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xxhdpi-v9/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi-v11/ic_report_notif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexZhukovich/SimpleCoffeeOrderTestProject/HEAD/app/src/main/res/drawable-xxhdpi-v11/ic_report_notif.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jun 22 17:22:59 EDT 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-4.0-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/presentation/CoffeeDetailPresenter.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.presentation;
2 |
3 | import com.alexzh.simplecoffeeorder.view.CoffeeDetailView;
4 |
5 | public interface CoffeeDetailPresenter {
6 |
7 | void setView(CoffeeDetailView view);
8 |
9 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/coffee_item_divider.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/presentation/CoffeeOrderDetailsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.presentation;
2 |
3 | public interface CoffeeOrderDetailsPresenter {
4 |
5 | void onResume();
6 |
7 | float calculateTotalPrice();
8 |
9 | void payForCoffee();
10 |
11 | void moveToOrderList();
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 | 0dp
7 | 1dp
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/view/CoffeeDetailView.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.view;
2 |
3 | import com.alexzh.simplecoffeeorder.model.Coffee;
4 |
5 | public interface CoffeeDetailView {
6 |
7 | Coffee getCoffee();
8 |
9 | void displayCoffeeName(String coffeeName);
10 |
11 | void displayCoffeeDetailInformation(Coffee coffee);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_approve_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/alexzh/simplecoffeeorder/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.utils;
2 |
3 | import android.support.test.rule.ActivityTestRule;
4 |
5 | public class StringUtils {
6 |
7 | public static String getString(ActivityTestRule rule, int resId) {
8 | return rule.getActivity().getString(resId);
9 | }
10 |
11 | public static String getString(ActivityTestRule rule, int resId, Object... args) {
12 | return rule.getActivity().getString(resId, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/view/CoffeeOrderListView.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.view;
2 |
3 | import com.alexzh.simplecoffeeorder.model.Coffee;
4 |
5 | import java.util.TreeMap;
6 |
7 | public interface CoffeeOrderListView {
8 |
9 | void displayCoffeeList(TreeMap coffeeOrderMap);
10 |
11 | void displayTotalPrice(float totalPrice);
12 |
13 | void displaySnackbar(int resId, int duration);
14 |
15 | void showLoading();
16 |
17 | void hideLoading();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/view/CoffeeOrderDetailsView.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.view;
2 |
3 | import com.alexzh.simplecoffeeorder.model.Coffee;
4 |
5 | import java.util.TreeMap;
6 |
7 | public interface CoffeeOrderDetailsView {
8 |
9 | void displayOrderedCoffeeList(TreeMap coffeeMap);
10 |
11 | void displayTotalPrice(float totalPrice);
12 |
13 | String getDeliveryInfo();
14 |
15 | void displayDeliveryInfo(String deliveryInfo);
16 |
17 | void disableDeliveryInfo();
18 |
19 | void enableDeliveryInfo();
20 |
21 | void sendNotification(TreeMap order);
22 |
23 | void moveToOrderList();
24 | }
25 |
--------------------------------------------------------------------------------
/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 /Users/alex/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 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_shopping_cart_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/utils/CoffeeUtils.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.utils;
2 |
3 | import com.alexzh.simplecoffeeorder.model.Coffee;
4 |
5 | public class CoffeeUtils {
6 |
7 | public static String getIngredientsString(Coffee coffee) {
8 | if (coffee != null) {
9 | StringBuilder ingredients = new StringBuilder();
10 | for (int i = 0; i < coffee.getIngredients().length; i++) {
11 | ingredients.append(coffee.getIngredients()[i]);
12 | if (i != coffee.getIngredients().length - 1) {
13 | ingredients.append(",\n");
14 | }
15 | }
16 | return ingredients.toString();
17 | }
18 | return null;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/alexzh/simplecoffeeorder/presentation/CoffeeDetailPresenterImpl.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.presentation;
2 |
3 | import com.alexzh.simplecoffeeorder.model.Coffee;
4 | import com.alexzh.simplecoffeeorder.view.CoffeeDetailView;
5 |
6 | public class CoffeeDetailPresenterImpl implements CoffeeDetailPresenter {
7 |
8 | CoffeeDetailView mView;
9 |
10 | @Override
11 | public void setView(CoffeeDetailView view) {
12 | this.mView = view;
13 | displayCoffeeInfo();
14 | }
15 |
16 | private void displayCoffeeInfo() {
17 | Coffee coffee = mView.getCoffee();
18 | if (coffee != null) {
19 | mView.displayCoffeeName(coffee.getName());
20 | mView.displayCoffeeDetailInformation(coffee);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SimpleCoffeeOrderTestProject
3 | Coffee: $%.1f
4 | $%.1f
5 | Total price: $%.1f
6 | +
7 | -
8 | 0
9 | Pay
10 | Please order more coffee
11 |
12 | Ingredients
13 | Price
14 | Enter your name
15 | Deliver to %s
16 |
17 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/alexzh/simplecoffeeorder/matchers/ListViewMatcher.java:
--------------------------------------------------------------------------------
1 | package com.alexzh.simplecoffeeorder.matchers;
2 |
3 | import android.support.test.espresso.matcher.BoundedMatcher;
4 |
5 | import com.alexzh.simplecoffeeorder.model.Coffee;
6 |
7 | import org.hamcrest.Description;
8 | import org.hamcrest.Matcher;
9 |
10 | public class ListViewMatcher {
11 |
12 | public static Matcher