Revision e3c74c0f
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/states/RubikStateMain.java | ||
---|---|---|
22 | 22 |
import android.content.SharedPreferences; |
23 | 23 |
import androidx.fragment.app.FragmentManager; |
24 | 24 |
import android.util.DisplayMetrics; |
25 |
import android.util.TypedValue; |
|
25 | 26 |
import android.view.LayoutInflater; |
26 | 27 |
import android.view.View; |
27 | 28 |
import android.widget.Button; |
... | ... | |
76 | 77 |
|
77 | 78 |
void enterState(final RubikActivity act) |
78 | 79 |
{ |
80 |
float width = act.getScreenWidthInPixels(); |
|
81 |
float buttonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
|
82 |
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE; |
|
83 |
|
|
79 | 84 |
FragmentManager mana = act.getSupportFragmentManager(); |
80 | 85 |
RubikDialogMain diag = (RubikDialogMain) mana.findFragmentByTag(RubikDialogMain.getDialogTag()); |
81 | 86 |
|
... | ... | |
91 | 96 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
92 | 97 |
layoutTop.removeAllViews(); |
93 | 98 |
final TextView text = (TextView)inflater.inflate(R.layout.upper_text, null); |
99 |
|
|
100 |
text.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
|
94 | 101 |
text.setText(R.string.app_name); |
95 | 102 |
layoutTop.addView(text); |
96 | 103 |
|
... | ... | |
108 | 115 |
Button buttonR = new Button(act); |
109 | 116 |
buttonR.setLayoutParams(params); |
110 | 117 |
buttonR.setPadding(padding,0,padding,0); |
118 |
buttonR.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize); |
|
111 | 119 |
buttonR.setText(R.string.exit); |
112 | 120 |
|
113 | 121 |
buttonR.setOnClickListener( new View.OnClickListener() |
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 1)