コード例 #1
0
        private bool sendSapaSwitchBroadcast(string packageName, string instanceId)
        {
            Context context = Context;

            if (null == context)
            {
                Log.w(TAG, "Cannot send sapa switch broadcast (pkg: " + packageName + ", instance: " + instanceId + "): context is null");
                return(false);
            }

            Intent intent = new Intent(FcConstants.INTENT_SAPA_SWITCH);

            intent.putExtra(FcConstants.INTENT_SAPA_SWITCH_EXTRAS_INSTANCEID, instanceId);
            intent.putExtra(FcConstants.INTENT_SAPA_SWITCH_EXTRAS_PACKAGE, packageName);

            context.sendBroadcast(intent, FcConstants.PERMISSION_USE_CONNETION_SERVICE);

            return(true);
        }
コード例 #2
0
        public override void onMessageReceived(string from, Bundle bundle)
        {
            Log.d(TAG, "onMessageReceived " + from);

            if (IncomingCallMessage.isValidMessage(bundle))
            {
                /*
                 * Generate a unique notification id using the system time
                 */
                int notificationId = (int)DateTimeHelperClass.CurrentUnixTimeMillis();

                /*
                 * Create an IncomingCallMessage from the bundle
                 */
                IncomingCallMessage incomingCallMessage = new IncomingCallMessage(bundle);

                showNotification(incomingCallMessage, notificationId);
                sendIncomingCallMessageToActivity(incomingCallMessage, notificationId);
            }
        }
コード例 #3
0
 public override void onClick(View view)
 {
     outerInstance.mGoogleLoginClicked = true;
     if (!outerInstance.mGoogleApiClient.Connecting)
     {
         if (outerInstance.mGoogleConnectionResult != null)
         {
             outerInstance.resolveSignInError();
         }
         else if (outerInstance.mGoogleApiClient.Connected)
         {
             outerInstance.GoogleOAuthTokenAndLogin;
         }
         else
         {
             /* connect API now */
             Log.d(TAG, "Trying to connect to Google API");
             outerInstance.mGoogleApiClient.connect();
         }
     }
 }
コード例 #4
0
            public override void onServiceConnected(ComponentName className, IBinder binder)
            {
                Log.d(TAG, "onServiceConnected");
                outerInstance.mService = new WeakReference <MainService>(((MainService.LocalBinder)binder).getMainService(outerInstance));
                // Connection bridge is set to the FloatingController.
                // You can have only one AudioAppConnectionBridge in the application
                // so you need to pass it from service to FloatingController.
                if (outerInstance.mService != null && outerInstance.mService.get() != null && outerInstance.mFloatingController != null)
                {
                    try
                    {
                        outerInstance.mFloatingController.SapaAppService = outerInstance.mService.get().SapaAppService;
                    }
                    catch (System.NullReferenceException)
                    {
                        ;
                    }
                }

                outerInstance.setButtonsState();
            }
コード例 #5
0
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            Log.d(TAG, "onCreate");
            base.onCreate(savedInstanceState);

            this.mFloatingController = (FloatingController)findViewById(R.id.jam_control);

            this.mService = null;
            // binding to local service.
            this.bindService(new Intent(this, typeof(MainService)), this.mConnection, 0);

            Intent intent = Intent;

            if (intent != null)
            {
                this.readIntent(intent);
            }

            this.mVolDownButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);
            this.mVolUpButton.OnClickListener   = new OnClickListenerAnonymousInnerClassHelper2(this);
        }
