Skip to content

Commit

Permalink
Merge pull request #47 from SecUSo/development
Browse files Browse the repository at this point in the history
Update to version 1.4.0
  • Loading branch information
udenr authored Sep 16, 2024
2 parents b0d3ff2 + 584038f commit 5711d3f
Show file tree
Hide file tree
Showing 36 changed files with 571 additions and 366 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Android Emulator Tests
on: [ push, pull_request ]

jobs:
check-if-tests-exist:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.check-androidTest.outputs.NOT_EMPTY }}
min-sdk-version: ${{ steps.get-sdk-version.outputs.MIN_SDK_VERSION }}
target-sdk-version: ${{ steps.get-sdk-version.outputs.TARGET_SDK_VERSION }}
app-id: ${{ steps.get-app-id.outputs.APP_ID }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Check if androidTest folder is not empty
run: |
echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')"
echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
id: check-androidTest
- name: Get min and target sdk
if: steps.check-androidTest.outputs.NOT_EMPTY == 'true'
id: get-sdk-version
run: |
echo "MIN_SDK_VERSION=$(cat app/build.gradle | grep minSdkVersion | rev | cut -d' ' -f 1 | rev)" >> $GITHUB_OUTPUT
echo "TARGET_SDK_VERSION=$(cat app/build.gradle | grep targetSdkVersion | rev | cut -d' ' -f 1 | rev)" >> $GITHUB_OUTPUT
- name: Get app ID
id: get-app-id
run: |
echo "APP_ID=$(cat app/build.gradle | grep applicationId | rev | cut -d' ' -f 1 | rev | tr -d '"')" >> $GITHUB_OUTPUT
test:
needs: check-if-tests-exist
if: needs.check-if-tests-exist.outputs.status == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [34, "${{ needs.check-if-tests-exist.outputs.min-sdk-version }}", "${{ needs.check-if-tests-exist.outputs.target-sdk-version }}"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/gradle-build-action@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Set up JDK environment
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.api-level >= 30 && 'google_apis' || 'default' }}
arch: ${{ matrix.api-level < 21 && 'x86' || 'x86_64' }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run connected tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.api-level >= 30 && 'google_apis' || 'default' }}
arch: ${{ matrix.api-level < 21 && 'x86' || 'x86_64' }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}} || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.test || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.androidTest || true
chmod +x gradlew
./gradlew :app:connectedCheck --stacktrace
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}} || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.test || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.androidTest || true
3 changes: 2 additions & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Changelog Generation

on:
release:
types: [published, released]
types: [published]
workflow_dispatch:

jobs:
Expand All @@ -16,6 +16,7 @@ jobs:
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
pull_request: true
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_summary_template: 'update changelog for %s changes'
args: -l 2
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,23 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run lint check
run: bash ./gradlew lint

- name: Upload lint result
uses: actions/upload-artifact@v4
with:
name: lint-results-debug
path: app/build/reports/lint-results-debug.html

- name: Build the app
run: bash ./gradlew build --stacktrace
run: bash ./gradlew build --stacktrace

- name: Build debug apk
run: bash ./gradlew assembleDebug

- name: Upload debug apk
uses: actions/upload-artifact@v4
with:
name: debug-apk
path: app/build/outputs/apk/debug/*.apk
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
minSdkVersion 21
targetSdkVersion 34
compileSdk 34
versionCode 7
versionName "1.3.1"
versionCode 8
versionName "1.4.0"
}
buildTypes {
release {
Expand All @@ -36,7 +36,7 @@ android {
}

android.applicationVariants.configureEach { variant ->
variant.outputs.all {
variant.outputs.configureEach {
def appName = "pfa-2048"
outputFileName = appName + "-${variant.name}-v${variant.versionName}.apk"
}
Expand All @@ -56,15 +56,15 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

// Backup
implementation project(path: ':backup-api')
def work_version = "2.9.0"
def work_version = "2.9.1"
implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
androidTestImplementation "androidx.work:work-testing:$work_version"
Expand Down

This file was deleted.

7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,16 @@
android:value="org.secuso.privacyfriendly2048.activities.MainActivity" />
</activity>
<activity
android:exported="true"
android:name=".activities.GameActivity"
android:label="@string/title_activity_game"
android:parentActivityName=".activities.MainActivity">
<intent-filter>
<action android:name="com.samsung.android.support.REMOTE_ACTION" />
</intent-filter>
<meta-data
android:name="com.samsung.android.support.REMOTE_ACTION"
android:resource="@xml/air_actions" />
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.secuso.privacyfriendly2048.activities.MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorInt;
import static org.secuso.privacyfriendly2048.helpers.ThemeResolverKt.GetColorRes;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.util.TypedValue;
import android.view.View;

import org.secuso.privacyfriendly2048.R;
Expand All @@ -50,18 +52,22 @@ public class Element extends androidx.appcompat.widget.AppCompatButton {
public int dPosY = 0;
public boolean activated;
public boolean animateMoving = false;
public float textSize = 24;
Context context;
int color;


@SuppressLint("RestrictedApi")
public Element(Context c) {
super(c);
context = c;
setAllCaps(false);
setTextSize(textSize);
setBackgroundResource(R.drawable.game_brick);
setColor(GetColorRes(context, R.attr.buttonEmpty));
setMaxLines(1);
setAutoSizeTextTypeUniformWithConfiguration(1,
100,
1,
TypedValue.COMPLEX_UNIT_SP);
}

public void drawItem() {
Expand Down Expand Up @@ -136,14 +142,10 @@ public void drawItem() {
case 16384:
setColor(GetColorRes(context, R.attr.button16384));
setTextColor(GetColorInt(context, R.attr.button16384Text));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
case 32768:
setColor(GetColorRes(context, R.attr.button32768));
setTextColor(GetColorInt(context, R.attr.button32768Text));
textSize = textSize * 0.8f;
setTextSize(textSize);
break;
}
}
Expand Down Expand Up @@ -197,11 +199,6 @@ public int getPosY() {
return posY;
}

public void updateFontSize() {
textSize = (float) (getLayoutParams().width / 7.0);
setTextSize(textSize);
}

public Element copy() {
Element temp = new Element(context);
temp.number = number;
Expand All @@ -212,9 +209,7 @@ public Element copy() {
temp.dPosY = dPosY;
temp.activated = activated;
temp.animateMoving = animateMoving;
temp.textSize = textSize;
temp.color = color;
temp.setTextSize(textSize);
//temp.setBackgroundResource(backGroundResource);
temp.setColor(color);
temp.setVisibility(getVisibility());
Expand Down
Loading

0 comments on commit 5711d3f

Please sign in to comment.