istereo2

diff src/android/MainActivity.java @ 29:c6c45fa9658d

fixed jni calls for ads
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 08 Oct 2015 04:55:45 +0300
parents 74b50b538858
children 900651a2f401
line diff
     1.1 --- a/src/android/MainActivity.java	Mon Oct 05 17:16:31 2015 +0300
     1.2 +++ b/src/android/MainActivity.java	Thu Oct 08 04:55:45 2015 +0300
     1.3 @@ -173,7 +173,9 @@
     1.4  				});
     1.5  
     1.6  
     1.7 -				request_ad();
     1.8 +				if(!waiting_for_ad) {
     1.9 +					request_ad();
    1.10 +				}
    1.11  
    1.12  				Log.i(tag, "Done creating ad popup");
    1.13  			}
    1.14 @@ -210,11 +212,15 @@
    1.15  	private void show_ad()
    1.16  	{
    1.17  		Log.i(tag, "show_ad called");
    1.18 -		//ad_view.setVisibility(View.VISIBLE);
    1.19  
    1.20  		if(ad_ready) {
    1.21 +			if(ad_win == null) {
    1.22 +				create_ad_popup();
    1.23 +			}
    1.24 +			ad_view.setVisibility(View.VISIBLE);
    1.25  			ad_win.showAtLocation(ad_main_layout, Gravity.TOP, 0, 0);
    1.26  			ad_win.update();
    1.27 +			Log.i(tag, "showing ad window: " + ad_win);
    1.28  		} else {
    1.29  			if(!waiting_for_ad) {
    1.30  				request_ad();
    1.31 @@ -226,7 +232,11 @@
    1.32  	{
    1.33  		Log.i(tag, "hide_ad called");
    1.34  		//ad_view.setVisibility(View.GONE);
    1.35 +		Log.i(tag, "hiding ad window: " + ad_win);
    1.36  		ad_win.dismiss();
    1.37 +		ad_win.update();
    1.38 +		//ad_win.update();
    1.39 +		//destroy_ad_popup();
    1.40  		ad_ready = false;
    1.41  		waiting_for_ad = false;
    1.42  	}