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/ConfigActivity.java
47 47
    private ConfigScreenPane mPane;
48 48
    private int mCurrentApiVersion;
49 49
    private int mObjectOrdinal;
50
    private boolean mSupportsAdjColors;
50 51

  
51 52
///////////////////////////////////////////////////////////////////////////////////////////////////
52 53

  
......
156 157
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
157 158
      view.onResume();
158 159
      String key ="";
160
      mSupportsAdjColors = false;
159 161

  
160 162
      if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() )
161 163
        {
162 164
        RubikObject object = RubikObjectList.getObject(mObjectOrdinal);
163 165
        changeIfDifferent(object,mObjectOrdinal,view.getObjectControl());
164
        if( object!=null ) key = object.getUpperName();
166

  
167
        if( object!=null )
168
          {
169
          key = object.getUpperName();
170
          mSupportsAdjColors = object.supportsAdjustableColors();
171
          }
165 172
        }
166 173

  
167 174
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
168
      restorePreferences(preferences);
175
      OSInterface os = view.getInterface();
176
      os.setPreferences(preferences);
177

  
178
      restorePreferences();
169 179

  
170 180
      if( mScreen==null ) mScreen = new ConfigScreen();
171 181
      mScreen.onAttachedToWindow(this,mObjectOrdinal);
172 182

  
173
      ObjectControl control = view.getObjectControl();
174
      OSInterface os = view.getInterface();
175
      TwistyObject obj = control.getObject();
176

  
177
      mPane = new ConfigScreenPane(this,key,os);
183
      mPane = new ConfigScreenPane(this,key,os,mSupportsAdjColors);
178 184
      }
179 185

  
180 186
///////////////////////////////////////////////////////////////////////////////////////////////////
181 187

  
182 188
    void repaintPuzzleFace(int cubit, int face)
183 189
      {
184
      if( mPane!=null )
190
      if( mPane!=null && mSupportsAdjColors )
185 191
        {
186 192
        int color  = mPane.getCurrentColor();
187 193
        ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
......
239 245

  
240 246
///////////////////////////////////////////////////////////////////////////////////////////////////
241 247

  
242
    private void restorePreferences(SharedPreferences preferences)
248
    private void restorePreferences()
243 249
      {
244 250
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
245
      OSInterface os = view.getInterface();
246
      os.setPreferences(preferences);
247 251
      view.getObjectControl().restoreStickers();
248 252
      }
249 253

  

Also available in: Unified diff