Skip to content

Commit

Permalink
-更新AndroidX的完整支持;
Browse files Browse the repository at this point in the history
-剔除anko
  • Loading branch information
limuyang committed Apr 25, 2020
1 parent aed6b6d commit 4634d6e
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 59 deletions.
16 changes: 7 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

renderscriptTargetApi 27
renderscriptTargetApi 28
renderscriptSupportModeEnabled true
ndk {
abiFilters "x86", "armeabi-v7a"
Expand All @@ -35,18 +35,16 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-beta02'
testImplementation 'junit:junit:4.13'

implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'

implementation "com.github.xinyuez:easypermissions:2.0.1"
implementation 'pub.devrel:easypermissions:3.0.0'
// implementation 'com.github.yalantis:ucrop:2.2.2'

// implementation project(path:':library')
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#android.useAndroidX=true
#android.enableJetifier=true
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
27 changes: 14 additions & 13 deletions photolibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ android {
compileSdkVersion 28



defaultConfig {
minSdkVersion 16
targetSdkVersion 28
Expand All @@ -15,15 +14,18 @@ android {

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

renderscriptTargetApi 27
renderscriptTargetApi 28
renderscriptSupportModeEnabled true

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
}
debug {
consumerProguardFiles 'proguard-rules.pro'
}
}

Expand All @@ -32,20 +34,19 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'

implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-beta02'
testImplementation 'junit:junit:4.13'

implementation 'com.github.mmin18:realtimeblurview:1.1.2'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'org.jetbrains.anko:anko-coroutines:0.10.7'
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
}

repositories {
Expand Down
24 changes: 24 additions & 0 deletions photolibrary/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,27 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class android.support.v8.renderscript.** { *; }
-keep class androidx.renderscript.** { *; }

# glide 的混淆代码
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}

# Kotlin协程
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}

# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}

-keep class kotlin.reflect.** { *; }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package top.limuyang2.photolibrary.activity

import android.os.Bundle
import android.support.annotation.LayoutRes
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.provider.Contacts
import android.util.TypedValue
import android.view.View
import androidx.annotation.StyleRes
import androidx.core.view.ViewCompat
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.l_activity_photo_picker.*
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.async
import org.jetbrains.anko.coroutines.experimental.bg
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import top.limuyang2.photolibrary.R
import top.limuyang2.photolibrary.adapter.LPPGridDivider
import top.limuyang2.photolibrary.adapter.PhotoPickerRecyclerAdapter
Expand Down Expand Up @@ -315,10 +317,11 @@ class LPhotoPickerActivity : LBaseActivity() {
}

override fun initData() {
async(UI) {
val photoModelList = bg { findPhoto(this@LPhotoPickerActivity, showTypeArray) }.await()
this@LPhotoPickerActivity.photoModelList.addAll(photoModelList)

lifecycleScope.launch {
val list = withContext(Dispatchers.IO) {
findPhoto(this@LPhotoPickerActivity, showTypeArray)
}
photoModelList.addAll(list)
reloadPhotos(0)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.support.annotation.StyleRes
import android.util.TypedValue
import android.view.View
import android.view.WindowManager
import android.view.animation.DecelerateInterpolator
import androidx.annotation.StyleRes
import androidx.core.view.ViewCompat
import androidx.core.view.ViewPropertyAnimatorListenerAdapter
import androidx.viewpager.widget.ViewPager
Expand Down Expand Up @@ -42,7 +42,7 @@ class LPhotoPickerPreviewActivity : LBaseActivity() {
window.setBackgroundDrawable(ColorDrawable(resources.getColor(R.color.l_pp_photo_preview_bg)))
initAttr()
setStatusBar()
checkBox.setChecked(true, false)
checkBox.setChecked(checked = true, animate = false)
previewTitleTv.text = "1/${intentSelectedPhotos.size}"
viewPage.adapter = viewPageAdapter
}
Expand All @@ -67,10 +67,10 @@ class LPhotoPickerPreviewActivity : LBaseActivity() {

checkBox.setOnClickListener {
if (!checkBox.isChecked) {
checkBox.setChecked(true, true)
checkBox.setChecked(checked = true, animate = true)
nowSelectedPhotos.add(currentPath)
} else {
checkBox.setChecked(false, true)
checkBox.setChecked(checked = false, animate = true)
nowSelectedPhotos.remove(currentPath)
}
applyBtn.isEnabled = nowSelectedPhotos.isNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package top.limuyang2.photolibrary.engine

import android.content.Context
import android.support.annotation.DrawableRes
import android.widget.ImageView
import androidx.annotation.DrawableRes
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package top.limuyang2.photolibrary.engine

import android.content.Context
import android.support.annotation.DrawableRes
import android.widget.ImageView
import androidx.annotation.DrawableRes

interface LImageEngine {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package top.limuyang2.photolibrary.util

import android.support.v4.content.FileProvider
import androidx.core.content.FileProvider


/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import android.content.Context
import android.graphics.Point
import android.os.Build
import android.provider.MediaStore
import android.support.annotation.ColorInt
import android.text.TextUtils
import android.view.WindowManager
import androidx.annotation.ColorInt
import top.limuyang2.photolibrary.R
import top.limuyang2.photolibrary.model.LPhotoModel
import java.io.File
Expand Down
8 changes: 4 additions & 4 deletions photolibrary/src/main/res/layout/l_activity_photo_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
android:orientation="vertical">


<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="@dimen/l_pp_toolBar_height"
android:background="@android:color/transparent">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="@dimen/l_pp_toolBar_height">
Expand Down Expand Up @@ -46,8 +46,8 @@
</LinearLayout>


</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pickerRecycler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
app:realtimeBlurRadius="20dp"
app:realtimeOverlayColor="#8c000000" />

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="@dimen/l_pp_toolBar_height"
Expand All @@ -48,7 +48,7 @@
android:layout_width="25dp"
android:layout_height="25dp" />

</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>

</FrameLayout>

Expand Down
15 changes: 5 additions & 10 deletions photolibrary/src/main/res/layout/l_pp_item_photo_picker.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
Expand All @@ -9,20 +8,16 @@
android:id="@+id/imgView"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="#123456" />

<top.limuyang2.photolibrary.widget.LPPSmoothCheckBox
android:id="@+id/checkView"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="5dp"
android:layout_gravity="top|end"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="@+id/imgView"
app:layout_constraintTop_toTopOf="@+id/imgView" />
android:layout_marginEnd="8dp"
android:layout_marginRight="5dp" />


</android.support.constraint.ConstraintLayout>
</FrameLayout>

0 comments on commit 4634d6e

Please sign in to comment.