private void loadBitmapCompleted(String url, Bitmap loadedImage) {
    if (DebugLog.DEBUG) {
      DebugLog.d(LOG_TAG, "loadBitmapCompleted url " + url);
    }
    if (url.equals(this.getUrl())) {
      if (loadedImage != null) {
        boolean isSuccess = loadFromCache();
        if (isSuccess) {
          setmShowState(ShowState.SHOW_IMAGE);
        }
        if (DebugLog.DEBUG) {
          DebugLog.d(LOG_TAG, "loadBitmapCompleted url SHOW_IMAGE");
        }
      }
    } else if (url.equals(this.getUrl() + THUMBNAIL_POSTFIX)) {
      if (loadedImage != null) {
        boolean isSuccess = loadThumbnailFromCache();
        if (isSuccess) {
          setmShowState(ShowState.SHOW_THUMBNAIL);
        }
        if (DebugLog.DEBUG) {
          DebugLog.d(LOG_TAG, "loadBitmapCompleted url SHOW_THUMBNAIL");
        }
      }
    } else {

    }
  }
  private void loadBitmapCompleteDealWith(String url, Bitmap loadedImage) {
    if (DebugLog.DEBUG) {
      DebugLog.d(LOG_TAG, "loadBitmapCompleteDealWith url:" + url);
    }

    String currentUrl = mConfig.mImageLoader.getmCurrentUrl();
    if (url.equals(mUrl)) {
      if (!currentUrl.equals(mUrl)) {
        // mConfig.mImageLoader.addBmpToImageRemoved(loadedImage);
        return;
      }
      // mConfig.mImageLoader.addImage2Cache(url, loadedImage);
    }

    if (this.getmShowState() == ShowState.SHOW_IMAGE) {
      if (DebugLog.DEBUG) {
        DebugLog.d(LOG_TAG, "loadBitmapCompleteDealWith url SHOW_IMAGE");
      }
      //			if (url.equals(this.getUrl())) {
      //				if (loadedImage != null) {
      //					recyleImageBitmap();
      //					mImageBitmap = loadedImage;
      //					setBitmap(mImageBitmap);
      //					setmShowState(ShowState.SHOW_IMAGE);
      //				}
      //			}
      return;
    }

    loadBitmapCompleted(url, loadedImage);
  }
 private boolean loadThumbnailFromCache() {
   DebugLog.d(
       LOG_TAG, "loadThumbnailFromCache loadFromCache mUrl:" + mUrl + " mConfig:" + mConfig);
   DebugLog.d(
       LOG_TAG,
       "loadThumbnailFromCache loadFromCache mUrl:"
           + mUrl
           + " mConfig.mImageLoader:"
           + mConfig.mImageLoader);
   if (mConfig == null || mConfig.mImageLoader == null) {
     return false;
   }
   Bitmap bitmap =
       mConfig.mImageLoader.getBitmapFromCache(mWallPaper.getImgUrl() + THUMBNAIL_POSTFIX);
   DebugLog.d(
       LOG_TAG,
       "loadThumbnailFromCache loadFromCache mUrl:" + mUrl + "loadImageBitmap bitmap:" + bitmap);
   if (bitmap != null) {
     this.setUrl(mWallPaper.getImgUrl());
     this.setImageBitmap(bitmap);
     return true;
   } else {
     //            this.setBackGroundColorAndRemoveImage(mWallPaper);
     //            loadStart();
     return false;
   }
 }
  public boolean openFingerPrintOrNot() {
    KeyguardViewHostManager manager = KeyguardViewHostManager.getInstance();
    if (manager == null) {
      return false;
    }
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSecureFrozen: " + isSecureFrozen());
    if (isSecureFrozen()) {
      return false;
    }

    boolean isSecure = manager.isSecure();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSecure: " + isSecure);
    if (!isSecure) {
      return false;
    }
    boolean isSkylightShown = manager.getIsSkylightShown();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSkylightShown: " + isSkylightShown);
    if (isSkylightShown) {
      return false;
    }
    boolean isKeyguardShown = manager.isShowingAndNotOccluded();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isKeyguardShown: " + isKeyguardShown);
    if (!isKeyguardShown) {
      return false;
    }

    boolean isSimRequired = manager.needsFullscreenBouncer();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSimRequired: " + isSimRequired);
    if (isSimRequired) {
      return false;
    }
    return true;
  }
