@Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Thread.setDefaultUncaughtExceptionHandler(
        new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));

    final Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      final Bundle data = intent.getBundleExtra(SearchManager.APP_DATA);
      if (data != null) {
        final NetworkLibrary library = NetworkLibrary.Instance();
        final NetworkTree.Key key =
            (NetworkTree.Key) data.getSerializable(NetworkLibraryActivity.TREE_KEY_KEY);
        final NetworkTree tree = library.getTreeByKey(key);
        if (tree instanceof SearchCatalogTree) {
          final SearchCatalogTree searchTree = (SearchCatalogTree) tree;
          final String pattern = intent.getStringExtra(SearchManager.QUERY);
          final MimeType mime = searchTree.getMimeType();
          if (MimeType.APP_ATOM_XML.weakEquals(mime)) {
            searchTree.startItemsLoader(new QuietNetworkContext(), pattern);
          } else if (MimeType.TEXT_HTML.weakEquals(mime)) {
            Util.openInBrowser(this, searchTree.getUrl(pattern));
          }
        }
      }
    }
    finish();
  }
示例#2
0
 @Override
 protected void onNewIntent(Intent intent) {
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     tweetLoader.setQuery(query);
   }
 }
示例#3
0
 private void handleIntent(Intent intent) {
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     mSearchView.setQuery(query, false);
     mSearchView.clearFocus();
   }
 }
 /** {@inheritDoc} */
 @Override
 protected void onNewIntent(Intent intent) {
   // New query
   if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
     initSearch();
   }
 }
示例#5
0
  private void handleIntent(Intent intent) {
    // Special processing of the incoming intent only occurs if the action specified
    // by the intent is ACTION_SEARCH.
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);

      SearchRecentSuggestions suggestions =
          new SearchRecentSuggestions(
              this,
              SearchRecentSuggestionsProviderImpl.AUTHORITY,
              SearchRecentSuggestionsProviderImpl.MODE);
      suggestions.saveRecentQuery(query, null);

      if (mTwoPane) {
        TopTracksActivityFragment fragment = new TopTracksActivityFragment();
        mUserLeaveHintCallback = fragment;
        getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.activity_fragment_top_tracks, fragment, TOPTRACKS_FRAGMENT_TAG)
            .commit();
      }

      // do the actual search on the fragment
      MainActivityFragment mainActivityFragment =
          (MainActivityFragment)
              getSupportFragmentManager().findFragmentById(R.id.activity_fragment_main);

      mainActivityFragment.searchArtists(query);
    }
  }
示例#6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    // TODO: create layout
    mHistoryAdapter = new SearchHistoryAdapter(this);
    mResultAdapter = new SearchResultAdapter(this);

    mSearchText = (EditText) findViewById(R.id.search_text);
    mSearchText.setOnEditorActionListener(searchTextListener);
    mSearchText.addTextChangedListener(searchTextWatcher);

    final Intent queryIntent = getIntent();
    final String queryAction = queryIntent.getAction();
    if (Intent.ACTION_SEARCH.equals(queryAction)) {
      String query = queryIntent.getStringExtra(SearchManager.QUERY);
      mSearchText.setText(query);
      mSearchText.setSelection(query.length());
    } else {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
      showSearchHistory();
    }

    mSearchText.requestFocus();
  }
  // LIFECYCLE CALLBACKS
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    dialog = new ProgressDialog(context);
    Log.d(TAG, "SearchWikiActivity created...");

    Log.d(TAG, "unloading search variables...");
    Intent intent = getIntent();
    final Bundle app_data = intent.getBundleExtra(SearchManager.APP_DATA);
    if (app_data != null) {
      wiki_filepath = app_data.getString("wiki_filepath");
      Log.d(TAG, "wiki_filepath: " + wiki_filepath);
    } else {
      Log.w(TAG, "app_data is null!"); // FIXME Handle problems like wiki_file being null (exiquio)
    }
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      query = intent.getStringExtra(SearchManager.QUERY);
      Log.d(TAG, "query: " + query);
      Log.d(TAG, "search variables unloaded!");
    }

    Log.d(TAG, "starting SearchWikiTask...");
    SearchWikiTask task = new SearchWikiTask();
    task.execute(query);
    Log.d(TAG, "SearchWikiTask should have reported complete!");
  }
  private void handleIntent(Intent intent) {

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      // use the query to search your data somehow
    }
  }
