Commit fe1de383 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Hyunyoung Song
Browse files

Enable selection action mode for Android M+.

Since I62963d225e6ea5d2ec9d8ebc8a6d73099f5d6c7f, we have disabled
selection action mode in the folder-name editing mode on Launcher,
mainly because it messed up the view on phones.  However that is no
longer the case in Android M and later, where floating action mode
is available.

With this CL, we start relying on the default floating action mode
in Android M and later.

Bug: 22210697
Bug: 28526978
Change-Id: Ie19e7844194acd86cdb013254a1923f0b1d78e11
(cherry picked from commit 1bd9a430)
parent d419681a
......@@ -208,8 +208,26 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
});
mFolderName.setOnFocusChangeListener(this);
// We disable action mode for now since it messes up the view on phones
mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
if (!Utilities.ATLEAST_MARSHMALLOW) {
// We disable action mode in older OSes where floating selection menu is not yet
// available.
mFolderName.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return false;
}
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return false;
}
public void onDestroyActionMode(ActionMode mode) {
}
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
});
}
mFolderName.setOnEditorActionListener(this);
mFolderName.setSelectAllOnFocus(true);
mFolderName.setInputType(mFolderName.getInputType() |
......@@ -224,23 +242,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFooterHeight = mFooter.getMeasuredHeight();
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return false;
}
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return false;
}
public void onDestroyActionMode(ActionMode mode) {
}
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
};
public void onClick(View v) {
Object tag = v.getTag();
if (tag instanceof ShortcutInfo) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment