Skip to content

Commit

Permalink
Fix auto text size
Browse files Browse the repository at this point in the history
- Set minimum to 1 SP and max to 100 SP
- Set max lines to 1
  • Loading branch information
udenr committed Sep 3, 2024
1 parent 588556f commit 03d8969
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorInt;
import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorRes;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.util.TypedValue;
import android.view.View;

import org.secuso.privacyfriendly2048.R;
Expand Down Expand Up @@ -54,12 +56,18 @@ public class Element extends androidx.appcompat.widget.AppCompatButton {
int color;


@SuppressLint("RestrictedApi")
public Element(Context c) {
super(c);
context = c;
setAllCaps(false);
setBackgroundResource(R.drawable.game_brick);
setColor(GetColorRes(context, R.attr.buttonEmpty));
setMaxLines(1);
setAutoSizeTextTypeUniformWithConfiguration(1,
100,
1,
TypedValue.COMPLEX_UNIT_SP);
}

public void drawItem() {
Expand Down

0 comments on commit 03d8969

Please sign in to comment.