Project

General

Profile

« Previous | Next » 

Revision 50ac40a6

Added by Leszek Koltunski almost 8 years ago

some improvements for the way we test DistortedObjects.

View differences:

src/main/java/org/distorted/examples/cubes/CubesActivity.java
21 21

  
22 22
import org.distorted.library.Distorted;
23 23
import org.distorted.examples.R;
24
import org.distorted.library.DistortedBitmap;
25
import org.distorted.library.DistortedCubes;
26
import org.distorted.library.DistortedObject;
24 27

  
25 28
import android.app.Activity;
26 29
import android.opengl.GLSurfaceView;
27 30
import android.os.Bundle;
28 31
import android.view.Gravity;
29 32
import android.view.View;
33
import android.widget.AdapterView;
34
import android.widget.ArrayAdapter;
30 35
import android.widget.Button;
31 36
import android.widget.LinearLayout;
32 37
import android.widget.NumberPicker;
33 38
import android.widget.NumberPicker.OnValueChangeListener;
39
import android.widget.Spinner;
34 40
import android.widget.TableRow;
35 41

  
36 42
///////////////////////////////////////////////////////////////////////////////////////////////////
37 43

  
38
public class CubesActivity extends Activity implements View.OnClickListener
44
public class CubesActivity extends Activity implements View.OnClickListener, AdapterView.OnItemSelectedListener
39 45
{
40
    private static int mNumCols = 3;
41
    private static int mNumRows = 3;
42
    
43 46
    private static final int COLOR_OFF = 0xffffe81f;
44 47
    private static final int COLOR_ON  = 0xff0000ff;
45
    
48

  
49
    private int mNumCols = 3;
50
    private int mNumRows = 3;
46 51
    private NumberPicker mColsPicker, mRowsPicker;
47 52
    private LinearLayout mLay;
48
    private static boolean[] mShape;
49
    
53
    private boolean[] mShape;
54
    private DistortedObject mObject;
55
    private int mObjectType;
56

  
50 57
///////////////////////////////////////////////////////////////////////////////////////////////////
51 58
    
52 59
    @Override
......
54 61
      {
55 62
      super.onCreate(savedState);
56 63

  
57
      setContentView(R.layout.cubes1layout);
64
      setContentView(R.layout.objectpickerlayout);
58 65
      
59
      mLay = (LinearLayout)findViewById(R.id.buttongrid);
66
      mLay = (LinearLayout)findViewById(R.id.objectpicker_buttongrid);
60 67
      
61
      mColsPicker = (NumberPicker)findViewById(R.id.colsPicker);
62
      mRowsPicker = (NumberPicker)findViewById(R.id.rowsPicker);
68
      mColsPicker = (NumberPicker)findViewById(R.id.objectpicker_cols);
69
      mRowsPicker = (NumberPicker)findViewById(R.id.objectpicker_rows);
63 70
      
64 71
      mColsPicker.setMaxValue(10);
65 72
      mColsPicker.setMinValue( 0);
......
83 90
           setGrid();
84 91
           }
85 92
         });
86
      }
87 93

  
88
///////////////////////////////////////////////////////////////////////////////////////////////////
94
      mObjectType = 0;
89 95

  
90
    public static int getCols()
91
      {
92
      return mNumCols; 
93
      }
96
      Spinner typeSpinner  = (Spinner)findViewById(R.id.objectpicker_spinnerType);
97
      typeSpinner.setOnItemSelectedListener(this);
94 98

  
95
///////////////////////////////////////////////////////////////////////////////////////////////////
99
      String[] objectType = new String[] {"DistortedCubes", "DistortedBitmap"};
96 100

  
97
    public static String getShape()
98
      {
99
      String str = ""; 
100
       
101
      for(int i=0; i<mNumRows*mNumCols; i++)
102
        str += mShape[i] ? "1" : "0";
103
      
104
      //android.util.Log.d("CUBES", str);
105
      
106
      return str; 
101
      ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType);
102
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
103
      typeSpinner.setAdapter(adapter);
107 104
      }
108
    
105

  
109 106
///////////////////////////////////////////////////////////////////////////////////////////////////
110 107
    
111
    public void setGrid()
108
    private void setGrid()
112 109
      {
113 110
      mNumCols = mColsPicker.getValue();
114 111
      mNumRows = mRowsPicker.getValue();
......
153 150
        }
154 151
      }
155 152

  
153
///////////////////////////////////////////////////////////////////////////////////////////////////
154

  
155
  public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
