mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-17 12:00:10 -07:00
demo buttob
This commit is contained in:
parent
9a64dde80c
commit
cff85c1197
8 changed files with 48 additions and 24 deletions
|
|
@ -1156,18 +1156,10 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
.show();
|
||||
}
|
||||
|
||||
private float pxToDp(float px) {
|
||||
return (px / getResources().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
private float dpToPx(float dp) {
|
||||
return (dp * getResources().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
private Button findButton(int id) {
|
||||
Button button = (Button) findViewById(id);
|
||||
button.setWidth((int) dpToPx(pxToDp(button.getWidth()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
||||
button.setHeight((int) dpToPx(pxToDp(button.getHeight()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
||||
button.setWidth((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getWidth()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
||||
button.setHeight((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getHeight()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
||||
button.setOnTouchListener(this);
|
||||
return button;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue