Skip to content

State Improvements #2

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

Merged
merged 3 commits into from
Apr 12, 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
76 changes: 76 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Lint"

on:
workflow_dispatch:
push:
branches: [master]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Debug event.json"
if: ${{ !cancelled() }}
continue-on-error: true
run: |
cat "${GITHUB_EVENT_PATH}"

- name: "Kotlin Lint"
if: ${{ !cancelled() }}
continue-on-error: true # TODO: Resolve KTLint Issues
env:
klint: ${RUNNER_TEMP}/ktlint
run: |
echo "Output File: ${{ env.klint }}"
wget -q https://github.com/pinterest/ktlint/releases/latest/download/ktlint -O ${{ env.klint }}
file ${{ env.klint }}
chmod +x ${{ env.klint }}
${{ env.klint }} --version
${{ env.klint }} --color 'app/src/main/java/**'

- name: "Prettier"
if: ${{ !cancelled() }}
run: |
echo "::group::Install"
npm install prettier
echo "::endgroup::"
npx prettier --check .

- name: "Yamllint"
if: ${{ !cancelled() }}
env:
CONFIG: "{extends: relaxed, ignore: [node_modules/,.github/disabled/], rules: {line-length: {max: 119}}}"
run: |
echo "::group::List Files"
yamllint -d '${{ env.CONFIG }}' --list-files .
echo "::endgroup::"
yamllint -d '${{ env.CONFIG }}' .

- name: "Actionlint"
if: ${{ !cancelled() }}
run: |
echo "::group::Download"
loc=$(curl -sI https://github.com/rhysd/actionlint/releases/latest | grep -i '^location:')
echo "loc: ${loc}"
tag=$(echo "${loc}" | sed -E 's|.*/tag/v?(.*)|\1|' | tr -d '\t\r\n')
echo "tag: ${tag}"
url="https://github.com/rhysd/actionlint/releases/latest/download/actionlint_${tag}_linux_amd64.tar.gz"
echo "url: ${url}"
curl -sL "${url}" | tar xz -C "${RUNNER_TEMP}" actionlint
file "${RUNNER_TEMP}/actionlint"
"${RUNNER_TEMP}/actionlint" --version
echo "::endgroup::"
"${RUNNER_TEMP}/actionlint" -color -verbose -shellcheck= -pyflakes=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ app/release

local.properties
*.keystore
*.logcat
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![GitHub Downloads](https://img.shields.io/github/downloads/cssnr/zipline-android/total?logo=github)](https://github.com/cssnr/zipline-android/releases/latest/download/zipline.apk)
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/zipline-android?logo=github)](https://github.com/cssnr/zipline-android/releases/latest)
[![Lint](https://img.shields.io/github/actions/workflow/status/cssnr/zipline-android/lint.yaml?logo=github&logoColor=white&label=lint)](https://github.com/cssnr/zipline-android/actions/workflows/lint.yaml)
[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/zipline-android?logo=htmx)](https://github.com/cssnr/zipline-android)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/zipline-android?logo=github&label=updated)](https://github.com/cssnr/zipline-android/graphs/commit-activity)
[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/zipline-android?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/zipline-android)
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ android {
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.okhttp)
implementation(libs.retrofit)
implementation(libs.retrofit.gson)
implementation(libs.okhttp)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
}
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Zipline"
tools:targetApi="35"
android:enableOnBackInvokedCallback="true"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
tools:targetApi="35"> <!-- TODO: Remove enableOnBackInvokedCallback ??? -->
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation|smallestScreenSize|screenSize|screenLayout|keyboardHidden">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
29 changes: 27 additions & 2 deletions app/src/main/java/org/cssnr/zipline/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class MainActivity : AppCompatActivity() {
@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d("MainActivity", "onCreate")

Log.d("onCreate", "savedInstanceState: $savedInstanceState")
enableEdgeToEdge()

binding = ActivityMainBinding.inflate(layoutInflater)
Expand All @@ -51,6 +50,32 @@ class MainActivity : AppCompatActivity() {
handleIntent(intent)
}

override fun onSaveInstanceState(outState: Bundle) {
Log.d("onSaveInstanceState", "outState: $outState")
super.onSaveInstanceState(outState)
binding.webView.saveState(outState)
}

override fun onRestoreInstanceState(savedInstanceState: Bundle) {
Log.d("onRestoreInstanceState", "savedInstanceState: $savedInstanceState")
super.onRestoreInstanceState(savedInstanceState)
binding.webView.restoreState(savedInstanceState)
}

override fun onPause() {
Log.d("onPause", "ON PAUSE")
super.onPause()
binding.webView.onPause()
binding.webView.pauseTimers()
}

override fun onResume() {
Log.d("onResume", "ON RESUME")
super.onResume()
binding.webView.onResume()
binding.webView.resumeTimers()
}

override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
Log.d("onNewIntent", "intent: $intent")
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.10.1"
retrofit = "2.9.0"
okhttp = "4.12.0"
retrofit = "2.9.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand All @@ -19,9 +19,9 @@ androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-co
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Loading