Project

General

Profile

« Previous | Next » 

Revision 8375250f

Added by Leszek Koltunski almost 2 years ago

difficulty icons.

View differences:

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

  
12 12
import java.io.InputStream;
13 13

  
14
import android.graphics.PorterDuff;
14 15
import android.util.TypedValue;
15 16
import android.widget.ImageView;
16 17
import android.widget.LinearLayout;
......
30 31

  
31 32
public class ConfigScreenPane
32 33
{
33
  private static final int[] IMAGES =
34
  private static final int[] IDS =
34 35
    {
35 36
    R.id.configDifficulty0,
36 37
    R.id.configDifficulty1,
......
39 40
    R.id.configDifficulty4
40 41
    };
41 42

  
42
  private static final int NUM_IMAGES = IMAGES.length;
43
  private static final int[] IMAGES =
44
    {
45
    R.drawable.difficulty1,
46
    R.drawable.difficulty2,
47
    R.drawable.difficulty3,
48
    R.drawable.difficulty4,
49
    R.drawable.difficulty5,
50
    };
51

  
52
  private static final int NUM_IDS         = IDS.length;
43 53
  public  static final float PADDING_RATIO = 0.025f;
44 54
  private static final float TEXT_RATIO    = 0.042f;
45 55
  private static final float RADIO_RATIO   = 0.900f;
......
95 105
      view = layout.findViewById(R.id.configDetailsAuthor2);
96 106
      view.setText(both);
97 107

  
98
      if( difficulty<0          ) difficulty=0;
99
      if( difficulty>NUM_IMAGES ) difficulty=NUM_IMAGES;
108
      if( difficulty<0       ) difficulty=0;
109
      if( difficulty>NUM_IDS ) difficulty=NUM_IDS;
100 110

  
101
      for(int i=0; i<NUM_IMAGES; i++)
111
      for(int i=0; i<NUM_IDS; i++)
102 112
        {
103
        ImageView image = layout.findViewById(IMAGES[i]);
104
        image.setImageResource( i==difficulty ? R.drawable.ui_difficulty_checked : R.drawable.ui_difficulty_unchecked );
113
        ImageView image = layout.findViewById(IDS[i]);
114
        image.setImageResource(IMAGES[i]);
115
        image.setColorFilter( difficulty==i ? 0xffff0000 : 0xffffffff, PorterDuff.Mode.MULTIPLY );
105 116
        }
106 117

  
107 118
      int meshState = object.getMeshState();

Also available in: Unified diff