示例#9
0
  private void handleIntent(Intent intent) {

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);

      showResults(query);
    }
  }
示例#10
0
  private void handleIntent(Intent intent) {

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      // use the query to search
      textView.setText(query);
    }
  }
示例#11
0
 /** @see android.app.Activity#onNewIntent(android.content.Intent) */
 @Override
 protected void onNewIntent(Intent intent) {
   setIntent(intent);
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     handleIntent(query);
   }
 }
示例#12
0
  private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {

      String query = intent.getStringExtra(SearchManager.QUERY);
      Log.d(TAG, "handle search, query=" + query);
      onQueryChanged(query);
    }
  }
 private void handleIntent(Intent intent) {
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     ListView listView = (ListView) findViewById(R.id.listView8);
     listView.setAdapter(null);
     System.out.println("QUERY TEXT2 : " + query);
     searchAdvert(query);
   }
 }
 /**
  * Verify the Intent's action and get the query
  *
  * @param intent
  */
 protected void handleIntent(Intent intent) {
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     // Tracker
     //			Tracker.getInstance().trackPageView("map/search/" + query);
     query = query.trim();
     mController.search(query);
   }
 }
示例#15
0
 @Override
 protected void onNewIntent(Intent intent) {
   // TODO Auto-generated method stub
   super.onNewIntent(intent);
   setIntent(intent);
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     query = intent.getStringExtra(SearchManager.QUERY);
     new LoadSearchResultsAsyncTask(this, this).execute(query);
   }
 }
示例#16
0
  private void doSearchQuery(Intent intent) {
    showInfo(" doSearchQuery() is called");
    if (intent == null) return;

    String queryAction = intent.getAction();
    if (Intent.ACTION_SEARCH.equals(queryAction)) {
      String queryString = intent.getStringExtra(SearchManager.QUERY);
      showInfo("搜索内容" + queryString);
    }
  }
  private void handleIntent(Intent intent) {

    Log.d(TAG, "handleIntent" + intent.getAction());
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      presenter.setQuery(query);
      Log.d(TAG, "query:" + query);
      // 通过某种方法,根据请求检索你的数据
    }
  }
示例#18
0
 private void handleIntent(Intent intent) {
   if (Intent.ACTION_VIEW.equals(intent.getAction())) {
     Intent wordIntent = new Intent(this, WordActivity.class);
     wordIntent.setData(intent.getData());
     startActivity(wordIntent);
     finish();
   } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     showResults(query);
   }
 }
  private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      // where you do the actual database search
      String query = intent.getStringExtra(SearchManager.QUERY);

      // SELECT * FROM awesometable WHERE name = ? (or WHERE name LIKE ?)
      Cursor cursor = mPokemonDatabaseHelper.getInstance(this).searchPokemon(query);

      mCursorAdapter.swapCursor(cursor);
    }
  }
示例#20
0
  /** Handling intent data */
  private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);

      /**
       * Use this query to display search results like 1. Getting the data from SQLite and showing
       * in listview 2. Making webrequest and displaying the data For now we just display the query
       * only
       */
      txtQuery.setText("Search Query: " + query);
    }
  }
示例#21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      doMySearch(query);
    }
  }
 /** Initialize {@link #mUIController}. */
 private void initUIController() {
   if (UiUtilities.useTwoPane(this)) {
     if (getIntent().getAction() != null
         && Intent.ACTION_SEARCH.equals(getIntent().getAction())
         && !UiUtilities.showTwoPaneSearchResults(this)) {
       mUIController = new UIControllerSearchTwoPane(this);
     } else {
       mUIController = new UIControllerTwoPane(this);
     }
   } else {
     mUIController = new UIControllerOnePane(this);
   }
 }
