Example usage for android.content Intent ACTION_SEARCH_LONG_PRESS

List of usage examples for android.content Intent ACTION_SEARCH_LONG_PRESS

Introduction

In this page you can find the example usage for android.content Intent ACTION_SEARCH_LONG_PRESS.

Prototype

String ACTION_SEARCH_LONG_PRESS

To view the source code for android.content Intent ACTION_SEARCH_LONG_PRESS.

Click Source Link

Document

Activity Action: Start action associated with long pressing on the search key.

Usage

From source file:net.networksaremadeofstring.cyllell.Search.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_main);

    //Fancy title
    ((TextView) findViewById(R.id.TitleBarText))
            .setTypeface(Typeface.createFromAsset(this.getAssets(), "fonts/codeops_serif.ttf"));

    //List view to hold search results
    list = (ListView) findViewById(R.id.SearchResultsListView);

    //Prep the handler to do all the UI updating etc
    MakeHandler();//  ww  w  .j  av  a  2  s. c om

    //This is for the crafted search (not visible if the user came in via a search intent
    ((Button) findViewById(R.id.SearchButton)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            index = ((Spinner) findViewById(R.id.IndexChoice)).getSelectedItem().toString().toLowerCase();
            query = ((TextView) findViewById(R.id.SearchStringEditText)).getText().toString();
            PerformSearch(true);
        }
    });

    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        findViewById(R.id.SearchParamContainer).setVisibility(8);
        //findViewById(R.id.ShowSearchParams).setVisibility(0);
        findViewById(R.id.SearchMainRelativeLayout).invalidate();

        query = intent.getStringExtra(SearchManager.QUERY);
        index = "node";

        PerformSearch(false);
    } else if (Intent.ACTION_SEARCH_LONG_PRESS.equals(intent.getAction())) {
        //findViewById(R.id.SearchParamContainer).setVisibility(0);
        //findViewById(R.id.ShowSearchParams).setVisibility(4);
    } else {
        //findViewById(R.id.SearchParamContainer).setVisibility(0);
        //findViewById(R.id.ShowSearchParams).setVisibility(4);
    }

    /*((ImageView)findViewById(R.id.ShowSearchParams)).setOnClickListener(new View.OnClickListener() {
    public void onClick(View v)
    {
       findViewById(R.id.SearchParamContainer).setVisibility(0);
      findViewById(R.id.ShowSearchParams).setVisibility(4);
      findViewById(R.id.SearchMainRelativeLayout).invalidate();
    }
     });
            
    ((ImageView)findViewById(R.id.HideSearchParams)).setOnClickListener(new View.OnClickListener() {
    public void onClick(View v)
    {
       findViewById(R.id.SearchParamContainer).setVisibility(8);
      findViewById(R.id.ShowSearchParams).setVisibility(0);
      findViewById(R.id.SearchMainRelativeLayout).invalidate();
              
    }
     });*/
}

From source file:com.tundem.alternativefindr.AlternativefindrActivity.java

public void handleIntent(Intent intent, boolean onCreate) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mSearchTerm = intent.getStringExtra(SearchManager.QUERY);
        startFragment = 0;//from www  .j  av a2s .  c o m

        if (!onCreate) {
            //mPager.setCurrentItem(startFragment);
            mIndicator.setCurrentItem(startFragment);
            updateCurrentListView();
        }
    } else if (Intent.ACTION_SEARCH_LONG_PRESS.equals(intent.getAction())) {
        onSearchRequested();
    }
}