| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,4 +8,4 @@ | |||
| 8 | 8 | # project structure. | |
| 9 | 9 | ||
| 10 | 10 | # Project target. | |
| 11 | - target=android-8 | ||
| 11 | + target=android-14 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,51 +1,63 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | 2 | ||
| 3 | - <FrameLayout | ||
| 3 | + <LinearLayout | ||
| 4 | 4 | xmlns:android="http://schemas.android.com/apk/res/android" | |
| 5 | 5 | android:id="@+id/main" | |
| 6 | - android:orientation="horizontal" | ||
| 6 | + android:orientation="vertical" | ||
| 7 | 7 | android:layout_width="match_parent" | |
| 8 | 8 | android:layout_height="match_parent"> | |
| 9 | 9 | ||
| 10 | 10 | <LinearLayout | |
| 11 | 11 | android:id="@+id/xform_v" | |
| 12 | 12 | android:orientation="horizontal" | |
| 13 | 13 | android:layout_width="match_parent" | |
| 14 | - android:layout_height="match_parent"> | ||
| 14 | + android:layout_height="wrap_content"> | ||
| 15 | 15 | ||
| 16 | 16 | <LinearLayout | |
| 17 | 17 | android:id="@+id/xform_v_left" | |
| 18 | 18 | android:orientation="vertical" | |
| 19 | 19 | android:background="@drawable/bg0" | |
| 20 | - android:layout_width="wrap_content" | ||
| 20 | + android:layout_width="0dp" | ||
| 21 | + android:layout_weight=".05" | ||
| 21 | 22 | android:layout_height="wrap_content" /> | |
| 22 | 23 | ||
| 23 | 24 | <LinearLayout | |
| 24 | 25 | android:id="@+id/xform_v_right" | |
| 25 | 26 | android:orientation="vertical" | |
| 26 | 27 | android:background="@drawable/bg0" | |
| 27 | - android:layout_width="wrap_content" | ||
| 28 | + android:layout_width="0dp" | ||
| 29 | + android:layout_weight=".05" | ||
| 28 | 30 | android:layout_height="wrap_content" /> | |
| 29 | 31 | </LinearLayout> | |
| 30 | 32 | ||
| 31 | 33 | <LinearLayout | |
| 32 | 34 | android:id="@+id/efx_v" | |
| 33 | 35 | android:orientation="horizontal" | |
| 34 | 36 | android:layout_width="match_parent" | |
| 35 | - android:layout_height="match_parent"> | ||
| 37 | + android:layout_height="wrap_content"> | ||
| 36 | 38 | ||
| 37 | 39 | <LinearLayout | |
| 38 | 40 | android:id="@+id/efx_v_left" | |
| 39 | 41 | android:orientation="vertical" | |
| 40 | 42 | android:background="@drawable/bg0" | |
| 41 | - android:layout_width="wrap_content" | ||
| 43 | + android:layout_width="0dp" | ||
| 44 | + android:layout_weight=".05" | ||
| 42 | 45 | android:layout_height="wrap_content" /> | |
| 43 | 46 | ||
| 44 | 47 | <LinearLayout | |
| 45 | 48 | android:id="@+id/efx_v_right" | |
| 46 | 49 | android:orientation="vertical" | |
| 47 | 50 | android:background="@drawable/bg0" | |
| 48 | - android:layout_width="wrap_content" | ||
| 51 | + android:layout_width="0dp" | ||
| 52 | + android:layout_weight=".05" | ||
| 49 | 53 | android:layout_height="wrap_content" /> | |
| 50 | 54 | </LinearLayout> | |
| 51 | - </FrameLayout> | ||
| 55 | + | ||
| 56 | + <com.oreilly.demo.android.pa.viewdemo.widget.GLDemoWidget | ||
| 57 | + android:id="@+id/efx_gl" | ||
| 58 | + android:layout_width="match_parent" | ||
| 59 | + android:layout_weight=".03" | ||
| 60 | + android:layout_height="0dp" /> | ||
| 61 | + <!-- | ||
| 62 | + --> | ||
| 63 | + </LinearLayout> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,11 +153,11 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) { | |||
| 153 | 153 | new LinearGradient( | |
| 154 | 154 | 0.0F, | |
| 155 | 155 | 0.0F, | |
| 156 | - 160.0F, | ||
| 157 | - 80.0F, | ||
| 156 | + 100.0F, | ||
| 157 | + 10.0F, | ||
| 158 | 158 | new int[] { | |
| 159 | 159 | Color.BLACK, Color.RED, Color.YELLOW }, | |
| 160 | - new float[] { 0.2F, 0.3F, 0.2F }, | ||
| 160 | + new float[] { 0.0F, 0.5F, 0.95F }, | ||
| 161 | 161 | Shader.TileMode.REPEAT)); | |
| 162 | 162 | } })); | |
| 163 | 163 | lv.addView(new EffectsWidget( | |
@@ -169,10 +169,6 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) { | |||
| 169 | 169 | new BlurMaskFilter(2, BlurMaskFilter.Blur.NORMAL)); | |
| 170 | 170 | } })); | |
| 171 | 171 | ||
| 172 | - // the OpenGL widget | ||
| 173 | - glWidget = new GLDemoWidget(this); | ||
| 174 | - lv.addView(glWidget); | ||
| 175 | - | ||
| 176 | 172 | rv.addView(new EffectsWidget( | |
| 177 | 173 | this, | |
| 178 | 174 | 2, | |
@@ -204,7 +200,6 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) { | |||
| 204 | 200 | rv.addView(w); | |
| 205 | 201 | w.setBackgroundResource(R.drawable.throbber); | |
| 206 | 202 | ||
| 207 | - //!!! Hack; should be fixed in Cupcake | ||
| 208 | 203 | w.setOnClickListener(new OnClickListener() { | |
| 209 | 204 | @Override public void onClick(View v) { | |
| 210 | 205 | AnimationDrawable animation | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ | |||
| 8 | 8 | import android.graphics.Color; | |
| 9 | 9 | import android.graphics.Paint; | |
| 10 | 10 | import android.view.View; | |
| 11 | + import android.view.ViewGroup; | ||
| 11 | 12 | ||
| 12 | 13 | import com.oreilly.demo.android.pa.viewdemo.R; | |
| 13 | 14 | ||
@@ -39,7 +40,7 @@ public EffectsWidget(Context context, int n, PaintEffect pe) { | |||
| 39 | 40 | effect = pe; | |
| 40 | 41 | ||
| 41 | 42 | setMinimumWidth(160); | |
| 42 | - setMinimumHeight(80); | ||
| 43 | + setMinimumHeight(135); | ||
| 43 | 44 | ||
| 44 | 45 | setBackgroundResource(R.drawable.bg0); | |
| 45 | 46 | } | |
@@ -48,7 +49,7 @@ public EffectsWidget(Context context, int n, PaintEffect pe) { | |||
| 48 | 49 | @Override | |
| 49 | 50 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
| 50 | 51 | setMeasuredDimension( | |
| 51 | - getSuggestedMinimumWidth(), | ||
| 52 | + ViewGroup.LayoutParams.MATCH_PARENT, | ||
| 52 | 53 | getSuggestedMinimumHeight()); | |
| 53 | 54 | } | |
| 54 | 55 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ | |||
| 17 | 17 | import android.opengl.GLU; | |
| 18 | 18 | import android.opengl.GLUtils; | |
| 19 | 19 | import android.os.SystemClock; | |
| 20 | + import android.util.AttributeSet; | ||
| 20 | 21 | ||
| 21 | 22 | import com.example.android.apis.graphics.GLSurfaceView; | |
| 22 | 23 | import com.oreilly.demo.android.pa.viewdemo.R; | |
@@ -37,14 +38,12 @@ public class GLDemoWidget extends GLSurfaceView | |||
| 37 | 38 | ||
| 38 | 39 | /** | |
| 39 | 40 | * @param context the app context | |
| 41 | + * @param attrs the view attributes | ||
| 40 | 42 | */ | |
| 41 | - public GLDemoWidget(Context context) { | ||
| 42 | - super(context); | ||
| 43 | + public GLDemoWidget(Context context, AttributeSet attrs) { | ||
| 44 | + super(context, attrs); | ||
| 43 | 45 | this.context = context; | |
| 44 | 46 | ||
| 45 | - setMinimumWidth(160); | ||
| 46 | - setMinimumHeight(80); | ||
| 47 | - | ||
| 48 | 47 | setRenderer(this); | |
| 49 | 48 | ||
| 50 | 49 | float[] coords = { | |
@@ -86,14 +85,6 @@ public GLDemoWidget(Context context) { | |||
| 86 | 85 | indexBuf.position(0); | |
| 87 | 86 | } | |
| 88 | 87 | ||
| 89 | - /** @see android.view.View#onMeasure(int, int) */ | ||
| 90 | - @Override | ||
| 91 | - protected void onMeasure(int widthSpec, int heightSpec) { | ||
| 92 | - setMeasuredDimension( | ||
| 93 | - getSuggestedMinimumWidth(), | ||
| 94 | - getSuggestedMinimumHeight()); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | 88 | /** | |
| 98 | 89 | * We don't need a depth buffer and don't care about our color depth. | |
| 99 | 90 | */ | |
@@ -131,7 +122,7 @@ public void surfaceCreated(GL10 gl) { | |||
| 131 | 122 | GL10.GL_PERSPECTIVE_CORRECTION_HINT, | |
| 132 | 123 | GL10.GL_FASTEST); | |
| 133 | 124 | ||
| 134 | - gl.glClearColor(0.4f, 0.2f, 0.2f, 0.5f); | ||
| 125 | + gl.glClearColor(0.2f, 0.1f, 0.8f, 0.1f); | ||
| 135 | 126 | gl.glShadeModel(GL10.GL_SMOOTH); | |
| 136 | 127 | gl.glEnable(GL10.GL_DEPTH_TEST); | |
| 137 | 128 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ | |||
| 8 | 8 | import android.graphics.Rect; | |
| 9 | 9 | import android.graphics.drawable.Drawable; | |
| 10 | 10 | import android.view.View; | |
| 11 | + import android.view.ViewGroup; | ||
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | 14 | /** | |
@@ -53,7 +54,7 @@ public TransformedViewWidget( | |||
| 53 | 54 | @Override | |
| 54 | 55 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
| 55 | 56 | setMeasuredDimension( | |
| 56 | - getSuggestedMinimumWidth(), | ||
| 57 | + ViewGroup.LayoutParams.MATCH_PARENT, | ||
| 57 | 58 | getSuggestedMinimumHeight()); | |
| 58 | 59 | } | |
| 59 | 60 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments