commit 8bebb31994db4e8a9173bf91c73d05cb1c233ba5
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Tue Jun 21 10:36:32 2016 +0100

    Effects2D should be finished.

diff --git a/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java b/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
index b9ff7bb..e75e3e3 100644
--- a/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
+++ b/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
@@ -34,6 +34,7 @@ import android.widget.Spinner;
 import android.widget.TableLayout;
 import android.widget.TableRow;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -237,35 +238,42 @@ public class Effects2DActivity extends Activity implements AdapterView.OnItemSel
 
   public void effectAdded(final long id, final EffectNames name, final EffectTypes type)
     {
-    mAdapterID.add( new Long(id) );
-    mAdapterID.notifyDataSetChanged();
+    if( id>=0 )  // we really added a new effect
+      {
+      mAdapterID.add( new Long(id) );
+      mAdapterID.notifyDataSetChanged();
 
-    TableRow tr = new TableRow(this);
-    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
+      TableRow tr = new TableRow(this);
+      tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
 
-    TextView b1 = new TextView(this);
-    b1.setText("ID: "+id);
-    b1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
-    tr.addView(b1);
+      TextView b1 = new TextView(this);
+      b1.setText("ID: "+id);
+      b1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
+      tr.addView(b1);
 
-    TextView b2 = new TextView(this);
-    b2.setText(name.name());
-    b2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
-    tr.addView(b2);
+      TextView b2 = new TextView(this);
+      b2.setText(name.name());
+      b2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
+      tr.addView(b2);
 
-    TextView b3 = new TextView(this);
-    b3.setText(type.name());
-    b3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
-    tr.addView(b3);
+      TextView b3 = new TextView(this);
+      b3.setText(type.name());
+      b3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
+      tr.addView(b3);
 
-    TextView b4 = new TextView(this);
-    b4.setText("LIVE");
-    b4.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
-    tr.addView(b4);
+      TextView b4 = new TextView(this);
+      b4.setText("LIVE");
+      b4.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
+      tr.addView(b4);
 
-    mMap.put(id,tr);
+      mMap.put(id,tr);
 
-    mLayoutList.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
+      mLayoutList.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
+      }
+    else // id=-1, i.e. we failed to add new effect due to too many effects already
+      {
+      Toast.makeText(this, R.string.example_effects2d_toast , Toast.LENGTH_LONG).show();
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 4ad0e87..9009628 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -93,4 +93,5 @@
 
     <string name="example_movingeffects_toast">Click on \'RESET\' and define your path by touching the screen. Then click on one of the effects and see it move along your path.</string>
     <string name="example_cubes_toast">Rotate the cubes by swiping the screen</string>
+    <string name="example_effects2d_toast">Failed to add new effect</string>
 </resources>
