Skip to content
This repository was archived by the owner on Jun 28, 2019. It is now read-only.

Commit 9cdb56e

Browse files
metal-presidentkoji-1009
authored andcommitted
実装完了
1 parent f91b89f commit 9cdb56e

File tree

79 files changed

+2078
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2078
-1
lines changed

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Original
2+
*.iml
3+
.gradle
4+
/local.properties
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
.DS_Store
9+
/build
10+
/captures
11+
.externalNativeBuild
12+
13+
# Built application files
14+
*.apk
15+
*.ap_
16+
17+
# Files for the ART/Dalvik VM
18+
*.dex
19+
20+
# Java class files
21+
*.class
22+
23+
# Generated files
24+
bin/
25+
gen/
26+
out/
27+
28+
# Gradle files
29+
.gradle/
30+
build/
31+
32+
# Local configuration file (sdk path, etc)
33+
local.properties
34+
35+
# Proguard folder generated by Eclipse
36+
proguard/
37+
38+
# Log Files
39+
*.log
40+
41+
# Android Studio Navigation editor temp files
42+
.navigation/
43+
44+
# Android Studio captures folder
45+
captures/
46+
47+
# IntelliJ
48+
*.iml
49+
.idea/
50+
51+
# Keystore files
52+
# Uncomment the following line if you do not want to check your keystore files in.
53+
#*.jks
54+
55+
# External native build folder generated in Android Studio 2.2 and later
56+
.externalNativeBuild

README.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,94 @@
1-
# Studyplus-Android-SDK-V2
1+
# Studyplus-Android-SDK-V2
2+
3+
## Requirements
4+
- Android 2.2+
5+
- [Studyplus App 2.14+](https://play.google.com/store/apps/details?id=jp.studyplus.android.app)
6+
7+
8+
## Import in your Project
9+
10+
### Gradle file (app)
11+
```
12+
repositories {
13+
mavenCentral()
14+
}
15+
dependencies {
16+
compile ('jp.studyplus.android.sdk:studyplus-android-sdk:2.0.0@aar') {
17+
transitive = true
18+
}
19+
}
20+
```
21+
22+
### Maven
23+
```
24+
<dependency>
25+
<groupId>jp.studyplus.android.sdk</groupId>
26+
<artifactId>studyplus-android-sdk</artifactId>
27+
<version>2.0.0</version>
28+
</dependency>
29+
```
30+
31+
or download the latest JAR [via Central Repository](http://search.maven.org/#search%7Cga%7C1%7Cstudyplus)
32+
33+
## Usage
34+
35+
### Setup
36+
```
37+
Studyplus.instance.setup("consumer_key", "consumer_secret")
38+
```
39+
40+
### Authenticate
41+
42+
Open an Activity to connect with Studyplus.
43+
```
44+
try {
45+
Studyplus.instance.startAuth(this@MainActivity, REQUEST_CODE_AUTH)
46+
} catch (e: ActivityNotFoundException) {
47+
e.printStackTrace()
48+
Toast.makeText(context, "Need for Studyplus 2.14.0+", Toast.LENGTH_LONG).show()
49+
}
50+
```
51+
52+
Then save its result.
53+
```
54+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
55+
when (requestCode) {
56+
REQUEST_CODE_AUTH -> {
57+
if (resultCode == Activity.RESULT_OK) {
58+
Studyplus.instance.setAuthResult(this, data)
59+
Toast.makeText(this@MainActivity, "Success!!", Toast.LENGTH_LONG).show()
60+
}
61+
}
62+
}
63+
}
64+
```
65+
66+
### Post a record to Studyplus
67+
Create a record and post.
68+
```
69+
val record = StudyRecordBuilder()
70+
.setComment("勉強した!!!")
71+
.setAmountTotal(30)
72+
.setDurationSeconds(2 * 60)
73+
.build()
74+
Studyplus.instance.postRecord(this@MainActivity, record,
75+
object : Studyplus.Companion.OnPostRecordListener {
76+
override fun onResult(success: Boolean, recordId: Long?, throwable: Throwable?) {
77+
if (success) {
78+
Toast.makeText(context, "Post Study Record!! ($recordId)", Toast.LENGTH_LONG).show()
79+
} else {
80+
throwable?.apply {
81+
Toast.makeText(context, "error!!", Toast.LENGTH_LONG).show()
82+
printStackTrace()
83+
}
84+
}
85+
}
86+
})
87+
```
88+
89+
### More
90+
- See also [actual examples with Kotlin]().
91+
- See also [actual examples with Java]().
92+
93+
### License
94+
- [MIT License](http://opensource.org/licenses/MIT)

build.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
ext.kotlin_version = '1.2.50'
5+
ext.versions = [
6+
'compileSdk': 28,
7+
'minSdk': 16,
8+
'targetSdk': 28,
9+
'supportLibrary': '27.1.1',
10+
'constraintLayout': '1.1.2',
11+
'gson': '2.8.2',
12+
'okhttp': '3.10.0',
13+
'retrofit' : '2.4.0',
14+
'rx2' : '2.0.2',
15+
'moshi' : '1.6.0'
16+
]
17+
repositories {
18+
google()
19+
jcenter()
20+
}
21+
dependencies {
22+
classpath 'com.android.tools.build:gradle:3.1.3'
23+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
24+
}
25+
}
26+
27+
allprojects {
28+
repositories {
29+
google()
30+
jcenter()
31+
}
32+
}
33+
34+
task clean(type: Delete) {
35+
delete rootProject.buildDir
36+
}

gradle.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx1536m
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true

gradle/wrapper/gradle-wrapper.jar

53.4 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sun Jul 01 16:03:41 JST 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)