Project

General

Profile

« Previous | Next » 

Revision e3c74c0f

Added by Leszek Koltunski almost 4 years ago

Improvements to the UI - make it proportional regardless of the physical screen size. (Part 1)

View differences:

src/main/java/org/distorted/states/RubikStateSolving.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;
......
85 86

  
86 87
  void enterState(final RubikActivity act)
87 88
    {
89
    float width = act.getScreenWidthInPixels();
90
    float buttonSize = width*RubikActivity.BUTTON_TEXT_SIZE;
91
    float titleSize  = width*RubikActivity.TITLE_TEXT_SIZE;
92

  
88 93
    mCanPrevMove = true;
89 94

  
90 95
    startCounting(act);
......
101 106
    layoutTop.removeAllViews();
102 107
    mTime = (TextView)inflater.inflate(R.layout.upper_text, null);
103 108
    int elapsed = (int)mElapsed/1000;
109
    mTime.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
104 110
    mTime.setText(act.getString(R.string.tm_placeholder,elapsed/60,elapsed%60));
105 111
    layoutTop.addView(mTime);
106 112

  
......
120 126
    Button back = new Button(act);
121 127
    back.setLayoutParams(params);
122 128
    back.setPadding(padding,0,padding,0);
129
    back.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize);
123 130
    back.setText(R.string.back);
124 131

  
125 132
    back.setOnClickListener( new View.OnClickListener()

Also available in: Unified diff