Project

General

Profile

« Previous | Next » 

Revision b3786da4

Added by Leszek Koltunski about 1 year ago

progress with FactoryBandagedMegaminx.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
191 191
    protected void onResume() 
192 192
      {
193 193
      super.onResume();
194

  
194 195
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
195 196
      BandagedCreatorView view = findViewById(R.id.bandagedCreatorObjectView);
196 197
      view.onResume();
src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java
47 47
  private final int mOrdinal;
48 48
  private final int mDimension;
49 49
  private final int mMaxSupported;
50
  private final int mMinSupported;
50 51

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

  
53 54
  public BandagedCreatorScreen(int ordinal)
54 55
    {
55 56
    mOrdinal      = ordinal;
57
    mMinSupported = LocallyBandagedList.getMinSupported(ordinal);
56 58
    mMaxSupported = LocallyBandagedList.getMaxSupported(ordinal);
57 59
    mDimension    = LocallyBandagedList.getDimension(ordinal);
58 60
    mSpinnersReady= false;
......
120 122

  
121 123
  private String[] createSizes(String mark)
122 124
    {
123
    String[] ret = new String[mMaxSupported];
125
    int num = mMaxSupported-mMinSupported+1;
126
    String[] ret = new String[num];
124 127

  
125
    for(int i=1; i<=mMaxSupported; i++)
128
    for(int i=1; i<=num; i++)
126 129
      {
127
      ret[i-1] = mark+" : "+i;
130
      ret[i-1] = mark+" : "+(mMinSupported+i-1);
128 131
      }
129 132

  
130 133
    return ret;
......
137 140
    if( mSpinnersReady )
138 141
      {
139 142
      BandagedCreatorActivity act = mAct.get();
140
      if( act!=null ) act.changeObject(mX+1,mY+1,mZ+1);
143
      if( act!=null ) act.changeObject(mX+mMinSupported,mY+mMinSupported,mZ+mMinSupported);
141 144
      }
142 145
    }
143 146

  
......
145 148

  
146 149
  void onAttachedToWindow(final BandagedCreatorActivity act)
147 150
    {
151
    android.util.Log.e("D", "attached1");
152

  
148 153
    mAct = new WeakReference<>(act);
149 154
    mObjectView = act.findViewById(R.id.bandagedCreatorView);
150 155
    mTextSize = act.getScreenHeightInPixels()*BandagedCreatorActivity.SPINNER_TEXT_SIZE;
......
219 224
      {
220 225
      mSpinnerZ.setVisibility(View.INVISIBLE);
221 226
      }
227

  
228

  
229
    android.util.Log.e("D", "attached2");
222 230
    }
223 231

  
224 232
///////////////////////////////////////////////////////////////////////////////////////////////////
......
388 396

  
389 397
    public void restorePreferences(BandagedCreatorActivity act, SharedPreferences preferences)
390 398
      {
399
      android.util.Log.e("D", "restore1");
400

  
391 401
      String objects = preferences.getString(generateObjectKey(),"");
392 402
      addObjects(act,objects);
393 403

  
......
395 405
      mY = preferences.getInt("bandagedY"+mOrdinal, 2);
396 406
      mZ = preferences.getInt("bandagedZ"+mOrdinal, 2);
397 407

  
408
      int max = mMaxSupported-mMinSupported+1;
409

  
410
      if( mX>max ) mX = max;
411
      if( mY>max ) mY = max;
412
      if( mZ>max ) mZ = max;
413

  
398 414
      mSpinnerX.setSelection(mX);
399 415
      mSpinnerY.setSelection(mY);
400 416
      mSpinnerZ.setSelection(mZ);
401 417

  
402 418
      mSpinnersReady = true;
403 419
      changeObject();
420

  
421
      android.util.Log.e("D", "restore2");
404 422
      }
405 423
}

Also available in: Unified diff