Android RelativeSizeSpan - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RelativeSizeSpan class.

This code example shows how to use the following methods:
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Relay");
		ssb.append(String.valueOf(mRelayNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mButton = (ToggleButton) targetView.getChildAt(1);
		mButton.setOnCheckedChangeListener(this);
	} 
 
	public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
		if (isChecked) {
			mButton.setBackgroundDrawable(mOnBackground);
		} else { 
			mButton.setBackgroundDrawable(mOffBackground);
		} 
		if (mActivity != null) {
			mActivity.sendCommand(DemoKitActivity.RELAY_COMMAND,
					mCommandTarget, isChecked ? 1 : 0);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
		SpannableString ss = new SpannableString(text);
		if (titleEnd > 0) {
			ss.setSpan(new StyleSpan(face), 0, titleEnd,
					Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			ss.setSpan(new RelativeSizeSpan(titleRelSize), 0, titleEnd,
					Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			ss.setSpan(fontSpan, 0, titleEnd,
					Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		} 
 
		return ss;
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		TextView widget = (TextView) this;
		Object text = widget.getText();
		if (text instanceof Spanned) {
			Spannable buffer = (Spannable) text;
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        int level = intent.getIntExtra("level", 0);
        String battery = Integer.toString(level) + "%";
 
        SpannableStringBuilder BattText = new SpannableStringBuilder(battery);
        int percent = battery.indexOf("%");
        CharacterStyle style = new RelativeSizeSpan(0.7f);
        BattText.setSpan(style, percent, percent + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        setText(BattText);
    } 
 
    // Get text colors 
    final void updateTextColor(Intent intent) {
        ContentResolver resolver = mContext.getContentResolver();
        int level = intent.getIntExtra("level", 0);
        boolean plugged = intent.getIntExtra("plugged", 0) != 0;
 
        if (!mBattColorAllow) {
            mBattTextColor = Settings.System.getInt(resolver, Settings.System.BATTERY_TEXT_COLOR_STOCK, 0xFF33B5E5);
        } else if (plugged) {
            mBattTextColor = Settings.System.getInt(resolver, Settings.System.BATTERY_TEXT_COLOR_CHARGE, 0xFF00FF00);
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
	public void setInsignificantRelativeSize(final float insignificantRelativeSize)
	{ 
		if (insignificantRelativeSize != 1)
		{ 
			this.prefixRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize);
			this.insignificantRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize);
		} 
		else 
		{ 
			this.prefixRelativeSizeSpan = null;
			this.insignificantRelativeSizeSpan = null;
		} 
	} 
 
	@Override 
	protected void onFinishInflate() 
	{ 
		super.onFinishInflate(); 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Servo");
		ssb.append(String.valueOf(mServoNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mSlider = (Slider) targetView.getChildAt(1);
		mSlider.setPositionListener(this);
	} 
 
	public void onPositionChange(double value) {
		byte v = (byte) (value * 255);
		mActivity.sendCommand(DemoKitActivity.LED_SERVO_COMMAND,
				mCommandTarget, v);
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	public void attachToView(ViewGroup targetView) {
		mLabel = (TextView) targetView.getChildAt(0);
		SpannableStringBuilder ssb = new SpannableStringBuilder("Servo");
		ssb.append(String.valueOf(mServoNumber));
		ssb.setSpan(new SubscriptSpan(), 5, 6, 0);
		ssb.setSpan(new RelativeSizeSpan(0.7f), 5, 6, 0);
		mLabel.setText(ssb);
		mSlider = (Slider) targetView.getChildAt(1);
		mSlider.setPositionListener(this);
	} 
 
	public void onPositionChange(double value) {
		byte v = (byte) (value * 255);
		mActivity.sendCommand(DemoKitActivity.LED_SERVO_COMMAND,
				mCommandTarget, v);
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		Typeface customFont = Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeueLt.ttf");
		Spannable span = new SpannableString(top + "\n" +  bottom);
		//Big font till you find `\n` 
		span.setSpan(new CustomTypefaceSpan("", customFont), 0, top.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		//Small font from `\n` to the end 
		span.setSpan(new RelativeSizeSpan(0.7f), top.length(), (top.length()+bottom.length()+1), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		b.setText(span);
	} 
	 
	private void setLunchInfo(String[] info, ParseObject lunch){
		info[0] = lunch.getString("title");
		info[1] = lunch.getString("menu");
		info[2] = lunch.getDate("date").toString();
		info[3] = lunch.getString("location");
		info[4] = lunch.getString("description");
	} 
 
} 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
   */ 
  private String m_prediction_route_tag;
  private String m_prediction_direction_tag;
  private String m_prediction_direction_title;
 
  private static final RelativeSizeSpan s_small_span = new RelativeSizeSpan(
      0.7f); 
 
  /** 
   * Updates the view's contents according to the arrival time, routes, and 
   * directions that have been set into this object. Schedules another update to 
   * happen when the remaining time goes down by a minute. 
   */ 
  public final void update() { 
    // Never have multiple updates scheduled at once. 
    m_handler.removeMessages(UPDATE_MSG);
 
    if (!"".equals(m_no_prediction_text)) {
      setText(m_no_prediction_text);
      return; 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	} 
 
	public static CharSequence formatColorAndSize(final Context context, final int color, final String text) {
		final SpannableString spannable = new SpannableString(text);
		spannable.setSpan(new ForegroundColorSpan(color), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		spannable.setSpan(new RelativeSizeSpan(0.9f), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		return spannable;
	} 
 
	public static String formatMinutes(final Context context, final long millisecondes) {
		String delay = "";
		final int minutes = (int) (millisecondes / 60000);
 
		if (minutes < 60) {
			delay = context.getString(R.string.format_minutes, minutes);
		} else { 
			final int heures = minutes / 60;
			final int reste = minutes - heures * 60;
			delay = context.getString(R.string.format_heures, heures, (reste < 10) ? "0" + reste : reste);
		} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        int level = intent.getIntExtra("level", 0);
        String battery = Integer.toString(level) + "%";
 
        SpannableStringBuilder BattText = new SpannableStringBuilder(battery);
        int percent = battery.indexOf("%");
        CharacterStyle style = new RelativeSizeSpan(0.7f);
        BattText.setSpan(style, percent, percent + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        setText(BattText);
    } 
 
    // Get text colors 
    final void updateTextColor(Intent intent) {
        ContentResolver resolver = mContext.getContentResolver();
        int level = intent.getIntExtra("level", 0);
        boolean plugged = intent.getIntExtra("plugged", 0) != 0;
 
        if (!mBattColorAllow) {
            mBattTextColor = Settings.System.getInt(resolver, Settings.System.BATTERY_TEXT_COLOR_STOCK, 0xFF33B5E5);
        } else if (plugged) {
            mBattTextColor = Settings.System.getInt(resolver, Settings.System.BATTERY_TEXT_COLOR_CHARGE, 0xFF00FF00);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android RelativeSizeSpan Questions & Answers:

See Code Examples for Android RelativeSizeSpan Methods: