Skip to content

Commit

Permalink
Improvements building different brands
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeveid committed Jun 23, 2024
1 parent af7cb4e commit 0462536
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 28 deletions.
6 changes: 3 additions & 3 deletions AndroidManifestBadminton.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.doubleyellow.badminton">
<!-- PlayStoreID=4974076001360456618 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- package="com.doubleyellow.badminton" -->
<!-- PlayStoreID=4974076001360456618 -->

<!-- auto added by ?? so specifically remove it -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
Expand Down
4 changes: 2 additions & 2 deletions AndroidManifestRacketlon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.doubleyellow.racketlon">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- package="com.doubleyellow.racketlon" -->
<!-- PlayStoreID=4973204554147732137 -->

<!-- auto added by ?? so specifically remove it -->
Expand Down
4 changes: 2 additions & 2 deletions AndroidManifestSquore.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.doubleyellow.scoreboard">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- package="com.doubleyellow.scoreboard" -->
<!-- PlayStoreID=4972255383319852172 -->

<!-- auto added by ?? so specifically remove it -->
Expand Down
4 changes: 2 additions & 2 deletions AndroidManifestTabletennis.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.doubleyellow.tabletennis">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- package="com.doubleyellow.tabletennis" -->
<!-- PlayStoreID=4975506867766261096 -->

<!-- auto added by ?? so specifically remove it -->
Expand Down
4 changes: 2 additions & 2 deletions AndroidManifestTennisPadel.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.doubleyellow.tennispadel">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- package="com.doubleyellow.tennispadel" -->
<!-- PlayStoreID=4972207514792479457 -->

<!-- auto added by ?? so specifically remove it -->
Expand Down
19 changes: 10 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
// NOTE: Resource IDs will be non-final by default in Android Gradle Plugin version 8.0, avoid using them in switch case statements

// added for firebase to parse google-services.json
classpath 'com.google.gms:google-services:4.3.8' // 4.3.5 ok, 4.3.10 breaks
classpath 'com.google.gms:google-services:4.4.2'
}
}
repositories {
Expand All @@ -30,6 +30,8 @@ repositories {
}
// Run ./gradlew -q :dependencies
android {
namespace 'com.doubleyellow.scoreboard'

compileOptions {
// added when going from 1.1.9 to androidx.wear:wear:1.2.0
sourceCompatibility 1.8
Expand Down Expand Up @@ -180,8 +182,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // this one is not actually required, but removing it makes com.doubleyellow.scoreboard.history.MatchGameScoresView in portrait spacing incorrect?!
implementation 'com.android.support.constraint:constraint-layout:2.0.4'

implementation 'androidx.appcompat:appcompat:1.6.1' // moving from 1.3.1 to 1.4.0 makes e.g. Wear OS in emulator fail
// not required for building, BUT required for runtime when using newer gradle (20191022)
implementation 'androidx.appcompat:appcompat:1.6.1' // moving from 1.3.1 to 1.4.0 makes e.g. Wear OS in emulator fail, 1.7.0 made build fail it seems (20240606)

//implementation 'androidx.legacy:legacy-support-v13:1.0.0'

Expand All @@ -190,14 +191,14 @@ dependencies {
implementation 'androidx.core:core-splashscreen:1.0.1'

// ChromeCast (new with Custom Receiver)
phoneTabletPre22Implementation 'com.google.android.gms:play-services-cast-framework:21.4.0'
phoneTabletPost23Implementation 'com.google.android.gms:play-services-cast-framework:21.4.0'
wearOsImplementation 'com.google.android.gms:play-services-cast-framework:21.4.0' // wearOs can not cast but to run it still needs 'Implementation' to not have 'ClassNotFound' exceptions
phoneTabletPre22Implementation 'com.google.android.gms:play-services-cast-framework:21.5.0'
phoneTabletPost23Implementation 'com.google.android.gms:play-services-cast-framework:21.5.0'
wearOsImplementation 'com.google.android.gms:play-services-cast-framework:21.5.0' // wearOs can not cast but to run it still needs 'Implementation' to not have 'ClassNotFound' exceptions

// allow communication between handheld device and wearable
phoneTabletPre22CompileOnly 'com.google.android.gms:play-services-wearable:18.1.0' // compileOnly is good enough for API < 23
phoneTabletPost23Implementation 'com.google.android.gms:play-services-wearable:18.1.0'
wearOsImplementation 'com.google.android.gms:play-services-wearable:18.1.0'
phoneTabletPre22CompileOnly 'com.google.android.gms:play-services-wearable:18.2.0' // compileOnly is good enough for API < 23
phoneTabletPost23Implementation 'com.google.android.gms:play-services-wearable:18.2.0'
wearOsImplementation 'com.google.android.gms:play-services-wearable:18.2.0'

phoneTabletPre22CompileOnly 'com.google.android.support:wearable:2.9.0'
phoneTabletPost23Implementation 'com.google.android.support:wearable:2.9.0'
Expand Down
30 changes: 23 additions & 7 deletions change.R.package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

defaultTimeout=2

# derive allowed brands from existing Manifest files
allowedInput=$(ls -1 AndroidManifest*.xml | grep -v ALL | perl -ne 's~AndroidManifest(.+).xml~$1~; print' | sort )

Expand Down Expand Up @@ -31,20 +33,24 @@ Allowed are: ${allowedInput}
exit
else
brandPkg=$(grep package= ${brandMfFile} | perl -ne 's~.*"([a-z\.]+)".*~$1~; print')
if [[ -z "$brandPkg" ]]; then
echo "Could not determine package from ${brandMfFile}"
exit
fi
read -t 2 -p "New package ${brandPkg}"
fi

if [[ -z "${parentBrand}" ]]; then
parentBrand="$(cat ${brandMfFile} | grep parentBrand | sed -e 's~parentBrand\s*=\s*~~' | tr -d ' ')"
read -t 1 -p "Backup brand from ${brandMfFile} ==> '${parentBrand}'. Continuing...."
read -t $defaultTimeout -p "Backup brand from ${brandMfFile} ==> '${parentBrand}'. Continuing...."
echo
fi

function correctSportSpecificResource {
from=$1
to=$2

read -t 1 -p "Correcting from ${from} to ${to}. Continue ?"
read -t $defaultTimeout -p "Correcting from ${from} to ${to}. Continue ?"
echo

echo -n > notcorrected.txt
Expand All @@ -59,7 +65,7 @@ function correctSportSpecificResource {
if echo ${res} | grep -q "__${from}"; then
nrOfOccurrencesAsExpr=$(grep -E -h -c -r "@.*${res}" * | grep -E -v '^0$' | xargs | sed -e 's/\ /+/g')
nrOfOccurrences=$((${nrOfOccurrencesAsExpr}))
#read -t 3 -p "Nr of occurrences of valid ${res} : ${nrOfOccurrences}"
#read -t $defaultTimeout -p "Nr of occurrences of valid ${res} : ${nrOfOccurrences}"
let keptCnt=keptCnt+nrOfOccurrences
printf "%2d (+%d) %-72s OK \n" ${keptCnt} ${nrOfOccurrences} ${res} >> notcorrected.txt
fi
Expand Down Expand Up @@ -119,7 +125,7 @@ fi

# derive current package by looking for .R reference in Brand.java
pkgFrom=$(grep -E 'import[ ]+.*\.R;' com/doubleyellow/scoreboard/main/ScoreBoard.java | perl -ne 's~import\s+([\w\.]+)\.R;~\1~; print')
read -t 2 -p "From package ${pkgFrom}"
read -t $defaultTimeout -p "From package ${pkgFrom}"
if [[ -z "${pkgFrom}" ]]; then
echo "Could not determine 'from' package"
exit 1
Expand Down Expand Up @@ -151,6 +157,7 @@ touch -t "${oldFileTime}" ${f}
####################################################
# Change <other>.java
####################################################
read -t $defaultTimeout -p "Brand.java adapted. Continue?"

echo '=================================='
printf "Change to '${tobranded}'\n"
Expand All @@ -172,7 +179,7 @@ for f in $(grep -E -irl "${pkgFrom}\.R[^a-z]" *); do
touch -t "${oldFileTime}" ${f}
done
echo '=================================='
#read -t 10 -p ' Java files changed. Continue ... ? '
read -t $defaultTimeout -p ' Java files changed. Continue ... ? '

# change some defaults in xml files (in java is/should be taken care of by means of code)
cd ../res
Expand Down Expand Up @@ -200,11 +207,11 @@ for f in $(grep -E -rl "@(string|fraction|color).*__${fromSuffix}\""); do
else
rm ${f}.1.xml
fi
#read -t 10 -p ' Continue ? '
#read -t $defaultTimeout -p ' Continue ? '
touch -t "${oldFileTime}" ${f}
done
echo '=================================='
#read -t 10 -p 'menu/layout/preferences files processed. Continue ? '
#read -t $defaultTimeout -p 'menu/layout/preferences files processed. Continue ? '
if [[ -e correctSportSpecificResource.txt ]]; then
rm -v correctSportSpecificResource.txt
fi
Expand Down Expand Up @@ -245,4 +252,13 @@ if [[ -n "$(diff ${f}.tmp ${f})" ]]; then
else
rm ${f}.tmp
fi

# change 'namespace "com.doubleyellow.tennispadel"'
cat ${f} | perl -ne "s~(namespace\s+')${pkgFrom}(')~\1${brandPkg}\2~; print" > ${f}.tmp
if [[ -n "$(diff ${f}.tmp ${f})" ]]; then
mv ${f}.tmp ${f}
else
rm ${f}.tmp
fi

touch -t "${oldFileTime}" ${f}
2 changes: 1 addition & 1 deletion res/values/defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ http://developer.android.com/guide/practices/screens_support.html
<integer name="speechOverBT_speechOverBT_PlayingVolumeToKeepAlive_default">20</integer>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__Squash">false</bool>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__TennisPadel">true</bool>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__TableTennis">true</bool>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__Tabletennis">true</bool>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__Badminton">true</bool>
<bool name="speechOverBT_PlayWhiteNoiseSoundFileToKeepAlive_default__Racketlon">true</bool>

Expand Down

0 comments on commit 0462536

Please sign in to comment.