Project

General

Profile

« Previous | Next » 

Revision a88b947f

Added by Leszek Koltunski over 2 years ago

IAP, part 3: non-free objects appear in the popup with a lock icon: make the lock icon's size resolution-independent

View differences:

src/main/java/org/distorted/config/ConfigScreen.java
56 56

  
57 57
    int cubeSize  = (int)(width/9);
58 58
    int margin    = (int)(width*RubikActivity.LARGE_MARGIN);
59
    int padding   = (int)(width*RubikActivity.POPUP_PADDING);
59 60
    mObjectSize   = (int)(cubeSize + 2*margin + 0.5f);
60 61
    mMaxRowCount  = (int)((height-mBarHeight)/mObjectSize);
61 62

  
62 63
    ScrollView view = (ScrollView)inflate( act, R.layout.popup_object_simple, null);
63 64
    GridLayout objectGrid = view.findViewById(R.id.objectGrid);
64 65

  
65
    PopupCreator.createObjectGrid(objectGrid,act,mRowCount,mColCount,numObjects,margin,cubeSize);
66
    PopupCreator.createObjectGrid(objectGrid,act,mRowCount,mColCount,numObjects,margin,cubeSize,padding);
66 67

  
67 68
    for(int child=0; child<numObjects; child++)
68 69
      {
src/main/java/org/distorted/helpers/PopupCreator.java
15 15
import android.view.View;
16 16
import android.widget.GridLayout;
17 17
import android.widget.ImageButton;
18
import android.widget.ImageView;
18 19

  
19 20
import org.distorted.main.R;
20 21
import org.distorted.objects.RubikObject;
......
24 25

  
25 26
public class PopupCreator
26 27
  {
27
  public static void createObjectGrid(GridLayout grid, Activity act, int rowCount, int colCount, int numObjects, int margin, int size)
28
  public static void createObjectGrid(GridLayout grid, Activity act, int rowCount, int colCount, int numObjects, int margin, int size, int pad)
28 29
    {
29 30
    GridLayout.Spec[] rowSpecs = new GridLayout.Spec[rowCount];
30 31
    GridLayout.Spec[] colSpecs = new GridLayout.Spec[colCount];
......
48 49

  
49 50
    for(int object=0; object<numObjects; object++)
50 51
      {
51
      View v = createView(act,layoutInflater,object);
52
      View v = createView(act,layoutInflater,object,pad);
52 53
      int row = object/colCount;
53 54

  
54 55
      GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
......
68 69

  
69 70
///////////////////////////////////////////////////////////////////////////////////////////////////
70 71

  
71
  private static View createView(Activity act, LayoutInflater inflater, int ordinal)
72
  private static View createView(Activity act, LayoutInflater inflater, int ordinal, int pad)
72 73
    {
73 74
    final RubikObject obj = RubikObjectList.getObject(ordinal);
74 75

  
......
85 86
        final View layout = inflater.inflate(R.layout.non_free_object, null);
86 87
        ImageButton button= layout.findViewById(R.id.non_free_button);
87 88
        obj.setIconTo(act,button);
89
        ImageView view= layout.findViewById(R.id.non_free_lock);
90
        view.setPadding(0,pad,0,0);
88 91
        return layout;
89 92
        }
90 93
      }
src/main/java/org/distorted/main/RubikActivity.java
65 65
    public static final float SMALL_MARGIN        = 0.004f;
66 66
    public static final float MEDIUM_MARGIN       = 0.015f;
67 67
    public static final float LARGE_MARGIN        = 0.025f;
68
    public static final float POPUP_PADDING       = 0.045f;
68 69
    public static final float BUTTON_TEXT_SIZE    = 0.05f;
69 70
    public static final float TITLE_TEXT_SIZE     = 0.06f;
70 71
    public static final float SOLVER_BMP_H_SIZE   = 0.11f;
src/main/java/org/distorted/screens/RubikScreenPlay.java
178 178

  
179 179
    int cubeSize = (int)(width/9);
180 180
    int margin   = (int)(width*RubikActivity.LARGE_MARGIN);
181
    int padding  = (int)(width*RubikActivity.POPUP_PADDING);
181 182
    mObjectSize  = (int)(cubeSize + 2*margin + 0.5f);
182 183
    mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize);
183 184

  
......
186 187
    RelativeLayout bottomLayout = view.findViewById(R.id.bottomLayout);
187 188
    setupBottomLayout(act,bottomLayout);
188 189

  
189
    PopupCreator.createObjectGrid(objectGrid,act,mRowCount,mColCount,numObjects,margin,cubeSize);
190
    PopupCreator.createObjectGrid(objectGrid,act,mRowCount,mColCount,numObjects,margin,cubeSize,padding);
190 191

  
191 192
    for(int child=0; child<numObjects; child++)
192 193
      {

Also available in: Unified diff