<activity
android:name=".ui.activity.ShareActivity"
android:label="@string/share_dialog_title"
- android:theme="@style/Theme.ownCloud.Dialog" >
+ android:theme="@style/Theme.ownCloud.Dialog"
+ android:launchMode="singleTop" >
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable"/>
</activity>
</application>
<string name="share_add_user_or_group">Add User or Group</string>
<string name="share_search">Search</string>
-<!-- TODO: Remove or change this placeholder text -->
- <string name="hello_blank_fragment">Hello blank fragment</string>
+ <string name="search_users_and_groups_hint">Search users and groups</string>
</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+
+ @author David A. Velasco
+ Copyright (C) 2015 ownCloud Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2,
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<!-- Searchable configuration to search users & groups in an OC server -->
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:label="@string/app_name"
+ android:hint="@string/search_users_and_groups_hint" >
+</searchable>
\ No newline at end of file
* ownCloud Android client application
*
* @author masensio
+ * @author David A. Velasco
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
package com.owncloud.android.ui.activity;
import android.accounts.Account;
+import android.app.SearchManager;
+import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
mSearchFragment = null;
}
+ 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);
+ }
+ }
+
+ private void doMySearch(String query) {
+ // TODO implement
+ Toast.makeText(this, "You want to search for [" + query + "]", Toast.LENGTH_SHORT).show();
}
@Override
import android.accounts.Account;
import android.app.Activity;
+import android.app.SearchManager;
+import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.SearchView;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
* create an instance of this fragment.
*/
public class SearchFragment extends Fragment {
- private static final String TAG = ShareFileFragment.class.getSimpleName();
+ private static final String TAG = SearchFragment.class.getSimpleName();
// the fragment initialization parameters
private static final String ARG_FILE = "FILE";
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.search_users_groups_layout, container, false);
+ // Get the SearchView and set the searchable configuration
+ SearchView searchView = (SearchView) view.findViewById(R.id.searchView);
+ SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
+ searchView.setSearchableInfo(searchManager.getSearchableInfo(
+ getActivity().getComponentName()) // assumes parent activity is the searchable activity
+ );
+ searchView.setIconifiedByDefault(false); // do not iconify the widget; expand it by default
+
return view;
}