Search in sources :

Example 21 with Button

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

the class HmsPicker method restyleViews.

private void restyleViews() {
    for (Button number : mNumbers) {
        if (number != null) {
            number.setTextColor(mTextColor);
            number.setBackgroundResource(mKeyBackgroundResId);
        }
    }
    if (mDivider != null) {
        mDivider.setBackgroundColor(mDividerColor);
    }
    if (mHoursLabel != null) {
        mHoursLabel.setTextColor(mTextColor);
        mHoursLabel.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mMinutesLabel != null) {
        mMinutesLabel.setTextColor(mTextColor);
        mMinutesLabel.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mSecondsLabel != null) {
        mSecondsLabel.setTextColor(mTextColor);
        mSecondsLabel.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mDelete != null) {
        mDelete.setBackgroundResource(mButtonBackgroundResId);
        mDelete.setImageDrawable(getResources().getDrawable(mDeleteDrawableSrcResId));
    }
    if (mEnteredHms != null) {
        mEnteredHms.setTheme(mTheme);
    }
    if (mLeft != null) {
        mLeft.setTextColor(mTextColor);
        mLeft.setBackgroundResource(mKeyBackgroundResId);
    }
}
Also used : ImageButton(android.widget.ImageButton) Button(android.widget.Button)

Example 22 with Button

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

the class HmsPickerDialogFragment method onCreateView.

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

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

        @Override
        public void onClick(View view) {
            for (HmsPickerDialogHandlerV2 handler : mHmsPickerDialogHandlerV2s) {
                handler.onDialogHmsSet(mReference, mPicker.isNegative(), mPicker.getHours(), mPicker.getMinutes(), mPicker.getSeconds());
            }
            final Activity activity = getActivity();
            final Fragment fragment = getTargetFragment();
            if (activity instanceof HmsPickerDialogHandlerV2) {
                final HmsPickerDialogHandlerV2 act = (HmsPickerDialogHandlerV2) activity;
                act.onDialogHmsSet(mReference, mPicker.isNegative(), mPicker.getHours(), mPicker.getMinutes(), mPicker.getSeconds());
            } else if (fragment instanceof HmsPickerDialogHandlerV2) {
                final HmsPickerDialogHandlerV2 frag = (HmsPickerDialogHandlerV2) fragment;
                frag.onDialogHmsSet(mReference, mPicker.isNegative(), mPicker.getHours(), mPicker.getMinutes(), mPicker.getSeconds());
            }
            dismiss();
        }
    });
    mPicker = (HmsPicker) view.findViewById(R.id.hms_picker);
    mPicker.setSetButton(doneButton);
    mPicker.setTime(mHours, mMinutes, mSeconds);
    mPicker.setTheme(mTheme);
    mPicker.setPlusMinusVisibility(mPlusMinusVisibility);
    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 23 with Button

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

