@@ -0,0 +1,2019 @@
+package io.github.homelocker.lib;%0A%0Aimport org.durka.hallmonitor.R;%0A%0Aimport android.app.Activity;%0Aimport android.app.AlertDialog;%0Aimport android.os.Bundle;%0Aimport android.view.Gravity;%0Aimport android.view.MotionEvent;%0Aimport android.view.WindowManager;%0Aimport android.widget.FrameLayout;%0A%0Aimport static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;%0Aimport static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;%0Aimport static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;%0A%0A/**%0A * Created by shaobin on 2014/3/22.%0A */%0Apublic class HomeKeyLocker %7B%0A    private OverlayDialog mOverlayDialog;%0A%0A    public void lock(Activity activity) %7B%0A        if (mOverlayDialog == null) %7B%0A            mOverlayDialog = new OverlayDialog(activity);%0A            mOverlayDialog.show();%0A        %7D%0A    %7D%0A%0A    public void unlock() %7B%0A        if (mOverlayDialog != null) %7B%0A            mOverlayDialog.dismiss();%0A            mOverlayDialog = null;%0A        %7D%0A    %7D%0A%0A    private static class OverlayDialog extends AlertDialog %7B%0A%0A        public OverlayDialog(Activity activity) %7B%0A            super(activity, R.style.OverlayDialog);%0A            WindowManager.LayoutParams params = getWindow().getAttributes();%0A            params.type = TYPE_SYSTEM_ALERT;%0A            params.dimAmount = 0.0F; // transparent%0A            params.width = 0;%0A            params.height = 0;%0A            params.gravity = Gravity.BOTTOM;%0A            getWindow().setAttributes(params);%0A            getWindow().setFlags(FLAG_SHOW_WHEN_LOCKED %7C FLAG_NOT_TOUCH_MODAL, 0xffffff);%0A            setOwnerActivity(activity);%0A            setCancelable(false);%0A        %7D%0A%0A        public final boolean dispatchTouchEvent(MotionEvent motionevent) %7B%0A            return true;%0A        %7D%0A%0A        protected final void onCreate(Bundle bundle) %7B%0A            super.onCreate(bundle);%0A            FrameLayout framelayout = new FrameLayout(getContext());%0A            framelayout.setBackgroundColor(0);%0A            setContentView(framelayout);%0A        %7D%0A    %7D%0A%7D%0A

add the library