Skip to content

Commit

Permalink
update: AboutDialog to UI Designer
Browse files Browse the repository at this point in the history
  • Loading branch information
dengzii committed Dec 16, 2020
1 parent 8879bdc commit 481fb8b
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 98 deletions.
164 changes: 164 additions & 0 deletions src/com/dengzii/plugin/adb/ui/AboutDialog.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.dengzii.plugin.adb.ui.AboutDialog">
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties>
<foreground color="-2763307"/>
</properties>
<border type="line" title="">
<color color="-13487566"/>
</border>
<children>
<vspacer id="89cdf">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="f485b" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="56352" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="Version"/>
</properties>
</component>
<component id="2d3ca" class="javax.swing.JLabel" binding="labelVersion">
<constraints/>
<properties>
<text value="-"/>
</properties>
</component>
</children>
</grid>
<grid id="dec99" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="25bec" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="Reference"/>
</properties>
</component>
<component id="703ca" class="com.intellij.ui.components.labels.LinkLabel" binding="labelAdb">
<constraints/>
<properties>
<icon value=""/>
<text value="Android Debug Bridge"/>
</properties>
</component>
</children>
</grid>
<grid id="19b48" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="67667" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="Rating"/>
</properties>
</component>
<component id="49713" class="com.intellij.ui.components.labels.LinkLabel" binding="labelRating">
<constraints/>
<properties>
<icon value=""/>
<text value="JetBrains Plugin Repository"/>
</properties>
</component>
</children>
</grid>
<grid id="58e1a" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="469f9" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="Source Code"/>
</properties>
</component>
<component id="114c3" class="com.intellij.ui.components.labels.LinkLabel" binding="labelCode">
<constraints/>
<properties>
<icon value=""/>
<text value="https://github.com/dengzii/WiFiADB"/>
</properties>
</component>
</children>
</grid>
<grid id="deca2" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="7f98a" class="javax.swing.JLabel">
<constraints/>
<properties>
<text value="If you have any questions or suggestions, please"/>
</properties>
</component>
<component id="4ffaf" class="com.intellij.ui.components.labels.LinkLabel" binding="labelIssue">
<constraints/>
<properties>
<icon value=""/>
<text value="Create Issue"/>
</properties>
</component>
</children>
</grid>
<grid id="46cd7" layout-manager="FlowLayout" hgap="16" vgap="10" flow-align="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="272ac" class="javax.swing.JLabel">
<constraints/>
<properties>
<font size="24" style="1"/>
<text value="WiFiADB"/>
</properties>
</component>
</children>
</grid>
<grid id="ef534" layout-manager="FlowLayout" hgap="16" vgap="5" flow-align="0">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="30ee" class="javax.swing.JLabel">
<constraints/>
<properties>
<font size="11"/>
<foreground color="-5723992"/>
<text value="Having a good day!"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
50 changes: 50 additions & 0 deletions src/com/dengzii/plugin/adb/ui/AboutDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.dengzii.plugin.adb.ui;

import com.dengzii.plugin.adb.tools.ui.XDialog;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.ui.components.labels.LinkLabel;

import javax.swing.*;
import java.util.Arrays;

public class AboutDialog extends XDialog {
private LinkLabel<String> labelAdb;
private LinkLabel<String> labelRating;
private LinkLabel<String> labelCode;
private LinkLabel<String> labelIssue;
private JLabel labelVersion;
private JPanel content;

AboutDialog() {
super("About");
setContentPane(content);

try {
labelVersion.setText(Arrays.stream(PluginManager.getPlugins()).filter(ideaPluginDescriptor -> {
return ideaPluginDescriptor.getPluginId() == PluginId.getId("com.dengzii.plugin.adb");
}).findFirst().get().getVersion());
} catch (Exception ignored) {

}

labelAdb.setListener((linkLabel, o) -> {
BrowserUtil.browse(o);
}, "https://developer.android.com/studio/command-line/adb");

labelRating.setListener((linkLabel, o) -> {
BrowserUtil.browse(o);
}, "https://plugins.jetbrains.com/plugin/13156-android-wifiadb");

labelCode.setListener((linkLabel, o) -> {
BrowserUtil.browse(o);
}, "https://github.com/dengzii/WiFiADB");

labelIssue.setListener((linkLabel, o) -> {
BrowserUtil.browse(o);
}, "https://github.com/dengzii/WiFiADB/issues/new");


}
}
98 changes: 0 additions & 98 deletions src/com/dengzii/plugin/adb/ui/AboutDialog.kt

This file was deleted.

0 comments on commit 481fb8b

Please sign in to comment.