Revision 6d896e0e
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/glow/GlowActivity.java | ||
---|---|---|
35 | 35 |
public class GlowActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
36 | 36 |
{ |
37 | 37 |
private TextView textRadius, textAlpha; |
38 |
private int mQuality; |
|
38 | 39 |
|
39 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 41 |
|
... | ... | |
47 | 48 |
textRadius = (TextView)findViewById(R.id.glowTextRadius); |
48 | 49 |
SeekBar bar = (SeekBar)findViewById(R.id.glowSeekRadius); |
49 | 50 |
bar.setOnSeekBarChangeListener(this); |
50 |
bar.setProgress(50); |
|
51 |
if( savedState==null ) bar.setProgress(50);
|
|
51 | 52 |
|
52 | 53 |
textAlpha = (TextView)findViewById(R.id.glowTextAlpha); |
53 | 54 |
bar = (SeekBar)findViewById(R.id.glowSeekAlpha); |
54 | 55 |
bar.setOnSeekBarChangeListener(this); |
55 |
bar.setProgress(50); |
|
56 |
if( savedState==null ) bar.setProgress(50); |
|
57 |
|
|
58 |
if( savedState==null ) mQuality = EffectQuality.HIGHEST.ordinal(); |
|
56 | 59 |
} |
57 | 60 |
|
58 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
85 | 88 |
super.onDestroy(); |
86 | 89 |
} |
87 | 90 |
|
91 |
|
|
92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
93 |
|
|
94 |
@Override |
|
95 |
public void onSaveInstanceState(Bundle savedInstanceState) |
|
96 |
{ |
|
97 |
super.onSaveInstanceState(savedInstanceState); |
|
98 |
savedInstanceState.putInt("quality", mQuality); |
|
99 |
} |
|
100 |
|
|
101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
102 |
|
|
103 |
@Override |
|
104 |
public void onRestoreInstanceState(Bundle savedInstanceState) |
|
105 |
{ |
|
106 |
super.onRestoreInstanceState(savedInstanceState); |
|
107 |
|
|
108 |
mQuality = savedInstanceState.getInt("quality"); |
|
109 |
|
|
110 |
switch(mQuality) |
|
111 |
{ |
|
112 |
case 0 : quality0(null); break; |
|
113 |
case 1 : quality1(null); break; |
|
114 |
case 2 : quality2(null); break; |
|
115 |
case 3 : quality3(null); break; |
|
116 |
default: android.util.Log.e("Glow", "error - unknown quality!"); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
88 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
89 | 121 |
|
90 | 122 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
... | ... | |
117 | 149 |
GlowSurfaceView view = (GlowSurfaceView) this.findViewById(R.id.glowSurfaceView); |
118 | 150 |
GlowRenderer renderer = view.getRenderer(); |
119 | 151 |
renderer.setQuality(EffectQuality.HIGHEST); |
152 |
mQuality = EffectQuality.HIGHEST.ordinal(); |
|
120 | 153 |
} |
121 | 154 |
|
122 | 155 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
126 | 159 |
GlowSurfaceView view = (GlowSurfaceView) this.findViewById(R.id.glowSurfaceView); |
127 | 160 |
GlowRenderer renderer = view.getRenderer(); |
128 | 161 |
renderer.setQuality(EffectQuality.HIGH); |
162 |
mQuality = EffectQuality.HIGH.ordinal(); |
|
129 | 163 |
} |
130 | 164 |
|
131 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
135 | 169 |
GlowSurfaceView view = (GlowSurfaceView) this.findViewById(R.id.glowSurfaceView); |
136 | 170 |
GlowRenderer renderer = view.getRenderer(); |
137 | 171 |
renderer.setQuality(EffectQuality.MEDIUM); |
172 |
mQuality = EffectQuality.MEDIUM.ordinal(); |
|
138 | 173 |
} |
139 | 174 |
|
140 | 175 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
144 | 179 |
GlowSurfaceView view = (GlowSurfaceView) this.findViewById(R.id.glowSurfaceView); |
145 | 180 |
GlowRenderer renderer = view.getRenderer(); |
146 | 181 |
renderer.setQuality(EffectQuality.LOW); |
182 |
mQuality = EffectQuality.LOW.ordinal(); |
|
147 | 183 |
} |
148 | 184 |
} |
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
public class MultiblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
36 | 36 |
{ |
37 |
private int mQuality; |
|
38 |
|
|
37 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 40 |
|
39 | 41 |
@Override |
... | ... | |
52 | 54 |
{ |
53 | 55 |
distanceBar.setProgress(50); |
54 | 56 |
rangeBar.setProgress(50); |
57 |
mQuality = EffectQuality.HIGHEST.ordinal(); |
|
55 | 58 |
} |
56 | 59 |
} |
57 | 60 |
|
... | ... | |
96 | 99 |
MultiblurRenderer renderer = view.getRenderer(); |
97 | 100 |
|
98 | 101 |
savedInstanceState.putBooleanArray("checkboxes", renderer.getChecked() ); |
102 |
savedInstanceState.putInt("quality", mQuality); |
|
99 | 103 |
} |
100 | 104 |
|
101 | 105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
117 | 121 |
renderer.setChecked(i,checkboxes[i]); |
118 | 122 |
} |
119 | 123 |
} |
124 |
|
|
125 |
mQuality = savedInstanceState.getInt("quality"); |
|
126 |
|
|
127 |
switch(mQuality) |
|
128 |
{ |
|
129 |
case 0 : quality0(null); break; |
|
130 |
case 1 : quality1(null); break; |
|
131 |
case 2 : quality2(null); break; |
|
132 |
case 3 : quality3(null); break; |
|
133 |
default: android.util.Log.e("Glow", "error - unknown quality!"); |
|
134 |
} |
|
120 | 135 |
} |
121 | 136 |
|
122 | 137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
172 | 187 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
173 | 188 |
MultiblurRenderer renderer = view.getRenderer(); |
174 | 189 |
renderer.setQuality(EffectQuality.HIGHEST); |
190 |
mQuality = EffectQuality.HIGHEST.ordinal(); |
|
175 | 191 |
} |
176 | 192 |
|
177 | 193 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
181 | 197 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
182 | 198 |
MultiblurRenderer renderer = view.getRenderer(); |
183 | 199 |
renderer.setQuality(EffectQuality.HIGH); |
200 |
mQuality = EffectQuality.HIGH.ordinal(); |
|
184 | 201 |
} |
185 | 202 |
|
186 | 203 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
190 | 207 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
191 | 208 |
MultiblurRenderer renderer = view.getRenderer(); |
192 | 209 |
renderer.setQuality(EffectQuality.MEDIUM); |
210 |
mQuality = EffectQuality.MEDIUM.ordinal(); |
|
193 | 211 |
} |
194 | 212 |
|
195 | 213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
199 | 217 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
200 | 218 |
MultiblurRenderer renderer = view.getRenderer(); |
201 | 219 |
renderer.setQuality(EffectQuality.LOW); |
220 |
mQuality = EffectQuality.LOW.ordinal(); |
|
202 | 221 |
} |
203 | 222 |
} |
Also available in: Unified diff
Improvement for MultiBlur and Glow apps.