Esempio n. 5
0
 // invalidate a rectangle relative to the view's coordinate system all the way up the view
 // hierarchy
 @SuppressLint("NewApi")
 public static void invalidateGlobalRegion(View view, RectF childBounds) {
   // childBounds.offset(view.getTranslationX(), view.getTranslationY());
   if (DEBUG_INVALIDATE) if (DebugLog.DEBUG) DebugLog.d(TAG, "-------------");
   while (view.getParent() != null && view.getParent() instanceof View) {
     view = (View) view.getParent();
     view.getMatrix().mapRect(childBounds);
     view.invalidate(
         (int) Math.floor(childBounds.left),
         (int) Math.floor(childBounds.top),
         (int) Math.ceil(childBounds.right),
         (int) Math.ceil(childBounds.bottom));
     if (DebugLog.DEBUG) {
       DebugLog.v(
           TAG,
           "INVALIDATE("
               + (int) Math.floor(childBounds.left)
               + ","
               + (int) Math.floor(childBounds.top)
               + ","
               + (int) Math.ceil(childBounds.right)
               + ","
               + (int) Math.ceil(childBounds.bottom));
     }
   }
 }
  private void startIdentifyIfNeed() {

    boolean isStartFingerPrint = isActiveFingerPrint();
    DebugLog.d(LOG_TAG, "startIdentifyIfNeed  isStartFingerPrint:" + isStartFingerPrint);
    if (isStartFingerPrint && isHaveFinger()) {
      DebugLog.d(LOG_TAG, "startIdentifyIfNeed...." + Thread.currentThread().getId());
      startIdentifyTimeout(mFingerInts, 25 * 1000);
    }
  }
  private boolean isHaveFinger() {
    if (mFingerInts != null && mFingerInts.length > 0) {
      DebugLog.d(LOG_TAG, "isHaveFinger  return true");
      return true;
    }

    DebugLog.d(LOG_TAG, "isHaveFinger  return false");
    return false;
  }
 @Override
 public void onLoadingComplete(String imageUri, Bitmap loadedImage) {
   mLoadState = State.LOADED;
   if (DebugLog.DEBUG) {
     DebugLog.d(LOG_TAG, "onLoadingComplete imageUri:" + imageUri);
     DebugLog.d(LOG_TAG, "onLoadingComplete loadedImage:" + loadedImage);
   }
   HandlerObj handlerObj = new HandlerObj();
   handlerObj.setUrl(imageUri);
   handlerObj.setBitmap(loadedImage);
   Message message = mHandle.obtainMessage(GET_BITMAP_SUCCESS);
   message.obj = handlerObj;
   message.sendToTarget();
 }
 @Override
 public void onLoadingCancelled(String imageUri) {
   if (DebugLog.DEBUG) {
     DebugLog.d(LOG_TAG, "onLoadingCancelled onLoadingCancelled");
   }
   mLoadState = State.CANCELLED;
 }
Esempio n. 10
0
 @Override
 public Bitmap readFromLocal(String key) {
   DebugLog.d(TAG, "readFromLocal url:" + key);
   String file = mPath + File.separator + mFolderName + File.separator + key;
   //        Bitmap bitmap = DiskUtils.readFile(file,mScreenWid, mReuseImage);
   Bitmap bitmap = DiskUtils.getImageFromSystem(mContext, file, mReuseImage);
   return bitmap;
 }
Esempio n. 11
0
 @Override
 public boolean writeToLocal(String key, Bitmap bitmap) {
   boolean success = false;
   if (bitmap != null) {
     String path = mPath + File.separator + mFolderName;
     success = DiskUtils.saveBitmap(bitmap, key, path);
   }
   DebugLog.d(TAG, "writeToLocal success:" + success);
   return success;
 }
