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

Commit 4cdd797

Browse files
committed
[clean]StudyRecordの引数の順番変更
1 parent 31bd1bb commit 4cdd797

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Create a record and post.
7575
```
7676
val record = StudyRecord(
7777
duration = 2 * 60,
78-
comment = "勉強した!!!",
79-
amount = StudyRecordAmountTotal(30)
78+
amount = StudyRecordAmountTotal(30),
79+
comment = "勉強した!!!"
8080
)
8181
Studyplus.instance.postRecord(this@MainActivity, record,
8282
object : Studyplus.Companion.OnPostRecordListener {

sdk-example-java/src/main/java/jp/studyplus/android/sdk_example_java/MainActivity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
4040

4141
Button postRecordButton = findViewById(R.id.post_study_record);
4242
postRecordButton.setOnClickListener(view -> {
43-
StudyRecord record = new StudyRecord(2 * 60);
44-
record.setAmount(new StudyRecordAmountTotal(30));
45-
record.setComment("勉強した!!!");
46-
43+
StudyRecord record = new StudyRecord(2 * 60, new StudyRecordAmountTotal(30), "勉強した!!!");
4744
Studyplus.getInstance().postRecord(MainActivity.this, record,
4845
(success, recordId, throwable) -> {
4946
if (success) {

sdk-example-kt/src/main/java/jp/studyplus/android/sdk_example_kt/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class MainActivity : AppCompatActivity() {
4242
setOnClickListener {
4343
val record = StudyRecord(
4444
duration = 2 * 60,
45-
comment = "勉強した!!!",
46-
amount = StudyRecordAmountTotal(30)
45+
amount = StudyRecordAmountTotal(30),
46+
comment = "勉強した!!!"
4747
)
4848
Studyplus.instance.postRecord(this@MainActivity, record,
4949
object : Studyplus.Companion.OnPostRecordListener {

studyplus-android-sdk2/src/main/java/jp/studyplus/android/sdk/record/StudyRecord.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import java.util.*
88
* Studyplusに投稿する学習記録
99
*
1010
* @param duration 学習時間(s)
11-
* @param recordedTime 学習を終えた日時
12-
* @param comment 学習に関するコメント
1311
* @param amount 学習量
12+
* @param comment 学習に関するコメント
13+
* @param recordedTime 学習を終えた日時
1414
* @since 2.5.0
1515
*/
1616
data class StudyRecord @JvmOverloads constructor(
17-
var duration: Int,
18-
var recordedTime: Calendar = Calendar.getInstance(DATE_TIME_ZONE, DATE_LOCALE),
19-
var comment: String? = null,
20-
var amount: StudyRecordAmount? = null
17+
val duration: Int,
18+
val amount: StudyRecordAmount? = null,
19+
val comment: String? = null,
20+
val recordedTime: Calendar = Calendar.getInstance(DATE_TIME_ZONE, DATE_LOCALE)
2121
) {
2222

2323
internal fun toJson(): String = JSONObject().apply {

studyplus-android-sdk2/src/test/java/jp/studyplus/android/sdk/StudyRecordUnitTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class StudyRecordUnitTest {
2323
fun toJsonTest_allParams_amountTotal() {
2424
val studyRecord = StudyRecord(
2525
duration = 2 * 60,
26-
recordedTime = Calendar.getInstance().apply { set(2019, 5, 1, 1, 2, 3) },
26+
amount = StudyRecordAmountTotal(30),
2727
comment = "perfect!",
28-
amount = StudyRecordAmountTotal(30)
28+
recordedTime = Calendar.getInstance().apply { set(2019, 5, 1, 1, 2, 3) }
2929
)
3030

3131
assertEquals(
@@ -38,9 +38,9 @@ class StudyRecordUnitTest {
3838
fun toJsonTest_allParams_amountRange() {
3939
val studyRecord = StudyRecord(
4040
duration = 2 * 60,
41-
recordedTime = Calendar.getInstance().apply { set(2019, 5, 1, 1, 2, 3) },
41+
amount = StudyRecordAmountRange(5, 12),
4242
comment = "perfect!",
43-
amount = StudyRecordAmountRange(5, 12)
43+
recordedTime = Calendar.getInstance().apply { set(2019, 5, 1, 1, 2, 3) }
4444
)
4545

4646
assertEquals(

0 commit comments

Comments
 (0)