Project

General

Profile

« Previous | Next » 

Revision 4fb1fc0d

Added by Leszek Koltunski about 4 years ago

Progress with UI

View differences:

src/main/java/org/distorted/main/RubikActivity.java
54 54
    public static final float LARGE_MARGIN        = 0.025f;
55 55
    public static final float BUTTON_TEXT_SIZE    = 0.05f;
56 56
    public static final float TITLE_TEXT_SIZE     = 0.06f;
57
    public static final float BITMAP_TEXT_SIZE    = 0.05f;
57
    public static final float BITMAP_TEXT_SIZE    = 0.06f;
58 58
    public static final float MENU_ITEM_SIZE      = 0.12f;
59 59
    public static final float PATTERN_GROUP_TEXT  = 0.03f;
60 60
    public static final float PATTERN_CHILD_TEXT  = 0.02f;
src/main/java/org/distorted/states/RubikStateDone.java
23 23
import android.util.TypedValue;
24 24
import android.view.LayoutInflater;
25 25
import android.view.View;
26
import android.widget.Button;
26
import android.widget.ImageButton;
27 27
import android.widget.LinearLayout;
28 28
import android.widget.TextView;
29 29

  
......
62 62
    layoutBot.removeAllViews();
63 63

  
64 64
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
65
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
66

  
65 67
    LinearLayout layoutLeft = new LinearLayout(act);
66 68
    layoutLeft.setLayoutParams(paramsL);
67 69
    LinearLayout layoutRight = new LinearLayout(act);
68
    layoutRight.setLayoutParams(paramsL);
70
    layoutRight.setLayoutParams(paramsR);
69 71

  
70 72
    int padding = (int)(width*RubikActivity.PADDING);
71 73
    int margin  = (int)(width*RubikActivity.MARGIN);
......
76 78
    params.leftMargin   = margin;
77 79
    params.rightMargin  = margin;
78 80

  
79
    Button back = new Button(act);
81
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
82

  
83
    ImageButton back = new ImageButton(act);
80 84
    back.setLayoutParams(params);
81 85
    back.setPadding(padding,0,padding,0);
82
    back.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize);
83
    back.setText(R.string.back);
86
    back.setImageResource(icon);