示例#23
0
  @Override
  protected void onNewIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      if (menu.findItem(R.id.menu_search).isActionViewExpanded()) {
        menu.findItem(R.id.menu_search).collapseActionView();
      }
      Log.w("Search", query);

      ScheduleFragment.user = query.toLowerCase();
      UpdateSchedule.scroll = true;
      ScheduleFragment.createList();
    }
  }
  /** {@inheritDoc} */
  @Override
  protected void onCreate(Bundle state) {
    if (DEBUG) {
      Log.d(TAG, "SearchActivity.onCreate"); // $NON-NLS-1$
    }

    // Check if app is running in chrooted mode
    this.mChRooted = FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;

    // Register the broadcast receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(FileManagerSettings.INTENT_SETTING_CHANGED);
    filter.addAction(FileManagerSettings.INTENT_THEME_CHANGED);
    registerReceiver(this.mNotificationReceiver, filter);

    // Set in transition
    overridePendingTransition(R.anim.translate_to_right_in, R.anim.hold_out);

    // Set the main layout of the activity
    setContentView(R.layout.search);

    // Restore state
    if (state != null) {
      restoreState(state);
    }

    // Initialize action bars and search
    initTitleActionBar();
    initComponents();

    // Apply current theme
    applyTheme();

    if (this.mRestoreState != null) {
      // Restore activity from cached data
      loadFromCacheData();
    } else {
      // New query
      if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        initSearch();
      } else if (ACTION_RESTORE.equals(getIntent().getAction())) {
        restoreState(getIntent().getExtras());
        loadFromCacheData();
      }
    }

    // Save state
    super.onCreate(state);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      SearchRecentSuggestions suggestions =
          new SearchRecentSuggestions(
              this, RecentSuggestionsProvider.AUTHORITY, RecentSuggestionsProvider.MODE);
      suggestions.saveRecentQuery(query, null);
      finish();
    }
  }
示例#26
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // searchString = getIntent().getStringExtra("search_text");
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.search_list_activity);

    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      query = intent.getStringExtra(SearchManager.QUERY);
      new LoadSearchResultsAsyncTask(this, this).execute(query);
    }

    setUpViews();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_search);
   setupView();
   imageResults = new ArrayList<ImageResult>();
   aImageResults = new ImageResultsAdapter(this, imageResults);
   gvImageResults.setAdapter(aImageResults);
   settings = new ImageSetting();
   // Get the intent, verify the action and get the query
   Intent intent = getIntent();
   if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
     String query = intent.getStringExtra(SearchManager.QUERY);
     // doMySearch(query);
   }
 }
  private void handleIntent(Intent intent) {

    if (Intent.ACTION_MAIN.equals(intent.getAction())) {
      fillDataTransaction("", "date DESC", "5");
    } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String searchQuery = intent.getStringExtra(SearchManager.QUERY);
      fillDataTransaction(searchQuery, "date DESC", "");
    } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
      String id = checkIntentForID();
      onItemSelected(id);
    } else if (Intent.ACTION_DELETE.equals(intent.getAction())) {
      NotesDAO.deleteNote(
          getApplicationContext(), Integer.parseInt(intent.getStringExtra("itemId")));
      fillDataTransaction("", "date DESC", "");
      Toast.makeText(getApplicationContext(), "Note Deleted!", Toast.LENGTH_SHORT).show();
    }
  }
示例#29
0
  private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      Toast.makeText(this, "typed: " + query, Toast.LENGTH_SHORT).show();
    } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
      Bundle bundle = this.getIntent().getExtras();

      assert (bundle != null);

      if (bundle != null) {
        ResultItem receivedItem =
            bundle.getParcelable(CustomSearchableConstants.CLICKED_RESULT_ITEM);
        ((ContactsFragment) viewPagerAdapter.getItem(1))
            .updateRecyclerViewFromSearchSelection(receivedItem.getHeader());
      }
    }
  }
示例#30
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Buscando o elemento Listview da nossa interface principal interface
    lstLinguagens = (ListView) findViewById(R.id.lstLinguagens);

    source = new LinguagemDataSource(getApplicationContext());

    // Verifica se a activity foi chamada através do callback de busca
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);

      // Recupera do banco as informações filtradas
      linguagens = source.filterByNome(query);

    } else {

      // Recupera do banco as informações que serão uitlizados em nosso adapter
      linguagens = source.allLinguagens();
    }

    // Passamos a lista de exemplo para gerar nosso adpater
    adapter = new LinguagemArrayAdapter(getApplicationContext(), R.layout.linguagem, linguagens);

    // Setando o adapter em nossa ListView
    lstLinguagens.setAdapter(adapter);

    // Setando callback ao selecionar um item da lista
    lstLinguagens.setOnItemClickListener(
        new OnItemClickListener() {

          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            try {
              JSONObject linguagem = linguagens.get(position);
              String descricao = linguagem.getString("descricao");
              Toast.makeText(getApplicationContext(), descricao, 10000).show();
            } catch (JSONException e) {
            }
          }
        });
  }