+ handleIntent(getIntent());
+ }
+
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ setIntent(intent);
+ handleIntent(intent);
+ }
+
+
+ private void handleIntent(Intent intent) {
+ // Verify the action and get the query
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ doMySearch(query);
+
+ } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) {
+ Uri data = intent.getData();
+ doShareWith(
+ data.getLastPathSegment(),
+ UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority())
+ );
+
+ } else {
+ Log_OC.wtf(TAG, "Unexpected intent " + intent.toString());
+ }
+ }
+
+ private void doMySearch(String query) {
+ // TODO implement , or prevent that search may be sent without choosing from the suggestions list
+ Toast.makeText(this, "You want to search for [" + query + "]", Toast.LENGTH_SHORT).show();
+ }
+
+ private void doShareWith(String username, boolean isGroup) {
+ // TODO implement
+ if (isGroup) {
+ Toast.makeText(this, "You want to SHARE with GROUP [" + username + "]", Toast.LENGTH_SHORT).show();
+
+ } else {
+ Toast.makeText(this, "You want to SHARE with USER [" + username + "]", Toast.LENGTH_SHORT).show();
+ }