Skip to content

Commit

Permalink
Fixed issue where screenoff toggle rapidly fires
Browse files Browse the repository at this point in the history
  • Loading branch information
anselm94 committed Jun 4, 2019
1 parent 0ac757c commit f83933f
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 7 deletions.
1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_dependency_report" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
Expand All @@ -105,15 +106,22 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_main_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediary_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/linked_res_for_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_jni_libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_library_dependencies_report" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/module_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-files" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
Expand All @@ -123,7 +131,9 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
Expand Down
20 changes: 19 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* Copyright (C) 2017 Merbin J Anselm <[email protected]>
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* Copyright (C) 2016 Merbin J Anselm <[email protected]>
*
Expand Down Expand Up @@ -84,7 +102,7 @@ android {
applicationId "in.blogspot.anselmbros.torchie"
minSdkVersion 15
targetSdkVersion 28
versionCode 31
versionCode 33
versionName "3.2"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* Copyright (C) 2017 Merbin J Anselm <[email protected]>
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* Copyright (C) 2016 Merbin J Anselm <[email protected]>
*
Expand Down Expand Up @@ -80,7 +98,7 @@ protected boolean isKeyComboPerformed() {
for (int i = 0; i < current_ptr; i++) {
if (i > 0) {
int a = buffer[i], b = buffer[i - 1];
if (a == (-1 * b)) {
if ((a == -1 && b == 1) || (a == 1 && b == -1)) {
this.clearBuffer();
keyComboPerformed = true;
}
Expand Down
26 changes: 22 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
<!--
~ Copyright (C) 2017 Merbin J Anselm <[email protected]>
~
~ 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 2 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, write to the Free Software Foundation, Inc.,
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->

<!--
~ Copyright (C) 2016 Merbin J Anselm <[email protected]>
~
Expand Down Expand Up @@ -56,9 +74,9 @@
<string name="welcome_note">Make your life easier with <b>Torchie</b>! \n\nEnable <b>\'Torchie functionality\'</b> to turn on/off torch just by <b>holding volume buttons together</b>!\n\nTweak more in Torchie <b>Settings</b>!</string>
<string name="got_it">Got It</string>
<string name="permission_note">Enable <b>\'Torchie Quick\'</b> from Accessibility <b>Services</b> to experience Torchie.</string>
<string name="permission_summary"><b>Usage of Accessibility Service </b> \nTorchie requires a service to run in background to intercept PHYSICAL VOLUME BUTTON KEY presses. Since a normal \'Service\' cannot intercept Physical Hardware Key presses, an \'Accessibility Service\' is used for this purpose. It does not do anything apart from intercepting Volume Key presses! I promise! </string>
<string name="permission_warn"><b>About the PERMISSION - </b> \"<i>...observe text that you type &amp; observe your actions...</i>\"\nAlas! It\'s threatening! Android throws a \'Key Event\' only when a HARDWARE KEY is pressed. It is by this way, Torchie captures Volume Key presses. But It is Android\'s <i>flaw</i>, showing the same WARNING even for NON-HARDWARE KEYBOARD ENABLED PHONES (except very old Android devices and Blackberry Priv which had/have hardware keyboard for typing). It is impossible to design Torchie Functionality without this permission
\nAlso, Torchie <b>DOES NOT HAVE INTERNET PERMISSION</b>, so it is impossible to <i>send</i> anything to anyone\n\nTorchie CANNOT <i>COLLECT</i> anything from anyone. Feel free to enable Torchie functionality! <a href="https://torchieapp.wordpress.com/help/">Learn more</a> </string>
<string name="permission_summary"><b>Usage of Accessibility Service </b> \nTorchie requires a service to run in background. An \'Accessibility Service\' can intercept Physical Hardware Key presses while a normal background \'Service\' can\'t. It does not do anything apart from intercepting Volume Key presses! I promise! </string>
<string name="permission_warn"><b>About the PERMISSION - </b> \"<i>...observe text that you type &amp; observe your actions...</i>\"\nIt\'s threatening! Android throws a \'Key Event\' only when a HARDWARE KEY is pressed. It is by this way, Torchie captures Volume Key presses. But It is Android\'s <i>flaw</i>, showing the same WARNING even for NON-HARDWARE KEYBOARD ENABLED PHONES (except very old Android devices and Blackberry Priv which had hardware keyboard for typing).
\nAlso, Torchie <b>DOES NOT HAVE INTERNET PERMISSION</b>, so it is impossible to <i>send</i> anything to anyone\n\nTorchie DOES NOT <i>COLLECT</i> anything from anyone. <a href="https://torchieapp.wordpress.com/help/">Learn more</a> </string>
<string name="permission">Enable Torchie Functionality?</string>

<string name="about_note"><b>Torchie</b> is made by two brothers\nMerbin J Anselm and Rebin J Anselm\[email protected]\n\nMany thanks to following great hearts, who helped to translate Torchie</string>
Expand All @@ -68,7 +86,7 @@
<string name="facebook">Facebook</string>
<string name="google_plus">Google+</string>

<string name="donation_note">We\'ve spent lot\'s of <b>hours</b> making Torchie, that you may not <b>lose a second</b> turning on torch!\nSupport the work of Torchie by donating us</string>
<string name="donation_note">We\'ve spent lots of <b>hours</b> making Torchie, that you may not <b>lose a second</b> turning on torch!\nSupport the work of Torchie by donating us</string>
<string name="thank_you_note">Your care motivates us!\n\nShare a word about Torchie with your family and friends!</string>
<string name="donation_error">Oops! Error while sharing love with us!</string>
<string name="proceed_paypal">Proceed to Paypal?</string>
Expand Down
20 changes: 19 additions & 1 deletion app/src/main/res/xml/accessibility_service_config.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
<!--
~ Copyright (C) 2017 Merbin J Anselm <[email protected]>
~
~ 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 2 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, write to the Free Software Foundation, Inc.,
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->

<!--
~ Copyright (C) 2016 Merbin J Anselm <[email protected]>
~
Expand All @@ -22,4 +40,4 @@
android:canRequestFilterKeyEvents="true"
android:description="@string/accessibility_service_description_2"
android:settingsActivity="in.blogspot.anselmbros.torchie.SettingsActivity"
android:summary="@string/permission_summary" />
android:summary="@string/accessibility_service_description" />

0 comments on commit f83933f

Please sign in to comment.