Add edit button to menu and handle item single click events only if
contextual action bar is disabled
This commit is contained in:
@@ -80,6 +80,9 @@ public class LoginActivity extends ListActivity implements Receiver {
|
|||||||
|
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.edit:
|
||||||
|
mode.finish();
|
||||||
|
return true;
|
||||||
case R.id.clone:
|
case R.id.clone:
|
||||||
mode.finish();
|
mode.finish();
|
||||||
return true;
|
return true;
|
||||||
@@ -104,21 +107,23 @@ public class LoginActivity extends ListActivity implements Receiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
ConnectionProfile profileClicked = (ConnectionProfile) getListAdapter().getItem(position);
|
if(mActionMode == null) {
|
||||||
|
ConnectionProfile profileClicked = (ConnectionProfile) getListAdapter().getItem(position);
|
||||||
Intent intent = new Intent(this, CloudControllerService.class);
|
|
||||||
intent.setData(Uri.parse("http://192.168.1.20:5000"));
|
Intent intent = new Intent(this, CloudControllerService.class);
|
||||||
intent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_TOKEN_OPERATION);
|
intent.setData(Uri.parse("http://192.168.1.20:5000"));
|
||||||
intent.putExtra(CloudControllerService.RECEIVER, mReceiver);
|
intent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_TOKEN_OPERATION);
|
||||||
|
intent.putExtra(CloudControllerService.RECEIVER, mReceiver);
|
||||||
Bundle params = new Bundle();
|
|
||||||
params.putString("username", profileClicked.getUsername());
|
Bundle params = new Bundle();
|
||||||
params.putString("password", profileClicked.getPassword());
|
params.putString("username", profileClicked.getUsername());
|
||||||
params.putString("tenantId", profileClicked.getTenantId());
|
params.putString("password", profileClicked.getPassword());
|
||||||
|
params.putString("tenantId", profileClicked.getTenantId());
|
||||||
intent.putExtra(CloudControllerService.PARAMS, params);
|
|
||||||
|
intent.putExtra(CloudControllerService.PARAMS, params);
|
||||||
startService(intent);
|
|
||||||
|
startService(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user