Revision 8bebb319
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java | ||
---|---|---|
34 | 34 |
import android.widget.TableLayout; |
35 | 35 |
import android.widget.TableRow; |
36 | 36 |
import android.widget.TextView; |
37 |
import android.widget.Toast; |
|
37 | 38 |
|
38 | 39 |
import java.util.ArrayList; |
39 | 40 |
import java.util.HashMap; |
... | ... | |
237 | 238 |
|
238 | 239 |
public void effectAdded(final long id, final EffectNames name, final EffectTypes type) |
239 | 240 |
{ |
240 |
mAdapterID.add( new Long(id) ); |
|
241 |
mAdapterID.notifyDataSetChanged(); |
|
241 |
if( id>=0 ) // we really added a new effect |
|
242 |
{ |
|
243 |
mAdapterID.add( new Long(id) ); |
|
244 |
mAdapterID.notifyDataSetChanged(); |
|
242 | 245 |
|
243 |
TableRow tr = new TableRow(this); |
|
244 |
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
246 |
TableRow tr = new TableRow(this);
|
|
247 |
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
245 | 248 |
|
246 |
TextView b1 = new TextView(this); |
|
247 |
b1.setText("ID: "+id); |
|
248 |
b1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
249 |
tr.addView(b1); |
|
249 |
TextView b1 = new TextView(this);
|
|
250 |
b1.setText("ID: "+id);
|
|
251 |
b1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
252 |
tr.addView(b1);
|
|
250 | 253 |
|
251 |
TextView b2 = new TextView(this); |
|
252 |
b2.setText(name.name()); |
|
253 |
b2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
254 |
tr.addView(b2); |
|
254 |
TextView b2 = new TextView(this);
|
|
255 |
b2.setText(name.name());
|
|
256 |
b2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
257 |
tr.addView(b2);
|
|
255 | 258 |
|
256 |
TextView b3 = new TextView(this); |
|
257 |
b3.setText(type.name()); |
|
258 |
b3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
259 |
tr.addView(b3); |
|
259 |
TextView b3 = new TextView(this);
|
|
260 |
b3.setText(type.name());
|
|
261 |
b3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
262 |
tr.addView(b3);
|
|
260 | 263 |
|
261 |
TextView b4 = new TextView(this); |
|
262 |
b4.setText("LIVE"); |
|
263 |
b4.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
264 |
tr.addView(b4); |
|
264 |
TextView b4 = new TextView(this);
|
|
265 |
b4.setText("LIVE");
|
|
266 |
b4.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
|
|
267 |
tr.addView(b4);
|
|
265 | 268 |
|
266 |
mMap.put(id,tr); |
|
269 |
mMap.put(id,tr);
|
|
267 | 270 |
|
268 |
mLayoutList.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); |
|
271 |
mLayoutList.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT)); |
|
272 |
} |
|
273 |
else // id=-1, i.e. we failed to add new effect due to too many effects already |
|
274 |
{ |
|
275 |
Toast.makeText(this, R.string.example_effects2d_toast , Toast.LENGTH_LONG).show(); |
|
276 |
} |
|
269 | 277 |
} |
270 | 278 |
|
271 | 279 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Effects2D should be finished.