156
    {
157
    switch(parent.getId())
158
      {
159
      case R.id.objectpicker_spinnerType: mObjectType = pos; break;
160
      }
161
    }
162

  
163
///////////////////////////////////////////////////////////////////////////////////////////////////
164

  
165
  public void onNothingSelected(AdapterView<?> parent)
166
    {
167
    }
168

  
156 169
///////////////////////////////////////////////////////////////////////////////////////////////////
157 170
    
158 171
    public void onClick(View view) 
......
209 222
 
210 223
///////////////////////////////////////////////////////////////////////////////////////////////////
211 224
    
212
    public void Continue(View v)
213
      {   
214
      setContentView(R.layout.cubes2layout);
215
      }     
225
    public void Create(View v)
226
      {
227
      if( mObjectType==1 )
228
        {
229
        mObject = new DistortedBitmap(100,100,mNumCols);
230
        }
231
      else
232
        {
233
        String str = "";
234

  
235
        for(int i=0; i<mNumRows*mNumCols; i++)
236
          str += mShape[i] ? "1" : "0";
237

  
238
        mObject = new DistortedCubes(mNumCols, str, 10);
239
        }
240

  
241
      setContentView(R.layout.cubeslayout);
242
      }
243

  
244
///////////////////////////////////////////////////////////////////////////////////////////////////
245

  
246
    public DistortedObject getObject()
247
      {
248
      return mObject;
249
      }
216 250
}
src/main/java/org/distorted/examples/cubes/CubesRenderer.java
59 59
      {
60 60
      mView = v;
61 61

  
62
      mObject = new DistortedCubes( CubesActivity.getCols(), CubesActivity.getShape(), 100);
62
      mObject = ((CubesActivity)v.getContext()).getObject();
63 63

  
64 64
      mObjWidth = mObject.getWidth();
65 65
      mObjHeight= mObject.getHeight();
src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
43 43

  
44 44
public class Effects2DActivity extends Activity implements AdapterView.OnItemSelectedListener
45 45
  {
46
  private Spinner mID, mName, mType;
47
  private static ArrayAdapter<String> mAdapterName, mAdapterType;
46
  private Spinner mAdd, mID, mName, mType;
47
  private static ArrayAdapter<String> mAdapterAdd, mAdapterName, mAdapterType;
48 48
  private static ArrayAdapter<Long> mAdapterID;
49 49

  
50 50
  private int mPosID, mPosName, mPosType;
......
65 65
    mPosName = 0;
66 66
    mPosType = 0;
67 67

  
68
    mAdd  = (Spinner)findViewById(R.id.effects2d_spinnerAdd );
68 69
    mID   = (Spinner)findViewById(R.id.effects2d_spinnerID  );
69 70
    mName = (Spinner)findViewById(R.id.effects2d_spinnerName);
70 71
    mType = (Spinner)findViewById(R.id.effects2d_spinnerType);
71 72

  
73
    mAdd.setOnItemSelectedListener(this);
72 74
    mID.setOnItemSelectedListener(this);
73 75
    mName.setOnItemSelectedListener(this);
74 76
    mType.setOnItemSelectedListener(this);
......
83 85

  
84 86
    String[] itemsType = new String[] {"VERTEX", "FRAGMENT"};
85 87

  
88
    mAdapterAdd = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, itemsName);
89
    mAdapterAdd.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
90
    mAdd.setAdapter(mAdapterAdd);
91

  
86 92
    mAdapterID = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, itemsID);
87 93
    mAdapterID.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
88 94
    mID.setAdapter(mAdapterID);
......
136 142
    Distorted.onDestroy();
137 143
    super.onDestroy();
138 144
    }     
139
 
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141
    
142
  public void Distort(View v)
143
    {
144
    Effects2DSurfaceView.setEffect(0);
145
    }     
146
    
147
///////////////////////////////////////////////////////////////////////////////////////////////////
148

  
149
  public void Sink(View v)
150
    {
151
    Effects2DSurfaceView.setEffect(1);
152
    }       
153

  
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155
    
156
  public void Transparency(View v)
157
    {
158
    Effects2DSurfaceView.setEffect(2);
159
    }     
160
    
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162

  
163
  public void Macroblock(View v)
164
    {
165
    Effects2DSurfaceView.setEffect(3);
166
    }       
167
 
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

  
170
  public void Chroma(View v)
171
    {
172
    Effects2DSurfaceView.setEffect(4);
173
    }
