use of com.rey.material.widget.Button in project material by rey5137.
the class DialogsFragment method showBottomSheet.
private void showBottomSheet() {
mBottomSheetDialog = new BottomSheetDialog(mActivity, R.style.Material_App_BottomSheetDialog);
View v = LayoutInflater.from(mActivity).inflate(R.layout.view_bottomsheet, null);
ViewUtil.setBackground(v, new ThemeDrawable(R.array.bg_window));
Button bt_match = (Button) v.findViewById(R.id.sheet_bt_match);
bt_match.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mBottomSheetDialog.heightParam(ViewGroup.LayoutParams.MATCH_PARENT);
}
});
Button bt_wrap = (Button) v.findViewById(R.id.sheet_bt_wrap);
bt_wrap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mBottomSheetDialog.heightParam(ViewGroup.LayoutParams.WRAP_CONTENT);
}
});
mBottomSheetDialog.contentView(v).show();
}
use of com.rey.material.widget.Button in project material by rey5137.
the class ButtonFragment method onCreateView.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_button, container, false);
Button bt_flat = (Button) v.findViewById(R.id.button_bt_flat);
Button bt_flat_color = (Button) v.findViewById(R.id.button_bt_flat_color);
Button bt_flat_wave = (Button) v.findViewById(R.id.button_bt_flat_wave);
Button bt_flat_wave_color = (Button) v.findViewById(R.id.button_bt_flat_wave_color);
Button bt_raise = (Button) v.findViewById(R.id.button_bt_raise);
Button bt_raise_color = (Button) v.findViewById(R.id.button_bt_raise_color);
Button bt_raise_wave = (Button) v.findViewById(R.id.button_bt_raise_wave);
Button bt_raise_wave_color = (Button) v.findViewById(R.id.button_bt_raise_wave_color);
FloatingActionButton bt_float = (FloatingActionButton) v.findViewById(R.id.button_bt_float);
FloatingActionButton bt_float_color = (FloatingActionButton) v.findViewById(R.id.button_bt_float_color);
FloatingActionButton bt_float_wave = (FloatingActionButton) v.findViewById(R.id.button_bt_float_wave);
FloatingActionButton bt_float_wave_color = (FloatingActionButton) v.findViewById(R.id.button_bt_float_wave_color);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v instanceof FloatingActionButton) {
FloatingActionButton bt = (FloatingActionButton) v;
bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
}
// System.out.println(v + " " + ((RippleDrawable)v.getBackground()).getDelayClickType());
}
};
View.OnClickListener listener_delay = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v instanceof FloatingActionButton) {
FloatingActionButton bt = (FloatingActionButton) v;
bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
}
// System.out.println(v + " " + ((RippleDrawable)v.getBackground()).getDelayClickType());
}
};
bt_flat.setOnClickListener(listener);
bt_flat_wave.setOnClickListener(listener);
bt_raise.setOnClickListener(listener);
bt_raise_wave.setOnClickListener(listener);
bt_float.setOnClickListener(listener);
bt_float_wave.setOnClickListener(listener);
bt_flat_color.setOnClickListener(listener_delay);
bt_flat_wave_color.setOnClickListener(listener_delay);
bt_raise_color.setOnClickListener(listener_delay);
bt_raise_wave_color.setOnClickListener(listener_delay);
bt_float_color.setOnClickListener(listener_delay);
bt_float_wave_color.setOnClickListener(listener_delay);
return v;
}
use of com.rey.material.widget.Button in project material by rey5137.
the class DialogsFragment method onCreateView.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_dialog, container, false);
Button bt_title_only = (Button) v.findViewById(R.id.dialog_bt_title_only);
Button bt_msg_only = (Button) v.findViewById(R.id.dialog_bt_msg_only);
Button bt_title_msg = (Button) v.findViewById(R.id.dialog_bt_title_msg);
Button bt_custom = (Button) v.findViewById(R.id.dialog_bt_custom);
Button bt_choice = (Button) v.findViewById(R.id.dialog_bt_choice);
Button bt_multi_choice = (Button) v.findViewById(R.id.dialog_bt_multi_choice);
Button bt_time = (Button) v.findViewById(R.id.dialog_bt_time);
Button bt_date = (Button) v.findViewById(R.id.dialog_bt_date);
Button bt_bottomsheet = (Button) v.findViewById(R.id.dialog_bt_bottomsheet);
bt_title_only.setOnClickListener(this);
bt_msg_only.setOnClickListener(this);
bt_title_msg.setOnClickListener(this);
bt_custom.setOnClickListener(this);
bt_choice.setOnClickListener(this);
bt_multi_choice.setOnClickListener(this);
bt_time.setOnClickListener(this);
bt_date.setOnClickListener(this);
bt_bottomsheet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showBottomSheet();
}
});
mActivity = (MainActivity) getActivity();
return v;
}
use of com.rey.material.widget.Button in project material by rey5137.
the class SnackbarFragment method onCreateView.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_snackbar, container, false);
Button bt_mobile_single = (Button) v.findViewById(R.id.snackbar_bt_mobile_single);
Button bt_mobile_multi = (Button) v.findViewById(R.id.snackbar_bt_mobile_multi);
Button bt_tablet_single = (Button) v.findViewById(R.id.snackbar_bt_tablet_single);
Button bt_tablet_multi = (Button) v.findViewById(R.id.snackbar_bt_tablet_multi);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mSnackBar.getState() == SnackBar.STATE_SHOWN)
mSnackBar.dismiss();
else {
switch(v.getId()) {
case R.id.snackbar_bt_mobile_single:
mSnackBar.applyStyle(R.style.SnackBarSingleLine);
mSnackBar.show();
break;
case R.id.snackbar_bt_mobile_multi:
mSnackBar.applyStyle(R.style.SnackBarMultiLine);
mSnackBar.show();
break;
case R.id.snackbar_bt_tablet_single:
mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet);
mSnackBar.text("This is single-line snackbar.").actionText("CLOSE").duration(0).show();
break;
case R.id.snackbar_bt_tablet_multi:
mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet_MultiLine);
mSnackBar.text("This is multi-line snackbar.\nIt will auto-close after 5s.").actionText(null).duration(5000).show();
break;
}
}
}
};
bt_mobile_single.setOnClickListener(listener);
bt_mobile_multi.setOnClickListener(listener);
bt_tablet_single.setOnClickListener(listener);
bt_tablet_multi.setOnClickListener(listener);
mSnackBar = ((MainActivity) getActivity()).getSnackBar();
return v;
}
use of com.rey.material.widget.Button in project material by rey5137.
the class Dialog method init.
private void init(Context context, int style) {
mContentPadding = ThemeUtil.dpToPx(context, 24);
mActionMinWidth = ThemeUtil.dpToPx(context, 64);
mActionHeight = ThemeUtil.dpToPx(context, 36);
mActionOuterHeight = ThemeUtil.dpToPx(context, 48);
mActionPadding = ThemeUtil.dpToPx(context, 8);
mActionOuterPadding = ThemeUtil.dpToPx(context, 16);
mDialogHorizontalPadding = ThemeUtil.dpToPx(context, 40);
mDialogVerticalPadding = ThemeUtil.dpToPx(context, 24);
mCardView = new DialogCardView(context);
mContainer = new ContainerFrameLayout(context);
mTitle = new TextView(context);
mPositiveAction = new Button(context);
mNegativeAction = new Button(context);
mNeutralAction = new Button(context);
mCardView.setPreventCornerOverlap(false);
mCardView.setUseCompatPadding(true);
mTitle.setId(TITLE);
mTitle.setGravity(Gravity.START);
mTitle.setPadding(mContentPadding, mContentPadding, mContentPadding, mContentPadding - mActionPadding);
mPositiveAction.setId(ACTION_POSITIVE);
mPositiveAction.setPadding(mActionPadding, 0, mActionPadding, 0);
mPositiveAction.setBackgroundResource(0);
mNegativeAction.setId(ACTION_NEGATIVE);
mNegativeAction.setPadding(mActionPadding, 0, mActionPadding, 0);
mNegativeAction.setBackgroundResource(0);
mNeutralAction.setId(ACTION_NEUTRAL);
mNeutralAction.setPadding(mActionPadding, 0, mActionPadding, 0);
mNeutralAction.setBackgroundResource(0);
mContainer.addView(mCardView);
mCardView.addView(mTitle);
mCardView.addView(mPositiveAction);
mCardView.addView(mNegativeAction);
mCardView.addView(mNeutralAction);
backgroundColor(ThemeUtil.windowBackground(context, 0xFFFFFFFF));
elevation(ThemeUtil.dpToPx(context, 4));
cornerRadius(ThemeUtil.dpToPx(context, 2));
dimAmount(0.5f);
layoutDirection(View.LAYOUT_DIRECTION_LOCALE);
titleTextAppearance(R.style.TextAppearance_AppCompat_Title);
actionTextAppearance(R.style.TextAppearance_AppCompat_Button);
dividerColor(0x1E000000);
dividerHeight(ThemeUtil.dpToPx(context, 1));
cancelable(true);
canceledOnTouchOutside(true);
clearContent();
onCreate();
applyStyle(style);
super.setContentView(mContainer);
}
Aggregations