com.coder.zzq.smartshow.core.Utils.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中com.coder.zzq.smartshow.core.Utils.isEmpty()方法的一些代码示例,展示了Utils.isEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isEmpty()方法的具体详情如下:
包路径:com.coder.zzq.smartshow.core.Utils
类名称:Utils
方法名:isEmpty

Utils.isEmpty介绍

暂无

代码示例

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
public B message(CharSequence msg) {
  if (Utils.isEmpty(msg)) {
    return (B) this;
  }
  mMessage = msg;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
public B title(CharSequence title) {
  if (Utils.isEmpty(title)) {
    return (B) this;
  }
  mTitle = title;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
public ILoadingDialogCreator message(CharSequence msg) {
  mMsg = Utils.isEmpty(msg) ? "加载中..." : msg;
  return this;
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
public B title(CharSequence title) {
  if (Utils.isEmpty(title)) {
    return (B) this;
  }
  mTitle = title;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
public B message(CharSequence msg) {
  if (Utils.isEmpty(msg)) {
    return (B) this;
  }
  mMessage = msg;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
public B title(CharSequence title) {
  if (Utils.isEmpty(title)) {
    return (B) this;
  }
  mTitle = title;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
public B title(CharSequence title) {
  if (Utils.isEmpty(title)) {
    return (B) this;
  }
  mTitle = title;
  return (B) this;
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
public ILoadingDialogCreator message(CharSequence msg) {
  mMsg = Utils.isEmpty(msg) ? "加载中..." : msg;
  return this;
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

protected void setBtnStyle(TextView btn, CharSequence btnLabel, float labelSizeSp, @ColorInt int labelColor, boolean labelBold) {
  if (!Utils.isEmpty(btnLabel)) {
    btn.setText(btnLabel);
  }
  if (labelColor != 0) {
    btn.setTextColor(labelColor);
  }
  if (labelSizeSp > 0) {
    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP, labelSizeSp);
  }
  btn.getPaint().setFakeBoldText(labelBold);
}

代码示例来源:origin: the-pig-of-jungle/smart-show

protected void setBtnStyle(TextView btn, CharSequence btnLabel, float labelSizeSp, @ColorInt int labelColor, boolean labelBold) {
  if (!Utils.isEmpty(btnLabel)) {
    btn.setText(btnLabel);
  }
  if (labelColor != 0) {
    btn.setTextColor(labelColor);
  }
  if (labelSizeSp > 0) {
    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP, labelSizeSp);
  }
  btn.getPaint().setFakeBoldText(labelBold);
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
protected void initHeader(Dialog dialog, FrameLayout headerViewWrapper) {
  super.initHeader(dialog, headerViewWrapper);
  headerViewWrapper.setVisibility(Utils.isEmpty(mTitle) ? View.GONE : View.VISIBLE);
  if (!Utils.isEmpty(mTitle)) {
    headerViewWrapper.setVisibility(View.VISIBLE);
    TextView titleView = headerViewWrapper.findViewById(R.id.smart_show_dialog_title_view);
    titleView.setText(mTitle);
    if (mTitleColor != 0) {
      titleView.setTextColor(mTitleColor);
    }
    if (mTitleTextSizeSp > 0) {
      titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSizeSp);
    }
    titleView.getPaint().setFakeBoldText(mTitleBold);
  } else {
    headerViewWrapper.setVisibility(View.GONE);
  }
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
protected void initHeader(Dialog dialog, FrameLayout headerViewWrapper) {
  super.initHeader(dialog, headerViewWrapper);
  headerViewWrapper.setVisibility(Utils.isEmpty(mTitle) ? View.GONE : View.VISIBLE);
  if (!Utils.isEmpty(mTitle)) {
    headerViewWrapper.setVisibility(View.VISIBLE);
    TextView titleView = headerViewWrapper.findViewById(R.id.smart_show_dialog_title_view);
    titleView.setText(mTitle);
    if (mTitleColor != 0) {
      titleView.setTextColor(mTitleColor);
    }
    if (mTitleTextSizeSp > 0) {
      titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSizeSp);
    }
    titleView.getPaint().setFakeBoldText(mTitleBold);
  } else {
    headerViewWrapper.setVisibility(View.GONE);
  }
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
protected void initHeader(Dialog dialog, FrameLayout headerViewWrapper) {
  super.initHeader(dialog, headerViewWrapper);
  headerViewWrapper.setVisibility(Utils.isEmpty(mTitle) ? View.GONE : View.VISIBLE);
  if (!Utils.isEmpty(mTitle)) {
    headerViewWrapper.setVisibility(View.VISIBLE);
    TextView titleView = headerViewWrapper.findViewById(R.id.smart_show_dialog_title_view);
    titleView.setText(mTitle);
    if (mTitleColor != 0) {
      titleView.setTextColor(mTitleColor);
    }
    if (mTitleTextSizeSp > 0) {
      titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSizeSp);
    }
    if (mTitleBold) {
      titleView.getPaint().setFakeBoldText(mTitleBold);
    }
  } else {
    headerViewWrapper.setVisibility(View.GONE);
  }
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
protected void initHeader(Dialog dialog, FrameLayout headerViewWrapper) {
  super.initHeader(dialog, headerViewWrapper);
  headerViewWrapper.setVisibility(Utils.isEmpty(mTitle) ? View.GONE : View.VISIBLE);
  if (!Utils.isEmpty(mTitle)) {
    headerViewWrapper.setVisibility(View.VISIBLE);
    TextView titleView = headerViewWrapper.findViewById(R.id.smart_show_dialog_title_view);
    titleView.setText(mTitle);
    if (mTitleColor != 0) {
      titleView.setTextColor(mTitleColor);
    }
    if (mTitleTextSizeSp > 0) {
      titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSizeSp);
    }
    if (mTitleBold) {
      titleView.getPaint().setFakeBoldText(mTitleBold);
    }
  } else {
    headerViewWrapper.setVisibility(View.GONE);
  }
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

protected void setBtn(final Dialog dialog, FrameLayout footerViewWrapper, int btnId, CharSequence label, int labelColor, float labelSize, boolean labelBold,
           final DialogBtnClickListener clickListener) {
  final TextView btn = footerViewWrapper.findViewById(btnId);
  if (!Utils.isEmpty(label)) {
    btn.setText(label);
  }
  if (labelColor != 0) {
    btn.setTextColor(labelColor);
  }
  if (labelSize > 0) {
    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP, labelSize);
  }
  btn.getPaint().setFakeBoldText(labelBold);
  btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      if (clickListener == null) {
        dialog.dismiss();
      } else if (btn.getId() == R.id.smart_show_dialog_confirm_btn) {
        onConfirmBtnClick(dialog, btn, clickListener);
      } else if (btn.getId() == R.id.smart_show_dialog_cancel_btn) {
        onCancelBtnClick(dialog, btn, clickListener);
      }
    }
  });
}

代码示例来源:origin: the-pig-of-jungle/smart-show

protected void setBtn(final Dialog dialog, FrameLayout footerViewWrapper, int btnId, CharSequence label, int labelColor, float labelSize, boolean labelBold,
           final DialogBtnClickListener clickListener) {
  final TextView btn = footerViewWrapper.findViewById(btnId);
  if (!Utils.isEmpty(label)) {
    btn.setText(label);
  }
  if (labelColor != 0) {
    btn.setTextColor(labelColor);
  }
  if (labelSize > 0) {
    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP, labelSize);
  }
  btn.getPaint().setFakeBoldText(labelBold);
  btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      if (clickListener == null) {
        dialog.dismiss();
      } else if (btn.getId() == R.id.smart_show_dialog_confirm_btn) {
        onConfirmBtnClick(dialog, btn, clickListener);
      } else if (btn.getId() == R.id.smart_show_dialog_cancel_btn) {
        onCancelBtnClick(dialog, btn, clickListener);
      }
    }
  });
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

