File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
java/jp/studyplus/android/sdk_example_kt Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ class MainActivity : AppCompatActivity() {
38
38
}
39
39
}
40
40
41
+ findViewById<View >(R .id.cancel_auth)?.apply {
42
+ setOnClickListener {
43
+ Studyplus .instance.cancelAuth(this @MainActivity)
44
+ updateAuthText()
45
+ }
46
+ }
47
+
41
48
findViewById<View >(R .id.post_study_record)?.apply {
42
49
setOnClickListener {
43
50
val record = StudyRecord (
@@ -64,7 +71,10 @@ class MainActivity : AppCompatActivity() {
64
71
65
72
override fun onResume () {
66
73
super .onResume()
74
+ updateAuthText()
75
+ }
67
76
77
+ private fun updateAuthText () {
68
78
val authStatusText = findViewById<TextView >(R .id.auth_status)
69
79
authStatusText.text = when (Studyplus .instance.isAuthenticated(this )) {
70
80
true -> getString(R .string.status_authenticated)
Original file line number Diff line number Diff line change 35
35
android : layout_width =" match_parent"
36
36
android : layout_height =" 24dp" />
37
37
38
+ <Button
39
+ android : id =" @+id/cancel_auth"
40
+ android : layout_width =" match_parent"
41
+ android : layout_height =" wrap_content"
42
+ android : padding =" 8dp"
43
+ android : text =" @string/cancel_auth_button" />
44
+
45
+ <Space
46
+ android : layout_width =" match_parent"
47
+ android : layout_height =" 24dp" />
48
+
38
49
<Button
39
50
android : id =" @+id/post_study_record"
40
51
android : layout_width =" match_parent"
Original file line number Diff line number Diff line change 5
5
<string name =" status_authenticated" >認証済</string >
6
6
7
7
<string name =" start_auth_button" >認証画面を開く</string >
8
+ <string name =" cancel_auth_button" >認証を解除する</string >
8
9
<string name =" post_study_record_button" >投稿!</string >
9
10
10
11
<string name =" consumer_key" ></string >
You can’t perform that action at this time.
0 commit comments