Skip to content

Commit

Permalink
First Release
Browse files Browse the repository at this point in the history
  • Loading branch information
nmelihsensoy committed Mar 8, 2022
1 parent 41ae734 commit ee2f803
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 30 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
# <img align="left" width="60" height="60" src="logo.png" alt="Snowy - Touch Blocker [Root]"><span>Snowy - Touch Blocker [Root]</span></img>
# <img align="left" width="60" height="60" src="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" alt="Snowy - Touch Blocker [Root]"><span>Snowy - Touch Blocker [Root]</span></img>
</br>

*A quick settings tile to block touch screen for real. Requires root.*

| Demo | Settings | Tile |
|---|---|---|
| <img src="demo.gif" width="256"> | <img src="screenshot2.png" width="256"> | <img src="screenshot1.png" width="256"> |
| <img src="media/demo.gif" width="256"> | <img src="media/screenshot2.png" width="256"> | <img src="media/screenshot1.png" width="256"> |

# Download

[<img src="media/github-badge.png"
alt="Get it on Github"
height="80">](https://github.com/nmelihsensoy/snowy/releases)

# License

Snowy is licenced under [`GNUv3.0`](LICENCE) also uses [`blockevent`](https://github.com/nmelihsensoy/blockevent) library which is licenced under `Apache 2.0` and can build from source.

Snowy Copyright 2022 N.Melih Sensoy

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
23 changes: 0 additions & 23 deletions app/src/main/java/com/nmelihsensoy/snowy/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class SettingsActivity : AppCompatActivity() {
SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
when (key) {
"tile_icon" -> updatePrefUiIcon()
"onstop_alert" -> updateToaster()
}
}

Expand All @@ -68,28 +67,6 @@ class SettingsActivity : AppCompatActivity() {
}
}

private fun updateToaster(){
val receiver = context?.let { ComponentName(it.applicationContext, SnowyToaster::class.java) }
val pm = context?.applicationContext?.packageManager

val onstopAlertVal = prefs.getBoolean("onstop_alert", true)
if (onstopAlertVal){
if (receiver != null) {
pm?.setComponentEnabledSetting(
receiver,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP)
}
}else{
if (receiver != null) {
pm?.setComponentEnabledSetting(
receiver,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP)
}
}
}

override fun onResume() {
super.onResume()
prefs.registerOnSharedPreferenceChangeListener(listener)
Expand Down
13 changes: 8 additions & 5 deletions app/src/main/java/com/nmelihsensoy/snowy/SnowyUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SnowyUtils {
fun blockTouchScreen(libPath: String, stopTrigger: String, flags: EnumSet<Mode>,
onStopMsg: String = ""){
var blockCmd = mutableListOf("su", "-c")
val blockeventCmd = mutableListOf("$libPath/blockevent.so", "-t", "-s", stopTrigger, "-v", "4")
blockCmd.addAll(collapseCmd)
blockCmd.add(";")

Expand All @@ -39,23 +40,25 @@ class SnowyUtils {
}

if (flags.contains(Mode.VIBRATE_ONSTOP)) {
blockCmd.addAll(arrayOf("($libPath/blockevent.so", "-t", "-s", stopTrigger,
"&&", "cmd", "vibrator", "vibrate", "-f", "100", "blockevent)"))
blockCmd.add("(")
blockCmd.addAll(blockeventCmd)
blockCmd.add("&&")
blockCmd.addAll(vibrateCmd)
blockCmd.add(")")
}else {
blockCmd.addAll(arrayOf("$libPath/blockevent.so", "-t", "-s", stopTrigger))
blockCmd.addAll(blockeventCmd)
}

if (flags.contains(Mode.TOAST_ONSTOP)) {
blockCmd.add(";")
blockCmd.addAll(stopAlertCmd)
blockCmd.add("\"$onStopMsg\"")
}

ProcessBuilder(blockCmd).start()
}

private fun enableToaster(cn: ComponentName, pm: PackageManager){
pm?.setComponentEnabledSetting(
pm.setComponentEnabledSetting(
cn,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP)
Expand Down
Binary file modified app/src/main/jniLibs/arm64-v8a/blockevent.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/blockevent.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/blockevent.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/blockevent.so
Binary file not shown.
Binary file removed logo.png
Binary file not shown.
File renamed without changes
Binary file added media/github-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes

0 comments on commit ee2f803

Please sign in to comment.