Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to version 1.4.0 #47

Merged
merged 19 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Autosize text inside Element
Text resizing is handled by `AutoSizeableTextView`, which `Element`
implements, so manual text resizing is unnecessary.
Fixes #2, #6 and #12.
  • Loading branch information
p-davide committed Nov 5, 2022
commit 22d96afba5c648b9f405c90086ff58c247434399
12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class Element extends android.support.v7.widget.AppCompatButton {
public int dPosY = 0;
public boolean activated;
public boolean animateMoving = false;
public float textSize = 24;
Context context;
int color;

Expand All @@ -59,7 +58,6 @@ public Element(Context c)
super(c);
context = c;
setAllCaps(false);
setTextSize(textSize);
setBackgroundResource(R.drawable.game_brick);
if(PreferenceManager.getDefaultSharedPreferences(context).getString("pref_color","1").equals("1"))
setColor(context.getResources().getColor(R.color.button_empty));
Expand Down Expand Up @@ -143,14 +141,10 @@ public void drawItem() {
case 16384:
setColor(ContextCompat.getColor(context,R.color.button16384));
setTextColor(ContextCompat.getColor(context,R.color.white));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
case 32768:
setColor(ContextCompat.getColor(context,R.color.button32768));
setTextColor(ContextCompat.getColor(context,R.color.white));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
}
}
Expand Down Expand Up @@ -216,14 +210,10 @@ public void drawItem() {
case 16384:
setColor(ContextCompat.getColor(context,R.color.button16384_2));
setTextColor(ContextCompat.getColor(context,R.color.white));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
case 32768:
setColor(ContextCompat.getColor(context,R.color.button32768_2));
setTextColor(ContextCompat.getColor(context,R.color.white));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
}
}
Expand Down Expand Up @@ -273,10 +263,7 @@ public int getPosX() {
public int getPosY() {
return posY;
}
public void updateFontSize(){
textSize=(float)(getLayoutParams().width/7.0);
setTextSize(textSize);
}

public Element copy()
{
Element temp = new Element(context);
Expand All @@ -288,9 +275,7 @@ public Element copy()
temp.dPosY = dPosY;
temp.activated = activated;
temp.animateMoving = animateMoving;
temp.textSize = textSize;
temp.color = color;
temp.setTextSize(textSize);
//temp.setBackgroundResource(backGroundResource);
temp.setColor(color);
temp.setVisibility(getVisibility());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ record = gameStatistics.getRecord();
elements[i][j].setDPosition(lp.getMarginStart(),lp.topMargin);
elements[i][j].setLayoutParams(lp);
backgroundElements[i][j].setLayoutParams(lp);
elements[i][j].updateFontSize();
backgroundElements[i][j].setLayoutParams(lp);
backgroundElements[i][j].setOnTouchListener(swipeListener);
elements[i][j].setOnTouchListener(swipeListener);
Expand Down