Keyguard polishing

Integrate from proto app

* New assets

* Layout changes

* Dragging behavior change for sliding challenge

* Realign camera for new padding

Change-Id: Ia177c60f59f1fc74000d95fc39b048321acf1246
This commit is contained in:
Adam Powell
2012-10-29 18:21:31 -07:00
parent 7bf93cf50f
commit cfc3086b18
19 changed files with 44 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -25,8 +25,8 @@
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="25dp"
android:paddingBottom="25dp"
android:paddingBottom="64dp"
android:clipChildren="false"
android:clipToPadding="false"
androidprv:pageSpacing="10dp">
</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager>
</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager>

View File

@@ -169,11 +169,12 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
}
private void transitionToCamera() {
final View child = getChildAt(0);
if (mTransitioning || mChallengeActive || mDown) return;
if (DEBUG) Log.d(TAG, "Transitioning to camera...");
mTransitioning = true;
int startWidth = getChildAt(0).getWidth();
int startHeight = getChildAt(0).getHeight();
int startWidth = child.getWidth();
int startHeight = child.getHeight();
int finishWidth = getRootView().getWidth();
int finishHeight = getRootView().getHeight();
@@ -182,9 +183,15 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
float scaleY = (float) finishHeight / startHeight;
float scale = Math.max(scaleX, scaleY);
final int screenCenter = getResources().getDisplayMetrics().heightPixels / 2;
final int[] loc = new int[2];
child.getLocationInWindow(loc);
final int childCenter = loc[1] + startHeight / 2;
animate()
.scaleX(scale)
.scaleY(scale)
.translationY(screenCenter - childCenter)
.setDuration(WIDGET_ANIMATION_DURATION)
.withEndAction(mLaunchCameraRunnable)
.start();
@@ -284,6 +291,7 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
animate().cancel();
setScaleX(1);
setScaleY(1);
setTranslationY(0);
}
@Override

View File

