Revision e3c74c0f
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/states/RubikStateSolution.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.Gravity; |
25 | 26 |
import android.view.LayoutInflater; |
26 | 27 |
import android.view.View; |
... | ... | |
47 | 48 |
private int[][] mMoves; |
48 | 49 |
private int mCurrMove, mNumMoves; |
49 | 50 |
private boolean mCanRotate; |
51 |
private float mButtonSize, mTitleSize; |
|
50 | 52 |
|
51 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 54 |
|
... | ... | |
60 | 62 |
|
61 | 63 |
void enterState(final RubikActivity act) |
62 | 64 |
{ |
65 |
float width = act.getScreenWidthInPixels(); |
|
66 |
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
|
67 |
mTitleSize = width*RubikActivity.TITLE_TEXT_SIZE; |
|
68 |
|
|
63 | 69 |
DisplayMetrics metrics = act.getResources().getDisplayMetrics(); |
64 | 70 |
final float scale = metrics.density; |
65 | 71 |
LayoutInflater inflater = act.getLayoutInflater(); |
... | ... | |
69 | 75 |
layoutTop.removeAllViews(); |
70 | 76 |
|
71 | 77 |
final TextView text = (TextView)inflater.inflate(R.layout.upper_text, null); |
78 |
text.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTitleSize); |
|
72 | 79 |
text.setText(R.string.solution); |
73 | 80 |
layoutTop.addView(text); |
74 | 81 |
|
... | ... | |
148 | 155 |
mMovesText.setLayoutParams(params); |
149 | 156 |
mMovesText.setPadding(padding,0,padding,0); |
150 | 157 |
mMovesText.setGravity(Gravity.CENTER); |
158 |
mMovesText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize); |
|
151 | 159 |
mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves)); |
152 | 160 |
} |
153 | 161 |
|
... | ... | |
160 | 168 |
mBackButton = new Button(act); |
161 | 169 |
mBackButton.setLayoutParams(backParams); |
162 | 170 |
mBackButton.setPadding(padding,0,padding,0); |
171 |
mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize); |
|
163 | 172 |
mBackButton.setText(R.string.back); |
164 | 173 |
|
165 | 174 |
mBackButton.setOnClickListener( new View.OnClickListener() |
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 1)