Revision 3e673c74
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
20 | 20 |
package org.distorted.examples.multiblur; |
21 | 21 |
|
22 | 22 |
import android.app.Activity; |
23 |
import android.opengl.GLSurfaceView; |
|
23 | 24 |
import android.os.Bundle; |
25 |
import android.widget.SeekBar; |
|
26 |
|
|
27 |
import org.distorted.examples.R; |
|
24 | 28 |
import org.distorted.library.Distorted; |
25 | 29 |
|
26 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 | 31 |
|
28 |
public class MultiblurActivity extends Activity |
|
32 |
public class MultiblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener
|
|
29 | 33 |
{ |
30 |
private MultiblurSurfaceView mView; |
|
31 |
|
|
32 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
33 | 35 |
|
34 | 36 |
@Override |
35 | 37 |
protected void onCreate(Bundle savedState) |
36 | 38 |
{ |
37 | 39 |
super.onCreate(savedState); |
38 |
mView = new MultiblurSurfaceView(this); |
|
39 |
setContentView(mView); |
|
40 |
setContentView(R.layout.multiblurlayout); |
|
41 |
|
|
42 |
SeekBar bar = (SeekBar)findViewById(R.id.multiblurSeek); |
|
43 |
bar.setOnSeekBarChangeListener(this); |
|
44 |
bar.setProgress(50); |
|
40 | 45 |
} |
41 | 46 |
|
42 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
44 | 49 |
@Override |
45 | 50 |
protected void onPause() |
46 | 51 |
{ |
47 |
mView.onPause(); |
|
52 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
53 |
view.onPause(); |
|
48 | 54 |
super.onPause(); |
49 | 55 |
} |
50 | 56 |
|
... | ... | |
54 | 60 |
protected void onResume() |
55 | 61 |
{ |
56 | 62 |
super.onResume(); |
57 |
mView.onResume(); |
|
63 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
64 |
view.onResume(); |
|
58 | 65 |
} |
59 | 66 |
|
60 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
65 | 72 |
Distorted.onDestroy(); |
66 | 73 |
super.onDestroy(); |
67 | 74 |
} |
75 |
|
|
76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
77 |
|
|
78 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
|
79 |
{ |
|
80 |
switch (bar.getId()) |
|
81 |
{ |
|
82 |
case R.id.multiblurSeek: MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
83 |
view.getRenderer().setDistance(progress); |
|
84 |
break; |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
89 |
|
|
90 |
public void onStartTrackingTouch(SeekBar bar) { } |
|
91 |
|
|
92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
93 |
|
|
94 |
public void onStopTrackingTouch(SeekBar bar) { } |
|
95 |
|
|
96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
68 | 97 |
} |
Also available in: Unified diff
Enrich the Multiblur app.