Esempio n. 12
0
 private void onFingerIdentify() {
   if (!isActiveFingerPrint()) {
     DebugLog.d(LOG_TAG, "onFingerIdentify  isActiveFingerPrint flase");
     return;
   }
   if (KeyguardViewHostManager.getInstance().isScreenOn()) {
     KeyguardViewHostManager.getInstance().fingerPrintSuccess();
     KeyguardViewHostManager.getInstance().unlockByFingerIdentify();
   }
 }
 public void loadImageFromCacheIfNeeded() {
   if (ShowState.SHOW_IMAGE != getmShowState()) {
     boolean isRefresh = loadFromCache();
     if (DebugLog.DEBUG) {
       DebugLog.d(LOG_TAG, "loadImageToRefresh isRefresh:" + isRefresh);
     }
     if (isRefresh) {
       setmShowState(ShowState.SHOW_IMAGE);
     }
   }
 }
Esempio n. 14
0
 /** @params reason: 0 failed;1 timeout; 2 cancel */
 public void onNoMatch(int reason) {
   DebugLog.d(
       LOG_TAG,
       "onNoMatch()---reason="
           + reason
           + " threadname:  "
           + Thread.currentThread().getName());
   Message msg = mHandler.obtainMessage(MSG_FINGER_NO_MATCH);
   msg.arg1 = reason;
   mHandler.sendMessage(msg);
 }
Esempio n. 15
0
  private void getIds() {

    DebugLog.d(LOG_TAG, "resetFingerIds...." + Thread.currentThread().getId());
    DebugLog.d(LOG_TAG, "getIds() start  time: " + SystemClock.uptimeMillis());
    try {

      Class<?> GnFingerPrintManager = (Class<?>) Class.forName(CLASS_GNFPMANAGER);
      Method getIds = GnFingerPrintManager.getMethod("getIds");
      Object obj = GnFingerPrintManager.newInstance();

      int[] ids = (int[]) getIds.invoke(obj);

      DebugLog.d(
          LOG_TAG,
          "getIds() end ids=" + Arrays.toString(ids) + "  time: " + SystemClock.uptimeMillis());
      mFingerInts = ids;
    } catch (Exception e) {
      DebugLog.d(LOG_TAG, Log.getStackTraceString(e));
      mFingerInts = null;
    }
  }
Esempio n. 16
0
 public void UnFrozenStartFingerIdentify() {
   DebugLog.d(LOG_TAG, "startIdentify  mIsStartIdentifyState:" + mIsStartIdentifyState);
   synchronized (this) {
     FingerThread.getInstance()
         .excuteTask(
             new Runnable() {
               @Override
               public void run() {
                 startIdentifyIfNeed();
               }
             });
   }
 }
 public void loadloadThumbnailFromCache() {
   // TODO Auto-generated method stub
   boolean isRefresh = loadThumbnailFromCache();
   if (DebugLog.DEBUG) {
     DebugLog.d(LOG_TAG, "loadThumbnailToRefresh isRefresh:" + isRefresh);
   }
   if (isRefresh) {
     setmShowState(ShowState.SHOW_THUMBNAIL);
   } else {
     this.setImageResource(mConfig.startBitmapID);
     setmShowState(ShowState.SHOW_NOIMAGE);
   }
 }
Esempio n. 18
0
 private static boolean isTouchInvalidArea(MotionEvent event, AmigoKeyguardPage mainCellLayout) {
   boolean isInvalidArea = false;
   Rect notificationRect = mainCellLayout.getNotificationContentRect();
   if (DebugLog.DEBUG) DebugLog.d(TAG, "notificationRect: " + notificationRect.toString());
   float x = event.getX();
   float y = event.getY();
   boolean isInNotificationRect =
       (x > notificationRect.left && x < notificationRect.right)
           && (y > notificationRect.top && y < notificationRect.bottom);
   if (isInNotificationRect) {
     isInvalidArea = true;
   }
   return isInvalidArea;
 }
