コード例 #1
0
    @Override
    protected void onPostExecute(Boolean result) {
      if (dialogShow) progDialog.cancel();
      if (result) {
        Toast.makeText(RssReaderActivity.this, R.string.rss_items_update_done, Toast.LENGTH_SHORT)
            .show();
        rssFeed = dbQuery.getRssFeed(name, limit);
        updateListView();
      } else
        Toast.makeText(RssReaderActivity.this, R.string.rss_item_not_update, Toast.LENGTH_SHORT)
            .show();

      dbQuery.updateRssItems();
      isTaskRunning = false;
    }
コード例 #2
0
    @Override
    protected void onPreExecute() {
      if (dialogShow) {
        progDialog = new ProgressDialog(RssReaderActivity.this);
        progDialog.setCancelable(false);
        progDialog.setMessage(getString(R.string.rss_fetching));
        progDialog.setButton(
            DialogInterface.BUTTON_NEGATIVE,
            getString(R.string.btn_hide_text),
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                Toast.makeText(
                        RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
                    .show();
              }
            });
        progDialog.show();
      } else
        Toast.makeText(RssReaderActivity.this, R.string.rss_start_updating, Toast.LENGTH_SHORT)
            .show();

      isTaskRunning = true;
    }
コード例 #3
0
  private void loadData(String providerName, boolean limit, boolean dialogShow, boolean update) {
    int maxItemLoad = limit ? dbQuery.getRssSettings()[1] : 0;
    rssFeed = dbQuery.getRssFeed(providerName, maxItemLoad);

    if (providerName == null) curProvider = -1;
    updateListView();

    if (isTaskRunning)
      Toast.makeText(RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT).show();
    else if (update) new RssDownloadTask(providerName, maxItemLoad, dialogShow).execute();
  }
コード例 #4
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.mnu_exit:
        if (!isTaskRunning) finish();
        else
          Toast.makeText(RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
              .show();
        break;
      case R.id.mnu_about:
        break;
      default:
        break;
    }
    return true;
  }