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;
}
}
Log.d(TAG, "NavigationActivity.onCreate"); //$NON-NLS-1$
}
+ // Default long-click action
+ String defaultValue = ((ObjectStringIdentifier)ExplorerSettings.
+ SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
+ String value = Preferences.getSharedPreferences().getString(
+ ExplorerSettings.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(ExplorerSettings.INTENT_SETTING_CHANGED);
}
}
- // Default long-click action
- String defaultValue = ((ObjectStringIdentifier)ExplorerSettings.
- SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
- String value = Preferences.getSharedPreferences().getString(
- ExplorerSettings.SETTINGS_DEFAULT_LONG_CLICK_ACTION.getId(),
- defaultValue);
- DefaultLongClickAction mode = DefaultLongClickAction.fromId(value);
- this.mDefaultLongClickAction = mode;
-
//Save state
super.onCreate(state);
}
//The list view
this.mSearchListView = (ListView)findViewById(R.id.search_listview);
this.mSearchListView.setOnItemClickListener(this);
- this.mSearchListView.setOnItemLongClickListener(this);
+
+ // Register the long-click listener only if needed
+ if (this.mDefaultLongClickAction.compareTo(
+ DefaultLongClickAction.NONE) != 0) {
+ this.mSearchListView.setOnItemLongClickListener(this);
+ }
+
//Other components
this.mSearchWaiting = (ProgressBar)findViewById(R.id.search_waiting);
this.mSearchFoundItems = (TextView)findViewById(R.id.search_status_found_items);
//Initialize variables
this.mFiles = new ArrayList<FileSystemObject>();
- //Retrieve the default configuration
- SharedPreferences preferences = Preferences.getSharedPreferences();
- int viewMode = preferences.getInt(
- ExplorerSettings.SETTINGS_LAYOUT_MODE.getId(),
- ((ObjectIdentifier)ExplorerSettings.
- SETTINGS_LAYOUT_MODE.getDefaultValue()).getId());
- changeViewMode(NavigationLayoutMode.fromId(viewMode));
-
// Default long-click action
String defaultValue = ((ObjectStringIdentifier)ExplorerSettings.
SETTINGS_DEFAULT_LONG_CLICK_ACTION.getDefaultValue()).getId();
defaultValue);
DefaultLongClickAction mode = DefaultLongClickAction.fromId(value);
this.mDefaultLongClickAction = mode;
+
+ //Retrieve the default configuration
+ SharedPreferences preferences = Preferences.getSharedPreferences();
+ int viewMode = preferences.getInt(
+ ExplorerSettings.SETTINGS_LAYOUT_MODE.getId(),
+ ((ObjectIdentifier)ExplorerSettings.
+ SETTINGS_LAYOUT_MODE.getDefaultValue()).getId());
+ changeViewMode(NavigationLayoutMode.fromId(viewMode));
}
/**
*/
public void setDefaultLongClickAction(DefaultLongClickAction mDefaultLongClickAction) {
this.mDefaultLongClickAction = mDefaultLongClickAction;
+
+ // Register the long-click listener only if needed
+ if (this.mDefaultLongClickAction.compareTo(
+ DefaultLongClickAction.NONE) != 0) {
+ this.mAdapterView.setOnItemLongClickListener(this);
+ } else {
+ this.mAdapterView.setOnItemLongClickListener(null);
+ }
}
/**
//Set the adapter
this.mAdapter = adapter;
- newView.setAdapter(adapter);
+ newView.setAdapter(this.mAdapter);
newView.setOnItemClickListener(NavigationView.this);
- newView.setOnItemLongClickListener(NavigationView.this);
+
+ // Register the long-click listener only if needed
+ if (this.mDefaultLongClickAction.compareTo(
+ DefaultLongClickAction.NONE) != 0) {
+ newView.setOnItemLongClickListener(this);
+ }
//Add the new layout
this.mAdapterView = newView;