forked from chen-fishbein/admobfullscreen-codenameone
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e1073e
commit 147ca9c
Showing
8 changed files
with
208 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/nbproject/private/ | ||
/build/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.codename1.admob; | ||
|
||
/** | ||
* | ||
* @author Chen | ||
*/ | ||
public interface AdsListener { | ||
|
||
/** | ||
* Called when the user is about to return to the application after clicking | ||
* on an ad. | ||
*/ | ||
public void onAdClosed(); | ||
|
||
/** | ||
* Called when an ad request failed. | ||
*/ | ||
public void onAdFailedToLoad(int errorCode); | ||
|
||
/** | ||
* Called when an ad leaves the application (e.g., to go to the browser). | ||
*/ | ||
public void onAdLeftApplication(); | ||
|
||
/** | ||
* Called when an ad is received. | ||
*/ | ||
public void onAdLoaded(); | ||
|
||
/** | ||
* Called when an ad opens an overlay that covers the screen. | ||
*/ | ||
public void onAdOpened(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.codename1.admob; | ||
|
||
import com.codename1.ui.Display; | ||
|
||
/** | ||
* | ||
* @author Chen | ||
*/ | ||
public class Callback { | ||
|
||
private static AdsListener l; | ||
|
||
public static void onAdClosed(){ | ||
if(l != null){ | ||
Display.getInstance().callSerially(new Runnable(){ | ||
|
||
public void run() { | ||
l.onAdClosed(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
public static void onAdLeftApplication(){ | ||
if(l != null){ | ||
Display.getInstance().callSerially(new Runnable(){ | ||
|
||
public void run() { | ||
l.onAdLeftApplication(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
public static void onAdOpened(){ | ||
if(l != null){ | ||
Display.getInstance().callSerially(new Runnable(){ | ||
|
||
public void run() { | ||
l.onAdOpened(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
public static void onAdFailedToLoad(final int err){ | ||
if(l != null){ | ||
Display.getInstance().callSerially(new Runnable(){ | ||
|
||
public void run() { | ||
l.onAdFailedToLoad(err); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
|
||
public static void onAdLoaded(){ | ||
if(l != null){ | ||
Display.getInstance().callSerially(new Runnable(){ | ||
|
||
public void run() { | ||
l.onAdLoaded(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
static void setListener(AdsListener listener){ | ||
l = listener; | ||
} | ||
|
||
} |