Project

General

Profile

« Previous | Next » 

Revision 32f60dec

Added by Leszek Koltunski over 4 years ago

Downloading High Scores: make the Scores Dialog always start from appropriate tab

View differences:

src/main/java/org/distorted/magic/RubikActivity.java
45 45
    public static final int DEF_SCRAMBLE =  1;
46 46
    public static final int MAX_SCRAMBLE = 18;
47 47

  
48
    private static int mSize = RubikSize.DEFAULT_SIZE;
48
    private static int mButton = RubikSize.SIZE3.ordinal();
49 49
    private HorizontalNumberPicker mPicker;
50 50

  
51 51
///////////////////////////////////////////////////////////////////////////////////////////////////
52 52

  
53
    private void markButton(int size)
53
    private void markButton(int button)
54 54
      {
55
      mSize = size;
55
      mButton = button;
56 56

  
57 57
      for(int b=0; b<RubikSize.LENGTH; b++)
58 58
        {
59 59
        Drawable d = findViewById(b).getBackground();
60 60

  
61
        if( size == RubikSize.getSize(b).getCubeSize() )
61
        if( b==button )
62 62
          {
63 63
          d.setColorFilter(ContextCompat.getColor(this,R.color.red), PorterDuff.Mode.MULTIPLY);
64 64
          }
......
128 128

  
129 129
///////////////////////////////////////////////////////////////////////////////////////////////////
130 130

  
131
    static int getSize()
131
    static int getRedButton()
132 132
      {
133
      return mSize;
133
      return mButton;
134 134
      }
135 135

  
136 136
///////////////////////////////////////////////////////////////////////////////////////////////////
......
142 142
      setTheme(R.style.CustomActivityThemeNoActionBar);
143 143
      setContentView(R.layout.main);
144 144
      addSizeButtons();
145
      markButton(mSize);
145
      markButton(mButton);
146 146

  
147 147
      mPicker = findViewById(R.id.rubikNumberPicker);
148 148
      mPicker.setMin(MIN_SCRAMBLE);
......
199 199

  
200 200
        if( success )
201 201
          {
202
          markButton(size);
202
          markButton(id);
203 203
          }
204 204
        }
205 205
      }
......
219 219
    public void Scores(View v)
220 220
      {
221 221
      RubikScores scores = new RubikScores();
222
      Bundle bundle = new Bundle();
223
      bundle.putInt("button", mButton);
224
      scores.setArguments(bundle);
222 225
      scores.show(getSupportFragmentManager(), null);
223 226
      }
224 227

  

Also available in: Unified diff