Skip to content

Commit 84827f4

Browse files
authored
Merge pull request #7 from Commit451/feature/open-source-library-migration-v2
Migrate AdapterLayout with open-source-library-migration guide
2 parents cf3976d + 943dc39 commit 84827f4

36 files changed

+854
-781
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Configure JDK
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: zulu
19+
java-version: '17'
20+
cache: gradle
21+
22+
- name: Validate Gradle Wrapper
23+
uses: gradle/actions/wrapper-validation@v4
24+
25+
- name: Build
26+
run: ./gradlew build
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
RELEASE_SIGNING_ENABLED: true
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
if: github.repository == 'Commit451/AdapterLayout'
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: zulu
24+
java-version: '17'
25+
cache: gradle
26+
27+
- name: Release to Maven Central
28+
run: ./gradlew publishAndReleaseToMavenCentral -PVERSION_NAME="${GITHUB_REF_NAME}" --no-configuration-cache
29+
env:
30+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
31+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
32+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
11
# AdapterLayout
22
ViewGroup backed by RecyclerView.Adapter, allowing for easy data set manipulation with non recycling views. Aka RecyclerView minus the recycling.
33

4-
[![Build Status](https://travis-ci.org/Commit451/AdapterLayout.svg?branch=master)](https://travis-ci.org/Commit451/AdapterLayout) [![](https://jitpack.io/v/Commit451/AdapterLayout.svg)](https://jitpack.io/#Commit451/AdapterLayout)
4+
[![Build](https://github.com/Commit451/AdapterLayout/actions/workflows/ci.yml/badge.svg)](https://github.com/Commit451/AdapterLayout/actions/workflows/ci.yml) [![Maven Central](https://img.shields.io/maven-central/v/com.commit451.adapterlayout/adapterlayout.svg?label=Maven%20Central)](https://central.sonatype.com/search?q=g:com.commit451.adapterlayout)
55

66
# Dependency
7-
```gradle
8-
allprojects {
9-
repositories {
10-
maven { url "https://jitpack.io" }
11-
}
12-
}
13-
```
14-
and within your application `build.gradle`
15-
167
```gradle
178
dependencies {
18-
implementation 'com.github.Commit451.AdapterLayout:adapterlayout:latest.release.here'
9+
implementation "com.commit451.adapterlayout:adapterlayout:latest.release.here"
1910
}
2011
```
2112
and for [FlowLayout](https://github.com/blazsolar/FlowLayout) support:
2213
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.wefika/flowlayout/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.wefika/flowlayout)
2314
```gradle
2415
dependencies {
25-
//add the latest of FlowLayout
26-
implementation 'com.wefika:flowlayout:latest.release.here'
27-
implementation 'com.github.Commit451.AdapterLayout:adapterflowlayout:latest.release.here'
28-
}
29-
```
30-
and for Kotlin extensions support:
31-
```gradle
32-
dependencies {
33-
implementation 'com.github.Commit451.AdapterLayout:adapterlayout-kotlin:latest.release.here'
16+
// add the latest of FlowLayout
17+
implementation "com.wefika:flowlayout:latest.release.here"
18+
implementation "com.commit451.adapterlayout:adapterflowlayout:latest.release.here"
3419
}
3520
```
21+
Kotlin extensions are included in `adapterlayout`.
3622

3723
# Usage
3824
See the sample project for full usage.

adapterflowlayout/build.gradle

Lines changed: 0 additions & 30 deletions
This file was deleted.

adapterflowlayout/build.gradle.kts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
2+
import com.vanniktech.maven.publish.SonatypeHost
3+
4+
plugins {
5+
id("com.android.library")
6+
id("com.vanniktech.maven.publish")
7+
}
8+
9+
group = findProperty("GROUP") as String
10+
version = findProperty("VERSION_NAME") as String
11+
12+
android {
13+
namespace = "com.commit451.adapterflowlayout"
14+
compileSdk = 35
15+
16+
defaultConfig {
17+
minSdk = 21
18+
}
19+
20+
buildTypes {
21+
release {
22+
isMinifyEnabled = false
23+
proguardFiles(
24+
getDefaultProguardFile("proguard-android-optimize.txt"),
25+
"proguard-rules.pro",
26+
)
27+
}
28+
}
29+
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_17
32+
targetCompatibility = JavaVersion.VERSION_17
33+
}
34+
35+
lint {
36+
abortOnError = false
37+
}
38+
}
39+
40+
dependencies {
41+
compileOnly("com.wefika:flowlayout:0.4.1") {
42+
exclude(group = "com.intellij", module = "annotations")
43+
}
44+
compileOnly(project(":adapterlayout"))
45+
}
46+
47+
mavenPublishing {
48+
configure(AndroidSingleVariantLibrary("release", true, true))
49+
coordinates("com.commit451.adapterlayout", "adapterflowlayout", version.toString())
50+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
51+
if (System.getenv("RELEASE_SIGNING_ENABLED") == "true") {
52+
signAllPublications()
53+
}
54+
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.commit451.adapterflowlayout"/>
1+
<manifest />

adapterflowlayout/src/main/java/com/commit451/adapterflowlayout/AdapterFlowLayout.java

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@file:Suppress("unused")
2+
3+
package com.commit451.adapterflowlayout
4+
5+
import android.content.Context
6+
import android.util.AttributeSet
7+
import androidx.annotation.Nullable
8+
import androidx.recyclerview.widget.RecyclerView
9+
import com.commit451.adapterlayout.AdapterLayoutDelegate
10+
import com.wefika.flowlayout.FlowLayout
11+
12+
/**
13+
* [FlowLayout] with [RecyclerView.Adapter] support.
14+
*/
15+
class AdapterFlowLayout : FlowLayout {
16+
17+
private var adapterLayoutDelegate: AdapterLayoutDelegate? = null
18+
19+
constructor(context: Context?) : super(context)
20+
21+
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
22+
23+
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
24+
25+
@get:Nullable
26+
var adapter: RecyclerView.Adapter<*>?
27+
get() = adapterLayoutDelegate?.getAdapter()
28+
set(value) {
29+
if (adapterLayoutDelegate == null) {
30+
adapterLayoutDelegate = AdapterLayoutDelegate(this)
31+
}
32+
adapterLayoutDelegate?.setAdapter(value)
33+
}
34+
35+
@Nullable
36+
fun getViewHolderAt(index: Int): RecyclerView.ViewHolder? {
37+
return adapterLayoutDelegate?.getViewHolderAt(index)
38+
}
39+
}

adapterlayout-kotlin/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)