Ejemplo n.º 1
0
 public virtual void onClick(android.view.View view)
 {
     if (view == this._enclosing.mDefaultActivityButton)
     {
         this._enclosing.dismissPopup();
         android.content.pm.ResolveInfo defaultActivity = this._enclosing.mAdapter.getDefaultActivity
                                                              ();
         int index = this._enclosing.mAdapter.getDataModel().getActivityIndex(defaultActivity
                                                                              );
         android.content.Intent launchIntent = this._enclosing.mAdapter.getDataModel().chooseActivity
                                                   (index);
         if (launchIntent != null)
         {
             this._enclosing.mContext.startActivity(launchIntent);
         }
     }
     else
     {
         if (view == this._enclosing.mExpandActivityOverflowButton)
         {
             this._enclosing.mIsSelectingDefaultActivity = false;
             this._enclosing.showPopupUnchecked(this._enclosing.mInitialActivityCount);
         }
         else
         {
             throw new System.ArgumentException();
         }
     }
 }
Ejemplo n.º 2
0
        public virtual int addIntentOptions(int groupId, int itemId, int order, android.content.ComponentName
                                            caller, android.content.Intent[] specifics, android.content.Intent intent, int
                                            flags, android.view.MenuItem[] outSpecificItems)
        {
            android.content.pm.PackageManager pm = mContext.getPackageManager();
            java.util.List <android.content.pm.ResolveInfo> lri = pm.queryIntentActivityOptions
                                                                      (caller, specifics, intent, 0);
            int N = lri != null?lri.size() : 0;

            if ((flags & android.view.MenuClass.FLAG_APPEND_TO_GROUP) == 0)
            {
                removeGroup(groupId);
            }
            {
                for (int i = 0; i < N; i++)
                {
                    android.content.pm.ResolveInfo ri      = lri.get(i);
                    android.content.Intent         rintent = new android.content.Intent(ri.specificIndex < 0 ?
                                                                                        intent : specifics[ri.specificIndex]);
                    rintent.setComponent(new android.content.ComponentName(ri.activityInfo.applicationInfo
                                                                           .packageName, ri.activityInfo.name));
                    android.view.MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm)).setIcon
                                                     (ri.loadIcon(pm)).setIntent(rintent);
                    if (outSpecificItems != null && ri.specificIndex >= 0)
                    {
                        outSpecificItems[ri.specificIndex] = item;
                    }
                }
            }
            return(N);
        }
Ejemplo n.º 3
0
            public override android.view.View getView(int position, android.view.View convertView
                                                      , android.view.ViewGroup parent)
            {
                int itemViewType = this.getItemViewType(position);

                switch (itemViewType)
                {
                case ITEM_VIEW_TYPE_FOOTER:
                {
                    if (convertView == null || convertView.getId() != ITEM_VIEW_TYPE_FOOTER)
                    {
                        convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
                                          ([email protected]_chooser_view_list_item, parent, false);
                        convertView.setId(ITEM_VIEW_TYPE_FOOTER);
                        android.widget.TextView titleView = (android.widget.TextView)convertView.findViewById
                                                                ([email protected]);
                        titleView.setText(java.lang.CharSequenceProxy.Wrap(this._enclosing.mContext.getString
                                                                               ([email protected][email protected]_chooser_view_see_all)));
                    }
                    return(convertView);
                }

                case ITEM_VIEW_TYPE_ACTIVITY:
                {
                    if (convertView == null || convertView.getId() != [email protected]_item)
                    {
                        convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
                                          ([email protected]_chooser_view_list_item, parent, false);
                    }
                    android.content.pm.PackageManager packageManager = this._enclosing.mContext.getPackageManager
                                                                           ();
                    // Set the icon
                    android.widget.ImageView iconView = (android.widget.ImageView)convertView.findViewById
                                                            ([email protected]);
                    android.content.pm.ResolveInfo activity = (android.content.pm.ResolveInfo) this.getItem
                                                                  (position);
                    iconView.setImageDrawable(activity.loadIcon(packageManager));
                    // Set the title.
                    android.widget.TextView titleView_1 = (android.widget.TextView)convertView.findViewById
                                                              ([email protected]);
                    titleView_1.setText(activity.loadLabel(packageManager));
                    // Highlight the default.
                    if (this.mShowDefaultActivity && position == 0 && this.mHighlightDefaultActivity)
                    {
                        convertView.setActivated(true);
                    }
                    else
                    {
                        convertView.setActivated(false);
                    }
                    return(convertView);
                }

                default:
                {
                    throw new System.ArgumentException();
                }
                }
            }
