@Test public void showDownloadProgressNullDownloaderListenerTest() throws Exception { whenNew(ReleaseDownloadListener.class).withArguments(any(Context.class), any(ReleaseDetails.class)).thenReturn(null); mockStatic(DistributeUtils.class); when(DistributeUtils.getStoredDownloadState()).thenReturn(DOWNLOAD_STATE_ENQUEUED); when(SharedPreferencesManager.getLong(eq(PREFERENCE_KEY_DOWNLOAD_TIME))).thenReturn(3L); when(DistributeUtils.loadCachedReleaseDetails()).thenReturn(mReleaseDetails); when(mReleaseDetails.isMandatoryUpdate()).thenReturn(true); resumeWorkflow(mock(Activity.class)); verify(mReleaseDownloaderListener, never()).showDownloadProgress(mActivity); }
private synchronized void showDownloadProgress() { if (mForegroundActivity == null) { AppCenterLog.warn(LOG_TAG, "Could not display progress dialog in the background."); return; } if (mReleaseDownloaderListener == null) { return; } Dialog progressDialog = mReleaseDownloaderListener.showDownloadProgress(mForegroundActivity); if (progressDialog != null) { showAndRememberDialogActivity(progressDialog); } }
Distribute extends AbstractAppCenterService { private synchronized void showDownloadProgress() { if (mForegroundActivity == null) { AppCenterLog.warn(LOG_TAG, "Could not display progress dialog in the background."); return; } if (mReleaseDownloaderListener == null) { return; } Dialog progressDialog = mReleaseDownloaderListener.showDownloadProgress(mForegroundActivity); if (progressDialog != null) { showAndRememberDialogActivity(progressDialog); } } }
Distribute extends AbstractAppCenterService { private synchronized void showDownloadProgress() { if (mForegroundActivity == null) { AppCenterLog.warn(LOG_TAG, "Could not display progress dialog in the background."); return; } if (mReleaseDownloaderListener == null) { return; } Dialog progressDialog = mReleaseDownloaderListener.showDownloadProgress(mForegroundActivity); if (progressDialog != null) { showAndRememberDialogActivity(progressDialog); } } private  Distribute(); }
Distribute extends AbstractAppCenterService { private synchronized void showDownloadProgress() { if (mForegroundActivity == null) { AppCenterLog.warn(LOG_TAG, "Could not display progress dialog in the background."); return; } if (mReleaseDownloaderListener == null) { return; } Dialog progressDialog = mReleaseDownloaderListener.showDownloadProgress(mForegroundActivity); if (progressDialog != null) { showAndRememberDialogActivity(progressDialog); } } private  Distribute(); static synchronized Distribute getInstance(); static AppCenterFuture<Boolean> isEnabled(); static AppCenterFuture<Void> setEnabled(boolean enabled); static void setInstallUrl(String installUrl); static void setApiUrl(String apiUrl); @SuppressWarnings("WeakerAccess") static int getUpdateTrack(); static void setUpdateTrack(@UpdateTrack int updateTrack); static void setListener(DistributeListener listener); static void setEnabledForDebuggableBuild(boolean enabled); static void notifyUpdateAction(@UpdateAction int updateAction); static void checkForUpdate(); static void disableAutomaticCheckForUpdate(); @Override String getServiceName(); @Override Map<String, LogFactory> getLogFactories(); @Override synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp); @Override synchronized void onActivityResumed(Activity activity); @Override synchronized void onActivityPaused(Activity activity); @Override void onApplicationEnterForeground(); }
Distribute extends AbstractAppCenterService { private synchronized void showDownloadProgress() { if (mForegroundActivity == null) { AppCenterLog.warn(LOG_TAG, "Could not display progress dialog in the background."); return; } if (mReleaseDownloaderListener == null) { return; } Dialog progressDialog = mReleaseDownloaderListener.showDownloadProgress(mForegroundActivity); if (progressDialog != null) { showAndRememberDialogActivity(progressDialog); } } private  Distribute(); static synchronized Distribute getInstance(); static AppCenterFuture<Boolean> isEnabled(); static AppCenterFuture<Void> setEnabled(boolean enabled); static void setInstallUrl(String installUrl); static void setApiUrl(String apiUrl); @SuppressWarnings("WeakerAccess") static int getUpdateTrack(); static void setUpdateTrack(@UpdateTrack int updateTrack); static void setListener(DistributeListener listener); static void setEnabledForDebuggableBuild(boolean enabled); static void notifyUpdateAction(@UpdateAction int updateAction); static void checkForUpdate(); static void disableAutomaticCheckForUpdate(); @Override String getServiceName(); @Override Map<String, LogFactory> getLogFactories(); @Override synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp); @Override synchronized void onActivityResumed(Activity activity); @Override synchronized void onActivityPaused(Activity activity); @Override void onApplicationEnterForeground();  }