stepstone-tech / android-material-stepper Goto Github PK
View Code? Open in Web Editor NEWThis library allows to use Material steppers inside Android applications.
License: Apache License 2.0
This library allows to use Material steppers inside Android applications.
License: Apache License 2.0
Hi,
just a question, not an issue (and maybe a stupid question...).
Lets say in a wizard I have to show 3 steps (1st, 2nd and 3rd) and at runtime I want conditionally jump the 2nd step (so that the user will see the 1st and 3rd steps only).
For example... The 2nd step is where, in a wizard, we ask for app's permissions or something similar.
Scenario 1:
The user already set all permissions in a previous wizard session. He runs the wizard again. The 2nd step should not be shown at all.
Scenario 2:
The first time the wizard runs, all 3 steps are shown. In the 2nd step the user allows all permissions. Then he goes to the 3rd step and clicks "Back"... the 2nd step should be not shown at all (all permissions were already set).
How can I do this?
Many thanks
I'm confused and I have no idea on how will I add more steps to the stepper? Can someone teach me how to do that? Should I make another class for step 2 and so on? Thank you so much.
Hi @zawadz88
I had a issue while adding more than 3 fragments. the first fragment automatically recreates.
With this the data will not be stable in the first fragment as the view is recreated
So i pulled your code and added a line in to your code in setAdapter method
mPager.setOffscreenPageLimit(stepAdapter.getCount());
is it any way to change arrows for next and back button? OR hide next and back arrow?
because it is not support right to left!
any help?
Good day. I couldn't find a way to disable navigation via step tabs. I think an option to enable/disable this via both xml and java would seem reasonable.
Hello,
First of all, thanks for your awesome library !
We are using it to provide a nice register flow for our users.
Is it possible to add the possibility to change icons for next/back button thanks to getViewModel(...) in the adapter ?
It could help us to let the user understand more precisely what he is going (sometimes, text isn't enough ;) )
Thanks a lot,
Tom
The existing screenshots/GIFs referenced in README are outdated and should be replaced with new ones from the current version of the library.
AbstractFragmentStepAdapter.findStep(ViewPager, int) requires ViewPager as first attribute and uses its getId(), which, as I see it it, always resolves to R.id.ms_stepPager. Would it be possible to remove ViewPager from findStep or provide an overloaded findStep(int)?
My actual issue is that AbstractFragmentStepAdapter.getItem() calls createStep() internally, so I cannot access the actual fragment instances in my adapter, since they are recreated in createStep(). I also can't use findStep, since I cannot get the ViewPager from StepperLayout.
A getter for StepperLayout.mPager would do the job, too.
Another solution to this issue might be to change the implementation of AbstractFragmentStepAdapter.getItem(int) to check findStep() != null before calling createStep
I could file a PR if you agree.
//edit:
I can access the fragments using FragmentManager (as proposed in #39), but this still involves R.id.ms_stepPager. Accessing the fragments using their adapter would be cleaner, IMHO.
Good day! I think it would be nice if error state triangle would wobble a bit horizontally for a sec (just like the button in the sample app) when error state just occurs. Also would be nice to enable/disable this option via both xml and java.
I'm using this library with three fragment. It seems that the first fragment is recreated (losing values etc...) if I return back from the third to the first fragment. Is there a way to prevent the fragment to be destroyed?
I found this on StackOverflow: mViewPager.setOffscreenPageLimit(2);. Is there a way to implement this solution?
Currently, by pressing the Android system back softkey, it will quit the entire wizard activity.
However, is there possibility, that we can change such behavior in the way.
If we are in step 2, step 3, ... , pressing Android system back softkey, will enable us to back to page step 1, step 2, ...
If we are in step 1, pressing Android system back softkey, will enable us to quit the entire wizard activity.
Thank you
Why is it happening?
I wonder if you can add support for RTL navigation.
Current implementation does not support RTL language locales.
How can I create stepper activity with 3 fragments? Do I have to create 3 classes for each step? Or just 3 xml layout?
what is the type for Horizontal stepper
@zawadz88 Your library is very useful i like it can you please enhance one feature to set toolbar title and subtitle according to active fragment. If this feature already available on your library than can you please guide me how i use that?
HI.
I'm trying to perform some actions after calling an activity in one of my fragments. However, the method onActivityResult
is being called in the Activity
but not in the active Fragment
.
I'm calling super.onActivityResult
on my Activity
so that's not the problem.
What can be happening?
Hi,
any way to set the step name by some strings and not from the resources.
I need to set step name dynamically from strings consumed by a rest api.
Thanks in advance,
Hi,
I know we can perform time consuming task, in non-last step fragment, by using BlockingStep
.
However, when I use BlockingStep
as the last step fragment, the onNextClicked
is not triggered when I click on DONE button.
I was wondering, what is the proper way, to perform time consuming task in last step fragment?
Thanks.
Cheok
Hi, tnx for this great lib.
I have a problem with a tab visibility.
f.e. If you have lots of tabs and some of them are off screen, the next or prev button does not slide (show) to the current page (tab) and you have to manually scroll to it.
Kind regards
Sorry for my English, Thanks so much for this awesome library
when i use StepperLayout in my fragment does n=not open the ui for the fragment.
I'm actually becoming crazy with this library...
I'm trying to implement it on my app. I decided to use the Styled Tabs version. I have the three fragments you provide on sample edited for the use I need, so on the main one I show a list, a Spinner on the second and another list on the third one.
But as I've read on other issue,
By default, ViewPager if you're on page N will create page N - 1 and N + 1. So if you're starting with the first page it will create the first and the second Fragment.
So, when I try to populate the list on the first fragment, or the spinner on the second, as it doesn't exists on the others, it gives me a null exception... I'm doing this on StyledTabsActivity because here it is where I found at the example that you apply the logics to the button that appears, but you have the same button with same id on the three fragments...
How or where I am supposed to be able to populate this elements?
Hello stepstone team,
thanks for sharing this library. I want to use it with API Level 19 and I always get this error:
Binary XML file line #17: invalid drawable tag vector
I use: compile 'com.android.support:appcompat-v7:25.0.0'
Also tried: vectorDrawables.useSupportLibrary = true
But didn't solve the Problem.
Seems to be this issue:stackoverflow
Can you say something about supported API Levels or do you know how to fix this error?
Here the complete output of console:
Unable to start activity ComponentInfo{com.projecttango.experiments.planefittingsample/com.projecttango.examples.java.planefitting.ui.stepper.StepperActivity}:
android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2196)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2246)
at android.app.ActivityThread.access$800(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5030)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
at android.content.res.Resources.loadDrawable(Resources.java:2096)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:435)
at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.projecttango.examples.java.planefitting.ui.stepper.StepperActivity.onCreate(StepperActivity.java:50)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2160)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2246)
at android.app.ActivityThread.access$800(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5030)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2092)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v7.widget.VectorEnabledTintResources.superGetDrawable(VectorEnabledTintResources.java:74)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:435)
at android.support.v7.widget.VectorEnabledTintResources.getDrawable(VectorEnabledTintResources.java:67)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.projecttango.examples.java.planefitting.ui.stepper.StepperActivity.onCreate(StepperActivity.java:50)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2160)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2246)
at android.app.ActivityThread.access$800(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5030)
at java.lang.reflect.Method.invoke(Native Method)
Thank you.
Hi,
I tried to find where I can remove the arrow icon from the options but I didn't find it. I read in another issue that it has that option.
I want to remove it from the first step having the option CANCEL without the <
when i have three tabs ,
select tab two then reload tab one how can i prevent the loading.
Is there a limit to the number of steps that can be added?
Can anybody help me with this?
How can I verify edittexts inside my Step?
I have diferrent verification methods for each edittext
`Hello @zawadz88 !
Just a question, how can I implement this to verifyStep()?
`
class VerifyAppNameTask extends AsyncTask<String, Void, String> {
// use doInBackground() to make network calls, the returned value is
// sent to onPostExecute()
@Override
protected String doInBackground(String... data) {
if (sAppName.replace(" ","").isEmpty())
{
return "1";
}
else if (sAppName.length() > 25)
{
return "2";
}
else if (checkAppName(data[0]))
{
return "3";
}
else
{
return "4";
}
}
@Override
protected void onPostExecute(String result) {
tilAppName.setErrorEnabled(true);
switch(result)
{
case "1": {tilAppName.setError("You can't leave this empty.");break;}
case "2": {tilAppName.setError("Maximum of 25 characters.");break;}
case "3": {tilAppName.setError("No spaces allowed");break;}
case "4": {tilAppName.setError(null);tilAppName.setErrorEnabled(false);break;}
}
}
}`
above code is one of my error traps
My problem is how can I verify edittexts then when there's no more error, Next > button will enable again. Thank you so much for you help!
How to implement this with view pager?
I love your stepper but am now stumped with an issue. Here's how I am using your library and where I am getting stumped.
I have 7 steps in my wizard, each implemented by a Fragment that extends Step. In the overridden createStep method, I have this code.
@Override
public Fragment createStep(int position) {
Logger.writeToLog("position=" + position);
switch (position) {
case 0:
return new StepWelcome();
case 1:
return new StepSelectAccounts();
case 2:
return new StepPreTaxEarnings();
case 3:
return new StepTaxes();
case 4:
return new StepRetirals();
case 5:
return new StepStockPurchase();
case 6:
return new StepSummary();
default:
throw new IllegalArgumentException("Unsupported position: " + position);
}
}
I am returning 7 in getCount() in my AbstractStepAdapter extension
What I find funny is that the initial log print shows the following when the wizard is invoked. It should have ideally only printed upto position=6 and should have printed position=0 since we're now on the first step of the wizard when it is started. However, it prints position=1 as well when the stepper is now on the first step.
2016-12-14 19:29:48:position=0
2016-12-14 19:29:48:position=1
2016-12-14 19:29:48:position=2
2016-12-14 19:29:48:position=3
2016-12-14 19:29:48:position=4
2016-12-14 19:29:48:position=5
2016-12-14 19:29:48:position=6
2016-12-14 19:29:48:position=0
2016-12-14 19:29:48:position=1
Because of this issue, when I move through the steps, I am getting wrong behavior since the step positions are now already incremented by 1 because of the behavior above. I am happy to paste the entire code if needed. This is frustrating and I don't know what I did wrong
Hi - I have a newbie question, but this wasn't clear to me from the other questions or from the examples.
I have a stepper with three steps. Whenever I press the next button, I want to save information from the current step and move on to the next one. At the end, when I press complete, I want to consolidate the information from the three steps and make a REST API call. What's the best way to do this?
As an example - in my first step, I want the user to input a location. In the second, I want the user to choose a category. In the third, I want the user to provide a description. Finally, when the user presses complete, I want to make a REST call using the location, category and description.
Good day! Thanks for implementing 'error state' feature, works great. But I couldn't find a way to set the error state programmatically. Is it supported by the library?
how can i share data between tabs steps?
Hi,
I have removed a fragment dynamically from the Stepper adapter and i used notifyDataSetChanged(); to update Stepper adapter.
But it is not reflected back to StepperLayout.
Please let me know if there is any other method to remove view from stepper layout.
Thank you
How to fix this? I'm just starting using this stepper. When I add this code:
<com.stepstone.stepper.StepperLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/stepperLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:ms_stepperType="progress_bar" />
on my layout that error shows.
Here i have used 3 fragments. When i am on first fragment and i click twice on NEXT button it's go to 2nd then 3rd step even i not called callback.gotoNextStep in second fragment.
Hi,
Thanks for the great library!
I was wondering, is it possible to show BACK button in the first page of the wizard. The purpose of BACK button in the first page, is to close the entire wizard.
Thank you.
Is there any way to set custom TypeFace
for StepperLayout
's tab title?
I have tried this way:
mStepperlayout.setAdapter(new CustomStepperAdapter(getChildFragmentManager()));
TextView mStepTitle = (TextView) mStepperLayout.findViewById(R.id.ms_stepTitle);
Typeface mFont = Typeface.createFromAsset(getActivity().getAssets(), "CustomFont.ttf");
mStepTitle.setTypeface(mFont);
This works for navigation bar buttons but does not work tab titles, any idea?
What I'm trying to do :
The problem :
onNextClicked()
method is not being called in the last stepCause:
StepperLayout#onComplete()
does not check for BlockingStepsI had this error after importing stepper to my project. I'm a beginner in android that's why I don't know how to fix this one.
Good day. There is a nice attribute ms_bottomNavigationBackground
in StepperLayout to change bottom navigation background. But I couldn't find similar attribute for StepTabs. Instead we need to define a style for ms_tabsContainerStyle
with android:background
in it and assign it to ms_stepperLayoutTheme
. It would be nice to be able to have a simple attribute instead of defing numerous styles just for that. Thank you!
Is there some way to do it using the stepper only? if not, can this be added as a feature?
Good day. Is it possible to implement a stepper feedback like the one provided in material guidelines?
Currently, by pressing COMPLETE button, I'm going to launch a async task, to perform a long running operation. During that time, I would like to prevent user from clicking the back button. Is there any way to disable back button click operation, programmatically?
Thank.
Cheok
Hey guys, first of all, nice work ! Just found the lib and it seems pretty cool !
Since today a lot of devs (including me) are moving away from Frags to View-based Apps, I think it would be cool to abstract even more the StepAdapter, so people like me could still use the lib, implementing the abstract Adapter methods, not obligatory using Frags.
I'd be happy to drop a PR, if you guys are interested !
Thanks
In last Step i want to done payment procedure on click on Complete button if payment done succesfully then it's call onComplete method code how can i do this can you please guide me with this ? Through any custom method
Would be nice to see the ability to make the next/back/completed buttons Visibility.gone, and expose methods on the StepperLayout class to allow me to programmatically advance to the next step. This would allow for things like where a step requires a user select a button out of a choice of buttons for example, and the code does something on button click, and once done, advance the step. No need to have the user also click next. Also, add the ability to prevent the tabs from updating the steps along the same lines.
While I can just grab the buttons and tabs container and set the button onClickListener to null, and overload the tabContainers listener to achieve the same result, I'd have to make the buttons text the same color as the nav bar, and use some styling to get the chevrons to be the same color effectively making them disappear. However the bar is still there on the ui, which sucks if it's unneeded to begin with.
I can't just hide the buttons unfortunately since you update the visibility inside onUpdate, so would be nice to add a && shouldBeVisibile style able or something along those lines inside onUpdate, so I can just use styles in a theme to change the behavior base on individual stepperlayouts in my views.
I'm guessing in the mean time, I can grab the listeners before I set them to null so I can have access to the StepperLayouts private methods for actually advancing the steps?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.