Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c28261d4 authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Wire up "add widget" in keyguard" into jb-mr1-lockscreen-dev

parents 9415aa1c b5f3b707
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
    android:layout_height="match_parent"
    android:gravity="center_horizontal">
    <ImageView
        android:id="@+id/keyguard_add_widget_view"
        android:clickable="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/add_widget" />
+1 −0
Original line number Diff line number Diff line
@@ -1311,6 +1311,7 @@
  <java-symbol type="id" name="sliding_layout" />
  <java-symbol type="id" name="keyguard_add_widget" />
  <java-symbol type="id" name="sliding_layout" />
  <java-symbol type="id" name="keyguard_add_widget_view" />

  <java-symbol type="integer" name="config_carDockRotation" />
  <java-symbol type="integer" name="config_defaultUiModeType" />
+26 −0
Original line number Diff line number Diff line
@@ -35,7 +35,9 @@ import android.graphics.Rect;
import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
@@ -518,6 +520,8 @@ public class KeyguardHostView extends KeyguardViewBase {
            if (mViewMediatorCallback != null) {
                mViewMediatorCallback.keyguardDone(true);
            }
        } else {
            mViewStateManager.showBouncer(true);
        }
    }

@@ -837,6 +841,28 @@ public class KeyguardHostView extends KeyguardViewBase {
        View cameraWidget = inflater.inflate(R.layout.keyguard_camera_widget, null, true);
        mAppWidgetContainer.addWidget(cameraWidget);

        View addWidgetButton = addWidget.findViewById(R.id.keyguard_add_widget_view);
        addWidgetButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mCallback.setOnDismissRunnable(new Runnable() {

                    @Override
                    public void run() {
                        Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
                        intent.addFlags(
                                Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_SINGLE_TOP
                                | Intent.FLAG_ACTIVITY_CLEAR_TOP
                                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                        mContext.startActivityAsUser(intent,
                                new UserHandle(UserHandle.USER_CURRENT));
                    }
                });
                mCallback.dismiss(false);
            }
        });

        inflateAndAddUserSelectorWidgetIfNecessary();
        initializeTransportControl();
    }
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.internal.policy.impl.keyguard;

import android.view.View;
@@ -31,6 +46,10 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle
    public void onPageEndMoving() {
    }

    public void showBouncer(boolean show) {
        mSlidingChallengeLayout.showChallenge(show);
    }

    public void onPageSwitch(View newPage, int newPageIndex) {
        // Reset the previous page size and ensure the current page is sized appropriately
        if (mPagedView != null) {
+27 −28
Original line number Diff line number Diff line
@@ -1371,7 +1371,6 @@ public class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeL
                                    int oldX = getOffsetX() + getChildOffset(i);
                                    int newX = getOffsetX() + getChildOffset(i + shiftDelta);


                                    // Animate the view translation from its old position to its new
                                    // position
                                    AnimatorSet anim = (AnimatorSet) v.getTag();
@@ -2123,8 +2122,8 @@ public class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeL
        final View dragView = mDragView;
        from.left = (int) dragView.getTranslationX();
        from.top = (int) dragView.getTranslationY();
        AnimatorUpdateListener updateCb = new FlingAlongVectorAnimatorUpdateListener(dragView, vel, from, startTime,
                FLING_TO_DELETE_FRICTION);
        AnimatorUpdateListener updateCb = new FlingAlongVectorAnimatorUpdateListener(dragView, vel,
                from, startTime, FLING_TO_DELETE_FRICTION);

        final Runnable onAnimationEndRunnable = new Runnable() {
            @Override