コード例 #6
0
        private void moveThing(OfficeThing touchedThing, int xTouchLogical, int yTouchLogical)
        {
            //TODO: make sure these are accurate
            int newTop    = yTouchLogical - mRenderUtil.getModelHeight(touchedThing) / 2;
            int newLeft   = xTouchLogical - mRenderUtil.getModelWidth(touchedThing) / 2;
            int newBottom = yTouchLogical + mRenderUtil.getModelHeight(touchedThing) / 2;
            int newRight  = xTouchLogical + mRenderUtil.getModelWidth(touchedThing) / 2;

            if (newTop < 0 || newLeft < 0 || newBottom > LOGICAL_HEIGHT || newRight > LOGICAL_WIDTH)
            {
                Log.v(TAG, "Dragging beyond screen edge. Limiting");
            }
            // Limit moves to the boundaries of the screen
            if (newTop < 0)
            {
                newTop = 0;
            }
            if (newLeft < 0)
            {
                newLeft = 0;
            }
            if (newBottom > LOGICAL_HEIGHT)
            {
                newTop = LOGICAL_HEIGHT - mRenderUtil.getModelHeight(touchedThing);
            }
            if (newRight > LOGICAL_WIDTH)
            {
                newLeft = LOGICAL_WIDTH - mRenderUtil.getModelWidth(touchedThing);
            }

            // Save the object
            touchedThing.Top  = newTop;
            touchedThing.Left = newLeft;

            // Notify listeners
            if (null != this.mThingChangedListener)
            {
                mThingChangedListener.thingChanged(touchedThing.Key, touchedThing);
            }
        }
コード例 #7
0
        /// <summary>
        /// @brief TODO
        /// </summary>
        /// <param name="packageName"> </param>
        /// <param name="instanceId"> </param>
        /// <param name="mode"> </param>
        public virtual void openSapaAppActivity(string packageName, string instanceId, int mode)
        {
            if (mActiveApp == null || !mActiveApp.App.InstanceId.Equals(instanceId))
            {
                FcContextStateChanged listener = mListener.get();
                if (listener != null)
                {
                    listener.onActivityFinished();
                }
                Log.d(TAG, "Open Sapa app");
                if (!startSapaActivity(instanceId, mode))
                {
                    return;
                }
                if (!sendSapaSwitchBroadcast(packageName, instanceId))
                {
                    return;
                }

                finishCurrentActivity(packageName);
            }
        }
コード例 #8
0
            public override bool shouldOverrideUrlLoading(WebView view, string url)
            {
                Log.d(outerInstance.TAG, "Loading URL: " + url);
                string AIS_REDIRECT_TOKEN = Resources.getString([email protected]_redirect_token);
                string AIS_DOMAIN         = Resources.getString([email protected]_domain);
                string AIS_WEBVIEW_COOKIE = Resources.getString([email protected]_webview_cookie);

                // Once we've hit the final redirect URL to complete authentication,
                // harvest the cookie from this webview and pass it back to the main
                // activity.
                if (url.Contains(AIS_REDIRECT_TOKEN) && url.Contains("aisresponse"))
                {
                    string cookie = CookieManager.Instance.getCookie(AIS_DOMAIN);
                    Intent result = new Intent(outerInstance, typeof(MainActivity));
                    result.putExtra(AIS_WEBVIEW_COOKIE, cookie);
                    CookieSyncManager.Instance.sync();
                    setResult(RESULT_OK, result);
                    finish();
                    return(true);
                }
                return(false);
            }
コード例 #9
0
        /// <summary>
        /// @brief Finish current activity if the package name is matched
        /// </summary>
        /// <param name="packageName">   Package name of the activity to stop </param>
        private bool finishCurrentActivity(string packageName)
        {
            Context context = Context;

            if (null == context)
            {
                Log.w(TAG, "Cannot finish activity " + packageName + ": context is null");
                return(false);
            }

            if (!(context is Activity))
            {
                Log.w(TAG, "Cannot finish activity: " + packageName + ": context not an instance of Activity");
                return(false);
            }

            if (!context.PackageName.contentEquals(packageName))
            {
                ((Activity)context).finish();
            }
            return(true);
        }
コード例 #10
0
 protected internal override void onResume()
 {
     Log.d(TAG, "onResume");
     base.onResume();
     if (mService != null && mService.get() != null)
     {
         try
         {
             updateVolumeTextView(mService.get().getVolumeText(mVisibleAppInfo));
             if (mVisibleAppInfo != null)
             {
                 MainActivity.this.CurrentState = MainActivity.this.mVisibleAppInfo.App;
             }
         }
         catch (System.NullReferenceException)
         {
             ;
         }
     }
     else
     {
         updateVolumeTextView("Service, not ready");
     }
 }
