Skip to content

Commit 66e834e

Browse files
committed
update dependencies (gradle,kotlin,material) + remove jcenter
1 parent 7658b9a commit 66e834e

File tree

15 files changed

+142
-136
lines changed

15 files changed

+142
-136
lines changed

app/build.gradle

+16-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
7-
buildToolsVersion "29.0.2"
6+
compileSdkVersion 31
7+
buildToolsVersion "31.0.0"
88
defaultConfig {
99
applicationId "com.github.heyalex.cornerdrawer.example"
1010
minSdkVersion 16
11-
targetSdkVersion 29
11+
targetSdkVersion 31
1212
versionCode 1
1313
versionName "1.0"
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -30,26 +30,25 @@ android {
3030

3131
repositories {
3232
google()
33-
jcenter()
34-
33+
mavenCentral()
3534
}
3635
}
3736

3837
dependencies {
3938
implementation fileTree(dir: 'libs', include: ['*.jar'])
4039
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
41-
// implementation project(':drawer')
42-
//
43-
implementation 'com.github.heyalex.cornersheet:drawer:v1.0.1'
40+
implementation project(':drawer')
41+
42+
// implementation 'com.github.heyalex.cornersheet:drawer:v1.0.1'
4443

45-
implementation "androidx.fragment:fragment:1.2.0"
46-
implementation 'com.google.android.material:material:1.1.0'
47-
implementation 'androidx.appcompat:appcompat:1.1.0'
48-
implementation 'androidx.core:core-ktx:1.2.0'
49-
implementation 'com.github.bumptech.glide:glide:4.11.0'
50-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
44+
implementation "androidx.fragment:fragment-ktx:1.4.1"
45+
implementation 'com.google.android.material:material:1.5.0'
46+
implementation 'androidx.appcompat:appcompat:1.4.1'
47+
implementation 'androidx.core:core-ktx:1.7.0'
48+
implementation 'com.github.bumptech.glide:glide:4.12.0'
49+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
5150

52-
testImplementation 'junit:junit:4.12'
53-
androidTestImplementation 'androidx.test:runner:1.3.0-alpha03'
54-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
51+
testImplementation 'junit:junit:4.13.2'
52+
androidTestImplementation 'androidx.test:runner:1.4.0'
53+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
5554
}

app/src/main/AndroidManifest.xml

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@
1111
android:roundIcon="@mipmap/ic_launcher_round"
1212
android:supportsRtl="true"
1313
android:theme="@style/AppTheme">
14-
<activity android:name=".ExampleActivity">
14+
<activity
15+
android:name=".ExampleActivity"
16+
android:exported="true">
1517
<intent-filter>
1618
<action android:name="android.intent.action.MAIN" />
1719

1820
<category android:name="android.intent.category.LAUNCHER" />
1921
</intent-filter>
2022
</activity>
2123

22-
<activity android:name=".BehaviorSampleActivity" />
23-
<activity android:name=".support.ShopActivity" />
24+
<activity
25+
android:name=".BehaviorSampleActivity"
26+
android:exported="false" />
27+
<activity
28+
android:name=".support.ShopActivity"
29+
android:exported="false" />
2430
</application>
2531

2632
</manifest>

app/src/main/java/com/github/heyalex/cornerdrawer/example/BehaviorSampleActivity.kt

+9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.github.heyalex.cornerdrawer.example
22

33
import android.os.Bundle
4+
import android.util.Log
45
import android.view.View
56
import android.widget.SeekBar
67
import androidx.appcompat.app.AppCompatActivity
78
import androidx.appcompat.widget.AppCompatSeekBar
9+
import androidx.appcompat.widget.Toolbar
810
import com.github.heyalex.cornersheet.behavior.CornerSheetBehavior
911
import com.google.android.material.bottomsheet.BottomSheetBehavior
1012
import com.google.android.material.bottomsheet.CornerMaterialSheetBehavior
@@ -34,6 +36,13 @@ class BehaviorSampleActivity : AppCompatActivity() {
3436
})
3537

3638

