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

Commit 5150bcba authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Remove text selector and hide ime on print options close." into lmp-dev

parents e9866fdf 38408ff5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import com.android.printspooler.R;

/**
@@ -301,6 +302,7 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
            mSummaryContent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mDraggableContent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mMoreOptionsContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            ensureImeClosedAndInputFocusCleared();
        }
        if ((mDragProgress > 0 && progress == 0)
                || (mDragProgress < 1.0f && progress == 1.0f)) {
@@ -351,6 +353,18 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
        }
    }

    private void ensureImeClosedAndInputFocusCleared() {
        View focus = findFocus();
        if (focus != null) {
            InputMethodManager imm = (InputMethodManager) mContext.getSystemService(
                    Context.INPUT_METHOD_SERVICE);
            if (imm.isActive(focus)) {
                imm.hideSoftInputFromWindow(getWindowToken(), 0);
            }
            focus.clearFocus();
        }
    }

    private final class DragCallbacks extends ViewDragHelper.Callback {
        @Override
        public boolean tryCaptureView(View child, int pointerId) {