Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions engine/src/java/com/runrev/android/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public class Engine extends View
private NativeControlModule m_native_control_module;
private SoundModule m_sound_module;
private NotificationModule m_notification_module;
/* private AdModule m_ad_module; */

private PowerManager.WakeLock m_wake_lock;

Expand Down Expand Up @@ -149,7 +148,6 @@ public void handleMessage(Message p_message) {
m_native_control_module = new NativeControlModule(this, ((LiveCodeActivity)getContext()).s_main_layout);
m_sound_module = new SoundModule(this);
m_notification_module = new NotificationModule(this);
/* m_ad_module = new AdModule(this, ((LiveCodeActivity)getContext()).s_main_layout); */

// MM-2012-08-03: [[ Bug 10316 ]] Initialise the wake lock object.
PowerManager t_power_manager = (PowerManager) p_context.getSystemService(p_context.POWER_SERVICE);
Expand Down Expand Up @@ -931,22 +929,24 @@ Object createInputControl()

////////////////////////////////////////////////////////////////////////////////

/*
// ad functionality
void addAd(Object p_control)
{
}
// IM-2013-04-17: [[ AdModule ]] attempt to load AdModule class, returning null if the class cannot be found
Object loadAdModule()
{
try
{
Class t_ad_module_class;
Constructor t_ad_module_constructor;

void removeAd(Object p_control)
{
m_ad_module.removeAd(p_control);
}
t_ad_module_class = Class.forName("com.runrev.android.AdModule");
t_ad_module_constructor = t_ad_module_class.getConstructor(new Class[] {Engine.class, ViewGroup.class});

Object createInneractiveAd(String p_key, int p_type, int p_left, int p_top, int p_timeout, Map p_meta_data)
{
return m_ad_module.createInneractiveAd(p_key, p_type, p_left, p_top, p_timeout, p_meta_data);
}
*/
return t_ad_module_constructor.newInstance(new Object[] {this, ((LiveCodeActivity)getContext()).s_main_layout});
}
catch (Exception e)
{
return null;
}
}

////////////////////////////////////////////////////////////////////////////////

Expand Down
3 changes: 3 additions & 0 deletions engine/src/mblad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
////////////////////////////////////////////////////////////////////////////////

bool MCParseParameters(MCParameter*& p_parameters, const char *p_format, ...);
void MCSystemInneractiveAdInit();
bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd*& r_ad, MCAdType p_type, MCAdTopLeft p_top_left, uint32_t p_timeout, MCVariableValue *p_meta_data);

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -59,6 +60,8 @@ void MCAdInitialize(void)
s_ads = nil;
s_last_ad_id = 0;
s_inneractive_ad_key = nil;

MCSystemInneractiveAdInit();
}

void MCAdFinalize(void)
Expand Down
35 changes: 33 additions & 2 deletions engine/src/mblandroidad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */

////////////////////////////////////////////////////////////////////////////////

static jobject s_admodule = nil;

////////////////////////////////////////////////////////////////////////////////

class MCAndroidInneractiveAd : public MCAd
{
public:
Expand Down Expand Up @@ -86,7 +90,7 @@ MCAndroidInneractiveAd::MCAndroidInneractiveAd(MCAdType p_type, MCAdTopLeft p_to

bool MCAndroidInneractiveAd::Create(void)
{
MCAndroidEngineRemoteCall("createInneractiveAd", "osiiiim", &m_view, MCAdGetInneractiveKey(), m_type, m_top_left.x, m_top_left.y, m_timeout, m_meta_data);
MCAndroidObjectRemoteCall(s_admodule, "createInneractiveAd", "osiiiim", &m_view, MCAdGetInneractiveKey(), m_type, m_top_left.x, m_top_left.y, m_timeout, m_meta_data);
if (m_meta_data != nil)
{
JNIEnv *env;
Expand All @@ -104,7 +108,7 @@ void MCAndroidInneractiveAd::Delete()

if (m_view != nil)
{
MCAndroidEngineRemoteCall("removeAd", "vo", nil, m_view);
MCAndroidObjectRemoteCall(s_admodule, "removeAd", "vo", nil, m_view);
env->DeleteGlobalRef(m_view);
m_view = nil;
}
Expand Down Expand Up @@ -167,8 +171,31 @@ bool MCAndroidInneractiveAd::FindByView(jobject p_view, MCAndroidInneractiveAd *

////////////////////////////////////////////////////////////////////////////////

void MCSystemInneractiveAdInit()
{
s_admodule = nil;
}

//////////

// IM-2013-04-17: [[ AdModule ]] call out to Engine method to load AdModule class
bool MCAndroidInneractiveAdInitModule()
{
if (s_admodule != nil)
return true;

MCAndroidEngineCall("loadAdModule", "o", &s_admodule);

return s_admodule != nil;
}

//////////

bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd *&r_ad, MCAdType p_type, MCAdTopLeft p_top_left, uint32_t p_timeout, MCVariableValue *p_meta_data)
{
if (!MCAndroidInneractiveAdInitModule())
return false;

bool t_success;
t_success = true;

Expand Down Expand Up @@ -234,6 +261,10 @@ JNIEXPORT void JNICALL Java_com_runrev_android_InneractiveAdWrapper_doAdUpdate(J

#else

void MCSystemInneractiveAdInit()
{
}

bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd *&r_ad, MCAdType p_type, MCAdTopLeft p_top_left, uint32_t p_timeout, MCVariableValue *p_meta_data)
{
return false;
Expand Down
8 changes: 8 additions & 0 deletions engine/src/mbliphonead.mm
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ static void do_display_ad(void *p_context)

////////////////////////////////////////////////////////////////////////////////

void MCSystemInneractiveAdInit()
{
}

bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd*& r_ad, MCAdType p_type, MCAdTopLeft p_top_left, uint32_t p_timeout, MCVariableValue *p_meta_data)
{
NSMutableDictionary *t_meta_data;
Expand Down Expand Up @@ -455,6 +459,10 @@ bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd*& r_ad, MCAdType p_ty

#else

void MCSystemInneractiveAdInit()
{
}

bool MCSystemInneractiveAdCreate(MCExecContext &ctxt, MCAd*& r_ad, MCAdType p_type, MCAdTopLeft p_top_left, uint32_t p_timeout, MCVariableValue *p_meta_data)
{
return false;
Expand Down