generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from FindaDeveloper/dohun
[UPDATE] Show overdraw 기능 추가
- Loading branch information
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/kr/co/finda/androidtemplate/feature/showOverdraw/ShowOverdrawAction.kt
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,22 @@ | ||
package kr.co.finda.androidtemplate.feature.showOverdraw | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.project.Project | ||
import kr.co.finda.androidtemplate.ext.showMessageDialog | ||
import kr.co.finda.androidtemplate.util.DeviceHelperImpl | ||
|
||
class ShowOverdrawAction : AnAction(), ShowOverdrawContract.View { | ||
|
||
private val presenter: ShowOverdrawContract.Presenter by lazy { | ||
ShowOverdrawPresenter(this, DeviceHelperImpl()) | ||
} | ||
|
||
override fun actionPerformed(e: AnActionEvent) { | ||
presenter.onShowOverdrawActionPerformed(e.project!!) | ||
} | ||
|
||
override fun showDialog(project: Project, title: String, description: String) { | ||
project.showMessageDialog(title, description) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/kr/co/finda/androidtemplate/feature/showOverdraw/ShowOverdrawContract.kt
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,14 @@ | ||
package kr.co.finda.androidtemplate.feature.showOverdraw | ||
|
||
import com.intellij.openapi.project.Project | ||
|
||
interface ShowOverdrawContract { | ||
|
||
interface View { | ||
fun showDialog(project: Project, title: String, description: String) | ||
} | ||
|
||
interface Presenter { | ||
fun onShowOverdrawActionPerformed(project: Project) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/kr/co/finda/androidtemplate/feature/showOverdraw/ShowOverdrawPresenter.kt
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,22 @@ | ||
package kr.co.finda.androidtemplate.feature.showOverdraw | ||
|
||
import com.intellij.openapi.project.Project | ||
import kr.co.finda.androidtemplate.util.DeviceHelper | ||
|
||
class ShowOverdrawPresenter( | ||
private val view: ShowOverdrawContract.View, | ||
private val deviceHelper: DeviceHelper | ||
) : ShowOverdrawContract.Presenter { | ||
override fun onShowOverdrawActionPerformed(project: Project) { | ||
val devices = deviceHelper.getDebugDevices(project) | ||
|
||
if (devices.isNullOrEmpty()) { | ||
view.showDialog(project, "연결된 디바이스가 없습니다", "디바이스 연결 상태를 확인해주세요") | ||
return | ||
} | ||
|
||
deviceHelper.getShowOverdrawEnabled(devices[0]) { prevEnabled -> | ||
deviceHelper.setShowOverdrawEnabled(devices, !prevEnabled) | ||
} | ||
} | ||
} |
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