Project

General

Profile

« Previous | Next » 

Revision 6f3024ae

Added by Leszek Koltunski about 8 years ago

Fix a lot of Lint warnings in the apps.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
23 23
import android.graphics.BitmapFactory;
24 24
import android.opengl.GLES20;
25 25
import android.opengl.GLSurfaceView;
26
import android.provider.Settings;
27 26

  
28 27
import org.distorted.examples.R;
29 28
import org.distorted.library.Distorted;
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldSurfaceViewPicker.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25
import android.view.MotionEvent;
27 26

  
......
41 40
      if(!isInEditMode())
42 41
        {
43 42
        setEGLContextClientVersion(2);
44

  
45
        if( Build.FINGERPRINT.startsWith("generic") )
46
          {
47
          setEGLConfigChooser(8, 8, 8, 8, 16, 0);
48
          }
49

  
50 43
        mRenderer = new AroundTheWorldRendererPicker();
51 44
        setRenderer(mRenderer);
52 45
        }
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
56 56

  
57 57
///////////////////////////////////////////////////////////////////////////////////////////////////
58 58

  
59
    public CatAndDogRenderer(GLSurfaceView v)
59
    CatAndDogRenderer(GLSurfaceView v)
60 60
      {   
61 61
      mView = v;
62 62

  
......
131 131
    
132 132
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
133 133
      {
134
      int duration = 10000;   
134
      int duration = 10000;   // 10 seconds
135 135
      
136 136
      Dynamic3D diMove = new Dynamic3D(duration,0.0f);
137 137
      diMove.add(new Static3D(width-bmpWidth,height-bmpHeight,0));
src/main/java/org/distorted/examples/catanddog/CatAndDogSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/check/CheckSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
......
37 36
      if(!isInEditMode())
38 37
        {
39 38
        setEGLContextClientVersion(2);
40
        CheckRenderer renderer = new CheckRenderer(this);
41
        setRenderer(renderer);
39
        setRenderer(new CheckRenderer(this));
42 40
        }
43 41
      }
44 42

  
src/main/java/org/distorted/examples/cubes/CubesActivity.java
108 108
      mShape = new boolean[mNumRows*mNumCols];
109 109

  
110 110
      TableRow.LayoutParams p = new android.widget.TableRow.LayoutParams();
111
          
111

  
112 112
      p.rightMargin  = pad;
113 113
      p.leftMargin   = pad;
114 114
      p.topMargin    = pad;
src/main/java/org/distorted/examples/cubes/CubesSurfaceView.java
23 23

  
24 24
import android.content.Context;
25 25
import android.opengl.GLSurfaceView;
26
import android.os.Build;
27 26
import android.util.AttributeSet;
28 27
import android.view.MotionEvent;
29 28
import android.widget.Toast;
......
101 100
                                       float rz = mRenderer.mQuat2.getZ();
102 101
                                       float rw = mRenderer.mQuat2.getW();
103 102

  
104
                                       // This is quaternion multiplication. (tx.ty.tz.tw)
103
                                       // This is quaternion multiplication. (tx,ty,tz,tw)
105 104
                                       // is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw)
106 105
                                       float tx = rw*qx - rz*qy + ry*qz + rx*qw;
107 106
                                       float ty = rw*qy + rz*qx + ry*qw - rx*qz;
src/main/java/org/distorted/examples/deform/DeformActivity.java
53 53
     
54 54
      barR.setProgress(50);
55 55
      
56
      textR.setText("Radius: 50");
56
      textR.setText(getString(R.string.radius_placeholder,"50"));
57 57

  
58 58
      RadioButton effect = (RadioButton)findViewById(R.id.deformDistortButton);
59 59
      effect.setChecked(true);
......
127 127
        {
128 128
        case R.id.deformSeekRadius: DeformSurfaceView view = (DeformSurfaceView) this.findViewById(R.id.deformSurfaceView);
129 129
                                    view.getRenderer().setRegionRadius(progress);
130
                                    textR.setText("Radius: "+(progress<100 ? progress: "Infinity"));
130
                                    textR.setText(getString(R.string.radius_placeholder,(progress<100 ? (""+progress): "Infinity") ));
131 131
                                    break;
132 132
        }
133 133
      }
