Project

General

Profile

« Previous | Next » 

Revision 0c9b1ef5

Added by Leszek Koltunski 10 months ago

progress

View differences:

src/main/java/org/distorted/helpers/ObjectGridCreator.java
15 15

  
16 16
import android.app.Activity;
17 17
import android.content.Context;
18
import android.util.TypedValue;
19
import android.view.Gravity;
18 20
import android.view.LayoutInflater;
19 21
import android.view.View;
20 22
import android.view.ViewGroup;
......
35 37

  
36 38
public class ObjectGridCreator
37 39
  {
40
  private static final float TITLE_SIZE     = 0.8f;
41
  private static final float TEXT_SIZE      = 0.5f;
42
  private static final float TITLE_PADDING  = 0.15f;
43

  
38 44
  private GridLayout mGrid;
39 45
  private GridLayout[] mCategoryGrids;
40 46
  private RubikObjectCategories mROC;
......
126 132
      layout.setPadding(0,mMargin,0,mMargin);
127 133
      scrollView.addView(layout);
128 134

  
135
      int height = (int)(TITLE_SIZE*mCubeSize);
136

  
129 137
      mROC = new RubikObjectCategories(sortMode);
130
      if( mROC.hasIcons() ) constructIconBasedGrid(act,layout,mROC,mCubeSize);
131
      else                  constructIconlessGrid(act,layout,mROC,mCubeSize);
138
      if( mROC.hasIcons() ) constructIconBasedGrid(act,layout,mROC,height);
139
      else                  constructIconlessGrid(act,layout,mROC,height);
132 140
      }
133 141
    }
134 142

  
......
175 183
    ImageView view = new ImageView(act);
176 184
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height);
177 185
    view.setLayoutParams(params);
186
    view.setBackgroundResource(R.color.dark_grey);
187

  
188
    int p = (int)(TITLE_PADDING*height);
189
    view.setPadding( p,p,p,p );
178 190
    view.setImageResource(iconID);
179 191

  
180 192
    return view;
......
187 199
    TextView view = new TextView(act);
188 200
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height);
189 201
    view.setLayoutParams(params);
202
    view.setBackgroundResource(R.color.dark_grey);
203
    view.setGravity(Gravity.CENTER);
204

  
205
    int size = (int)(TEXT_SIZE*height);
206
    view.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
190 207
    view.setText(title);
191 208

  
192 209
    return view;
src/main/java/org/distorted/objects/RubikObjectCategories.java
331 331
      int obj = mObjectIndices[t][0];
332 332
      RubikObject object = RubikObjectList.getObject(obj);
333 333
      int year = object==null ? 0 : object.getYearOfInvention();
334
      mTitles[t] = String.valueOf(year);
334
      mTitles[t] = year==0 ? "Unknown" : String.valueOf(year);
335 335
      }
336 336
    }
337 337

  

Also available in: Unified diff