Skip to content

Commit 7ac4428

Browse files
Stanllleyxuyang2519
authored and
xuyang2519
committed
kotlin extension:
when use kotlin , Calendar.Scheme.getObj support Generics reification
1 parent f61ed06 commit 7ac4428

File tree

8 files changed

+72
-2
lines changed

8 files changed

+72
-2
lines changed

build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
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.41'
45
repositories {
56
jcenter()
67
google()
78
}
89
dependencies {
910
//noinspection GradleDependency
10-
classpath 'com.android.tools.build:gradle:3.4.1'
11+
classpath 'com.android.tools.build:gradle:3.4.2'
1112
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
1213
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1315
}
1416
}
1517

kotlin/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

kotlin/build.gradle

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
4+
apply plugin: 'kotlin-kapt'
5+
android {
6+
compileSdkVersion 28
7+
defaultConfig {
8+
minSdkVersion 14
9+
targetSdkVersion 28
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
24+
}
25+
26+
dependencies {
27+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
28+
api project(':calendarview')
29+
}

kotlin/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

kotlin/src/main/AndroidManifest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest package="com.haibin.calendarview.kotlin" />
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.haibin.calendarview
2+
3+
/**
4+
*@Author xuyang
5+
6+
*@Date 2019/7/24.
7+
*@Description
8+
*/
9+
import com.haibin.calendarview.Calendar.Scheme
10+
11+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
12+
inline fun<reified T : Any> Scheme.getObj():T = obj as T
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name" translatable="false">kotlin</string>
3+
</resources>

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':app', ':calendarview'
1+
include ':app', ':calendarview', ':kotlin'

0 commit comments

Comments
 (0)