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

Commit 38408ff5 authored by Svetoslav's avatar Svetoslav
Browse files

Remove text selector and hide ime on print options close.

bug:16301754

Change-Id: I69bf09df9976b12c611821737eb4abb794c1df80
parent b4d87328
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) {