174 145

  
175 146
///////////////////////////////////////////////////////////////////////////////////////////////////
176 147

  
......
178 149
    {
179 150
    switch(parent.getId())
180 151
      {
152
      case R.id.effects2d_spinnerAdd : Effects2DSurfaceView.setEffect(pos); break;
181 153
      case R.id.effects2d_spinnerID  : mPosID   = pos; break;
182 154
      case R.id.effects2d_spinnerName: mPosName = pos; break;
183 155
      case R.id.effects2d_spinnerType: mPosType = pos; break;
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
103 103
        tmp = (DistortedBitmap)mCircleNode[i].getObject();
104 104
        tmp.move( new Static3D(positions[2*i], positions[2*i+1], 0) );
105 105
        tmp.rotate( mRot, axis, center );
106
        tmp.chroma( new Static1D(0.8f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2]) );
106
        tmp.chroma( new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2]) );
107 107
        }
108 108
      }
109 109

  
src/main/java/org/distorted/examples/vertex3d/Vertex3DActivity.java
24 24
import android.os.Bundle;
25 25
import android.view.Gravity;
26 26
import android.view.View;
27
import android.widget.AdapterView;
28
import android.widget.ArrayAdapter;
27 29
import android.widget.Button;
28 30
import android.widget.LinearLayout;
29 31
import android.widget.NumberPicker;
30 32
import android.widget.SeekBar;
31 33
import android.widget.SeekBar.OnSeekBarChangeListener;
34
import android.widget.Spinner;
32 35
import android.widget.TableRow;
33 36
import android.widget.TextView;
34 37

  
35 38
import org.distorted.examples.R;
36 39
import org.distorted.library.Distorted;
40
import org.distorted.library.DistortedBitmap;
41
import org.distorted.library.DistortedCubes;
42
import org.distorted.library.DistortedObject;
37 43
import org.distorted.library.EffectNames;
38 44

  
39 45
///////////////////////////////////////////////////////////////////////////////////////////////////
40 46

  
41
public class Vertex3DActivity extends Activity implements OnSeekBarChangeListener, View.OnClickListener
47
public class Vertex3DActivity extends Activity
48
                              implements OnSeekBarChangeListener,
49
                                         View.OnClickListener,
50
                                         AdapterView.OnItemSelectedListener
42 51
  {
52
  private static final int COLOR_OFF = 0xffffe81f;
53
  private static final int COLOR_ON  = 0xff0000ff;
54

  
43 55
  private boolean firstScreen;
44 56

  
45 57
  // fields needed for the first 'pick-a-shape' screen
46 58
  //
47
  private static int mNumCols = 3;
48
  private static int mNumRows = 3;
49

  
50
  private static final int COLOR_OFF = 0xffffe81f;
51
  private static final int COLOR_ON  = 0xff0000ff;
52

  
59
  private int mNumCols = 3;
60
  private int mNumRows = 3;
53 61
  private NumberPicker mColsPicker, mRowsPicker;
54 62
  private LinearLayout mLay;
55
  private static boolean[] mShape;
63
  private boolean[] mShape;
56 64

  
57 65
  // fields needed for the second 'apply vertex effects' screen
58 66
  //
......
70 78
  private float fswirlA;
71 79
  private float fcenterX, fcenterY;
72 80

  
81
  private DistortedObject mObject;
82

  
73 83
  private EffectNames[] effects = new EffectNames[4];
74
    
84
  private int mObjectType;
85

  
75 86
///////////////////////////////////////////////////////////////////////////////////////////////////
76 87
    
77 88
  @Override
......
79 90
    {
80 91
    super.onCreate(savedState);
81 92

  
82
    setContentView(R.layout.cubes1layout);
93
    setContentView(R.layout.objectpickerlayout);
83 94

  
84
    mLay = (LinearLayout)findViewById(R.id.buttongrid);
95
    mLay = (LinearLayout)findViewById(R.id.objectpicker_buttongrid);
85 96

  
86
    mColsPicker = (NumberPicker)findViewById(R.id.colsPicker);
87
    mRowsPicker = (NumberPicker)findViewById(R.id.rowsPicker);
97
    mColsPicker = (NumberPicker)findViewById(R.id.objectpicker_cols);
98
    mRowsPicker = (NumberPicker)findViewById(R.id.objectpicker_rows);
88 99

  
89 100
    mColsPicker.setMaxValue(10);
90 101
    mColsPicker.setMinValue( 0);
......
110 121
      });
111 122

  
112 123
    firstScreen = true;
113
    }
114 124

  
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116
// 'first screen' methods
125
    mObjectType = 0;
