Git Product home page Git Product logo

materialsteppers's Introduction

Material Design Steppers

Download Android Arsenal

Google Material Design Steppers Component For Android Java - Official Link


`compile 'ivb.com.materialstepper:material-stepper:0.0.2'`

1. Create Java class and extend the **progressMobileStepper** or **simpleMobileStepper** Activity.
2. Implement the following methods: **List init()** method and **void onStepperCompleted()** .
3. Create Fragments by Extending **stepperFragment** and implement Method **boolean onNextButtonHandler()**.
4. Use **onNextButtonHandler** method to handle UI validation inside the Fragments, whenever the user presses the Next Button, return true/false inorder to determine whether to Stay or move to next Fragment.
5. Make it an ArrayList with Class containing fragments and return via **List init()** method - as mentioned in the 1st step.
6. Use **onStepperCompleted** method to complete stepper and finalize the activity.
7. Developers can choose to implement savedInstanceState s to save the Data if need be. The fragments will be imitialized only when needed. Most of the time they will be destroyed to avoid memory overheads and leaks.
**Note** : with the given List size : step count will be Computed and Updated. Increasing and dynamic fragment feature could be added in upcoming releases,
Scrollview has been adapted for ViewPager(fragment)scroll, This will scaled to all screen sizezes. Added support for both Landscape and Portait Mode by adapting SavedInstanceState.(However Your Data inside that fragment is not gauranteed for consistency, so the usage SavedinstanceState is suggested) ##DEMO : Here is a demo for your understaning: example project, Download and Sync with gradle.build
###Screenshot : Screenshot Link
## Potential use-cases for this Library : 1) Payment Processing Steps for Checkouts
2) Account creation and validation
3) Forms and surveys (Ideal use-case)
4) Accomplishment apps and Task driven apps.

##Motive behind this Library: Hello,i'm shivasurya,Pre-Final year UG Student from INDIA
i have been developing apps for more than a year,Developed Android Material Design Component using Existing Support Library v4 ViewPager named as Material Steppers.Initially developed for part of College Project and open sourced for further development and enhancement of the library in Github.Constantly working on the library to improve features and fix memory Leaks based on issues opened.It has been published in Android-arsenal too.

Android Arsenal - https://android-arsenal.com/details/1/3049
Please Do Contribute and Optimize the code!.

##License The MIT License (MIT)

Project Maintained By Shivasurya S

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

materialsteppers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

materialsteppers's Issues

Potential memory leaks

Hi!
In this class, you keep a reference to all fragments. If Android needs more memory for your app, it will destroy Fragments, but the garbage collector won't be able to free memory until it kills your Activity entirely because you hold a reference in a List. You should use FragmentStatePagerAdapter and save instance state to manage your fragments instead. You can see my Popular Movies project to see how I implemented FragmentStatePagerAdapter (which doesn't properly save instance state for now though) ;)

The Fragments which form the part of steps, expand according to the amount of widget or data contained in them

Hello Surya
Great work by the way.
FormFragment, TextFragment, Instruction, they all expand or take as much place as per the amount of widgets or data stored.
For example let's Form Fragment. To the parent in the XML apply a dark background. what you'll see is that dark background only cover 1/4th while running on real device but cover entire screen in android studio.
Similarly I tried changing various layouts but didn't work. Please look into this matter.

Naming convention

Hi!
I saw several things you can improve in your library. The first, is following the java and android naming convention.
Java classes should begin with an uppercase letter (mobileStepperSimple should be SimpleMobileSteppers or MobileSteppersSimple), and fields (member variables) should have a "m" prefix.
For example, if you have int step as a field, it should be int mStep in Android, avoiding having to add this. prefix to differentiate local variables from members visually.

Allow using custom ViewPager and/or ViewPagerStateAdapter

I noticed that after orientation change, my app's state does not restore correctly. I did override onSaveInstanceState in my step fragments, but it apparently gets called twice, first with the current state, and next with uninitialized values.

According to the answers on ViewPager and fragments โ€” what's the right way to store fragment's state?, ViewPager will sometimes reuse existing fragments and sometimes create new ones. So onSaveInstanceState may be called on the old fragment which is not being displayed after orientation change. So to ensure state restoration one needs to either setOffScreenPageLimit to hold all pages, or override ViewPagerAdapter's instantiateItem to reuse fragment instances. However, since mViewPager is private to the baseStepper class, it's not possible for me to use these solutions.

Last onNextButtonHandler method is never called

Hi shivasurya. Congratulations about your materialstepper. I'm using it and I've realize that the onNextButtonHandler method of the last stepper is never called. Is it a bug or I'm doing something wrong?

Thanks

Some fields can be local

Hi,
It's me again! :)
In this class, you hold the FragmentManager in a member variable (applies also for other fields such as FragmentTransaction, but use it only in one method. You shouldn't ignore Android Studio warnings and check your code quality, especially for a public library which could be used in third-party production apps. Keep me tuned for updates! :)

Back button showing on first fragment

Hey hi Shivasurya,
It's a great job. It is very useful for me. I am working on one android application and using your library i am trying register user to our system. But have some small issue in this library is that when you are on first fragment 'Back' button is visible.
I have checked your code for that next and back button. You already added code for it means you have checked that current fragment is more than 0 or not. When current fragment is >0 then all are fine but when you are on 1st fragment then you have to disable that 'Back' button.
It quite confusing for user that something is still before than first screen.
You can check this issue on your given application. I am also adding screenshot for it with red circle. Please check and update your library as fast as possible.
And thanks giving such nice library. Great job. ๐Ÿ‘
screenshot_20160116-235608

Passing data between activity and stepper fragments

Hi, I have an issue that I can't solve. In my app, I'll use the stepper to perform a configuration of an already connected bluetooth device.
I need to pass the bluetooth device connectivity information from the main activity to the stepper fragments in order to send command and receive information over bluetooth.

Starting from main, my idea is to use do this:

BluetoothDevice mBtDevice

final Intent mIntent = new Intent(MainActivity.this, CalibrationActivity.class);
mIntent.putExtra("BluetoothDevice", mBtDevice);
startActivity(mIntent); 

so I will "receive" the bluetooth device in the activity that extend progressMobileStepper. At this point every thing is all right, in "mBtDevice" I have all the information I need. This is what I have done so far:

public class CalibrationActivity extends progressMobileStepper {

    List<Class> stepperFragmentList = new ArrayList<>();
    BluetoothDevice mBtDevice;

    @Override
    public List<Class> init() {

        Bundle data = getIntent().getExtras();
        mBtDevice= data.getParcelable("BluetoothDevice");


        Fragment fragment = new Fragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable("toFragmentBtDevice", mBtDevice);
        fragment.setArguments(bundle);

        stepperFragmentList.add(CalibrationStep1Fragment.class);

        return stepperFragmentList;
    }

    @Override
    public void onStepperCompleted() {
        //nothing at the moment...
    }

The problem is in the "CalibrationStep1Fragment". This is the code:

public class CalibrationStep1Fragment extends stepperFragment {

   BluetoothDevice mBtDevice;

    @Override
    public boolean onNextButtonHandler() {
        return true;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Bundle bundle = getArguments();   // thsi is null
        mBtDevice= bundle.getParcelable("toFragmentBtDevice");

        return inflater.inflate(
                R.layout.stepper_step1, container, false);
    }

}

at this point bundle is null ( Bundle bundle = getArguments(); )

Please tell me if something is not clear and I'll try to give more information.

English labels - Back & Next

Great library. Thank you for that.

Could you please help me figuring out how I could change label Next and back?
I still haven't found where they are located.

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.