Merge "Adding select all on focus to folder renaming, changed spacing"

This commit is contained in:
Adam Cohen
2011-06-21 22:39:21 -07:00
committed by Android (Google) Code Review
3 changed files with 17 additions and 4 deletions
+2 -2
View File
@@ -32,8 +32,8 @@
android:layout_height="wrap_content"
android:cacheColorHint="#ff333333"
android:hapticFeedbackEnabled="false"
launcher:widthGap="@dimen/workspace_width_gap"
launcher:heightGap="@dimen/workspace_height_gap"
launcher:widthGap="@dimen/folder_width_gap"
launcher:heightGap="@dimen/folder_height_gap"
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
launcher:xAxisStartPadding="0dip"
+2
View File
@@ -97,4 +97,6 @@
<dimen name="folder_preview_padding">4dp</dimen>
<dimen name="folder_padding">18dp</dimen>
<dimen name="folder_content_name_gap">10dp</dimen>
<dimen name="folder_width_gap">0dp</dimen>
<dimen name="folder_height_gap">0dp</dimen>
</resources>
+13 -2
View File
@@ -99,6 +99,8 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
private Alarm mOnExitAlarm = new Alarm();
private TextView mFolderName;
private int mFolderNameHeight;
private static String sDefaultFolderName;
private Rect mHitRect = new Rect();
private boolean mIsEditingName = false;
private InputMethodManager mInputMethodManager;
@@ -122,6 +124,10 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
Resources res = getResources();
mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration);
if (sDefaultFolderName == null) {
sDefaultFolderName = res.getString(R.string.folder_name);
}
}
@Override
@@ -142,6 +148,7 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
mFolderName.setCursorVisible(false);
mFolderName.setOnEditorActionListener(this);
mFolderName.setSelectAllOnFocus(true);
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@@ -183,7 +190,6 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
}
}
private Rect mHitRect = new Rect();
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mFolderName.getHitRect(mHitRect);
@@ -322,7 +328,12 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
}
mItemsInvalidated = true;
mInfo.addListener(this);
mFolderName.setText(mInfo.title);
if (sDefaultFolderName != mInfo.title) {
mFolderName.setText(mInfo.title);
} else {
mFolderName.setText("");
}
}
/**