1 |
bc0a685b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
71c8884f
|
Leszek Koltunski
|
// This file is part of Distorted. //
|
5 |
bc0a685b
|
Leszek Koltunski
|
// //
|
6 |
71c8884f
|
Leszek Koltunski
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
bc0a685b
|
Leszek Koltunski
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
71c8884f
|
Leszek Koltunski
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
bc0a685b
|
Leszek Koltunski
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
71c8884f
|
Leszek Koltunski
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
bc0a685b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
427ab7bf
|
Leszek Koltunski
|
|
20 |
5068fa06
|
Leszek Koltunski
|
package org.distorted.examples.check;
|
21 |
427ab7bf
|
Leszek Koltunski
|
|
22 |
e3900503
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedLibrary;
|
23 |
5068fa06
|
Leszek Koltunski
|
import org.distorted.examples.R;
|
24 |
427ab7bf
|
Leszek Koltunski
|
|
25 |
|
|
import android.app.Activity;
|
26 |
|
|
import android.opengl.GLSurfaceView;
|
27 |
|
|
import android.os.Bundle;
|
28 |
|
|
import android.widget.NumberPicker;
|
29 |
|
|
import android.widget.NumberPicker.OnValueChangeListener;
|
30 |
|
|
import android.view.View;
|
31 |
|
|
|
32 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
33 |
|
|
|
34 |
|
|
public class CheckActivity extends Activity
|
35 |
|
|
{
|
36 |
|
|
private NumberPicker mVPicker, mFPicker;
|
37 |
9b9440a0
|
Leszek Koltunski
|
private int maxV, maxF;
|
38 |
427ab7bf
|
Leszek Koltunski
|
|
39 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
|
|
@Override
|
42 |
|
|
protected void onCreate(Bundle icicle)
|
43 |
|
|
{
|
44 |
|
|
super.onCreate(icicle);
|
45 |
|
|
setContentView(R.layout.check1layout);
|
46 |
|
|
|
47 |
a4d59c0b
|
Leszek Koltunski
|
mVPicker = findViewById(R.id.check1NumberPickerVertex);
|
48 |
|
|
mFPicker = findViewById(R.id.check1NumberPickerFragment);
|
49 |
427ab7bf
|
Leszek Koltunski
|
|
50 |
|
|
mVPicker.setMaxValue(1000);
|
51 |
|
|
mVPicker.setMinValue( 0);
|
52 |
|
|
mFPicker.setMaxValue(1000);
|
53 |
|
|
mFPicker.setMinValue( 0);
|
54 |
|
|
|
55 |
|
|
mVPicker.setOnValueChangedListener(new OnValueChangeListener()
|
56 |
|
|
{
|
57 |
|
|
@Override
|
58 |
|
|
public void onValueChange(NumberPicker picker, int oldVal, int newVal)
|
59 |
9c5b5cb6
|
Leszek Koltunski
|
{
|
60 |
427ab7bf
|
Leszek Koltunski
|
maxV = newVal;
|
61 |
|
|
}
|
62 |
|
|
});
|
63 |
|
|
|
64 |
|
|
mFPicker.setOnValueChangedListener(new OnValueChangeListener()
|
65 |
|
|
{
|
66 |
|
|
@Override
|
67 |
|
|
public void onValueChange(NumberPicker picker, int oldVal, int newVal)
|
68 |
9c5b5cb6
|
Leszek Koltunski
|
{
|
69 |
427ab7bf
|
Leszek Koltunski
|
maxF = newVal;
|
70 |
|
|
}
|
71 |
|
|
});
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75 |
|
|
|
76 |
|
|
@Override
|
77 |
|
|
protected void onPause()
|
78 |
|
|
{
|
79 |
a4d59c0b
|
Leszek Koltunski
|
GLSurfaceView mView = findViewById(R.id.checkSurfaceView);
|
80 |
427ab7bf
|
Leszek Koltunski
|
if( mView!=null ) mView.onPause();
|
81 |
b0ebdf5e
|
Leszek Koltunski
|
|
82 |
e3900503
|
Leszek Koltunski
|
DistortedLibrary.onPause();
|
83 |
427ab7bf
|
Leszek Koltunski
|
super.onPause();
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
87 |
|
|
|
88 |
|
|
@Override
|
89 |
|
|
protected void onResume()
|
90 |
|
|
{
|
91 |
|
|
super.onResume();
|
92 |
|
|
|
93 |
a4d59c0b
|
Leszek Koltunski
|
GLSurfaceView mView = findViewById(R.id.checkSurfaceView);
|
94 |
427ab7bf
|
Leszek Koltunski
|
if( mView!=null ) mView.onResume();
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
98 |
|
|
|
99 |
|
|
@Override
|
100 |
|
|
protected void onDestroy()
|
101 |
|
|
{
|
102 |
e3900503
|
Leszek Koltunski
|
DistortedLibrary.onDestroy();
|
103 |
427ab7bf
|
Leszek Koltunski
|
super.onDestroy();
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107 |
|
|
|
108 |
|
|
@Override
|
109 |
|
|
public void onWindowFocusChanged(boolean hasFocus)
|
110 |
|
|
{
|
111 |
|
|
super.onWindowFocusChanged(hasFocus);
|
112 |
|
|
|
113 |
9c5b5cb6
|
Leszek Koltunski
|
maxF = 1;
|
114 |
|
|
maxV = 2;
|
115 |
|
|
|
116 |
|
|
mVPicker.setValue(2);
|
117 |
427ab7bf
|
Leszek Koltunski
|
mFPicker.setValue(1);
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
121 |
|
|
|
122 |
9b9440a0
|
Leszek Koltunski
|
public int getMaxV()
|
123 |
427ab7bf
|
Leszek Koltunski
|
{
|
124 |
|
|
return maxV;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
128 |
|
|
|
129 |
9b9440a0
|
Leszek Koltunski
|
public int getMaxF()
|
130 |
427ab7bf
|
Leszek Koltunski
|
{
|
131 |
|
|
return maxF;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
135 |
|
|
|
136 |
|
|
public void Check(View v)
|
137 |
|
|
{
|
138 |
|
|
setContentView(R.layout.check2layout);
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
142 |
|
|
|
143 |
|
|
}
|