Ejemplo n.º 4
0
 public virtual int compare(android.content.pm.ResolveInfo arg0, android.content.pm.ResolveInfo arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallIntMethod(this.JvmHandle, global::android.content.pm.ResolveInfo.DisplayNameComparator._compare2156, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)));
     }
     else
     {
         return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::android.content.pm.ResolveInfo.DisplayNameComparator.staticClass, global::android.content.pm.ResolveInfo.DisplayNameComparator._compare2156, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)));
     }
 }
Ejemplo n.º 5
0
        /// <summary>Updates the buttons state.</summary>
        /// <remarks>Updates the buttons state.</remarks>
        private void updateAppearance()
        {
            // Expand overflow button.
            if (mAdapter.getCount() > 0)
            {
                mExpandActivityOverflowButton.setEnabled(true);
            }
            else
            {
                mExpandActivityOverflowButton.setEnabled(false);
            }
            // Default activity button.
            int activityCount = mAdapter.getActivityCount();
            int historySize   = mAdapter.getHistorySize();

            if (activityCount > 0 && historySize > 0)
            {
                mDefaultActivityButton.setVisibility(VISIBLE);
                android.content.pm.ResolveInfo    activity       = mAdapter.getDefaultActivity();
                android.content.pm.PackageManager packageManager = mContext.getPackageManager();
                mDefaultActivityButtonImage.setImageDrawable(activity.loadIcon(packageManager));
                if (mDefaultActionButtonContentDescription != 0)
                {
                    java.lang.CharSequence label = activity.loadLabel(packageManager);
                    string contentDescription    = mContext.getString(mDefaultActionButtonContentDescription
                                                                      , label);
                    mDefaultActivityButton.setContentDescription(java.lang.CharSequenceProxy.Wrap(contentDescription
                                                                                                  ));
                }
            }
            else
            {
                mDefaultActivityButton.setVisibility(android.view.View.GONE);
            }
            // Activity chooser content.
            if (mDefaultActivityButton.getVisibility() == VISIBLE)
            {
                mActivityChooserContent.setBackgroundDrawable(mActivityChooserContentBackground);
            }
            else
            {
                mActivityChooserContent.setBackgroundDrawable(null);
            }
        }
Ejemplo n.º 6
0
        // Not for instantiating.
        /// <summary>
        /// Returns the broadcast intent to fire with
        /// <see cref="android.content.Context.sendOrderedBroadcast(android.content.Intent, string, android.content.BroadcastReceiver, android.os.Handler, int, string, android.os.Bundle)
        ///     ">android.content.Context.sendOrderedBroadcast(android.content.Intent, string, android.content.BroadcastReceiver, android.os.Handler, int, string, android.os.Bundle)
        ///     </see>
        /// to receive details from the package that implements voice search.
        /// <p>
        /// This is based on the value specified by the voice search
        /// <see cref="android.app.Activity">android.app.Activity</see>
        /// in
        /// <see cref="DETAILS_META_DATA">DETAILS_META_DATA</see>
        /// , and if this is not specified, will return null. Also if there
        /// is no chosen default to resolve for
        /// <see cref="ACTION_WEB_SEARCH">ACTION_WEB_SEARCH</see>
        /// , this will return null.
        /// <p>
        /// If an intent is returned and is fired, a
        /// <see cref="android.os.Bundle">android.os.Bundle</see>
        /// of extras will be returned to the
        /// provided result receiver, and should ideally contain values for
        /// <see cref="EXTRA_LANGUAGE_PREFERENCE">EXTRA_LANGUAGE_PREFERENCE</see>
        /// and
        /// <see cref="EXTRA_SUPPORTED_LANGUAGES">EXTRA_SUPPORTED_LANGUAGES</see>
        /// .
        /// <p>
        /// (Whether these are actually provided is up to the particular implementation. It is
        /// recommended that
        /// <see cref="android.app.Activity">android.app.Activity</see>
        /// s implementing
        /// <see cref="ACTION_WEB_SEARCH">ACTION_WEB_SEARCH</see>
        /// provide this
        /// information, but it is not required.)
        /// </summary>
        /// <param name="context">a context object</param>
        /// <returns>the broadcast intent to fire or null if not available</returns>
        public static android.content.Intent getVoiceDetailsIntent(android.content.Context
                                                                   context)
        {
            android.content.Intent voiceSearchIntent = new android.content.Intent(ACTION_WEB_SEARCH
                                                                                  );
            android.content.pm.ResolveInfo ri = context.getPackageManager().resolveActivity(voiceSearchIntent
                                                                                            , android.content.pm.PackageManager.GET_META_DATA);
            if (ri == null || ri.activityInfo == null || ri.activityInfo.metaData == null)
            {
                return(null);
            }
            string className = ri.activityInfo.metaData.getString(DETAILS_META_DATA);

            if (className == null)
            {
                return(null);
            }
            android.content.Intent detailsIntent = new android.content.Intent(ACTION_GET_LANGUAGE_DETAILS
                                                                              );
            detailsIntent.setComponent(new android.content.ComponentName(ri.activityInfo.packageName
                                                                         , className));
            return(detailsIntent);
        }
