Skip to content

Commit

Permalink
Merge pull request #144 from marcauberer/dev
Browse files Browse the repository at this point in the history
Release of version 1.3.0
  • Loading branch information
marcauberer authored May 12, 2021
2 parents f740c37 + 33732f0 commit afc82c3
Show file tree
Hide file tree
Showing 20 changed files with 525 additions and 336 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Prepare publishing environment
run: mkdir ~/.gradle && echo "$ARTIFACTORY_CREDENTIALS" > ./simplesettings/gradle.properties
env:
ARTIFACTORY_CREDENTIALS: ${{ secrets.ARTIFACTORY_CREDENTIALS }}
- name: Android Build
run: ./gradlew assembleDebug
- name: Checkout
uses: actions/checkout@v2
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Android Build
run: ./gradlew assembleDebug
66 changes: 34 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
# Workflow for Android CI release

name: Publish to Artifactory
name: Publish to Sonatype

on:
release:
types: [ published ]
push:
tags:
- '*'

jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest

steps:
- name: Get version name
id: get_version
uses: battila7/get-version-action@v2
- name: Checkout code
- name: Check out code
uses: actions/checkout@v2
with:
persist-credentials: false # Avoids messing up PagesDeployAction
- name: Configure JDK
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Make gradlew executable
run: chmod +x gradlew
- name: Prepare publishing environment
run: mkdir ~/.gradle && echo "$ARTIFACTORY_CREDENTIALS" > ./simplesettings/gradle.properties
env:
ARTIFACTORY_CREDENTIALS: ${{ secrets.ARTIFACTORY_CREDENTIALS }}
- name: Publish Dev
if: ${{ contains(steps.get_version.outputs.version, 'alpha') }}
run: ./gradlew simplesettings:assemble dokkaHtml
- name: Publish
if: ${{ !contains(steps.get_version.outputs.version, 'alpha') }}
run: ./gradlew simplesettings:assemble -PparamEnv=RELEASE dokkaHtml
- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@3.6.2
run: chmod +x ./gradlew

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: simplesettings/build/dokka/html
TARGET_FOLDER: docs
CLEAN: true
distribution: zulu
java-version: 11

- name: Prepare environment
env:
SONATYPE_GPG_FILE_CONTENTS: ${{ secrets.SONATYPE_GPG_FILE_CONTENTS }}
SONATYPE_GPG_FILE: ${{ secrets.SONATYPE_GPG_FILE }}
run: |
git fetch --unshallow
sudo bash -c "echo '$SONATYPE_GPG_FILE_CONTENTS' | base64 -d > '$SONATYPE_GPG_FILE'"
- name: Release build
run: ./gradlew simplesettings:assembleRelease

- name: Publish to MavenCentral
run: ./gradlew simplesettings:publishReleasePublicationToSonatypeRepository -Plibrary_only --no-configure-on-demand --no-parallel dokkaHtml
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SONATYPE_GPG_KEY: ${{ secrets.SONATYPE_GPG_KEY }}
SONATYPE_GPG_PASS: ${{ secrets.SONATYPE_GPG_PASS }}
SONATYPE_GPG_FILE: ${{ secrets.SONATYPE_GPG_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
/build
/captures
.externalNativeBuild
.cxx
simplesettings/gradle.properties
.cxx
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Simple Settings Library for Android
[![Maven Central](https://img.shields.io/maven-central/v/com.chillibits/simplesettings.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.chillibits%22%20AND%20a:%22simplesettings%22)
![GitHub release](https://img.shields.io/github/v/release/marcauberer/simple-settings?include_prereleases)
![Android CI](https://github.com/marcauberer/simple-settings/workflows/Android%20CI/badge.svg)
[![API](https://img.shields.io/badge/API-21%2B-red.svg?style=flat)](https://android-arsenal.com/api?level=21)
Expand All @@ -21,14 +22,14 @@ Add repository to build.gradle file on project level:
allprojects {
repositories {
...
maven { url "https://repo.chillibits.com/artifactory/android" }
maven { url "https://jitpack.io" }
}
}
```

Add dependencies to build.gradle file on module level (e.g. app/build.gradle):
```gradle
implementation 'com.chillibits:simplesettings:1.2.0'
implementation 'com.chillibits:simplesettings:1.3.0'
// Required dependencies
implementation 'com.google.android.material:material:<latest-version>'
Expand Down Expand Up @@ -222,10 +223,16 @@ As you can see, this works for the types `String`, `Int`, `Boolean`, `Float`, `L
### Retrieval as LiveData
Furthermore, the library offers a feature to observe preference values as LiveData as follows:
```kotlin
val inputPref = getPreferenceLiveData(this@MainActivity, "listpreference")
```

or you can retrieve it directly as an LiveData Observer:
```kotlin
getPrefObserver(this@MainActivity, "listpreference", Observer<String> { value ->
textField.text = value
})
```

Like above, this works for the types `String`, `Int`, `Boolean`, `Float`, `Long`, `StringSet`.<br>
*Note: This extension functions are only available for the classes, which implement `LifecycleOwner`.*

Expand Down
51 changes: 40 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,75 @@
* Copyright © Marc Auberer 2020-2021. All rights reserved
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.mikepenz.aboutlibraries.plugin'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.chillibits.simplesettingssample"
minSdkVersion 21
targetSdkVersion 30
versionCode library_version_code
versionName library_version
versionCode libraryVersionCode
versionName libraryVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

kotlinOptions {
jvmTarget = '11'
useIR = true
}
buildFeatures {
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
composeOptions {
kotlinCompilerExtensionVersion composeVersion
kotlinCompilerVersion '1.4.32'
}
}

dependencies {
// Library itself
implementation project(':simplesettings')

// Base dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'androidx.core:core-ktx:1.5.0-beta03'
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation 'androidx.core:core-ktx:1.5.0-rc02'

// Google dependencies
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

// Jetpack Compose
implementation "androidx.compose.ui:ui:$composeVersion"
implementation "androidx.compose.ui:ui-tooling:$composeVersion"
implementation "androidx.compose.material:material:$composeVersion"
implementation "androidx.compose.runtime:runtime-livedata:$composeVersion"
implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha06'
implementation 'androidx.activity:activity-compose:1.3.0-alpha07'

// ChilliBits dependencies
implementation 'com.chillibits:composenumberpicker:1.0.3'

// Test dependencies
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
Expand Down
15 changes: 4 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright © Marc Auberer 2020-2021. All rights reserved
-->

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chillibits.simplesettingssample"
android:installLocation="auto">
android:installLocation="auto" >

<application
android:allowBackup="true"
Expand All @@ -15,12 +10,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity
android:name=".MainActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustPan">

android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
Expand All @@ -29,4 +21,5 @@
</intent-filter>
</activity>
</application>

</manifest>
Loading

0 comments on commit afc82c3

Please sign in to comment.