commit 7e9be46da27241ae4a6ba56393860cb4a0ce439f
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Wed Jul 6 13:07:05 2016 +0100

    Improve Fragment3D app some more!

diff --git a/src/main/java/org/distorted/examples/fragment3d/Fragment3DActivity.java b/src/main/java/org/distorted/examples/fragment3d/Fragment3DActivity.java
index 9338c06..b906d2f 100644
--- a/src/main/java/org/distorted/examples/fragment3d/Fragment3DActivity.java
+++ b/src/main/java/org/distorted/examples/fragment3d/Fragment3DActivity.java
@@ -41,6 +41,11 @@ import org.distorted.library.DistortedBitmap;
 import org.distorted.library.DistortedCubes;
 import org.distorted.library.DistortedObject;
 import org.distorted.library.EffectNames;
+import org.distorted.library.EffectTypes;
+import org.distorted.library.type.Dynamic1D;
+import org.distorted.library.type.Dynamic3D;
+
+import java.util.ArrayList;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -67,20 +72,10 @@ public class Fragment3DActivity extends Activity
 
   // fields needed for the second 'apply fragment effects' screen
   //
-  private SeekBar bar;
-  private TextView textChroma, textAlpha, textBrightness, textSaturation, textCenter;
-  private int chromaL, chromaR, chromaG, chromaB;
-  private int alphaL;
-  private int brightnessL;
-  private int saturationL;
+  private TextView textCenter;
   private int centerX, centerY;
-
-  private float fchromaL, fchromaR, fchromaG, fchromaB;
-  private float falphaL;
-  private float fbrightnessL;
-  private float fsaturationL;
   private float fcenterX, fcenterY;
