Skip to content

Commit

Permalink
Changes for targetSdkVersion >= 31
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeveid committed Jan 3, 2023
1 parent 50a0dcb commit cbff174
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 14 deletions.
1 change: 1 addition & 0 deletions AndroidManifestBadminton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- for initiating and cancelling device discovery, and initiating connections -->
<!-- bluetooth (Android 12 upwards) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->

Expand Down
1 change: 1 addition & 0 deletions AndroidManifestRacketlon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- for initiating and cancelling device discovery, and initiating connections -->
<!-- bluetooth (Android 12 upwards) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->

Expand Down
4 changes: 3 additions & 1 deletion AndroidManifestSquore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
-->
<!-- bluetooth (Android 12 upwards) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />-->

<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->

Expand Down
1 change: 1 addition & 0 deletions AndroidManifestTabletennis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- for initiating and cancelling device discovery, and initiating connections -->
<!-- bluetooth (Android 12 upwards) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->

Expand Down
1 change: 1 addition & 0 deletions AndroidManifestTennisPadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- for initiating and cancelling device discovery, and initiating connections -->
<!-- bluetooth (Android 12 upwards) -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ android {
minSdkVersion 19
targetSdkVersion 33
multiDexEnabled true // required since using firebase
versionCode 1915 * 10000 + 493
versionCode 1915 * 10000 + 494
versionName "4.50"
}
phoneTabletPost23 {
dimension "devicetype"
minSdkVersion 23
targetSdkVersion 33
versionCode 2315 * 10000 + 493
versionCode 2315 * 10000 + 494
versionName "4.50"
}
wearOs {
dimension "devicetype"
minSdkVersion 25 // 25 for Wear2.0 (23 would suffice for Wear1.0)
targetSdkVersion 33
versionCode 2501 * 10000 + 493
versionCode 2501 * 10000 + 494
versionName "4.50"
}
}
Expand Down
4 changes: 2 additions & 2 deletions res/values-es/sbstrings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
<string name="Score">Puntuación</string>
<string name="Game">Juego</string>

<string name="left_serveside_single_char">R</string>
<string name="right_serveside_single_char">D</string>
<string name="left_serveside_single_char">I</string> <!-- Izquierda -->
<string name="right_serveside_single_char">D</string> <!-- Derecha -->

<string name="oa_handout">Hand-out</string>
<string name="lbl_all_games">Todos los juegos</string>
Expand Down
3 changes: 3 additions & 0 deletions res/values-fr/general.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="lbl_left">Gauche</string>
<string name="lbl_right">Droit</string>

<string name="fetching_data">Récupération des données…</string>
<string name="loading">Chargement en cours…</string>
<string name="loading_of_x">Chargement de %1$s… (%2$s)</string>
Expand Down
3 changes: 3 additions & 0 deletions res/values-it/general.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources tools:ignore="MissingTranslation" xmlns:tools="http://schemas.android.com/tools">
<string name="lbl_left">Sinistra</string>
<string name="lbl_right">Destra</string>

