diff options
author | Adam Cohen <adamcohen@google.com> | 2011-09-30 20:10:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-30 20:10:20 -0700 |
commit | 3918640c2b0845b7647d5ecf4c0e4f80ade58a79 (patch) | |
tree | de8b89eed64bc9c013dfa3f33fdf2344f45a0cbf | |
parent | 79568720bfb745c5c136d4fbb5031a0b7e2e95ea (diff) | |
parent | ea0818d475df26d498ce08105bc2bc5582fce5a9 (diff) | |
download | packages_apps_trebuchet-3918640c2b0845b7647d5ecf4c0e4f80ade58a79.zip packages_apps_trebuchet-3918640c2b0845b7647d5ecf4c0e4f80ade58a79.tar.gz packages_apps_trebuchet-3918640c2b0845b7647d5ecf4c0e4f80ade58a79.tar.bz2 |
Merge "Small fix in Folder text editing"
-rw-r--r-- | src/com/android/launcher2/Folder.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index 1b863de..8a198f8 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -53,7 +53,8 @@ import java.util.ArrayList; * Represents a set of icons chosen by the user or generated by the system. */ public class Folder extends LinearLayout implements DragSource, View.OnClickListener, - View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener { + View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener, + View.OnFocusChangeListener { private static final String TAG = "Launcher.Folder"; @@ -148,6 +149,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mContent.setGridSize(0, 0); mFolderName = (FolderEditText) findViewById(R.id.folder_name); mFolderName.setFolder(this); + mFolderName.setOnFocusChangeListener(this); // We find out how tall the text view wants to be (it is set to wrap_content), so that // we can allocate the appropriate amount of space for it. @@ -193,16 +195,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList } } - public boolean onInterceptTouchEvent(MotionEvent ev) { - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - mFolderName.getHitRect(mHitRect); - if (mHitRect.contains((int) ev.getX(), (int) ev.getY()) && !mIsEditingName) { - startEditingFolderName(); - } - } - return false; - } - public boolean onLongClick(View v) { Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { @@ -1024,4 +1016,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList public void getLocationInDragLayer(int[] loc) { mLauncher.getDragLayer().getLocationInDragLayer(this, loc); } + + public void onFocusChange(View v, boolean hasFocus) { + if (v == mFolderName && hasFocus) { + startEditingFolderName(); + } + } } |