List of usage examples for android.app SearchManager QUERY
String QUERY
To view the source code for android.app SearchManager QUERY.
Click Source Link
From source file:org.openmrs.client.activities.FindActiveVisitsActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { mQuery = intent.getStringExtra(SearchManager.QUERY); Intent searchIntent = new Intent(this, FindActiveVisitsSearchActivity.class); searchIntent.putExtra(SearchManager.QUERY, mQuery); startActivity(searchIntent);/*from w w w .j av a2 s . c o m*/ intent.setAction(null); if (null != mFindVisitItem) { MenuItemCompat.collapseActionView(mFindVisitItem); } } }
From source file:systems.soapbox.ombuds.client.ui.omb.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); mSearchView = (SearchView) findViewById(R.id.search_view); setupSearchView();/*from w w w.j a va 2 s . com*/ mSearchResults = (ListView) findViewById(R.id.search_results); /* mResultsAdapter = new SimpleCursorAdapter(this, R.layout.list_item_search_result, null, new String[]{ScheduleContract.SearchTopicSessionsColumns.SEARCH_SNIPPET}, new int[]{R.id.search_result}, 0); mSearchResults.setAdapter(mResultsAdapter); */ mSearchResults.setOnItemClickListener(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Drawable up = DrawableCompat.wrap(ContextCompat.getDrawable(this, R.drawable.ic_arrow_back_white_24dp)); // TODO DrawableCompat.setTint(up, getResources().getColor(R.color.app_body_text_2)); // TODO toolbar.setNavigationIcon(up); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dismiss(null); } }); String query = getIntent().getStringExtra(SearchManager.QUERY); query = query == null ? "" : query; mQuery = query; if (mSearchView != null) { mSearchView.setQuery(query, false); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { doEnterAnim(); } overridePendingTransition(0, 0); }
From source file:org.adaway.ui.dialog.ActivityNotFoundDialogFragment.java
/** * Creates dialog//from w w w . ja v a 2 s . co m */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final String appGooglePlayUri = getArguments().getString(ARG_APP_GOOGLE_PLAY_URI); final String appFDroidQuery = getArguments().getString(ARG_APP_FDROID_QUERY); final int title = getArguments().getInt(ARG_TITLE); final int message = getArguments().getInt(ARG_MESSAGE); AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setPositiveButton(R.string.button_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intentGooglePlay = new Intent(Intent.ACTION_VIEW); intentGooglePlay.setData(Uri.parse(appGooglePlayUri)); try { activity.startActivity(intentGooglePlay); } catch (ActivityNotFoundException e) { Log.e(Constants.TAG, "No Google Play Store installed!, Trying FDroid...", e); Intent intentFDroid = new Intent(Intent.ACTION_SEARCH); intentFDroid.setComponent( new ComponentName("org.fdroid.fdroid", "org.fdroid.fdroid.SearchResults")); intentFDroid.putExtra(SearchManager.QUERY, appFDroidQuery); try { activity.startActivity(intentFDroid); } catch (ActivityNotFoundException e2) { Log.e(Constants.TAG, "No FDroid installed!", e2); } } } }); builder.setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setTitle(title); builder.setMessage(message); return builder.create(); }
From source file:org.sufficientlysecure.localcalendar.ui.ActivityNotFoundDialogFragment.java
/** * Creates dialog/*from ww w .j a v a 2 s.co m*/ */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final String appGooglePlayUri = getArguments().getString(ARG_APP_GOOGLE_PLAY_URI); final String appFDroidQuery = getArguments().getString(ARG_APP_FDROID_QUERY); final int title = getArguments().getInt(ARG_TITLE); final int message = getArguments().getInt(ARG_MESSAGE); AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intentGooglePlay = new Intent(Intent.ACTION_VIEW); intentGooglePlay.setData(Uri.parse(appGooglePlayUri)); try { activity.startActivity(intentGooglePlay); } catch (ActivityNotFoundException e) { Log.e(TAG, "No Google Play Store installed!, Trying FDroid...", e); Intent intentFDroid = new Intent(Intent.ACTION_SEARCH); intentFDroid.setComponent( new ComponentName("org.fdroid.fdroid", "org.fdroid.fdroid.SearchResults")); intentFDroid.putExtra(SearchManager.QUERY, appFDroidQuery); try { activity.startActivity(intentFDroid); } catch (ActivityNotFoundException e2) { Log.e(TAG, "No FDroid installed!", e2); } } } }); builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); builder.setTitle(title); builder.setMessage(message); return builder.create(); }
From source file:com.andrew.apollo.ui.activities.ShortcutActivity.java
/** * {@inheritDoc}/*from w ww. j a v a 2 s . co m*/ */ @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Fade it in overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); // Bind Apollo's service mToken = MusicUtils.bindToService(this, this); // Intiialize the intent mIntent = getIntent(); // Get the voice search query mVoiceQuery = Capitalize.capitalize(mIntent.getStringExtra(SearchManager.QUERY)); }
From source file:org.mariotaku.twidere.activity.SearchActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(android.R.string.search_go); final Intent intent = getIntent(); mArguments.clear();/*w w w .j a va2s. co m*/ mData = intent.getData(); final boolean is_search_user = mData != null ? QUERY_PARAM_VALUE_USERS.equals(mData.getQueryParameter(QUERY_PARAM_TYPE)) : false; final String query = Intent.ACTION_SEARCH.equals(intent.getAction()) ? intent.getStringExtra(SearchManager.QUERY) : mData != null ? mData.getQueryParameter(QUERY_PARAM_QUERY) : null; if (query == null) { finish(); return; } if (savedInstanceState == null) { final SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, RecentSearchProvider.AUTHORITY, RecentSearchProvider.MODE); suggestions.saveRecentQuery(query, null); } mArguments.putString(INTENT_KEY_QUERY, query); final String param_account_id = mData != null ? mData.getQueryParameter(QUERY_PARAM_ACCOUNT_ID) : null; if (param_account_id != null) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, parseLong(param_account_id)); } else { final String param_account_name = mData != null ? mData.getQueryParameter(QUERY_PARAM_ACCOUNT_NAME) : null; if (param_account_name != null) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, getAccountId(this, param_account_name)); } else { final long account_id = getDefaultAccountId(this); if (isMyAccount(this, account_id)) { mArguments.putLong(INTENT_KEY_ACCOUNT_ID, account_id); } else { finish(); return; } } } mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mAdapter = new TabsAdapter(this, getSupportFragmentManager(), null); mAdapter.addTab(SearchTweetsFragment.class, mArguments, getString(R.string.tweets), R.drawable.ic_tab_twitter, 0); mAdapter.addTab(SearchUsersFragment.class, mArguments, getString(R.string.users), R.drawable.ic_tab_person, 1); mViewPager.setAdapter(mAdapter); mViewPager.setCurrentItem(is_search_user ? 1 : 0); mPagerTab.setTabIndicatorColorResource(R.color.holo_blue_light); }
From source file:com.rowland.movies.ui.fragments.SearchFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(SearchManager.QUERY, mQuery); }
From source file:org.openmrs.client.activities.FindPatientsSearchActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { searching = true;/*from w w w. jav a2s. c om*/ lastSearchId++; mEmptyList.setVisibility(View.GONE); mPatientsListView.setEmptyView(mSpinner); mAdapter = new PatientArrayAdapter(this, R.layout.find_patients_row, new ArrayList<Patient>()); mPatientsListView.setAdapter(mAdapter); mLastQuery = intent.getStringExtra(SearchManager.QUERY); PatientCacheHelper.clearCache(); PatientCacheHelper.setId(lastSearchId); FindPatientsManager fpm = new FindPatientsManager(this); fpm.findPatient(mLastQuery, lastSearchId); if (mFindPatientMenuItem != null) { MenuItemCompat.collapseActionView(mFindPatientMenuItem); } } }
From source file:com.keylesspalace.tusky.SearchActivity.java
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { currentQuery = intent.getStringExtra(SearchManager.QUERY); searchFragment.search(currentQuery); }//from ww w .j a v a 2 s . c om }
From source file:com.klinker.android.twitter.activities.search.SearchPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); try {/* w w w. j av a 2s . c o m*/ ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0); settings = AppSettings.getInstance(this); try { searchQuery = getIntent().getStringExtra(SearchManager.QUERY); } catch (Exception e) { searchQuery = ""; } if (searchQuery == null) { searchQuery = ""; } handleIntent(getIntent()); if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) { translucent = true; getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); try { int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode"); if (immersive == 1) { translucent = false; } } catch (Exception e) { } } else { translucent = false; } Utils.setUpTheme(context, settings); setContentView(R.layout.search_pager); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.search)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); View statusBar = findViewById(R.id.activity_status_bar); mViewPager = (ViewPager) findViewById(R.id.pager); if (translucent) { statusBar.setVisibility(View.VISIBLE); int statusBarHeight = Utils.getStatusBarHeight(context); LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } else { mViewPager.setPadding(0, 0, 0, 0); } mSectionsPagerAdapter = new SearchPagerAdapter(getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } mViewPager.setCurrentItem(1); Utils.setActionBar(context, true); if (onlyProfile) { mViewPager.setCurrentItem(2); } }