Project

General

Profile

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

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

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.main.DistortedLibrary;
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 int maxV, maxF;
38
    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40
    
41
    @Override
42
    protected void onCreate(Bundle icicle) 
43
      {
44
      super.onCreate(icicle);
45
      DistortedLibrary.onCreate();
46
      setContentView(R.layout.check1layout);
47
       
48
      mVPicker = findViewById(R.id.check1NumberPickerVertex);
49
      mFPicker = findViewById(R.id.check1NumberPickerFragment);
50
      
51
      mVPicker.setMaxValue(1000);
52
      mVPicker.setMinValue(   0);
53
      mFPicker.setMaxValue(1000);
54
      mFPicker.setMinValue(   0);
55
     
56
      mVPicker.setOnValueChangedListener(new OnValueChangeListener() 
57
         {
58
         @Override
59
         public void onValueChange(NumberPicker picker, int oldVal, int newVal) 
60
           {
61
           maxV = newVal;
62
           }
63
         });
64
      
65
      mFPicker.setOnValueChangedListener(new OnValueChangeListener() 
66
         {
67
         @Override
68
         public void onValueChange(NumberPicker picker, int oldVal, int newVal) 
69
           {
70
           maxF = newVal;
71
           }
72
         });
73
      }
74

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

    
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87
    
88
    @Override
89
    protected void onResume() 
90
      {
91
      super.onResume();
92
      GLSurfaceView view = findViewById(R.id.checkSurfaceView);
93
      if( view!=null ) view.onResume();
94
      }
95
 
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97
    
98
    @Override
99
    protected void onDestroy() 
100
      {
101
      DistortedLibrary.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 = 3;
114

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

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

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

    
128
    public 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)