Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ndsinister committed Oct 6, 2013
2 parents 5adf8a3 + 96fb2da commit e509e6b
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
language: java
jdk: oraclejdk7
env:
matrix:
- ANDROID_SDKS=android-18,sysimg-18 ANDROID_TARGET=android-18 ANDROID_ABI=armeabi-v7a
before_install:
# Install base Android SDK
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
- wget http://dl.google.com/android/android-sdk_r22.0.5-linux.tgz
- tar xzf android-sdk_r22.0.5-linux.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

# Gradle
- wget http://services.gradle.org/distributions/gradle-1.7-bin.zip
- unzip gradle-1.7-bin.zip
- export GRADLE_HOME=$PWD/gradle-1.7
- export PATH=$GRADLE_HOME/bin:$PATH

# install android build tools
- wget https://dl-ssl.google.com/android/repository/build-tools_r18.0.1-linux.zip
- unzip build-tools_r18.0.1-linux.zip -d $ANDROID_HOME
- mkdir -p $ANDROID_HOME/build-tools/
- mv $ANDROID_HOME/android-4.3 $ANDROID_HOME/build-tools/18.0.1

# Install required components.
# For a full list, run `android list sdk -a --extended`
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).
# Other relevant API's
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-17 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null

script:
- gradle assemble
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Change Log
===============================================================================

Version 1.0.1 *(2013-10-06)*
----------------------------

* Fix: Crash when moving to another screen after the display orientation had changed in the middle of the wizard
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

allprojects {
version = "1.0.0"
version = "1.0.1"
group = "org.codepond"
}

Expand Down
2 changes: 1 addition & 1 deletion wizardroid-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.codepond.wizardroid.sample"
android:versionCode="1" android:versionName="1.0.0">
android:versionCode="2" android:versionName="1.0.1">

<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="18"
Expand Down
2 changes: 1 addition & 1 deletion wizardroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" package="org.codepond.wizardroid">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="1.0.1" package="org.codepond.wizardroid">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
<application/>
</manifest>
12 changes: 7 additions & 5 deletions wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
/**
* The engine of the Wizard. This class controls the flow of the wizard
* and is using {@link ViewPager} under the hood. You would normally want to
* extend {@link WizardFragment} instead of using this class directly. Use this
* extend {@link WizardFragment} instead of using this class directly and make calls to the wizard API
* via {@link org.codepond.wizardroid.WizardFragment#wizard} field. Use this
* class only if you wish to create a custom WizardFragment to control the wizard.
*/
public class Wizard {
Expand All @@ -40,7 +41,6 @@ public static interface WizardCallbacks {
private final WizardCallbacks callbacks;
private final ViewPager mPager;

private WizardStep[] wizardStepInstances;
private boolean fingerSlide;


Expand Down Expand Up @@ -181,7 +181,7 @@ public int getCurrentStepPosition() {
* @return WizardStep the current WizardStep instance
*/
public WizardStep getCurrentStep() {
return wizardStepInstances[mPager.getCurrentItem()];
return ((WizardPagerAdapter)mPager.getAdapter()).getPrimaryItem();
}

/**
Expand All @@ -206,14 +206,12 @@ public class WizardPagerAdapter extends FragmentStatePagerAdapter {

public WizardPagerAdapter(FragmentManager fm) {
super(fm);
wizardStepInstances = new WizardStep[getCount()];
}

@Override
public Fragment getItem(int i) {
try {
WizardStep step = wizardFlow.getSteps().get(i).newInstance();
wizardStepInstances[i] = step;
contextManager.loadStepContext(step);
Log.v(TAG, "context loaded for " + step.toString());
return step;
Expand Down Expand Up @@ -245,5 +243,9 @@ public int getItemPosition(Object object) {
public int getCount() {
return wizardFlow.getSteps().size();
}

public WizardStep getPrimaryItem() {
return (WizardStep) mPrimaryItem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public List<Class<? extends WizardStep>> getSteps() {
}

/**
* Builder for {@link WizardFlow}. Use this class to build an instance of WizardFlow and
* eventually call {@link WizardFlow.Builder#create()} to create the instance.
* Builder for {@link WizardFlow}. Use this class to build an instance of WizardFlow.
* You need to use this class in your wizard's {@link WizardFragment#onSetup()} to return an instance of WizardFlow.
* Call {@link #addStep(Class)} to add steps to the flow, keeping in mind that the order you the steps
* will be the order the wizard will display them. Eventually call {@link WizardFlow.Builder#create()} to create the instance.
*/
public static class Builder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* Extend this class to implement your own custom wizard layout and user {@link Wizard} API to
* control the wizard. Typically, you'd call {@link Wizard#goNext()} and {@link Wizard#goBack()}
* from your controls onClick event to control the flow of the wizard.
* The implementation takes care of persisting the instance of the fragment and therefore the wizard context.
* Keep in mind that if for some reason you are not able to extend this class and have to implement your
* own, then wizard context persistence is totally up to you by implementing {@link ContextManager} and passing
* an instance of it when you construct {@link Wizard}.
*/
public abstract class WizardFragment extends Fragment implements Wizard.WizardCallbacks {
private static final String TAG = WizardFragment.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.Date;

/**
* Base class for a wizard's step.
* Base class for a wizard's step. Extend this class to create a step and override {@link #onExit(int)}
* to handle input and do tasks before the wizard changes the current step.
* As with regular {@link Fragment} each inherited class must have an empty constructor.
*/
public abstract class WizardStep extends Fragment {
Expand All @@ -27,13 +28,18 @@ public abstract class WizardStep extends Fragment {
/**
* Called when the wizard is about to go to the next step or
* the previous step. Override this method to handle input from the step.
* Possible exit codes are {@link #EXIT_NEXT} and {@link #EXIT_PREVIOUS}.
* @param exitCode Code indicating whether the wizard is going to the next or previous step. The value would either be
* WizardStep.EXIT_NEXT when wizard is about to go to the next step or
* WizardStep.EXIT_PREVIOUS when wizard is about to go to the previous step.
*/
public void onExit(int exitCode) {
}

/**
* IMPORTANT: This method is overridden to bind the wizard context to the step's fields.
* Make sure to call super.onAttach(activity), if you override this method in your step class.
*/
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* Otherwise, extend {@link WizardFragment} and implement a custom wizard layout.
* Override {@link WizardFragment#onSetup()} to set up the wizard's flow
* and optionally {@link WizardFragment#onWizardComplete()} to handle wizard's finish event.
* Note that button labels are changeable by calling {@link #setNextButtonText(String)}, {@link #setBackButtonText(String)} and
* {@link #setFinishButtonText(String)}.
*/
public abstract class BasicWizardLayout extends WizardFragment implements View.OnClickListener {
Expand All @@ -35,7 +37,8 @@ public BasicWizardLayout() {
super();
}
/**
* Setting common layout for all wizards
* Setting the layout for this basic wizard layout and hooking up wizard controls to their
* OnClickListeners.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand Down Expand Up @@ -80,7 +83,7 @@ else if (v.getId() == R.id.wizard_previous_button) {
}

/**
* Event triggered after a step was changed
* Event triggered after a step was changed, updating the button labels accordingly
*/
@Override
public void onStepChanged() {
Expand Down

0 comments on commit e509e6b

Please sign in to comment.