├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── avatar.png │ │ │ │ ├── wallpaper.png │ │ │ │ └── row_selector.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_menu_check.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_menu_check.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_menu_check.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_menu_check.png │ │ │ │ └── selectable_item_background.xml │ │ │ ├── menu │ │ │ │ └── main.xml │ │ │ ├── layout │ │ │ │ ├── toolbar_default.xml │ │ │ │ ├── fragment_navigation_drawer.xml │ │ │ │ ├── drawer_row.xml │ │ │ │ ├── fragment_main.xml │ │ │ │ ├── fragment_page.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── list_item_review.xml │ │ │ │ ├── activity_report_health.xml │ │ │ │ └── fragment_page_customer_info.xml │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── values-v21 │ │ │ │ └── styles.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── iftw │ │ │ │ └── materialnavigation │ │ │ │ ├── drawer │ │ │ │ ├── NavigationDrawerCallbacks.java │ │ │ │ ├── NavigationItem.java │ │ │ │ ├── NavigationDrawerAdapter.java │ │ │ │ └── NavigationDrawerFragment.java │ │ │ │ ├── service │ │ │ │ └── InterfaceMapping.java │ │ │ │ ├── wizard │ │ │ │ ├── ui │ │ │ │ │ ├── PageFragmentCallbacks.java │ │ │ │ │ ├── PresentWizardModel.java │ │ │ │ │ ├── SingleChoiceFragment.java │ │ │ │ │ ├── MultipleChoiceFragment.java │ │ │ │ │ ├── CustomerInfoFragment.java │ │ │ │ │ ├── ReviewFragment.java │ │ │ │ │ └── StepPagerStrip.java │ │ │ │ ├── model │ │ │ │ │ ├── ModelCallbacks.java │ │ │ │ │ ├── PageTreeNode.java │ │ │ │ │ ├── PageList.java │ │ │ │ │ ├── CustomerInfoPage.java │ │ │ │ │ ├── ReviewItem.java │ │ │ │ │ ├── MultipleFixedChoicePage.java │ │ │ │ │ ├── SingleFixedChoicePage.java │ │ │ │ │ ├── Page.java │ │ │ │ │ ├── AbstractWizardModel.java │ │ │ │ │ └── BranchPage.java │ │ │ │ └── PresentWizardModel.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── HealthIssueFragment.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── com │ │ └── iftw │ │ └── materialnavigation │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── .idea ├── (2).name ├── .name ├── copyright │ └── profiles_settings.xml ├── scopes │ └── scope_settings.xml ├── encodings.xml ├── encodings (2).xml ├── vcs (2).xml ├── vcs.xml ├── modules (2).xml ├── modules.xml ├── gradle.xml ├── compiler.xml ├── compiler (2).xml ├── misc.xml └── misc (2).xml ├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── Android-Material-Wizard-Drawer.iml ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.idea/ (2).name: -------------------------------------------------------------------------------- 1 | MaterialNavigation -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Android-Material-Wizard-Drawer -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable/avatar.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wallpaper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable/wallpaper.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable-hdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable-mdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable-xhdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkOSullivan94/Android-Material-Wizard-Drawer/HEAD/app/src/main/res/drawable-xxhdpi/ic_menu_check.png -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Material Wizard Drawer 2 | An Android template with a Material wizard and a Material navigation drawer. 3 | 4 | 5 | ![Material Navigation GIF](http://i.imgur.com/D9e6Qbw.gif) 6 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings (2).xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs (2).xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/drawer/NavigationDrawerCallbacks.java: -------------------------------------------------------------------------------- 1 | package com.iftw.materialnavigation.drawer; 2 | 3 | public interface NavigationDrawerCallbacks { 4 | void onNavigationDrawerItemSelected(int position); 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/selectable_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 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.2.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_default.xml: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.idea/modules (2).xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/iftw/materialnavigation/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.iftw.materialnavigation; 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 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Material Template 3 | Menu opened 4 | Menu closed 5 | Settings 6 | Name 7 | Email 8 | e.g. Larry 9 | Optional 10 | Menu Item 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/drawer_row.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 8 | 240dp 9 | 4dp 10 | 11 | 12 | 32dp 13 | 3dp 14 | 4dp 15 | 16 | 17 | -------------------------------------------------------------------------------- /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 C:\Users\MOS182\Documents\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/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/compiler (2).xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.iftw.materialnavigation" 9 | minSdkVersion 14 10 | targetSdkVersion 22 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 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.0.0' 25 | compile 'com.android.support:support-v4:22.0.0' 26 | compile 'com.android.support:recyclerview-v7:22.0.0' 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/drawer/NavigationItem.java: -------------------------------------------------------------------------------- 1 | package com.iftw.materialnavigation.drawer; 2 | 3 | 4 | import android.graphics.drawable.Drawable; 5 | 6 | /** 7 | * Created by poliveira on 24/10/2014. 8 | */ 9 | public class NavigationItem { 10 | private String mText; 11 | private Drawable mDrawable; 12 | 13 | public NavigationItem(String text, Drawable drawable) { 14 | mText = text; 15 | mDrawable = drawable; 16 | } 17 | 18 | public String getText() { 19 | return mText; 20 | } 21 | 22 | public void setText(String text) { 23 | mText = text; 24 | } 25 | 26 | public Drawable getDrawable() { 27 | return mDrawable; 28 | } 29 | 30 | public void setDrawable(Drawable drawable) { 31 | mDrawable = drawable; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/service/InterfaceMapping.java: -------------------------------------------------------------------------------- 1 | package com.iftw.materialnavigation.service; 2 | 3 | import com.iftw.materialnavigation.HealthIssueFragment; 4 | 5 | /** 6 | * Created by Petronela on 4/11/2015. 7 | */ 8 | public class InterfaceMapping { 9 | private static InterfaceMapping instance; 10 | private HealthIssueFragment fragment; 11 | 12 | private InterfaceMapping() { 13 | 14 | } 15 | 16 | public static InterfaceMapping getInstance() { 17 | if (instance == null) 18 | instance = new InterfaceMapping(); 19 | return instance; 20 | } 21 | 22 | public void setFragment(HealthIssueFragment fragment) { 23 | this.fragment = fragment; 24 | } 25 | 26 | public HealthIssueFragment getFragment() { 27 | return fragment; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/ui/PageFragmentCallbacks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.ui; 18 | 19 | public interface PageFragmentCallbacks { 20 | com.iftw.materialnavigation.wizard.model.Page onGetPage(String key); 21 | } 22 | -------------------------------------------------------------------------------- /Android-Material-Wizard-Drawer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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/main/java/com/iftw/materialnavigation/wizard/model/ModelCallbacks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | /** 20 | * Callback interface connecting {@link Page}, {@link AbstractWizardModel}, and model container 21 | * objects. 22 | */ 23 | public interface ModelCallbacks { 24 | void onPageDataChanged(Page page); 25 | void onPageTreeChanged(); 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/model/PageTreeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | import java.util.ArrayList; 20 | 21 | /** 22 | * Represents a node in the page tree. Can either be a single page, or a page container. 23 | */ 24 | public interface PageTreeNode { 25 | public Page findByKey(String key); 26 | public void flattenCurrentPageSequence(ArrayList dest); 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | #FF4081 12 | #D81B60 13 | #FF4081 14 | #FFF 15 | #FFF 16 | #424242 17 | #000 18 | 19 | #4433b5e5 20 | #ff0099cc 21 | #10000000 22 | 23 | #66000000 24 | 25 | #0c000000 26 | #2c000000 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_page.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 21 | 22 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 18 | 19 | 21 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/model/PageList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | import java.util.ArrayList; 20 | 21 | /** 22 | * Represents a list of wizard pages. 23 | */ 24 | public class PageList extends ArrayList implements PageTreeNode { 25 | 26 | public PageList() { 27 | 28 | } 29 | 30 | public PageList(Page... pages) { 31 | for (Page page : pages) { 32 | add(page); 33 | } 34 | } 35 | 36 | @Override 37 | public Page findByKey(String key) { 38 | for (Page childPage : this) { 39 | Page found = childPage.findByKey(key); 40 | if (found != null) { 41 | return found; 42 | } 43 | } 44 | 45 | return null; 46 | } 47 | 48 | @Override 49 | public void flattenCurrentPageSequence(ArrayList dest) { 50 | for (Page childPage : this) { 51 | childPage.flattenCurrentPageSequence(dest); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_review.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 27 | 28 | 37 | 38 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/model/CustomerInfoPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | import android.support.v4.app.ListFragment; 20 | import android.text.TextUtils; 21 | 22 | import com.iftw.materialnavigation.wizard.ui.CustomerInfoFragment; 23 | 24 | import java.util.ArrayList; 25 | 26 | /** 27 | * A page asking for a name and an email. 28 | */ 29 | public class CustomerInfoPage extends Page { 30 | public static final String NAME_DATA_KEY = "name"; 31 | public static final String EMAIL_DATA_KEY = "email"; 32 | 33 | public CustomerInfoPage(ModelCallbacks callbacks, String title) { 34 | super(callbacks, title); 35 | } 36 | 37 | @Override 38 | public ListFragment createFragment() { 39 | return CustomerInfoFragment.create(getKey()); 40 | } 41 | 42 | @Override 43 | public void getReviewItems(ArrayList dest) { 44 | dest.add(new ReviewItem("Your name", mData.getString(NAME_DATA_KEY), getKey(), -1)); 45 | dest.add(new ReviewItem("Your email", mData.getString(EMAIL_DATA_KEY), getKey(), -1)); 46 | } 47 | 48 | @Override 49 | public boolean isCompleted() { 50 | return !TextUtils.isEmpty(mData.getString(NAME_DATA_KEY)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/model/ReviewItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | /** 20 | * Represents a single line item on the final review page. 21 | * 22 | * @see 23 | */ 24 | public class ReviewItem { 25 | public static final int DEFAULT_WEIGHT = 0; 26 | 27 | private int mWeight; 28 | private String mTitle; 29 | private String mDisplayValue; 30 | private String mPageKey; 31 | 32 | public ReviewItem(String title, String displayValue, String pageKey) { 33 | this(title, displayValue, pageKey, DEFAULT_WEIGHT); 34 | } 35 | 36 | public ReviewItem(String title, String displayValue, String pageKey, int weight) { 37 | mTitle = title; 38 | mDisplayValue = displayValue; 39 | mPageKey = pageKey; 40 | mWeight = weight; 41 | } 42 | 43 | public String getDisplayValue() { 44 | return mDisplayValue; 45 | } 46 | 47 | public void setDisplayValue(String displayValue) { 48 | mDisplayValue = displayValue; 49 | } 50 | 51 | public String getPageKey() { 52 | return mPageKey; 53 | } 54 | 55 | public void setPageKey(String pageKey) { 56 | mPageKey = pageKey; 57 | } 58 | 59 | public String getTitle() { 60 | return mTitle; 61 | } 62 | 63 | public void setTitle(String title) { 64 | mTitle = title; 65 | } 66 | 67 | public int getWeight() { 68 | return mWeight; 69 | } 70 | 71 | public void setWeight(int weight) { 72 | mWeight = weight; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/iftw/materialnavigation/wizard/model/MultipleFixedChoicePage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.iftw.materialnavigation.wizard.model; 18 | 19 | import android.support.v4.app.ListFragment; 20 | 21 | import com.iftw.materialnavigation.wizard.ui.MultipleChoiceFragment; 22 | 23 | import java.util.ArrayList; 24 | 25 | /** 26 | * A page offering the user a number of non-mutually exclusive choices. 27 | */ 28 | public class MultipleFixedChoicePage extends SingleFixedChoicePage { 29 | public MultipleFixedChoicePage(ModelCallbacks callbacks, String title) { 30 | super(callbacks, title); 31 | } 32 | 33 | @Override 34 | public ListFragment createFragment() { 35 | return MultipleChoiceFragment.create(getKey()); 36 | } 37 | 38 | @Override 39 | public void getReviewItems(ArrayList dest) { 40 | StringBuilder sb = new StringBuilder(); 41 | 42 | ArrayList selections = mData.getStringArrayList(Page.SIMPLE_DATA_KEY); 43 | if (selections != null && selections.size() > 0) { 44 | for (String selection : selections) { 45 | if (sb.length() > 0) { 46 | sb.append(", "); 47 | } 48 | sb.append(selection); 49 | } 50 | } 51 | 52 | dest.add(new ReviewItem(getTitle(), sb.toString(), getKey())); 53 | } 54 | 55 | @Override 56 | public boolean isCompleted() { 57 | ArrayList selections = mData.getStringArrayList(Page.SIMPLE_DATA_KEY); 58 | return selections != null && selections.size() > 0; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_report_health.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 17 | 18 | 23 | 24 | 28 | 29 | 34 | 35 |