コード例 #11
0
        /// <summary>
        /// Switches playback to local media player.
        /// </summary>
        public virtual void setLocalPlayer()
        {
            if (mControllerType is LocalPlayer)
            {
                // We are already local, do nothing
                return;
            }

            Log.d("MusicPlayerActivity", "setLocalPlayer");

            ControllerType previousControllerType = mControllerType;

            mControllerType = new LocalPlayer(this, mContentUri);
            restorePosition();

            // Releases previous player.
            if (previousControllerType != null)
            {
                previousControllerType.release();

                // Notify listener
                mEventListener.onRemoteDisconnected();
            }
        }
コード例 #12
0
            protected internal override string doInBackground(params Void[] @params)
            {
                string token = null;

                try
                {
                    string scope = string.Format("oauth2:{0}", Scopes.PLUS_LOGIN);
                    token = GoogleAuthUtil.getToken(outerInstance, Plus.AccountApi.getAccountName(outerInstance.mGoogleApiClient), scope);
                }
                catch (IOException transientEx)
                {
                    /* Network or server error */
                    Log.e(TAG, "Error authenticating with Google: " + transientEx);
                    errorMessage = "Network error: " + transientEx.Message;
                }
                catch (UserRecoverableAuthException e)
                {
                    Log.w(TAG, "Recoverable Google OAuth error: " + e.ToString());
                    /* We probably need to ask for permissions, so start the intent if there is none pending */
                    if (!outerInstance.mGoogleIntentInProgress)
                    {
                        outerInstance.mGoogleIntentInProgress = true;
                        Intent recover = e.Intent;
                        startActivityForResult(recover, MainActivity.RC_GOOGLE_LOGIN);
                    }
                }
                catch (GoogleAuthException authEx)
                {
                    /* The call is not ever expected to succeed assuming you have already verified that
                     * Google Play services is installed. */
                    Log.e(TAG, "Error authenticating with Google: " + authEx.Message, authEx);
                    errorMessage = "Error authenticating with Google: " + authEx.Message;
                }

                return(token);
            }
コード例 #13
0
            public override void onClick(View arg0)
            {
                playClickAnim(arg0);
                switch (arg0.Id)
                {
                case R.id.img01:
                    Log.i(TAG, "clicked iamge icon 01.");
                    outerInstance.mainText.Text = "Selected pencil icon.";
                    break;

                case R.id.img02:
                    Log.i(TAG, "clicked iamge icon 02.");
                    outerInstance.mainText.Text = "Selected pen icon.";
                    break;

                case R.id.img03:
                    Log.i(TAG, "clicked iamge icon 03.");
                    outerInstance.mainText.Text = "Selected high lighter icon.";
                    break;

                case R.id.img04:
                    Log.i(TAG, "clicked iamge icon 04.");
                    outerInstance.mainText.Text = "Selected calligraphy brush icon.";
                    break;

                case R.id.img05:
                    Log.i(TAG, "clicked iamge icon 05.");
                    outerInstance.mainText.Text = "Selected brush icon.";
                    break;

                case R.id.img06:
                    Log.i(TAG, "clicked iamge icon 06.");
                    outerInstance.mainText.Text = "Selected marker icon.";
                    break;
                }
            }
コード例 #14
0
        /// <summary>
        /// Switches playback to remote AllShare device.
        /// </summary>
        /// <param name="deviceId"> the unique identifier of device </param>
        /// <param name="devicetype"> the device type </param>
        public virtual void setRemotePlayer(string deviceId, int devicetype)
        {
            // Release previous player
            if (mControllerType != null)
            {
                mControllerType.release();
            }

            Log.d("MediaPlayer", "setRemotePlayer");

            ControllerType previousControllerType = mControllerType;

            // Connect to remote player
            mControllerType = new RemotePlayer(this, mContentUri, mMimeType, deviceId, devicetype);

            // Restore current state and position
            restorePosition();

            // Releases previous player.
            if (previousControllerType != null)
            {
                previousControllerType.release();
            }
        }
コード例 #15
0
 public override void onPageStarted(WebView view, string url, Bitmap favicon)
 {
     Log.d(outerInstance.TAG, "Page started: " + url);
     base.onPageStarted(view, url, favicon);
 }
コード例 #16
0
 public override void onReceivedError(WebView view, int errorCode, string description, string failingUrl)
 {
     Log.d(outerInstance.TAG, description);
     Log.d(outerInstance.TAG, failingUrl);
     base.onReceivedError(view, errorCode, description, failingUrl);
 }
