Example #1
0
 private void updateLockIcon() {
   boolean visible = isShown() && KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
   if (visible) {
     mTrustDrawable.start();
   } else {
     mTrustDrawable.stop();
   }
   if (!visible) {
     return;
   }
   // TODO: Real icon for facelock.
   int iconRes =
       mUnlockMethodCache.isFaceUnlockRunning()
           ? com.android.internal.R.drawable.ic_account_circle
           : mUnlockMethodCache.isMethodInsecure()
               ? R.drawable.ic_lock_open_24dp
               : R.drawable.ic_lock_24dp;
   if (mLastUnlockIconRes != iconRes) {
     Drawable icon = mContext.getDrawable(iconRes);
     int iconHeight =
         getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_icon_height);
     int iconWidth = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_icon_width);
     if (icon.getIntrinsicHeight() != iconHeight || icon.getIntrinsicWidth() != iconWidth) {
       icon = new IntrinsicSizeDrawable(icon, iconWidth, iconHeight);
     }
     mLockIcon.setImageDrawable(icon);
   }
   boolean trustManaged = mUnlockMethodCache.isTrustManaged();
   mTrustDrawable.setTrustManaged(trustManaged);
   updateLockIconClickability();
 }
Example #2
0
 @Override
 protected void onVisibilityChanged(View changedView, int visibility) {
   super.onVisibilityChanged(changedView, visibility);
   if (isShown()) {
     mTrustDrawable.start();
   } else {
     mTrustDrawable.stop();
   }
   if (changedView == this && visibility == VISIBLE) {
     updateLockIcon();
     updateCameraVisibility();
   }
 }
Example #3
0
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mTrustDrawable.stop();
 }