84 87

  
85 88
    back.setOnClickListener( new View.OnClickListener()
86 89
      {
src/main/java/org/distorted/states/RubikStatePattern.java
26 26
import android.view.Gravity;
27 27
import android.view.LayoutInflater;
28 28
import android.view.View;
29
import android.widget.Button;
30 29
import android.widget.ImageButton;
31 30
import android.widget.LinearLayout;
32 31
import android.widget.TextView;
......
44 43
public class RubikStatePattern extends RubikStateAbstract
45 44
  {
46 45
  private TextView mText;
47
  private Button mBackButton;
48
  private ImageButton mPrevButton, mNextButton;
46
  private ImageButton mPrevButton, mNextButton, mBackButton;
49 47
  private TextView mMovesText;
50 48
  private int mNumMoves;
51 49
  private int mPatternOrdinal, mCategory, mPattern;
......
124 122

  
125 123
    LinearLayout layoutLeft = new LinearLayout(act);
126 124
    layoutLeft.setLayoutParams(params);
125
    LinearLayout layoutRight = new LinearLayout(act);
126
    layoutRight.setLayoutParams(params);
127 127

  
128 128
    layoutLeft.addView(mPrevButton);
129 129
    layoutLeft.addView(mMovesText);
......
131 131

  
132 132
    setupBackButton(act,width);
133 133

  
134
    LinearLayout layoutRight = new LinearLayout(act);
135
    layoutRight.setLayoutParams(params);
136

  
137 134
    layoutRight.addView(mBackButton);
138 135

  
139 136
    layoutBot.addView(layoutLeft);
......
175 172
    params.leftMargin   = margin;
176 173
    params.rightMargin  = margin;
177 174

  
178
    mBackButton = new Button(act);
175
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
176

  
177
    mBackButton = new ImageButton(act);
179 178
    mBackButton.setLayoutParams(params);
180 179
    mBackButton.setPadding(padding,0,padding,0);
181
    mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize);
182
    mBackButton.setText(R.string.back);
180
    mBackButton.setImageResource(icon);
183 181

  
184 182
    mBackButton.setOnClickListener( new View.OnClickListener()
185 183
      {
src/main/java/org/distorted/states/RubikStatePlay.java
126 126
    LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
127 127
    layoutBot.removeAllViews();
128 128

  
129
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
130

  
131
    LinearLayout layoutLeft = new LinearLayout(act);
132
    layoutLeft.setLayoutParams(params);
133
    LinearLayout layoutMid = new LinearLayout(act);
134
    layoutMid.setLayoutParams(params);
135
    LinearLayout layoutRight = new LinearLayout(act);
136
    layoutRight.setLayoutParams(params);
137

  
129 138
    setupPrevButton(act,width);
130
    layoutBot.addView(mPrevButton);
139
    layoutLeft.addView(mPrevButton);
131 140
    setupSolveButton(act,width);
132
    layoutBot.addView(mSolveButton);
141
    layoutRight.addView(mSolveButton);
142

  
143
    layoutBot.addView(layoutLeft);
144
    layoutBot.addView(layoutMid);
145
    layoutBot.addView(layoutRight);
133 146
    }
134 147

  
135 148
///////////////////////////////////////////////////////////////////////////////////////////////////
......
261 274
    {
262 275
    int padding  = (int)(width*RubikActivity.PADDING);
263 276
    int margin   = (int)(width*RubikActivity.MARGIN);
264
    int widthBut = (int)(width/6);
265 277
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve);
266 278

  
267
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthBut, LinearLayout.LayoutParams.MATCH_PARENT);
279
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
268 280
    params.topMargin    = margin;
269 281
    params.bottomMargin = margin;
270 282
    params.leftMargin   = margin;
......
292 304
    {
293 305
    int padding  = (int)(width*RubikActivity.PADDING);
294 306
    int margin   = (int)(width*RubikActivity.MARGIN);
295
    int widthBut = (int)(width/6);
296 307
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_back,R.drawable.ui_medium_cube_back, R.drawable.ui_big_cube_back, R.drawable.ui_huge_cube_back);
297 308

  
298
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthBut, LinearLayout.LayoutParams.MATCH_PARENT);
309
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
299 310
    params.topMargin    = margin;
300 311
    params.bottomMargin = margin;
301 312
    params.leftMargin   = margin;
src/main/java/org/distorted/states/RubikStateReady.java
67 67
    layoutBot.removeAllViews();
68 68

  
69 69
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
70

  
70 71
    LinearLayout layoutLeft = new LinearLayout(act);
71 72
    layoutLeft.setLayoutParams(paramsL);
73
    LinearLayout layoutMid = new LinearLayout(act);
74
    layoutMid.setLayoutParams(paramsL);
72 75
    LinearLayout layoutRight = new LinearLayout(act);
73 76
    layoutRight.setLayoutParams(paramsL);
74 77

  
......
83 86
    params.leftMargin   = margin;
84 87
    params.rightMargin  = margin;
85 88

  
86
    Button back = new Button(act);
89
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
90

  
91
    ImageButton back = new ImageButton(act);
87 92
    back.setLayoutParams(params);
88 93
    back.setPadding(padding,0,padding,0);
89
    back.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize);
90
    back.setText(R.string.back);
94
    back.setImageResource(icon);
91 95

  
92 96
    back.setOnClickListener( new View.OnClickListener()
93 97
      {
......
101 105
    layoutRight.addView(back);
102 106

  
103 107
    layoutBot.addView(layoutLeft);
108
    layoutBot.addView(layoutMid);
104 109
    layoutBot.addView(layoutRight);
105 110
    }
106 111

  
......
110 115
    {
111 116
    int padding = (int)(width*RubikActivity.PADDING);
112 117
    int margin  = (int)(width*RubikActivity.MARGIN);
113
    int widthBut= (int)(width/6);
114 118
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_back,R.drawable.ui_medium_cube_back, R.drawable.ui_big_cube_back, R.drawable.ui_huge_cube_back);
115 119

  
116
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthBut,LinearLayout.LayoutParams.MATCH_PARENT);
120
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
117 121
    params.topMargin    = margin;
