-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加开启wifi使用二维码扫描连接
- Loading branch information
lizhichao
committed
Jun 4, 2021
1 parent
f3f6e2f
commit ee2149a
Showing
14 changed files
with
1,260 additions
and
1,216 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,95 @@ | ||
package com.apicloud.plugin.run; | ||
|
||
import com.apicloud.plugin.util.PrintUtil; | ||
import com.apicloud.plugin.util.RunProperties; | ||
import com.apicloud.wifisyncmanager.WifiSyncManager; | ||
import com.apicloud.wifisyncserver.WifiSyncServer; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.DumbAware; | ||
import com.intellij.openapi.project.Project; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* Created with IntelliJ IDEA. | ||
* User: lizhichao | ||
* Date: 2018/1/10 0010 | ||
* Time: 10:49:44 | ||
* Description: | ||
*/ | ||
public class WifiApicloudRunAction extends AnAction implements DumbAware { | ||
|
||
public WifiApicloudRunAction() { | ||
super("wifiApicloudRun Run", "点击开启WIFI服务", new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiStop.png"))); | ||
System.out.println("初始化WiFi运行开关"); | ||
} | ||
|
||
|
||
@Override | ||
public void actionPerformed(AnActionEvent event) { | ||
Project project = event.getProject(); | ||
|
||
System.out.println(project.getBasePath()); | ||
try { | ||
Thread ts = new Thread() { | ||
@Override | ||
public void run() { | ||
try { | ||
Thread.sleep(300); | ||
PrintUtil.error("启动wifi服务----------------", project.getName()); | ||
RunProperties.pushType(project.getName(), null); | ||
WifiSyncServer wifiSyncServer = RunProperties.getWifiSyncServer(project.getName()); | ||
wifiSyncServer.run(new String[]{event.getProject().getBasePath(), "1"}); | ||
PrintUtil.error("wifi服务启动成功", project.getName()); | ||
Thread.sleep(300); | ||
WifiSyncManager wifiSyncManager = RunProperties.getWifiSyncManager(project.getName()); | ||
wifiSyncManager.main(new String[]{"1"}); | ||
System.setProperty("java.net.preferIPv4Stack", "true"); | ||
} catch (Exception e) { | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
}; | ||
if (RunProperties.wifiRun(project.getName())) { | ||
event.getPresentation().setText("点击启动wifi服务"); | ||
event.getPresentation().setIcon(new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiStop.png"))); | ||
//event.getPresentation().setIcon(ApicloudIcon.wifiStopIcon); | ||
new Thread() { | ||
@Override | ||
public void run() { | ||
try { | ||
|
||
PrintUtil.error("wifi服务停止中,请稍等......", project.getName()); | ||
WifiSyncServer wifiSyncServer = RunProperties.getWifiSyncServer(project.getName()); | ||
wifiSyncServer.run(new String[]{event.getProject().getBasePath(), "0"}); | ||
Thread.sleep(1300); | ||
PrintUtil.error("wifi服务已停止", project.getName()); | ||
RunProperties.pushType(project.getName(), null); | ||
System.setProperty("java.net.preferIPv4Stack", "false"); | ||
} catch (Exception e) { | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
}.start(); | ||
ts.stop(); | ||
RunProperties.wifiRun(project.getName(), false); | ||
} else { | ||
event.getPresentation().setText("点击停止wifi服务"); | ||
event.getPresentation().setIcon(new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiApicloud.png"))); | ||
ts.start(); | ||
RunProperties.wifiRun(project.getName(), true); | ||
} | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
|
||
} | ||
package com.apicloud.plugin.run; | ||
|
||
import com.apicloud.plugin.util.PrintUtil; | ||
import com.apicloud.plugin.util.RunProperties; | ||
import com.apicloud.wifisyncmanager.WifiSyncManager; | ||
import com.apicloud.wifisyncserver.WifiSyncServer; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.DumbAware; | ||
import com.intellij.openapi.project.Project; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* Created with IntelliJ IDEA. | ||
* User: lizhichao | ||
* Date: 2018/1/10 0010 | ||
* Time: 10:49:44 | ||
* Description: | ||
*/ | ||
public class WifiApicloudRunAction extends AnAction implements DumbAware { | ||
|
||
public WifiApicloudRunAction() { | ||
super("wifiApicloudRun Run", "点击开启WIFI服务", new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiStop.png"))); | ||
System.out.println("初始化WiFi运行开关"); | ||
} | ||
|
||
|
||
@Override | ||
public void actionPerformed(AnActionEvent event) { | ||
Project project = event.getProject(); | ||
|
||
System.out.println(project.getBasePath()); | ||
try { | ||
Thread ts = new Thread() { | ||
@Override | ||
public void run() { | ||
try { | ||
Thread.sleep(300); | ||
PrintUtil.error("启动wifi服务----------------", project.getName()); | ||
RunProperties.pushType(project.getName(), null); | ||
WifiSyncServer wifiSyncServer = RunProperties.getWifiSyncServer(project.getName()); | ||
wifiSyncServer.run(new String[]{event.getProject().getBasePath(), "1"}); | ||
PrintUtil.error("wifi服务启动成功", project.getName()); | ||
Thread.sleep(300); | ||
WifiSyncManager wifiSyncManager = RunProperties.getWifiSyncManager(project.getName()); | ||
wifiSyncManager.main(new String[]{"1"}); | ||
System.setProperty("java.net.preferIPv4Stack", "true"); | ||
WebStorm webStorm = RunProperties.getWebStorm(project.getName()); | ||
RunProperties.wifiAdbConn = true; | ||
RunProperties.wifiAdb(webStorm,project.getName()); | ||
} catch (Exception e) { | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
}; | ||
if (RunProperties.wifiRun(project.getName())) { | ||
event.getPresentation().setText("点击启动wifi服务"); | ||
event.getPresentation().setIcon(new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiStop.png"))); | ||
//event.getPresentation().setIcon(ApicloudIcon.wifiStopIcon); | ||
new Thread() { | ||
@Override | ||
public void run() { | ||
try { | ||
|
||
PrintUtil.error("wifi服务停止中,请稍等......", project.getName()); | ||
WifiSyncServer wifiSyncServer = RunProperties.getWifiSyncServer(project.getName()); | ||
wifiSyncServer.run(new String[]{event.getProject().getBasePath(), "0"}); | ||
Thread.sleep(1300); | ||
PrintUtil.error("wifi服务已停止", project.getName()); | ||
RunProperties.pushType(project.getName(), null); | ||
System.setProperty("java.net.preferIPv4Stack", "false"); | ||
RunProperties.wifiAdbConn = false; | ||
WifiQrcode.getInstance().setIcon(new ImageIcon(WifiQrcode.class.getResource("/com/apicloud/plugin/icons/apicloud.png")).getImage()); | ||
} catch (Exception e) { | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
}.start(); | ||
ts.stop(); | ||
RunProperties.wifiRun(project.getName(), false); | ||
} else { | ||
event.getPresentation().setText("点击停止wifi服务"); | ||
event.getPresentation().setIcon(new ImageIcon(WifiApicloudRunAction.class.getResource("/com/apicloud/plugin/icons/wifiApicloud.png"))); | ||
ts.start(); | ||
RunProperties.wifiRun(project.getName(), true); | ||
} | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
PrintUtil.error(e.getMessage(), project.getName()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.apicloud.plugin.run; | ||
|
||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.DumbAware; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
/** | ||
* Created with IntelliJ IDEA. | ||
* User: lizhichao | ||
* Date: 2018/1/10 0010 | ||
* Time: 10:49:44 | ||
* Description: | ||
*/ | ||
public class WifiQrcode extends AnAction implements DumbAware { | ||
|
||
static WifiQrcode instance = null; | ||
|
||
public void setIcon(Image icon) { | ||
((ImageIcon)getTemplatePresentation().getIcon()).setImage(icon); | ||
} | ||
|
||
public static WifiQrcode getInstance() { | ||
return instance; | ||
} | ||
|
||
public WifiQrcode() { | ||
super(" ", "请用手机PP扫码连接", new ImageIcon(WifiQrcode.class.getResource("/com/apicloud/plugin/icons/apicloud.png"))); | ||
instance = this; | ||
} | ||
|
||
|
||
@Override | ||
public void actionPerformed(AnActionEvent event) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.