39+
behavior.halfExpandedRatio = 0.3f
40+
41+
findViewById<Toolbar>(R.id.toolbar).setOnClickListener {
42+
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
43+
behavior_state.text = "HALF EXPANDED"
44+
}
45+
3746
expand.setOnClickListener {
3847
behavior.horizontalState = CornerSheetBehavior.STATE_EXPANDED
3948
behavior_state.text = "EXPANDED"

app/src/main/java/com/github/heyalex/cornerdrawer/example/support/SupportFragment.kt

+6-9
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ class SupportFragment : Fragment() {
3232
backPressedCallback = object :
3333
OnBackPressedCallback(behavior.state != BottomSheetBehavior.STATE_COLLAPSED) {
3434
override fun handleOnBackPressed() {
35-
if (wasExpanded && behavior.state != BottomSheetBehavior.STATE_HALF_EXPANDED)
36-
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
37-
else {
38-
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
39-
}
35+
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
4036
}
4137
}
4238
activity?.onBackPressedDispatcher?.addCallback(this, backPressedCallback)
4339

4440
view.header_root.setOnClickListener {
45-
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
41+
if (behavior.state == BottomSheetBehavior.STATE_COLLAPSED) {
42+
behavior.state = BottomSheetBehavior.STATE_EXPANDED
43+
} else {
44+
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
45+
}
4646
}
4747

4848
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
@@ -68,16 +68,13 @@ class SupportFragment : Fragment() {
6868
}
6969

7070
override fun onStateChanged(bottomSheet: View, newState: Int) {
71-
if (newState == BottomSheetBehavior.STATE_EXPANDED) wasExpanded = true
7271
backPressedCallback.isEnabled = newState != BottomSheetBehavior.STATE_COLLAPSED
7372
}
7473
})
7574

7675
return view
7776
}
7877