Esempio n. 19
0
  private void startIdentifyTimeout(final int[] ids, final long timeout) {

    try {
      DebugLog.d(
          LOG_TAG, "startIdentifyTimeout() start...Arrays.toString(ids)=" + Arrays.toString(ids));
      mIsStartIdentifyState = true;

      Class<?> GnFingerPrintManager = (Class<?>) Class.forName(CLASS_GNFPMANAGER);
      Object obj = GnFingerPrintManager.newInstance();
      mGnFingerPrintManagerClass = GnFingerPrintManager;
      mObj = obj;

      Method startIdentify =
          GnFingerPrintManager.getMethod(
              "startIdentify", IGnIdentifyCallback.class, int[].class, long.class);
      startIdentify.invoke(obj, mIdentifyCb, ids, timeout);

      DebugLog.d(LOG_TAG, "startIdentifyTimeout() end");

    } catch (Exception e) {
      DebugLog.d(LOG_TAG, Log.getStackTraceString(e));
    }
  }
  @Override
  public void onLoadingFailed(String imageUri, FailReason failReason) {
    // WallpaperDB.getInstance(getContext().getApplicationContext()).updateDownLoadNotFinish(wallpaper);
    mLoadState = State.FAILED;
    if (DebugLog.DEBUG) {
      DebugLog.d(LOG_TAG, "onLoadingFailed imageUri:" + imageUri);
    }

    int what = GET_BITMAP_FAIL;

    HandlerObj handlerObj = new HandlerObj();
    handlerObj.setUrl(imageUri);
    handlerObj.setFailReason(failReason);
    Message message = mHandle.obtainMessage(what);
    message.obj = handlerObj;
    message.sendToTarget();
  }
Esempio n. 21
0
  private boolean readFingerprintSwitchValue() {
    // 0 is close;1 is open
    int unlockValue =
        Settings.Secure.getInt(mContext.getContentResolver(), FINGERPRINT_FOR_UNLOCK_SWITCH_KEY, 0);
    if (unlockValue == 0) {
      mFingerprintSwitchOpen = false;
    } else {
      mFingerprintSwitchOpen = true;
    }

    DebugLog.d(
        LOG_TAG,
        "readFingerprintSwitchValue: unlockValue="
            + unlockValue
            + ",mFingerprintSwitchOpen="
            + mFingerprintSwitchOpen);

    return mFingerprintSwitchOpen;
  }
Esempio n. 22
0
  private boolean isActiveFingerPrint() {
    KeyguardViewHostManager manager = KeyguardViewHostManager.getInstance();
    if (manager == null) {
      return false;
    }
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSecureFrozen: " + isSecureFrozen());
    if (isSecureFrozen()) {
      return false;
    }
    boolean isSupportFinger = KeyguardViewHostManager.isSuppotFinger();
    if (!isSupportFinger) {
      return false;
    }
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  switchOpen: " + mFingerprintSwitchOpen);
    if (!mFingerprintSwitchOpen) {
      return false;
    }
    boolean isSecure = manager.isSecure();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSecure: " + isSecure);
    if (!isSecure) {
      return false;
    }
    boolean isSkylightShown = manager.getIsSkylightShown();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSkylightShown: " + isSkylightShown);
    if (isSkylightShown) {
      return false;
    }
    boolean isKeyguardShown = manager.isShowingAndNotOccluded();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isKeyguardShown: " + isKeyguardShown);
    if (!isKeyguardShown) {
      return false;
    }
    boolean isScreenOn = manager.isScreenOn();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isScreenOn: " + isScreenOn);
    if (!isScreenOn) {
      return false;
    }

    boolean isSimRequired = manager.needsFullscreenBouncer();
    DebugLog.d(LOG_TAG, "isActiveFingerPrint  isSimRequired: " + isSimRequired);
    if (isSimRequired) {
      return false;
    }
    return true;
  }
