Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/jaredkotoff/WiFiList
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcat committed Apr 26, 2024
2 parents 5bbffd2 + 460bd80 commit ddc4611
Show file tree
Hide file tree
Showing 16 changed files with 233 additions and 212 deletions.
68 changes: 68 additions & 0 deletions .github/actions/build-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build (debug)
description: Builds debugging android apk
inputs:
KEYSTORE_BASE_64:
description: 'secrets.KEYSTORE_BASE_64'
required: false
RELEASE_KEYSTORE_ALIAS:
description: 'secrets.RELEASE_KEYSTORE_ALIAS'
required: false
RELEASE_KEYSTORE_PASSWORD:
description: 'secrets.RELEASE_KEYSTORE_PASSWORD'
required: false
RELEASE_KEY_PASSWORD:
description: 'secrets.RELEASE_KEY_PASSWORD'
required: false
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
cache: 'gradle'
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Download modified 33-34 SDK android.jar files
run: |
TARGET="$ANDROID_SDK_ROOT/platforms"
SOURCE='https://github.com/Reginer/aosp-android-jar/raw/main'
curl -Lo "$TARGET/android-33/android.jar" "$SOURCE/android-33/android.jar"
curl -Lo "$TARGET/android-34/android.jar" "$SOURCE/android-34/android.jar"
shell: bash

- name: Set APP_NAME
shell: bash
run: |
# Setup GITHUB_SHA
if [[ "$GITHUB_EVENT_NAME" = 'pull_request' ]]; then
GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA
fi
GITHUB_SHA="${GITHUB_SHA:0:7}"
# App/apk name
APP_NAME="${{ github.event.repository.name }}-${GITHUB_SHA}"
echo APP_NAME="$APP_NAME" >> "$GITHUB_ENV"
- name: Build Debug
if: ${{ github.event_name != 'release' }}
uses: ./.github/actions/build-debug

- name: Build Release
if: ${{ github.event_name == 'release' }}
uses: ./.github/actions/build-release
with:
KEYSTORE_BASE_64: ${{ inputs.KEYSTORE_BASE_64 }}
RELEASE_KEYSTORE_ALIAS: ${{ inputs.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_PASSWORD: ${{ inputs.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEY_PASSWORD: ${{ inputs.RELEASE_KEY_PASSWORD }}


- name: Upload Release Build to Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}
path: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk
37 changes: 1 addition & 36 deletions .github/actions/build-debug/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,11 @@ description: Builds debugging android apk
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Download modified 33-34 SDK android.jar files
run: |
TARGET="$ANDROID_SDK_ROOT/platforms"
SOURCE='https://github.com/Reginer/aosp-android-jar/raw/main'
curl -Lo "$TARGET/android-33/android.jar" "$SOURCE/android-33/android.jar"
curl -Lo "$TARGET/android-34/android.jar" "$SOURCE/android-34/android.jar"
shell: bash

- name: Set APP_NAME
shell: bash
run: |
# Setup GITHUB_SHA
if [[ "$GITHUB_EVENT_NAME" = 'pull_request' ]]; then
GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA
fi
GITHUB_SHA="${GITHUB_SHA:0:7}"
# App/apk name
APP_NAME="${{ github.event.repository.name }}-${GITHUB_SHA}"
echo APP_NAME="$APP_NAME" >> "$GITHUB_ENV"
- name: Set BUILD_DIR
shell: bash
run: echo BUILD_DIR="app/build/outputs/apk/debug" >> "$GITHUB_ENV"

- uses: actions/checkout@v4
- name: Build debug apk
shell: bash
run: |
Expand All @@ -45,9 +16,3 @@ runs:
# - name: Build debug bundle
# run: ./gradlew bundleDebug --no-daemon

- name: Upload Release Build to Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}
path: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk
59 changes: 19 additions & 40 deletions .github/actions/build-release/action.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
name: Build (release)
description: Builds signed release android apk
inputs:
KEYSTORE_BASE_64:
description: 'secrets.KEYSTORE_BASE_64'
required: true
RELEASE_KEYSTORE_ALIAS:
description: 'secrets.RELEASE_KEYSTORE_ALIAS'
required: true
RELEASE_KEYSTORE_PASSWORD:
description: 'secrets.RELEASE_KEYSTORE_PASSWORD'
required: true
RELEASE_KEY_PASSWORD:
description: 'secrets.RELEASE_KEY_PASSWORD'
required: true

runs:
using: composite
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Download modified 33-34 SDK android.jar files
run: |
TARGET="$ANDROID_SDK_ROOT/platforms"
SOURCE='https://github.com/Reginer/aosp-android-jar/raw/main'
curl -Lo "$TARGET/android-33/android.jar" "$SOURCE/android-33/android.jar"
curl -Lo "$TARGET/android-34/android.jar" "$SOURCE/android-34/android.jar"
shell: bash

- name: Set APP_NAME
shell: bash
run: |
# Setup GITHUB_SHA
if [[ "$GITHUB_EVENT_NAME" = 'pull_request' ]]; then
GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA
fi
GITHUB_SHA="${GITHUB_SHA:0:7}"
# App/apk name
APP_NAME="${{ github.event.repository.name }}-${GITHUB_SHA}"
echo APP_NAME="$APP_NAME" >> "$GITHUB_ENV"
- name: Set BUILD_DIR
shell: bash
run: echo BUILD_DIR="app/build/outputs/apk/release" >> "$GITHUB_ENV"

- uses: actions/checkout@v4
- name: Build release apk
shell: bash
run: |
Expand All @@ -52,10 +37,10 @@ runs:
id: sign_app
with:
releaseDirectory: ${{ env.BUILD_DIR }}
signingKeyBase64: ${{ secrets.KEYSTORE_BASE_64 }}
alias: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
keyStorePassword: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.RELEASE_KEY_PASSWORD }}
signingKeyBase64: ${{ inputs.KEYSTORE_BASE_64 }}
alias: ${{ inputs.RELEASE_KEYSTORE_ALIAS }}
keyStorePassword: ${{ inputs.RELEASE_KEYSTORE_PASSWORD }}
keyPassword: ${{ inputs.RELEASE_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

Expand All @@ -64,9 +49,3 @@ runs:
with:
name: ${{ env.APP_NAME }}
path: ${{steps.sign_app.outputs.signedReleaseFile}}

- name: Upload Release Build to Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}
path: ${{ env.BUILD_DIR }}/${{ env.APP_NAME }}.apk
26 changes: 11 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,26 @@ jobs:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3

build-debug:
build:
needs: validation
if: ${{ github.event_name != 'release' && needs.validation.result == 'success' }}
if: ${{ needs.validation.result == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: local-build-debug
uses: ./.github/actions/build-debug

build-release:
needs: validation
if: ${{ github.event_name == 'release' && needs.validation.result == 'success' && (github.event_name != 'push' || !startsWith(github.event.head_commit.message, '[skip ci]')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: local-build-release
uses: ./.github/actions/build-release
- name: local-build-action
uses: ./.github/actions/build-android
with:
KEYSTORE_BASE_64: ${{ secrets.KEYSTORE_BASE_64 }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}

upload:
name: Upload release
runs-on: ubuntu-latest
needs: build-release
needs: build

if: ${{ needs.build-release.result == 'success' }}
if: ${{ github.event_name == 'release' && needs.build.result == 'success' }}

steps:
- uses: actions/download-artifact@v4
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "tk.zwander.wifilist"
minSdk = 30
targetSdk = 34
versionCode = 12
versionName = "1.3.1"
versionCode = 13
versionName = "1.3.2"

vectorDrawables {
useSupportLibrary = true
Expand All @@ -25,11 +25,11 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
buildFeatures {
compose = true
Expand Down

This file was deleted.

27 changes: 19 additions & 8 deletions app/src/main/java/tk/zwander/wifilist/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandIn
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkOut
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand Down Expand Up @@ -57,6 +61,7 @@ import tk.zwander.wifilist.util.Preferences.cachedInfo
import tk.zwander.wifilist.util.Preferences.updateCachedInfo
import tk.zwander.wifilist.util.hasShizukuPermission
import tk.zwander.wifilist.util.launchUrl
import tk.zwander.wifilist.util.plus

class MainActivity : AppCompatActivity(),
Shizuku.OnRequestPermissionResultListener,
Expand Down Expand Up @@ -274,19 +279,21 @@ fun MainContent(networks: List<WifiConfiguration>) {
val exportLaunchers = rememberExportChoiceLaunchers(choices = exportChoices)

WiFiListTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize()
.navigationBarsPadding()
.imePadding(),
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Scaffold(
bottomBar = {
BottomAppBar(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxWidth()
.imePadding(),
) {
AnimatedVisibility(visible = !searchExpanded) {
AnimatedVisibility(
visible = !searchExpanded,
enter = fadeIn() + expandIn(expandFrom = Alignment.CenterStart),
exit = fadeOut() + shrinkOut(shrinkTowards = Alignment.CenterStart),
) {
Text(
text = stringResource(id = R.string.saved_wifi_networks),
modifier = Modifier.padding(start = 16.dp),
Expand All @@ -312,7 +319,11 @@ fun MainContent(networks: List<WifiConfiguration>) {
tint = MaterialTheme.colorScheme.onSurface,
)

AnimatedVisibility(visible = !searchExpanded) {
AnimatedVisibility(
visible = !searchExpanded,
enter = fadeIn() + expandIn(expandFrom = Alignment.CenterEnd),
exit = fadeOut() + shrinkOut(shrinkTowards = Alignment.CenterEnd),
) {
IconButton(onClick = { showingPopup = !showingPopup }) {
Icon(
imageVector = Icons.Default.Menu,
Expand All @@ -334,7 +345,7 @@ fun MainContent(networks: List<WifiConfiguration>) {
},
) { padding ->
LazyVerticalStaggeredGrid(
contentPadding = padding,
contentPadding = padding + PaddingValues(horizontal = 8.dp),
columns = StaggeredGridCells.Adaptive(minSize = 400.dp),
) {
items(
Expand Down
Loading

0 comments on commit ddc4611

Please sign in to comment.