117 126

  
118
  public static int getCols()
119
    {
120
    return mNumCols;
121
    }
122

  
123
///////////////////////////////////////////////////////////////////////////////////////////////////
124

  
125
  public static String getShape()
126
    {
127
    String str = "";
127
    Spinner typeSpinner  = (Spinner)findViewById(R.id.objectpicker_spinnerType);
128
    typeSpinner.setOnItemSelectedListener(this);
128 129

  
129
    for(int i=0; i<mNumRows*mNumCols; i++)
130
      str += mShape[i] ? "1" : "0";
130
    String[] objectType = new String[] {"DistortedCubes", "DistortedBitmap"};
131 131

  
132
    //android.util.Log.d("CUBES", str);
133

  
134
    return str;
132
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType);
133
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
134
    typeSpinner.setAdapter(adapter);
135 135
    }
136 136

  
137 137
///////////////////////////////////////////////////////////////////////////////////////////////////
138 138

  
139
  public void setGrid()
139
  private void setGrid()
140 140
    {
141 141
    mNumCols = mColsPicker.getValue();
142 142
    mNumRows = mRowsPicker.getValue();
......
181 181
      }
182 182
    }
183 183

  
184
///////////////////////////////////////////////////////////////////////////////////////////////////
185

  
186
  public DistortedObject getObject()
187
    {
188
    return mObject;
189
    }
190

  
184 191
///////////////////////////////////////////////////////////////////////////////////////////////////
185 192

  
186 193
  public void onClick(View view)
......
193 200

  
194 201
///////////////////////////////////////////////////////////////////////////////////////////////////
195 202

  
196
  public void Continue(View v)
203
  public void Create(View v)
197 204
    {
198 205
    firstScreen = false;
206

  
207
    if( mObjectType==1 )
208
      {
209
      mObject = new DistortedBitmap(100,100,mNumCols);
210
      }
211
    else
212
      {
213
      String str = "";
214

  
215
      for(int i=0; i<mNumRows*mNumCols; i++)
216
        str += mShape[i] ? "1" : "0";
217

  
218
      mObject = new DistortedCubes(mNumCols, str, 10);
219
      }
220

  
199 221
    setContentView(R.layout.vertex3dlayout);
200 222
    Default(null);
201 223
    }
202 224

  
225

  
226
///////////////////////////////////////////////////////////////////////////////////////////////////
227

  
228
  public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
229
    {
230
    switch(parent.getId())
231
      {
232
      case R.id.objectpicker_spinnerType: mObjectType = pos; break;
233
      }
234
    }
235

  
236
///////////////////////////////////////////////////////////////////////////////////////////////////
237

  
238
  public void onNothingSelected(AdapterView<?> parent)
239
    {
240
    }