<string name="fetching_data">Recuperando dati…</string>
<string name="loading">Caricamento in corso…</string>
<string name="loading_of_x">Caricamento di %1$s… (%2$s)</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,11 @@ private void updateSponsor(Context context) {
boolean bShow = PreferenceValues.castScreenShowSponsor(context);
if ( bShow && StringUtil.isNotEmpty(sSponsorURL) ) {
sSponsorURL = URLFeedTask.prefixWithBaseIfRequired(sSponsorURL);
sSponsorURL = String.format(sSponsorURL, Brand.brand);
try {
sSponsorURL = String.format(sSponsorURL, Brand.brand);
} catch (Exception e) {
// Sorry, the sponsor url can not be used, message?
}
} else {
sSponsorURL = "";
}
Expand Down
24 changes: 19 additions & 5 deletions src/com/doubleyellow/scoreboard/main/ScoreBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7113,18 +7113,32 @@ private void setupBluetoothControl(boolean bStartTimer) {
e.printStackTrace();
}

PreferenceValues.Permission hasPermission = PreferenceValues.doesUserHavePermissionToBluetoothConnect(this, true);
if ( PreferenceValues.Permission.Granted.equals(hasPermission) == false ) {
return;
}
PreferenceValues.Permission hasPermission2 = PreferenceValues.doesUserHavePermissionToBluetoothScan(this, true);
if ( PreferenceValues.Permission.Granted.equals(hasPermission2) == false ) {
return;
}
PreferenceValues.Permission hasPermission3 = PreferenceValues.doesUserHavePermissionToBluetoothAdmin(this, true);
if ( PreferenceValues.Permission.Granted.equals(hasPermission3) == false ) {
return;
}
/*
PreferenceValues.Permission hasPermission4 = PreferenceValues.doesUserHavePermissionToBluetoothAdvertise(this, true);
if ( PreferenceValues.Permission.Granted.equals(hasPermission4) == false ) {
return;
}
*/

SelectDeviceDialog selectDevice = new SelectDeviceDialog(this, matchModel, this);
int[] iResIds = selectDevice.getBluetoothDevices(true);
if ( iResIds == null ) {
addToDialogStack(selectDevice);
} else {
// show dialog with info about how to solve/help/why
MyDialogBuilder.dialogWithOkOnly(this, iResIds[0], iResIds[1], false);

PreferenceValues.Permission hasPermission = PreferenceValues.doesUserHavePermissionToBluetoothConnect(this, true);
if ( PreferenceValues.Permission.Granted.equals(hasPermission) == false ) {
return;
}
}
/*
Intent nm = new Intent(this, DeviceListActivity.class);
Expand Down
4 changes: 3 additions & 1 deletion src/com/doubleyellow/scoreboard/model/GSMModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,9 @@ public String translateScore(Player player, int iScore) {
return String.valueOf(iScore);
} else {
int iScoreOther = getScore(player.getOther());
if ( iScore < NUMBER_OF_POINTS_TO_WIN_GAME ) {
if ( iScore < 0 ) {
return String.valueOf(iScore); // ?? seen this happen according to playstore. negative handicap maybe?
} else if ( iScore < NUMBER_OF_POINTS_TO_WIN_GAME ) {
return lTranslatedScores.get(iScore);
} else {
// compare with opponent
Expand Down
14 changes: 13 additions & 1 deletion src/com/doubleyellow/scoreboard/prefs/PreferenceValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ public static File targetDirForImportExport(Context context, boolean bForImport)
return fDir;
}

private static final String NO_SHOWCASE_FOR_VERSION_BEFORE = "2022-07-04"; // auto adjusted by shell script 'clean.and.assemble.sh'
private static final String NO_SHOWCASE_FOR_VERSION_BEFORE = "2023-01-04"; // auto adjusted by shell script 'clean.and.assemble.sh'
public static boolean currentDateIsTestDate() {
return DateUtil.getCurrentYYYY_MM_DD().compareTo(NO_SHOWCASE_FOR_VERSION_BEFORE) < 0;
}
Expand Down Expand Up @@ -2376,6 +2376,18 @@ public static Permission doesUserHavePermissionToWriteExternalStorage(Context co
public static Permission doesUserHavePermissionToBluetooth(Context context, boolean bRequestIfRequired) {
return requestPermission(context, PreferenceKeys.enableScoringByBluetoothConnection, Manifest.permission.BLUETOOTH, bRequestIfRequired);
}
public static Permission doesUserHavePermissionToBluetoothConnect(Context context, boolean bRequestIfRequired) {
return requestPermission(context, PreferenceKeys.enableScoringByBluetoothConnection, Manifest.permission.BLUETOOTH_CONNECT, bRequestIfRequired);
}
public static Permission doesUserHavePermissionToBluetoothScan(Context context, boolean bRequestIfRequired) {
return requestPermission(context, PreferenceKeys.enableScoringByBluetoothConnection, Manifest.permission.BLUETOOTH_SCAN, bRequestIfRequired);
}
public static Permission doesUserHavePermissionToBluetoothAdvertise(Context context, boolean bRequestIfRequired) {
return requestPermission(context, PreferenceKeys.enableScoringByBluetoothConnection, Manifest.permission.BLUETOOTH_ADVERTISE, bRequestIfRequired);
}
public static Permission doesUserHavePermissionToBluetoothAdmin(Context context, boolean bRequestIfRequired) {
return requestPermission(context, PreferenceKeys.enableScoringByBluetoothConnection, Manifest.permission.BLUETOOTH_ADMIN, bRequestIfRequired);
}
public static boolean initializeForScoringWithMediaControlButtons(Context context) {
return getBoolean(PreferenceKeys.allowForScoringWithBlueToothConnectedMediaControlButtons, context, false);
}
Expand Down

0 comments on commit cbff174

Please sign in to comment.