Revision e3c74c0f
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/states/RubikStateReady.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.SharedPreferences; |
23 | 23 |
import android.util.DisplayMetrics; |
24 |
import android.util.TypedValue; |
|
24 | 25 |
import android.view.LayoutInflater; |
25 | 26 |
import android.view.View; |
26 | 27 |
import android.widget.Button; |
... | ... | |
43 | 44 |
|
44 | 45 |
void enterState(final RubikActivity act) |
45 | 46 |
{ |
47 |
float width = act.getScreenWidthInPixels(); |
|
48 |
float buttonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
|
49 |
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE; |
|
50 |
|
|
46 | 51 |
LayoutInflater inflater = act.getLayoutInflater(); |
47 | 52 |
DisplayMetrics metrics = act.getResources().getDisplayMetrics(); |
48 | 53 |
float scale = metrics.density; |
... | ... | |
51 | 56 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
52 | 57 |
layoutTop.removeAllViews(); |
53 | 58 |
TextView label = (TextView)inflater.inflate(R.layout.upper_text, null); |
59 |
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
|
54 | 60 |
label.setText(R.string.ready); |
55 | 61 |
layoutTop.addView(label); |
56 | 62 |
|
... | ... | |
67 | 73 |
Button back = new Button(act); |
68 | 74 |
back.setLayoutParams(params); |
69 | 75 |
back.setPadding(padding,0,padding,0); |
76 |
back.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize); |
|
70 | 77 |
back.setText(R.string.back); |
71 | 78 |
|
72 | 79 |
back.setOnClickListener( new View.OnClickListener() |
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 1)