Ejemplo n.º 1
0
  @Override
  public void onResume() {
    super.onResume();

    if ((progressBar.getVisibility() == View.VISIBLE) && !working && onPause) {
      dismissProgressBar();
      onPause = false;
    }
  }
Ejemplo n.º 2
0
    /** We update the UI */
    @Override
    protected void onProgressUpdate(Bean... bean) {

      if (context.progressBar.getVisibility() == View.VISIBLE) context.dismissProgressBar();

      if (context.progressbar_bottom.getVisibility() == View.VISIBLE)
        context.progressbar_bottom.setVisibility(View.GONE);

      context.musicAdapter.addItem(bean[0]);
    }
Ejemplo n.º 3
0
  /** It handles the result of the DownloadService service. It updates the UI. */
  @Override
  public void onReceiveResult(int resultCode, Bundle resultData) {
    switch (resultCode) {
      case 1:
        if (progressBar.isShown()) dismissProgressBar();

        MusicBean bean = resultData.getParcelable(DownloadService.MUSIC_BEAN);

        // update UI with the music
        musicAdapter.addItem(bean);
        break;

      case 2:
        showProgressBar();
        break;

      default:
        dismissProgressBar();
        Toast.makeText(context, "Search failed", Toast.LENGTH_LONG).show();
        break;
    }
  }
Ejemplo n.º 4
0
    @Override
    protected void onPostExecute(String result) {
      if (result != null) {
        super.onPostExecute(result);

        if (!searchSuccess) {
          context.dismissProgressBar();
          Toast.makeText(
                  context.getContext().getApplicationContext(),
                  "Sorry, no music with " + result + " was found!",
                  Toast.LENGTH_LONG)
              .show();
        }

        if (context.progressbar_bottom.getVisibility() == View.VISIBLE)
          context.progressbar_bottom.setVisibility(View.GONE);

        working = false;
        activity = null;
      }
    }