Skip to content

Commit

Permalink
Merge pull request #220 from mjaun/feature/update_android
Browse files Browse the repository at this point in the history
Update Android
  • Loading branch information
mjaun authored Aug 17, 2024
2 parents 49db680 + dde4008 commit bed769a
Show file tree
Hide file tree
Showing 69 changed files with 186 additions and 222 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ insert_final_newline = true
charset = utf-8

# Tab indentation
[makefile,Makefile]
[Makefile]
indent_style = tab
## PEP 0008 https://www.python.org/dev/peps/pep-0008/
[*.py]
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build*

app/*.apk
Expand Down
15 changes: 7 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33

defaultConfig {
applicationId "ch.logixisland.anuto"
minSdkVersion 17
targetSdkVersion 33
versionCode 32
versionName "0.11"
compileSdk 34
minSdkVersion 23
targetSdkVersion 35
versionCode 33
versionName "0.12"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand All @@ -30,6 +29,6 @@ android {

dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test:rules:1.6.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ private void tryEnhanceTower() {

while (iterator.hasNext()) {
Tower tower = iterator.next();
final int tier = mTowerTiers.getTowerTier(tower);

// check if enhancing is possible
if (!tower.isEnhanceable()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ch.logixisland.anuto;

import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Rule;
Expand All @@ -15,7 +15,7 @@
public class IntegrationTest {

@Rule
public ActivityTestRule<GameActivity> mActivityRule = new ActivityTestRule<>(GameActivity.class);
public ActivityScenarioRule<GameActivity> mActivityRule = new ActivityScenarioRule<>(GameActivity.class);

@Test
public void integrationTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface Listener {
private boolean mGameStarted = false;
private int mFinalScore = 0;

private List<Listener> mListeners = new CopyOnWriteArrayList<>();
private final List<Listener> mListeners = new CopyOnWriteArrayList<>();

public GameState(ScoreBoard scoreBoard, HighScores highScores, TowerSelector towerSelector) {
mScoreBoard = scoreBoard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public class MapInfo {

private String mMapId;
private int mMapNameResId;
private int mMapDataResId;
private final String mMapId;
private final int mMapNameResId;
private final int mMapDataResId;

MapInfo(String mapId, int mapNameResId, int mapDataResId) {
mMapId = mapId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.logixisland.anuto.business.game;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Expand Down Expand Up @@ -54,7 +53,6 @@ public List<SaveGameInfo> getSaveGameInfos() {
public SaveGameInfo createSaveGame(Bitmap screenshot, int score, int wave, int lives) {
Date date = new Date();

@SuppressLint("SimpleDateFormat")
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
File folder = new File(mContext.getFilesDir() + File.separator
+ "savegame" + File.separator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

public class TowerInfo {

private int mValue;
private int mLevel;
private int mLevelMax;
private boolean mEnhanceable;
private int mEnhanceCost;
private boolean mUpgradeable;
private int mUpgradeCost;
private boolean mSellable;
private boolean mCanLockTarget;
private final int mValue;
private final int mLevel;
private final int mLevelMax;
private final boolean mEnhanceable;
private final int mEnhanceCost;
private final boolean mUpgradeable;
private final int mUpgradeCost;
private final boolean mSellable;
private final boolean mCanLockTarget;
private boolean mDoesLockTarget;
private boolean mHasStrategy;
private final boolean mHasStrategy;
private TowerStrategy mStrategy;
private List<TowerInfoValue> mProperties;
private final List<TowerInfoValue> mProperties;

public TowerInfo(Tower tower, int credits, boolean controlsEnabled) {
mValue = tower.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface Listener {

private Tower mInsertedTower;
private Plateau mCurrentPlateau;
private Collection<Listener> mListeners = new CopyOnWriteArrayList<>();
private final Collection<Listener> mListeners = new CopyOnWriteArrayList<>();

public TowerInserter(GameEngine gameEngine, GameState gameState, EntityRegistry entityRegistry,
TowerSelector towerSelector, TowerAging towerAging, ScoreBoard scoreBoard) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface Listener {
private TowerInfo mTowerInfo;
private Tower mSelectedTower;

private Collection<Listener> mListeners = new CopyOnWriteArrayList<>();
private final Collection<Listener> mListeners = new CopyOnWriteArrayList<>();

public TowerSelector(GameEngine gameEngine, ScoreBoard scoreBoard) {
mGameEngine = gameEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WaveAttender implements Enemy.Listener {
private final List<MapPath> mPaths;
private final Collection<Enemy> mRemainingEnemies = new ArrayList<>();

private int mWaveNumber;
private final int mWaveNumber;
private int mWaveStartTickCount;

private int mExtend;
Expand Down Expand Up @@ -78,7 +78,7 @@ void modifyEnemyReward(float modifier) {
}

void modifyWaveReward(float modifier) {
mWaveReward *= modifier;
mWaveReward = (int) ((float) mWaveReward * modifier);
}

void start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import ch.logixisland.anuto.util.container.KeyValueStore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.logixisland.anuto.engine.logic.map;

import java.util.Collections;
import java.util.List;

import ch.logixisland.anuto.util.math.Vector2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ch.logixisland.anuto.engine.logic.map;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import ch.logixisland.anuto.util.container.KeyValueStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class GamePersister {

private List<Persister> mPersisterList = new ArrayList<>();
private final List<Persister> mPersisterList = new ArrayList<>();

public void registerPersister(Persister persister) {
mPersisterList.add(persister);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public interface Listener {
private final Renderer mRenderer;

private Theme mTheme;
private List<Theme> mAvailableThemes = new ArrayList<>();
private final List<Theme> mAvailableThemes = new ArrayList<>();

private List<Listener> mListeners = new CopyOnWriteArrayList<>();
private final List<Listener> mListeners = new CopyOnWriteArrayList<>();

public ThemeManager(Context context, Renderer renderer) {
mRenderer = renderer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import ch.logixisland.anuto.engine.logic.GameEngine;
import ch.logixisland.anuto.engine.logic.entity.Entity;
Expand All @@ -14,8 +12,8 @@

public class AreaObserver implements Entity.Listener {

private Vector2 mPosition;
private float mRange;
private final Vector2 mPosition;
private final float mRange;
private boolean mFinished;

private final GameEngine mGameEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class BouncingLaser extends Effect {
private final static int ALPHA_STEP = (int) (ALPHA_START / (GameEngine.TARGET_FRAME_RATE * VISIBLE_EFFECT_DURATION));

private class LaserDrawable implements Drawable {
private Paint mPaint;
private final Paint mPaint;
private int mAlpha = ALPHA_START;

private LaserDrawable() {
Expand Down Expand Up @@ -56,15 +56,15 @@ public void draw(Canvas canvas) {
}
}

private float mDamage;
private int mBounceCount;
public float mMaxBounceDist;
private final float mDamage;
private final int mBounceCount;
public final float mMaxBounceDist;
private Enemy mOrigin;
private Enemy mTarget;
private final Enemy mTarget;
private Vector2 mTargetPos;
private Collection<Enemy> mPrevTargets;

private LaserDrawable mDrawObject;
private final LaserDrawable mDrawObject;

public BouncingLaser(Entity origin, Vector2 position, Enemy target, float damage) {
this(origin, position, target, damage, 0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum State {
Ended
}

private Entity mOrigin;
private final Entity mOrigin;
private TickTimer mTimer;
private State mState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Explosion extends Effect {
private final static int ALPHA_STEP = (int) (ALPHA_START / (GameEngine.TARGET_FRAME_RATE * EFFECT_DURATION));

private class ExplosionDrawable implements Drawable {
private Paint mPaint;
private final Paint mPaint;
private int mAlpha = ALPHA_START;

private ExplosionDrawable() {
Expand Down Expand Up @@ -52,11 +52,11 @@ public void draw(Canvas canvas) {
}
}

private float mDamage;
private float mRadius;
private final float mDamage;
private final float mRadius;

private ExplosionDrawable mDrawObject;
private Sound mSound;
private final ExplosionDrawable mDrawObject;
private final Sound mSound;

public Explosion(Entity origin, Vector2 position, float damage, float radius) {
super(origin, EFFECT_DURATION);
Expand Down Expand Up @@ -103,9 +103,4 @@ protected void effectBegin() {
enemy.damage(mDamage, getOrigin());
}
}

@Override
protected void effectEnd() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ private static class StaticData {
SpriteTemplate mSpriteTemplate;
}

private float mAngle;
private float mIntensity;
private int mAlphaStep;
private AreaObserver mAreaObserver;
private final float mAngle;
private final float mIntensity;
private final int mAlphaStep;
private final AreaObserver mAreaObserver;

private Paint mPaint;
private StaticSprite mSprite;
private final Paint mPaint;
private final StaticSprite mSprite;

public GlueEffect(Entity origin, Vector2 position, float intensity, float duration) {
super(origin, duration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public void draw(Canvas canvas) {
}
}

private float mRange;
private final float mRange;
private float mDrawRadius;
private float mHealAmount;
private final float mHealAmount;

private Drawable mDrawable;
private Collection<Enemy> mHealedEnemies;
private final Drawable mDrawable;
private final Collection<Enemy> mHealedEnemies;
private StaticData mStaticData;

public HealEffect(Entity origin, Vector2 position, float amount, float radius, Collection<Enemy> healedEnemies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArrayList;

import ch.logixisland.anuto.engine.logic.GameEngine;
import ch.logixisland.anuto.engine.logic.entity.Entity;
Expand All @@ -29,7 +28,7 @@ public class StraightLaser extends Effect {
private final static int ALPHA_STEP = (int) (ALPHA_START / (GameEngine.TARGET_FRAME_RATE * VISIBLE_EFFECT_DURATION));

private class LaserDrawable implements Drawable {
private Paint mPaint;
private final Paint mPaint;
private int mAlpha = ALPHA_START;

public LaserDrawable() {
Expand Down Expand Up @@ -60,11 +59,11 @@ public void draw(Canvas canvas) {
}
}

private float mDamage;
private Vector2 mLaserTo;
private Collection<Flyer> mStunnedFliers = new ArrayList<>();
private final float mDamage;
private final Vector2 mLaserTo;
private final Collection<Flyer> mStunnedFliers = new ArrayList<>();

private LaserDrawable mDrawObject;
private final LaserDrawable mDrawObject;

public StraightLaser(Entity origin, Vector2 position, Vector2 laserTo, float damage) {
super(origin, EFFECT_DURATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public void draw(Canvas canvas) {

private Enemy mTarget;

private float mDistance;
private Vector2 mMoveDirection;
private float mMoveStep;
private TeleportDrawable mDrawObject;
private final float mDistance;
private final Vector2 mMoveDirection;
private final float mMoveStep;
private final TeleportDrawable mDrawObject;
private StaticData mStaticData;

public TeleportEffect(Entity origin, Vector2 position, Enemy target, float distance) {
Expand Down
Loading

0 comments on commit bed769a

Please sign in to comment.