@Test public void doNotHideNullDialog() throws Exception { ReleaseDownloadListener releaseDownloadListener = new ReleaseDownloadListener(mContext, mockReleaseDetails(false)); releaseDownloadListener.hideProgressDialog(); verify(mProgressDialog, never()).hide(); verify(mHandler, never()).removeCallbacksAndMessages(any()); }
@SuppressWarnings({"deprecation", "RedundantSuppression"}) synchronized void hideProgressDialog() { if (mProgressDialog != null) { final android.app.ProgressDialog progressDialog = mProgressDialog; mProgressDialog = null; HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { progressDialog.hide(); } }); HandlerUtils.getMainHandler().removeCallbacksAndMessages(HANDLER_TOKEN_CHECK_PROGRESS); } }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @SuppressWarnings({"deprecation", "RedundantSuppression"}) synchronized void hideProgressDialog() { if (mProgressDialog != null) { final android.app.ProgressDialog progressDialog = mProgressDialog; mProgressDialog = null; HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { progressDialog.hide(); } }); HandlerUtils.getMainHandler().removeCallbacksAndMessages(HANDLER_TOKEN_CHECK_PROGRESS); } } }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @SuppressWarnings({"deprecation", "RedundantSuppression"}) synchronized void hideProgressDialog() { if (mProgressDialog != null) { final android.app.ProgressDialog progressDialog = mProgressDialog; mProgressDialog = null; HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { progressDialog.hide(); } }); HandlerUtils.getMainHandler().removeCallbacksAndMessages(HANDLER_TOKEN_CHECK_PROGRESS); } } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @SuppressWarnings({"deprecation", "RedundantSuppression"}) synchronized void hideProgressDialog() { if (mProgressDialog != null) { final android.app.ProgressDialog progressDialog = mProgressDialog; mProgressDialog = null; HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { progressDialog.hide(); } }); HandlerUtils.getMainHandler().removeCallbacksAndMessages(HANDLER_TOKEN_CHECK_PROGRESS); } } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); @WorkerThread @Override void onStart(long enqueueTime); @WorkerThread @Override synchronized boolean onProgress(final long currentSize, final long totalSize); @WorkerThread @Override boolean onComplete(@NonNull Uri localUri); @WorkerThread @Override void onError(@Nullable String errorMessage); }
ReleaseDownloadListener implements ReleaseDownloader.Listener { @SuppressWarnings({"deprecation", "RedundantSuppression"}) synchronized void hideProgressDialog() { if (mProgressDialog != null) { final android.app.ProgressDialog progressDialog = mProgressDialog; mProgressDialog = null; HandlerUtils.runOnUiThread(new Runnable() { @Override public void run() { progressDialog.hide(); } }); HandlerUtils.getMainHandler().removeCallbacksAndMessages(HANDLER_TOKEN_CHECK_PROGRESS); } } ReleaseDownloadListener(@NonNull Context context, @NonNull ReleaseDetails releaseDetails); @WorkerThread @Override void onStart(long enqueueTime); @WorkerThread @Override synchronized boolean onProgress(final long currentSize, final long totalSize); @WorkerThread @Override boolean onComplete(@NonNull Uri localUri); @WorkerThread @Override void onError(@Nullable String errorMessage);  }