Ejemplo n.º 1
0
 private String decorateSearchString(String searchString) {
   return searchControl.decorateSearchString(searchString, getSearchType(), getBibleSection());
 }
Ejemplo n.º 2
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, true);
    Log.i(TAG, "Displaying Search view");
    setContentView(R.layout.search);

    if (!searchControl.validateIndex(getDocumentToSearch())) {
      Dialogs.getInstance()
          .showErrorMsg(
              R.string.error_occurred,
              new Callback() {
                @Override
                public void okay() {
                  finish();
                }
              });
    }

    mSearchTextInput = (EditText) findViewById(R.id.searchText);
    mSearchTextInput.setOnKeyListener(
        new OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            // If the event is a key-down event on the "enter" button
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && (keyCode == KeyEvent.KEYCODE_ENTER)) {
              // Perform action on key press
              onSearch(null);
              return true;
            }
            return false;
          }
        });

    // pre-load search string if passed in
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      String searchText = extras.getString(SearchControl.SEARCH_TEXT);
      if (StringUtils.isNotEmpty(searchText)) {
        mSearchTextInput.setText(searchText);
      }
    }

    RadioGroup wordsRadioGroup = (RadioGroup) findViewById(R.id.wordsGroup);
    wordsRadioGroup.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            wordsRadioSelection = checkedId;
          }
        });

    RadioGroup sectionRadioGroup = (RadioGroup) findViewById(R.id.bibleSectionGroup);
    sectionRadioGroup.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            sectionRadioSelection = checkedId;
          }
        });

    // set text for current bible book on appropriate radio button
    RadioButton currentBookRadioButton = (RadioButton) findViewById(R.id.searchCurrentBook);
    currentBookRadioButton.setText(searchControl.getCurrentBookDescription());

    Log.d(TAG, "Finished displaying Search view");
  }
 @Override
 protected boolean canShow() {
   return searchControl.currentDocumentContainsNonScripture();
 }