()
| 250 | } |
| 251 | } |
| 252 | @Override |
| 253 | public void onResume() { |
| 254 | // Start or resume the game. |
| 255 | super.onResume(); |
| 256 | if (mInterstitialAd == null) { |
| 257 | loadAd(); |
| 258 | } |
| 259 | shouldShowAds = sharedPreferences.getBoolean("ShouldShowAds", false); |
| 260 | if(shouldShowAds){ |
| 261 | if(showOpenAdsNow){ |
| 262 | appOpenAdManager.showAdIfAvailable(MainUI.this, new AppOpenAdManager.OnShowAdCompleteListener() { |
| 263 | @Override |
| 264 | public void onShowAdComplete() { |
| 265 | // Empty because the user will go back to the activity that shows the ad. |
| 266 | lockOpenAds = false; |
| 267 | showOpenAdsNow = false; |
| 268 | i = -1; |
| 269 | } |
| 270 | }); |
| 271 | } |
| 272 | if(lockOpenAds){ |
| 273 | showOpenAdsNow = true; |
| 274 | }else{ |
| 275 | if(!isDialogShowing){ |
| 276 | new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { |
| 277 | @Override |
| 278 | public void run() { |
| 279 | appOpenAdManager.showAdIfAvailable(MainUI.this, new AppOpenAdManager.OnShowAdCompleteListener() { |
| 280 | @Override |
| 281 | public void onShowAdComplete() { |
| 282 | // Empty because the user will go back to the activity that shows the ad. |
| 283 | showOpenAdsNow = false; |
| 284 | i = -1; |
| 285 | } |
| 286 | }); |
| 287 | } |
| 288 | }, 4500); |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | if(rewardedAd == null){ |
| 293 | loadRewardedAd(); |
| 294 | } |
| 295 | } |
| 296 | @Override |
| 297 | public boolean onKeyDown(int keyCode, KeyEvent event){ |
| 298 |
nothing calls this directly
no test coverage detected