mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
Adding error message for login(). Final touch. Refactoring LoginActivity and other improvements. Co-authored-by: opyale <opyale@noreply.gitea.io> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/561 Reviewed-by: 6543 <6543@noreply.codeberg.org>
27 lines
574 B
Java
27 lines
574 B
Java
package org.mian.gitnex.helpers;
|
|
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.graphics.Typeface;
|
|
|
|
/**
|
|
* Author M M Arif
|
|
*/
|
|
|
|
public class LabelWidthCalculator {
|
|
|
|
public static int calculateLabelWidth(String text, Typeface typeface, int textSize, int paddingLeftRight) {
|
|
|
|
Paint paint = new Paint();
|
|
Rect rect = new Rect();
|
|
|
|
paint.setTextSize(textSize);
|
|
paint.setTypeface(typeface);
|
|
paint.getTextBounds(text, 0, text.length(), rect);
|
|
|
|
return rect.width() + (paddingLeftRight * 2);
|
|
|
|
}
|
|
|
|
}
|