Revision e3c74c0f
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/states/RubikStatePattern.java | ||
---|---|---|
23 | 23 |
import android.os.Bundle; |
24 | 24 |
import androidx.fragment.app.FragmentManager; |
25 | 25 |
import android.util.DisplayMetrics; |
26 |
import android.util.TypedValue; |
|
26 | 27 |
import android.view.Gravity; |
27 | 28 |
import android.view.LayoutInflater; |
28 | 29 |
import android.view.View; |
... | ... | |
49 | 50 |
private TextView mMovesText; |
50 | 51 |
private int mNumMoves; |
51 | 52 |
private int mPatternOrdinal, mCategory, mPattern; |
53 |
private float mButtonSize, mTitleSize; |
|
52 | 54 |
|
53 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 56 |
|
... | ... | |
79 | 81 |
|
80 | 82 |
void enterState(final RubikActivity act) |
81 | 83 |
{ |
84 |
float width = act.getScreenWidthInPixels(); |
|
85 |
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
|
86 |
mTitleSize = width*RubikActivity.TITLE_TEXT_SIZE; |
|
87 |
|
|
82 | 88 |
RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass(); |
83 | 89 |
int obj = play.getObject(); |
84 | 90 |
int size = play.getSize(); |
... | ... | |
101 | 107 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
102 | 108 |
layoutTop.removeAllViews(); |
103 | 109 |
mText = (TextView)inflater.inflate(R.layout.upper_pattern_text, null); |
110 |
mText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTitleSize); |
|
104 | 111 |
mText.setText(R.string.patterns); |
105 | 112 |
layoutTop.addView(mText); |
106 | 113 |
|
... | ... | |
158 | 165 |
mBackButton = new Button(act); |
159 | 166 |
mBackButton.setLayoutParams(backParams); |
160 | 167 |
mBackButton.setPadding(padding,0,padding,0); |
168 |
mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize); |
|
161 | 169 |
mBackButton.setText(R.string.back); |
162 | 170 |
|
163 | 171 |
mBackButton.setOnClickListener( new View.OnClickListener() |
... | ... | |
245 | 253 |
mMovesText.setLayoutParams(params); |
246 | 254 |
mMovesText.setPadding(padding,0,padding,0); |
247 | 255 |
mMovesText.setGravity(Gravity.CENTER); |
256 |
mMovesText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize); |
|
248 | 257 |
mMovesText.setText(act.getString(R.string.mo_placeholder,0,0)); |
249 | 258 |
} |
250 | 259 |
|
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 1)