Search in sources :

Example 1 with Button

use of android.widget.Button in project android-betterpickers by code-troopers.

the class TimePickerDialogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.time_picker_dialog, container, false);
    Button doneButton = (Button) view.findViewById(R.id.done_button);
    Button cancelButton = (Button) view.findViewById(R.id.cancel_button);
    cancelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            dismiss();
        }
    });
    cancelButton.setTextColor(mTextColor);
    doneButton.setTextColor(mTextColor);
    doneButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            for (TimePickerDialogHandler handler : mTimePickerDialogHandlers) {
                handler.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
            }
            final Activity activity = getActivity();
            final Fragment fragment = getTargetFragment();
            if (activity instanceof TimePickerDialogHandler) {
                final TimePickerDialogHandler act = (TimePickerDialogHandler) activity;
                act.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
            } else if (fragment instanceof TimePickerDialogHandler) {
                final TimePickerDialogHandler frag = (TimePickerDialogHandler) fragment;
                frag.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
            }
            dismiss();
        }
    });
    mPicker = (TimePicker) view.findViewById(R.id.time_picker);
    mPicker.setSetButton(doneButton);
    mPicker.setTheme(mTheme);
    getDialog().getWindow().setBackgroundDrawableResource(mDialogBackgroundResId);
    return view;
}
Also used : Button(android.widget.Button) Activity(android.app.Activity) View(android.view.View) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 2 with Button

use of android.widget.Button in project android-betterpickers by code-troopers.

the class SampleHmsThemeLight 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.hms_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

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

Example 3 with Button

use of android.widget.Button 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 4 with Button

use of android.widget.Button 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 5 with Button

use of android.widget.Button 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)

Aggregations

Button (android.widget.Button)1427 View (android.view.View)872 TextView (android.widget.TextView)585 OnClickListener (android.view.View.OnClickListener)272 Intent (android.content.Intent)189 LinearLayout (android.widget.LinearLayout)186 ImageView (android.widget.ImageView)141 EditText (android.widget.EditText)120 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)74 ViewGroup (android.view.ViewGroup)62 ScrollView (android.widget.ScrollView)51 Test (org.junit.Test)51 CompoundButton (android.widget.CompoundButton)49 FrameLayout (android.widget.FrameLayout)47 Bundle (android.os.Bundle)44 CheckBox (android.widget.CheckBox)43 ImageButton (android.widget.ImageButton)43 LargeTest (android.test.suitebuilder.annotation.LargeTest)41 DialogInterface (android.content.DialogInterface)39