diff --git a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt index c91094b..c40c353 100644 --- a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt +++ b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt @@ -21,7 +21,7 @@ class MainService : Service() { val mySharedPref by lazy { MySharedPref(this, PreferenceNames.CONFIG) } - val overlayView: ViewGroup by lazy { LayoutInflater.from(this).inflate(R.layout.overlay_layout, null) as ViewGroup } + val moveOverlayView: ViewGroup by lazy { LayoutInflater.from(this).inflate(R.layout.move_overlay, null) as ViewGroup } val windowManager: WindowManager by lazy { applicationContext.getSystemService(Context.WINDOW_SERVICE) as WindowManager } var params: WindowManager.LayoutParams? = null val displaySize: Point by lazy { @@ -38,13 +38,13 @@ .setSmallIcon(R.mipmap.ic_launcher) // TODO:白抜きのアイコンをセット startForeground(Const.notificationId, notificationBuilder.build()) - setInitOverlayView() + setMoveOverlayView() return START_STICKY } - private fun setInitOverlayView() { - overlayView.apply(clickListener()) + private fun setMoveOverlayView() { + moveOverlayView.apply(clickListener()) if (Build.VERSION.SDK_INT >= 26) { params = WindowManager.LayoutParams( @@ -71,7 +71,7 @@ params?.x = mySharedPref.getValue(PreferenceKeys.VIEWX, Int::class.java, 0) as Int params?.y = mySharedPref.getValue(PreferenceKeys.VIEWY, Int::class.java, 0) as Int - windowManager.addView(overlayView, params) + windowManager.addView(moveOverlayView, params) } private fun clickListener(): View.() -> Unit { @@ -96,7 +96,7 @@ params?.x = centerX params?.y = centerY - windowManager.updateViewLayout(overlayView, params) + windowManager.updateViewLayout(moveOverlayView, params) } } diff --git a/app/src/main/res/layout/move_overlay.xml b/app/src/main/res/layout/move_overlay.xml new file mode 100644 index 0000000..9d7c50c --- /dev/null +++ b/app/src/main/res/layout/move_overlay.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/overlay_layout.xml b/app/src/main/res/layout/overlay_layout.xml deleted file mode 100644 index 9d7c50c..0000000 --- a/app/src/main/res/layout/overlay_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file