Project

General

Profile

« Previous | Next » 

Revision 183d4a34

Added by Leszek Koltunski about 3 years ago

Progress with ConfigPane.

View differences:

src/main/java/org/distorted/config/ConfigScreenPane.java
24 24
import android.widget.LinearLayout;
25 25
import android.widget.RadioButton;
26 26
import android.widget.RadioGroup;
27
import android.widget.RelativeLayout;
27 28
import android.widget.TextView;
28 29

  
29 30
import org.distorted.jsons.ObjectJson;
......
48 49
    R.id.configDifficulty4
49 50
    };
50 51

  
52
  private static final int[] CHECK =
53
    {
54
    R.drawable.diff_check0,
55
    R.drawable.diff_check1,
56
    R.drawable.diff_check2,
57
    R.drawable.diff_check3,
58
    R.drawable.diff_check4,
59
    };
60

  
61
  private static final int[] UNCHECK =
62
    {
63
    R.drawable.diff_uncheck0,
64
    R.drawable.diff_uncheck1,
65
    R.drawable.diff_uncheck2,
66
    R.drawable.diff_uncheck3,
67
    R.drawable.diff_uncheck4,
68
    };
69

  
51 70
  private static final int NUM_IMAGES = IMAGES.length;
52 71
  private static final float PADDING_RATIO = 0.015f;
53 72
  private static final float TEXT_RATIO    = 0.025f;
......
94 113
    for(int i=0; i<NUM_IMAGES; i++)
95 114
      {
96 115
      ImageView image = layout.findViewById(IMAGES[i]);
97
      image.setBackgroundResource( i==difficulty ? R.drawable.difficulty_background : 0 );
116
      image.setImageResource( i==difficulty ? CHECK[i] : UNCHECK[i] );
98 117
      }
99 118
    }
100 119

  
......
114 133
    difficultyLayout.setPadding(padding,padding/2,padding,padding/2);
115 134
    meshLayout.setPadding(padding,padding/2,padding,padding);
116 135

  
117
    LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.0f);
118
    LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.0f);
119
    LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.3f);
136
    LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.00f);
137
    LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.00f);
138
    LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.05f);
120 139

  
121 140
    detailsLayout.setLayoutParams(params1);
122 141
    difficultyLayout.setLayoutParams(params2);
src/main/res/layout/config_difficulty.xml
38 38
             android:layout_width="0dp"
39 39
             android:layout_height="match_parent"
40 40
             android:layout_weight="1"
41
             android:gravity="center"
42
             android:src="@drawable/difficulty0" />
41
             android:src="@drawable/diff_uncheck0"/>
43 42

  
44 43
        <ImageView
45 44
             android:id="@+id/configDifficulty1"
......
47 46
             android:layout_height="match_parent"
48 47
             android:layout_weight="1"
49 48
             android:gravity="center"
50
             android:src="@drawable/difficulty1" />
49
             android:src="@drawable/diff_uncheck1"/>
51 50

  
52 51
        <ImageView
53 52
             android:id="@+id/configDifficulty2"
......
55 54
             android:layout_height="match_parent"
56 55
             android:layout_weight="1"
57 56
             android:gravity="center"
58
             android:src="@drawable/difficulty2" />
57
             android:src="@drawable/diff_uncheck2"/>
59 58

  
60 59
        <ImageView
61 60
             android:id="@+id/configDifficulty3"
......
63 62
             android:layout_height="match_parent"
64 63
             android:layout_weight="1"
65 64
             android:gravity="center"
66
             android:src="@drawable/difficulty3" />
65
             android:src="@drawable/diff_uncheck3"/>
67 66

  
68 67
        <ImageView
69 68
             android:id="@+id/configDifficulty4"
......
71 70
             android:layout_height="match_parent"
72 71
             android:layout_weight="1"
73 72
             android:gravity="center"
74
             android:src="@drawable/difficulty4" />
73
             android:src="@drawable/diff_uncheck4"/>
75 74

  
76 75
    </LinearLayout>
77 76

  
src/main/res/layout/config_mesh.xml
26 26
        android:id="@+id/meshRadioGroup"
27 27
        android:layout_width="match_parent"
28 28
        android:layout_height="0dp"
29
        android:layout_weight="2"
29
        android:layout_weight="3.0"
30
        android:paddingStart="5dp"
30 31
        android:checkedButton="@+id/meshNice"
31 32
        android:background="@color/light_grey">
32 33

  

Also available in: Unified diff