src/main/java/org/distorted/examples/deform/DeformSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25
import android.view.MotionEvent;
27 26

  
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.view.MotionEvent;
26 25
import android.util.AttributeSet;
27 26
import android.graphics.Canvas;
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
45 45
class EffectQueueRenderer implements GLSurfaceView.Renderer, EffectListener
46 46
  {  
47 47
  private static final int NUMLINES =  10;
48
  static final int BWID = 300;
49
  static final int BHEI = 400;
48
  final int BWID = 300;
49
  final int BHEI = 400;
50 50
   
51 51
  private EffectQueueSurfaceView mView;
52 52
  private Paint mPaint;
src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java
506 506
    return 0;
507 507
    }
508 508

  
509
///////////////////////////////////////////////////////////////////////////////////////////////////
510

  
511
  public int getScreenHeight()
512
    {
513
    return 0;
514
    }
515

  
516 509
///////////////////////////////////////////////////////////////////////////////////////////////////
517 510

  
518 511
  private void resetData()
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
648 648

  
649 649
///////////////////////////////////////////////////////////////////////////////////////////////////
650 650

  
651
  public boolean thisView(View v)
651
  boolean thisView(View v)
652 652
    {
653 653
    return v==mButton;
654 654
    }
src/main/java/org/distorted/examples/fbo/FBOSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/flag/FlagActivity.java
88 88
      barNoiseAngleA.setProgress   ( (int)mNoise.getW() );
89 89
      barNoiseAngleB.setProgress   ( (int)mNoise.getV() );
90 90

  
91
      textNoiseAmplitude.setText("Noise 0.00");
92
      textNoiseLength.setText("Noise 0.00");
93
      textNoiseAngleA.setText("Noise 0.00");
94
      textNoiseAngleB.setText("Noise 0.00");
91
      textNoiseAmplitude.setText(getString(R.string.noise_placeholder,"0.00"));
92
      textNoiseLength.setText(getString(R.string.noise_placeholder,"0.00"));
93
      textNoiseAngleA.setText(getString(R.string.noise_placeholder,"0.00"));
94
      textNoiseAngleB.setText(getString(R.string.noise_placeholder,"0.00"));
95 95
      }
96 96

  
97 97
///////////////////////////////////////////////////////////////////////////////////////////////////
......
145 145
      switch (bar.getId())
146 146
        {
147 147
        case R.id.flagSeekAmplitude     : renderer.setAmplitude(progress);
148
                                          textAmplitude.setText("Amplitude "+progress);
148
                                          textAmplitude.setText(getString(R.string.amplitude_placeholder,progress));
149 149
                                          break;
150 150
        case R.id.flagSeekNoiseAmplitude: mNoise.set1((float)progress/100);
151 151
                                          renderer.setNoise(mNoise);
152 152
                                          convert(progress);
153
                                          textNoiseAmplitude.setText("Noise "+mStr );
153
                                          textNoiseAmplitude.setText(getString(R.string.noise_placeholder,mStr));
154 154
                                          break;
155 155
        case R.id.flagSeekLength        : progress = progress*2;
156 156
                                          renderer.setLength(progress);
157
                                          textLength.setText("Length "+progress);
157
                                          textLength.setText(getString(R.string.length_placeholder,progress));
158 158
                                          break;
159 159
        case R.id.flagSeekNoiseLength   : mNoise.set2((float)progress/100);
160 160
                                          renderer.setNoise(mNoise);
161 161
                                          convert(progress);
162
                                          textNoiseLength.setText("Noise "+mStr );
162
                                          textNoiseLength.setText(getString(R.string.noise_placeholder,mStr));
163 163
                                          break;
164 164
        case R.id.flagSeekAngleA        : progress = (360*progress)/100;
165 165
                                          renderer.setAngleA(progress);
166
                                          textAngleA.setText("Alpha "+progress);
166
                                          textAngleA.setText(getString(R.string.alpha_placeholder,progress));
167 167
                                          break;
168 168
        case R.id.flagSeekNoiseAngleA   : mNoise.set4((float)progress/100);
169 169
                                          renderer.setNoise(mNoise);
170 170
                                          convert(progress);
171
                                          textNoiseAngleA.setText("Noise "+mStr );
171
                                          textNoiseAngleA.setText(getString(R.string.noise_placeholder,mStr));
172 172
                                          break;
173 173
        case R.id.flagSeekAngleB        : progress = ((360*progress)/100);
174 174
                                          renderer.setAngleB(progress);
175
                                          textAngleB.setText("Beta "+progress);
175
                                          textAngleB.setText(getString(R.string.beta_placeholder,progress));
176 176
                                          break;
177 177
        case R.id.flagSeekNoiseAngleB   : mNoise.set5((float)progress/100);
178 178
                                          renderer.setNoise(mNoise);
179 179
                                          convert(progress);
180
                                          textNoiseAngleB.setText("Noise "+mStr );
180
                                          textNoiseAngleB.setText(getString(R.string.noise_placeholder,mStr));
181 181
                                          break;
182 182
        }
