Project

General

Profile

« Previous | Next » 

Revision f12e4de9

Added by Leszek Koltunski over 2 years ago

Progress with Config UI.

View differences:

src/main/java/org/distorted/config/ConfigScreenPane.java
34 34

  
35 35
import java.io.InputStream;
36 36

  
37
import static android.view.View.inflate;
38

  
39 37
///////////////////////////////////////////////////////////////////////////////////////////////////
40 38

  
41 39
public class ConfigScreenPane
42 40
{
41
  public static final int MESH_NICE = 0;
42
  public static final int MESH_FAST = 1;
43

  
43 44
  private static final int[] IMAGES =
44 45
    {
45 46
    R.id.configDifficulty0,
......
56 57

  
57 58
  private JsonReader mReader;
58 59
  private int mObjectOrdinal;
60
  private boolean mProgramatic;
59 61

  
60 62
///////////////////////////////////////////////////////////////////////////////////////////////////
61 63

  
62
  private void switchMesh(ConfigActivity act, boolean simple)
64
  private void switchMeshState(ConfigActivity act, int meshState)
63 65
    {
66
    RubikObjectList.setMeshState(mObjectOrdinal,meshState);
64 67

  
68
    // TODO: rebuild the mesh
65 69
    }
66 70

  
67 71
///////////////////////////////////////////////////////////////////////////////////////////////////
......
98 102
      ImageView image = layout.findViewById(IMAGES[i]);
99 103
      image.setImageResource( i==difficulty ? R.drawable.ui_difficulty_checked : R.drawable.ui_difficulty_unchecked );
100 104
      }
105

  
106
    int meshState = object.getMeshState();
107
    int id = meshState==MESH_NICE ? R.id.meshNice : R.id.meshSimple;
108
    RadioButton button = act.findViewById(id);
109

  
110
    mProgramatic = true;
111
    button.setChecked(true);
112
    mProgramatic = false;
101 113
    }
102 114

  
103 115
///////////////////////////////////////////////////////////////////////////////////////////////////
......
159 171
      @Override
160 172
      public void onCheckedChanged(RadioGroup group, int checkedId)
161 173
        {
162
        switchMesh( act, checkedId != R.id.meshNice );
174
        if( !mProgramatic )
175
          {
176
          int meshState = checkedId == R.id.meshNice ? MESH_NICE : MESH_FAST;
177
          switchMeshState( act, meshState );
178
          }
163 179
        }
164 180
      });
165 181

  

Also available in: Unified diff