Esempio n. 23
0
  private void onFingerNoMatch(int reason) {
    if (reason == 2) { // cancel&exception
      return;

    } else if (reason == 1) { // timeout
      synchronized (this) {
        FingerThread.getInstance()
            .excuteTask(
                new Runnable() {
                  @Override
                  public void run() {
                    startIdentifyIfNeed();
                  }
                });
      }

    } else if (reason == 0) {
      DebugLog.d(LOG_TAG, "onFingerNoMatch mIdentifyFailedTimes: " + mIdentifyFailedTimes);
      fingerMatchFail();
    }
  }
 public void loadImageBitmap(
     Wallpaper wallpaper /*, int posOfListener*/, boolean immediatelyLoad) {
   //    	mPosOfListener = posOfListener;
   mWallPaper = wallpaper;
   this.mUrl = wallpaper.getImgUrl();
   this.setTag(mUrl);
   if (DebugLog.DEBUG) {
     DebugLog.d(LOG_TAG, "loadImageBitmap mUrl" + mUrl);
   }
   this.setmShowState(ShowState.SHOW_NOIMAGE);
   mConfig.mImageLoader.loadImageToView(this /*, posOfListener*/);
   boolean isLoadFromCache = loadFromCache();
   if (!isLoadFromCache) {
     boolean isLoadThumbnailFromCache = loadThumbnailFromCache();
     if (!isLoadThumbnailFromCache) {
       this.setImageResource(mConfig.startBitmapID);
       this.setmShowState(ShowState.SHOW_NOIMAGE);
     } else {
       this.setmShowState(ShowState.SHOW_THUMBNAIL);
     }
   } else {
     this.setmShowState(ShowState.SHOW_IMAGE);
   }
 }
Esempio n. 25
0
 public void onIdentified(int fingerId, boolean updated) {
   DebugLog.d(LOG_TAG, "onIdentified()---");
   mHandler.sendEmptyMessage(MSG_FINGER_IDENTIFY);
 }
Esempio n. 26
0
 public void onExtIdentifyMsg(Message msg, String description) {
   DebugLog.d(LOG_TAG, "onExtIdentifyMsg()---");
 }
Esempio n. 27
0
  private void fingerMatchFail() {
    DebugLog.e(LOG_TAG, "fingerMatchFail  isSecureFrozen---" + isSecureFrozen());
    if (isSecureFrozen()) {
      cancel();
      return;
    }

    if (isAtHomePosition()) {
      DebugLog.d(LOG_TAG, "fingerMatchFail  isAtHomePosition : true");

      if (mIdentifyFailedTimes < 2) {
        mIdentifyFailedTimes++;
        KeyguardViewHostManager.getInstance().shakeFingerIdentifyTip();
        VibatorUtil.amigoVibrate(
            mContext,
            VibatorUtil.LOCKSCREEN_UNLOCK_CODE_ERROR,
            VibatorUtil.UNLOCK_ERROR_VIBRATE_TIME);
        synchronized (this) {
          FingerThread.getInstance()
              .excuteTask(
                  new Runnable() {
                    @Override
                    public void run() {
                      startIdentifyIfNeed();
                    }
                  });
        }

      } else if (mIdentifyFailedTimes == 2) {
        mIdentifyFailedTimes = 0;
        KeyguardViewHostManager.getInstance().shakeFingerIdentifyTip();
        VibatorUtil.amigoVibrate(
            mContext,
            VibatorUtil.LOCKSCREEN_UNLOCK_CODE_ERROR,
            VibatorUtil.UNLOCK_ERROR_VIBRATE_TIME);
        synchronized (this) {
          FingerThread.getInstance()
              .excuteTask(
                  new Runnable() {
                    @Override
                    public void run() {
                      startIdentifyIfNeed();
                    }
                  });
        }
        KeyguardViewHostManager.getInstance().scrollToUnlockHeightByOther(true);
      }

    } else {
      DebugLog.d(LOG_TAG, "fingerMatchFail  isAtHomePosition : false");

      mIdentifyFailedTimes = 0;
      KeyguardViewHostManager.getInstance().fingerPrintFailed();
      synchronized (this) {
        FingerThread.getInstance()
            .excuteTask(
                new Runnable() {
                  @Override
                  public void run() {
                    startIdentifyIfNeed();
                  }
                });
      }
    }
  }
Esempio n. 28
0
 public void onInput() {
   DebugLog.d(LOG_TAG, "onInput()---");
 }
Esempio n. 29
0
 public void onCaptureFailed(int reason) {
   DebugLog.d(LOG_TAG, "onCaptureFailed()---");
 }
Esempio n. 30
0
 public void onCaptureCompleted() {
   DebugLog.d(LOG_TAG, "onCaptureCompleted()---");
 }