// Path: app/src/main/java/com/ce/game/screenlocker/common/Const.java
// public class Const {
//     // For Activity Result
//     public static final String REQUEST_ROLE = "role";
//     public static final int REQUEST_USER_ROLE_CODE = 20;
// 
//     public static final String REQUEST_CITY_INFO = "city";
//     public static final int REQUEST_CITY_INFO_CODE = 20;
// 
//     public static final String REQUEST_ACTIVITY_EXIT = "exit";
//     public static final int REQUEST_ACTIVITY_EXIT_CODE = 20;
// 
//     public static final String REQUEST_CITY_PICKER_INFO = "city_picker";
//     public static final int REQUEST_ACTIVITY_CITY = 23;
// 
//     public static final String NOW_CITY = "location";
//     public static final String SAVE_CITY_LIST = "save_city_list";
// 
//     public static final String APP_HIDE = "Hide Apps";
//     public static final String APP_TITLE = "app_title";
// 
//     public static final int MESSAGE_HIDE_APP = 24;
// 
//     // For Activity Arguments
//     // Action Bar
//     public static final String ARGU_ACTION_BAR = "back";
//     public static final int ACTION_BAR_FROM_CREATE = 20;
//     public static final int ACTION_BAR_FROM_EDIT = 21;
// 
//     //    wallpaper
//     public static final int IMAGE_PICK = 5;
//     public static final String DEFAULT_WALLPAPER_THUMBNAIL = "default_thumb2.jpg";
//     public static final String DEFAULT_WALLPAPER_THUMBNAIL_OLD = "default_thumb.jpg";
//     public static final String DIR_ROOT = "blablalauncher";
//     public static final String SCREEN_LOCK_WALLPAPER = "/screen_lock_wallpaper";
//     public static final String DEFAULT_WALLPAPER_DIRECTORY = "/default-wallpaper";
//     public static final String DEFAULT_WALLPAPER_NAME = "default.png";
//     public static final String SYSTEM_DEFAULT_WALLPAPER_NAME = "system-default.png";
//     public static final String USER_WALLPAPER_NAME = "wallpaper-";
//     public static final String USER_WALLPAPER_NAME_SUFFIX = ".png";
//     public static final String GUEST_ENIGMA_RESULT = "guest";
//     public static final String SCREEN_LOCK_WALLPAPER_THUMBNAIL = "screen_lock_thumb.png";
//     public static final String SCREEN_LOCK_WALLPAPER_THUMBNAIL_BLURRED = "screen_lock_thumb_blurred.png";
//     public static final String EXCLUDE_DIRECTORY_FROM_GALLERY_TRICK_FILE = ".nomedia";
//     public static final String WALLPAPER_TRIGGER_SOURCE = "wallpaper_trigger_source";
//     public static final String WALLPAPER_NOT_MYSELF_PASSWORD = "wallpaper_not_myself_password";
//     public static final String EMPTY_PASSWORD_ENIGMA_RESULT = "empty";
// 
//     //    retrieve password
//     public static class OAuth2Credentials {
//         public static final String URL_START = "https://accounts.google.com/o/oauth2/v2/auth?";
//         public static final String CLIENT_ID = "294554247866-47jje3ufmkkvtlhkioqtcf43vi7c51to.apps.googleusercontent.com";
//         public static final String REDIRECT_URI = "http%3A%2F%2Flocalhost%2F__%2Fauth%2Fhandler";
//         public static final String SCOPE = "https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile";
//     }
// }


import android.app.KeyguardManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Vibrator;
import android.util.Log;
import com.ce.game.screenlocker.R;
import com.ce.game.screenlocker.common.Const;
import junit.framework.Assert;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
package com.ce.game.screenlocker.util;





/**
 * Created by KyleCe on 2016/7/6.
 *
 * @author: KyleCe
 */
public class LockAffairs {
    private static final String TAG = LockAffairs.class.getSimpleName();

    public static void vibrate(Context mContext, long milliseconds) {
        if (mContext == null) return;
        Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
        // Vibrate for 500 milliseconds
        v.vibrate(milliseconds == 0 ? 500 : milliseconds);
    }

    @Deprecated
    public static final void disableKeyguard(Context context) {
        Assert.assertNotNull(context);

        final KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        final KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("KeyguardLock");
        keyguardLock.disableKeyguard();
    }