183 183
      }
src/main/java/org/distorted/examples/flag/FlagSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25
import android.view.MotionEvent;
27 26

  
src/main/java/org/distorted/examples/girl/GirlActivity.java
60 60
      barSize.setProgress(50);
61 61
      barHips.setProgress(0);
62 62

  
63
      textSwing.setText("Swing: 0");
64
      textSize.setText("Size: 1.0");
65
      textHips.setText("Hips: 0");
63
      textSwing.setText(getString(R.string.swing_placeholder,0.0f));
64
      textSize.setText(getString(R.string.size_placeholder,1.0f));
65
      textHips.setText(getString(R.string.hips_placeholder,0.0f));
66 66
      }
67 67

  
68 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
108 108
        {
109 109
        case R.id.girlSeekSwing: v = progress/5;
110 110
                                 view.getRenderer().setSwing(v);
111
                                 textSwing.setText("Swing: "+v);
111
                                 textSwing.setText(getString(R.string.swing_placeholder,v));
112 112
                                 break;
113
        case R.id.girlSeekSize : if( progress> 50)
114
                                   {
115
                                   s = (progress-50)/16.0f + 1.0f;
116
                                   }
117
                                 else
118
                                   {
119
                                   s = 0.015f*progress + 0.25f;
120
                                   }
113
        case R.id.girlSeekSize : if( progress> 50) s = (progress-50)/16.0f + 1.0f;
114
                                 else              s = 0.015f*progress + 0.25f;
121 115
                                 view.getRenderer().setSize(s);
122
                                 textSize.setText("Size: "+(((int)(s*10))/10.0f));
116
                                 textSize.setText(getString(R.string.size_placeholder,(((int)(s*10))/10.0f)));
123 117
                                 break;
124 118
        case R.id.girlSeekHips : v = progress/5;
125 119
                                 view.getRenderer().setHips(v);
126
                                 textHips.setText("Hips: "+v);
120
                                 textHips.setText(getString(R.string.hips_placeholder,v));
127 121
                                 break;
128 122
        }
129 123
      }
src/main/java/org/distorted/examples/girl/GirlSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/listener/ListenerSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/matrix3d/Matrix3DActivity.java
142 142

  
143 143
    }
144 144

  
145
///////////////////////////////////////////////////////////////////////////////////////////////////
146

  
147
  public static boolean supportsRegion()
148
    {
149
    return false;
150
    }
151

  
152 145
///////////////////////////////////////////////////////////////////////////////////////////////////
153 146

  
154 147
  public static void setSupportsCenter(boolean supports)
......
156 149
    mSupportsCenter = supports;
157 150
    }
158 151

  
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

  
161
  public static boolean supportsCenter()
162
    {
163
    return mSupportsCenter;
164
    }
165

  
166 152
///////////////////////////////////////////////////////////////////////////////////////////////////
167 153

  
168 154
  public Bitmap getBitmap()
......
216 202
    return r.getWidth();
217 203
    }
218 204

  
219
///////////////////////////////////////////////////////////////////////////////////////////////////
220

  
221
  public int getScreenHeight()
222
    {
223
    Matrix3DRenderer r = ((Matrix3DSurfaceView)findViewById(R.id.matrix3dSurfaceView)).getRenderer();
224
    return r.getHeight();
225
    }
