Loading core/java/android/widget/TextView.java +15 −13 Original line number Diff line number Diff line Loading @@ -8220,6 +8220,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener positionAtCursor(); coords[0] += mPositionX; coords[1] += mPositionY; coords[0] = Math.max(0, coords[0]); final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels; coords[0] = Math.min(screenWidth - mContainer.getContentView().getMeasuredWidth(), coords[0]); mContainer.showAtLocation(TextView.this, Gravity.NO_GRAVITY, coords[0], coords[1]); } Loading Loading @@ -8363,7 +8367,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mContainerPositionY = coords[1] + mPositionY; mContainer.showAtLocation(TextView.this, 0, mContainerPositionX, mContainerPositionY); // Hide paste view when handle is moved. // Hide paste view when handle is moved on screen. if (mPastePopupWindow != null) { mPastePopupWindow.hide(); } Loading Loading @@ -8502,12 +8506,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIsDragging = true; if (mHasPastePopupWindow) { mTouchTimer = SystemClock.uptimeMillis(); if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) { // Tapping on the handle again dismisses the displayed paste view, mPastePopupWindow.hide(); // and makes sure the action up does not display the paste view. mTouchTimer = 0; } } break; } Loading @@ -8522,10 +8520,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; } case MotionEvent.ACTION_UP: if (mPastePopupWindow != null) { // Will show the paste popup after a delay. mController.show(); /* TEMP USER TEST: Display Paste as soon as handle is draggged if (mHasPastePopupWindow) { long delay = SystemClock.uptimeMillis() - mTouchTimer; if (delay < ViewConfiguration.getTapTimeout()) { final float touchOffsetX = ev.getRawX() - mPositionX; Loading @@ -8537,9 +8532,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop(); final int slopSquared = doubleTapSlop * doubleTapSlop; if (distanceSquared < slopSquared) { showPastePopupWindow(); if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) { // Tapping on the handle dismisses the displayed paste view, mPastePopupWindow.hide(); } else { ((InsertionPointCursorController) mController).show(0); } } } else { mController.show(); } }*/ } mIsDragging = false; break; Loading core/res/res/layout/text_edit_no_paste_window.xml +12 −21 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project <!-- Copyright (C) 2010 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. Loading @@ -14,34 +14,25 @@ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:drawable/text_edit_paste_window"> <ImageView android:id="@+id/paste_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="16dip" android:paddingRight="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:background="@android:drawable/ic_menu_paste_dark" /> android:layout_height="wrap_content"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@android:string/pasteDisabled" android:drawableLeft="@android:drawable/ic_menu_paste_dark" android:drawablePadding="8dip" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="@android:color/dim_foreground_dark_inverse_disabled" android:layout_toRightOf="@id/paste_icon" android:background="@android:drawable/text_edit_paste_window" android:text="@android:string/pasteDisabled" android:layout_marginBottom="12dip" /> </RelativeLayout> </LinearLayout> core/res/res/layout/text_edit_paste_window.xml +11 −20 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project <!-- Copyright (C) 2010 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. Loading @@ -14,34 +14,25 @@ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:drawable/text_edit_paste_window"> <ImageView android:id="@+id/paste_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="16dip" android:paddingRight="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:background="@android:drawable/ic_menu_paste_light" /> android:layout_height="wrap_content"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:drawableLeft="@android:drawable/ic_menu_paste_light" android:drawablePadding="8dip" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:text="@android:string/paste" android:textColor="@android:color/black" android:layout_toRightOf="@id/paste_icon" android:background="@android:drawable/text_edit_paste_window" android:text="@android:string/paste" android:layout_marginBottom="12dip" /> </RelativeLayout> </LinearLayout> Loading
core/java/android/widget/TextView.java +15 −13 Original line number Diff line number Diff line Loading @@ -8220,6 +8220,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener positionAtCursor(); coords[0] += mPositionX; coords[1] += mPositionY; coords[0] = Math.max(0, coords[0]); final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels; coords[0] = Math.min(screenWidth - mContainer.getContentView().getMeasuredWidth(), coords[0]); mContainer.showAtLocation(TextView.this, Gravity.NO_GRAVITY, coords[0], coords[1]); } Loading Loading @@ -8363,7 +8367,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mContainerPositionY = coords[1] + mPositionY; mContainer.showAtLocation(TextView.this, 0, mContainerPositionX, mContainerPositionY); // Hide paste view when handle is moved. // Hide paste view when handle is moved on screen. if (mPastePopupWindow != null) { mPastePopupWindow.hide(); } Loading Loading @@ -8502,12 +8506,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIsDragging = true; if (mHasPastePopupWindow) { mTouchTimer = SystemClock.uptimeMillis(); if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) { // Tapping on the handle again dismisses the displayed paste view, mPastePopupWindow.hide(); // and makes sure the action up does not display the paste view. mTouchTimer = 0; } } break; } Loading @@ -8522,10 +8520,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; } case MotionEvent.ACTION_UP: if (mPastePopupWindow != null) { // Will show the paste popup after a delay. mController.show(); /* TEMP USER TEST: Display Paste as soon as handle is draggged if (mHasPastePopupWindow) { long delay = SystemClock.uptimeMillis() - mTouchTimer; if (delay < ViewConfiguration.getTapTimeout()) { final float touchOffsetX = ev.getRawX() - mPositionX; Loading @@ -8537,9 +8532,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop(); final int slopSquared = doubleTapSlop * doubleTapSlop; if (distanceSquared < slopSquared) { showPastePopupWindow(); if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) { // Tapping on the handle dismisses the displayed paste view, mPastePopupWindow.hide(); } else { ((InsertionPointCursorController) mController).show(0); } } } else { mController.show(); } }*/ } mIsDragging = false; break; Loading
core/res/res/layout/text_edit_no_paste_window.xml +12 −21 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project <!-- Copyright (C) 2010 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. Loading @@ -14,34 +14,25 @@ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:drawable/text_edit_paste_window"> <ImageView android:id="@+id/paste_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="16dip" android:paddingRight="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:background="@android:drawable/ic_menu_paste_dark" /> android:layout_height="wrap_content"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@android:string/pasteDisabled" android:drawableLeft="@android:drawable/ic_menu_paste_dark" android:drawablePadding="8dip" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="@android:color/dim_foreground_dark_inverse_disabled" android:layout_toRightOf="@id/paste_icon" android:background="@android:drawable/text_edit_paste_window" android:text="@android:string/pasteDisabled" android:layout_marginBottom="12dip" /> </RelativeLayout> </LinearLayout>
core/res/res/layout/text_edit_paste_window.xml +11 −20 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project <!-- Copyright (C) 2010 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. Loading @@ -14,34 +14,25 @@ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:drawable/text_edit_paste_window"> <ImageView android:id="@+id/paste_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="16dip" android:paddingRight="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:background="@android:drawable/ic_menu_paste_light" /> android:layout_height="wrap_content"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:drawableLeft="@android:drawable/ic_menu_paste_light" android:drawablePadding="8dip" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:text="@android:string/paste" android:textColor="@android:color/black" android:layout_toRightOf="@id/paste_icon" android:background="@android:drawable/text_edit_paste_window" android:text="@android:string/paste" android:layout_marginBottom="12dip" /> </RelativeLayout> </LinearLayout>