Skip to content

Commit 0339572

Browse files
committed
Update extensions->parcelable support ui
1 parent 5ec6977 commit 0339572

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

parceable_support_tip.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#### Use Annotation
2+
3+
##### 1.add in gradle file
4+
5+
```
6+
android {
7+
...
8+
9+
//Using Kotlin experimental characteristics
10+
//You only need this for Kotlin < 1.3.40
11+
androidExtensions {
12+
experimental = true
13+
}
14+
}
15+
```
16+
17+
##### 2. Marking Data Classes with Annotations and Implementing Parcelable Interface
18+
19+
```
20+
@SuppressLint("ParcelCreator")
21+
@Parcelize
22+
data class User(val name: String, val age: Int) : Parcelable
23+
```

src/main/kotlin/extensions/jose/han/ParcelableAnnotationSupport.kt

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,25 @@
11
package extensions.jose.han;
22

3+
import com.intellij.ide.BrowserUtil
34
import com.intellij.ui.layout.panel
4-
import com.intellij.util.ui.JBDimension
55
import extensions.Extension
6-
import extensions.wu.seal.PropertySuffixSupport
76
import wu.seal.jsontokotlin.classscodestruct.Annotation
87
import wu.seal.jsontokotlin.classscodestruct.KotlinDataClass
9-
import java.awt.Color
10-
import java.awt.event.FocusEvent
11-
import java.awt.event.FocusListener
128
import javax.swing.JCheckBox
139
import javax.swing.JPanel
14-
import javax.swing.JTextArea
15-
import javax.swing.JTextField
1610

1711
/**
1812
* @author jose.han
19-
* @Date 2019/7/27
13+
* @Date 2019/7/27Ø
2014
*/
2115
object ParcelableAnnotationSupport : Extension() {
2216

2317
val configKey = "jose.han.add_parcelable_annotatioin_enable"
2418

2519
override fun createUI(): JPanel {
26-
val labelJField = JTextArea().apply {
27-
text = " android {\n" +
28-
" ...\n" +
29-
" androidExtensions {\n" +
30-
" experimental = true\n" +
31-
" }\n" +
32-
" }"
33-
isEnabled = false
34-
minimumSize = JBDimension(200, 200)
35-
background = Color.BLACK
36-
}
3720

3821

39-
val checkBox = JCheckBox("Enable Parcelable Support").apply {
22+
val checkBox = JCheckBox("Enable Parcelable Support ").apply {
4023
isSelected = ParcelableAnnotationSupport.getConfig(ParcelableAnnotationSupport.configKey).toBoolean()
4124
addActionListener {
4225
ParcelableAnnotationSupport.setConfig(ParcelableAnnotationSupport.configKey, isSelected.toString())
@@ -45,8 +28,13 @@ object ParcelableAnnotationSupport : Extension() {
4528

4629
return panel {
4730
row {
31+
4832
checkBox()
49-
labelJField()
33+
right {
34+
link("Need Some Config") {
35+
BrowserUtil.browse("https://github.com/wuseal/JsonToKotlinClass/blob/master/parceable_support_tip.md.md")
36+
}
37+
}
5038
}
5139
}
5240
}

0 commit comments

Comments
 (0)