├── 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 withCoffee(final Coffee coffee) { 13 | return new BoundedMatcher(Coffee.class) { 14 | 15 | @Override 16 | public void describeTo(Description description) { 17 | description.appendText("has value: " + coffee.toString()); 18 | } 19 | 20 | @Override 21 | protected boolean matchesSafely(Coffee item) { 22 | return item.equals(coffee); 23 | } 24 | }; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/androidTest/java/com/alexzh/simplecoffeeorder/matchers/ToolbarMatcher.java: -------------------------------------------------------------------------------- 1 | package com.alexzh.simplecoffeeorder.matchers; 2 | 3 | import android.support.test.espresso.matcher.BoundedMatcher; 4 | import android.support.v7.widget.Toolbar; 5 | 6 | import org.hamcrest.Description; 7 | import org.hamcrest.Matcher; 8 | 9 | public class ToolbarMatcher { 10 | 11 | public static Matcher withToolbarTitle(final Matcher textMatcher) { 12 | return new BoundedMatcher(Toolbar.class) { 13 | @Override public boolean matchesSafely(Toolbar toolbar) { 14 | return textMatcher.matches(toolbar.getTitle()); 15 | } 16 | @Override public void describeTo(Description description) { 17 | description.appendText("with toolbar title: "); 18 | textMatcher.describeTo(description); 19 | } 20 | }; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/alexzh/simplecoffeeorder/utils/CoffeeOrderUtils.java: -------------------------------------------------------------------------------- 1 | package com.alexzh.simplecoffeeorder.utils; 2 | 3 | import com.alexzh.simplecoffeeorder.model.Coffee; 4 | 5 | import java.util.TreeMap; 6 | 7 | public class CoffeeOrderUtils { 8 | 9 | public static Coffee getCoffeeByPosition(TreeMap orderedMap, int position) { 10 | int interactionPosition = 0; 11 | for (Coffee key : orderedMap.keySet()) { 12 | if (interactionPosition == position) { 13 | return key; 14 | } 15 | interactionPosition++; 16 | } 17 | return null; 18 | } 19 | 20 | public static int getCountByCoffee(TreeMap orderedMap, Coffee coffee) { 21 | for (Coffee key : orderedMap.keySet()) { 22 | if (key.equals(coffee)) { 23 | return orderedMap.get(key); 24 | } 25 | } 26 | return 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/alexzh/simplecoffeeorder/presentation/CoffeeOrderListPresenter.java: -------------------------------------------------------------------------------- 1 | package com.alexzh.simplecoffeeorder.presentation; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | 6 | import com.alexzh.simplecoffeeorder.customview.CoffeeCountPicker; 7 | import com.alexzh.simplecoffeeorder.model.Coffee; 8 | import com.alexzh.simplecoffeeorder.view.CoffeeOrderListView; 9 | 10 | import java.util.ArrayList; 11 | 12 | public interface CoffeeOrderListPresenter { 13 | 14 | void onResume(); 15 | 16 | void setView(CoffeeOrderListView view); 17 | 18 | void updateCoffeeOrder(Coffee coffee, int count, CoffeeCountPicker.CoffeeOrderOperation operation); 19 | 20 | void savePresenterData(Bundle outState); 21 | 22 | void restorePresenterData(Bundle savedInstanceState); 23 | 24 | void activityResults(int requestCode, int resultCode, Intent data); 25 | 26 | void onClickCoffeeList(int position); 27 | 28 | void showDetail(); 29 | 30 | void updateData(ArrayList coffeeList); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_coffee_count_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |