Project

General

Profile

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

examples / src / main / java / org / distorted / examples / check / CheckActivity.java @ 9930cd43

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
      setContentView(R.layout.check1layout);
46
       
47
      mVPicker = findViewById(R.id.check1NumberPickerVertex);
48
      mFPicker = 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 = findViewById(R.id.checkSurfaceView);
80
      if( mView!=null ) mView.onPause();
81

    
82
      DistortedLibrary.onPause();
83
      super.onPause();
84
      }
85

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

    
113
      maxF = 1;
114
      maxV = 3;
115

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

    
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121

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

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

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

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