aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjruesga <jorge@ruesga.com>2012-10-26 18:37:53 +0200
committerjruesga <jorge@ruesga.com>2012-10-26 18:37:53 +0200
commit12063a527e5b248bbdadd78d0df17d37003c179b (patch)
treeda1586ea549ca9254064bd9bf8cad6f85a2d35be
parentb968899dc925f5bddac0bf06126d804ed305d8dd (diff)
downloadandroid_packages_apps_CMFileManager-12063a527e5b248bbdadd78d0df17d37003c179b.tar.gz
android_packages_apps_CMFileManager-12063a527e5b248bbdadd78d0df17d37003c179b.tar.bz2
android_packages_apps_CMFileManager-12063a527e5b248bbdadd78d0df17d37003c179b.zip
Remove actions menu icon (issue #21)
Remove the action menu icon and the default long-click action setting. Now, long-click always shows the action menu
-rw-r--r--res/drawable-hdpi/ic_holo_light_contextual_action.pngbin588 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_holo_light_contextual_action.pngbin566 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_holo_light_contextual_action.pngbin631 -> 0 bytes
-rw-r--r--res/layout/navigation_view_details_item.xml12
-rw-r--r--res/layout/navigation_view_icons_item.xml8
-rw-r--r--res/layout/navigation_view_simple_item.xml13
-rw-r--r--res/layout/search_item.xml13
-rw-r--r--res/xml/preferences_general.xml9
-rw-r--r--src/com/cyanogenmod/filemanager/activities/NavigationActivity.java18
-rw-r--r--src/com/cyanogenmod/filemanager/activities/SearchActivity.java84
-rw-r--r--src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java26
-rw-r--r--src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java65
-rw-r--r--src/com/cyanogenmod/filemanager/adapters/SearchResultAdapter.java59
-rw-r--r--src/com/cyanogenmod/filemanager/preferences/DefaultLongClickAction.java86
-rw-r--r--src/com/cyanogenmod/filemanager/preferences/FileManagerSettings.java7
-rw-r--r--src/com/cyanogenmod/filemanager/tasks/SearchResultDrawingAsyncTask.java10
-rw-r--r--src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java98
17 files changed, 34 insertions, 474 deletions
diff --git a/res/drawable-hdpi/ic_holo_light_contextual_action.png b/res/drawable-hdpi/ic_holo_light_contextual_action.png
deleted file mode 100644
index db1b48b6..00000000
--- a/res/drawable-hdpi/ic_holo_light_contextual_action.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_holo_light_contextual_action.png b/res/drawable-mdpi/ic_holo_light_contextual_action.png
deleted file mode 100644
index 49b1e810..00000000
--- a/res/drawable-mdpi/ic_holo_light_contextual_action.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_holo_light_contextual_action.png b/res/drawable-xhdpi/ic_holo_light_contextual_action.png
deleted file mode 100644
index a64798d0..00000000
--- a/res/drawable-xhdpi/ic_holo_light_contextual_action.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/navigation_view_details_item.xml b/res/layout/navigation_view_details_item.xml
index 29975205..ee3f5b86 100644
--- a/res/layout/navigation_view_details_item.xml
+++ b/res/layout/navigation_view_details_item.xml
@@ -37,20 +37,12 @@
android:contentDescription="@null"
android:src="@null" />
- <com.cyanogenmod.filemanager.ui.widgets.NonFocusableButtonItem
- android:id="@+id/navigation_view_item_menu"
- android:layout_width="@dimen/item_menu_row_button_width"
- android:layout_height="match_parent"
- android:layout_alignParentRight="true"
- android:contentDescription="@null"
- android:src="@drawable/ic_holo_light_contextual_action" />
-
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_toLeftOf="@id/navigation_view_item_menu"
+ android:layout_alignParentRight="true"
android:layout_toRightOf="@id/navigation_view_item_icon"
- android:layout_alignWithParentIfMissing="true">
+ android:layout_marginRight="@dimen/extra_margin">
<TextView
android:id="@+id/navigation_view_item_name"
diff --git a/res/layout/navigation_view_icons_item.xml b/res/layout/navigation_view_icons_item.xml
index 422e4da0..36fdc6f1 100644
--- a/res/layout/navigation_view_icons_item.xml
+++ b/res/layout/navigation_view_icons_item.xml
@@ -36,14 +36,6 @@
android:gravity="center|center_vertical"
android:src="@null" />
-<!-- <com.cyanogenmod.filemanager.ui.widgets.NonFocusableButtonItem -->
-<!-- android:id="@+id/navigation_view_item_menu" -->
-<!-- android:layout_width="@dimen/navigation_grid_item_width" -->
-<!-- android:layout_height="@dimen/navigation_grid_item_height" -->
-<!-- android:layout_toRightOf="@id/navigation_view_item_icon" -->
-<!-- android:contentDescription="@null" -->
-<!-- android:src="@drawable/ic_holo_light_contextual_action" /> -->
-
<TextView
android:id="@+id/navigation_view_item_name"
android:layout_width="match_parent"
diff --git a/res/layout/navigation_view_simple_item.xml b/res/layout/navigation_view_simple_item.xml
index 79fa5913..db2f98d7 100644
--- a/res/layout/navigation_view_simple_item.xml
+++ b/res/layout/navigation_view_simple_item.xml
@@ -37,21 +37,12 @@
android:contentDescription="@null"
android:src="@null" />
- <com.cyanogenmod.filemanager.ui.widgets.NonFocusableButtonItem
- android:id="@+id/navigation_view_item_menu"
- android:layout_width="@dimen/item_menu_row_button_width"
- android:layout_height="match_parent"
- android:layout_alignParentRight="true"
- android:contentDescription="@null"
- android:src="@drawable/ic_holo_light_contextual_action" />
-
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_toLeftOf="@id/navigation_view_item_menu"
+ android:layout_alignParentRight="true"
android:layout_toRightOf="@id/navigation_view_item_icon"
-
- android:layout_alignWithParentIfMissing="true" >
+ android:layout_marginRight="@dimen/extra_margin" >
<TextView
android:id="@+id/navigation_view_item_name"
diff --git a/res/layout/search_item.xml b/res/layout/search_item.xml
index 6b6ae5b8..3058858f 100644
--- a/res/layout/search_item.xml
+++ b/res/layout/search_item.xml
@@ -27,19 +27,12 @@
android:contentDescription="@null"
android:src="@null" />
- <com.cyanogenmod.filemanager.ui.widgets.NonFocusableButtonItem
- android:id="@+id/search_item_menu"
- android:layout_width="@dimen/item_menu_row_button_width"
- android:layout_height="match_parent"
- android:layout_alignParentRight="true"
- android:contentDescription="@null"
- android:src="@drawable/ic_holo_light_contextual_action" />
-
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_toLeftOf="@id/search_item_menu"
- android:layout_toRightOf="@id/search_item_icon" >
+ android:layout_alignParentRight="true"
+ android:layout_toRightOf="@id/search_item_icon"
+ android:layout_marginRight="@dimen/extra_margin" >
<TextView
android:id="@+id/search_item_name"
diff --git a/res/xml/preferences_general.xml b/res/xml/preferences_general.xml
index 615a85a9..4fb84679 100644
--- a/res/xml/preferences_general.xml
+++ b/res/xml/preferences_general.xml
@@ -29,15 +29,6 @@
android:persistent="true"
android:defaultValue="false" />
- <!-- Default longclick action -->
- <ListPreference
- android:key="cm_filemanager_default_longclick_action"
- android:title="@string/pref_default_longclick_action"
- android:entries="@array/default_longclick_action_labels"
- android:entryValues="@array/default_longclick_action_values"
- android:defaultValue="0"
- android:persistent="true" />
-
<!-- Disk usage warning level -->
<ListPreference
android:key="cm_filemanager_disk_usage_warning_level"
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
index bfd675a3..f18fc325 100644
--- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
@@ -61,11 +61,9 @@ import com.cyanogenmod.filemanager.model.MountPoint;
import com.cyanogenmod.filemanager.parcelables.HistoryNavigable;
import com.cyanogenmod.filemanager.parcelables.NavigationViewInfoParcelable;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
-import com.cyanogenmod.filemanager.preferences.DefaultLongClickAction;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.NavigationLayoutMode;
import com.cyanogenmod.filemanager.preferences.ObjectIdentifier;
-import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.ui.dialogs.ActionsDialog;
import com.cyanogenmod.filemanager.ui.dialogs.ChooseConsoleDialog;
@@ -189,20 +187,6 @@ public class NavigationActivity extends Activity
return;
}
- // Default long-click action
- if (key.compareTo(FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId()) == 0) {
- String defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String id = FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId();
- String value =
- Preferences.getSharedPreferences().getString(id, defaultValue);
- DefaultLongClickAction mode = DefaultLongClickAction.fromId(value);
- getCurrentNavigationView().setDefaultLongClickAction(mode);
- return;
- }
-
// Case sensitive sort
if (key.compareTo(FileManagerSettings.
SETTINGS_CASE_SENSITIVE_SORT.getId()) == 0) {
@@ -1118,7 +1102,7 @@ public class NavigationActivity extends Activity
bundle.putString(
SearchActivity.EXTRA_SEARCH_DIRECTORY,
getCurrentNavigationView().getCurrentDir());
- // TODO VoiceSearch icon is now shown. This must be a bug of CM. Verify with a test app.
+ // TODO VoiceSearch icon is not shown. This must be a bug of CM. Verify with a test app.
startSearch(Preferences.getLastSearch(), true, bundle, false);
return true;
}
diff --git a/src/com/cyanogenmod/filemanager/activities/SearchActivity.java b/src/com/cyanogenmod/filemanager/activities/SearchActivity.java
index 8bc2c30e..57a8460b 100644
--- a/src/com/cyanogenmod/filemanager/activities/SearchActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/SearchActivity.java
@@ -50,7 +50,6 @@ import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.activities.preferences.SettingsPreferences;
import com.cyanogenmod.filemanager.activities.preferences.SettingsPreferences.SearchPreferenceFragment;
import com.cyanogenmod.filemanager.adapters.SearchResultAdapter;
-import com.cyanogenmod.filemanager.adapters.SearchResultAdapter.OnRequestMenuListener;
import com.cyanogenmod.filemanager.commands.AsyncResultExecutable;
import com.cyanogenmod.filemanager.commands.AsyncResultListener;
import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
@@ -61,15 +60,12 @@ import com.cyanogenmod.filemanager.model.Query;
import com.cyanogenmod.filemanager.model.SearchResult;
import com.cyanogenmod.filemanager.model.Symlink;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
-import com.cyanogenmod.filemanager.preferences.DefaultLongClickAction;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
-import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.providers.RecentSearchesContentProvider;
import com.cyanogenmod.filemanager.tasks.SearchResultDrawingAsyncTask;
import com.cyanogenmod.filemanager.ui.dialogs.ActionsDialog;
import com.cyanogenmod.filemanager.ui.dialogs.MessageProgressDialog;
-import com.cyanogenmod.filemanager.ui.policy.InfoActionPolicy;
import com.cyanogenmod.filemanager.ui.policy.IntentsActionPolicy;
import com.cyanogenmod.filemanager.ui.widgets.ButtonItem;
import com.cyanogenmod.filemanager.util.CommandHelper;
@@ -87,7 +83,7 @@ import java.util.List;
*/
public class SearchActivity extends Activity
implements AsyncResultListener, OnItemClickListener,
- OnItemLongClickListener, OnRequestMenuListener, OnRequestRefreshListener {
+ OnItemLongClickListener, OnRequestRefreshListener {
private static final String TAG = "SearchActivity"; //$NON-NLS-1$
@@ -136,28 +132,6 @@ public class SearchActivity extends Activity
SearchActivity.this.mSearchListView.setSelection(pos);
return;
}
-
- // Default long-click action
- if (key.compareTo(FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId()) == 0) {
- String defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String id = FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId();
- String value =
- Preferences.getSharedPreferences().getString(id, defaultValue);
- SearchActivity.this.mDefaultLongClickAction =
- DefaultLongClickAction.fromId(value);
-
- // Register the long-click listener only if needed
- if (SearchActivity.this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.NONE) != 0) {
- SearchActivity.this.
- mSearchListView.setOnItemLongClickListener(SearchActivity.this);
- } else {
- SearchActivity.this.mSearchListView.setOnItemLongClickListener(null);
- }
- return;
- }
}
}
}
@@ -189,10 +163,6 @@ public class SearchActivity extends Activity
*/
TextView mSearchTerms;
private View mEmptyListMsg;
- /**
- * @hide
- */
- DefaultLongClickAction mDefaultLongClickAction;
private String mSearchDirectory;
/**
@@ -229,15 +199,6 @@ public class SearchActivity extends Activity
// Check if app is running in chrooted mode
this.mChRooted = !FileManagerApplication.isAdvancedMode();
- // Default long-click action
- String defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String value = Preferences.getSharedPreferences().getString(
- FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId(),
- defaultValue);
- DefaultLongClickAction mode = DefaultLongClickAction.fromId(value);
- this.mDefaultLongClickAction = mode;
-
// Register the broadcast receiver
IntentFilter filter = new IntentFilter();
filter.addAction(FileManagerSettings.INTENT_SETTING_CHANGED);
@@ -381,12 +342,7 @@ public class SearchActivity extends Activity
//The list view
this.mSearchListView = (ListView)findViewById(R.id.search_listview);
this.mSearchListView.setOnItemClickListener(this);
-
- // Register the long-click listener only if needed
- if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.NONE) != 0) {
- this.mSearchListView.setOnItemLongClickListener(this);
- }
+ this.mSearchListView.setOnItemLongClickListener(this);
//Other components
this.mSearchWaiting = (ProgressBar)findViewById(R.id.search_waiting);
@@ -551,7 +507,6 @@ public class SearchActivity extends Activity
SearchResultAdapter adapter =
new SearchResultAdapter(this,
new ArrayList<SearchResult>(), R.layout.search_item, this.mQuery);
- adapter.setOnRequestMenuListener(this);
this.mSearchListView.setAdapter(adapter);
//Set terms
@@ -676,7 +631,6 @@ public class SearchActivity extends Activity
list,
R.layout.search_item,
query);
- adapter.setOnRequestMenuListener(SearchActivity.this);
SearchActivity.this.mSearchListView.setAdapter(adapter);
SearchActivity.this.mSearchListView.setSelection(0);
@@ -836,38 +790,17 @@ public class SearchActivity extends Activity
SearchResult searchResult = adapter.getItem(position);
FileSystemObject fso = searchResult.getFso();
- // Select/deselect. Not apply here
-
- // Show content description
- if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_CONTENT_DESCRIPTION) == 0) {
- InfoActionPolicy.showContentDescription(this, fso);
- }
-
- // Open with
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.OPEN_WITH) == 0) {
- IntentsActionPolicy.openFileSystemObject(this, fso, true, null, null);
- }
-
- // Show properties
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_PROPERTIES) == 0) {
- InfoActionPolicy.showPropertiesDialog(this, fso, this);
- }
-
- // Show actions
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_ACTIONS) == 0) {
- onRequestMenu(fso);
- }
+ // Open the actions menu
+ onRequestMenu(fso);
return true; //Always consume the event
}
/**
- * {@inheritDoc}
+ * Method invoked when a request to show the menu associated
+ * with an item is started.
+ *
+ * @param item The item for which the request was started
*/
- @Override
public void onRequestMenu(FileSystemObject item) {
// Prior to show the dialog, refresh the item reference
FileSystemObject fso = null;
@@ -1121,7 +1054,6 @@ public class SearchActivity extends Activity
new SearchResultDrawingAsyncTask(
this.mSearchListView,
this.mSearchWaiting,
- this,
this.mResultList,
this.mQuery);
this.mDrawingSearchResultTask.execute();
diff --git a/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java b/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
index d6fa03f9..7e6516c8 100644
--- a/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
+++ b/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
@@ -118,7 +118,6 @@ public class SettingsPreferences extends PreferenceActivity {
public static class GeneralPreferenceFragment extends PreferenceFragment {
private CheckBoxPreference mCaseSensitiveSort;
- private ListPreference mDefaultLongClickAction;
private ListPreference mFreeDiskSpaceWarningLevel;
private CheckBoxPreference mComputeFolderStatistics;
private CheckBoxPreference mAdvancedSettings;
@@ -139,15 +138,6 @@ public class SettingsPreferences extends PreferenceActivity {
key,
String.valueOf(newValue)));
- // Default long-click action
- if (FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.
- getId().compareTo(key) == 0) {
- int value = Integer.valueOf((String)newValue).intValue();
- String[] summary = getResources().getStringArray(
- R.array.default_longclick_action_labels);
- preference.setSummary(summary[value]);
- }
-
// Disk usage warning level
else if (FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.
getId().compareTo(key) == 0) {
@@ -190,26 +180,14 @@ public class SettingsPreferences extends PreferenceActivity {
FileManagerSettings.SETTINGS_CASE_SENSITIVE_SORT.getId());
this.mCaseSensitiveSort.setOnPreferenceChangeListener(this.mOnChangeListener);
- // Default long-click action
- this.mDefaultLongClickAction =
- (ListPreference)findPreference(
- FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId());
- this.mDefaultLongClickAction.setOnPreferenceChangeListener(this.mOnChangeListener);
- String defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String value = Preferences.getSharedPreferences().getString(
- FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId(),
- defaultValue);
- this.mOnChangeListener.onPreferenceChange(this.mDefaultLongClickAction, value);
-
//Disk usage warning level
this.mFreeDiskSpaceWarningLevel =
(ListPreference)findPreference(
FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.getId());
this.mFreeDiskSpaceWarningLevel.setOnPreferenceChangeListener(this.mOnChangeListener);
- defaultValue = ((String)FileManagerSettings.
+ String defaultValue = ((String)FileManagerSettings.
SETTINGS_DISK_USAGE_WARNING_LEVEL.getDefaultValue());
- value = Preferences.getSharedPreferences().getString(
+ String value = Preferences.getSharedPreferences().getString(
FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.getId(),
defaultValue);
this.mOnChangeListener.onPreferenceChange(this.mFreeDiskSpaceWarningLevel, value);
diff --git a/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java b/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
index a8b627d9..62ddf25b 100644
--- a/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
+++ b/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
@@ -58,20 +58,6 @@ public class FileSystemObjectAdapter
}
/**
- * An interface to communicate a request for show the menu associated
- * with an item.
- */
- public interface OnRequestMenuListener {
- /**
- * Method invoked when a request to show the menu associated
- * with an item is started.
- *
- * @param item The item for which the request was started
- */
- void onRequestMenu(FileSystemObject item);
- }
-
- /**
* A class that conforms with the ViewHolder pattern to performance
* the list view rendering.
*/
@@ -87,7 +73,6 @@ public class FileSystemObjectAdapter
TextView mTvName;
TextView mTvSummary;
TextView mTvSize;
- ImageButton mBtMenu;
}
/**
@@ -106,7 +91,6 @@ public class FileSystemObjectAdapter
String mName;
String mSummary;
String mSize;
- boolean mHasMenu;
}
@@ -117,7 +101,6 @@ public class FileSystemObjectAdapter
private final boolean mPickable;
private OnSelectionChangedListener mOnSelectionChangedListener;
- private OnRequestMenuListener mOnRequestMenuListener;
//The resource of the item check
private static final int RESOURCE_ITEM_CHECK = R.id.navigation_view_item_check;
@@ -129,8 +112,6 @@ public class FileSystemObjectAdapter
private static final int RESOURCE_ITEM_SUMMARY = R.id.navigation_view_item_summary;
//The resource of the item size information
private static final int RESOURCE_ITEM_SIZE = R.id.navigation_view_item_size;
- //The resource of the item check
- private static final int RESOURCE_ITEM_MENU = R.id.navigation_view_item_menu;
/**
* Constructor of <code>FileSystemObjectAdapter</code>.
@@ -166,15 +147,6 @@ public class FileSystemObjectAdapter
}
/**
- * Method that sets the listener for menu item requests.
- *
- * @param onRequestMenuListener The listener reference
- */
- public void setOnRequestMenuListener(OnRequestMenuListener onRequestMenuListener) {
- this.mOnRequestMenuListener = onRequestMenuListener;
- }
-
- /**
* Method that loads the default icons (known icons and more common icons).
*/
private void loadDefaultIcons() {
@@ -257,7 +229,6 @@ public class FileSystemObjectAdapter
this.mData[i].mName = fso.getName();
this.mData[i].mSummary = sbSummary.toString();
this.mData[i].mSize = FileHelper.getHumanReadableSize(fso);
- this.mData[i].mHasMenu = !(fso instanceof ParentDirectory);
}
}
@@ -282,17 +253,9 @@ public class FileSystemObjectAdapter
if (!this.mPickable) {
viewHolder.mBtCheck = (ImageButton)v.findViewById(RESOURCE_ITEM_CHECK);
viewHolder.mBtCheck.setOnClickListener(this);
- viewHolder.mBtMenu = (ImageButton)v.findViewById(RESOURCE_ITEM_MENU);
- if (viewHolder.mBtMenu != null) {
- viewHolder.mBtMenu.setOnClickListener(this);
- }
} else {
viewHolder.mBtCheck = (ImageButton)v.findViewById(RESOURCE_ITEM_CHECK);
viewHolder.mBtCheck.setVisibility(View.GONE);
- viewHolder.mBtMenu = (ImageButton)v.findViewById(RESOURCE_ITEM_MENU);
- if (viewHolder.mBtMenu != null) {
- viewHolder.mBtMenu.setVisibility(View.GONE);
- }
}
v.setTag(viewHolder);
}
@@ -322,10 +285,6 @@ public class FileSystemObjectAdapter
dataHolder.mSelected
? R.drawable.holo_list_selector_selected
: R.drawable.holo_list_selector_deseleted);
- if (viewHolder.mBtMenu != null) {
- viewHolder.mBtMenu.setVisibility(dataHolder.mHasMenu ? View.VISIBLE : View.GONE);
- viewHolder.mBtMenu.setTag(Integer.valueOf(position));
- }
}
//Return the view
@@ -481,22 +440,6 @@ public class FileSystemObjectAdapter
}
/**
- * Method that verify if the item can be selected.
- *
- * @param item The item view to check
- * @return boolean If the item is selectable
- */
- @SuppressWarnings("static-method")
- public boolean isSelectable(View item) {
- View v = item;
- if (item.getId() == RESOURCE_ITEM_MENU) {
- v = (View)v.getParent().getParent();
- }
- ImageButton view = (ImageButton)v.findViewById(RESOURCE_ITEM_CHECK);
- return view.getVisibility() == View.VISIBLE;
- }
-
- /**
* Method that returns the selected items.
*
* @return List<FileSystemObject> The selected items
@@ -524,7 +467,6 @@ public class FileSystemObjectAdapter
int pos = ((Integer)v.getTag()).intValue();
//Retrieve data holder
- final DataHolder dataHolder = this.mData[pos];
final FileSystemObject fso = getItem(pos);
//What button was pressed?
@@ -533,13 +475,6 @@ public class FileSystemObjectAdapter
//Get the row item view
toggleSelection(v, fso);
break;
-
- case RESOURCE_ITEM_MENU:
- //Notify menu request
- if (dataHolder.mHasMenu && fso != null) {
- this.mOnRequestMenuListener.onRequestMenu(fso);
- }
- break;
default:
break;
}
diff --git a/src/com/cyanogenmod/filemanager/adapters/SearchResultAdapter.java b/src/com/cyanogenmod/filemanager/adapters/SearchResultAdapter.java
index 94e626ba..c3bf55e1 100644
--- a/src/com/cyanogenmod/filemanager/adapters/SearchResultAdapter.java
+++ b/src/com/cyanogenmod/filemanager/adapters/SearchResultAdapter.java
@@ -20,10 +20,8 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
-import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@@ -45,21 +43,7 @@ import java.util.List;
/**
* An implementation of {@link ArrayAdapter} for display search results.
*/
-public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements OnClickListener {
-
- /**
- * An interface to communicate a request for show the menu associated
- * with an item.
- */
- public interface OnRequestMenuListener {
- /**
- * Method invoked when a request to show the menu associated
- * with an item is started.
- *
- * @param item The item for which the request was started
- */
- void onRequestMenu(FileSystemObject item);
- }
+public class SearchResultAdapter extends ArrayAdapter<SearchResult> {
/**
* A class that conforms with the ViewHolder pattern to performance
@@ -75,7 +59,6 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
ImageView mIvIcon;
TextView mTvName;
TextView mTvParentDir;
- ImageButton mBtMenu;
RelevanceView mWgRelevance;
}
@@ -103,8 +86,6 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
private final boolean mHighlightTerms;
private final boolean mShowRelevanceWidget;
- private OnRequestMenuListener mOnRequestMenuListener;
-
private final List<String> mQueries;
//The resource of the item icon
@@ -113,8 +94,6 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
private static final int RESOURCE_ITEM_NAME = R.id.search_item_name;
//The resource of the item path
private static final int RESOURCE_ITEM_PARENT_DIR = R.id.search_item_parent_dir;
- //The resource of the item check
- private static final int RESOURCE_ITEM_MENU = R.id.search_item_menu;
//The resource of the item relevance
private static final int RESOURCE_ITEM_RELEVANCE = R.id.search_item_relevance;
@@ -150,15 +129,6 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
}
/**
- * Method that sets the listener for menu item requests.
- *
- * @param onRequestMenuListener The listener reference
- */
- public void setOnRequestMenuListener(OnRequestMenuListener onRequestMenuListener) {
- this.mOnRequestMenuListener = onRequestMenuListener;
- }
-
- /**
* Method that loads the default icons (known icons and more common icons).
*/
private void loadDefaultIcons() {
@@ -263,8 +233,6 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
viewHolder.mIvIcon = (ImageView)v.findViewById(RESOURCE_ITEM_ICON);
viewHolder.mTvName = (TextView)v.findViewById(RESOURCE_ITEM_NAME);
viewHolder.mTvParentDir = (TextView)v.findViewById(RESOURCE_ITEM_PARENT_DIR);
- viewHolder.mBtMenu = (ImageButton)v.findViewById(RESOURCE_ITEM_MENU);
- viewHolder.mBtMenu.setOnClickListener(this);
viewHolder.mWgRelevance = (RelevanceView)v.findViewById(RESOURCE_ITEM_RELEVANCE);
v.setTag(viewHolder);
}
@@ -284,34 +252,9 @@ public class SearchResultAdapter extends ArrayAdapter<SearchResult> implements O
}
viewHolder.mWgRelevance.setVisibility(
dataHolder.mRelevance != null ? View.VISIBLE : View.GONE);
- viewHolder.mBtMenu.setTag(Integer.valueOf(position));
//Return the view
return v;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void onClick(View v) {
- //Select or deselect the item
- int pos = ((Integer)v.getTag()).intValue();
-
- //Retrieve search result
- final SearchResult sr = getItem(pos);
-
- switch (v.getId()) {
- case RESOURCE_ITEM_MENU:
- //Notify menu request
- if (this.mOnRequestMenuListener != null && sr.getFso() != null) {
- this.mOnRequestMenuListener.onRequestMenu(sr.getFso());
- }
- break;
- default:
- break;
- }
- }
-
-
}
diff --git a/src/com/cyanogenmod/filemanager/preferences/DefaultLongClickAction.java b/src/com/cyanogenmod/filemanager/preferences/DefaultLongClickAction.java
deleted file mode 100644
index 214ce7d2..00000000
--- a/src/com/cyanogenmod/filemanager/preferences/DefaultLongClickAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.preferences;
-
-/**
- * An enumeration of the long-click action possibilities.
- */
-public enum DefaultLongClickAction implements ObjectStringIdentifier {
-
- /**
- * No action.
- */
- NONE("0"), //$NON-NLS-1$
- /**
- * Show the item content description (item name).
- */
- SHOW_CONTENT_DESCRIPTION("1"), //$NON-NLS-1$
- /**
- * Select/deselect the item
- */
- SELECT_DESELECT("2"), //$NON-NLS-1$T
- /**
- * Open the item with ...
- */
- OPEN_WITH("3"), //$NON-NLS-1$
- /**
- * Show the item properties
- */
- SHOW_PROPERTIES("4"), //$NON-NLS-1$
- /**
- * Show the item actions
- */
- SHOW_ACTIONS("5"); //$NON-NLS-1$
-
- private String mId;
-
- /**
- * Constructor of <code>DefaultLongClickAction</code>.
- *
- * @param id The unique identifier of the enumeration
- */
- private DefaultLongClickAction(String id) {
- this.mId = id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getId() {
- return this.mId;
- }
-
- /**
- * Method that returns an instance of {@link DefaultLongClickAction} from its
- * unique identifier.
- *
- * @param id The unique identifier
- * @return DefaultLongClickAction The default long click action
- */
- public static DefaultLongClickAction fromId(String id) {
- DefaultLongClickAction[] values = values();
- int cc = values.length;
- for (int i = 0; i < cc; i++) {
- if (values[i].mId.compareTo(id) == 0) {
- return values[i];
- }
- }
- return null;
- }
-
-}
diff --git a/src/com/cyanogenmod/filemanager/preferences/FileManagerSettings.java b/src/com/cyanogenmod/filemanager/preferences/FileManagerSettings.java
index 96bd645d..facb1645 100644
--- a/src/com/cyanogenmod/filemanager/preferences/FileManagerSettings.java
+++ b/src/com/cyanogenmod/filemanager/preferences/FileManagerSettings.java
@@ -78,13 +78,6 @@ public enum FileManagerSettings {
*/
SETTINGS_CASE_SENSITIVE_SORT("cm_filemanager_case_sensitive_sort", Boolean.FALSE), //$NON-NLS-1$
/**
- * Default action when long-click over a FileSystemObject item
- * @hide
- */
- SETTINGS_DEFAULT_LONG_CLICK_ACTION(
- "cm_filemanager_default_longclick_action", //$NON-NLS-1$
- DefaultLongClickAction.NONE),
- /**
* When display a warning in free disk widget
* @hide
*/
diff --git a/src/com/cyanogenmod/filemanager/tasks/SearchResultDrawingAsyncTask.java b/src/com/cyanogenmod/filemanager/tasks/SearchResultDrawingAsyncTask.java
index 9dd93432..a247a33b 100644
--- a/src/com/cyanogenmod/filemanager/tasks/SearchResultDrawingAsyncTask.java
+++ b/src/com/cyanogenmod/filemanager/tasks/SearchResultDrawingAsyncTask.java
@@ -24,7 +24,6 @@ import android.widget.ProgressBar;
import com.cyanogenmod.filemanager.FileManagerApplication;
import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.adapters.SearchResultAdapter;
-import com.cyanogenmod.filemanager.adapters.SearchResultAdapter.OnRequestMenuListener;
import com.cyanogenmod.filemanager.model.FileSystemObject;
import com.cyanogenmod.filemanager.model.Query;
import com.cyanogenmod.filemanager.model.SearchResult;
@@ -61,28 +60,21 @@ public class SearchResultDrawingAsyncTask extends AsyncTask<Object, Integer, Boo
*/
final Query mQueries;
private boolean mRunning;
- /**
- * @hide
- */
- final OnRequestMenuListener mOnRequestMenuListener;
/**
* Constructor of <code>SearchResultDrawingAsyncTask</code>.
*
* @param searchListView The {@link ListView} reference
* @param searchWaiting A {@link ProgressBar} reference
- * @param onRequestMenuListener The listener for display the actions menu
* @param files The files to draw
* @param queries The terms of the search
*/
public SearchResultDrawingAsyncTask(
ListView searchListView, ProgressBar searchWaiting,
- OnRequestMenuListener onRequestMenuListener,
List<FileSystemObject> files, Query queries) {
super();
this.mSearchListView = searchListView;
this.mSearchWaiting = searchWaiting;
- this.mOnRequestMenuListener = onRequestMenuListener;
this.mFiles = files;
this.mQueries = queries;
this.mRunning = false;
@@ -151,8 +143,6 @@ public class SearchResultDrawingAsyncTask extends AsyncTask<Object, Integer, Boo
result,
R.layout.search_item,
SearchResultDrawingAsyncTask.this.mQueries);
- adapter.setOnRequestMenuListener(
- SearchResultDrawingAsyncTask.this.mOnRequestMenuListener);
// Configure the listview
SearchResultDrawingAsyncTask.this.mSearchListView.setAdapter(adapter);
diff --git a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
index 40035331..0cb16a6e 100644
--- a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
+++ b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
@@ -33,7 +33,6 @@ import android.widget.Toast;
import com.cyanogenmod.filemanager.FileManagerApplication;
import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.adapters.FileSystemObjectAdapter;
-import com.cyanogenmod.filemanager.adapters.FileSystemObjectAdapter.OnRequestMenuListener;
import com.cyanogenmod.filemanager.adapters.FileSystemObjectAdapter.OnSelectionChangedListener;
import com.cyanogenmod.filemanager.console.ConsoleAllocException;
import com.cyanogenmod.filemanager.listeners.OnHistoryListener;
@@ -45,13 +44,10 @@ import com.cyanogenmod.filemanager.model.ParentDirectory;
import com.cyanogenmod.filemanager.model.Symlink;
import com.cyanogenmod.filemanager.parcelables.NavigationViewInfoParcelable;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
-import com.cyanogenmod.filemanager.preferences.DefaultLongClickAction;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.NavigationLayoutMode;
import com.cyanogenmod.filemanager.preferences.ObjectIdentifier;
-import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
import com.cyanogenmod.filemanager.preferences.Preferences;
-import com.cyanogenmod.filemanager.ui.policy.InfoActionPolicy;
import com.cyanogenmod.filemanager.ui.policy.IntentsActionPolicy;
import com.cyanogenmod.filemanager.util.CommandHelper;
import com.cyanogenmod.filemanager.util.DialogHelper;
@@ -70,8 +66,7 @@ import java.util.List;
*/
public class NavigationView extends RelativeLayout implements
AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener,
- BreadcrumbListener, OnSelectionChangedListener, OnRequestMenuListener,
- OnSelectionListener, OnRequestRefreshListener {
+ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRefreshListener {
/**
* An interface to communicate selection changes events.
@@ -138,7 +133,6 @@ public class NavigationView extends RelativeLayout implements
*/
List<FileSystemObject> mFiles;
private FileSystemObjectAdapter mAdapter;
- private DefaultLongClickAction mDefaultLongClickAction;
private final Object mSync = new Object();
@@ -276,15 +270,6 @@ public class NavigationView extends RelativeLayout implements
this.mChRooted = !FileManagerApplication.isAdvancedMode();
}
- // Default long-click action
- String defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String value = Preferences.getSharedPreferences().getString(
- FileManagerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId(),
- defaultValue);
- DefaultLongClickAction lcMode = DefaultLongClickAction.fromId(value);
- this.mDefaultLongClickAction = lcMode;
-
//Retrieve the default configuration
if (this.mNavigationMode.compareTo(NAVIGATION_MODE.BROWSABLE) == 0) {
SharedPreferences preferences = Preferences.getSharedPreferences();
@@ -381,29 +366,6 @@ public class NavigationView extends RelativeLayout implements
}
/**
- * Method that sets the default long-click action
- *
- * @param mDefaultLongClickAction The default long-click action
- */
- public void setDefaultLongClickAction(DefaultLongClickAction mDefaultLongClickAction) {
- this.mDefaultLongClickAction = mDefaultLongClickAction;
-
- // Pick mode doesn't implements the onlongclick
- if (this.mNavigationMode.compareTo(NAVIGATION_MODE.BROWSABLE) == 0) {
- // Register the long-click listener only if needed. Icon layout mode always use
- // actions menu on long-click
- if (this.mDefaultLongClickAction.compareTo(DefaultLongClickAction.NONE) != 0 ||
- this.mCurrentMode.compareTo(NavigationLayoutMode.ICONS) == 0) {
- this.mAdapterView.setOnItemLongClickListener(this);
- } else {
- this.mAdapterView.setOnItemLongClickListener(null);
- }
- } else {
- this.mAdapterView.setOnItemLongClickListener(null);
- }
- }
-
- /**
* Method that sets the listener for communicate history changes.
*
* @param onHistoryListener The listener for communicate history changes
@@ -535,7 +497,6 @@ public class NavigationView extends RelativeLayout implements
itemResourceId,
this.mNavigationMode.compareTo(NAVIGATION_MODE.PICKABLE) == 0);
adapter.setOnSelectionChangedListener(this);
- adapter.setOnRequestMenuListener(this);
//Remove current layout
if (current != null) {
@@ -563,7 +524,11 @@ public class NavigationView extends RelativeLayout implements
this.mCurrentMode = newMode;
// Pick mode doesn't implements the onlongclick
- setDefaultLongClickAction(this.mDefaultLongClickAction);
+ if (this.mNavigationMode.compareTo(NAVIGATION_MODE.BROWSABLE) == 0) {
+ this.mAdapterView.setOnItemLongClickListener(this);
+ } else {
+ this.mAdapterView.setOnItemLongClickListener(null);
+ }
//Save the preference (only in navigation browse mode)
if (this.mNavigationMode.compareTo(NAVIGATION_MODE.BROWSABLE) == 0) {
@@ -875,48 +840,13 @@ public class NavigationView extends RelativeLayout implements
if (fso instanceof ParentDirectory) {
return false;
}
-
- // In icons layout mode, always long-click is associated to show actions menu
- if (this.mCurrentMode.compareTo(NavigationLayoutMode.ICONS) == 0) {
- onRequestMenu(fso);
- return true;
- }
-
- // Select/deselect
- if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SELECT_DESELECT) == 0) {
- if (adapter.isSelectable(view)) {
- adapter.toggleSelection(view);
- }
- }
-
- // Show content description
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_CONTENT_DESCRIPTION) == 0) {
- InfoActionPolicy.showContentDescription(getContext(), fso);
- }
-
- // Open with
- else if (this.mDefaultLongClickAction.compareTo(DefaultLongClickAction.OPEN_WITH) == 0) {
- if (!FileHelper.isDirectory(fso)) {
- IntentsActionPolicy.openFileSystemObject(getContext(), fso, true, null, null);
- } else {
- return false;
- }
- }
-
- // Show properties
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_PROPERTIES) == 0) {
- InfoActionPolicy.showPropertiesDialog(getContext(), fso, this);
- }
-
- // Show actions
- else if (this.mDefaultLongClickAction.compareTo(
- DefaultLongClickAction.SHOW_ACTIONS) == 0) {
- onRequestMenu(fso);
+
+ // Pick mode doesn't implements the onlongclick
+ if (this.mNavigationMode.compareTo(NAVIGATION_MODE.PICKABLE) == 0) {
+ return false;
}
+ onRequestMenu(fso);
return true; //Always consume the event
}
@@ -1027,9 +957,11 @@ public class NavigationView extends RelativeLayout implements
}
/**
- * {@inheritDoc}
+ * Method invoked when a request to show the menu associated
+ * with an item is started.
+ *
+ * @param item The item for which the request was started
*/
- @Override
public void onRequestMenu(final FileSystemObject item) {
if (this.mOnNavigationRequestMenuListener != null) {
this.mOnNavigationRequestMenuListener.onRequestMenu(this, item);