-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Extracting most UI state to EditingState (#126)
#126: Miscellaneous refactoring --------- * Fixes: - share - resize - SavePathDialog - NoBeanDefFoundException in EditModule * Clarify Serialization in ImageDefaults * Move all toggleCrop logic from EditScreen to EditViewModel * Move operations logic from EditScreen to EditViewModel * Move all state to EditingState * Extract to EditingState: - isCropMode, isEyeDropperMode - isRotateMode, isResizeMode, isEraseMode - isZoomMode, isPanMode, isBlurMode - canUndo, canRedo * Delete getCachedImageUri * Extract image loading from EditViewModel file * Remove context from shareImage * Remove ktlint gradle plugin and add ktlintCheck to ktlint.gradle * Run ktlintCheck after ktlintFormat * Add ktlint gradle plugin + update AGP * Update workflows, gradle, use JDK 17 * Update compose to 1.6.8 * Refactor packages structure * Minor refactors --------- Co-authored-by: Chingiz <[email protected]>
- Loading branch information
Showing
70 changed files
with
4,031 additions
and
3,234 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,17 @@ jobs: | |
environment: Development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation[email protected] | ||
uses: gradle/actions/wrapper-validation@v3 | ||
|
||
- name: Build debug APK | ||
run: ./gradlew assembleDebug | ||
|
@@ -38,17 +38,17 @@ jobs: | |
environment: Development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation[email protected] | ||
uses: gradle/actions/wrapper-validation@v3 | ||
|
||
- name: Decrypt the keystore for signing | ||
run: | | ||
|
@@ -59,7 +59,7 @@ jobs: | |
run: ./gradlew assembleRelease | ||
|
||
- name: Upload release APK | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ark-retouch | ||
path: ./app/build/outputs/apk/release/*.apk | ||
|
@@ -69,18 +69,18 @@ jobs: | |
environment: Development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Run linter | ||
run: ./gradlew lint | ||
|
||
- uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: lint-results | ||
path: ./app/build/reports/*.html | ||
|
@@ -90,14 +90,14 @@ jobs: | |
environment: Development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Kotlin linter | ||
run: ./gradlew ktlintCheck | ||
run: ./gradlew ktlint -PautoCorrect=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,16 @@ jobs: | |
ACRA_URI: ${{ secrets.ACRARIUM_URI }} | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation[email protected] | ||
uses: gradle/actions/wrapper-validation@v3 | ||
|
||
- name: Build Release APK | ||
run: ./gradlew assembleRelease | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ | |
*.tab | ||
*.tab.values.at | ||
misc.xml | ||
|
||
*.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
configurations { | ||
ktlint | ||
} | ||
|
||
dependencies { | ||
ktlint "com.pinterest:ktlint:0.45.2" | ||
} | ||
|
||
tasks.register('ktlint', JavaExec) { | ||
mainClass = "com.pinterest.ktlint.Main" | ||
classpath = configurations.ktlint | ||
args("$rootDir/**/*.kt", "!$rootDir/**/build/**") | ||
jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED" | ||
|
||
if (project.hasProperty("autoCorrect") && project.property("autoCorrect") == "0") { | ||
logger.quiet("(KTLINT): auto correction is disabled") | ||
} else { | ||
logger.quiet("(KTLINT): auto correction is enabled") | ||
args "-F" | ||
} | ||
} | ||
|
||
tasks.register('ktlintCheck', JavaExec) { | ||
classpath = configurations.ktlint | ||
mainClass = "com.pinterest.ktlint.Main" | ||
args "src/**/*.kt", "**.kts", "!**/build/**" | ||
} | ||
|
||
tasks.preBuild.dependsOn ktlintCheck | ||
|
||
tasks.ktlintCheck.dependsOn ktlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
app/src/androidTest/java/dev/arkbuilders/arkretouch/ExampleInstrumentedTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/src/main/java/dev/arkbuilders/arkretouch/data/model/DrawPath.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.arkbuilders.arkretouch.data.model | ||
|
||
import androidx.compose.ui.graphics.Paint | ||
import androidx.compose.ui.graphics.Path | ||
|
||
class DrawPath( | ||
val path: Path, | ||
val paint: Paint | ||
) |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/dev/arkbuilders/arkretouch/data/model/DrawingState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dev.arkbuilders.arkretouch.data.model | ||
|
||
import androidx.compose.ui.graphics.BlendMode | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.Paint | ||
import androidx.compose.ui.graphics.PaintingStyle | ||
import dev.arkbuilders.arkretouch.utils.defaultPaint | ||
|
||
data class DrawingState( | ||
val currentPaint: Paint = defaultPaint(), | ||
val drawPaint: Paint = defaultPaint(), | ||
val backgroundPaint: Paint = Paint().also { it.color = Color.Transparent }, | ||
val erasePaint: Paint = Paint().apply { | ||
shader = null | ||
color = backgroundPaint.color | ||
style = PaintingStyle.Stroke | ||
blendMode = BlendMode.SrcOut | ||
}, | ||
val blurSize: Float = 250f, | ||
val blurIntensity: Float = 12f | ||
) |
Oops, something went wrong.