-
Notifications
You must be signed in to change notification settings - Fork 81
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 #329 from AdamNiederer/accessibility-overlay
Accessibility Service Overlay MVP
- Loading branch information
Showing
15 changed files
with
152 additions
and
174 deletions.
There are no files selected for viewing
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
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
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
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
119 changes: 0 additions & 119 deletions
119
app/src/main/java/com/jmstudios/redmoon/manager/ScreenManager.kt
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/jmstudios/redmoon/service/AccessibilityFilterService.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,39 @@ | ||
package com.jmstudios.redmoon.service | ||
|
||
import android.accessibilityservice.AccessibilityService | ||
import android.animation.ValueAnimator | ||
import android.graphics.PixelFormat | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.view.WindowManager | ||
import android.view.accessibility.AccessibilityEvent | ||
import com.jmstudios.redmoon.* | ||
import com.jmstudios.redmoon.helper.Logger | ||
import org.greenrobot.eventbus.Subscribe | ||
|
||
|
||
class AccessibilityFilterService : AccessibilityService() { | ||
lateinit var mFilter: Overlay | ||
|
||
override fun onAccessibilityEvent(event: AccessibilityEvent) {} | ||
override fun onInterrupt() {} | ||
|
||
override fun onServiceConnected() { | ||
mFilter = Overlay(applicationContext) | ||
(getSystemService(WINDOW_SERVICE) as WindowManager).addView(mFilter, mFilter.mLayoutParams) | ||
mFilter.visibility = View.GONE; | ||
EventBus.register(this) | ||
} | ||
|
||
override fun onDestroy() { | ||
EventBus.unregister(this); | ||
(getSystemService(WINDOW_SERVICE) as WindowManager).removeView(mFilter) | ||
super.onDestroy() | ||
} | ||
|
||
@Subscribe | ||
fun turnOnOrOff(cmd: accessibilityServiceCommand) { | ||
mFilter.setBackgroundColor(activeProfile.filterColor) | ||
mFilter.visibility = if (cmd.command.turnOn) View.VISIBLE else View.GONE | ||
} | ||
} |
Oops, something went wrong.