コード例 #17
0
 public override void onError(string error)
 {
     Log.e(TAG, error);
 }
コード例 #18
0
 public override void onServiceDisconnected(ComponentName name)
 {
     Log.d(TAG, "onServiceDisconnected");
     outerInstance.mService = null;
 }
コード例 #19
0
 public override void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
 {
     Log.d(outerInstance.TAG, "Ignoring SSL certificate error.");
     handler.proceed();
 }
コード例 #20
0
 public virtual void zoomReset()
 {
     Log.i("Zoom", "Reset");
 }
コード例 #21
0
 public override void onConnected(Bundle bundle)
 {
     /* Connected with Google API, use this to authenticate with Firebase */
     Log.i(TAG, "Login Connected");
     GoogleOAuthTokenAndLogin;
 }
コード例 #22
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public boolean onTouchEvent(final android.view.MotionEvent event)
        public override bool onTouchEvent(MotionEvent @event)
        {
            bool handled = false;

            OfficeThing touchedThing;
            int         xTouchLogical;
            int         yTouchLogical;
            int         pointerId;
            int         actionIndex = @event.ActionIndex;

            // get touch event coordinates and make transparent wrapper from it
            switch (@event.ActionMasked)
            {
            case MotionEvent.ACTION_DOWN:
                // first pointer, clear the pointer
                mSelectedThing = null;

                xTouchLogical = screenToModel((int)@event.getX(0));
                yTouchLogical = screenToModel((int)@event.getY(0));

                // check if we've touched inside something
                touchedThing = getTouchedThing(xTouchLogical, yTouchLogical);

                if (touchedThing == null)
                {
                    mSelectedThingChangeListener.thingChanged(null);
                    break;
                }

                mSelectedThing = touchedThing;

                if (null != mSelectedThingChangeListener)
                {
                    mSelectedThingChangeListener.thingChanged(touchedThing);
                }
                touchedThing.setzIndex(mOfficeLayout.HighestzIndex + 1);

                Log.v(TAG, "Selected " + touchedThing);
                handled = true;
                break;


            case MotionEvent.ACTION_MOVE:

                pointerId = @event.getPointerId(actionIndex);
                if (pointerId > 0)
                {
                    break;
                }

                xTouchLogical = screenToModel((int)@event.getX(actionIndex));
                yTouchLogical = screenToModel((int)@event.getY(actionIndex));

                touchedThing = mSelectedThing;

                if (null == touchedThing)
                {
                    break;
                }

                moveThing(touchedThing, xTouchLogical, yTouchLogical);

                handled = true;
                break;

            case MotionEvent.ACTION_UP:
                mSelectedThing = null;
                invalidate();
                handled = true;
                break;

            case MotionEvent.ACTION_CANCEL:
                handled = true;
                break;
            }

            return(base.onTouchEvent(@event) || handled);
        }
コード例 #23
0
 public override void onConnectionSuspended(int i)
 {
     Log.i(TAG, "Login Suspended");
     // ignore
 }
コード例 #24
0
 public override void onNewIntent(Intent intent)
 {
     Log.d(TAG, "onNewIntent");
     this.readIntent(intent);
 }
コード例 #25
0
 public override void onPageFinished(WebView view, string url)
 {
     Log.d(outerInstance.TAG, "Page loaded: " + url);
     base.onPageFinished(view, url);
 }
コード例 #26
0
 public virtual void panApplied()
 {
     Log.i("Pan", "New X range=[" + outerInstance.mRenderer.XAxisMin + ", " + outerInstance.mRenderer.XAxisMax + "], Y range=[" + outerInstance.mRenderer.YAxisMax + ", " + outerInstance.mRenderer.YAxisMax + "]");
 }
コード例 #27
0
 public virtual void onError(string error)
 {
     Log.e(outerInstance.TAG, error);
 }
コード例 #28
0
 public override void onError(string s)
 {
     Log.e(outerInstance.TAG, "Could not load video: " + s);
 }
コード例 #29
0
 public override void onClientStopped(SinchClient client)
 {
     Log.d(TAG, "SinchClient stopped");
 }
コード例 #30
0
 protected internal override void onDestroy()
 {
     Log.d(TAG, "onDestroy");
     unbindService(mConnection);
     base.onDestroy();
 }