Skip to content

Commit

Permalink
bump rxjava3 version;
Browse files Browse the repository at this point in the history
refactor package name.
  • Loading branch information
qingmei2 committed Nov 22, 2019
1 parent 667d37f commit c0ad40c
Show file tree
Hide file tree
Showing 28 changed files with 66 additions and 88 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buildscript {

// plugin for jcenter
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
Expand All @@ -24,6 +25,7 @@ allprojects {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://oss.jfrog.org/libs-snapshot/" }
}

tasks.withType(Javadoc) {
Expand Down
12 changes: 6 additions & 6 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ def glide_version = '4.9.0'
project.ext {

android = [
compileSdkVersion: 28,
compileSdkVersion: 29,
minSdkVersion : 16,
targetSdkVersion : 28,
versionCode : 36,
versionName : '3.0.0-beta01'
targetSdkVersion : 29,
versionCode : 38,
versionName : '3.0.0-beta02'
]

constants = [
Expand All @@ -31,8 +31,8 @@ project.ext {
"kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version",

//rx
"rxjava3" : "io.reactivex.rxjava3:rxjava:3.0.0-RC0",
"rxandroid" : "io.reactivex.rxjava2:rxandroid:2.1.0",
"rxjava3" : "io.reactivex.rxjava3:rxjava:3.0.0-RC5",
"rxandroid" : "io.reactivex.rxjava3:rxandroid:3.0.0-SNAPSHOT",

//glide
"glide" : "com.github.bumptech.glide:glide:${glide_version}",
Expand Down
2 changes: 1 addition & 1 deletion rximagepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies {

api rootProject.ext.dependencies['rxjava3']
api(rootProject.ext.dependencies['rxandroid']) {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'io.reactivex.rxjava3', module: 'rxjava'
}

implementation rootProject.ext.dependencies['kotlin-android']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.qingmei2.rximagepicker.entity.ConfigProvider
import com.qingmei2.rximagepicker.scheduler.IRxImagePickerSchedulers
import com.qingmei2.rximagepicker.entity.sources.SourcesFrom
import com.qingmei2.rximagepicker.ui.ActivityPickerViewController
import io.reactivex.Observable
import io.reactivex.rxjava3.core.Observable

/**
* [ConfigProcessor] is the class that processing reactive data stream.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.qingmei2.rximagepicker.core

import com.qingmei2.rximagepicker.scheduler.RxImagePickerSchedulers
import io.reactivex.*
import io.reactivex.functions.Supplier
import io.reactivex.rxjava3.core.*
import io.reactivex.rxjava3.functions.Supplier
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.qingmei2.rximagepicker.scheduler

import io.reactivex.Scheduler
import io.reactivex.rxjava3.core.Scheduler

/**
* [IRxImagePickerSchedulers] is used to manage the [Scheduler].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.qingmei2.rximagepicker.scheduler

import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Scheduler
import io.reactivex.rxjava3.schedulers.Schedulers


/**
* An extra layer of packaging, using [IRxImagePickerSchedulers] for control thread switch.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.qingmei2.rximagepicker.scheduler

import io.reactivex.Scheduler
import io.reactivex.schedulers.Schedulers
import io.reactivex.rxjava3.core.Scheduler
import io.reactivex.rxjava3.schedulers.Schedulers

/**
* An extra layer of packaging, using [RxImagePickerTestSchedulers] for easier testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package com.qingmei2.rximagepicker.ui

import android.app.Activity
import android.content.Intent
import androidx.fragment.app.FragmentActivity

import com.qingmei2.rximagepicker.entity.Result
import io.reactivex.rxjava3.core.Observable

import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.rxjava3.subjects.PublishSubject

class ActivityPickerViewController private constructor() : ICustomPickerView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import com.qingmei2.rximagepicker.entity.Result
import com.qingmei2.rximagepicker.function.parseResultNoExtraData
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.subjects.PublishSubject

abstract class BaseSystemPickerFragment : Fragment() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import com.qingmei2.rximagepicker.entity.Result
import com.qingmei2.rximagepicker.entity.sources.Camera
import com.qingmei2.rximagepicker.entity.sources.Gallery
import io.reactivex.Observable
import io.reactivex.rxjava3.core.Observable

interface BasicImagePicker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.annotation.IdRes

import com.qingmei2.rximagepicker.entity.Result

import io.reactivex.Observable
import io.reactivex.rxjava3.core.Observable

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import androidx.fragment.app.FragmentActivity
import com.qingmei2.rximagepicker.entity.Result
import com.qingmei2.rximagepicker.ui.BaseSystemPickerFragment
import com.qingmei2.rximagepicker.ui.ICustomPickerConfiguration
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.rxjava3.subjects.PublishSubject
import java.text.SimpleDateFormat
import java.util.*

Expand All @@ -35,7 +34,7 @@ class BasicCameraFragment : BaseSystemPickerFragment(), ICameraCustomPickerView
}
}

override fun pickImage(): Observable<Result> {
override fun pickImage(): io.reactivex.rxjava3.core.Observable<Result> {
publishSubject = PublishSubject.create<Result>()
return uriObserver
}
Expand All @@ -48,7 +47,7 @@ class BasicCameraFragment : BaseSystemPickerFragment(), ICameraCustomPickerView
val pictureChooseIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
pictureChooseIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraPictureUrl)

startActivityForResult(pictureChooseIntent, BaseSystemPickerFragment.CAMERA_REQUEST_CODE)
startActivityForResult(pictureChooseIntent, CAMERA_REQUEST_CODE)
}

override fun getActivityResultUri(data: Intent?): Uri? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.fragment.app.FragmentActivity
import com.qingmei2.rximagepicker.entity.Result
import com.qingmei2.rximagepicker.ui.BaseSystemPickerFragment
import com.qingmei2.rximagepicker.ui.ICustomPickerConfiguration
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.subjects.PublishSubject

class BasicGalleryFragment : BaseSystemPickerFragment(), IGalleryCustomPickerView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Item : Parcelable {
private constructor(source: Parcel) {
id = source.readLong()
mimeType = source.readString()
contentUri = source.readParcelable(Uri::class.java.classLoader)
contentUri = source.readParcelable(Uri::class.java.classLoader)!!
size = source.readLong()
duration = source.readLong()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ class AlbumMediaCollection : androidx.loader.app.LoaderManager.LoaderCallbacks<C
private var mLoaderManager: androidx.loader.app.LoaderManager? = null
private var mCallbacks: AlbumMediaCallbacks? = null

override fun onCreateLoader(id: Int, args: Bundle?): androidx.loader.content.Loader<Cursor> {
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor> {
val context = mContext!!.get()
val album = args!!.getParcelable<Album>(ARGS_ALBUM)
val album = requireNotNull(args!!.getParcelable<Album>(ARGS_ALBUM))

return AlbumMediaLoader.newInstance(context, album,
album.isAll && args.getBoolean(ARGS_ENABLE_CAPTURE, false))
}

override fun onLoadFinished(loader: androidx.loader.content.Loader<Cursor>, data: Cursor) {
override fun onLoadFinished(loader: Loader<Cursor>, data: Cursor) {
mContext?.get() ?: return

mCallbacks!!.onAlbumMediaLoad(data)
}

override fun onLoaderReset(loader: androidx.loader.content.Loader<Cursor>) {
override fun onLoaderReset(loader: Loader<Cursor>) {
mContext?.get() ?: return

mCallbacks!!.onAlbumMediaReset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ open class SelectedPreviewActivity : BasePreviewActivity() {
super.onCreate(savedInstanceState)

val bundle = intent.getBundleExtra(BasePreviewActivity.EXTRA_DEFAULT_BUNDLE)
val selected = bundle.getParcelableArrayList<Item>(SelectedItemCollection.STATE_SELECTION)
mAdapter.addAll(selected)
val selected =
bundle.getParcelableArrayList<Item>(SelectedItemCollection.STATE_SELECTION)
mAdapter.addAll(requireNotNull(selected))
mAdapter.notifyDataSetChanged()
if (mSpec.countable) {
mCheckView.setCheckedNum(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ open class AlbumMediaAdapter(context: Context,

init {
val ta = context.theme.obtainStyledAttributes(intArrayOf(R.attr.item_placeholder))
mPlaceholder = ta.getDrawable(0)
mPlaceholder = ta.getDrawable(0)!!
ta.recycle()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import com.qingmei2.rximagepicker.ui.camera.BasicCameraFragment
import com.qingmei2.rximagepicker_extension.entity.SelectionSpec
import com.qingmei2.rximagepicker_extension.ui.adapter.AlbumMediaAdapter
import com.qingmei2.rximagepicker_extension_wechat.R
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable

class WechatImagePickerActivity : AppCompatActivity(), AlbumMediaAdapter.OnPhotoCapture {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ import com.qingmei2.rximagepicker_extension.ui.widget.AlbumsSpinner
import com.qingmei2.rximagepicker_extension_wechat.R
import com.qingmei2.rximagepicker_extension_wechat.ui.adapter.WechatAlbumsAdapter
import com.qingmei2.rximagepicker_extension_wechat.ui.widget.WechatAlbumsSpinner
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import java.util.*
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.subjects.PublishSubject

class WechatImagePickerFragment : Fragment(), IGalleryCustomPickerView,
AlbumCollection.AlbumCallbacks, AdapterView.OnItemSelectedListener,
Expand Down Expand Up @@ -112,7 +111,7 @@ class WechatImagePickerFragment : Fragment(), IGalleryCustomPickerView,
return publishSubject
}

fun closure() {
private fun closure() {
if (activity is WechatImagePickerActivity) {
(activity as WechatImagePickerActivity).closure()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import com.qingmei2.rximagepicker.ui.camera.BasicCameraFragment
import com.qingmei2.rximagepicker_extension.entity.SelectionSpec
import com.qingmei2.rximagepicker_extension.ui.adapter.AlbumMediaAdapter
import com.qingmei2.rximagepicker_extension_zhihu.R
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable

class ZhihuImagePickerActivity : AppCompatActivity(), AlbumMediaAdapter.OnPhotoCapture {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.qingmei2.rximagepicker_extension.ui.adapter.AlbumMediaAdapter
import com.qingmei2.rximagepicker_extension.ui.adapter.AlbumsAdapter
import com.qingmei2.rximagepicker_extension.ui.widget.AlbumsSpinner
import com.qingmei2.rximagepicker_extension_zhihu.R
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.subjects.PublishSubject
import java.util.*

class ZhihuImagePickerFragment : androidx.fragment.app.Fragment(), IGalleryCustomPickerView, AlbumCollection.AlbumCallbacks,
Expand Down
46 changes: 12 additions & 34 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,7 @@ android {
}
}

final boolean useRemote = true
final String substituteReason = 'we work with the unreleased development version.'

final String rxImagePickerRemote = "com.github.qingmei2:rximagepicker:$rootProject.ext.android.versionName"
final String rxImagePickerUiRemote = "com.github.qingmei2:rximagepicker_support:$rootProject.ext.android.versionName"
final String rxImagePickerZhihuRemote = "com.github.qingmei2:rximagepicker_support_zhihu:$rootProject.ext.android.versionName"
final String rxImagePickerWechatRemote = "com.github.qingmei2:rximagepicker_support_wechat:$rootProject.ext.android.versionName"

configurations {
all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.reactivex.rxjava3' &&
details.requested.name == 'rxjava') {
details.useVersion '3.0.0-RC0'
details.because 'Unified dependency version.'
}
}
dependencySubstitution {
if (!useRemote) {
substitute module(rxImagePickerRemote) because substituteReason with project(':rximagepicker')
substitute module(rxImagePickerUiRemote) because substituteReason with project(':rximagepicker_support')
substitute module(rxImagePickerZhihuRemote) because substituteReason with project(':rximagepicker_support_wechat')
substitute module(rxImagePickerWechatRemote) because substituteReason with project(':rximagepicker_support_zhihu')
}
}
}
}
// compile.exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
}
final boolean useRemote = false

dependencies {
implementation rootProject.ext.dependencies['kotlin-android']
Expand All @@ -79,10 +50,17 @@ dependencies {
androidTestImplementation rootProject.ext.dependencies['test-runner']
androidTestImplementation rootProject.ext.dependencies['test-rules']

implementation rxImagePickerRemote
implementation rxImagePickerUiRemote
implementation rxImagePickerZhihuRemote
implementation rxImagePickerWechatRemote
if (useRemote) {
implementation "com.github.qingmei2:rximagepicker:$rootProject.ext.android.versionName"
implementation "com.github.qingmei2:rximagepicker_support:$rootProject.ext.android.versionName"
implementation "com.github.qingmei2:rximagepicker_support_zhihu:$rootProject.ext.android.versionName"
implementation "com.github.qingmei2:rximagepicker_support_wechat:$rootProject.ext.android.versionName"
} else {
implementation project(':rximagepicker')
implementation project(':rximagepicker_support')
implementation project(':rximagepicker_support_wechat')
implementation project(':rximagepicker_support_zhihu')
}

testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation rootProject.ext.dependencies["junit"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.qingmei2.rximagepicker.entity.Result
import com.qingmei2.rximagepicker.entity.sources.Camera
import com.qingmei2.rximagepicker.entity.sources.Gallery
import com.qingmei2.rximagepicker.ui.ICustomPickerConfiguration
import io.reactivex.Observable
import io.reactivex.rxjava3.core.Observable

interface SystemImagePicker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.qingmei2.rximagepicker_extension.MimeType
import com.qingmei2.rximagepicker_extension_wechat.WechatConfigrationBuilder
import com.qingmei2.rximagepicker_extension_wechat.ui.WechatImagePickerFragment
import com.qingmei2.sample.R
import io.reactivex.functions.Consumer
import io.reactivex.rxjava3.functions.Consumer
import kotlinx.android.synthetic.main.activity_wechat.*

@SuppressLint("CheckResult")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.qingmei2.rximagepicker.ui.ICustomPickerConfiguration;
import com.qingmei2.rximagepicker_extension_wechat.ui.WechatImagePickerActivity;

import io.reactivex.Observable;
import io.reactivex.rxjava3.core.Observable;

public interface WechatImagePicker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import com.qingmei2.rximagepicker_extension.MimeType
import com.qingmei2.rximagepicker_extension_zhihu.ZhihuConfigurationBuilder
import com.qingmei2.rximagepicker_extension_zhihu.ui.ZhihuImagePickerFragment
import com.qingmei2.sample.R
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable
import kotlinx.android.synthetic.main.activity_zhihu.*

class ZhihuActivity : AppCompatActivity() {
Expand Down
Loading

0 comments on commit c0ad40c

Please sign in to comment.