Skip to content
Android Spinner Dialog Library supported on both Java and Kotlin, Use for single or multi selection of choice
Kotlin Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app Color support added Sep 27, 2019
demo Demo images Sep 27, 2019
gradle/wrapper Initial commit v1.0 Sep 27, 2019
spinnerdialog
.gitignore Initial commit v1.0 Sep 27, 2019
README.md Update README.md Sep 27, 2019
_config.yml Set theme jekyll-theme-cayman Sep 27, 2019
build.gradle
gradle.properties Initial commit v1.0 Sep 27, 2019
gradlew Initial commit v1.0 Sep 27, 2019
gradlew.bat
settings.gradle

README.md

SpinnerDialog

Android Spinner Dialog Library, Use for single or multi selection of choice

Download

Android UI

Download

To include SpinnerDialog in your project, add the following to your dependencies:

app/build.gradle

dependencies {
        implementation 'com.github.hamzaahmedkhan:SpinnerDialog:v1.0'
}

Usage

The following snippet shows how you can use Spinner Dialog in your project.

In Java

public class MainActivity extends Activity {
    
    
    //... other variables
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
            // Set Data
            
           ArrayList<SpinnerModel> arrSpinners = new ArrayList<>();
        
           for (int i = 0; i < 5; i++) {
               arrSpinners.add(new SpinnerModel("Number " + i));
           }
        
           // Init Fragment
           SpinnerDialogFragment spinnerDialogFragment = SpinnerDialogFragment.Companion.newInstance("Demo", arrSpinners, (data, selectedPosition) -> UIHelper.showToast(getContext(), data.getText()), 0);
           
           // Show Fragment
           spinnerDialogFragment.show(getActivity().getSupportFragmentManager(), "spinnerDialog");

    }
}

In Kotlin

class MainActivity : AppCompatActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        val arraySpinnerModel: ArrayList<SpinnerModel> = ArrayList()

        for (i in 1..9) {
            arraySpinnerModel.add(SpinnerModel("Number $i"))
        }


        // Init Fragment
        val spinnerDialogFragment =
            SpinnerDialogFragment.newInstance(
                "Spinner Dialog", arraySpinnerModel,
                object : OnSpinnerOKPressedListener {
                    override fun onItemSelect(data: SpinnerModel, selectedPosition: Int) {
                        Toast.makeText(applicationContext, data.text, Toast.LENGTH_LONG).show()
                    }

                }, 0
            )


        txtShowSingleChoiceSpinner.setOnClickListener { spinnerDialogFragment.show(supportFragmentManager, "SpinnerDialogFragment") }
        txtShowMultiChoiceSpinner.setOnClickListener { Toast.makeText(applicationContext, "In Progress", Toast.LENGTH_LONG).show() }
    }
}

EXTRA ATTRIBUTES

        // Using optional features
        spinnerDialogFragment.buttonText = "SAVE"
        spinnerDialogFragment.themeColorResId = resources.getColor(R.color.material_pink500)

FUTURE PLANS

-> Multi check options -> Searh bar

You can’t perform that action at this time.