Project

General

Profile

« Previous | Next » 

Revision 988e3d33

Added by Leszek Koltunski about 2 months ago

Objects can support or not changing colors of their stickers.

View differences:

src/main/java/org/distorted/config/ConfigScreenPane.java
117 117
    markButton(mRow,mCol);
118 118
    }
119 119

  
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121

  
122
  private View createColorSection(final ConfigActivity act, int width, int height, boolean supports)
123
    {
124
    if( supports )
125
      {
126
      createColorGrid(act,width,height);
127
      return mGrid;
128
      }
129
    else
130
      {
131
      float textSize = height*TEXT_RATIO;
132
      TextView text = new TextView(act);
133
      text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
134
      text.setText(R.string.config_no_support);
135
      return text;
136
      }
137
    }
138

  
120 139
///////////////////////////////////////////////////////////////////////////////////////////////////
121 140

  
122 141
  private View createView(final Activity act, final int row, final int col)
......
144 163

  
145 164
  private void markButton(int row, int col)
146 165
    {
147
    int index = mRow*COLORS[0].length + mCol;
148
    ImageButton button = (ImageButton)mGrid.getChildAt(index);
149
    button.setImageResource(0);
166
    if( mGrid!=null )
167
      {
168
      int index = mRow*COLORS[0].length + mCol;
169
      ImageButton button = (ImageButton)mGrid.getChildAt(index);
170
      button.setImageResource(0);
150 171

  
151
    mRow = row;
152
    mCol = col;
172
      mRow = row;
173
      mCol = col;
153 174

  
154
    index = mRow*COLORS[0].length + mCol;
155
    button = (ImageButton)mGrid.getChildAt(index);
156
    button.setImageResource(R.drawable.check);
175
      index = mRow*COLORS[0].length + mCol;
176
      button = (ImageButton)mGrid.getChildAt(index);
177
      button.setImageResource(R.drawable.check);
178
      }
157 179
    }
158 180

  
159 181
///////////////////////////////////////////////////////////////////////////////////////////////////
......
177 199

  
178 200
///////////////////////////////////////////////////////////////////////////////////////////////////
179 201

  
180
  ConfigScreenPane(final ConfigActivity act, String key, OSInterface os)
202
  ConfigScreenPane(final ConfigActivity act, String key, OSInterface os, boolean supportsAdjColors)
181 203
    {
182 204
    mRow = 0;
183 205
    mCol = 0;
......
268 290

  
269 291
    configLayoutL.setLayoutParams(paramsLayoutL);
270 292

  
271
    createColorGrid(act, width, height);
293
    View view = createColorSection(act, width, height, supportsAdjColors);
272 294
    configLayoutL.removeAllViews();
273
    configLayoutL.addView(mGrid);
295
    configLayoutL.addView(view);
274 296
    }
275 297
}

Also available in: Unified diff