Ejemplo n.º 7
0
        public override void onPrepareSubMenu(android.view.SubMenu subMenu)
        {
            // Clear since the order of items may change.
            subMenu.clear();
            android.widget.ActivityChooserModel dataModel = android.widget.ActivityChooserModel
                                                            .get(mContext, mShareHistoryFileName);
            android.content.pm.PackageManager packageManager = mContext.getPackageManager();
            int expandedActivityCount  = dataModel.getActivityCount();
            int collapsedActivityCount = System.Math.Min(expandedActivityCount, mMaxShownActivityCount
                                                         );

            {
                // Populate the sub-menu with a sub set of the activities.
                for (int i = 0; i < collapsedActivityCount; i++)
                {
                    android.content.pm.ResolveInfo activity = dataModel.getActivity(i);
                    subMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon
                                                                                         (packageManager)).setOnMenuItemClickListener(mOnMenuItemClickListener);
                }
            }
            if (collapsedActivityCount < expandedActivityCount)
            {
                // Add a sub-menu for showing all activities as a list item.
                android.view.SubMenu expandedSubMenu = subMenu.addSubMenu(android.view.MenuClass.NONE
                                                                          , collapsedActivityCount, collapsedActivityCount, java.lang.CharSequenceProxy.Wrap
                                                                              (mContext.getString([email protected][email protected]_chooser_view_see_all)));
                {
                    for (int i_1 = 0; i_1 < expandedActivityCount; i_1++)
                    {
                        android.content.pm.ResolveInfo activity = dataModel.getActivity(i_1);
                        expandedSubMenu.add(0, i_1, i_1, activity.loadLabel(packageManager)).setIcon(activity
                                                                                                     .loadIcon(packageManager)).setOnMenuItemClickListener(mOnMenuItemClickListener);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public SpellCheckerInfo(android.content.Context context, android.content.pm.ResolveInfo
                         service)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 9
0
 public DeviceAdminInfo(android.content.Context context, android.content.pm.ResolveInfo
                        receiver)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 10
0
 public InputMethodInfo(android.content.Context context, android.content.pm.ResolveInfo
                        service, java.util.Map <string, java.util.List <android.view.inputmethod.InputMethodSubtype
                                                                        > > additionalSubtypesMap)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 11
0
 public InputMethodInfo(android.content.Context context, android.content.pm.ResolveInfo
                        service) : this(context, service, null)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 12
0
 public InputMethodInfo(android.content.Context arg0, android.content.pm.ResolveInfo arg1)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.view.inputmethod.InputMethodInfo.staticClass, global::android.view.inputmethod.InputMethodInfo._InputMethodInfo10223, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     Init(@__env, handle);
 }
Ejemplo n.º 13
0
 public WallpaperInfo(android.content.Context arg0, android.content.pm.ResolveInfo arg1)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.app.WallpaperInfo.staticClass, global::android.app.WallpaperInfo._WallpaperInfo852, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     Init(@__env, handle);
 }
Ejemplo n.º 14
0
 public ActivityResolveInfo(ActivityChooserModel _enclosing, android.content.pm.ResolveInfo
                            resolveInfo)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 15
0
 public virtual int getActivityIndex(android.content.pm.ResolveInfo activity)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 16
0
 internal ListItem(android.content.pm.PackageManager pm, android.content.pm.ResolveInfo
                   resolveInfo, android.app.LauncherActivity.IconResizer resizer)
 {
     throw new System.NotImplementedException();
 }