Skip to content

Commit 8b9eaa2

Browse files
committed
make the library compatible with modern gradle
1 parent 878af51 commit 8b9eaa2

File tree

7 files changed

+35
-96
lines changed

7 files changed

+35
-96
lines changed

build.gradle

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
42
repositories {
53
google()
6-
jcenter()
4+
mavenCentral()
75
}
86
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.3'
7+
classpath 'com.android.tools.build:gradle:8.7.3'
108
}
119
}
1210

13-
plugins {
14-
id "com.github.dcendents.android-maven" version "2.0"
15-
id "com.jfrog.bintray" version "1.8.0"
16-
}
17-
1811
allprojects {
1912
repositories {
2013
google()
21-
jcenter()
14+
mavenCentral()
2215
}
2316
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Nov 29 09:35:22 JST 2017
1+
#Mon Dec 30 18:48:19 JST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip

library/build.gradle

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 29
4+
compileSdk 34
5+
namespace 'link.fls.swipestack'
56

67
defaultConfig {
7-
minSdkVersion 16
8-
targetSdkVersion 29
8+
minSdkVersion 21
9+
targetSdkVersion 34
910
}
1011
buildTypes {
1112
release {
@@ -16,9 +17,6 @@ android {
1617
}
1718

1819
dependencies {
19-
implementation fileTree(dir: 'libs', include: ['*.jar'])
20-
testImplementation 'junit:junit:4.12'
21-
implementation 'androidx.appcompat:appcompat:1.1.0'
20+
testImplementation 'junit:junit:4.13.2'
21+
implementation 'androidx.appcompat:appcompat:1.7.0'
2222
}
23-
24-
apply from: 'publish.gradle'

library/publish.gradle

-53
This file was deleted.

sample/build.gradle

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 29
4+
compileSdk 34
5+
namespace 'link.fls.swipestacksample'
56

67
defaultConfig {
78
applicationId "link.fls.swipestacksample"
8-
minSdkVersion 16
9-
targetSdkVersion 29
9+
minSdkVersion 21
10+
targetSdkVersion 34
1011
versionCode 1
1112
versionName "1.0"
1213
}
@@ -20,9 +21,9 @@ android {
2021

2122
dependencies {
2223
implementation fileTree(dir: 'libs', include: ['*.jar'])
23-
testImplementation 'junit:junit:4.12'
24+
testImplementation 'junit:junit:4.13.2'
2425
implementation project(':library')
25-
implementation 'androidx.appcompat:appcompat:1.1.0'
26+
implementation 'androidx.appcompat:appcompat:1.7.0'
2627
implementation 'androidx.cardview:cardview:1.0.0'
27-
implementation 'com.google.android.material:material:1.0.0'
28+
implementation 'com.google.android.material:material:1.12.0'
2829
}

sample/src/main/AndroidManifest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest package="link.fls.swipestacksample"
3-
xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<application
65
android:allowBackup="true"
76
android:icon="@mipmap/ic_launcher"
87
android:label="@string/app_name"
98
android:supportsRtl="true"
109
android:theme="@style/AppTheme">
11-
<activity android:name="link.fls.swipestacksample.MainActivity">
10+
<activity android:name="link.fls.swipestacksample.MainActivity"
11+
android:exported="true">
1212
<intent-filter>
1313
<action android:name="android.intent.action.MAIN"/>
1414

sample/src/main/java/link/fls/swipestacksample/MainActivity.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,20 @@ public boolean onCreateOptionsMenu(Menu menu) {
9595

9696
@Override
9797
public boolean onOptionsItemSelected(MenuItem item) {
98-
99-
switch (item.getItemId()) {
100-
case R.id.menuReset:
101-
mSwipeStack.resetStack();
102-
Snackbar.make(mFab, R.string.stack_reset, Snackbar.LENGTH_SHORT).show();
103-
return true;
104-
case R.id.menuGitHub:
105-
Intent browserIntent = new Intent(
106-
Intent.ACTION_VIEW, Uri.parse("https://github.com/flschweiger/SwipeStack"));
107-
startActivity(browserIntent);
108-
return true;
98+
int itemId = item.getItemId();
99+
100+
if (itemId == R.id.menuReset) {
101+
mSwipeStack.resetStack();
102+
Snackbar.make(mFab, R.string.stack_reset, Snackbar.LENGTH_SHORT).show();
103+
return true;
104+
} else if (itemId == R.id.menuGitHub) {
105+
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
106+
Uri.parse("https://github.com/flschweiger/SwipeStack"));
107+
startActivity(browserIntent);
108+
return true;
109+
} else {
110+
throw new IllegalStateException("Unexpected value: " + item.getItemId());
109111
}
110-
111-
return super.onOptionsItemSelected(item);
112112
}
113113

114114
@Override
@@ -142,7 +142,7 @@ public void onLongClick(long duration) {
142142

143143
public class SwipeStackAdapter extends BaseAdapter {
144144

145-
private List<String> mData;
145+
private final List<String> mData;
146146

147147
SwipeStackAdapter(List<String> data) {
148148
this.mData = data;

0 commit comments

Comments
 (0)