the class NumberPickerDialogFragment method onCreateView.

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

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

        @Override
        public void onClick(View view) {
            BigDecimal number = mPicker.getEnteredNumber();
            if (mMinNumber != null && mMaxNumber != null && (isSmaller(number) || isBigger(number))) {
                String errorText = getString(R.string.min_max_error, mMinNumber, mMaxNumber);
                mPicker.getErrorView().setText(errorText);
                mPicker.getErrorView().show();
                return;
            } else if (mMinNumber != null && isSmaller(number)) {
                String errorText = getString(R.string.min_error, mMinNumber);
                mPicker.getErrorView().setText(errorText);
                mPicker.getErrorView().show();
                return;
            } else if (mMaxNumber != null && isBigger(number)) {
                String errorText = getString(R.string.max_error, mMaxNumber);
                mPicker.getErrorView().setText(errorText);
                mPicker.getErrorView().show();
                return;
            }
            for (NumberPickerDialogHandlerV2 handler : mNumberPickerDialogHandlersV2) {
                handler.onDialogNumberSet(mReference, mPicker.getNumber(), mPicker.getDecimal(), mPicker.getIsNegative(), number);
            }
            final Activity activity = getActivity();
            final Fragment fragment = getTargetFragment();
            if (activity instanceof NumberPickerDialogHandlerV2) {
                final NumberPickerDialogHandlerV2 act = (NumberPickerDialogHandlerV2) activity;
                act.onDialogNumberSet(mReference, mPicker.getNumber(), mPicker.getDecimal(), mPicker.getIsNegative(), number);
            } else if (fragment instanceof NumberPickerDialogHandlerV2) {
                final NumberPickerDialogHandlerV2 frag = (NumberPickerDialogHandlerV2) fragment;
                frag.onDialogNumberSet(mReference, mPicker.getNumber(), mPicker.getDecimal(), mPicker.getIsNegative(), number);
            }
            dismiss();
        }
    });
    mPicker = (NumberPicker) view.findViewById(R.id.number_picker);
    mPicker.setSetButton(doneButton);
    mPicker.setTheme(mTheme);
    mPicker.setDecimalVisibility(mDecimalVisibility);
    mPicker.setPlusMinusVisibility(mPlusMinusVisibility);
    mPicker.setLabelText(mLabelText);
    if (mMinNumber != null) {
        mPicker.setMin(mMinNumber);
    }
    if (mMaxNumber != null) {
        mPicker.setMax(mMaxNumber);
    }
    mPicker.setNumber(mCurrentNumber, mCurrentDecimal, mCurrentSign);
    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) BigDecimal(java.math.BigDecimal)

Example 24 with Button

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

the class DatePicker method restyleViews.

private void restyleViews() {
    for (Button month : mMonths) {
        if (month != null) {
            month.setTextColor(mTextColor);
            month.setBackgroundResource(mKeyBackgroundResId);
        }
    }
    for (Button dateNumber : mDateNumbers) {
        if (dateNumber != null) {
            dateNumber.setTextColor(mTextColor);
            dateNumber.setBackgroundResource(mKeyBackgroundResId);
        }
    }
    for (Button yearNumber : mYearNumbers) {
        if (yearNumber != null) {
            yearNumber.setTextColor(mTextColor);
            yearNumber.setBackgroundResource(mKeyBackgroundResId);
        }
    }
    if (mKeyboardIndicator != null) {
        mKeyboardIndicator.setSelectedColor(mKeyboardIndicatorColor);
    }
    if (mDivider != null) {
        mDivider.setBackgroundColor(mTitleDividerColor);
    }
    if (mDateLeft != null) {
        mDateLeft.setTextColor(mTextColor);
        mDateLeft.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mDateRight != null) {
        mDateRight.setBackgroundResource(mKeyBackgroundResId);
        mDateRight.setImageDrawable(getResources().getDrawable(mCheckDrawableSrcResId));
    }
    if (mDelete != null) {
        mDelete.setBackgroundResource(mButtonBackgroundResId);
        mDelete.setImageDrawable(getResources().getDrawable(mDeleteDrawableSrcResId));
    }
    if (mYearLeft != null) {
        mYearLeft.setTextColor(mTextColor);
        mYearLeft.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mYearRight != null) {
        mYearRight.setTextColor(mTextColor);
        mYearRight.setBackgroundResource(mKeyBackgroundResId);
    }
    if (mEnteredDate != null) {
        mEnteredDate.setTheme(mTheme);
    }
}
Also used : ImageButton(android.widget.ImageButton) Button(android.widget.Button)

Example 25 with Button

use of android.widget.Button in project UltimateAndroid by cymcsg.

the class SnackbarNavigationBarTranslucentSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.snack_bar_activity_navigation_bar_translucent_sample);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    enableTransparentSystemBars(getWindow());
    Button singleLineButton = (Button) findViewById(R.id.single_line);
    singleLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarNavigationBarTranslucentSampleActivity.this).text("Single-line snackbar"));
        }
    });
    Button multiLineButton = (Button) findViewById(R.id.multi_line);
    multiLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarNavigationBarTranslucentSampleActivity.this).type(SnackbarType.MULTI_LINE).text("This is a multi-line snackbar. Keep in mind that snackbars" + " are meant for VERY short messages"));
        }
    });
}
Also used : Button(android.widget.Button) View(android.view.View)

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