Skip to content

Commit 8bbd350

Browse files
Perform silent code cleanup
1 parent 98a8c68 commit 8bbd350

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

demo/src/main/java/com/yalantis/starwarsdemo/adapter/ProfileAdapter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ProfileAdapter extends RecyclerView.Adapter<ProfileAdapter.ViewHold
2626
private static final int VIEW_TYPE_TEXT_FIELD = 1;
2727
private static final int VIEW_GENDER_FIELD = 2;
2828
private final ProfileAdapterListener mListener;
29-
private User mUser;
29+
private final User mUser;
3030

3131
private final String mFullNameLabel;
3232
private final String mHomeWorldLabel;
@@ -87,9 +87,8 @@ public void onBindViewHolder(final ViewHolder holder, int position) {
8787
// holder.getBinding().setVariable(BR.callback, mListener);
8888
// holder.getBinding().setVariable(BR.user, mUser);
8989
holder.mySwitch.setCheckedImmediate(mUser.isDarkSide());
90-
holder.mySwitch.setOnCheckedChangeListener((CompoundButton.OnCheckedChangeListener)
91-
(buttonView, isChecked) ->
92-
mListener.onSideSwitch(holder.mySwitch));
90+
holder.mySwitch.setOnCheckedChangeListener((buttonView, isChecked) ->
91+
mListener.onSideSwitch(holder.mySwitch));
9392
holder.label.setText(mUser.getSideText());
9493
break;
9594
case 1:

demo/src/main/java/com/yalantis/starwarsdemo/particlesys/ParticleSystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class ParticleSystem implements Renderable {
2525
private final ParticleSystemRenderer mRenderer;
2626
public static final int PARTICLE_COUNT = 1_000;
27-
private int mBufferId;
27+
private final int mBufferId;
2828

2929
public static final int POS_DATA_SIZE = 3;
3030
public static final int TEXTURE_COORDS_DATA_SIZE = 2;
@@ -39,7 +39,7 @@ public ParticleSystem(ParticleSystemRenderer renderer, FloatBuffer vertexBuffer)
3939
Timber.d("generated in %d ms", System.currentTimeMillis() - startTime);
4040

4141
// Copy buffer into OpenGL's memory. After, we don't need to keep the client-side buffers around.
42-
final int buffers[] = new int[1];
42+
final int[] buffers = new int[1];
4343
glGenBuffers(1, buffers, 0);
4444

4545
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);

demo/src/main/java/com/yalantis/starwarsdemo/particlesys/ParticleSystemRenderer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
3434
public int sizeX = 35;
3535
public int sizeY = 70;
3636
public float mTime;
37-
private GLSurfaceView mGlSurfaceView;
37+
private final GLSurfaceView mGlSurfaceView;
3838
/**
3939
* Store the model matrix. This matrix is used to move models from object space (where each model can be thought
4040
* of being located at the center of the universe) to world space.
4141
*/
42-
private float[] mModelMatrix = new float[16];
42+
private final float[] mModelMatrix = new float[16];
4343
/**
4444
* Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space;
4545
* it positions things relative to our eye.
4646
*/
47-
private float[] mViewMatrix = new float[16];
47+
private final float[] mViewMatrix = new float[16];
4848
/** Store the projection matrix. This is used to project the scene onto a 2D viewport. */
49-
private float[] mProjectionMatrix = new float[16];
49+
private final float[] mProjectionMatrix = new float[16];
5050
/** Allocate storage for the final combined matrix. This will be passed into the shader program. */
51-
private float[] mMVPMatrix = new float[16];
52-
private float[] mTemporaryMatrix = new float[16];
51+
private final float[] mMVPMatrix = new float[16];
52+
private final float[] mTemporaryMatrix = new float[16];
5353
private int timeHandle;
5454
private long mStartTime;
5555
private int frames;
@@ -59,7 +59,7 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
5959
private float dt;
6060
private long t_current;
6161
private long t_prev;
62-
private float dt_prev = 1;
62+
private final float dt_prev = 1;
6363
private ValueAnimator animator;
6464
private Bitmap mBitmap;
6565
private ParticleSystem mParticleSystem;
@@ -68,7 +68,7 @@ public class ParticleSystemRenderer implements GLSurfaceView.Renderer {
6868
private int mHeight;
6969
private int timesRepeated;
7070
private float delta;
71-
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
71+
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
7272

7373

7474
public ParticleSystemRenderer(GLSurfaceView glSurfaceView) {

demo/src/main/java/com/yalantis/starwarsdemo/view/SideFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public abstract class SideFragment extends Fragment implements ProfileAdapterLis
4343

4444
private FragmentSideBinding binding;
4545

46-
private Toolbar.OnMenuItemClickListener onMenuItemClickListener = item -> {
46+
private final Toolbar.OnMenuItemClickListener onMenuItemClickListener = item -> {
4747
if (R.id.action_close == item.getItemId()) {
4848
doBreak();
4949
}

demo/src/main/java/com/yalantis/starwarsdemo/widget/CenterTopImageView.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
import android.content.Context;
44
import android.graphics.Matrix;
55
import android.util.AttributeSet;
6-
import android.widget.ImageView;
6+
7+
import androidx.appcompat.widget.AppCompatImageView;
78

89
/**
910
* Created by Artem Kholodnyi on 11/23/15.
1011
*/
11-
public class CenterTopImageView extends ImageView {
12-
private Matrix matrix = new Matrix();
12+
public class CenterTopImageView extends AppCompatImageView {
13+
private final Matrix matrix = new Matrix();
1314

1415
public CenterTopImageView(Context context) {
1516
super(context);

0 commit comments

Comments
 (0)