79-
private var wasExpanded = false
80-
8178
fun changeStatusBarIconColor(isLight: Boolean) {
8279
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
8380
activity?.window?.let {

app/src/main/res/layout/activity_main.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
android:layout_height="match_parent"
9494
android:orientation="vertical"
9595
app:backgroundTint="@color/colorPrimary"
96+
app:behavior_horizontalExpandingRatio="0.1"
9697
app:behavior_expanded_width="175dp"
9798
app:behavior_horizontal_peekHeight="97dp"
9899
app:behavior_peekHeight="60dp"
@@ -114,7 +115,8 @@
114115
android:id="@+id/expandedValue"
115116
android:layout_width="wrap_content"
116117
android:layout_height="wrap_content"
117-
android:layout_gravity="center"
118+
android:layout_gravity="top"
119+
android:paddingTop="90dp"
118120
android:text="SLIDE OFFSET"
119121
android:textColor="@android:color/white"
120122
android:textSize="20sp" />

app/src/main/res/layout/example_activity.xml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
android:layout_height="match_parent"
55
android:background="@android:color/white">
66

7-
87
<LinearLayout
98
android:layout_width="wrap_content"
109
android:layout_height="wrap_content"

app/src/main/res/layout/support_fragment.xml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
android:id="@+id/corner_drawer"
99
android:layout_width="match_parent"
1010
android:layout_height="match_parent"
11-
android:clickable="true"
1211
app:behavior_horizontal_peekHeight="58dp"
1312
app:content_color="@color/corner_drawer_header_color"
1413
app:content_view="@layout/support_content"

build.gradle

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.61'
4+
ext.kotlin_version = '1.6.20'
55

66
repositories {
77
google()
8-
jcenter()
9-
8+
mavenCentral()
109
}
1110
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.3'
11+
classpath 'com.android.tools.build:gradle:7.1.3'
1312
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1413

15-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
1614
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1715
classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18'
1816
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.9.18'
@@ -22,8 +20,7 @@ buildscript {
2220
allprojects {
2321
repositories {
2422
google()
25-
jcenter()
26-
23+
mavenCentral()
2724
}
2825
}
2926

core/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
7-
buildToolsVersion '29.0.2'
6+
compileSdkVersion 31
7+
buildToolsVersion '31.0.0'
88

99
defaultConfig {
1010

1111
minSdkVersion 16
12-
targetSdkVersion 29
12+
targetSdkVersion 31
1313
versionCode 1
1414
versionName "1.0"
1515

@@ -29,11 +29,11 @@ dependencies {
2929

3030
implementation fileTree(dir: "libs", include: ["*.jar"])
3131
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
32-
implementation 'androidx.core:core-ktx:1.2.0'
33-
implementation 'com.google.android.material:material:1.1.0'
34-
testImplementation 'junit:junit:4.12'
35-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
36-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
32+
implementation 'androidx.core:core-ktx:1.7.0'
33+
implementation 'com.google.android.material:material:1.5.0'
34+
testImplementation 'junit:junit:4.13.2'
35+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
36+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
3737
}
3838

3939
apply from: rootProject.file('release-bintray.gradle')

core/src/main/java/com/google/android/material/bottomsheet/CornerMaterialSheetBehavior.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ open class CornerMaterialSheetBehavior<V : View> : BottomSheetBehavior<V> {
133133
if (!isViewRefInitialized) {
134134
ViewCompat.setBackground(child, sheetBackground)
135135
fullViewWidth = child.width
136-
currentWidth = getMaxWidth()
136+
currentWidth = getMaxWidthCornerSheet()
137137
if (state == STATE_EXPANDED || state == STATE_HALF_EXPANDED) {
138138
child.translationX = 0f
139139
sheetBackground?.interpolation = 0f
@@ -145,7 +145,7 @@ open class CornerMaterialSheetBehavior<V : View> : BottomSheetBehavior<V> {
145145
addBottomSheetCallback(object :
146146
BottomSheetCallback() {
147147
override fun onSlide(bottomSheet: View, slideOffset: Float) {
148-
val translationValue = getMaxWidth()
148+
val translationValue = getMaxWidthCornerSheet()
149149
child.translationX =
150150
interpolate(
151151
translationValue.toFloat(),
@@ -194,7 +194,7 @@ open class CornerMaterialSheetBehavior<V : View> : BottomSheetBehavior<V> {
194194
interpolator = AccelerateInterpolator()
195195
duration = 150
196196
val start = currentWidth
197-
val end = getMaxWidth()
197+
val end = getMaxWidthCornerSheet()
198198

199199
addUpdateListener { animation ->
200200
val value = animation.animatedValue as Float
@@ -294,7 +294,7 @@ open class CornerMaterialSheetBehavior<V : View> : BottomSheetBehavior<V> {
294294
isViewRefInitialized = false
295295
}
296296

297-
private fun getMaxWidth(): Int {
297+
private fun getMaxWidthCornerSheet(): Int {
298298
val width = when (horizontalState) {
299299
CornerSheetBehavior.STATE_EXPANDED -> expandedWidth
300300
CornerSheetBehavior.STATE_COLLAPSED -> horizontalPeekWidth

drawer/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android-extensions'
33
apply plugin: 'kotlin-android'
44

55
android {
6-
compileSdkVersion 29
7-
buildToolsVersion "29.0.2"
6+
compileSdkVersion 31
7+
buildToolsVersion "31.0.0"
88

99

1010
defaultConfig {
1111
minSdkVersion 16
12-
targetSdkVersion 29
12+
targetSdkVersion 31
1313
versionCode 1
1414
versionName "1.0"
1515

@@ -28,11 +28,11 @@ android {
2828

2929
dependencies {
3030
implementation fileTree(dir: 'libs', include: ['*.jar'])
31-
implementation project(':core')
31+
api project(':core')
3232
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
33-
implementation 'com.google.android.material:material:1.1.0'
34-
implementation 'androidx.core:core-ktx:1.1.0'
35-
testImplementation 'junit:junit:4.12'
33+
implementation 'com.google.android.material:material:1.5.0'
34+
implementation 'androidx.core:core-ktx:1.7.0'
35+
testImplementation 'junit:junit:4.13.2'
3636
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3737
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
3838
}

gradle.properties

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ org.gradle.jvmargs=-Xmx1536m
1515
# Android operating system, and which are packaged with your app's APK
1616
# https://developer.android.com/topic/libraries/support-library/androidx-rn
1717
android.useAndroidX=true
18-
# Automatically convert third-party libraries to use AndroidX
19-
android.enableJetifier=true
2018
# Kotlin code style for this project: "official" or "obsolete":
2119
kotlin.code.style=official
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat Feb 15 22:54:40 MSK 2020
1+
#Sat Apr 23 09:44:01 MSK 2022
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)