Skip to content

Commit

Permalink
refactor: Some sonar fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
itachi1706 committed Jun 13, 2024
1 parent aee8bc5 commit 505f77f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.itachi1706.droideggs.eggs.honeycomb;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.MotionEvent;
Expand All @@ -32,14 +31,14 @@
public class PlatLogoActivityHONEYCOMB extends AppCompatActivity {

Toast mToast;
int BGCOLOR = 0xD0000000;
int bgColor = 0xD0000000;

@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences pref = getSharedPreferences("preferenceggs", Context.MODE_PRIVATE);

super.onCreate(savedInstanceState);

getWindow().getDecorView().setBackgroundColor(BGCOLOR);
getWindow().getDecorView().setBackgroundColor(bgColor);

mToast = Toast.makeText(this, "REZZZZZZZ...", Toast.LENGTH_SHORT);

Expand All @@ -58,10 +57,8 @@ protected void onPostCreate(Bundle savedInstanceState) {

Boolean forcePort = getSharedPreferences("preferenceggs", Context.MODE_PRIVATE).getBoolean("hc_force_port", false);

if (forcePort == true) {

if (Boolean.TRUE.equals(forcePort)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ public class FlyingCat extends ImageView {
public static final float VMAX = 1000.0f;
public static final float VMIN = 100.0f;

public float v, vr;

public float dist;
public float z;

public ComponentName component;
private float v;
private float z;

public FlyingCat(Context context, AttributeSet as) {
super(context, as);
Expand All @@ -94,13 +90,9 @@ public void reset() {
setY(randfrange(0, Board.this.getHeight()-scale*getHeight()));
v = lerp(VMIN, VMAX, z);

dist = 0;

// android.util.Log.d("Nyandroid", "reset cat: " + this);
}

public void update(float dt) {
dist += v * dt;
setX(getX() + v * dt);
}
}
Expand All @@ -116,7 +108,6 @@ public Board(Context context, AttributeSet as) {
}

private void reset() {
// android.util.Log.d("Nyandroid", "board reset");
removeAllViews();

final ViewGroup.LayoutParams wrap = new ViewGroup.LayoutParams(
Expand Down Expand Up @@ -157,7 +148,6 @@ private void reset() {
mAnim = new TimeAnimator();
mAnim.setTimeListener((animation, totalTime, deltaTime) -> {
// setRotation(totalTime * 0.01f); // not as cool as you would think
// android.util.Log.d("Nyandroid", "t=" + totalTime);

for (int i=0; i<getChildCount(); i++) {
View v = getChildAt(i);
Expand All @@ -180,7 +170,6 @@ private void reset() {
@Override
protected void onSizeChanged (int w, int h, int oldw, int oldh) {
super.onSizeChanged(w,h,oldw,oldh);
// android.util.Log.d("Nyandroid", "resized: " + w + "x" + h);
post(() -> {
reset();
mAnim.start();
Expand All @@ -200,7 +189,6 @@ public boolean isOpaque() {
}
}

private Board mBoard;

@Override
public void onStart() {
Expand All @@ -214,6 +202,7 @@ public void onStart() {

@Override
public void onResume() {
Board mBoard;
super.onResume();
mBoard = new Board(this, null);
setContentView(mBoard);
Expand All @@ -229,7 +218,6 @@ public void onResume() {

@Override
public void onUserInteraction() {
// android.util.Log.d("Nyandroid", "finishing on user interaction");
stopNyan();
finish();
}
Expand Down

0 comments on commit 505f77f

Please sign in to comment.