android.graphics.Typeface.equals()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(88)

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

Typeface.equals介绍

暂无

代码示例

代码示例来源:origin: bluejamesbond/TextJustify-Android

public void setTextTypeface(Typeface typeface) {
  if (this.textTypeface.equals(typeface)) {
    return;
  }
  this.textTypeface = typeface;
  invalidate();
}

代码示例来源:origin: AigeStudio/WheelPicker

@Override
public Typeface getTypeface() {
  if (mPickerYear.getTypeface().equals(mPickerMonth.getTypeface()) &&
      mPickerMonth.getTypeface().equals(mPickerDay.getTypeface()))
    return mPickerYear.getTypeface();
  throw new RuntimeException("Can not get typeface correctly from WheelDatePicker!");
}

代码示例来源:origin: facebook/litho

if (!DEFAULT_TYPEFACE.equals(typeface)) {
 layoutBuilder.setTypeface(typeface);
} else {

代码示例来源:origin: opacapp/multiline-collapsingtoolbar

private boolean areTypefacesDifferent(Typeface first, Typeface second) {
  return (first != null && !first.equals(second)) || (first == null && second != null);
}

代码示例来源:origin: org.arakhne.afc.ui/vector-android

@Override
public String getName() {
  Typeface tf = this.paint.getTypeface();
  tf = Typeface.create(tf, Typeface.NORMAL);
  if (tf.equals(Typeface.DEFAULT)) {
    return "Normal"; 
  }
  if (tf.equals(Typeface.MONOSPACE)) {
    return "Monospace"; 
  }
  if (tf.equals(Typeface.SANS_SERIF)) {
    return "Sans"; 
  }
  if (tf.equals(Typeface.SERIF)) {
    return "Serif"; 
  }
  return "Unknown"; 
}

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || this.getClass() != o.getClass()) {
    return false;
  }
  TextCacheKey that = (TextCacheKey) o;
  return ((this.text == null) ? (that.text == null) : this.text.equals(that.text))
    && ((this.textColor == null) ? (that.textColor == null) : this.textColor.equals(that.textColor))
    && this.textSize == that.textSize
    && ((this.typeface == null) ? (that.typeface == null) : this.typeface.equals(that.typeface))
    && this.enableOutline == that.enableOutline
    && ((this.outlineColor == null) ? (that.outlineColor == null) : this.outlineColor.equals(that.outlineColor))
    && this.outlineWidth == that.outlineWidth;
}

代码示例来源:origin: powerpoint45/Lucid-Browser

@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Views views;
    if (convertView == null){
      convertView = inflater.inflate(R.layout.file_item,null);
      views = new Views();
      views.imageView = (ImageView) convertView.findViewById(R.id.favorites_icon);
      views.textView = (TextView) convertView.findViewById(R.id.favorites_text);
      convertView.setTag(views);
    }else
      views = (Views)convertView.getTag();
    views.textView.setText(files[position].getName());
    if (tf == null)
      tf = views.textView.getTypeface();
    if (!views.textView.getTypeface().equals(tf))
      views.textView.setTypeface(tf);
    if (files[position].isDirectory()){
      if (files[position].getName().toString().equals("LucidBrowser"))
        views.textView.setTypeface(null,Typeface.BOLD);
      views.imageView.setImageResource(R.drawable.ic_action_collection);
    }else{
      views.imageView.setImageResource(R.drawable.ic_insert_drive_file);
    }
    return convertView;
  }
};

代码示例来源:origin: NASAWorldWind/WorldWindAndroid

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || this.getClass() != o.getClass()) {
    return false;
  }
  TextAttributes that = (TextAttributes) o;
  return this.textColor.equals(that.textColor)
    && this.textOffset.equals(that.textOffset)
    && this.textSize == that.textSize
    && ((this.typeface == null) ? (that.typeface == null) : this.typeface.equals(that.typeface))
    && this.enableOutline == that.enableOutline
    && this.outlineColor.equals(that.outlineColor)
    && this.enableDepthTest == that.enableDepthTest
    && this.outlineWidth == that.outlineWidth;
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

public void updatePadding() {
  float paddingRatio = NORMAL_FONT_PADDING_RATIO;
  float bottomPaddingRatio = NORMAL_FONT_BOTTOM_PADDING_RATIO;
  if (getPaint().getTypeface() != null && getPaint().getTypeface().equals(Typeface.DEFAULT_BOLD)) {
    paddingRatio = BOLD_FONT_PADDING_RATIO;
    bottomPaddingRatio = BOLD_FONT_BOTTOM_PADDING_RATIO;
  }
  if (getTypeface() != null && getTypeface().equals(SAN_SERIF_BOLD)) {
    paddingRatio = BOLD_FONT_PADDING_RATIO;
    bottomPaddingRatio = BOLD_FONT_BOTTOM_PADDING_RATIO;
  }
  if (getTypeface() != null && getTypeface().equals(SAN_SERIF_CONDENSED_BOLD)) {
    paddingRatio = BOLD_FONT_PADDING_RATIO;
    bottomPaddingRatio = BOLD_FONT_BOTTOM_PADDING_RATIO;
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH &&
      getText() != null &&
      (getText().toString().equals(decimalSeperator) ||
          getText().toString().equals(timeSeperator))) {
    bottomPaddingRatio = PRE_ICS_BOTTOM_PADDING_RATIO;
  }
  // no need to scale by display density because getTextSize() already returns the font
  // height in px
  setPadding(0, (int) (-paddingRatio * getTextSize()), mPaddingRight,
      (int) (-bottomPaddingRatio * getTextSize()));
}

相关文章