CDB4DContext* VRIAJSRuntimeContext::RetainDB4DContext(VRIAServerProject* inApplication)
{
	CDB4DContext* result = NULL;
	VRIAContext* riacontext = GetApplicationContext(inApplication);
	if (riacontext != NULL && riacontext->GetBaseContext() != NULL)
	{
		result = RetainRefCountable(riacontext->GetBaseContext()->GetContextOwner());
	}
	return result;
}
Example #2
0
FlingAnimator::FlingAnimator()
{
    // hold the global reference of the Java objects.
    JNIEnv* env = AttachCurrentThread();
    ASSERT(env);
    ScopedJavaLocalRef<jclass> cls(GetClass(env, "android/widget/OverScroller"));
    jmethodID constructor = GetMethodID(env, cls, "<init>", "(Landroid/content/Context;)V");
    ScopedJavaLocalRef<jobject> tmp(env, env->NewObject(cls.obj(), constructor, GetApplicationContext()));
    ASSERT(tmp.obj());
    m_javaScroller.Reset(tmp);

    m_flingMethodId = GetMethodID(env, cls, "fling", "(IIIIIIIIII)V");
    m_abortMethodId = GetMethodID(env, cls, "abortAnimation", "()V");
    m_computeMethodId = GetMethodID(env, cls, "computeScrollOffset", "()Z");
    m_getXMethodId = GetMethodID(env, cls, "getCurrX", "()I");
    m_getYMethodId = GetMethodID(env, cls, "getCurrY", "()I");
}
ECode NetInitiatedActivity::OnCreate(
    /* [in] */ IBundle* savedInstanceState)
{
    AlertActivity::OnCreate(savedInstanceState);

    // Set up the "dialog"
    AutoPtr<IIntent> intent;
    GetIntent((IIntent**)&intent);
    AutoPtr<CAlertControllerAlertParams> p = mAlertParams;
    AutoPtr<IContext> context;
    GetApplicationContext((IContext**)&context);
    p->SetIconId(0/*com.android.internal.R.drawable.ic_dialog_usb*/);
    String title;
    intent->GetStringExtra(IGpsNetInitiatedHandler::NI_INTENT_KEY_TITLE, &title);
    AutoPtr<ICharSequence> titleSequence;
    CString::New(title, (ICharSequence**)&titleSequence);
    p->SetTitle(titleSequence);
    String message;
    intent->GetStringExtra(IGpsNetInitiatedHandler::NI_INTENT_KEY_MESSAGE, &message);
    AutoPtr<ICharSequence> mSequence;
    CString::New(message, (ICharSequence**)&mSequence);
    p->SetMessage(mSequence);
//    p->mPositiveButtonText = String.format(context.getString(R.string.gpsVerifYes));
    p->SetPositiveButtonListener(this);
//    p->mNegativeButtonText = String.format(context.getString(R.string.gpsVerifNo));
    p->SetNegativeButtonListener(this);

    intent->GetInt32Extra(IGpsNetInitiatedHandler::NI_INTENT_KEY_NOTIF_ID, -1, &mNotificationId);
    intent->GetInt32Extra(IGpsNetInitiatedHandler::NI_INTENT_KEY_TIMEOUT,
                          mDefault_response_timeout,
                          &mTimeout);
    intent->GetInt32Extra(IGpsNetInitiatedHandler::NI_INTENT_KEY_DEFAULT_RESPONSE,
                          IGpsNetInitiatedHandler::GPS_NI_RESPONSE_ACCEPT,
                          &mDefault_response);
    if (DEBUG) Slogger::D(TAG, "onCreate() : notificationId: %d timeout: %d default_response:%d", mNotificationId, mTimeout, mDefault_response);

    Boolean result;
    mHandler->SendEmptyMessageDelayed(GPS_NO_RESPONSE_TIME_OUT, (mTimeout * 1000), &result);
    SetupAlert();
    return NOERROR;
}