Exemplo n.º 1
0
  @Override
  protected void jobFinished(Progress prog) {
    Log.d(TAG, "Finished download, going to main screen");
    if (SwordDocumentFacade.getInstance().getBibles().size() > 0) {
      gotoMainScreen();
    } else {

      Log.w(TAG, "Could not immediately find downloaded bible");
      // can't find downloaded bible, wait a sec and try again
      CommonUtils.pause(2);
      if (SwordDocumentFacade.getInstance().getBibles().size() > 0) {
        Log.d(TAG, "Downloaded bible found now");
        gotoMainScreen();
      } else {
        Log.e(TAG, "Downloaded bible not found");
        if (JobManager.getJobs().size() == 0) {
          // something went wrong with the download
          Dialogs.getInstance().showErrorMsg(R.string.download_complete_no_bibles);
        }
      }
    }
  }
Exemplo 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");
  }