Esempio n. 1
0
 public virtual void finish()
 {
     if (mParent == null)
     {
         int    resultCode;
         Intent resultData;
         lock (this) {
             resultCode = mResultCode;
             resultData = mResultData;
         }
         if (resultData != null)
         {
             resultData.setAllowFds(false);
         }
         XobotActivityManager.FinishActivity(this, resultCode, resultData);
         mFinished = true;
     }
     else
     {
         mParent.finishFromChild(this);
     }
 }
Esempio n. 2
0
        /// <summary>Execute a startActivity call made by the application.</summary>
        /// <remarks>
        /// Execute a startActivity call made by the application.  The default
        /// implementation takes care of updating any active
        /// <see cref="ActivityMonitor">ActivityMonitor</see>
        /// objects and dispatches this call to the system activity manager; you can
        /// override this to watch for the application to start an activity, and
        /// modify what happens when it does.
        /// <p>This method returns an
        /// <see cref="ActivityResult">ActivityResult</see>
        /// object, which you can
        /// use when intercepting application calls to avoid performing the start
        /// activity action but still return the result the application is
        /// expecting.  To do this, override this method to catch the call to start
        /// activity so that it returns a new ActivityResult containing the results
        /// you would like the application to see, and don't call up to the super
        /// class.  Note that an application is only expecting a result if
        /// <var>requestCode</var> is &gt;= 0.
        /// <p>This method throws
        /// <see cref="android.content.ActivityNotFoundException">android.content.ActivityNotFoundException
        ///     </see>
        /// if there was no Activity found to run the given Intent.
        /// </remarks>
        /// <param name="who">The Context from which the activity is being started.</param>
        /// <param name="contextThread">
        /// The main thread of the Context from which the activity
        /// is being started.
        /// </param>
        /// <param name="token">
        /// Internal token identifying to the system who is starting
        /// the activity; may be null.
        /// </param>
        /// <param name="target">
        /// Which activity is performing the start (and thus receiving
        /// any result); may be null if this call is not being made
        /// from an activity.
        /// </param>
        /// <param name="intent">The actual Intent to start.</param>
        /// <param name="requestCode">
        /// Identifier for this request's result; less than zero
        /// if the caller is not expecting a result.
        /// </param>
        /// <returns>
        /// To force the return of a particular result, return an
        /// ActivityResult object containing the desired data; otherwise
        /// return null.  The default implementation always returns null.
        /// </returns>
        /// <exception cref="android.content.ActivityNotFoundException">android.content.ActivityNotFoundException
        ///     </exception>
        /// <seealso cref="Activity.startActivity(android.content.Intent)">Activity.startActivity(android.content.Intent)
        ///     </seealso>
        /// <seealso cref="Activity.startActivityForResult(android.content.Intent, int)">Activity.startActivityForResult(android.content.Intent, int)
        ///     </seealso>
        /// <seealso cref="Activity.startActivityFromChild(Activity, android.content.Intent, int)
        ///     "><hide></hide></seealso>
        public virtual ActivityResult execStartActivity(Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode)
        {
            IApplicationThread whoThread = (IApplicationThread)contextThread;

            if (mActivityMonitors != null)
            {
                lock (mSync) {
                    int N = mActivityMonitors.size();
                    {
                        for (int i = 0; i < N; i++)
                        {
                            ActivityMonitor am = mActivityMonitors.get(i);
                            if (am.match(who, null, intent))
                            {
                                am.mHits++;
                                if (am.isBlocking())
                                {
                                    return(requestCode >= 0 ? am.getResult() : null);
                                }
                                break;
                            }
                        }
                    }
                }
            }

            try {
                intent.setAllowFds(false);
                int result = XobotActivityManager.StartActivity(
                    whoThread, intent, intent.resolveTypeIfNeeded(who.getContentResolver()), target,
                    requestCode);
                checkStartActivityResult(result, intent);
            } catch (RemoteException) {
            }
            return(null);
        }
Esempio n. 3
0
 /// <summary>
 /// Enqueue a message into the message queue after all pending messages
 /// before the absolute time (in milliseconds) <var>uptimeMillis</var>.
 /// </summary>
 /// <remarks>
 /// Enqueue a message into the message queue after all pending messages
 /// before the absolute time (in milliseconds) <var>uptimeMillis</var>.
 /// <b>The time-base is
 /// <see cref="SystemClock.uptimeMillis()">SystemClock.uptimeMillis()</see>
 /// .</b>
 /// You will receive it in
 /// <see cref="handleMessage(Message)">handleMessage(Message)</see>
 /// , in the thread attached
 /// to this handler.
 /// </remarks>
 /// <param name="uptimeMillis">
 /// The absolute time at which the message should be
 /// delivered, using the
 /// <see cref="SystemClock.uptimeMillis()">SystemClock.uptimeMillis()</see>
 /// time-base.
 /// </param>
 /// <returns>
 /// Returns true if the message was successfully placed in to the
 /// message queue.  Returns false on failure, usually because the
 /// looper processing the message queue is exiting.  Note that a
 /// result of true does not mean the message will be processed -- if
 /// the looper is quit before the delivery time of the message
 /// occurs then the message will be dropped.
 /// </returns>
 public virtual bool sendMessageAtTime(Message msg, long uptimeMillis)
 {
     XobotActivityManager.SendMessage(this, msg, uptimeMillis);
     return(true);
 }
Esempio n. 4
0
 public static Window makeNewWindow(Context context)
 {
     return(XobotActivityManager.CreateMainWindow(context));
 }