Search in sources :

Example 1 with NumberPickerBuilder

use of com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder in project android-betterpickers by code-troopers.

the class SampleNumberBasicUsage method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    mResultTextView.setText(R.string.no_value);
    button.setText(R.string.number_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment);
            npb.show();
        }
    });
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder)

Example 2 with NumberPickerBuilder

use of com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder in project android-betterpickers by code-troopers.

the class SampleNumberMaxValue method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    final BigDecimal maxNumberAllowed = new BigDecimal("1227");
    mResultTextView.setText(R.string.no_value);
    button.setText("Set Number below " + maxNumberAllowed);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment).setMaxNumber(maxNumberAllowed);
            npb.show();
        }
    });
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder) BigDecimal(java.math.BigDecimal)

Example 3 with NumberPickerBuilder

use of com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder in project android-betterpickers by code-troopers.

the class SampleNumberMinValue method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    final BigDecimal minNumberAllowed = new BigDecimal("1227");
    mResultTextView.setText(R.string.no_value);
    button.setText("Set Number above " + minNumberAllowed);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment).setMinNumber(minNumberAllowed);
            npb.show();
        }
    });
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder) BigDecimal(java.math.BigDecimal)

Example 4 with NumberPickerBuilder

use of com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder in project android-betterpickers by code-troopers.

the class SampleNumberWithOptions method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_three_buttons);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button buttonOne = (Button) findViewById(R.id.button_one);
    mButtonSetMin = (Button) findViewById(R.id.button_two);
    mButtonSetMax = (Button) findViewById(R.id.button_three);
    mResultTextView.setText(R.string.no_value);
    buttonOne.setText(R.string.number_picker_set);
    buttonOne.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setPlusMinusVisibility(View.INVISIBLE).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_ONE_REFERENCE).setLabelText("LBS.");
            if (mMin != null) {
                npb.setMinNumber(mMin);
            }
            if (mMax != null) {
                npb.setMaxNumber(mMax);
            }
            npb.show();
        }
    });
    mButtonSetMin.setText("Set Min Number");
    mButtonSetMin.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_TWO_REFERENCE).setLabelText("MIN NUMBER");
            npb.show();
        }
    });
    mButtonSetMax.setText("Set Max Number");
    mButtonSetMax.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_THREE_REFERENCE).setLabelText("MAX NUMBER");
            npb.show();
        }
    });
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder)

Example 5 with NumberPickerBuilder

use of com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder in project android-betterpickers by code-troopers.

the class SampleNumberFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.text_and_button, container, false);
    mResultTextView = (TextView) view.findViewById(R.id.text);
    Button button = (Button) view.findViewById(R.id.button);
    mResultTextView.setText(R.string.no_value);
    button.setText(R.string.number_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getChildFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment).setTargetFragment(SampleNumberFragment.this);
            npb.show();
        }
    });
    return view;
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder)

Aggregations

View (android.view.View)10 TextView (android.widget.TextView)10 NumberPickerBuilder (com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder)10 Button (android.widget.Button)9 BigDecimal (java.math.BigDecimal)3 DialogInterface (android.content.DialogInterface)1 AdapterView (android.widget.AdapterView)1 OnDialogDismissListener (com.codetroopers.betterpickers.OnDialogDismissListener)1 CalendarDatePickerDialogFragment (com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerDialogFragment)1 RadialTimePickerDialogFragment (com.codetroopers.betterpickers.radialtimepicker.RadialTimePickerDialogFragment)1 Calendar (java.util.Calendar)1 Time (ve.com.abicelis.remindy.model.Time)1