Skip to content

Commit

Permalink
Initial skeleton (#2)
Browse files Browse the repository at this point in the history
* Project skeleton

* Tidy up sample

* More tweaks

* Add CI workflows

* Rename lib to haze

* Simplify sample

* Add basic implementation

* Simplify sample

* Tidy up Android impl

* Migrate sample to CMP

* Make spotless happy

* Turn off config caching as we're using Kotlin 1.9.10

* Fix Android sample R8 config

* Tidy up the API

* Tweaks docs setup

* Update Sample icon

* Tweak copyright

* Tweak build-logic settings.gradle.kts

* Enable publishing
  • Loading branch information
chrisbanes authored Oct 28, 2023
1 parent 737e3b4 commit ffb4128
Show file tree
Hide file tree
Showing 61 changed files with 2,087 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ktlint_code_style = intellij_idea
ktlint_standard_discouraged-comment-location = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'

jobs:
build:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"

runs-on: macos-13
timeout-minutes: 40

steps:
- uses: actions/checkout@v3

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

- uses: gradle/gradle-build-action@v2

- name: Build
run: ./gradlew build

deploy:
if: github.ref == 'refs/heads/main'

runs-on: macos-13
needs: [ build ]
timeout-minutes: 30

steps:
- uses: actions/checkout@v3

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

- uses: gradle/gradle-build-action@v2

- name: Deploy to Sonatype
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
46 changes: 46 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish docs

on:
push:
tags:
- v*

jobs:
deploy_docs:
runs-on: ubuntu-latest
env:
TERM: dumb

steps:
- uses: actions/checkout@v2

- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 17

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install mkdocs
python3 -m pip install mkdocs-material
- uses: gradle/gradle-build-action@v2

- run: ./gradlew :dokkaHtmlMultiModule

- name: Build site
run: mkdocs build

# TODO: Copy over Dokka API build to ./site

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
96 changes: 96 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Gradle
.gradle
build/

captures

/local.properties

# IntelliJ .idea folder
.idea/workspace.xml
.idea/misc.xml
.idea/libraries
.idea/caches
.idea/navEditor.xml
.idea/tasks.xml
.idea/modules.xml
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/deploymentTargetDropDown.xml
.idea/androidTestResultsUserPreferences.xml
.idea/appInsightsSettings.xml
.idea/artifacts
gradle.xml
*.iml
ios-app/Tivi/.idea/*
.fleet

# General
.DS_Store
.externalNativeBuild

# Do not commit plain-text release keys
app-release.jks
play-account.p12
play-account.json

# Do not commit firebase config
google-services.json

# VS Code config
org.eclipse.buildship.core.prefs
.classpath
.project
bin/


##########################################################################################
# Imported from https://github.com/github/gitignore/blob/main/Swift.gitignore
##########################################################################################

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

report.xml
Preview.html
screenshots/**/*.png
test_output

*.env*
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[![Maven Central](https://img.shields.io/maven-central/v/dev.chrisbanes.haze/haze)](https://search.maven.org/search?q=g:dev.chrisbanes.haze) ![Build status](https://github.com/chrisbanes/haze/actions/workflows/build.yml/badge.svg)

## Haze

Snapper is now deprecated, due to it's functionality being replaced by [`SnapFlingBehavior`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/snapping/SnapFlingBehavior) which is available in Jetpack Compose 1.3.0.

The `SnapFlingBehavior` API is very similar to Snapper, so migration should be very easy. I haven't provided an automatic migration path, as I feel that it's important to learn the new API by performing the migration yourself.

## Library

![](docs/assets/header.png)

Snapper is a library which brings snapping to the Compose scrolling layouts (currently only LazyColumn and LazyRow).

Check out the website for more information: https://chrisbanes.github.io/haze

## License

```
Copyright 2023 Chris Banes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2023, Christopher Banes and the Haze project contributors
// SPDX-License-Identifier: Apache-2.0


plugins {
id("dev.chrisbanes.root")

alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.cacheFixPlugin) apply false
alias(libs.plugins.android.lint) apply false
alias(libs.plugins.android.test) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.mavenpublish) apply false
alias(libs.plugins.dokka)
}
1 change: 1 addition & 0 deletions docs/assets/croc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/demo.mp4
Binary file not shown.
Binary file added docs/assets/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/tivi.mp4
Binary file not shown.
Loading

0 comments on commit ffb4128

Please sign in to comment.