Project

General

Profile

Download (5.16 KB) Statistics
| Branch: | Revision:

examples / src / main / java / org / distorted / examples / check / CheckActivity.java @ bc0a685b

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// 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
// Distorted is distributed in the hope that it will be useful,                                  //
12
// 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
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.examples.check;
21

    
22
import org.distorted.library.Distorted;
23
import org.distorted.examples.R;
24

    
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
    private static int maxV, maxF;
38
    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40
    
41
    @Override
42
    protected void onCreate(Bundle icicle) 
43
      {
44
      super.onCreate(icicle);
45
      setContentView(R.layout.check1layout);
46
       
47
      mVPicker = (NumberPicker)findViewById(R.id.check1NumberPickerVertex);
48
      mFPicker = (NumberPicker)findViewById(R.id.check1NumberPickerFragment);
49
      
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
           {
60
           maxV = newVal;
61
           }
62
         });
63
      
64
      mFPicker.setOnValueChangedListener(new OnValueChangeListener() 
65
         {
66
         @Override
67
         public void onValueChange(NumberPicker picker, int oldVal, int newVal) 
68
           {
69
           maxF = newVal;
70
           }
71
         });
72
      }
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75
    
76
    @Override
77
    protected void onPause() 
78
      {
79
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.checkSurfaceView);
80
      if( mView!=null ) mView.onPause();
81
      
82
      super.onPause();
83
      }
84

    
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86
    
87
    @Override
88
    protected void onResume() 
89
      {
90
      super.onResume();
91
      
92
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.checkSurfaceView);
93
      if( mView!=null ) mView.onResume();    
94
      }
95
 
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97
    
98
    @Override
99
    protected void onDestroy() 
100
      {
101
      Distorted.onDestroy();  
102
      super.onDestroy();
103
      }
104
    
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
    
107
    @Override
108
    public void onWindowFocusChanged(boolean hasFocus) 
109
      {
110
      super.onWindowFocusChanged(hasFocus);
111

    
112
      maxF = 1;
113
      maxV = 2;
114

    
115
      mVPicker.setValue(2);
116
      mFPicker.setValue(1);
117
      }
118

    
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

    
121
    public static int getMaxV()
122
      {
123
      return maxV;
124
      }
125
    
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

    
128
    public static int getMaxF()
129
      {
130
      return maxF;
131
      }
132

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134
    
135
    public void Check(View v)
136
      {
137
      setContentView(R.layout.check2layout);
138
      }     
139

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141
    
142
}
(1-1/3)