Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@ language: android
sudo: required
jdk: oraclejdk8

stages:
- build
- deploy

before_cache:
-rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
-rm -fr $HOME/.gradle/caches/*/plugin-resolution/
-rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
-rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
-$HOME/.gradle/caches/
-$HOME/.gradle/wrapper/
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

before_install:
- yes | sdkmanager "platforms;android-27"
- yes | sdkmanager "platforms;android-27"

before_script:
- chmod +x gradlew

script:
- "./gradlew clean assembleDebug jacocoTestReport -PdisablePreDex"
- chmod +x gradlew

after_script:
- "java -jar ./codacy-coverage-reporter-4.0.5-assembly.jar report -l Kotlin -r ./rxPreston/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
jobs:
include:
- stage: 'build'
name: 'Build Stage'
script: "./gradlew clean lint assembleDebug jacocoTestReport -PdisablePreDex"
after_script: "java -jar ./codacy-coverage-reporter-4.0.5-assembly.jar report -l Kotlin -r ./rxPreston/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
- stage: 'deploy'
skip_cleanup: true
name: 'Deploy Stage'
if: branch = develop
script: "./gradlew install bintrayUpload"
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

* No changes since last release

## [v1.1.0] Initial Maven Release

### Added
* Added support for maven uploading

### Modified
* Use Androidx rather than support libraries.
* Made `MediaPlayerObserver.kt` an open class to allow for override.
* Updated dependencies to the latest

[Unreleased]: https://github.com/CCorrado/Preston/tree/develop
[README]: https://github.com/CCorrado/Preston/tree/master
[v1.1.0]: https://github.com/CCorrado/Preston/tree/1.1.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Preston is a helpful wrapper around Android's MediaPlayer using RxJava.
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fbf616092167410e95612c6f831f76e4)](https://www.codacy.com/app/CCorrado/Preston?utm_source=github.com&utm_medium=referral&utm_content=CCorrado/Preston&utm_campaign=Badge_Grade)
[![Build Status](https://travis-ci.org/CCorrado/Preston.svg?branch=master)](https://travis-ci.org/CCorrado/Preston)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/fbf616092167410e95612c6f831f76e4)](https://www.codacy.com/app/CCorrado/Preston?utm_source=github.com&utm_medium=referral&utm_content=CCorrado/Preston&utm_campaign=Badge_Coverage)
[ ![Download](https://api.bintray.com/packages/ccorrado/ccorrads/preston/images/download.svg) ](https://bintray.com/ccorrado/ccorrads/preston/_latestVersion)

### Why Preston?
Android's Media Player is a pain point for a lot of Android Developers. There is a lot to consider. The state diagram of Media Player is tough to follow and hard to handle gracefully. https://developer.android.com/reference/android/media/MediaPlayer.html
Expand Down
21 changes: 10 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ apply plugin: 'kotlin-android-extensions'
apply from: './jacoco.gradle'

android {
compileSdkVersion 28
compileSdkVersion rootProject.ext.targetSdk
defaultConfig {
applicationId "com.ccorrads.prestonsample"
minSdkVersion 17
targetSdkVersion 28
versionCode 3
versionName "1.1.0"
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -31,14 +31,13 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$appCompatVersion"

implementation "com.android.support:appcompat-v7:$appCompatVersion"
implementation "com.android.support:design:$appCompatVersion"
implementation "com.android.support:cardview-v7:$appCompatVersion"
implementation "com.android.support:recyclerview-v7:$appCompatVersion"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"

implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'

//RxJava
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid_version"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ccorrads.prestonsample

import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.ccorrads.prestonsample

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.LinearLayoutManager
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.ccorrads.prestonsample.mediacards.MediaItem
import com.ccorrads.prestonsample.mediacards.SampleRVAdapter
import kotlinx.android.synthetic.main.activity_sample.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ccorrads.prestonsample.mediacards

import android.support.v7.widget.RecyclerView
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class MediaViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ccorrads.prestonsample.mediacards

import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ccorrads.preston.media.MediaPlaybackService
import com.ccorrads.preston.media.MediaPlayerObserver
import com.ccorrads.prestonsample.R
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_sample.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SampleActivity">

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sample_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
8 changes: 4 additions & 4 deletions app/src/main/res/layout/card_media_item.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp">

<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand Down Expand Up @@ -68,5 +68,5 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/song_title"/>

</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -19,12 +20,15 @@ allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
ext {
appCompatVersion = "28.0.0"
minSdk = 17
targetSdk = 28
versionCode = 3
versionName = "1.1.0"
gson_version = "2.8.0"
rxJava_version = "2.1.3"
rxJava_version = "2.2.8"
rxAndroid_version = "2.1.1"
okhttp_version = "3.7.0"
joda_version = "2.9.9"
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
42 changes: 33 additions & 9 deletions rxPreston/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply from: './jacoco.gradle'
apply from: './maven.gradle'

android {
compileSdkVersion 28
compileSdkVersion rootProject.ext.targetSdk

defaultConfig {
minSdkVersion 17
targetSdkVersion 28
versionCode 3
versionName "1.1.0"
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand All @@ -33,7 +36,6 @@ android {
includeAndroidResources = true
}
}

}

dependencies {
Expand All @@ -42,11 +44,33 @@ dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:${appCompatVersion}"
implementation "androidx.appcompat:appcompat:1.0.2"

//RxJava
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid_version"
implementation "io.reactivex.rxjava2:rxjava:$rxJava_version"
}
repositories {
mavenCentral()

tasks.withType(Javadoc).all {
enabled = false
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
89 changes: 89 additions & 0 deletions rxPreston/maven.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
ext {
bintrayRepo = 'ccorrads'
bintrayName = 'preston'

publishedGroupId = 'com.ccorrads'
libraryName = 'preston'
artifact = 'rxPreston'

libraryDescription = 'Preston is a helpful wrapper around Android\'s MediaPlayer using RxJava.'

siteUrl = 'https://github.com/CCorrado/Preston'
gitUrl = 'https://github.com/CCorrado/Preston.git'

libraryVersion = rootProject.ext.versionName

developerId = 'ccorrado'
developerName = 'Chris Corrado'
developerEmail = 'ccorrads@gmail.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

bintray {
def ENV = System.getenv()
Properties properties = new Properties()
try {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
} catch (err) {
//no-op
}

user = ENV["BINTRAY_USER"] ?: properties.getProperty("bintray.user")
key = ENV["BINTRAY_KEY"] ?: properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
dryRun = false
publish = true
override = false
publicDownloadNumbers = true
version {
desc = libraryDescription
}
}
}

group = publishedGroupId
version = libraryVersion

install {
repositories.mavenInstaller {
pom.project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact

name libraryName
description libraryDescription
url siteUrl

licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
Loading