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

Commit e509e6b

Browse files
author
ndsinister
committed
Merge branch 'develop'
2 parents 5adf8a3 + 96fb2da commit e509e6b

File tree

10 files changed

+76
-13
lines changed

10 files changed

+76
-13
lines changed

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
language: java
2+
jdk: oraclejdk7
3+
env:
4+
matrix:
5+
- ANDROID_SDKS=android-18,sysimg-18 ANDROID_TARGET=android-18 ANDROID_ABI=armeabi-v7a
6+
before_install:
7+
# Install base Android SDK
8+
- sudo apt-get update -qq
9+
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
10+
- wget http://dl.google.com/android/android-sdk_r22.0.5-linux.tgz
11+
- tar xzf android-sdk_r22.0.5-linux.tgz
12+
- export ANDROID_HOME=$PWD/android-sdk-linux
13+
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
14+
15+
# Gradle
16+
- wget http://services.gradle.org/distributions/gradle-1.7-bin.zip
17+
- unzip gradle-1.7-bin.zip
18+
- export GRADLE_HOME=$PWD/gradle-1.7
19+
- export PATH=$GRADLE_HOME/bin:$PATH
20+
21+
# install android build tools
22+
- wget https://dl-ssl.google.com/android/repository/build-tools_r18.0.1-linux.zip
23+
- unzip build-tools_r18.0.1-linux.zip -d $ANDROID_HOME
24+
- mkdir -p $ANDROID_HOME/build-tools/
25+
- mv $ANDROID_HOME/android-4.3 $ANDROID_HOME/build-tools/18.0.1
26+
27+
# Install required components.
28+
# For a full list, run `android list sdk -a --extended`
29+
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).
30+
# Other relevant API's
31+
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
32+
- echo yes | android update sdk --filter android-17 --no-ui --force > /dev/null
33+
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
34+
- echo yes | android update sdk --filter sysimg-18 --no-ui --force > /dev/null
35+
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
36+
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
37+
38+
script:
39+
- gradle assemble

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Change Log
2+
===============================================================================
3+
4+
Version 1.0.1 *(2013-10-06)*
5+
----------------------------
6+
7+
* Fix: Crash when moving to another screen after the display orientation had changed in the middle of the wizard

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
allprojects {
11-
version = "1.0.0"
11+
version = "1.0.1"
1212
group = "org.codepond"
1313
}
1414

wizardroid-sample/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="org.codepond.wizardroid.sample"
4-
android:versionCode="1" android:versionName="1.0.0">
4+
android:versionCode="2" android:versionName="1.0.1">
55

66
<uses-sdk android:minSdkVersion="14"
77
android:targetSdkVersion="18"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" package="org.codepond.wizardroid">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="1.0.1" package="org.codepond.wizardroid">
33
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
44
<application/>
55
</manifest>

wizardroid/src/main/java/org/codepond/wizardroid/Wizard.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
/**
1414
* The engine of the Wizard. This class controls the flow of the wizard
1515
* and is using {@link ViewPager} under the hood. You would normally want to
16-
* extend {@link WizardFragment} instead of using this class directly. Use this
16+
* extend {@link WizardFragment} instead of using this class directly and make calls to the wizard API
17+
* via {@link org.codepond.wizardroid.WizardFragment#wizard} field. Use this
1718
* class only if you wish to create a custom WizardFragment to control the wizard.
1819
*/
1920
public class Wizard {
@@ -40,7 +41,6 @@ public static interface WizardCallbacks {
4041
private final WizardCallbacks callbacks;
4142
private final ViewPager mPager;
4243

43-
private WizardStep[] wizardStepInstances;
4444
private boolean fingerSlide;
4545

4646

@@ -181,7 +181,7 @@ public int getCurrentStepPosition() {
181181
* @return WizardStep the current WizardStep instance
182182
*/
183183
public WizardStep getCurrentStep() {
184-
return wizardStepInstances[mPager.getCurrentItem()];
184+
return ((WizardPagerAdapter)mPager.getAdapter()).getPrimaryItem();
185185
}
186186

187187
/**
@@ -206,14 +206,12 @@ public class WizardPagerAdapter extends FragmentStatePagerAdapter {
206206

207207
public WizardPagerAdapter(FragmentManager fm) {
208208
super(fm);
209-
wizardStepInstances = new WizardStep[getCount()];
210209
}
211210

212211
@Override
213212
public Fragment getItem(int i) {
214213
try {
215214
WizardStep step = wizardFlow.getSteps().get(i).newInstance();
216-
wizardStepInstances[i] = step;
217215
contextManager.loadStepContext(step);
218216
Log.v(TAG, "context loaded for " + step.toString());
219217
return step;
@@ -245,5 +243,9 @@ public int getItemPosition(Object object) {
245243
public int getCount() {
246244
return wizardFlow.getSteps().size();
247245
}
246+
247+
public WizardStep getPrimaryItem() {
248+
return (WizardStep) mPrimaryItem;
249+
}
248250
}
249251
}

wizardroid/src/main/java/org/codepond/wizardroid/WizardFlow.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ public List<Class<? extends WizardStep>> getSteps() {
2323
}
2424

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

wizardroid/src/main/java/org/codepond/wizardroid/WizardFragment.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
* Extend this class to implement your own custom wizard layout and user {@link Wizard} API to
1616
* control the wizard. Typically, you'd call {@link Wizard#goNext()} and {@link Wizard#goBack()}
1717
* from your controls onClick event to control the flow of the wizard.
18+
* The implementation takes care of persisting the instance of the fragment and therefore the wizard context.
19+
* Keep in mind that if for some reason you are not able to extend this class and have to implement your
20+
* own, then wizard context persistence is totally up to you by implementing {@link ContextManager} and passing
21+
* an instance of it when you construct {@link Wizard}.
1822
*/
1923
public abstract class WizardFragment extends Fragment implements Wizard.WizardCallbacks {
2024
private static final String TAG = WizardFragment.class.getSimpleName();

wizardroid/src/main/java/org/codepond/wizardroid/WizardStep.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import java.util.Date;
1010

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

39+
/**
40+
* IMPORTANT: This method is overridden to bind the wizard context to the step's fields.
41+
* Make sure to call super.onAttach(activity), if you override this method in your step class.
42+
*/
3743
@Override
3844
public void onAttach(Activity activity) {
3945
super.onAttach(activity);

wizardroid/src/main/java/org/codepond/wizardroid/layouts/BasicWizardLayout.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Otherwise, extend {@link WizardFragment} and implement a custom wizard layout.
1717
* Override {@link WizardFragment#onSetup()} to set up the wizard's flow
1818
* and optionally {@link WizardFragment#onWizardComplete()} to handle wizard's finish event.
19+
* Note that button labels are changeable by calling {@link #setNextButtonText(String)}, {@link #setBackButtonText(String)} and
20+
* {@link #setFinishButtonText(String)}.
1921
2022
*/
2123
public abstract class BasicWizardLayout extends WizardFragment implements View.OnClickListener {
@@ -35,7 +37,8 @@ public BasicWizardLayout() {
3537
super();
3638
}
3739
/**
38-
* Setting common layout for all wizards
40+
* Setting the layout for this basic wizard layout and hooking up wizard controls to their
41+
* OnClickListeners.
3942
*/
4043
@Override
4144
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -80,7 +83,7 @@ else if (v.getId() == R.id.wizard_previous_button) {
8083
}
8184

8285
/**
83-
* Event triggered after a step was changed
86+
* Event triggered after a step was changed, updating the button labels accordingly
8487
*/
8588
@Override
8689
public void onStepChanged() {

0 commit comments

Comments
 (0)