File tree Expand file tree Collapse file tree 5 files changed +64
-1
lines changed
kotlin/kr/co/finda/androidtemplate
feature/installImmediately Expand file tree Collapse file tree 5 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 1+ package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+ import com.intellij.openapi.actionSystem.AnAction
4+ import com.intellij.openapi.actionSystem.AnActionEvent
5+ import kr.co.finda.androidtemplate.util.DeviceHelperImpl
6+
7+ class InstallImmediatelyAction : AnAction (), InstallImmediatelyContract.View {
8+
9+ private val presenter: InstallImmediatelyContract .Presenter by lazy {
10+ InstallImmediatelyPresenter (DeviceHelperImpl ())
11+ }
12+
13+ override fun actionPerformed (e : AnActionEvent ) {
14+ val project = e.project ? : return
15+ presenter.onInstallPerformed(project)
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+ import com.intellij.openapi.project.Project
4+
5+ interface InstallImmediatelyContract {
6+
7+ interface View {
8+
9+ }
10+
11+ interface Presenter {
12+ fun onInstallPerformed (project : Project )
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+ import com.intellij.openapi.project.Project
4+ import kr.co.finda.androidtemplate.util.DeviceHelper
5+
6+ class InstallImmediatelyPresenter (
7+ private val deviceHelper : DeviceHelper
8+ ) : InstallImmediatelyContract.Presenter {
9+
10+ override fun onInstallPerformed (project : Project ) {
11+ val devices = deviceHelper.getDebugDevices(project)
12+ deviceHelper.installFindaStgImmediately(devices ? : emptyList())
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ interface DeviceHelper {
1919 fun getDebugDevices (project : Project ): List <IDevice >?
2020
2121 fun clearFindaAppCache (device : IDevice )
22+
23+ fun installFindaStgImmediately (devices : List <IDevice >)
2224}
2325
2426class DeviceHelperImpl : DeviceHelper {
@@ -53,7 +55,7 @@ class DeviceHelperImpl : DeviceHelper {
5355 override fun getShowOverdrawEnabled (device : IDevice , on : (isEnabled: Boolean ) -> Unit ) {
5456 device.executeShellCommand(
5557 " getprop debug.hwui.overdraw" ,
56- object : MultiLineReceiver () {
58+ object : MultiLineReceiver () {
5759 var cancelled = false
5860
5961 override fun isCancelled (): Boolean {
@@ -88,4 +90,13 @@ class DeviceHelperImpl : DeviceHelper {
8890 NullOutputReceiver ()
8991 )
9092 }
93+
94+ override fun installFindaStgImmediately (devices : List <IDevice >) {
95+ devices.forEach { device ->
96+ device.executeShellCommand(
97+ " install -t app/build/outputs/apk/stg/debug/app-stg-debug.apk" ,
98+ NullOutputReceiver ()
99+ )
100+ }
101+ }
91102}
Original file line number Diff line number Diff line change 4848 icon =" Icons.FindaLogo" >
4949 <add-to-group group-id =" ToolsMenu" anchor =" last" />
5050 </action >
51+ <action id =" kr.co.finda.androidtemplate.feature.installImmediately.InstallImmediatelyAction"
52+ class =" kr.co.finda.androidtemplate.feature.installImmediately.InstallImmediatelyAction"
53+ text =" Install Finda STG Immediately"
54+ description =" Install Finda STG Immediately"
55+ icon =" Icons.FindaLogo" >
56+ <add-to-group group-id =" ToolsMenu" anchor =" last" />
57+ </action >
5158 </actions >
5259
5360 <extensions defaultExtensionNs =" com.intellij" >
You can’t perform that action at this time.
0 commit comments