diff --git a/.github/workflows/build.yml b/.github/workflows/build_filepicker.yml similarity index 90% rename from .github/workflows/build.yml rename to .github/workflows/build_filepicker.yml index 46225b7..bb43d65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build_filepicker.yml @@ -3,8 +3,12 @@ name: Build the components on: push: branches: [ main ] + paths: + - filepicker/** pull_request: branches: [ main ] + paths: + - filepicker/** jobs: @@ -31,8 +35,8 @@ jobs: echo "${{ secrets.KEYSTORE_ENCRYPTED }}" > keystore.asc gpg -d --passphrase "${{ secrets.KEYSTORE_PASSWORD }}" --batch keystore.asc > keystore.jks - - name: Build components - run: ./gradlew assembleRelease + - name: Build filepicker module + run: ./gradlew filepicker:assembleRelease - name: Build release sample APK run: ./gradlew sample:assembleRelease diff --git a/.github/workflows/build_folderstree.yml b/.github/workflows/build_folderstree.yml new file mode 100644 index 0000000..43cc0b8 --- /dev/null +++ b/.github/workflows/build_folderstree.yml @@ -0,0 +1,33 @@ +name: Build the components + +on: + push: + branches: [ main ] + paths: + - folderstree/** + pull_request: + branches: [ main ] + paths: + - folderstree/** + + +jobs: + build: + if: ${{ ! startsWith(github.actor, 'dependabot') }} + environment: Development + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: gradle + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Build folderstree module + run: ./gradlew folderstree:assembleRelease diff --git a/.github/workflows/build_scorewidget.yml b/.github/workflows/build_scorewidget.yml new file mode 100644 index 0000000..a8781cc --- /dev/null +++ b/.github/workflows/build_scorewidget.yml @@ -0,0 +1,33 @@ +name: Build the components + +on: + push: + branches: [ main ] + paths: + - scorewidget/** + pull_request: + branches: [ main ] + paths: + - scorewidget/** + + +jobs: + build: + if: ${{ ! startsWith(github.actor, 'dependabot') }} + environment: Development + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: gradle + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Build scorewidget module + run: ./gradlew scorewidget:assembleRelease diff --git a/.github/workflows/build_tagselector.yml b/.github/workflows/build_tagselector.yml new file mode 100644 index 0000000..56714bd --- /dev/null +++ b/.github/workflows/build_tagselector.yml @@ -0,0 +1,33 @@ +name: Build the components + +on: + push: + branches: [ main ] + paths: + - tagselector/** + pull_request: + branches: [ main ] + paths: + - tagselector/** + + +jobs: + build: + if: ${{ ! startsWith(github.actor, 'dependabot') }} + environment: Development + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: gradle + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Build tagselector module + run: ./gradlew tagselector:assembleRelease diff --git a/.github/workflows/build_utils.yml b/.github/workflows/build_utils.yml new file mode 100644 index 0000000..4bb5ba4 --- /dev/null +++ b/.github/workflows/build_utils.yml @@ -0,0 +1,33 @@ +name: Build the components + +on: + push: + branches: [ main ] + paths: + - utils/** + pull_request: + branches: [ main ] + paths: + - utils/** + + +jobs: + build: + if: ${{ ! startsWith(github.actor, 'dependabot') }} + environment: Development + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: gradle + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Build utils module + run: ./gradlew utils:assembleRelease diff --git a/.github/workflows/release_filepicker.yml b/.github/workflows/release_filepicker.yml new file mode 100644 index 0000000..a6175c0 --- /dev/null +++ b/.github/workflows/release_filepicker.yml @@ -0,0 +1,28 @@ +name: Release the components + +on: + push: + tags: + - 'filepicker*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Publish components to Github + uses: gradle/gradle-build-action@v2 + with: + arguments: filepicker:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_folderstree.yml b/.github/workflows/release_folderstree.yml new file mode 100644 index 0000000..44d28a9 --- /dev/null +++ b/.github/workflows/release_folderstree.yml @@ -0,0 +1,28 @@ +name: Release the components + +on: + push: + tags: + - 'folderstree*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Publish components to Github + uses: gradle/gradle-build-action@v2 + with: + arguments: folderstree:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_scorewidget.yml b/.github/workflows/release_scorewidget.yml new file mode 100644 index 0000000..cb33f03 --- /dev/null +++ b/.github/workflows/release_scorewidget.yml @@ -0,0 +1,28 @@ +name: Release the components + +on: + push: + tags: + - 'scorewidget*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Publish components to Github + uses: gradle/gradle-build-action@v2 + with: + arguments: scorewidget:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_tagselector.yml b/.github/workflows/release_tagselector.yml new file mode 100644 index 0000000..e991c36 --- /dev/null +++ b/.github/workflows/release_tagselector.yml @@ -0,0 +1,28 @@ +name: Release the components + +on: + push: + tags: + - 'tagselector*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.0.5 + + - name: Publish components to Github + uses: gradle/gradle-build-action@v2 + with: + arguments: tagselector:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release_utils.yml similarity index 91% rename from .github/workflows/release.yml rename to .github/workflows/release_utils.yml index a2f15d0..42993de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release_utils.yml @@ -3,7 +3,7 @@ name: Release the components on: push: tags: - - '*' + - 'utils*' jobs: release: @@ -23,6 +23,6 @@ jobs: - name: Publish components to Github uses: gradle/gradle-build-action@v2 with: - arguments: components:publish + arguments: utils:publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/components/.gitignore b/filepicker/.gitignore similarity index 100% rename from components/.gitignore rename to filepicker/.gitignore diff --git a/components/build.gradle.kts b/filepicker/build.gradle.kts similarity index 52% rename from components/build.gradle.kts rename to filepicker/build.gradle.kts index 92a5201..145a438 100644 --- a/components/build.gradle.kts +++ b/filepicker/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } android { - namespace = "dev.arkbuilders.components" + namespace = "dev.arkbuilders.components.filepicker" compileSdk = 34 defaultConfig { @@ -34,6 +34,7 @@ android { kotlinOptions { jvmTarget = "17" } + buildFeatures { viewBinding = true } @@ -45,31 +46,31 @@ android { } dependencies { - implementation("androidx.core:core-ktx:1.12.0") - implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.22")) - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.11.0") - implementation("org.orbit-mvi:orbit-viewmodel:6.1.0") - implementation("dev.arkbuilders:arklib:0.3.5") - implementation("com.mikepenz:fastadapter:5.7.0") - implementation("com.mikepenz:fastadapter-extensions-binding:5.7.0") - implementation("com.mikepenz:fastadapter-extensions-diff:5.7.0") + implementation(libraries.ark.component.utils) + implementation(libraries.ark.component.folderstree) + implementation(libraries.ark.component.tagselector) + implementation(libraries.ark.component.scorewidget) - implementation("com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.5.9") + implementation(libraries.androidx.core.ktx) + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) - implementation("androidx.fragment:fragment-ktx:1.6.1") - implementation("com.github.skydoves:balloon:1.6.4") - implementation("com.google.android.flexbox:flexbox:3.0.0") + implementation(libraries.coil) + implementation(libraries.coil.gif) + implementation(libraries.coil.svg) + implementation(libraries.coil.video) - val coilVersion = "2.4.0" - implementation("io.coil-kt:coil:$coilVersion") - implementation("io.coil-kt:coil-gif:$coilVersion") - implementation("io.coil-kt:coil-svg:$coilVersion") - implementation("io.coil-kt:coil-video:$coilVersion") + implementation(libraries.androidx.fragment.ktx) - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(libraries.fastadapter) + implementation(libraries.fastadapter.extensions.binding) + implementation(libraries.fastadapter.extensions.diff) + implementation(libraries.arklib) + implementation(libraries.orbit.mvi.viewmodel) + implementation(libraries.viewbinding.property.delegate) } val libVersion: String = scmVersion.version @@ -77,8 +78,8 @@ val libVersion: String = scmVersion.version publishing { publications { create("release") { - groupId = "dev.arkbuilders" - artifactId = "components" + groupId = "dev.arkbuilders.components" + artifactId = "filepicker" version = libVersion afterEvaluate { from(components["release"]) @@ -88,11 +89,11 @@ publishing { repositories { maven { name = "GithubPackages" - url = URI("https://maven.pkg.github.com/ARK-Builders/ark-components-android") + url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") } } } -} +} \ No newline at end of file diff --git a/components/consumer-rules.pro b/filepicker/consumer-rules.pro similarity index 100% rename from components/consumer-rules.pro rename to filepicker/consumer-rules.pro diff --git a/components/proguard-rules.pro b/filepicker/proguard-rules.pro similarity index 100% rename from components/proguard-rules.pro rename to filepicker/proguard-rules.pro diff --git a/filepicker/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt b/filepicker/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..617ca04 --- /dev/null +++ b/filepicker/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dev.arkbuilders.components + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("dev.arkbuilders.components.filepicker.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/components/src/main/AndroidManifest.xml b/filepicker/src/main/AndroidManifest.xml similarity index 100% rename from components/src/main/AndroidManifest.xml rename to filepicker/src/main/AndroidManifest.xml diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt similarity index 95% rename from components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt index 79d8fe3..ed01069 100644 --- a/components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt +++ b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerConfig.kt @@ -3,7 +3,7 @@ package dev.arkbuilders.components.filepicker import androidx.annotation.PluralsRes import androidx.annotation.StringRes import androidx.annotation.StyleRes -import dev.arkbuilders.components.R +import dev.arkbuilders.components.filepicker.R import java.nio.file.Path class ArkFilePickerConfig( diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt similarity index 98% rename from components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt index 7d86a8a..3929c72 100644 --- a/components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt +++ b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerFragment.kt @@ -41,11 +41,11 @@ import com.mikepenz.fastadapter.binding.AbstractBindingItem import dev.arkbuilders.arklib.utils.DeviceStorageUtils import dev.arkbuilders.arklib.utils.INTERNAL_STORAGE import org.orbitmvi.orbit.viewmodel.observe -import dev.arkbuilders.components.R -import dev.arkbuilders.components.databinding.ArkFilePickerDialogNewFolderBinding -import dev.arkbuilders.components.databinding.ArkFilePickerHostFragmentBinding -import dev.arkbuilders.components.databinding.ArkFilePickerItemFileBinding -import dev.arkbuilders.components.databinding.ArkFilePickerItemFilesRootsPageBinding +import dev.arkbuilders.components.filepicker.R +import dev.arkbuilders.components.filepicker.databinding.ArkFilePickerDialogNewFolderBinding +import dev.arkbuilders.components.filepicker.databinding.ArkFilePickerHostFragmentBinding +import dev.arkbuilders.components.filepicker.databinding.ArkFilePickerItemFileBinding +import dev.arkbuilders.components.filepicker.databinding.ArkFilePickerItemFilesRootsPageBinding import dev.arkbuilders.components.filepicker.callback.OnFileItemLongClick import dev.arkbuilders.components.folderstree.FolderTreeView import dev.arkbuilders.components.utils.args diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt similarity index 98% rename from components/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt index 4b51f9d..4734a98 100644 --- a/components/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt +++ b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/DevicesPopup.kt @@ -9,7 +9,7 @@ import android.widget.PopupWindow import android.widget.TextView import androidx.core.content.res.ResourcesCompat import dev.arkbuilders.arklib.utils.INTERNAL_STORAGE -import dev.arkbuilders.components.R +import dev.arkbuilders.components.filepicker.R import dev.arkbuilders.components.utils.dpToPx import java.nio.file.Path diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/FragmentManagerUtils.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/FragmentManagerUtils.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/filepicker/FragmentManagerUtils.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/FragmentManagerUtils.kt diff --git a/components/src/main/java/dev/arkbuilders/components/filepicker/callback/OnFileItemLongClick.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/callback/OnFileItemLongClick.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/filepicker/callback/OnFileItemLongClick.kt rename to filepicker/src/main/java/dev/arkbuilders/components/filepicker/callback/OnFileItemLongClick.kt diff --git a/components/src/main/res/anim/ark_file_picker_fade_in.xml b/filepicker/src/main/res/anim/ark_file_picker_fade_in.xml similarity index 100% rename from components/src/main/res/anim/ark_file_picker_fade_in.xml rename to filepicker/src/main/res/anim/ark_file_picker_fade_in.xml diff --git a/components/src/main/res/anim/ark_file_pickerfade_out.xml b/filepicker/src/main/res/anim/ark_file_pickerfade_out.xml similarity index 100% rename from components/src/main/res/anim/ark_file_pickerfade_out.xml rename to filepicker/src/main/res/anim/ark_file_pickerfade_out.xml diff --git a/components/src/main/res/drawable/ark_file_picker_bg_round_16.xml b/filepicker/src/main/res/drawable/ark_file_picker_bg_round_16.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_bg_round_16.xml rename to filepicker/src/main/res/drawable/ark_file_picker_bg_round_16.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_chevron.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_chevron.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_chevron.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_chevron.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_3gp.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_3gp.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_3gp.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_3gp.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_avi.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_avi.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_avi.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_avi.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_bmp.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_bmp.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_bmp.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_bmp.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_doc.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_doc.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_doc.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_doc.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_docx.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_docx.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_docx.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_docx.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_flac.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_flac.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_flac.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_flac.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_flv.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_flv.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_flv.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_flv.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_gif.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_gif.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_gif.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_gif.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_html.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_html.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_html.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_html.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_jpeg.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_jpeg.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_jpeg.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_jpeg.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_jpg.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_jpg.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_jpg.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_jpg.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_mkv.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_mkv.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_mkv.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_mkv.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_mov.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_mov.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_mov.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_mov.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_mp3.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_mp3.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_mp3.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_mp3.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_mp4.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_mp4.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_mp4.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_mp4.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_ods.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_ods.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_ods.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_ods.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_odt.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_odt.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_odt.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_odt.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_pdf.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_pdf.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_pdf.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_pdf.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_png.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_png.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_png.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_png.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_svg.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_svg.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_svg.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_svg.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_txt.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_txt.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_txt.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_txt.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_wav.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_wav.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_wav.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_wav.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_wma.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_wma.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_wma.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_wma.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_wmv.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_wmv.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_wmv.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_wmv.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_xls.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_xls.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_xls.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_xls.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file_xlsx.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_file_xlsx.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file_xlsx.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_file_xlsx.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_folder.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_folder.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_folder.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_folder.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_more_vert.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_more_vert.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_more_vert.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_more_vert.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_new_folder.xml b/filepicker/src/main/res/drawable/ark_file_picker_ic_new_folder.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_new_folder.xml rename to filepicker/src/main/res/drawable/ark_file_picker_ic_new_folder.xml diff --git a/components/src/main/res/drawable/ic_delete.xml b/filepicker/src/main/res/drawable/ic_delete.xml similarity index 100% rename from components/src/main/res/drawable/ic_delete.xml rename to filepicker/src/main/res/drawable/ic_delete.xml diff --git a/components/src/main/res/drawable/ic_search.xml b/filepicker/src/main/res/drawable/ic_search.xml similarity index 100% rename from components/src/main/res/drawable/ic_search.xml rename to filepicker/src/main/res/drawable/ic_search.xml diff --git a/components/src/main/res/drawable/ic_star.xml b/filepicker/src/main/res/drawable/ic_star.xml similarity index 100% rename from components/src/main/res/drawable/ic_star.xml rename to filepicker/src/main/res/drawable/ic_star.xml diff --git a/components/src/main/res/layout/ark_file_picker_dialog_new_folder.xml b/filepicker/src/main/res/layout/ark_file_picker_dialog_new_folder.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_dialog_new_folder.xml rename to filepicker/src/main/res/layout/ark_file_picker_dialog_new_folder.xml diff --git a/components/src/main/res/layout/ark_file_picker_fragment.xml b/filepicker/src/main/res/layout/ark_file_picker_fragment.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_fragment.xml rename to filepicker/src/main/res/layout/ark_file_picker_fragment.xml diff --git a/components/src/main/res/layout/ark_file_picker_host_fragment.xml b/filepicker/src/main/res/layout/ark_file_picker_host_fragment.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_host_fragment.xml rename to filepicker/src/main/res/layout/ark_file_picker_host_fragment.xml diff --git a/components/src/main/res/layout/ark_file_picker_item_file.xml b/filepicker/src/main/res/layout/ark_file_picker_item_file.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_item_file.xml rename to filepicker/src/main/res/layout/ark_file_picker_item_file.xml diff --git a/components/src/main/res/layout/ark_file_picker_item_files_roots_page.xml b/filepicker/src/main/res/layout/ark_file_picker_item_files_roots_page.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_item_files_roots_page.xml rename to filepicker/src/main/res/layout/ark_file_picker_item_files_roots_page.xml diff --git a/components/src/main/res/menu/file_select_menu.xml b/filepicker/src/main/res/menu/file_select_menu.xml similarity index 100% rename from components/src/main/res/menu/file_select_menu.xml rename to filepicker/src/main/res/menu/file_select_menu.xml diff --git a/components/src/main/res/values/colors.xml b/filepicker/src/main/res/values/colors.xml similarity index 89% rename from components/src/main/res/values/colors.xml rename to filepicker/src/main/res/values/colors.xml index ff4daec..f12e9bf 100644 --- a/components/src/main/res/values/colors.xml +++ b/filepicker/src/main/res/values/colors.xml @@ -1,7 +1,6 @@ #6200EE - #717171 #000000 #FFFFFF #50717171 diff --git a/components/src/main/res/values/dimens.xml b/filepicker/src/main/res/values/dimens.xml similarity index 100% rename from components/src/main/res/values/dimens.xml rename to filepicker/src/main/res/values/dimens.xml diff --git a/components/src/main/res/values/strings.xml b/filepicker/src/main/res/values/strings.xml similarity index 77% rename from components/src/main/res/values/strings.xml rename to filepicker/src/main/res/values/strings.xml index 146f7ad..c3d9f22 100644 --- a/components/src/main/res/values/strings.xml +++ b/filepicker/src/main/res/values/strings.xml @@ -1,8 +1,5 @@ - Label some resources with tags to enable tags selector - Filter - Invert Internal Cancel Pick @@ -11,9 +8,6 @@ [device] [favorite] [root] - Add favorite - Forget root - Forget favorite New folder Folder already exists! Name your folder diff --git a/components/src/main/res/values/styles.xml b/filepicker/src/main/res/values/styles.xml similarity index 100% rename from components/src/main/res/values/styles.xml rename to filepicker/src/main/res/values/styles.xml diff --git a/components/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt b/filepicker/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt similarity index 100% rename from components/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt rename to filepicker/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt diff --git a/folderstree/.gitignore b/folderstree/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/folderstree/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/folderstree/build.gradle.kts b/folderstree/build.gradle.kts new file mode 100644 index 0000000..6f65a54 --- /dev/null +++ b/folderstree/build.gradle.kts @@ -0,0 +1,82 @@ +import java.net.URI + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("pl.allegro.tech.build.axion-release") + `maven-publish` +} + +android { + namespace = "dev.arkbuilders.components.folderstree" + compileSdk = 34 + + defaultConfig { + minSdk = 26 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + viewBinding = true + } +} + +dependencies { + + implementation(libraries.ark.component.utils) + implementation(libraries.androidx.core.ktx) + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + implementation(libraries.fastadapter) + implementation(libraries.fastadapter.extensions.binding) + implementation(libraries.fastadapter.extensions.diff) + implementation(libraries.skydoves.balloon) + implementation(libraries.arklib) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) +} + +val libVersion: String = scmVersion.version + +publishing { + publications { + create("release") { + groupId = "dev.arkbuilders.components" + artifactId = "folderstree" + version = libVersion + afterEvaluate { + from(components["release"]) + } + } + } + repositories { + maven { + name = "GithubPackages" + url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/folderstree/consumer-rules.pro b/folderstree/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/folderstree/proguard-rules.pro b/folderstree/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/folderstree/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/folderstree/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt b/folderstree/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..316a35b --- /dev/null +++ b/folderstree/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dev.arkbuilders.components + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("dev.arkbuilders.components.folderstree.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/folderstree/src/main/AndroidManifest.xml b/folderstree/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/folderstree/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt b/folderstree/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt similarity index 96% rename from components/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt rename to folderstree/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt index 33240b1..9880352 100644 --- a/components/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt +++ b/folderstree/src/main/java/dev/arkbuilders/components/folderstree/FolderItemView.kt @@ -10,10 +10,9 @@ import androidx.lifecycle.findViewTreeLifecycleOwner import com.mikepenz.fastadapter.binding.AbstractBindingItem import com.skydoves.balloon.Balloon import dev.arkbuilders.arklib.utils.INTERNAL_STORAGE -import dev.arkbuilders.components.R -import dev.arkbuilders.components.databinding.ArkFilePickerItemDeviceBinding -import dev.arkbuilders.components.databinding.ArkFilePickerItemFavoriteBinding -import dev.arkbuilders.components.databinding.ArkFilePickerItemRootBinding +import dev.arkbuilders.components.folderstree.databinding.ArkFilePickerItemDeviceBinding +import dev.arkbuilders.components.folderstree.databinding.ArkFilePickerItemFavoriteBinding +import dev.arkbuilders.components.folderstree.databinding.ArkFilePickerItemRootBinding import dev.arkbuilders.components.utils.setMargin internal class DeviceFolderItem( diff --git a/components/src/main/java/dev/arkbuilders/components/folderstree/FolderNode.kt b/folderstree/src/main/java/dev/arkbuilders/components/folderstree/FolderNode.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/folderstree/FolderNode.kt rename to folderstree/src/main/java/dev/arkbuilders/components/folderstree/FolderNode.kt diff --git a/components/src/main/java/dev/arkbuilders/components/folderstree/FoldersTreeView.kt b/folderstree/src/main/java/dev/arkbuilders/components/folderstree/FoldersTreeView.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/folderstree/FoldersTreeView.kt rename to folderstree/src/main/java/dev/arkbuilders/components/folderstree/FoldersTreeView.kt diff --git a/folderstree/src/main/res/drawable/ark_file_picker_ic_chevron.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_chevron.xml new file mode 100644 index 0000000..f988e7d --- /dev/null +++ b/folderstree/src/main/res/drawable/ark_file_picker_ic_chevron.xml @@ -0,0 +1,5 @@ + + + diff --git a/components/src/main/res/drawable/ark_file_picker_ic_delete.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_delete.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_delete.xml rename to folderstree/src/main/res/drawable/ark_file_picker_ic_delete.xml diff --git a/folderstree/src/main/res/drawable/ark_file_picker_ic_folder.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_folder.xml new file mode 100644 index 0000000..dc6b080 --- /dev/null +++ b/folderstree/src/main/res/drawable/ark_file_picker_ic_folder.xml @@ -0,0 +1,10 @@ + + + diff --git a/components/src/main/res/drawable/ark_file_picker_ic_folder_action_add.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_folder_action_add.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_folder_action_add.xml rename to folderstree/src/main/res/drawable/ark_file_picker_ic_folder_action_add.xml diff --git a/folderstree/src/main/res/drawable/ark_file_picker_ic_more_vert.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_more_vert.xml new file mode 100644 index 0000000..6a7f274 --- /dev/null +++ b/folderstree/src/main/res/drawable/ark_file_picker_ic_more_vert.xml @@ -0,0 +1,5 @@ + + + diff --git a/components/src/main/res/drawable/ark_file_picker_ic_sd_card.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_sd_card.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_sd_card.xml rename to folderstree/src/main/res/drawable/ark_file_picker_ic_sd_card.xml diff --git a/components/src/main/res/drawable/ark_file_picker_ic_star.xml b/folderstree/src/main/res/drawable/ark_file_picker_ic_star.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_star.xml rename to folderstree/src/main/res/drawable/ark_file_picker_ic_star.xml diff --git a/components/src/main/res/layout/ark_file_picker_favorite_options.xml b/folderstree/src/main/res/layout/ark_file_picker_favorite_options.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_favorite_options.xml rename to folderstree/src/main/res/layout/ark_file_picker_favorite_options.xml diff --git a/components/src/main/res/layout/ark_file_picker_item_device.xml b/folderstree/src/main/res/layout/ark_file_picker_item_device.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_item_device.xml rename to folderstree/src/main/res/layout/ark_file_picker_item_device.xml diff --git a/components/src/main/res/layout/ark_file_picker_item_favorite.xml b/folderstree/src/main/res/layout/ark_file_picker_item_favorite.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_item_favorite.xml rename to folderstree/src/main/res/layout/ark_file_picker_item_favorite.xml diff --git a/components/src/main/res/layout/ark_file_picker_item_root.xml b/folderstree/src/main/res/layout/ark_file_picker_item_root.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_item_root.xml rename to folderstree/src/main/res/layout/ark_file_picker_item_root.xml diff --git a/components/src/main/res/layout/ark_file_picker_root_options.xml b/folderstree/src/main/res/layout/ark_file_picker_root_options.xml similarity index 100% rename from components/src/main/res/layout/ark_file_picker_root_options.xml rename to folderstree/src/main/res/layout/ark_file_picker_root_options.xml diff --git a/folderstree/src/main/res/values/colors.xml b/folderstree/src/main/res/values/colors.xml new file mode 100644 index 0000000..287a354 --- /dev/null +++ b/folderstree/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FFFFFF + #FF555555 + \ No newline at end of file diff --git a/folderstree/src/main/res/values/strings.xml b/folderstree/src/main/res/values/strings.xml new file mode 100644 index 0000000..11a034e --- /dev/null +++ b/folderstree/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + Internal + Forget favorite + Add favorite + Forget root + \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..09a3470 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,46 @@ +[versions] +arkComponentUtils = "0.0.9-SNAPSHOT-01" +akrComponentFoldersTree = "0.0.9-SNAPSHOT-02" +akrComponentTagSelector = "0.0.9-SNAPSHOT-02" +akrComponentScoreWidget = "0.0.9-SNAPSHOT-02" +arkComponentFilePicker = "0.1.0-SNAPSHOT" +coil = "2.4.0" +androidxFragmentKtx = "1.6.1" +fastadapter = "5.7.0" +arkLib = "0.3.5" +orbitMvi = "6.1.0" +viewbindingPropertyDelegate = "1.5.9" +androidXCore = "1.9.0" +androidXAppcompat = "1.6.1" +androidMaterial = "1.11.0" +junit = "4.13.2" +androidXTestJunit = "1.1.5" +androidXTestEspresso = "3.5.1" +skydovesBalloon = "1.6.4" +flexbox = "3.0.0" + +[libraries] +ark-component-utils = { group = "dev.arkbuilders.components", name = "utils", version.ref = "arkComponentUtils" } +ark-component-folderstree = { group = "dev.arkbuilders.components", name = "folderstree", version.ref = "akrComponentFoldersTree" } +ark-component-tagselector = { group = "dev.arkbuilders.components", name = "tagselector", version.ref = "akrComponentTagSelector" } +ark-component-scorewidget = { group = "dev.arkbuilders.components", name = "scorewidget", version.ref = "akrComponentScoreWidget" } +ark-component-filepicker = { group = "dev.arkbuilders.components", name = "filepicker", version.ref = "arkComponentFilePicker" } +coil = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +coil-gif = { group = "io.coil-kt", name = "coil-gif", version.ref = "coil" } +coil-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" } +coil-video = { group = "io.coil-kt", name = "coil-video", version.ref = "coil" } +androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidxFragmentKtx" } +fastadapter = { group = "com.mikepenz", name = "fastadapter", version.ref = "fastadapter" } +fastadapter-extensions-binding = { group = "com.mikepenz", name = "fastadapter-extensions-binding", version.ref = "fastadapter" } +fastadapter-extensions-diff = { group = "com.mikepenz", name = "fastadapter-extensions-diff", version.ref = "fastadapter" } +arklib = { group = "dev.arkbuilders", name = "arklib", version.ref = "arkLib" } +orbit-mvi-viewmodel = { group = "org.orbit-mvi", name = "orbit-viewmodel", version.ref = "orbitMvi" } +viewbinding-property-delegate = { group = "com.github.kirich1409", name = "viewbindingpropertydelegate-noreflection", version.ref = "viewbindingPropertyDelegate" } +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidXCore" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidXAppcompat" } +android-material = { group = "com.google.android.material", name = "material", version.ref = "androidMaterial" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidXTestJunit" } +androidx-test-espresso = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidXTestEspresso" } +skydoves-balloon = { group = "com.github.skydoves", name = "balloon", version.ref = "skydovesBalloon" } +flexbox = { group = "com.google.android.flexbox", name = "flexbox", version.ref = "flexbox" } \ No newline at end of file diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index a04d5f7..8ea98a7 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -69,13 +69,13 @@ android { } dependencies { - implementation(project(":components")) - implementation("dev.arkbuilders:arklib:0.3.5") + implementation(libraries.ark.component.filepicker) + implementation(libraries.arklib) implementation("androidx.core:core-ktx:1.12.0") - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.11.0") - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) } \ No newline at end of file diff --git a/scorewidget/.gitignore b/scorewidget/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/scorewidget/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/scorewidget/build.gradle.kts b/scorewidget/build.gradle.kts new file mode 100644 index 0000000..b05f489 --- /dev/null +++ b/scorewidget/build.gradle.kts @@ -0,0 +1,78 @@ +import java.net.URI + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("pl.allegro.tech.build.axion-release") + `maven-publish` +} + +android { + namespace = "dev.arkbuilders.components" + compileSdk = 34 + + defaultConfig { + minSdk = 26 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + viewBinding = true + } +} + +dependencies { + + implementation(libraries.androidx.core.ktx) + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + implementation(libraries.arklib) + implementation(libraries.orbit.mvi.viewmodel) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) +} + +val libVersion: String = scmVersion.version + +publishing { + publications { + create("release") { + groupId = "dev.arkbuilders.components" + artifactId = "scorewidget" + version = libVersion + afterEvaluate { + from(components["release"]) + } + } + } + repositories { + maven { + name = "GithubPackages" + url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/scorewidget/consumer-rules.pro b/scorewidget/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/scorewidget/proguard-rules.pro b/scorewidget/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/scorewidget/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/components/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt b/scorewidget/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt similarity index 88% rename from components/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt rename to scorewidget/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt index ec187dc..57afdac 100644 --- a/components/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt +++ b/scorewidget/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt @@ -19,6 +19,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("dev.arkbuilders.scorewidget.test", appContext.packageName) + assertEquals("dev.arkbuilders.components.test", appContext.packageName) } } \ No newline at end of file diff --git a/scorewidget/src/main/AndroidManifest.xml b/scorewidget/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/scorewidget/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidget.kt b/scorewidget/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidget.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidget.kt rename to scorewidget/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidget.kt diff --git a/components/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidgetController.kt b/scorewidget/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidgetController.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidgetController.kt rename to scorewidget/src/main/java/dev/arkbuilders/components/scorewidget/ScoreWidgetController.kt diff --git a/components/src/main/res/drawable/bg_rounded_top_24dp.xml b/scorewidget/src/main/res/drawable/bg_rounded_top_24dp.xml similarity index 100% rename from components/src/main/res/drawable/bg_rounded_top_24dp.xml rename to scorewidget/src/main/res/drawable/bg_rounded_top_24dp.xml diff --git a/components/src/main/res/drawable/ic_arrow_down.xml b/scorewidget/src/main/res/drawable/ic_arrow_down.xml similarity index 100% rename from components/src/main/res/drawable/ic_arrow_down.xml rename to scorewidget/src/main/res/drawable/ic_arrow_down.xml diff --git a/components/src/main/res/drawable/ic_arrow_up.xml b/scorewidget/src/main/res/drawable/ic_arrow_up.xml similarity index 100% rename from components/src/main/res/drawable/ic_arrow_up.xml rename to scorewidget/src/main/res/drawable/ic_arrow_up.xml diff --git a/components/src/main/res/drawable/ic_close.xml b/scorewidget/src/main/res/drawable/ic_close.xml similarity index 100% rename from components/src/main/res/drawable/ic_close.xml rename to scorewidget/src/main/res/drawable/ic_close.xml diff --git a/components/src/main/res/drawable/ic_drag_handle.xml b/scorewidget/src/main/res/drawable/ic_drag_handle.xml similarity index 100% rename from components/src/main/res/drawable/ic_drag_handle.xml rename to scorewidget/src/main/res/drawable/ic_drag_handle.xml diff --git a/components/src/main/res/drawable/ic_sort.xml b/scorewidget/src/main/res/drawable/ic_sort.xml similarity index 100% rename from components/src/main/res/drawable/ic_sort.xml rename to scorewidget/src/main/res/drawable/ic_sort.xml diff --git a/scorewidget/src/main/res/drawable/ic_star.xml b/scorewidget/src/main/res/drawable/ic_star.xml new file mode 100644 index 0000000..1d62020 --- /dev/null +++ b/scorewidget/src/main/res/drawable/ic_star.xml @@ -0,0 +1,5 @@ + + + diff --git a/components/src/main/res/layout/item_tag.xml b/scorewidget/src/main/res/layout/item_tag.xml similarity index 100% rename from components/src/main/res/layout/item_tag.xml rename to scorewidget/src/main/res/layout/item_tag.xml diff --git a/components/src/main/res/layout/score_widget.xml b/scorewidget/src/main/res/layout/score_widget.xml similarity index 100% rename from components/src/main/res/layout/score_widget.xml rename to scorewidget/src/main/res/layout/score_widget.xml diff --git a/scorewidget/src/main/res/values/colors.xml b/scorewidget/src/main/res/values/colors.xml new file mode 100644 index 0000000..f6dd68b --- /dev/null +++ b/scorewidget/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #717171 + #000000 + #6200EE + \ No newline at end of file diff --git a/scorewidget/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt b/scorewidget/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt new file mode 100644 index 0000000..187f2d4 --- /dev/null +++ b/scorewidget/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package dev.arkbuilders.components + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 81427ae..265ee03 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,8 +24,18 @@ dependencyResolutionManagement { } } } + + versionCatalogs { + create("libraries") { + from(files("./gradle/libs.versions.toml")) + } + } } rootProject.name = "Ark Components" +include(":scorewidget") +include(":tagselector") +include(":folderstree") +include(":utils") +include(":filepicker") include(":sample") -include(":components") diff --git a/tagselector/.gitignore b/tagselector/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/tagselector/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/tagselector/build.gradle.kts b/tagselector/build.gradle.kts new file mode 100644 index 0000000..054bcec --- /dev/null +++ b/tagselector/build.gradle.kts @@ -0,0 +1,83 @@ +import java.net.URI + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("pl.allegro.tech.build.axion-release") + `maven-publish` +} + +android { + namespace = "dev.arkbuilders.components.tagselector" + compileSdk = 34 + + defaultConfig { + minSdk = 26 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + viewBinding = true + } +} + +dependencies { + + implementation(libraries.ark.component.utils) + implementation(libraries.androidx.core.ktx) + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + implementation(libraries.flexbox) + implementation(libraries.fastadapter) + implementation(libraries.fastadapter.extensions.binding) + implementation(libraries.skydoves.balloon) + implementation(libraries.arklib) + implementation(libraries.orbit.mvi.viewmodel) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) +} + +val libVersion: String = scmVersion.version + +publishing { + publications { + create("release") { + groupId = "dev.arkbuilders.components" + artifactId = "tagselector" + version = libVersion + afterEvaluate { + from(components["release"]) + } + } + } + repositories { + maven { + name = "GithubPackages" + url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/tagselector/consumer-rules.pro b/tagselector/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/tagselector/proguard-rules.pro b/tagselector/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/tagselector/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/tagselector/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt b/tagselector/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..57afdac --- /dev/null +++ b/tagselector/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dev.arkbuilders.components + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("dev.arkbuilders.components.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/tagselector/src/main/AndroidManifest.xml b/tagselector/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/tagselector/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt b/tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt similarity index 96% rename from components/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt rename to tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt index 207fce5..b777507 100644 --- a/components/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt +++ b/tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelector.kt @@ -18,16 +18,15 @@ import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.adapters.ItemAdapter import com.mikepenz.fastadapter.binding.AbstractBindingItem import com.skydoves.balloon.Balloon -import dev.arkbuilders.components.R -import dev.arkbuilders.components.databinding.ItemTagBinding -import dev.arkbuilders.components.databinding.PopupTagSelectorTagMenuBinding -import dev.arkbuilders.components.databinding.TagSelectorDragHandlerBinding -import dev.arkbuilders.components.databinding.TagSelectorTagsLayoutBinding import dev.arkbuilders.components.utils.closeKeyboard import dev.arkbuilders.components.utils.placeCursorToEnd import dev.arkbuilders.components.utils.showKeyboard import org.orbitmvi.orbit.viewmodel.observe import dev.arkbuilders.arklib.data.meta.Kind +import dev.arkbuilders.components.tagselector.databinding.ItemTagBinding +import dev.arkbuilders.components.tagselector.databinding.PopupTagSelectorTagMenuBinding +import dev.arkbuilders.components.tagselector.databinding.TagSelectorDragHandlerBinding +import dev.arkbuilders.components.tagselector.databinding.TagSelectorTagsLayoutBinding class TagSelector( val ctx: Context, diff --git a/components/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorAction.kt b/tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorAction.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorAction.kt rename to tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorAction.kt diff --git a/components/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorController.kt b/tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorController.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorController.kt rename to tagselector/src/main/java/dev/arkbuilders/components/tagselector/TagSelectorController.kt diff --git a/tagselector/src/main/res/drawable/bg_rounded_top_24dp.xml b/tagselector/src/main/res/drawable/bg_rounded_top_24dp.xml new file mode 100644 index 0000000..c9da8ef --- /dev/null +++ b/tagselector/src/main/res/drawable/bg_rounded_top_24dp.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/tagselector/src/main/res/drawable/ic_close.xml b/tagselector/src/main/res/drawable/ic_close.xml new file mode 100644 index 0000000..d5d2297 --- /dev/null +++ b/tagselector/src/main/res/drawable/ic_close.xml @@ -0,0 +1,10 @@ + + + diff --git a/tagselector/src/main/res/drawable/ic_drag_handle.xml b/tagselector/src/main/res/drawable/ic_drag_handle.xml new file mode 100644 index 0000000..b4c5e3c --- /dev/null +++ b/tagselector/src/main/res/drawable/ic_drag_handle.xml @@ -0,0 +1,10 @@ + + + diff --git a/tagselector/src/main/res/drawable/ic_search.xml b/tagselector/src/main/res/drawable/ic_search.xml new file mode 100644 index 0000000..cbf0cc7 --- /dev/null +++ b/tagselector/src/main/res/drawable/ic_search.xml @@ -0,0 +1,10 @@ + + + diff --git a/tagselector/src/main/res/drawable/ic_sort.xml b/tagselector/src/main/res/drawable/ic_sort.xml new file mode 100644 index 0000000..9e4fc5f --- /dev/null +++ b/tagselector/src/main/res/drawable/ic_sort.xml @@ -0,0 +1,10 @@ + + + diff --git a/tagselector/src/main/res/layout/item_tag.xml b/tagselector/src/main/res/layout/item_tag.xml new file mode 100644 index 0000000..f4d1745 --- /dev/null +++ b/tagselector/src/main/res/layout/item_tag.xml @@ -0,0 +1,7 @@ + + diff --git a/components/src/main/res/layout/popup_tag_selector_tag_menu.xml b/tagselector/src/main/res/layout/popup_tag_selector_tag_menu.xml similarity index 100% rename from components/src/main/res/layout/popup_tag_selector_tag_menu.xml rename to tagselector/src/main/res/layout/popup_tag_selector_tag_menu.xml diff --git a/components/src/main/res/layout/tag_selector_drag_handler.xml b/tagselector/src/main/res/layout/tag_selector_drag_handler.xml similarity index 100% rename from components/src/main/res/layout/tag_selector_drag_handler.xml rename to tagselector/src/main/res/layout/tag_selector_drag_handler.xml diff --git a/components/src/main/res/layout/tag_selector_tags_layout.xml b/tagselector/src/main/res/layout/tag_selector_tags_layout.xml similarity index 100% rename from components/src/main/res/layout/tag_selector_tags_layout.xml rename to tagselector/src/main/res/layout/tag_selector_tags_layout.xml diff --git a/tagselector/src/main/res/values/colors.xml b/tagselector/src/main/res/values/colors.xml new file mode 100644 index 0000000..cffe199 --- /dev/null +++ b/tagselector/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ + + + #000000 + #50717171 + #ADD8E6 + #FFFFFF + #717171 + \ No newline at end of file diff --git a/tagselector/src/main/res/values/strings.xml b/tagselector/src/main/res/values/strings.xml new file mode 100644 index 0000000..f872c27 --- /dev/null +++ b/tagselector/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + Invert + Label some resources with tags to enable tags selector + Filter + \ No newline at end of file diff --git a/tagselector/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt b/tagselector/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt new file mode 100644 index 0000000..187f2d4 --- /dev/null +++ b/tagselector/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package dev.arkbuilders.components + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/utils/.gitignore b/utils/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/utils/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/utils/build.gradle.kts b/utils/build.gradle.kts new file mode 100644 index 0000000..1a92b42 --- /dev/null +++ b/utils/build.gradle.kts @@ -0,0 +1,72 @@ +import java.net.URI + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("pl.allegro.tech.build.axion-release") + `maven-publish` +} + +android { + namespace = "dev.arkbuilders.components.utils" + compileSdk = 34 + + defaultConfig { + minSdk = 26 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } +} + +dependencies { + + implementation(libraries.androidx.core.ktx) + implementation(libraries.androidx.appcompat) + implementation(libraries.android.material) + testImplementation(libraries.junit) + androidTestImplementation(libraries.androidx.test.junit) + androidTestImplementation(libraries.androidx.test.espresso) +} + +val libVersion: String = scmVersion.version + +publishing { + publications { + create("release") { + groupId = "dev.arkbuilders.components" + artifactId = "utils" + version = libVersion + afterEvaluate { + from(components["release"]) + } + } + } + repositories { + maven { + name = "GithubPackages" + url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/utils/consumer-rules.pro b/utils/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/utils/proguard-rules.pro b/utils/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/utils/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/utils/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt b/utils/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..57afdac --- /dev/null +++ b/utils/src/androidTest/java/dev/arkbuilders/components/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dev.arkbuilders.components + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("dev.arkbuilders.components.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/utils/src/main/AndroidManifest.xml b/utils/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/utils/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt b/utils/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt similarity index 90% rename from components/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt rename to utils/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt index 240d0a2..618710a 100644 --- a/components/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt +++ b/utils/src/main/java/dev/arkbuilders/components/utils/FragmentArgsDelegate.kt @@ -5,9 +5,9 @@ import androidx.fragment.app.Fragment import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -internal fun args() = FragmentArgDelegate() +fun args() = FragmentArgDelegate() -internal class FragmentArgDelegate : ReadWriteProperty { +class FragmentArgDelegate : ReadWriteProperty { override fun setValue(thisRef: Fragment, property: KProperty<*>, value: T?) { val arguments = thisRef.arguments ?: Bundle().also(thisRef::setArguments) diff --git a/components/src/main/java/dev/arkbuilders/components/utils/KeyboardUtils.kt b/utils/src/main/java/dev/arkbuilders/components/utils/KeyboardUtils.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/utils/KeyboardUtils.kt rename to utils/src/main/java/dev/arkbuilders/components/utils/KeyboardUtils.kt diff --git a/components/src/main/java/dev/arkbuilders/components/utils/Popularity.kt b/utils/src/main/java/dev/arkbuilders/components/utils/Popularity.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/utils/Popularity.kt rename to utils/src/main/java/dev/arkbuilders/components/utils/Popularity.kt diff --git a/components/src/main/java/dev/arkbuilders/components/utils/ToastUtils.kt b/utils/src/main/java/dev/arkbuilders/components/utils/ToastUtils.kt similarity index 100% rename from components/src/main/java/dev/arkbuilders/components/utils/ToastUtils.kt rename to utils/src/main/java/dev/arkbuilders/components/utils/ToastUtils.kt diff --git a/components/src/main/java/dev/arkbuilders/components/utils/Utils.kt b/utils/src/main/java/dev/arkbuilders/components/utils/Utils.kt similarity index 82% rename from components/src/main/java/dev/arkbuilders/components/utils/Utils.kt rename to utils/src/main/java/dev/arkbuilders/components/utils/Utils.kt index 424f477..e5edd7c 100644 --- a/components/src/main/java/dev/arkbuilders/components/utils/Utils.kt +++ b/utils/src/main/java/dev/arkbuilders/components/utils/Utils.kt @@ -6,11 +6,10 @@ import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2 -import dev.arkbuilders.components.R import java.text.DecimalFormat import kotlin.math.pow -internal fun View.iconForExtension(ext: String): Int { +fun View.iconForExtension(ext: String): Int { val drawableID = this.resources .getIdentifier( "ark_file_picker_ic_file_$ext", @@ -22,14 +21,14 @@ internal fun View.iconForExtension(ext: String): Int { else R.drawable.ark_file_picker_ic_file } -internal fun Context.dpToPx(dp: Float): Int = +fun Context.dpToPx(dp: Float): Int = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, dp, this.resources.displayMetrics ).toInt() -internal fun ViewPager2.setDragSensitivity(f: Int) { +fun ViewPager2.setDragSensitivity(f: Int) { val recyclerViewField = ViewPager2::class.java.getDeclaredField("mRecyclerView") recyclerViewField.isAccessible = true val recyclerView = recyclerViewField.get(this) as RecyclerView @@ -40,13 +39,13 @@ internal fun ViewPager2.setDragSensitivity(f: Int) { touchSlopField.set(recyclerView, touchSlop*f) } -internal fun View.setMargin(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0) { +fun View.setMargin(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0) { val params = layoutParams as ViewGroup.MarginLayoutParams params.setMargins(left, top, right, bottom) layoutParams = params } -internal fun Long.formatSize(): String { +fun Long.formatSize(): String { if (this <= 0) { return "0 B" } diff --git a/components/src/main/res/drawable/ark_file_picker_ic_file.xml b/utils/src/main/res/drawable/ark_file_picker_ic_file.xml similarity index 100% rename from components/src/main/res/drawable/ark_file_picker_ic_file.xml rename to utils/src/main/res/drawable/ark_file_picker_ic_file.xml diff --git a/utils/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt b/utils/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt new file mode 100644 index 0000000..187f2d4 --- /dev/null +++ b/utils/src/test/java/dev/arkbuilders/components/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package dev.arkbuilders.components + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file