Giter VIP home page Giter VIP logo

android-homekey-locker's Introduction

Android-HomeKey-Locker

Utility to disable HOME KEY in Android Activity.

As there are a lot questions about "how to disable home button in android?" on Stack Overflow, such as

This library provide a easy way to do this job.

NOTICE

This library doesn't support devices with VIRTUAL HOME KEY, such as

  • Galaxy Nexus
  • Nexus 4
  • Nexus 5
  • Nexus 7

Demo Application

The demo application (the source is in the repository) has been published onto Google Play for easy access:

Get it on Google Play

Usage

in Activity

HomeKeyLocker homeKeyLocker = new HomeKeyLocker();
homeKeyLocker.lock(this);
// home key is locked since then
homeKeyLocker.unlock();
// home key is unlocked since then

Known Issues

Side Effect

Lock HOME KEY will also lock BACK KEY and MENU KEY.

Work

  • Android 4.4.2
  • CM11 (Google Nexus S, Moto Defy)
  • Android 4.0.3
  • Moto XT910
  • Huawei C8812
  • Android 4.0.4
  • ZTE V889M
  • Android 2.3.5
  • HTC Desire S (Sense 3.0)

Not Work

License

Copyright 2014 shaobin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-homekey-locker's People

Contributors

shaobin0604 avatar simonschubert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-homekey-locker's Issues

bug when compiled

Hello,

I have tried your app on google play, and it works.
But when I tried to compile it (github source) and execute on the same smartphone, it doesn't work.

I have updated your project, in order it compiles with new Android Studio and new version of graddle.

Could you find the error, when the app tries to lock(), and publish the solution on github.

Perhaps, google prevents new compilation of the function you use, in order to prevent programmers to use your technique.

Source of new version :
HomeKey.zip

Expected Resource of type attr

public OverlayDialog(Activity activity) {
super(activity, R.style.OverlayDialog);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.type = TYPE_SYSTEM_ERROR;
params.dimAmount = 0.0F; // transparent
params.width = 0;
params.height = 0;
params.gravity = Gravity.BOTTOM;
getWindow().setAttributes(params);
getWindow().setFlags(FLAG_SHOW_WHEN_LOCKED | FLAG_NOT_TOUCH_MODAL, 0xffffff);
setOwnerActivity(activity);
setCancelable(false);
}

I updated the styles.xml with the OverlayDialog Resource but there is an error displayed - Expected Resource of type attr

what am i doing wrong ?

any help will be appreciated thank you

Cannot Open other dialog

Hello !
When i using Homekeylocker.
I'm trying open Intent Chooser , but it Intent Chooser not showing. I think HomeKeyLocker Dialog is on Top. . Please Help me

Soft keyboard not open.

After add this library in project and add below code in main activity soft keyboard not open. please give solution as soon as possible. Thanks
HomeKeyLocker homeKeyLocker = new HomeKeyLocker();
homeKeyLocker.lock(this);

While on lenevo I get this

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.geolocator/com.geolocator.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@4ce38e0 -- permission denied for window type 2010
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@4ce38e0 -- permission denied for window type 2010
at android.view.ViewRootImpl.setView(ViewRootImpl.java:820)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:351)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
at android.app.Dialog.show(Dialog.java:322)
at com.geolocator.HomeKeyLocker.lock(HomeKeyLocker.java:22)
at com.geolocator.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6684)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)

How i can use it??

Can you help me, about how i can use this code please..
i have an error in everything..

...almost...

Well, it doesn't do what it says. I have a Lenovo vibe P1m (Andr 5.1). 1. I cannot access the settings. 2. When it's on the home button works. I press the home button, I get into the home page and when I get into the app, it is back to say "unlocked". 3. It disables the back button though, close enough... :P I feel the vibration but it doesn't go back. 4. While the app runs on the background the keyboard that appears when you press on a writing place doesn't appear. I would like to lock all the hard keys (menu, home and back) if possible... Please try to fix it. I haven't found not a single app to do it. This is the closest to it...

App does not work.

Hello! Thanks for posting this solution. I tried your app (after downloading it on the play store) but it does not work. Clicking the button has no effect on the navigation keys. I use KitKat on a Moto G. Do you have any insights into how I can get it working? Thank you!

I can move this app to backgraund

Tested on emulator with Recent button.
After click on the "Recent button" then I can tap to one of invisible recent app from list and move it to foreground.

Works for a few seconds.....

Works for a few seconds in my rooted htc desire x dual sim and then goes back to home key unlocked. Badly need it as due to some reason my phone keeps opening recent apps/Menu button continuously. Dont know if its a touchpad issue. Eveything else is fine. Dont want to take it to service as its rooted and they will charge me a lot.

Do you have a full version unlike the demo one in google play?

cant work for me i dont know why

hi,
it is not working i dont know why , when importing the new version in there is no files to import
Error :" No projects are found to import"
thanks

Home Button Lock

On click of toggle button in app..home button is disabled fine..but I am having one issue..but if I tap on the screen..then it is opening home screen..how to overcome it..

Thanks,
Vinay Yamusani.

home button is enabled after opening other app

Hi,
For example, I locked home button, after that I oped ActionBar and open, for example, alarm clock. After opening I clicked on home button and closed two apps.
I think, it's a bug.

。。。

真正有用的只有复写了dispatchTouchEvent吧 我直接在activity里复写不就行了么

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.