    public Bitmap parseCustomBackground(Context context) {
        Assert.assertNotNull(context);

        try {
// Path: app/src/main/java/com/ce/game/screenlocker/common/Const.java
// public class Const {
//     // For Activity Result
//     public static final String REQUEST_ROLE = "role";
//     public static final int REQUEST_USER_ROLE_CODE = 20;
// 
//     public static final String REQUEST_CITY_INFO = "city";
//     public static final int REQUEST_CITY_INFO_CODE = 20;
// 
//     public static final String REQUEST_ACTIVITY_EXIT = "exit";
//     public static final int REQUEST_ACTIVITY_EXIT_CODE = 20;
// 
//     public static final String REQUEST_CITY_PICKER_INFO = "city_picker";
//     public static final int REQUEST_ACTIVITY_CITY = 23;
// 
//     public static final String NOW_CITY = "location";
//     public static final String SAVE_CITY_LIST = "save_city_list";
// 
//     public static final String APP_HIDE = "Hide Apps";
//     public static final String APP_TITLE = "app_title";
// 
//     public static final int MESSAGE_HIDE_APP = 24;
// 
//     // For Activity Arguments
//     // Action Bar
//     public static final String ARGU_ACTION_BAR = "back";
//     public static final int ACTION_BAR_FROM_CREATE = 20;
//     public static final int ACTION_BAR_FROM_EDIT = 21;
// 
//     //    wallpaper
//     public static final int IMAGE_PICK = 5;
//     public static final String DEFAULT_WALLPAPER_THUMBNAIL = "default_thumb2.jpg";
//     public static final String DEFAULT_WALLPAPER_THUMBNAIL_OLD = "default_thumb.jpg";
//     public static final String DIR_ROOT = "blablalauncher";
//     public static final String SCREEN_LOCK_WALLPAPER = "/screen_lock_wallpaper";
//     public static final String DEFAULT_WALLPAPER_DIRECTORY = "/default-wallpaper";
//     public static final String DEFAULT_WALLPAPER_NAME = "default.png";
//     public static final String SYSTEM_DEFAULT_WALLPAPER_NAME = "system-default.png";
//     public static final String USER_WALLPAPER_NAME = "wallpaper-";
//     public static final String USER_WALLPAPER_NAME_SUFFIX = ".png";
//     public static final String GUEST_ENIGMA_RESULT = "guest";
//     public static final String SCREEN_LOCK_WALLPAPER_THUMBNAIL = "screen_lock_thumb.png";
//     public static final String SCREEN_LOCK_WALLPAPER_THUMBNAIL_BLURRED = "screen_lock_thumb_blurred.png";
//     public static final String EXCLUDE_DIRECTORY_FROM_GALLERY_TRICK_FILE = ".nomedia";
//     public static final String WALLPAPER_TRIGGER_SOURCE = "wallpaper_trigger_source";
//     public static final String WALLPAPER_NOT_MYSELF_PASSWORD = "wallpaper_not_myself_password";
//     public static final String EMPTY_PASSWORD_ENIGMA_RESULT = "empty";
// 
//     //    retrieve password
//     public static class OAuth2Credentials {
//         public static final String URL_START = "https://accounts.google.com/o/oauth2/v2/auth?";
//         public static final String CLIENT_ID = "294554247866-47jje3ufmkkvtlhkioqtcf43vi7c51to.apps.googleusercontent.com";
//         public static final String REDIRECT_URI = "http%3A%2F%2Flocalhost%2F__%2Fauth%2Fhandler";
//         public static final String SCOPE = "https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile";
//     }
// }


// Path: app/src/main/java/com/ce/game/screenlocker/util/LockAffairs.java
import android.app.KeyguardManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Vibrator;
import android.util.Log;
import com.ce.game.screenlocker.R;
import com.ce.game.screenlocker.common.Const;
import junit.framework.Assert;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

package com.ce.game.screenlocker.util;





/**
 * Created by KyleCe on 2016/7/6.
 *
 * @author: KyleCe
 */
public class LockAffairs {
    private static final String TAG = LockAffairs.class.getSimpleName();

    public static void vibrate(Context mContext, long milliseconds) {
        if (mContext == null) return;
        Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
        // Vibrate for 500 milliseconds
        v.vibrate(milliseconds == 0 ? 500 : milliseconds);
    }

    @Deprecated
    public static final void disableKeyguard(Context context) {
        Assert.assertNotNull(context);

        final KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        final KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("KeyguardLock");
        keyguardLock.disableKeyguard();
    }

    public Bitmap parseCustomBackground(Context context) {
        Assert.assertNotNull(context);

        try {
            File fileDir = WallpaperSlaver.getAvailableStoreDirFile(Const.DIR_ROOT + Const.SCREEN_LOCK_WALLPAPER, context);