-  private EffectNames[] effects = new EffectNames[4];
+  private ArrayList<Fragment3DEffect> mEffects;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
@@ -89,6 +84,8 @@ public class Fragment3DActivity extends Activity
     {
     super.onCreate(savedState);
 
+    mEffects = new ArrayList<>();
+
     setContentView(R.layout.objectpickerlayout);
 
     mColsPicker = (NumberPicker)findViewById(R.id.objectpicker_cols);
@@ -195,31 +192,31 @@ public class Fragment3DActivity extends Activity
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void onClick(View view)
+  public int getBitmap()
     {
-    Button tmp = (Button)view;
-    int id = tmp.getId();
-    mShape[id] = !mShape[id];
-    tmp.setBackgroundColor(mShape[id] ? COLOR_ON:COLOR_OFF);
+    return mBitmap;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public int getBitmap()
+  public void onClick(View view)
     {
-    return mBitmap;
+    Button tmp = (Button)view;
+    int id = tmp.getId();
+    mShape[id] = !mShape[id];
+    tmp.setBackgroundColor(mShape[id] ? COLOR_ON:COLOR_OFF);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void Continue(View v)
     {
+    firstScreen = false;
+
     if( mObjectType==1 )
       {
-      firstScreen = false;
       mObject = new DistortedBitmap(100,100,mNumCols);
-      setContentView(R.layout.fragment3dlayout);
-      Default(null);
+      setFragmentView();
       }
     else
       {
@@ -249,8 +246,7 @@ public class Fragment3DActivity extends Activity
 
     mObject = new DistortedCubes(mNumCols, str, 10);
 
-    setContentView(R.layout.fragment3dlayout);
-    Default(null);
+    setFragmentView();
     }
 
 
@@ -281,236 +277,103 @@ public class Fragment3DActivity extends Activity
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // 'second screen' methods
 
-  public void Default(View view)
+  private void setFragmentView()
     {
-    effects[0] = EffectNames.CHROMA;
-    effects[1] = EffectNames.ALPHA;
-    effects[2] = EffectNames.BRIGHTNESS;
-    effects[3] = EffectNames.SATURATION;
-    
-    chromaL = 0;
-    chromaR = 0;
-    chromaG = 0;
-    chromaB = 0;
+    final View view = getLayoutInflater().inflate(R.layout.fragment3dlayout, null);
 
-    alphaL     = 0;
-    brightnessL= 0;
-    saturationL= 0;
+    setContentView(view);
 
     centerX = 50;
     centerY = 50;
 
-    textCenter = (TextView)findViewById(R.id.fragment3dcenterText);
+    textCenter = (TextView)view.findViewById(R.id.fragment3dcenterText);
     computeCenter();
     setCenterText();
 
-    setBar(R.id.fragment3dcenterX, centerX);
-    setBar(R.id.fragment3dcenterY, centerY);
-
-    addViews();
-    }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  private void addViews()
-    {
-    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
-    
-    layout.removeAllViews();
-      
-    View chroma    = getLayoutInflater().inflate(R.layout.fragment3dchroma    , null);
-    View alpha     = getLayoutInflater().inflate(R.layout.fragment3dalpha     , null);
-    View brightness= getLayoutInflater().inflate(R.layout.fragment3dbrightness, null);
-    View saturation= getLayoutInflater().inflate(R.layout.fragment3dsaturation, null);
-     
-    for( int i=effects.length-1 ; i>=0 ; i-- )
-      {
-      switch(effects[i])
-        {
-        case CHROMA     : layout.addView(chroma    , 0); break;
-        case ALPHA      : layout.addView(alpha     , 0); break;
-        case BRIGHTNESS : layout.addView(brightness, 0); break;
-        case SATURATION : layout.addView(saturation, 0); break;
-        }
-      }
-      
-    textChroma    = (TextView)findViewById(R.id.fragment3dchromaText);
-    textAlpha     = (TextView)findViewById(R.id.fragment3dalphaText);
-    textBrightness= (TextView)findViewById(R.id.fragment3dbrightnessText);
-    textSaturation= (TextView)findViewById(R.id.fragment3dsaturationText);
-     
-    setChromaText();
-    setAlphaText();
-    setBrightnessText();
-    setSaturationText();
-      
-    setBar(R.id.fragment3dchromaBar1, chromaL);
-    setBar(R.id.fragment3dchromaBar2, chromaR);
-    setBar(R.id.fragment3dchromaBar3, chromaG);
-    setBar(R.id.fragment3dchromaBar4, chromaB);
-
-    setBar(R.id.fragment3dalphaBar1     , alphaL);
-    setBar(R.id.fragment3dbrightnessBar1, brightnessL);
-    setBar(R.id.fragment3dsaturationBar1, saturationL);
-
-    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
-    view.getRenderer().setOrder(effects);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void moveUp(EffectNames name)
-    {
-    int len = effects.length-1;
-    int index = -1;
+    SeekBar bar;
 
-    for(int i=0; i<=len; i++)
-      {
-      if( effects[i]==name )
-        {
-        index=i;
-        break;
-        }
-      }
-
-    if( index==0 )
-      {
-      for(int i=0; i<len; i++)
-        effects[i] = effects[i+1];
-
-      effects[len] = name;
-      }
-    else if( index>0 )
-      {
-      effects[index]   = effects[index-1];
-      effects[index-1] = name;
-      }
-
-    addViews();
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    bar = (SeekBar)view.findViewById(R.id.fragment3dcenterX);
+    bar.setOnSeekBarChangeListener(this);
+    bar.setProgress(centerX);
 
-  public void ButtonChroma(View v)
-    {
-    moveUp(EffectNames.CHROMA);
+    bar = (SeekBar)view.findViewById(R.id.fragment3dcenterY);
+    bar.setOnSeekBarChangeListener(this);
+    bar.setProgress(centerY);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void ButtonAlpha(View v)
+  public void newChroma(View v)
     {
-    moveUp(EffectNames.ALPHA);
-    }
+    Fragment3DEffect chroma = new Fragment3DEffect(EffectNames.CHROMA);
+    mEffects.add(chroma);
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void ButtonBrightness(View v)
-    {
-    moveUp(EffectNames.BRIGHTNESS);
-    }
+    View view = chroma.createView(this);
+    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
+    layout.addView(view,0);
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    Dynamic1D dyn1 = chroma.getDyn1();
+    Dynamic3D dyn3 = chroma.getDyn3();
 
-  public void ButtonSaturation(View v)
-    {
-    moveUp(EffectNames.SATURATION);
+    mObject.chroma(dyn1,dyn3);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setBar(int id, int value)
+  public void newAlpha(View v)
     {
-    bar = (SeekBar)findViewById(id);
-    bar.setOnSeekBarChangeListener(this);
-    bar.setProgress(value);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+    Fragment3DEffect alpha = new Fragment3DEffect(EffectNames.ALPHA);
+    mEffects.add(alpha);
 
-  private void computeChroma()
-    {
-    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
-    Fragment3DRenderer renderer = view.getRenderer();
+    View view = alpha.createView(this);
+    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
+    layout.addView(view,0);
 
-    fchromaL = chromaL/100.0f;
-    fchromaR = chromaR*255/100.0f;
-    fchromaG = chromaG*255/100.0f;
-    fchromaB = chromaB*255/100.0f;
+    Dynamic1D dyn1 = alpha.getDyn1();
 
-    renderer.setChroma( fchromaL, fchromaR, fchromaG, fchromaB );
+    mObject.alpha(dyn1);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setChromaText()
+  public void newBrightness(View v)
     {
-    fchromaL = ((int)(100*fchromaL))/100.0f;
-    fchromaR = (float)((int)fchromaR);
-    fchromaG = (float)((int)fchromaG);
-    fchromaB = (float)((int)fchromaB);
+    Fragment3DEffect brightness = new Fragment3DEffect(EffectNames.BRIGHTNESS);
+    mEffects.add(brightness);
 
-    textChroma.setText("chroma("+fchromaL+"( "+fchromaR+" , "+fchromaG+" , "+fchromaB+" )");
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void computeAlpha()
-    {
-    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
+    View view = brightness.createView(this);
+    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
+    layout.addView(view,0);
 
-    falphaL = alphaL/100.0f;
+    Dynamic1D dyn1 = brightness.getDyn1();
 
-    view.getRenderer().setAlpha(falphaL);
+    mObject.brightness(dyn1);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setAlphaText()
+  public void newSaturation(View v)
     {
-    falphaL = ((int)(100*falphaL))/100.0f;
-
-    textAlpha.setText("alpha("+falphaL+")");
-    }
+    Fragment3DEffect saturation = new Fragment3DEffect(EffectNames.SATURATION);
+    mEffects.add(saturation);
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void computeBrightness()
-    {
-    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
+    View view = saturation.createView(this);
+    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
+    layout.addView(view,0);
 
-    fbrightnessL = brightnessL/100.0f;
+    Dynamic1D dyn1 = saturation.getDyn1();
 
-    view.getRenderer().setBrightness( fbrightnessL );
+    mObject.saturation(dyn1);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private void setBrightnessText()
+  public void removeAll(View v)
     {
-    fbrightnessL = ((int)(100*fbrightnessL))/100.0f;
-
-    textBrightness.setText("brightness("+fbrightnessL+")");
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void computeSaturation()
-    {
-    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
-
-    fsaturationL = saturationL/100.0f;
-
-    view.getRenderer().setSaturation( fsaturationL );
-    }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void setSaturationText()
-    {
-    fsaturationL = ((int)(100*fsaturationL))/100.0f;
-
-    textSaturation.setText("saturation("+fsaturationL+")");
+    mEffects.clear();
+    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
+    layout.removeAllViews();
+    mObject.abortEffects(EffectTypes.FRAGMENT);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -599,15 +462,8 @@ public class Fragment3DActivity extends Activity
     {
     switch (bar.getId())
       {
-      case R.id.fragment3dcenterX       : centerX    = progress; computeCenter()    ; setCenterText()    ; break;
-      case R.id.fragment3dcenterY       : centerY    = progress; computeCenter()    ; setCenterText()    ; break;
-      case R.id.fragment3dchromaBar1    : chromaL    = progress; computeChroma()    ; setChromaText()    ; break;
-      case R.id.fragment3dchromaBar2    : chromaR    = progress; computeChroma()    ; setChromaText()    ; break;
-      case R.id.fragment3dchromaBar3    : chromaG    = progress; computeChroma()    ; setChromaText()    ; break;
-      case R.id.fragment3dchromaBar4    : chromaB    = progress; computeChroma()    ; setChromaText()    ; break;
-      case R.id.fragment3dalphaBar1     : alphaL     = progress; computeAlpha()     ; setAlphaText()     ; break;
-      case R.id.fragment3dbrightnessBar1: brightnessL= progress; computeBrightness(); setBrightnessText(); break;
-      case R.id.fragment3dsaturationBar1: saturationL= progress; computeSaturation(); setSaturationText(); break;
+      case R.id.fragment3dcenterX: centerX    = progress; computeCenter()    ; setCenterText()    ; break;
+      case R.id.fragment3dcenterY: centerY    = progress; computeCenter()    ; setCenterText()    ; break;
       }
     }
 
diff --git a/src/main/java/org/distorted/examples/fragment3d/Fragment3DEffect.java b/src/main/java/org/distorted/examples/fragment3d/Fragment3DEffect.java
index 47bbb8c..da8021d 100644
--- a/src/main/java/org/distorted/examples/fragment3d/Fragment3DEffect.java
+++ b/src/main/java/org/distorted/examples/fragment3d/Fragment3DEffect.java
@@ -75,7 +75,7 @@ public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
     {
     switch(mName)
       {
-      case CHROMA    : mInter[0] = 100;
+      case CHROMA    : mInter[0] =   0;
                        mInter[1] =   0;
                        mInter[2] =   0;
                        mInter[3] =   0;
@@ -115,31 +115,46 @@ public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
   public Fragment3DEffect(EffectNames name)
     {
     mName = name;
-    mDimension = name.getDimension();
-
-    mInter = new int[mDimension];
-    mSeek  = new SeekBar[mDimension];
-
-    mDyn1 = new Dynamic1D();
-    mSta1 = new Static1D(0);
-    mDyn1.add(mSta1);
 
     if( mName==EffectNames.CHROMA )
       {
+      mDimension = 4;
       mDyn3 = new Dynamic3D();
       mSta3 = new Static3D(0,0,0);
       mDyn3.add(mSta3);
       }
     else
       {
+      mDimension = 1;
       mDyn3 = null;
       mSta3 = null;
       }
+
+    mInter = new int[mDimension];
+    mSeek  = new SeekBar[mDimension];
+
+    mDyn1 = new Dynamic1D();
+    mSta1 = new Static1D(0);
+    mDyn1.add(mSta1);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public Dynamic1D getDyn1()
+    {
+    return mDyn1;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void addView(Activity act, LinearLayout layout)
+  public Dynamic3D getDyn3()
+    {
+    return mDyn3;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public View createView(Activity act)
     {
     View effect;
 
@@ -168,7 +183,7 @@ public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
                mSeek[3] = (SeekBar)effect.findViewById(R.id.effect4dbar3);
                break;
       default: android.util.Log.e("Fragment3DEffect", "dimension "+mDimension+" not supported!");
-               return;
+               return null;
       }
 
     setDefaultInter();
@@ -181,7 +196,7 @@ public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
       mSeek[i].setProgress( mInter[i] );
       }
 
-    layout.addView(effect, 0);
+    return effect;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -194,6 +209,7 @@ public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
     if ( mDimension>=4 && bar.getId()==mSeek[3].getId() ) mInter[3] = progress;
 
     fillStatics();
+    setText();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/examples/fragment3d/Fragment3DRenderer.java b/src/main/java/org/distorted/examples/fragment3d/Fragment3DRenderer.java
index b7224cb..e36be39 100644
--- a/src/main/java/org/distorted/examples/fragment3d/Fragment3DRenderer.java
+++ b/src/main/java/org/distorted/examples/fragment3d/Fragment3DRenderer.java
@@ -61,48 +61,12 @@ class Fragment3DRenderer implements GLSurfaceView.Renderer
 
     private DynamicQuat mQuatInt1, mQuatInt2;
 
-    private EffectNames[] order;
-
-    private Dynamic2D mCenterInter;
-    private Dynamic3D mChromaInter, mMoveInter;
-    private Dynamic1D mChromaLevelInter, mAlphaInter, mBrightnessInter, mSaturationInter;
-
-    private Static2D mCenterPoint;
-    private Static3D mChromaPoint, mMovePoint;
-    private Static1D mChromaLevel, mAlphaPoint, mBrightnessPoint, mSaturationPoint;
+    private Dynamic3D mMoveInter;
+    private Static3D mMovePoint;
 
     Static4D mQuat1, mQuat2;
     int mScreenMin;
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void setChroma(float level, float r, float g, float b)
-      {
-      mChromaLevel.set(level);
-      mChromaPoint.set(r, g, b);
-      }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void setAlpha(float level)
-      {
-      mAlphaPoint.set(level);
-      }
-     
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void setBrightness(float level)
-      {
-      mBrightnessPoint.set(level);
-      }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void setSaturation(float level)
-      {
-      mSaturationPoint.set(level);
-      }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void setCenter(float x, float y)
@@ -110,36 +74,9 @@ class Fragment3DRenderer implements GLSurfaceView.Renderer
       x = (0.012f*x-0.1f)*mObjWidth;
       y = (0.012f*y-0.1f)*mObjHeight;
 
-      mCenterPoint.set(x,y);
       mMovePoint.set(mFactorObj*x,mFactorObj*y,0);
       }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public void setOrder(EffectNames[] effects)
-      {
-      order = effects;
-      setFragmentEffects();
-      }
-      
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    private void setFragmentEffects()
-      {
-      mObject.abortEffects(EffectTypes.FRAGMENT);
-
-      for( int i=0; i<=order.length-1 ; i++ )
-        {
-        switch(order[i])
-          {
-          case CHROMA    : mObject.chroma    ( mChromaLevelInter , mChromaInter) ; break;
-          case ALPHA     : mObject.alpha     ( mAlphaInter                     ) ; break;
-          case BRIGHTNESS: mObject.brightness( mBrightnessInter                ) ; break;
-          case SATURATION: mObject.saturation( mSaturationInter                ) ; break;
-          }
-        }
-      }
-    
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public Fragment3DRenderer(GLSurfaceView v)
@@ -152,29 +89,9 @@ class Fragment3DRenderer implements GLSurfaceView.Renderer
       mObjWidth = mObject.getWidth();
       mObjHeight= mObject.getHeight();
 
-      mCenterPoint    = new Static2D(0,0);
-      mMovePoint      = new Static3D(0,0,0);
-      mChromaPoint    = new Static3D(0,0,0);
-      mChromaLevel    = new Static1D(0);
-      mAlphaPoint     = new Static1D(1);
-      mBrightnessPoint= new Static1D(1);
-      mSaturationPoint= new Static1D(0.5f);
-
-      mCenterInter     = new Dynamic2D();
-      mMoveInter       = new Dynamic3D();
-      mChromaInter     = new Dynamic3D();
-      mChromaLevelInter= new Dynamic1D();
-      mAlphaInter      = new Dynamic1D();
-      mBrightnessInter = new Dynamic1D();
-      mSaturationInter = new Dynamic1D();
-
-      mCenterInter.add(mCenterPoint);
+      mMovePoint= new Static3D(0,0,0);
+      mMoveInter= new Dynamic3D();
       mMoveInter.add(mMovePoint);
-      mChromaInter.add(mChromaPoint);
-      mChromaLevelInter.add(mChromaLevel);
-      mAlphaInter.add(mAlphaPoint);
-      mBrightnessInter.add(mBrightnessPoint);
-      mSaturationInter.add(mSaturationPoint);
 
       mQuat1 = new Static4D(0,0,0,1);  // unity
       mQuat2 = new Static4D(0,0,0,1);  // quaternions
@@ -246,8 +163,6 @@ class Fragment3DRenderer implements GLSurfaceView.Renderer
       mCenter.move(mMoveInter);
       mCenter.scale(mFactorCen);
 
-      setFragmentEffects();
-
       Distorted.onSurfaceChanged(width, height); 
       }
 
diff --git a/src/main/res/layout/effect1d.xml b/src/main/res/layout/effect1d.xml
index 68bf791..2914fac 100644
--- a/src/main/res/layout/effect1d.xml
+++ b/src/main/res/layout/effect1d.xml
@@ -22,4 +22,11 @@
             android:layout_marginLeft="5dp"
             android:layout_marginRight="5dp" />
 
+
+        <View
+            android:layout_height="3dip"
+            android:background="#777777"
+            android:layout_width="match_parent"
+            />
+
 </LinearLayout>
diff --git a/src/main/res/layout/effect2d.xml b/src/main/res/layout/effect2d.xml
index 3fdadb5..864dd38 100644
--- a/src/main/res/layout/effect2d.xml
+++ b/src/main/res/layout/effect2d.xml
@@ -29,4 +29,11 @@
             android:layout_marginEnd="5dp"
             android:layout_marginLeft="5dp"
             android:layout_marginRight="5dp" />
+
+        <View
+            android:layout_height="3dip"
+            android:background="#777777"
+            android:layout_width="match_parent"
+            />
+
 </LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/effect3d.xml b/src/main/res/layout/effect3d.xml
index e3409fd..c736600 100644
--- a/src/main/res/layout/effect3d.xml
+++ b/src/main/res/layout/effect3d.xml
@@ -36,4 +36,11 @@
             android:layout_marginEnd="5dp"
             android:layout_marginLeft="5dp"
             android:layout_marginRight="5dp" />
+
+        <View
+            android:layout_height="3dip"
+            android:background="#777777"
+            android:layout_width="match_parent"
+            />
+
 </LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/effect4d.xml b/src/main/res/layout/effect4d.xml
index 3744ebc..13fd98b 100644
--- a/src/main/res/layout/effect4d.xml
+++ b/src/main/res/layout/effect4d.xml
@@ -44,4 +44,11 @@
             android:layout_marginEnd="5dp"
             android:layout_marginLeft="5dp"
             android:layout_marginRight="5dp" />
+
+        <View
+            android:layout_height="3dip"
+            android:background="#777777"
+            android:layout_width="match_parent"
+            />
+
 </LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/fragment3dalpha.xml b/src/main/res/layout/fragment3dalpha.xml
deleted file mode 100644
index aef0de2..0000000
--- a/src/main/res/layout/fragment3dalpha.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/fragment3dRowAlpha"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content"
-              android:orientation="horizontal">
-
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_weight="0.8"
-        android:orientation="vertical" >
-
-        <TextView
-            android:id="@+id/fragment3dalphaText"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="5dp"
-            android:layout_marginStart="5dp"
-            android:layout_marginTop="3dp"
-            />
-
-        <SeekBar
-            android:id="@+id/fragment3dalphaBar1"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="5dp"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp" />
-    </LinearLayout>
-
-    <Button
-        android:id="@+id/fragment3dUpAlpha"
-        android:layout_width="60dp"
-        android:layout_height="fill_parent"
-        android:onClick="ButtonAlpha"
-        android:text="@string/Up" />
-</LinearLayout>
diff --git a/src/main/res/layout/fragment3dbrightness.xml b/src/main/res/layout/fragment3dbrightness.xml
deleted file mode 100644
index 6e686b6..0000000
--- a/src/main/res/layout/fragment3dbrightness.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/fragment3dRowBrightness"
-              android:orientation="horizontal"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content" >
-
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_weight="0.70"
-        android:orientation="vertical" >
-
-        <TextView
-            android:id="@+id/fragment3dbrightnessText"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="5dp"
-            android:layout_marginStart="5dp"
-            android:layout_marginTop="3dp" />
-
-        <SeekBar
-            android:id="@+id/fragment3dbrightnessBar1"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="end"
-            android:layout_marginEnd="5dp"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp" />
-
-    </LinearLayout>
-
-    <Button
-        android:id="@+id/fragment3dUpBrightness"
-        android:layout_width="60dp"
-        android:layout_height="fill_parent"
-        android:onClick="ButtonBrightness"
-        android:text="@string/Up" />
-
-</LinearLayout>
diff --git a/src/main/res/layout/fragment3dchroma.xml b/src/main/res/layout/fragment3dchroma.xml
deleted file mode 100644
index d3eae88..0000000
--- a/src/main/res/layout/fragment3dchroma.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/fragment3dRowChroma"
-              android:orientation="horizontal"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content" >
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_weight="0.70"
-        android:orientation="vertical" >
-
-        <TextView
-            android:id="@+id/fragment3dchromaText"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="5dp"
-            android:layout_marginStart="5dp"
-            android:layout_marginTop="3dp" />
-
-        <SeekBar
-            android:id="@+id/fragment3dchromaBar1"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="end"
-            android:layout_marginEnd="5dp"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp" />
-
-        <LinearLayout
-            android:orientation="horizontal"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent">
-
-            <SeekBar
-                android:id="@+id/fragment3dchromaBar2"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_weight="0.33"/>
-
-            <SeekBar
-                android:id="@+id/fragment3dchromaBar3"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginEnd="5dp"
-                android:layout_marginLeft="5dp"
-                android:layout_marginRight="5dp"
-                android:layout_weight="0.33"/>
-
-            <SeekBar
-                android:id="@+id/fragment3dchromaBar4"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginRight="5dp"
-                android:layout_marginLeft="5dp"
-                android:layout_weight="0.33"/>
-
-        </LinearLayout>
-
-    </LinearLayout>
-
-    <Button
-        android:id="@+id/fragment3dUpChroma"
-        android:layout_width="60dp"
-        android:layout_height="fill_parent"
-        android:onClick="ButtonChroma"
-        android:text="@string/Up" />
-
-</LinearLayout>
diff --git a/src/main/res/layout/fragment3dlayout.xml b/src/main/res/layout/fragment3dlayout.xml
index 844ac60..d73e6b0 100644
--- a/src/main/res/layout/fragment3dlayout.xml
+++ b/src/main/res/layout/fragment3dlayout.xml
@@ -13,65 +13,98 @@
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="5dp"
-        android:background="@android:color/holo_green_dark">
+        android:layout_height="50dp"
+        android:layout_gravity="center">
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/reset"
+            android:id="@+id/buttonRemove"
+            android:onClick="removeAll"
+            />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/chroma"
+            android:id="@+id/buttonChroma"
+            android:onClick="newChroma"/>
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/alpha"
+            android:id="@+id/buttonAlpha"
+            android:onClick="newAlpha"/>
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/brightness"
+            android:id="@+id/buttonBrightness"
+            android:onClick="newBrightness"/>
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/saturation"
+            android:id="@+id/buttonSaturation"
+            android:onClick="newSaturation"/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="fill_parent"
+        android:layout_height="50dp"
+        >
+
+        <TextView
+            android:id="@+id/fragment3dcenterText"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="5dp"
+            android:layout_marginStart="5dp"
+            android:layout_marginTop="3dp"
+            />
 
         <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="0dp"
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_weight="0.8">
+            >
 
-            <TextView
-                android:id="@+id/fragment3dcenterText"
-                android:layout_width="wrap_content"
+            <SeekBar
+                android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginEnd="5dp"
-                android:layout_marginStart="5dp"
-                android:layout_marginTop="3dp"
-                />
-
-            <LinearLayout
-                android:orientation="horizontal"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                >
-
-                <SeekBar
-                    android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:id="@+id/fragment3dcenterX"
-                    android:layout_weight="0.5"
-                    android:paddingLeft="5dp"
-                    android:paddingRight="3dp"/>
-
-                <SeekBar
-                    android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:id="@+id/fragment3dcenterY"
-                    android:layout_weight="0.5"
-                    android:paddingLeft="3dp"
-                    android:paddingRight="5dp"/>
-            </LinearLayout>
+                android:id="@+id/fragment3dcenterX"
+                android:layout_weight="0.5"
+                android:paddingLeft="5dp"
+                android:paddingRight="3dp"/>
 
+            <SeekBar
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:id="@+id/fragment3dcenterY"
+                android:layout_weight="0.5"
+                android:paddingLeft="3dp"
+                android:paddingRight="5dp"/>
         </LinearLayout>
 
-        <Button
-            android:id="@+id/buttonDefault"
-            android:layout_width="60dp"
-            android:layout_height="wrap_content"
-            android:onClick="Default"
-            android:text="@string/reset"
-            android:layout_gravity="right"
-            android:layout_marginTop="3dp"/>
     </LinearLayout>
 
+    <View
+        android:layout_height="4dip"
+        android:background="#777777"
+        android:layout_width="match_parent"
+        />
+
     <ScrollView
         android:id="@+id/fragment3dscrollView"
         android:layout_width="match_parent"
         android:layout_height="0dp"
-        android:layout_weight="0.82" >
+        android:layout_weight="0.82"
+        >
 
         <LinearLayout
             android:id="@+id/fragment3dlayout"
diff --git a/src/main/res/layout/fragment3dsaturation.xml b/src/main/res/layout/fragment3dsaturation.xml
deleted file mode 100644
index 1a7e905..0000000
--- a/src/main/res/layout/fragment3dsaturation.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/fragment3dRowSaturation"
-              android:orientation="horizontal"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content" >
-
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_weight="0.70"
-        android:orientation="vertical" >
-
-        <TextView
-            android:id="@+id/fragment3dsaturationText"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="5dp"
-            android:layout_marginStart="5dp"
-            android:layout_marginTop="3dp" />
-
-        <SeekBar
-            android:id="@+id/fragment3dsaturationBar1"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="end"
-            android:layout_marginEnd="5dp"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="5dp" />
-
-    </LinearLayout>
-
-    <Button
-        android:id="@+id/fragment3dUpSaturation"
-        android:layout_width="60dp"
-        android:layout_height="fill_parent"
-        android:onClick="ButtonSaturation"
-        android:text="@string/Up" />
-
-</LinearLayout>
