Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to SDK 34 #30

Merged
merged 5 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdk 33
namespace "org.secuso.privacyfriendlybattleship"

defaultConfig {
applicationId "org.secuso.privacyfriendlybattleship"
minSdkVersion 17
targetSdkVersion 33
targetSdkVersion 34
compileSdk 34
versionCode 7
versionName "1.2.2"
vectorDrawables.useSupportLibrary = true
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
def appName = "pfa-battleship"
outputFileName = appName + "-${variant.name}-v${variant.versionName}.apk"
}
}
buildFeatures {
buildConfig = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android.applicationVariants.configureEach { variant ->
variant.outputs.all {
def appName = "pfa-battleship"
outputFileName = appName + "-${variant.name}-v${variant.versionName}.apk"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

kotlin {
jvmToolchain(17)
}

lint {
lintConfig = file("lint.xml")
}
}

Expand Down
6 changes: 6 additions & 0 deletions app/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Set the severity of missing translations to warning instead of error -->
<issue id="MissingTranslation" severity="warning" />
<issue id="MissingQuantity" severity="warning" />
</lint>
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,20 @@ private void callDrawerItem(final int itemId) {

Intent intent;

switch(itemId) {
case R.id.nav_main:
intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
case R.id.nav_tutorial:
intent = new Intent(this, TutorialActivity.class);
intent.setAction(ACTION_SHOW_ANYWAYS);
startActivity(intent);
break;
case R.id.nav_about:
intent = new Intent(this, AboutActivity.class);
createBackStack(intent);
break;
case R.id.nav_help:
intent = new Intent(this, HelpActivity.class);
createBackStack(intent);
break;
default:
if (itemId == R.id.nav_main) {
intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else if (itemId == R.id.nav_tutorial) {
intent = new Intent(this, TutorialActivity.class);
intent.setAction(ACTION_SHOW_ANYWAYS);
startActivity(intent);
} else if (itemId == R.id.nav_about) {
intent = new Intent(this, AboutActivity.class);
createBackStack(intent);
} else if (itemId == R.id.nav_help) {
intent = new Intent(this, HelpActivity.class);
createBackStack(intent);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,50 +255,41 @@ public void onClick(View view) {
GameMode gameMode;
GameController game;

switch(view.getId()) {
case R.id.mode_arrow_left:
viewPagerMode.arrowScroll(View.FOCUS_LEFT);
break;
case R.id.mode_arrow_right:
viewPagerMode.arrowScroll(View.FOCUS_RIGHT);
break;
case R.id.size_arrow_left:
viewPagerSize.arrowScroll(View.FOCUS_LEFT);
break;
case R.id.size_arrow_right:
viewPagerSize.arrowScroll(View.FOCUS_RIGHT);
break;
case R.id.quick_start_button:
// Get the selected game mode and the grid size
modeIndex = viewPagerMode.getCurrentItem();
gameMode = GameMode.getValidTypes().get(modeIndex);
sizeIndex = viewPagerSize.getCurrentItem();
gridSize = GameGrid.getValidSizes().get(sizeIndex);

game = new GameController(gridSize, gameMode);
game.placeAllShips();//place all ships randomly for both players

// send game information to GameActivity
intent = new Intent(this, GameActivity.class);
intent.putExtra("controller", game);
startActivity(intent);
break;
case R.id.action_settings:
// Get the selected game mode and the grid size
modeIndex = viewPagerMode.getCurrentItem();
gameMode = GameMode.getValidTypes().get(modeIndex);
sizeIndex = viewPagerSize.getCurrentItem();
gridSize = GameGrid.getValidSizes().get(sizeIndex);

game = new GameController(gridSize, gameMode);//place all ships randomly for both players

// send game information to ShipSetActivity
intent = new Intent(this, ShipSetActivity.class);
intent.putExtra("controller", game);
startActivity(intent);
break;
default:
break;
if (view.getId() == R.id.mode_arrow_left) {
viewPagerMode.arrowScroll(View.FOCUS_LEFT);
} else if (view.getId() == R.id.mode_arrow_right) {
viewPagerMode.arrowScroll(View.FOCUS_RIGHT);
} else if (view.getId() == R.id.size_arrow_left) {
viewPagerSize.arrowScroll(View.FOCUS_LEFT);
} else if (view.getId() == R.id.size_arrow_right) {
viewPagerSize.arrowScroll(View.FOCUS_RIGHT);
} else if (view.getId() == R.id.quick_start_button) {
// Get the selected game mode and the grid size
modeIndex = viewPagerMode.getCurrentItem();
gameMode = GameMode.getValidTypes().get(modeIndex);
sizeIndex = viewPagerSize.getCurrentItem();
gridSize = GameGrid.getValidSizes().get(sizeIndex);

game = new GameController(gridSize, gameMode);
game.placeAllShips();//place all ships randomly for both players

// send game information to GameActivity
intent = new Intent(this, GameActivity.class);
intent.putExtra("controller", game);
startActivity(intent);
} else if (view.getId() == R.id.action_settings) {
// Get the selected game mode and the grid size
modeIndex = viewPagerMode.getCurrentItem();
gameMode = GameMode.getValidTypes().get(modeIndex);
sizeIndex = viewPagerSize.getCurrentItem();
gridSize = GameGrid.getValidSizes().get(sizeIndex);

game = new GameController(gridSize, gameMode);//place all ships randomly for both players

// send game information to ShipSetActivity
intent = new Intent(this, ShipSetActivity.class);
intent.putExtra("controller", game);
startActivity(intent);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,25 +227,19 @@ public void onClickButton(View view) {
return;

GameCell[] oldCells = this.selectedShip.getShipsCells();
switch (view.getId()) {
case R.id.arrow_right:
this.selectedShip.moveShip(Direction.EAST);
break;
case R.id.arrow_left:
this.selectedShip.moveShip(Direction.WEST);
break;
case R.id.arrow_up:
this.selectedShip.moveShip(Direction.NORTH);
break;
case R.id.arrow_down:
this.selectedShip.moveShip(Direction.SOUTH);
break;
case R.id.rotate_right:
this.selectedShip.turnShipRight();
break;
case R.id.rotate_left:
this.selectedShip.turnShipLeft();
break;

if (view.getId() == R.id.arrow_left) {
this.selectedShip.moveShip(Direction.WEST);
} else if (view.getId() == R.id.arrow_right) {
this.selectedShip.moveShip(Direction.EAST);
} else if (view.getId() == R.id.arrow_up) {
this.selectedShip.moveShip(Direction.NORTH);
} else if (view.getId() == R.id.arrow_down) {
this.selectedShip.moveShip(Direction.SOUTH);
} else if (view.getId() == R.id.rotate_left) {
this.selectedShip.turnShipLeft();
} else if (view.getId() == R.id.rotate_right) {
this.selectedShip.turnShipRight();
}
unhighlightCells(oldCells);
highlightCells(this.selectedShip.getShipsCells());
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ buildscript {
name 'Google'
}
}
ext.kotlin_version = "1.7.20"
ext.kotlin_version = "2.0.21"
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -20,7 +20,7 @@ buildscript {

allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Sun Mar 05 16:27:49 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
Loading
Loading