Example #1
0
Exec_stat MCAndroidPlayerControl::Do(MCNativeControlAction p_action, MCParameter *p_parameters)
{
    jobject t_view;
    t_view = GetView();
    
    switch (p_action)
    {
        case kMCNativeControlActionPlay:
            MCAndroidObjectRemoteCall(t_view, "start", "v", nil);
            return ES_NORMAL;
            
        case kMCNativeControlActionPause:
            MCAndroidObjectRemoteCall(t_view, "pause", "v", nil);
            return ES_NORMAL;
            
        case kMCNativeControlActionStop:
            MCAndroidObjectRemoteCall(t_view, "stop", "v", nil);
            return ES_NORMAL;
            
        default:
            break;
    }
    
    return MCAndroidControl::Do(p_action, p_parameters);
}
Example #2
0
MCAdTopLeft MCAndroidInneractiveAd::GetTopLeft()
{   
    MCAdTopLeft t_top_left = {0,0};
    MCAndroidObjectRemoteCall(m_view, "getLeft", "i", &t_top_left.x);
    MCAndroidObjectRemoteCall(m_view, "getTop", "i", &t_top_left.y);
    
    // MM-2013-09-30: [[ Bug 11227 ]] Make sure we take into account device scale when positioning ads.
    MCGFloat t_device_scale;
    t_device_scale = MCResGetPixelScale();
    t_top_left . x = (uint32_t) t_top_left . x / t_device_scale;
    t_top_left . y = (uint32_t) t_top_left . y / t_device_scale;

    return t_top_left;     
}
Example #3
0
bool MCAndroidInneractiveAd::GetVisible(void)
{    
    bool t_visible;
    t_visible = false;
    MCAndroidObjectRemoteCall(m_view, "getVisible", "b", &t_visible);
    return t_visible;
}
Example #4
0
bool MCScrollViewIsDragging(jobject p_view, bool &r_dragging)
{
    if (p_view == nil)
        return false;
    
    MCAndroidObjectRemoteCall(p_view, "isDragging", "b", &r_dragging);
    return true;
}
Example #5
0
bool MCScrollViewSetScrollingEnabled(jobject p_view, bool p_enabled)
{
    if (p_view == nil)
        return false;
    
    MCAndroidObjectRemoteCall(p_view, "setScrollingEnabled", "vb", nil, p_enabled);
    return true;
}
Example #6
0
bool MCScrollViewGetScrollingEnabled(jobject p_view, bool &r_enabled)
{
    if (p_view == nil)
        return false;
    
    MCAndroidObjectRemoteCall(p_view, "getScrollingEnabled", "b", &r_enabled);
    return true;
}
Example #7
0
bool MCScrollViewSetVerticalIndicator(jobject p_view, bool p_show_indicator)
{
    if (p_view == nil)
        return false;
    
    MCAndroidObjectRemoteCall(p_view, "setVerticalIndicator", "vb", nil, p_show_indicator);
    return true;
}
Example #8
0
void MCAndroidScrollerControl::GetDragging(MCExecContext& ctxt, bool& r_value)
{
    jobject t_view;
    t_view = GetView();
    
    if (t_view)
        MCAndroidObjectRemoteCall(t_view, "isDragging", "b", &r_value);
}
Example #9
0
void MCAndroidScrollerControl::SetShowVerticalIndicator(MCExecContext& ctxt, bool p_value)
{
    jobject t_view;
    t_view = GetView();
    
    if (t_view)
        MCAndroidObjectRemoteCall(t_view, "setVerticalIndicator", "vb", nil, p_value);
}
Example #10
0
void MCAndroidScrollerControl::GetScrollingEnabled(MCExecContext& ctxt, bool& r_value)
{
    jobject t_view;
    t_view = GetView();
    
    if (t_view)
        MCAndroidObjectRemoteCall(t_view, "getScrollingEnabled", "b", &r_value);
}
Example #11
0
void MCAndroidScrollerControl::SetScrollingEnabled(MCExecContext& ctxt, bool p_value)
{
    jobject t_view;
    t_view = GetView();
    
    if (t_view)
        MCAndroidObjectRemoteCall(t_view, "setScrollingEnabled", "vb", nil, p_value);
}
Example #12
0
bool MCScrollViewGetVerticalIndicator(jobject p_view, bool &r_show_indicator)
{
    if (p_view == nil)
        return false;
    
    MCAndroidObjectRemoteCall(p_view, "getVerticalIndicator", "b", &r_show_indicator);
    return true;
}
Example #13
0
void MCAndroidScrollerControl::GetShowVerticalIndicator(MCExecContext& ctxt, bool& r_value)
{
    jobject t_view;
    t_view = GetView();
    
    if (t_view)
        MCAndroidObjectRemoteCall(t_view, "getVerticalIndicator", "b", &r_value);
    else
        r_value = false;
}
Example #14
0
void MCAndroidInneractiveAd::SetTopLeft(MCAdTopLeft p_top_left)
{
    // MM-2013-09-30: [[ Bug 11227 ]] Make sure we take into account device scale when positioning ads.
    MCGFloat t_device_scale;
    t_device_scale = MCResGetPixelScale();
    p_top_left . x = (uint32_t) p_top_left . x * t_device_scale;
    p_top_left . y = (uint32_t) p_top_left . y * t_device_scale;
    
    MCAndroidObjectRemoteCall(m_view, "setTopLeft", "vii", nil, p_top_left.x, p_top_left.y);
}
Example #15
0
bool MCScrollViewSetVScroll(jobject p_view, int32_t p_vscroll)
{
    if (p_view == nil)
        return false;
    
    // MM-2013-11-26: [[ Bug 11485 ]] The native control expects the scroll in device pixels, but the user expects in user pixels, so convert.
    int32_t t_vscroll;
    t_vscroll = MCNativeControlUserYLocToDeviceYLoc(p_vscroll);
    MCAndroidObjectRemoteCall(p_view, "setVScroll", "vi", nil, t_vscroll);
    return true;
}
Example #16
0
bool MCScrollViewGetVScroll(jobject p_view, int32_t &r_vscroll)
{
    if (p_view == nil)
		return false;

    // MM-2013-11-26: [[ Bug 11485 ]] The native control stores the scroll in device pixels, but the user expects in user pixels, so convert.
    int32_t t_vscroll;
    MCAndroidObjectRemoteCall(p_view, "getVScroll", "i", &t_vscroll);
    r_vscroll = MCNativeControlUserYLocFromDeviceYLoc(t_vscroll);
	return true;
}
Example #17
0
bool MCAndroidInneractiveAd::Create(void)
{
	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;
        env = MCJavaGetThreadEnv();        
        MCJavaFreeMap(env, m_meta_data);
        m_meta_data = nil;
    }
    return (m_view != nil);
}
Example #18
0
Exec_stat MCAndroidPlayerControl::Get(MCNativeControlProperty p_property, MCExecPoint &ep)
{
    bool t_bool = false;
    int32_t t_integer;
    
    jobject t_view;
    t_view = GetView();
    
    switch (p_property)
    {
        case kMCNativeControlPropertyContent:
        {
            ep.setsvalue(m_path);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyShowController:
        {
            MCAndroidObjectRemoteCall(t_view, "getShowController", "b", &t_bool);
            FormatBoolean(ep, t_bool);
            return ES_NORMAL;
        }
        
        case kMCNativeControlPropertyLooping:
        {
            MCAndroidObjectRemoteCall(t_view, "getLooping", "b", &t_bool);
            FormatBoolean(ep, t_bool);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyDuration:
        {
            MCAndroidObjectRemoteCall(t_view, "getDuration", "i", &t_integer);
            FormatInteger(ep, t_integer);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyCurrentTime:
        {
            MCAndroidObjectRemoteCall(t_view, "getCurrentTime", "i", &t_integer);
            FormatInteger(ep, t_integer);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyNaturalSize:
        {
            int32_t t_width = 0, t_height = 0;
            MCAndroidObjectRemoteCall(t_view, "getVideoWidth", "i", &t_width);
            MCAndroidObjectRemoteCall(t_view, "getVideoHeight", "i", &t_height);
            sprintf(ep.getbuffer(I2L * 2 + 3), "%d,%d", t_width, t_height);
            ep.setstrlen();
            return ES_NORMAL;
        }
            
        default:
            break;
    }
    
    return MCAndroidControl::Get(p_property, ep);
}
Example #19
0
void MCAndroidInneractiveAd::Delete()
{
    JNIEnv *env;
    env = MCJavaGetThreadEnv();    

    if (m_view != nil)
    {
		MCAndroidObjectRemoteCall(s_admodule, "removeAd", "vo", nil, m_view);
        env->DeleteGlobalRef(m_view);        
        m_view = nil;
    }
    
    if (m_meta_data != nil)
    {
        MCJavaFreeMap(env, m_meta_data);
        m_meta_data = nil;
    }
}
Example #20
0
void MCAndroidScrollerControl::SetContentRect(MCExecContext& ctxt, integer_t p_rect[4])
{
    jobject t_view;
    t_view = GetView();
	
    // SN-2014-11-27: [[ Bug 14046 ]] m_content_rect stores user-pixel values
    m_content_rect . x = p_rect[0];
    m_content_rect . y = p_rect[1];
    m_content_rect . width = p_rect[2] - p_rect[0];
    m_content_rect . height = p_rect[3] - p_rect[1];
    
	// PM-2016-01-14: [[Bug 16705]] Pass the correct width and height
    if (t_view != nil)
	{
		// SN-2014-11-27: [[ Bug 14046 ]] Apply the fix for the bug 11485.
		MCGRectangle t_rect;
		t_rect = MCNativeControlUserRectToDeviceRect(MCGRectangleMake(p_rect[0], p_rect[1], p_rect[2], p_rect[3]));
        MCAndroidObjectRemoteCall(t_view, "setContentSize", "vii", nil, (integer_t)(t_rect.size.width), (integer_t)(t_rect.size.height));
	}
}
Example #21
0
Exec_stat MCAndroidPlayerControl::Set(MCNativeControlProperty p_property, MCExecPoint &ep)
{
    bool t_bool = false;
    int32_t t_integer;
    
    jobject t_view;
    t_view = GetView();
    
    switch (p_property)
    {
        case kMCNativeControlPropertyContent:
        {
            bool t_success = true;
            MCCStringFree(m_path);
            t_success = MCCStringClone(ep.getcstring(), m_path);
            if (MCCStringBeginsWith(m_path, "http://") || MCCStringBeginsWith(m_path, "https://"))
            {
                MCAndroidObjectRemoteCall(t_view, "setUrl", "bs", &t_success, m_path);
            }
            else
            {
                char *t_resolved_path = nil;
                bool t_is_asset = false;
                const char *t_asset_path = nil;
                
                t_resolved_path = MCS_resolvepath(m_path);
                t_is_asset = path_to_apk_path(t_resolved_path, t_asset_path);
                
                MCAndroidObjectRemoteCall(t_view, "setFile", "bsb", &t_success, t_is_asset ? t_asset_path : t_resolved_path, t_is_asset);
                
                MCCStringFree(t_resolved_path);
            }
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyShowController:
        {
            if (!ParseBoolean(ep, t_bool))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setShowController", "vb", nil, t_bool);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyCurrentTime:
        {
            if (!ParseInteger(ep, t_integer))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setCurrentTime", "vi", nil, t_integer);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyLooping:
        {
            if (!ParseBoolean(ep, t_bool))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setLooping", "vb", nil, t_bool);
            return ES_NORMAL;
        }
            
        default:
            break;
    }
    
    return MCAndroidControl::Set(p_property, ep);
}
Example #22
0
void MCAndroidInneractiveAd::SetVisible(bool p_visible)
{
    MCAndroidObjectRemoteCall(m_view, "setVisible", "vb", nil, p_visible);
}