Skip to content

Commit

Permalink
⬆️ Support library upgrade to 28.0.0 and Target sdk version upgrade t…
Browse files Browse the repository at this point in the history
…o 28
  • Loading branch information
Flyge committed Oct 19, 2018
1 parent 8b393ef commit 6e4c3fd
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 68 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 2.6.3 pre

* :arrow_up: Target sdk version upgrade to 28
* :arrow_up: Support library upgrade to 28.0.0
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.30'
ext.kotlin_version = '1.2.71'
repositories {
maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } // Huawei Maven mirrors
maven { url 'https://dl.google.com/dl/android/maven2/' }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.novoda:bintray-release:0.8.1'
// classpath 'com.novoda:bintray-release:0.8.1'
classpath 'guru.stefma.bintrayrelease:bintrayrelease:1.0.0'
}
}

allprojects {
repositories {
maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } // Huawei Maven mirrors
maven { url 'https://dl.google.com/dl/android/maven2/' }
jcenter()
google()
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

COMPILE_SDK_VERSION=27
COMPILE_SDK_VERSION=28
MIN_SDK_VERSION=14
TARGET_SDK_VERSION=22
TARGET_SDK_VERSION=28

VERSION_CODE=2620
VERSION_NAME=2.6.2

SUPPORT_VERSION=27.1.1
SUPPORT_VERSION=28.0.0
LIFECYCLE_VERSION=1.1.1
PAGING_VERSION=1.0.1
ANDROIDX_CORE_KTX_VERSION=0.3
CONSTRAINT_LAYOUT_VERSION=1.1.2
CONSTRAINT_LAYOUT_VERSION=1.1.3
ASSEMBLY_ADAPTER_VERSION=3.2.1
PAGER_INDICATOR=1.8.0
FFMPEG_MEDIA_METADATA_RETRIEVER_VERSION=1.0.14
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed May 09 10:53:16 CST 2018
#Fri Oct 19 11:18:57 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.panpf.sketch.sample.util
package me.panpf.sketch.sample

import android.content.Context
import android.preference.PreferenceManager
import me.panpf.sketch.sample.BuildConfig
import me.panpf.sketch.sample.event.AppConfigChangedEvent
import org.greenrobot.eventbus.EventBus

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import me.panpf.sketch.Configuration
import me.panpf.sketch.Initializer
import me.panpf.sketch.SLog
import me.panpf.sketch.sample.event.AppConfigChangedEvent
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.util.XpkIconUriModel
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package me.panpf.sketch.sample.bean
import android.content.Context
import android.view.View
import me.panpf.adapter.AssemblyAdapter
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig

class CheckMenu(private val context: Context, var title: String, private val key: AppConfig.Key,
private val onCheckedChangedListener: OnCheckedChangedListener?, private val onClickListener: View.OnClickListener?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.panpf.sketch.sample.event

import me.panpf.sketch.sample.ui.Page
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig

class ChangePageEvent(val page: Page)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import me.panpf.adapter.pager.AssemblyFragmentItemFactory

import me.panpf.sketch.sample.bean.Image
import me.panpf.sketch.sample.ui.ImageFragment
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig

class ImageFragmentItemFactory(private val context: Context, private var loadingImageOptionsId: String?) : AssemblyFragmentItemFactory<Image>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import me.panpf.adapter.AssemblyItemFactory
import me.panpf.adapter.ktx.bindView
import me.panpf.sketch.sample.ImageOptions
import me.panpf.sketch.sample.R
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig
import me.panpf.sketch.sample.widget.SampleImageView
import me.panpf.sketch.util.SketchUtils

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import me.panpf.sketch.sample.R
import me.panpf.sketch.sample.bean.Image
import me.panpf.sketch.sample.event.AppConfigChangedEvent
import me.panpf.sketch.sample.event.RegisterEvent
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig
import me.panpf.sketch.sample.util.ApplyWallpaperAsyncTask
import me.panpf.sketch.sample.util.SaveImageAsyncTask
import me.panpf.sketch.sample.widget.MappingView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import me.panpf.sketch.sample.item.CheckMenuItemFactory
import me.panpf.sketch.sample.item.InfoMenuItemFactory
import me.panpf.sketch.sample.item.MenuTitleItemFactory
import me.panpf.sketch.sample.item.PageMenuItemFactory
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig
import me.panpf.sketch.sample.util.DeviceUtils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import me.panpf.sketch.sample.event.AppConfigChangedEvent
import me.panpf.sketch.sample.event.ChangeMainPageBgEvent
import me.panpf.sketch.sample.event.RegisterEvent
import me.panpf.sketch.sample.item.MyPhotoItemFactory
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig
import me.panpf.sketch.sample.util.ImageOrientationCorrectTestFileGenerator
import me.panpf.sketch.sample.util.ScrollingPauseLoadManager
import me.panpf.sketch.util.SketchUtils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.panpf.sketch.sample.util

import android.annotation.SuppressLint
import android.app.WallpaperManager
import android.content.Context
import android.os.AsyncTask
Expand All @@ -14,11 +15,8 @@ import java.io.InputStream
* 应用壁纸异步任务
*/
class ApplyWallpaperAsyncTask(context: Context, private val imageFile: File) : AsyncTask<Int, Int, Boolean>() {
private val context: Context

init {
this.context = context.applicationContext
}
@SuppressLint("StaticFieldLeak")
private val context: Context = context.applicationContext

override fun doInBackground(vararg params: Int?): Boolean {
var inputStream: InputStream? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,4 @@ public static int getWindowHeightSupplement(Activity activity) {
}
return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.widget.WrapperListAdapter;

import me.panpf.sketch.Sketch;
import me.panpf.sketch.sample.AppConfig;

/**
* 滚动中暂停暂停加载新图片管理器支持RecyclerView和AbsListView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ class DoubleFinsEmptyView : LinearLayout {
}

// 按离左上角的距离排序
Collections.sort(childRectList) { o1, o2 ->
childRectList.sortWith(Comparator { o1, o2 ->
if (o1.top >= o2.bottom || o2.top >= o1.bottom) {
o1.top - o2.top
} else {
o1.left - o2.left
}
}
})

val left = rect.left
var top = rect.top
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import me.panpf.sketch.drawable.SketchLoadingDrawable
import me.panpf.sketch.drawable.SketchShapeBitmapDrawable
import me.panpf.sketch.request.RedisplayListener
import me.panpf.sketch.request.Resize
import me.panpf.sketch.uri.GetDataSourceException
import me.panpf.sketch.uri.UriModel
import me.panpf.sketch.util.SketchUtils
import me.panpf.sketch.sample.ImageOptions
import me.panpf.sketch.sample.R
import me.panpf.sketch.sample.event.AppConfigChangedEvent
import me.panpf.sketch.sample.event.CacheCleanEvent
import me.panpf.sketch.sample.util.AppConfig
import me.panpf.sketch.sample.AppConfig
import me.panpf.sketch.uri.GetDataSourceException
import me.panpf.sketch.uri.UriModel
import me.panpf.sketch.util.SketchUtils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.EventBusException
import org.greenrobot.eventbus.Subscribe
Expand Down Expand Up @@ -74,43 +74,51 @@ class SampleImageView @JvmOverloads constructor(context: Context, attrs: Attribu

@Subscribe
fun onEvent(event: AppConfigChangedEvent) {
when {
AppConfig.Key.SHOW_GIF_FLAG == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
when (event.key) {
AppConfig.Key.SHOW_GIF_FLAG -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
setShowGifFlagEnabled(if (AppConfig.getBoolean(context, AppConfig.Key.SHOW_GIF_FLAG)) R.drawable.ic_gif else 0)
}
AppConfig.Key.SHOW_IMAGE_FROM_FLAG == event.key -> isShowImageFromEnabled = AppConfig.getBoolean(context, event.key)
AppConfig.Key.CLICK_SHOW_PRESSED_STATUS == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
AppConfig.Key.SHOW_IMAGE_FROM_FLAG -> isShowImageFromEnabled = AppConfig.getBoolean(context, event.key)
AppConfig.Key.CLICK_SHOW_PRESSED_STATUS -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
isShowPressedStatusEnabled = AppConfig.getBoolean(context, event.key)
}
AppConfig.Key.SHOW_IMAGE_DOWNLOAD_PROGRESS == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
AppConfig.Key.SHOW_IMAGE_DOWNLOAD_PROGRESS -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
isShowDownloadProgressEnabled = AppConfig.getBoolean(context, event.key)
}
AppConfig.Key.CLICK_RETRY_ON_PAUSE_DOWNLOAD == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
AppConfig.Key.CLICK_RETRY_ON_PAUSE_DOWNLOAD -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
isClickRetryOnPauseDownloadEnabled = AppConfig.getBoolean(context, event.key)
}
AppConfig.Key.CLICK_RETRY_ON_FAILED == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
AppConfig.Key.CLICK_RETRY_ON_FAILED -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
isClickRetryOnDisplayErrorEnabled = AppConfig.getBoolean(context, event.key)
}
AppConfig.Key.CLICK_PLAY_GIF == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
AppConfig.Key.CLICK_PLAY_GIF -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST || page == Page.APP_LIST) {
setClickPlayGifEnabled(if (AppConfig.getBoolean(context, event.key)) R.drawable.ic_video_play else 0)
}
AppConfig.Key.MOBILE_NETWORK_PAUSE_DOWNLOAD == event.key -> redisplay(null)
AppConfig.Key.GLOBAL_DISABLE_CACHE_IN_DISK == event.key -> redisplay(null)
AppConfig.Key.GLOBAL_DISABLE_BITMAP_POOL == event.key -> redisplay(null)
AppConfig.Key.GLOBAL_DISABLE_CACHE_IN_MEMORY == event.key -> redisplay(null)
AppConfig.Key.DISABLE_CORRECT_IMAGE_ORIENTATION == event.key -> {
AppConfig.Key.MOBILE_NETWORK_PAUSE_DOWNLOAD -> {
redisplay(null)
}
AppConfig.Key.GLOBAL_DISABLE_CACHE_IN_DISK -> {
redisplay(null)
}
AppConfig.Key.GLOBAL_DISABLE_BITMAP_POOL -> {
redisplay(null)
}
AppConfig.Key.GLOBAL_DISABLE_CACHE_IN_MEMORY -> {
redisplay(null)
}
AppConfig.Key.DISABLE_CORRECT_IMAGE_ORIENTATION -> {
val correctImageOrientationDisabled = AppConfig.getBoolean(context, event.key)
options.isCorrectImageOrientationDisabled = correctImageOrientationDisabled

redisplay { _, cacheOptions -> cacheOptions.isCorrectImageOrientationDisabled = correctImageOrientationDisabled }
}
AppConfig.Key.PLAY_GIF_ON_LIST == event.key -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST) {
AppConfig.Key.PLAY_GIF_ON_LIST -> if (page == Page.PHOTO_LIST || page == Page.SEARCH_LIST || page == Page.UNSPLASH_LIST) {
val playGifOnList = AppConfig.getBoolean(context, event.key)
options.isDecodeGifImage = playGifOnList

redisplay { _, cacheOptions -> cacheOptions.isDecodeGifImage = playGifOnList }
}
AppConfig.Key.THUMBNAIL_MODE == event.key -> if (page == Page.PHOTO_LIST) {
AppConfig.Key.THUMBNAIL_MODE -> if (page == Page.PHOTO_LIST) {
val thumbnailMode = AppConfig.getBoolean(context, event.key)
options.isThumbnailMode = thumbnailMode
if (thumbnailMode) {
Expand All @@ -128,16 +136,20 @@ class SampleImageView @JvmOverloads constructor(context: Context, attrs: Attribu
}
}
}
AppConfig.Key.CACHE_PROCESSED_IMAGE == event.key -> {
AppConfig.Key.CACHE_PROCESSED_IMAGE -> {
val cacheProcessedImageInDisk = AppConfig.getBoolean(context, event.key)
options.isCacheProcessedImageInDisk = cacheProcessedImageInDisk

redisplay { _, cacheOptions -> cacheOptions.isCacheProcessedImageInDisk = cacheProcessedImageInDisk }
}
AppConfig.Key.LONG_CLICK_SHOW_IMAGE_INFO == event.key -> if (AppConfig.getBoolean(context, AppConfig.Key.LONG_CLICK_SHOW_IMAGE_INFO)) {
onLongClickListener = longClickShowDrawableInfoListener
} else {
onLongClickListener = null
AppConfig.Key.LONG_CLICK_SHOW_IMAGE_INFO -> {
onLongClickListener = if (AppConfig.getBoolean(context, AppConfig.Key.LONG_CLICK_SHOW_IMAGE_INFO)) {
longClickShowDrawableInfoListener
} else {
null
}
}
else -> {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ZoomOutPageTransformer : ViewPager.PageTransformer {
}

companion object {
private val MIN_SCALE = 0.85f
private const val MIN_SCALE = 0.85f

private val MIN_ALPHA = 0.5f
private const val MIN_ALPHA = 0.5f
}
}
24 changes: 19 additions & 5 deletions sketch-gif/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
//apply plugin: 'com.novoda.bintray-release'
apply plugin: "guru.stefma.bintrayrelease"

android {
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
Expand All @@ -25,16 +26,29 @@ dependencies {
implementation "com.android.support:support-annotations:${SUPPORT_VERSION}"
}

//publish {
// groupId = 'me.panpf'
// artifactId = 'sketch-gif'
// publishVersion = android.defaultConfig.versionName
// desc = 'Android, Image, Load, GIF'
// website = 'https://github.com/panpf/sketch'
//
// def properties = new Properties()
// properties.load(project.file("local.properties").newDataInputStream())
// bintrayUser = properties.getProperty("bintray.user")
// userOrg = properties.getProperty("bintray.userOrg")
// bintrayKey = properties.getProperty("bintray.apikey")
//}

version = android.defaultConfig.versionName
group = 'me.panpf'
publish {
groupId = 'me.panpf'
artifactId = 'sketch-gif'
publishVersion = android.defaultConfig.versionName
desc = 'Android, Image, Load, GIF'
website = 'https://github.com/panpf/sketch'

def properties = new Properties()
properties.load(project.file("local.properties").newDataInputStream())
bintrayUser = properties.getProperty("bintray.user")
userOrg = properties.getProperty("bintray.userOrg")
bintrayUser = properties.getProperty("bintray.user")
bintrayKey = properties.getProperty("bintray.apikey")
}
Loading

0 comments on commit 6e4c3fd

Please sign in to comment.