/*
 * Copyright (C) 2016 Jared Rummler
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.jaredrummler.materialspinner.example;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.jaredrummler.materialspinner.MaterialSpinner;

public class MainActivity extends AppCompatActivity {

  private static final String[] ANDROID_VERSIONS = {
      "Cupcake", "Donut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jelly Bean", "KitKat",
      "Lollipop", "Marshmallow"
  };

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

      @Override public void onClick(View view) {
        try {
          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/Material-Spinner")));
        } catch (ActivityNotFoundException ignored) {
        }
      }
    });

    MaterialSpinner spinner = (MaterialSpinner) findViewById(R.id.spinner);
    spinner.setItems(ANDROID_VERSIONS);
    spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {

      @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
        Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
      }
    });
    spinner.setOnNothingSelectedListener(new MaterialSpinner.OnNothingSelectedListener() {

      @Override public void onNothingSelected(MaterialSpinner spinner) {
        Snackbar.make(spinner, "Nothing selected", Snackbar.LENGTH_LONG).show();
      }
    });
  }

}

@@ -1004,17 +1004,16 @@
 w.View;%0A
-%0A
 import c
@@ -1186,16 +1186,22 @@
 upcake%22,
+%0A     
  %22Donut%22
@@ -1201,16 +1201,22 @@
 %22Donut%22,
+%0A     
  %22Eclair
@@ -1217,16 +1217,22 @@
 Eclair%22,
+%0A     
  %22Froyo%22
@@ -1232,16 +1232,22 @@
 %22Froyo%22,
+%0A     
  %22Ginger
@@ -1253,16 +1253,22 @@
 rbread%22,
+%0A     
  %22Honeyc
@@ -1272,16 +1272,22 @@
 eycomb%22,
+%0A     
  %22Ice Cr
@@ -1300,16 +1300,22 @@
 ndwich%22,
+%0A     
  %22Jelly 
@@ -1320,16 +1320,22 @@
 y Bean%22,
+%0A     
  %22KitKat
@@ -1354,16 +1354,22 @@
 llipop%22,
+%0A     
  %22Marshm
@@ -1374,16 +1374,46 @@
 hmallow%22
+,%0A      %22Nougat%22,%0A      %22Oreo%22
 %0A  %7D;%0A%0A 

Update demo