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.blur;
|
21
|
|
22
|
import android.app.Activity;
|
23
|
import android.opengl.GLSurfaceView;
|
24
|
import android.os.Bundle;
|
25
|
import android.widget.SeekBar;
|
26
|
import android.widget.SeekBar.OnSeekBarChangeListener;
|
27
|
import android.widget.TextView;
|
28
|
|
29
|
import org.distorted.examples.R;
|
30
|
import org.distorted.library.main.DistortedLibrary;
|
31
|
|
32
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
33
|
|
34
|
public class BlurActivity extends Activity implements OnSeekBarChangeListener
|
35
|
{
|
36
|
private TextView textBlur, textHalo, textMove;
|
37
|
|
38
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39
|
|
40
|
@Override
|
41
|
protected void onCreate(Bundle icicle)
|
42
|
{
|
43
|
super.onCreate(icicle);
|
44
|
setContentView(R.layout.blurlayout);
|
45
|
|
46
|
textBlur = findViewById(R.id.blurText);
|
47
|
textHalo = findViewById(R.id.haloText);
|
48
|
textMove = findViewById(R.id.moveText);
|
49
|
|
50
|
SeekBar barB = findViewById(R.id.blurSeek);
|
51
|
barB.setOnSeekBarChangeListener(this);
|
52
|
barB.setProgress(50);
|
53
|
|
54
|
SeekBar barH = findViewById(R.id.haloSeek);
|
55
|
barH.setOnSeekBarChangeListener(this);
|
56
|
barH.setProgress(50);
|
57
|
|
58
|
SeekBar barM = findViewById(R.id.moveSeek);
|
59
|
barM.setOnSeekBarChangeListener(this);
|
60
|
barM.setProgress(50);
|
61
|
}
|
62
|
|
63
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64
|
|
65
|
@Override
|
66
|
protected void onPause()
|
67
|
{
|
68
|
super.onPause();
|
69
|
GLSurfaceView view = findViewById(R.id.blurSurfaceView);
|
70
|
view.onPause();
|
71
|
DistortedLibrary.onPause();
|
72
|
}
|
73
|
|
74
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75
|
|
76
|
@Override
|
77
|
protected void onResume()
|
78
|
{
|
79
|
super.onResume();
|
80
|
GLSurfaceView view = findViewById(R.id.blurSurfaceView);
|
81
|
view.onResume();
|
82
|
}
|
83
|
|
84
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
85
|
|
86
|
@Override
|
87
|
protected void onDestroy()
|
88
|
{
|
89
|
DistortedLibrary.onDestroy();
|
90
|
super.onDestroy();
|
91
|
}
|
92
|
|
93
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
94
|
|
95
|
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
|
96
|
{
|
97
|
BlurSurfaceView view = findViewById(R.id.blurSurfaceView);
|
98
|
|
99
|
switch( bar.getId() )
|
100
|
{
|
101
|
case R.id.blurSeek: int l1 = view.getRenderer().setBlur(progress);
|
102
|
textBlur.setText(getString(R.string.blur_placeholder,l1));
|
103
|
break;
|
104
|
case R.id.haloSeek: int l2 = view.getRenderer().setHalo(progress);
|
105
|
textHalo.setText(getString(R.string.halo_placeholder,l2));
|
106
|
break;
|
107
|
case R.id.moveSeek: int l3 = view.getRenderer().setMove(progress);
|
108
|
textMove.setText(getString(R.string.move_placeholder,l3));
|
109
|
break;
|
110
|
}
|
111
|
}
|
112
|
|
113
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114
|
|
115
|
public void onStartTrackingTouch(SeekBar bar) { }
|
116
|
|
117
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
118
|
|
119
|
public void onStopTrackingTouch(SeekBar bar) { }
|
120
|
|
121
|
}
|