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.save;
|
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.view.View;
|
29
|
import android.widget.SeekBar;
|
30
|
|
31
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32
|
|
33
|
public class SaveActivity extends Activity implements SeekBar.OnSeekBarChangeListener
|
34
|
{
|
35
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
36
|
|
37
|
@Override
|
38
|
protected void onCreate(Bundle icicle)
|
39
|
{
|
40
|
super.onCreate(icicle);
|
41
|
|
42
|
setContentView(R.layout.savelayout);
|
43
|
|
44
|
SeekBar barSize = (SeekBar)findViewById(R.id.saveSeekBar);
|
45
|
barSize.setOnSeekBarChangeListener(this);
|
46
|
barSize.setProgress(50);
|
47
|
}
|
48
|
|
49
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
50
|
|
51
|
@Override
|
52
|
protected void onPause()
|
53
|
{
|
54
|
SaveWorkerThread.stopSending();
|
55
|
|
56
|
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
|
57
|
view.onPause();
|
58
|
|
59
|
super.onPause();
|
60
|
}
|
61
|
|
62
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63
|
|
64
|
@Override
|
65
|
protected void onResume()
|
66
|
{
|
67
|
super.onResume();
|
68
|
|
69
|
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
|
70
|
view.onResume();
|
71
|
|
72
|
SaveWorkerThread.startSending(this);
|
73
|
}
|
74
|
|
75
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76
|
|
77
|
@Override
|
78
|
protected void onDestroy()
|
79
|
{
|
80
|
Distorted.onDestroy();
|
81
|
super.onDestroy();
|
82
|
}
|
83
|
|
84
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
85
|
|
86
|
public void Save(View v)
|
87
|
{
|
88
|
SaveSurfaceView view = (SaveSurfaceView) this.findViewById(R.id.saveSurfaceView);
|
89
|
view.getRenderer().Save();
|
90
|
}
|
91
|
|
92
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
93
|
|
94
|
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
|
95
|
{
|
96
|
float s = (progress>50 ? ((progress-50)/16.0f + 1.0f):(0.015f*progress + 0.25f));
|
97
|
SaveSurfaceView view = (SaveSurfaceView) this.findViewById(R.id.saveSurfaceView);
|
98
|
view.getRenderer().setSize(s);
|
99
|
}
|
100
|
|
101
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
102
|
|
103
|
public void onStartTrackingTouch(SeekBar bar) { }
|
104
|
|
105
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
106
|
|
107
|
public void onStopTrackingTouch(SeekBar bar) { }
|
108
|
|
109
|
}
|