File tree Expand file tree Collapse file tree
java/jp/studyplus/android/sdk_example_kt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ class MainActivity : AppCompatActivity() {
3838 }
3939 }
4040
41+ findViewById<View >(R .id.cancel_auth)?.apply {
42+ setOnClickListener {
43+ Studyplus .instance.cancelAuth(this @MainActivity)
44+ updateAuthText()
45+ }
46+ }
47+
4148 findViewById<View >(R .id.post_study_record)?.apply {
4249 setOnClickListener {
4350 val record = StudyRecord (
@@ -64,7 +71,10 @@ class MainActivity : AppCompatActivity() {
6471
6572 override fun onResume () {
6673 super .onResume()
74+ updateAuthText()
75+ }
6776
77+ private fun updateAuthText () {
6878 val authStatusText = findViewById<TextView >(R .id.auth_status)
6979 authStatusText.text = when (Studyplus .instance.isAuthenticated(this )) {
7080 true -> getString(R .string.status_authenticated)
Original file line number Diff line number Diff line change 3535 android : layout_width =" match_parent"
3636 android : layout_height =" 24dp" />
3737
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+
3849 <Button
3950 android : id =" @+id/post_study_record"
4051 android : layout_width =" match_parent"
Original file line number Diff line number Diff line change 55 <string name =" status_authenticated" >認証済</string >
66
77 <string name =" start_auth_button" >認証画面を開く</string >
8+ <string name =" cancel_auth_button" >認証を解除する</string >
89 <string name =" post_study_record_button" >投稿!</string >
910
1011 <string name =" consumer_key" ></string >
You can’t perform that action at this time.
0 commit comments