if (!Utils.isEmpty(mHint)) {
  inputEdt.setHint(mHint);

代码示例来源:origin: the-pig-of-jungle/smart-show

if (!Utils.isEmpty(mHint)) {
  inputEdt.setHint(mHint);

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
protected void initBody(Dialog dialog, FrameLayout bodyViewWrapper) {
  super.initBody(dialog, bodyViewWrapper);
  TextView messageView = bodyViewWrapper.findViewById(R.id.smart_show_dialog_message_view);
  messageView.setText(mMessage);
  ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) messageView.getLayoutParams();
  lp.topMargin = Utils.isEmpty(mTitle) ? Utils.dpToPx(7) : 0;
  messageView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
    @Override
    public void onViewAttachedToWindow(View v) {
      TextView msgView = (TextView) v;
      if (msgView.getLineCount() > 1) {
        msgView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
      } else {
        msgView.setGravity(Gravity.CENTER);
      }
    }
    @Override
    public void onViewDetachedFromWindow(View v) {
    }
  });
  if (mMessageColor != 0) {
    messageView.setTextColor(mMessageColor);
  }
  if (mMessageTextSizeSp > 0) {
    messageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mMessageTextSizeSp);
  }
  messageView.getPaint().setFakeBoldText(mMessageBold);
}

代码示例来源:origin: the-pig-of-jungle/smart-show

@Override
protected void initBody(Dialog dialog, FrameLayout bodyViewWrapper) {
  super.initBody(dialog, bodyViewWrapper);
  TextView messageView = bodyViewWrapper.findViewById(R.id.smart_show_dialog_message_view);
  messageView.setText(mMessage);
  ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) messageView.getLayoutParams();
  lp.topMargin = Utils.isEmpty(mTitle) ? Utils.dpToPx(7) : 0;
  messageView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
    @Override
    public void onViewAttachedToWindow(View v) {
      TextView msgView = (TextView) v;
      if (msgView.getLineCount() > 1) {
        msgView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
      } else {
        msgView.setGravity(Gravity.CENTER);
      }
    }
    @Override
    public void onViewDetachedFromWindow(View v) {
    }
  });
  if (mMessageColor != 0) {
    messageView.setTextColor(mMessageColor);
  }
  if (mMessageTextSizeSp > 0) {
    messageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mMessageTextSizeSp);
  }
  messageView.getPaint().setFakeBoldText(mMessageBold);
}

相关文章