118 122
    params.bottomMargin = margin;
119 123
    params.leftMargin   = margin;
src/main/java/org/distorted/states/RubikStateSolution.java
41 41
  {
42 42
  private static final int DURATION_MILLIS = 750;
43 43

  
44
  private Button mBackButton;
45
  private ImageButton mPrevButton, mNextButton;
44
  private ImageButton mPrevButton, mNextButton, mBackButton;
46 45
  private TextView mMovesText;
47 46
  private int[][] mMoves;
48 47
  private int mCurrMove, mNumMoves;
......
199 198
    params.leftMargin   = margin;
200 199
    params.rightMargin  = margin;
201 200

  
202
    mBackButton = new Button(act);
201
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
202

  
203
    mBackButton = new ImageButton(act);
203 204
    mBackButton.setLayoutParams(params);
204 205
    mBackButton.setPadding(padding,0,padding,0);
205
    mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize);
206
    mBackButton.setText(R.string.back);
206
    mBackButton.setImageResource(icon);
207 207

  
208 208
    mBackButton.setOnClickListener( new View.OnClickListener()
209 209
      {
src/main/java/org/distorted/states/RubikStateSolver.java
50 50
  {
51 51
  private static Bitmap[] mBitmap;
52 52
  private ImageButton[] mColorButton;
53
  private Button mBackButton, mSolveButton;
53
  private ImageButton mBackButton;
54
  private Button mSolveButton;
54 55
  private boolean mSolving;
55 56
  private int mCurrentColor;
56 57
  private int[] mFaceColors;
......
229 230
    params.leftMargin   = margin;
230 231
    params.rightMargin  = margin;
231 232

  
232
    mBackButton = new Button(act);
233
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
234

  
235
    mBackButton = new ImageButton(act);
233 236
    mBackButton.setLayoutParams(params);
234 237
    mBackButton.setPadding(padding,0,padding,0);
235
    mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButtonSize);
236
    mBackButton.setText(R.string.back);
238
    mBackButton.setImageResource(icon);
237 239

  
238 240
    mBackButton.setOnClickListener( new View.OnClickListener()
239 241
      {
src/main/java/org/distorted/states/RubikStateSolving.java
112 112
    layoutBot.removeAllViews();
113 113

  
114 114
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
115

  
115 116
    LinearLayout layoutLeft = new LinearLayout(act);
116 117
    layoutLeft.setLayoutParams(paramsL);
118
    LinearLayout layoutMid = new LinearLayout(act);
119
    layoutMid.setLayoutParams(paramsL);
117 120
    LinearLayout layoutRight = new LinearLayout(act);
118 121
    layoutRight.setLayoutParams(paramsL);
119 122

  
......
128 131
    params.leftMargin   = margin;
129 132
    params.rightMargin  = margin;
130 133

  
131
    Button back = new Button(act);
134
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
135

  
136
    ImageButton back = new ImageButton(act);
132 137
    back.setLayoutParams(params);
133 138
    back.setPadding(padding,0,padding,0);
134
    back.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonSize);
135
    back.setText(R.string.back);
139
    back.setImageResource(icon);
136 140

  
137 141
    back.setOnClickListener( new View.OnClickListener()
138 142
      {
......
146 150
    layoutRight.addView(back);
147 151

  
148 152
    layoutBot.addView(layoutLeft);
153
    layoutBot.addView(layoutMid);
149 154
    layoutBot.addView(layoutRight);
150 155
    }
151 156

  
......
155 160
    {
156 161
    int padding = (int)(width*RubikActivity.PADDING);
157 162
    int margin  = (int)(width*RubikActivity.MARGIN);
158
    int widthBut= (int)(width/6);
159 163
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_back,R.drawable.ui_medium_cube_back, R.drawable.ui_big_cube_back, R.drawable.ui_huge_cube_back);
160 164

  
161
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthBut,LinearLayout.LayoutParams.MATCH_PARENT);
165
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
162 166
    params.topMargin    = margin;
163 167
    params.bottomMargin = margin;
164 168
    params.leftMargin   = margin;

Also available in: Unified diff