Loading core/java/android/widget/TextView.java +15 −13 Original line number Original line Diff line number Diff line Loading @@ -8220,6 +8220,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener positionAtCursor(); positionAtCursor(); coords[0] += mPositionX; coords[0] += mPositionX; coords[1] += mPositionY; 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]); 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; mContainerPositionY = coords[1] + mPositionY; mContainer.showAtLocation(TextView.this, 0, mContainerPositionX, mContainerPositionY); 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) { if (mPastePopupWindow != null) { mPastePopupWindow.hide(); mPastePopupWindow.hide(); } } Loading Loading @@ -8502,12 +8506,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIsDragging = true; mIsDragging = true; if (mHasPastePopupWindow) { if (mHasPastePopupWindow) { mTouchTimer = SystemClock.uptimeMillis(); 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; break; } } Loading @@ -8522,10 +8520,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; break; } } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP: if (mPastePopupWindow != null) { if (mHasPastePopupWindow) { // Will show the paste popup after a delay. mController.show(); /* TEMP USER TEST: Display Paste as soon as handle is draggged long delay = SystemClock.uptimeMillis() - mTouchTimer; long delay = SystemClock.uptimeMillis() - mTouchTimer; if (delay < ViewConfiguration.getTapTimeout()) { if (delay < ViewConfiguration.getTapTimeout()) { final float touchOffsetX = ev.getRawX() - mPositionX; 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 doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop(); final int slopSquared = doubleTapSlop * doubleTapSlop; final int slopSquared = doubleTapSlop * doubleTapSlop; if (distanceSquared < slopSquared) { 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; mIsDragging = false; break; break; Loading core/res/res/layout/text_edit_no_paste_window.xml +12 −21 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. you may not use this file except in compliance with the License. Loading @@ -14,34 +14,25 @@ limitations under the License. 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_width="wrap_content" android:layout_height="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" /> <TextView android:id="@+id/title" <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:drawableLeft="@android:drawable/ic_menu_paste_dark" android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="8dip" android:text="@android:string/pasteDisabled" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="@android:color/dim_foreground_dark_inverse_disabled" 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 Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. you may not use this file except in compliance with the License. Loading @@ -14,34 +14,25 @@ limitations under the License. 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_width="wrap_content" android:layout_height="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" /> <TextView android:id="@+id/title" <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingTop="8dip" android:paddingBottom="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:textAppearance="?android:attr/textAppearanceMediumInverse" android:text="@android:string/paste" android:textColor="@android:color/black" 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 Original line Diff line number Diff line Loading @@ -8220,6 +8220,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener positionAtCursor(); positionAtCursor(); coords[0] += mPositionX; coords[0] += mPositionX; coords[1] += mPositionY; 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]); 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; mContainerPositionY = coords[1] + mPositionY; mContainer.showAtLocation(TextView.this, 0, mContainerPositionX, mContainerPositionY); 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) { if (mPastePopupWindow != null) { mPastePopupWindow.hide(); mPastePopupWindow.hide(); } } Loading Loading @@ -8502,12 +8506,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIsDragging = true; mIsDragging = true; if (mHasPastePopupWindow) { if (mHasPastePopupWindow) { mTouchTimer = SystemClock.uptimeMillis(); 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; break; } } Loading @@ -8522,10 +8520,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener break; break; } } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP: if (mPastePopupWindow != null) { if (mHasPastePopupWindow) { // Will show the paste popup after a delay. mController.show(); /* TEMP USER TEST: Display Paste as soon as handle is draggged long delay = SystemClock.uptimeMillis() - mTouchTimer; long delay = SystemClock.uptimeMillis() - mTouchTimer; if (delay < ViewConfiguration.getTapTimeout()) { if (delay < ViewConfiguration.getTapTimeout()) { final float touchOffsetX = ev.getRawX() - mPositionX; 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 doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop(); final int slopSquared = doubleTapSlop * doubleTapSlop; final int slopSquared = doubleTapSlop * doubleTapSlop; if (distanceSquared < slopSquared) { 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; mIsDragging = false; break; break; Loading
core/res/res/layout/text_edit_no_paste_window.xml +12 −21 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. you may not use this file except in compliance with the License. Loading @@ -14,34 +14,25 @@ limitations under the License. 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_width="wrap_content" android:layout_height="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" /> <TextView android:id="@+id/title" <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingBottom="8dip" android:layout_centerVertical="true" android:drawableLeft="@android:drawable/ic_menu_paste_dark" android:textAppearance="?android:attr/textAppearanceMedium" android:drawablePadding="8dip" android:text="@android:string/pasteDisabled" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="@android:color/dim_foreground_dark_inverse_disabled" 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 Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. you may not use this file except in compliance with the License. Loading @@ -14,34 +14,25 @@ limitations under the License. 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_width="wrap_content" android:layout_height="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" /> <TextView android:id="@+id/title" <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingLeft="0dip" android:paddingLeft="16dip" android:paddingRight="16dip" android:paddingRight="16dip" android:paddingTop="8dip" android:paddingTop="8dip" android:paddingBottom="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:textAppearance="?android:attr/textAppearanceMediumInverse" android:text="@android:string/paste" android:textColor="@android:color/black" 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>