Project

General

Profile

« Previous | Next » 

Revision 83e021c5

Added by Leszek Koltunski over 2 years ago

Bandaged 3x3 UI: progress

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
44 44
{
45 45
    private static final int ACTIVITY_NUMBER = 3;
46 46
    private static final float RATIO_BAR   = 0.10f;
47
    private static final float RATIO_SCROLL= 0.30f;
47
    static final float RATIO_SCROLL= 0.30f;
48 48

  
49 49
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
50 50
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
src/main/java/org/distorted/bandaged/BandagedCreatorObjectView.java
61 61
    int lMargin  = (int)(width*RubikActivity.LARGE_MARGIN);
62 62
    int textSize = (int)(width*RubikActivity.BUTTON_TEXT_SIZE);
63 63

  
64
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*0.35f), LinearLayout.LayoutParams.MATCH_PARENT);
64
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*0.36f), LinearLayout.LayoutParams.MATCH_PARENT);
65 65
    params.bottomMargin = lMargin;
66 66
    params.topMargin    = lMargin;
67 67
    params.leftMargin   = leftmost ? lMargin : 0;
......
72 72
    LinearLayout bottom = mPane.findViewById(R.id.bandagedCreatorObjectLayout);
73 73

  
74 74
    TransparentButton plaButton = new TransparentButton(act, R.string.play, textSize);
75
    plaButton.setSingleLine();
75 76

  
76
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_trash,R.drawable.ui_medium_trash, R.drawable.ui_big_trash, R.drawable.ui_huge_trash);
77
    final int icon = R.drawable.ui_trash;
77 78
    LinearLayout.LayoutParams paramsB = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,3.0f);
78 79
    TransparentImageButton delButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, paramsB);
79 80

  
81
    int height = act.getScreenHeightInPixels();
82
    int iconHeight = (int)(0.15f*(BandagedCreatorActivity.RATIO_SCROLL-2*RubikActivity.PADDING)*height);
83
    delButton.setIconSize(iconHeight);
84

  
80 85
    bottom.addView(plaButton);
81 86
    bottom.addView(delButton);
82 87

  
src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java
148 148
  void iconCreationDone(Activity act, Bitmap bmp)
149 149
    {
150 150
    int numChildren = mObjectView.getChildCount();
151
    LinearLayout pane = (LinearLayout)mObjectView.getChildAt(numChildren-1);
152
    ImageView view = pane.findViewById(R.id.bandagedCreatorObjectIcon);
153 151

  
154
    if( view!=null )
152
    if( numChildren>0 )
155 153
      {
156
      act.runOnUiThread(new Runnable()
154
      LinearLayout pane = (LinearLayout)mObjectView.getChildAt(numChildren-1);
155
      ImageView view = pane.findViewById(R.id.bandagedCreatorObjectIcon);
156

  
157
      if( view!=null )
157 158
        {
158
        @Override
159
        public void run()
159
        act.runOnUiThread(new Runnable()
160
          {
161
          @Override
162
          public void run()
160 163
          {
161 164
          view.setImageBitmap(bmp);
162 165
          }
163
        });
164
      }
165
    else
166
      {
167
      android.util.Log.e("D", "ImageView not found!");
166
          });
167
        }
168
      else
169
        {
170
        android.util.Log.e("D", "ImageView not found!");
171
        }
168 172
      }
169 173
    }
170 174
}

Also available in: Unified diff