226

  
227
///////////////////////////////////////////////////////////////////////////////////////////////////
205
//////////////////////////////////////////////////////////////////////////////////
228 206

  
229 207
  public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
230 208
    {
src/main/java/org/distorted/examples/matrix3d/Matrix3DEffect.java
648 648

  
649 649
///////////////////////////////////////////////////////////////////////////////////////////////////
650 650

  
651
  public boolean thisView(View v)
651
  boolean thisView(View v)
652 652
    {
653 653
    return v==mButton;
654 654
    }
src/main/java/org/distorted/examples/matrix3d/Matrix3DSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26
import android.view.MotionEvent;
27 25

  
28 26
///////////////////////////////////////////////////////////////////////////////////////////////////
29 27

  
src/main/java/org/distorted/examples/monalisa/MonaLisaSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/projection/ProjectionActivity.java
102 102
      switch (bar.getId()) 
103 103
        {
104 104
        case R.id.projectionSeekFOV: ret = renderer.setFOV(progress);
105
                                     textF.setText("FOV: "+ret);
105
                                     textF.setText(getString(R.string.fov_placeholder,ret));
106 106
                                     break;
107 107
        case R.id.projectionSeekX  : ret = renderer.setX(progress);
108
                                     textX.setText("X: "+ret);
108
                                     textX.setText(getString(R.string.x_placeholder,ret));
109 109
                                     break;
110 110
        case R.id.projectionSeekY  : ret = renderer.setY(progress);
111
                                     textY.setText("Y: "+ret);
111
                                     textY.setText(getString(R.string.y_placeholder,ret));
112 112
                                     break;
113 113
        }
114 114
      }
src/main/java/org/distorted/examples/quaternion/QuaternionSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/save/SaveSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/sink/SinkSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26

  
src/main/java/org/distorted/examples/wind/WindActivity.java
50 50
     
51 51
      bar.setProgress(50);
52 52
      
53
      windText.setText("Wind: 50");
53
      windText.setText(getString(R.string.wind_placeholder,50));
54 54
      }
55 55

  
56 56
///////////////////////////////////////////////////////////////////////////////////////////////////
......
90 90
        {
91 91
        case R.id.windSeek:WindSurfaceView view = (WindSurfaceView) this.findViewById(R.id.windSurfaceView);
92 92
                           view.getRenderer().setWind(progress);
93
                           windText.setText("Wind: "+progress);
93
                           windText.setText(getString(R.string.wind_placeholder,progress));
94 94
                           break;
95 95
        }
96 96
      }
src/main/java/org/distorted/examples/wind/WindSurfaceView.java
21 21

  
22 22
import android.content.Context;
23 23
import android.opengl.GLSurfaceView;
24
import android.os.Build;
25 24
import android.util.AttributeSet;
26
import android.view.MotionEvent;
27 25

  
28 26
///////////////////////////////////////////////////////////////////////////////////////////////////
29 27

  
src/main/res/values/strings.xml
58 58
    <string name="angleA">Alpha</string>
59 59
    <string name="angleB">Beta</string>
60 60

  
61
    <string name="radius_placeholder">Radius: %1$s</string>
62
    <string name="noise_placeholder">Noise %1$s</string>
63
    <string name="length_placeholder">Length %1$d</string>
64
    <string name="amplitude_placeholder">Amplitude %1$d</string>
65
    <string name="alpha_placeholder">Alpha %1$d</string>
66
    <string name="beta_placeholder">Beta %1$d</string>
67
    <string name="swing_placeholder">Swing %1$f</string>
68
    <string name="size_placeholder">Size %1$f</string>
69
    <string name="hips_placeholder">Hips %1$f</string>
70
    <string name="fov_placeholder">FOV: %1$d</string>
71
    <string name="x_placeholder">X: %1$d</string>
72
    <string name="y_placeholder">Y: %1$d</string>
73
    <string name="wind_placeholder">Wind: %1$d</string>
74

  
61 75
    <string name="example_monalisa">Mona Lisa</string>  
62 76
    <string name="example_monalisa_subtitle">The basics of Distortions.</string>
63 77
    <string name="example_sink">Dog</string>  

Also available in: Unified diff