diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f10a45a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs"] + path = docs + url = https://github.com/Nimrodda/WizarDroid.wiki.git diff --git a/.travis.yml b/.travis.yml index 430c558..62bd36c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,9 +16,9 @@ before_install: - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools # Gradle - - wget http://services.gradle.org/distributions/gradle-1.8-bin.zip - - unzip gradle-1.8-bin.zip - - export GRADLE_HOME=$PWD/gradle-1.8 + - wget http://services.gradle.org/distributions/gradle-1.11-bin.zip + - unzip gradle-1.11-bin.zip + - export GRADLE_HOME=$PWD/gradle-1.11 - export PATH=$GRADLE_HOME/bin:$PATH # install android build tools diff --git a/CHANGELOG.md b/CHANGELOG.md index c123304..ff6df37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Change Log =============================================================================== +Version 1.2.0 *(2014-03-18)* +---------------------------- + +* Fix: Issue #37 - removed minSdk and targetSdk from AndroidManifest.xml - contributed by @knicknak +* Feature: Device's back button will now cause the wizard to go to the previous step - contributed by @denny0223 +* Feature: Install WizarDroid.aar to local maven repository via 'gradle install' command +* Upgraded to Gradle 1.11 and Android Gradle plugin 0.9.0 + Version 1.1.1 *(2013-11-10)* ---------------------------- diff --git a/build.gradle b/build.gradle index 6994934..7377684 100755 --- a/build.gradle +++ b/build.gradle @@ -3,13 +3,18 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:0.6.+' + classpath 'com.android.tools.build:gradle:0.9.+' + classpath 'com.github.dcendents:android-maven-plugin:1.0' } } allprojects { - version = "1.1.1" + version = "1.2.0" group = "org.codepond" + + project.ext { + versionCode = 5 + } } subprojects { diff --git a/docs b/docs new file mode 160000 index 0000000..3021e4c --- /dev/null +++ b/docs @@ -0,0 +1 @@ +Subproject commit 3021e4c1f233793c5da0b7e674a9b81b55b87db2 diff --git a/wizardroid-sample/build.gradle b/wizardroid-sample/build.gradle index 90a9d20..cd4a228 100755 --- a/wizardroid-sample/build.gradle +++ b/wizardroid-sample/build.gradle @@ -7,6 +7,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 19 + versionCode project.ext.versionCode + versionName version } signingConfigs { diff --git a/wizardroid-sample/src/main/AndroidManifest.xml b/wizardroid-sample/src/main/AndroidManifest.xml index c948eb5..45f91db 100644 --- a/wizardroid-sample/src/main/AndroidManifest.xml +++ b/wizardroid-sample/src/main/AndroidManifest.xml @@ -1,11 +1,8 @@ + package="org.codepond.wizardroid.sample" > - + diff --git a/wizardroid/build.gradle b/wizardroid/build.gradle index 8a31b66..a8586b0 100644 --- a/wizardroid/build.gradle +++ b/wizardroid/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'android-library' -apply plugin: 'maven' +apply plugin: 'android-maven' apply plugin: 'signing' android { @@ -9,6 +9,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 19 + versionCode project.ext.versionCode + versionName version } } diff --git a/wizardroid/src/main/AndroidManifest.xml b/wizardroid/src/main/AndroidManifest.xml index a2a4207..e985dcc 100644 --- a/wizardroid/src/main/AndroidManifest.xml +++ b/wizardroid/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - - + - \ No newline at end of file + diff --git a/wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java b/wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java index d22ec14..3e4c2e9 100644 --- a/wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java +++ b/wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java @@ -3,6 +3,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentManager.OnBackStackChangedListener; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.view.ViewGroup; @@ -42,8 +43,10 @@ public static interface WizardCallbacks { private final ContextManager contextManager; private final WizardCallbacks callbacks; private final ViewPager mPager; + private final FragmentManager mFragmentManager; private boolean fingerSlide; + private int backStackEntryCount; /** @@ -61,12 +64,28 @@ public Wizard(final WizardFlow wizardFlow, this.contextManager = contextManager; this.callbacks = callbacks; this.mPager = (ViewPager) activity.findViewById(R.id.step_container); + this.mFragmentManager = activity.getSupportFragmentManager(); + if (mPager == null) { throw new RuntimeException("Cannot initialize Wizard. View with ID: step_container not found!" + " The hosting Activity/Fragment must have a ViewPager in its layout with ID: step_container"); } + mPager.setAdapter(new WizardPagerAdapter(activity.getSupportFragmentManager())); + backStackEntryCount = mFragmentManager.getBackStackEntryCount(); + mFragmentManager.addOnBackStackChangedListener(new OnBackStackChangedListener() { + @Override + public void onBackStackChanged() { + backStackEntryCount = mFragmentManager.getBackStackEntryCount(); + + //onBackPressed + if (backStackEntryCount < getCurrentStepPosition()){ + mPager.setCurrentItem(getCurrentStepPosition() - 1); + } + } + }); + //Implementation of OnPageChangeListener to handle wizard control via user finger slides mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @@ -103,6 +122,12 @@ else if (positionOffset < initialOffset){ @Override public void onPageSelected(int position) { //Signal that the page is now "selected" + if (backStackEntryCount < position){ + mFragmentManager.beginTransaction().addToBackStack(null).commit(); + } + else if (backStackEntryCount > position){ + mFragmentManager.popBackStack(); + } consumedPageSelectedEvent = true; }