本文整理汇总了Java中com.rey.material.widget.Button类的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于com.rey.material.widget包,在下文中一共展示了Button类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showCustomDialog
import com.rey.material.widget.Button; //导入依赖的package包/类
private void showCustomDialog(String header, String text) {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.fragment_alert_dialog);
TextView title = (TextView) dialog.findViewById(R.id.title);
title.setText(header);
TextView body = (TextView) dialog.findViewById(R.id.body);
body.setText(text);
android.widget.Button okButton = (android.widget.Button) dialog.findViewById(R.id.ok_button);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(App.inst(), MainAct.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
App.inst().startActivity(intent);
}
});
dialog.show();
}
示例2: onCreateView
import com.rey.material.widget.Button; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_create_event, container, false);
mFromDateButton = (Button) root.findViewById(R.id.from_date_button);
mToDateButton = (Button) root.findViewById(R.id.to_date_button);
mFromTimeButton = (Button) root.findViewById(R.id.from_time_button);
mToTimeButton = (Button) root.findViewById(R.id.to_time_button);
mFABUpload = (FloatingActionButton) root.findViewById(R.id.fab_upload);
mCoverImage = (ImageView) root.findViewById(R.id.create_event_cover);
mFABUpload.setOnClickListener(this);
mCoverImage.setOnClickListener(this);
setupButtonListener(mFromDateButton, true);
setupButtonListener(mToDateButton, true);
setupButtonListener(mFromTimeButton, false);
setupButtonListener(mToTimeButton, false);
return root;
}
示例3: initializeSecurityQuestions
import com.rey.material.widget.Button; //导入依赖的package包/类
private void initializeSecurityQuestions() {
_logger.Debug("initializeSecurityQuestions");
_linearLayoutSecurityQuestions = ((Activity) _context).findViewById(R.id.linearLayoutSecurityQuestions);
_checkBoxSecurityQuestionsAvailable = ((Activity) _context).findViewById(R.id.checkBoxSecurityQuestionsAvailable);
_checkBoxSecurityQuestionsAvailable.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
if (checked) {
_linearLayoutSecurityQuestions.setVisibility(View.VISIBLE);
} else {
_linearLayoutSecurityQuestions.setVisibility(View.GONE);
for (ArrayList<EditText> editPair : _securityQuestionEditTextList) {
if (editPair.size() % 2 != 0) {
_logger.Warn("_securityQuestionEditTextList does not contain pairs! Size: "
+ String.valueOf(editPair.size()));
return;
}
_linearLayoutSecurityQuestions.removeView(editPair.get(0));
_linearLayoutSecurityQuestions.removeView(editPair.get(1));
}
for (Button button : _securityButtonList) {
_linearLayoutSecurityQuestions.removeView(button);
}
_securityQuestionEditTextList.clear();
_securityButtonList.clear();
}
}
});
Button buttonFurtherSecurityQuestions = ((Activity) _context).findViewById(R.id.buttonFurtherSecurityQuestions);
buttonFurtherSecurityQuestions.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
addSecurityQuestion(null);
}
});
}
示例4: addSecurityQuestion
import com.rey.material.widget.Button; //导入依赖的package包/类
private void addSecurityQuestion(SecurityQuestionModel securityQuestion) {
_logger.Debug("addSecurityQuestion");
final EditText questionEditText = new EditText(_context);
final EditText answerEditText = new EditText(_context);
final ArrayList<EditText> editPair = new ArrayList<>();
editPair.add(questionEditText);
editPair.add(answerEditText);
final Button removeSecurityQuestions = new Button(_context);
removeSecurityQuestions.setBackgroundColor(COLOR_BLACK_MAX_ALPHA);
removeSecurityQuestions.setText("X");
removeSecurityQuestions.setGravity(Gravity.END);
removeSecurityQuestions.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
_securityQuestionEditTextList.remove(editPair);
_securityButtonList.remove(removeSecurityQuestions);
_linearLayoutSecurityQuestions.removeView(questionEditText);
_linearLayoutSecurityQuestions.removeView(answerEditText);
_linearLayoutSecurityQuestions.removeView(removeSecurityQuestions);
}
});
_linearLayoutSecurityQuestions.addView(removeSecurityQuestions);
_linearLayoutSecurityQuestions.addView(questionEditText);
_linearLayoutSecurityQuestions.addView(answerEditText);
_securityQuestionEditTextList.add(editPair);
_securityButtonList.add(removeSecurityQuestions);
if (securityQuestion != null) {
questionEditText.setText(securityQuestion.GetQuestion());
answerEditText.setText(securityQuestion.GetAnswer());
}
}
示例5: displayYoutubeIdSearchDialog
import com.rey.material.widget.Button; //导入依赖的package包/类
private void displayYoutubeIdSearchDialog() {
final Dialog dialog = new Dialog(_context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_edittext);
TextView titleView = dialog.findViewById(R.id.dialog_title);
titleView.setText(R.string.searchYoutube);
TextView promptView = dialog.findViewById(R.id.dialog_prompt);
promptView.setText(R.string.promptEnterSearch);
final EditText inputEditText = dialog.findViewById(R.id.dialog_edittext);
Button closeButton = dialog.findViewById(R.id.dialog_button_close);
closeButton.setText(R.string.search);
closeButton.setOnClickListener(v -> {
String input = inputEditText.getText().toString();
if (input.length() == 0) {
Logger.getInstance().Error(TAG, "Input has invalid length 0!");
Toasty.error(_context, "Input has invalid length 0!", Toast.LENGTH_LONG).show();
return;
}
searchYoutubeVideos(input);
});
dialog.setCancelable(true);
dialog.show();
Window window = dialog.getWindow();
if (window != null) {
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
} else {
Logger.getInstance().Warning(TAG, "Window is null!");
}
}
示例6: onCreateView
import com.rey.material.widget.Button; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.pedido_main_list, container, false);
ListView listView = (ListView) view.findViewById(R.id.pedido_items_list);
listView.setAdapter(pedidoAdapter);
TextView total = (TextView)view.findViewById(R.id.text_pedido_total);
final String valorTotal = PedidoAbertoManager.getInstance().getTotal();
total.setText(valorTotal);
final FragmentActivity activity = getActivity();
final com.rey.material.widget.Button confirmarButton = (com.rey.material.widget.Button)view.findViewById(R.id.button_confirmar_pedido);
handleConfirmButtonText(confirmarButton);
if (PedidoAbertoManager.getInstance().getItems().isEmpty())
{
confirmarButton.setEnabled(false);
confirmarButton.setBackgroundColor(getResources().getColor(R.color.disable_color));
confirmarButton.setTextColor(getResources().getColor(R.color.secondary_text));
}
else{
confirmarButton.setEnabled(true);
handleConfirmButtonClickEvent(confirmarButton, valorTotal, total);
}
return view;
}
示例7: handleConfirmButtonText
import com.rey.material.widget.Button; //导入依赖的package包/类
private void handleConfirmButtonText(Button confirmarButton) {
if (PedidoAbertoManager.getInstance().hasConta())
{
confirmarButton.setText("Pagar a Conta");
confirmarButton.setBackgroundColor(getResources().getColor(android.R.color.holo_red_light));
}
else{
confirmarButton.setText("Confirmar");
confirmarButton.setBackground(getResources().getDrawable(R.drawable.bg_bt_raise_color));
}
}
示例8: ViewHolder
import com.rey.material.widget.Button; //导入依赖的package包/类
public ViewHolder(View itemView) {
super(itemView);
time_tv = (TextView) itemView.findViewById(R.id.time_tv);
location_tv = (TextView) itemView.findViewById(R.id.location_tv);
name_tv = (TextView) itemView.findViewById(R.id.name_tv);
date_tv = (TextView) itemView.findViewById(R.id.date_tv);
photo_iv = (ImageView) itemView.findViewById(R.id.photo_iv);
feedback_bt = (Button) itemView.findViewById(R.id.feedback_bt);
}
示例9: initializeViews
import com.rey.material.widget.Button; //导入依赖的package包/类
private void initializeViews() {
_logger.Debug("initializeViews");
_passphraseInput = ((Activity) _context).findViewById(R.id.passwordInput);
Bitmap bitmap = BitmapFactory.decodeResource(_context.getResources(), R.drawable.main_image_informations);
bitmap = Tools.GetCircleBitmap(bitmap);
ImageView loginImageView = ((Activity) _context).findViewById(R.id.loginImageView);
loginImageView.setImageBitmap(bitmap);
Button loginButton = ((Activity) _context).findViewById(R.id.loginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String passphrase = _passphraseInput.getText().toString();
if (passphrase.length() >= Constants.MIN_PASSWORD_LENGTH
&& passphrase.length() <= Constants.MAX_PASSWORD_LENGTH) {
ApplicationPasswordModel passwordModel = getApplicationPassword();
if (passwordModel != null) {
try {
if (_bCrypter.IsPasswordValid(passphrase, passwordModel.GetPasswordHash())) {
passwordModel.SetPassword(passphrase);
Bundle passwordBundle = new Bundle();
passwordBundle.putSerializable(Bundles.APPLICATION_PASSWORD_MODEL, passwordModel);
Intent startDataServiceIntent = new Intent(_context, DataService.class);
startDataServiceIntent.putExtra(Bundles.APPLICATION_PASSWORD_MODEL, passwordModel);
_context.startService(startDataServiceIntent);
_navigationController.NavigateWithData(AccountListView.class, passwordBundle, true);
} else {
loginError();
}
} catch (NoSuchAlgorithmException e) {
_logger.Error(e.toString());
Toasty.error(_context, "An error appeared! Please contact GuepardoApps!", Toast.LENGTH_LONG).show();
((Activity) _context).finish();
}
} else {
loginError();
}
} else {
loginError();
}
}
});
}
示例10: init
import com.rey.material.widget.Button; //导入依赖的package包/类
@SuppressLint("PrivateResource")
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, 4);
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(ViewCompat.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);
}
示例11: init
import com.rey.material.widget.Button; //导入依赖的package包/类
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);
}
示例12: ViewHolder
import com.rey.material.widget.Button; //导入依赖的package包/类
public ViewHolder(View itemView) {
super(itemView);
//layout_item = itemView.findViewById(R.id.list_item);
//textView = (TextView) itemView.findViewById(R.id.title);
textView = (Button) itemView.findViewById(R.id.title);
}