@@ -17,11 +17,13 @@
package com.android.internal.policy.impl.keyguard;
import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.MediaStore;
@@ -97,13 +99,13 @@ public abstract class KeyguardActivityLauncher {
// For now, we'll treat this like launching any other app from secure keyguard.
// When they do, user sees the system's ResolverActivity which lets them choose
// which secure camera to use.
launchActivity(SECURE_CAMERA_INTENT, false);
launchActivity(SECURE_CAMERA_INTENT, false, false);
} else {
launchActivity(SECURE_CAMERA_INTENT, true);
launchActivity(SECURE_CAMERA_INTENT, true, false);
}
} else {
// Launch the normal camera
launchActivity(INSECURE_CAMERA_INTENT, false);
launchActivity(INSECURE_CAMERA_INTENT, false, false);
}
}
@@ -113,8 +115,11 @@ public abstract class KeyguardActivityLauncher {
* @param showsWhileLocked true if the activity can be run on top of keyguard.
* See {@link WindowManager#FLAG_SHOW_WHEN_LOCKED}
*/
public void launchActivity(final Intent intent, boolean showsWhileLocked) {
public void launchActivity(final Intent intent, boolean showsWhileLocked, boolean animate) {
final Context context = getContext();
final Bundle animation = animate ? null :
ActivityOptions.makeCustomAnimation(context, com.android.internal.R.anim.fade_in,
com.android.internal.R.anim.fade_out).toBundle();
LockPatternUtils lockPatternUtils = getLockPatternUtils();
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK
@@ -128,7 +133,8 @@ public abstract class KeyguardActivityLauncher {
Log.w(TAG, "can't dismiss keyguard on launch");
}
try {
context.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
context.startActivityAsUser(intent, animation,
new UserHandle(UserHandle.USER_CURRENT));
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Activity not found for intent + " + intent.getAction());
}
@@ -139,7 +145,8 @@ public abstract class KeyguardActivityLauncher {
callback.setOnDismissRunnable(new Runnable() {
@Override
public void run() {
context.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
context.startActivityAsUser(intent, animation,
new UserHandle(UserHandle.USER_CURRENT));
}
});
callback.dismiss(false);

View File

@@ -59,7 +59,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri
((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
.getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (assistIntent != null) {
mActivityLauncher.launchActivity(assistIntent, false);
mActivityLauncher.launchActivity(assistIntent, false, true);
} else {
Log.w(TAG, "Failed to get intent for assist activity");
}

View File

@@ -41,6 +41,8 @@ public class KeyguardWidgetFrame extends FrameLayout {
private final static PorterDuffXfermode sAddBlendMode =
new PorterDuffXfermode(PorterDuff.Mode.ADD);
static final float OUTLINE_ALPHA_MULTIPLIER = 0.6f;
private int mGradientColor;
private LinearGradient mForegroundGradient;
private LinearGradient mLeftToRightGradient;
@@ -319,7 +321,7 @@ public class KeyguardWidgetFrame extends FrameLayout {
}
public void showFrame(Object caller) {
fadeFrame(caller, true, 1f, 150);
fadeFrame(caller, true, OUTLINE_ALPHA_MULTIPLIER, 150);
}
public void fadeFrame(Object caller, boolean takeControl, float alpha, int duration) {

View File

@@ -341,6 +341,10 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
return 1f;
}
public float getOutlineAlphaForPage(int screenCenter, int index) {
return getAlphaForPage(screenCenter, index) * KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER;
}
protected boolean isOverScrollChild(int index, float scrollProgress) {
boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;
return (isInOverscroll && (index == 0 && scrollProgress < 0 ||
@@ -462,7 +466,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha);
anims.add(a);
float finalOutlineAlpha = show ? getAlphaForPage(mScreenCenter, i) : 0f;
float finalOutlineAlpha = show ? getOutlineAlphaForPage(mScreenCenter, i) : 0f;
child.fadeFrame(this, show, finalOutlineAlpha, duration);
}

View File

@@ -21,7 +21,6 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -48,8 +47,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
// The drag handle is measured in dp above & below the top edge of the
// challenge view; these parameters change based on whether the challenge
// is open or closed.
private static final int DRAG_HANDLE_CLOSED_ABOVE = 32; // dp
private static final int DRAG_HANDLE_CLOSED_BELOW = 32; // dp
private static final int DRAG_HANDLE_CLOSED_ABOVE = 64; // dp
private static final int DRAG_HANDLE_CLOSED_BELOW = 0; // dp
private static final int DRAG_HANDLE_OPEN_ABOVE = 8; // dp
private static final int DRAG_HANDLE_OPEN_BELOW = 0; // dp
@@ -243,13 +242,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
setWillNotDraw(false);
}
public void setDragDrawables(Drawable handle, Drawable icon) {
final float density = getResources().getDisplayMetrics().density;
final int handleHeight = handle != null ? handle.getIntrinsicHeight() : 0;
final int iconHeight = icon != null ? icon.getIntrinsicHeight() : 0;
// top half of the lock icon, plus another 25% to be sure
mDragHandleClosedAbove = (int) (DRAG_HANDLE_CLOSED_ABOVE * density + 0.5f);
@@ -258,9 +251,12 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
mDragHandleOpenBelow = (int) (DRAG_HANDLE_OPEN_BELOW * density + 0.5f);
// how much space to account for in the handle when closed
mChallengeBottomBound =
(mDragHandleClosedBelow + mDragHandleClosedAbove + handleHeight) / 2;
mChallengeBottomBound = mDragHandleClosedBelow;
setWillNotDraw(false);
}
public void setDragDrawables(Drawable handle, Drawable icon) {
mHandleDrawable = handle;
mDragIconDrawable = icon;
}
@@ -558,8 +554,6 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
}
mVelocityTracker.addMovement(ev);
//Log.v(TAG, "onTouch: " + ev);
final int action = ev.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
@@ -827,10 +821,12 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
}
if (mDragIconDrawable != null) {
final int closedTop = getLayoutBottom() - mChallengeBottomBound;
final int iconWidth = mDragIconDrawable.getIntrinsicWidth();
final int iconHeight = mDragIconDrawable.getIntrinsicHeight();
final int iconLeft = (challengeLeft + challengeRight - iconWidth) / 2;
final int iconTop = top + (handleHeight - iconHeight) / 2;
final int iconTop = closedTop +
(mDragHandleClosedBelow - mDragHandleClosedAbove - iconHeight) / 2;
mDragIconDrawable.setBounds(iconLeft, iconTop, iconLeft + iconWidth,
iconTop + iconHeight);
mDragIconDrawable.setAlpha((int) (mHandleAlpha * 0xFF));