241

  
203 242
///////////////////////////////////////////////////////////////////////////////////////////////////
204 243
// 'second screen' methods
205 244

  
src/main/java/org/distorted/examples/vertex3d/Vertex3DRenderer.java
145 145
      {
146 146
      mView = v;
147 147

  
148
      mObject = new DistortedCubes( Vertex3DActivity.getCols(), Vertex3DActivity.getShape(), SIZE);
149
      //mObject = new DistortedBitmap( SIZE, SIZE, 3);
148
      mObject = ((Vertex3DActivity)v.getContext()).getObject();
150 149
      mCenter = new DistortedBitmap(SIZE, SIZE, 1);
151 150

  
152 151
      mObjWidth = mObject.getWidth();
src/main/res/layout/cubes1layout.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    android:gravity="fill_vertical"
6
    android:orientation="vertical" >
7

  
8
    <LinearLayout
9
        android:layout_width="match_parent"
10
        android:layout_height="wrap_content"
11
        android:gravity="center_vertical|center_horizontal" >
12

  
13
        <NumberPicker
14
            android:id="@+id/rowsPicker"
15
            android:layout_width="wrap_content"
16
            android:layout_height="match_parent"
17
            android:layout_marginRight="10dp" />
18

  
19
        <NumberPicker
20
            android:id="@+id/colsPicker"
21
            android:layout_width="wrap_content"
22
            android:layout_height="match_parent"
23
            android:paddingRight="10dp" />
24

  
25
        <Button
26
            android:id="@+id/matrix3dRowMove"
27
            android:layout_width="124dp"
28
            android:layout_height="match_parent"
29
            android:layout_weight="0.64"
30
            android:onClick="Continue"
31
            android:text="@string/continu" />
32
    </LinearLayout>
33

  
34
    <LinearLayout
35
        android:id="@+id/buttongrid"
36
        android:layout_width="match_parent"
37
        android:layout_height="match_parent"
38
        android:gravity="center"
39
        android:orientation="vertical" >
40

  
41
    </LinearLayout>
42

  
43
</LinearLayout>
src/main/res/layout/cubes2layout.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="fill_parent"
4
    android:layout_height="fill_parent"
5
    android:gravity="center_horizontal"
6
    android:orientation="vertical" >
7

  
8
    <org.distorted.examples.cubes.CubesSurfaceView
9
        android:id="@+id/cubesSurfaceView"
10
        android:layout_width="match_parent"
11
        android:layout_height="0dp"
12
        android:layout_weight="1.00" />
13

  
14
</LinearLayout>
src/main/res/layout/cubeslayout.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="fill_parent"
4
    android:layout_height="fill_parent"
5
    android:gravity="center_horizontal"
6
    android:orientation="vertical" >
7

  
8
    <org.distorted.examples.cubes.CubesSurfaceView
9
        android:id="@+id/cubesSurfaceView"
10
        android:layout_width="match_parent"
11
        android:layout_height="0dp"
12
        android:layout_weight="1.00" />
13

  
14
</LinearLayout>
src/main/res/layout/effects2dlayout.xml
25 25
        android:orientation="vertical"
26 26
        android:weightSum="1">
27 27

  
28
        <View
29
            android:layout_height="2dip"
30
            android:background="#FF0000"
31
            android:layout_width="match_parent"
32
            />
33

  
34
        <TextView
35
            android:layout_width="wrap_content"
36
            android:layout_height="wrap_content"
37
            android:text="@string/add"
38
            android:id="@+id/textView"
39
            android:layout_gravity="center_horizontal"/>
40

  
41
        <RadioGroup
42
            android:id="@+id/radioGroup1"
43
            android:layout_width="wrap_content"
44
            android:layout_height="wrap_content"
45
            android:paddingLeft="5dp"
46
            android:paddingRight="10dp"
47
            android:orientation="horizontal"
48
            android:layout_gravity="center_horizontal">
49

  
50
            <RadioButton
51
                android:id="@+id/effects2dDistort"
52
                android:layout_width="wrap_content"
53
                android:layout_height="wrap_content"
54
                android:checked="true"
55
                android:onClick="Distort"
56
                android:text="@string/distort"
57
                android:textSize="12dp"/>
58

  
59
            <RadioButton
60
                android:id="@+id/effects2dSink"
61
                android:layout_width="wrap_content"
62
                android:layout_height="wrap_content"
63
                android:onClick="Sink"
64
                android:text="@string/sink"
65
                android:textSize="12dp"/>
66

  
67
            <RadioButton
68
                android:id="@+id/effects2dTransparency"
69
                android:layout_width="wrap_content"
70
                android:layout_height="wrap_content"
71
                android:onClick="Transparency"
72
                android:text="@string/transparency"
73
                android:textSize="12dp"/>
74

  
75
            <RadioButton
76
                android:id="@+id/effects2dMacroblock"
77
                android:layout_width="wrap_content"
78
                android:layout_height="wrap_content"
79
                android:onClick="Macroblock"
80
                android:text="@string/macroblock"
81
                android:textSize="12dp"/>
82

  
83
            <RadioButton
84
                android:id="@+id/effects2dBrightness"
85
                android:layout_width="wrap_content"
86
                android:layout_height="wrap_content"
87
                android:onClick="Chroma"
88
                android:text="@string/chroma"
89
                android:textSize="12dp"/>
90

  
91
        </RadioGroup>
92

  
93
        <View
94
            android:layout_height="2dip"
95
            android:background="#FF0000"
96
            android:layout_width="match_parent"/>
97

  
98 28
        <TableLayout
99 29
            android:layout_width="fill_parent"
100 30
            android:layout_height="wrap_content"
......
104 34
            android:paddingLeft="10dp"
105 35
            android:paddingRight="10dp">
106 36

  
37
            <TableRow
38
                android:layout_width="match_parent"
39
                android:layout_height="match_parent">
40

  
41
                <TextView
42
                    android:layout_width="wrap_content"
43
                    android:layout_height="wrap_content"
44
                    android:text="@string/add"
45
                    android:id="@+id/textView"
46
                    android:layout_gravity="center_vertical"
47
                    android:layout_span="2"
48
                    android:layout_marginLeft="8dp"/>
49

  
50
                <Spinner
51
                    android:layout_width="fill_parent"
52
                    android:layout_height="40dp"
53
                    android:id="@+id/effects2d_spinnerAdd"
54
                    />
55
            </TableRow>
56

  
107 57
            <TableRow
108 58
                android:layout_width="wrap_content"
109 59
                android:layout_height="wrap_content"
......
183 133
        </TableLayout>
184 134
        <View
185 135
            android:layout_height="2dip"
186
            android:background="#FF0000"
136
            android:background="#333333"
187 137
            android:layout_width="match_parent"
188 138
            />
189 139

  
src/main/res/layout/matrix3dmove.xml
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2

  
3 3
            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4
                android:id="@id/matrix3dRowMove"
4
                android:id="@+id/matrix3dRowMov"
5 5
                android:layout_width="match_parent"
6 6
                android:layout_height="wrap_content"
7 7
                android:orientation="horizontal" >
src/main/res/layout/objectpickerlayout.xml
1
<?xml version="1.0" encoding="utf-8"?>
2

  
3
   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4
    android:orientation="vertical"
5
    android:layout_width="match_parent"
6
    android:layout_height="match_parent">
7

  
8
       <TableLayout
9
        android:layout_width="match_parent"
10
        android:layout_height="wrap_content"
11
        android:stretchColumns="1,2,3"
12
        android:shrinkColumns="1,2,3">
13

  
14
        <TableRow
15
            android:layout_width="match_parent"
16
            android:layout_height="match_parent">
17

  
18
            <TextView
19
                android:layout_width="wrap_content"
20
                android:layout_height="wrap_content"
21
                android:textAppearance="?android:attr/textAppearanceMedium"
22
                android:text="@string/Create"
23
                android:id="@+id/textView2"
24
                android:layout_gravity="center_vertical"
25
                android:layout_marginLeft="10dp"/>
26

  
27
            <Spinner
28
                android:layout_width="fill_parent"
29
                android:layout_height="50dp"
30
                android:id="@+id/objectpicker_spinnerType"
31
                android:layout_span="3"/>
32
        </TableRow>
33

  
34
        <TableRow
35
            android:layout_width="match_parent"
36
            android:layout_height="match_parent">
37

  
38
            <TextView
39
                android:layout_width="wrap_content"
40
                android:layout_height="wrap_content"
41
                android:textAppearance="?android:attr/textAppearanceMedium"
42
                android:text="@string/rows"
43
                android:id="@+id/textView8"
44
                android:layout_gravity="center_vertical"
45
                android:layout_marginLeft="10dp"/>
46

  
47
            <NumberPicker
48
                android:id="@+id/objectpicker_rows"
49
                android:layout_width="wrap_content"
50
                android:layout_height="wrap_content"
51
                android:orientation="vertical"
52
                android:layout_span="1"
53
                />
54

  
55
            <TextView
56
                android:layout_width="wrap_content"
57
                android:layout_height="wrap_content"
58
                android:textAppearance="?android:attr/textAppearanceMedium"
59
                android:text="@string/cols"
60
                android:id="@+id/textView9"
61
                android:layout_marginLeft="10dp"
62
                android:layout_gravity="center_vertical"/>
63

  
64
            <NumberPicker
65
                android:id="@+id/objectpicker_cols"
66
                android:layout_width="wrap_content"
67
                android:layout_height="wrap_content"
68
                android:orientation="vertical"
69
                />
70
        </TableRow>
71

  
72
       </TableLayout>
73

  
74
    <LinearLayout
75
        android:id="@+id/objectpicker_buttongrid"
76
        android:layout_width="match_parent"
77
        android:layout_height="0dp"
78
        android:gravity="center"
79
        android:orientation="vertical"
80
        android:layout_weight="0.8">
81
    </LinearLayout>
82

  
83
    <Button
84
        android:id="@+id/objectpicker_create"
85
        android:onClick="Create"
86
        android:text="@string/Create"
87
        android:layout_width="match_parent"
88
        android:layout_height="50dp"
89
        android:layout_span="4"
90
        android:layout_marginTop="5dp"/>
91

  
92
</LinearLayout>
src/main/res/values/strings.xml
45 45
    <string name="Up">Up</string>
46 46
    <string name="Default">Default</string>
47 47
    <string name="save">Save</string>
48
    <string name="Create">Create</string>
48 49

  
49 50
    <string name="example_monalisa">Mona Lisa</string>  
50 51
    <string name="example_monalisa_subtitle">The basics of Distortions.</string>

Also available in: Unified diff