Ejemplo n.º 1
0
 protected internal override bool filterLeftoverView(android.view.ViewGroup parent
                                                     , int childIndex)
 {
     if (parent.getChildAt(childIndex) != mMoreView)
     {
         return(base.filterLeftoverView(parent, childIndex));
     }
     return(false);
 }
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            base.onCreate(savedInstanceState);

            Slook slook = new Slook();

            try
            {
                slook.initialize(this);
            }
            catch (SsdkUnsupportedException)
            {
                return;
            }

            if (slook.isFeatureEnabled(Slook.COCKTAIL_BAR))
            {
                // If device supports cocktail bar, you can set up the sub-window.
                ContentView = R.layout.activity_immersive_mode;
                SlookCocktailSubWindow.setSubContentView(this, R.layout.sub_view);
            }
            else
            {
                // Normal device
                ContentView = R.layout.activity_main;
            }

            mainText = (TextView)findViewById(R.id.main_text);
            ViewGroup subView = (ViewGroup)findViewById(R.id.sub_view_layout);

            if (subView != null)
            {
                int childCount = subView.ChildCount;
                for (int i = 0; i < childCount; i++)
                {
                    if (subView.getChildAt(i) is ImageView)
                    {
                        subView.getChildAt(i).OnClickListener = mSubViewOnClickListener;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            Log.d(TAG, "onCreate");
            ContentView = R.layout.activity_main;
            base.onCreate(savedInstanceState);
            mService = null;
            //binding to local service.
            bindService(new Intent(this, typeof(MainService)), mConnection, 0);

            //Views are being set from the layout.

            mFloatingController = (FloatingController)findViewById(R.id.jam_control);
            SharedPreferences preferences = getPreferences(Context.MODE_PRIVATE);
            int barAlignment = preferences.getInt(FLOATING_ALIGNMENT_STATE_TAG, mFloatingController.BarAlignment);

            /// <summary>
            ///This method is used to set floating controller position
            /// To set position you must used one of below value:
            /// HORIZONTAL POSITION
            /// 5 - BOTTOM RIGHT
            /// 6 - BOTTOM LEFT
            /// 4 - TOP RIGHT
            /// 7 - TOP LEFT
            ///
            /// VERTICAL POSITION
            /// 15 - BOTTOM RIGHT
            /// 16 - BOTTOM LEFT
            /// 14 - TOP RIGHT
            /// 17 - TOP LEFT
            /// </summary>
            mFloatingController.loadBarState(barAlignment);
            ViewGroup vg = (ViewGroup)findViewById(R.id.layout_keys);

            int size = vg.ChildCount;

            for (int i = 0; i < size; ++i)
            {
                View v = vg.getChildAt(i);
                if (v is KeyButton)
                {
                    v.OnTouchListener = this;
                }
            }
        }
Ejemplo n.º 4
0
        public virtual void updateMenuView(bool cleared)
        {
            android.view.ViewGroup parent = (android.view.ViewGroup)mMenuView;
            if (parent == null)
            {
                return;
            }
            int childIndex = 0;

            if (mMenu != null)
            {
                mMenu.flagActionItems();
                java.util.ArrayList <*****@*****.**> visibleItems = mMenu
                                                                                              .getVisibleItems();
                int itemCount = visibleItems.size();
                {
                    for (int i = 0; i < itemCount; i++)
                    {
                        [email protected] item = visibleItems.get(i);
                        if (shouldIncludeItem(childIndex, item))
                        {
                            android.view.View convertView = parent.getChildAt(childIndex);
                            android.view.View itemView    = getItemView(item, convertView, parent);
                            if (itemView != convertView)
                            {
                                addItemView(itemView, childIndex);
                            }
                            childIndex++;
                        }
                    }
                }
            }
            // Remove leftover views.
            while (childIndex < parent.getChildCount())
            {
                if (!filterLeftoverView(parent, childIndex))
                {
                    childIndex++;
                }
            }
        }
Ejemplo n.º 5
0
        private android.view.View findViewForItem(android.view.MenuItem item)
        {
            android.view.ViewGroup parent = (android.view.ViewGroup)mMenuView;
            if (parent == null)
            {
                return(null);
            }
            int count = parent.getChildCount();

            {
                for (int i = 0; i < count; i++)
                {
                    android.view.View child = parent.getChildAt(i);
                    if (child is [email protected] && (([email protected]
                                                                                         .ItemView)child).getItemData() == item)
                    {
                        return(child);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 6
0
        internal static bool canTextInput(android.view.View v)
        {
            if (v.onCheckIsTextEditor())
            {
                return(true);
            }
            if (!(v is android.view.ViewGroup))
            {
                return(false);
            }
            android.view.ViewGroup vg = (android.view.ViewGroup)v;
            int i = vg.getChildCount();

            while (i > 0)
            {
                i--;
                v = vg.getChildAt(i);
                if (canTextInput(v))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 7
0
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            /* No title section on the top */
            base.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);

            /* Get content */
            mContent = EngagementReachAgent.getInstance(this).getContent(Intent);
            if (mContent == null)
            {
                /* If problem with content, exit */
                finish();
                return;
            }

            /* Inflate layout */
            ContentView = getLayoutId(LayoutName);

            /* Set title */
            TextView titleView = getView("title");
            string   title     = mContent.Title;

            if (title != null)
            {
                titleView.Text = title;
            }
            else
            {
                titleView.Visibility = View.GONE;
            }

            /* Set body */
            setBody(mContent.Body, getView("body"));

            /* Action button */
            mActionButton = getView("action");
            string actionLabel = mContent.ActionLabel;

            if (actionLabel != null)
            {
                mActionButton.Text            = actionLabel;
                mActionButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);
            }

            /* No action label means no action button */
            else
            {
                mActionButton.Visibility = View.GONE;
            }

            /* Exit button */
            Button exitButton = getView("exit");
            string exitLabel  = mContent.ExitLabel;

            if (exitLabel != null)
            {
                exitButton.Text            = exitLabel;
                exitButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this);
            }

            /* No exit label means no exit button */
            else
            {
                exitButton.Visibility = View.GONE;
            }

            /* Hide spacers if only one button is visible (or none) */
            ViewGroup layout     = getView("engagement_button_bar");
            bool      hideSpacer = actionLabel == null || exitLabel == null;

            for (int i = 0; i < layout.ChildCount; i++)
            {
                View view = layout.getChildAt(i);
                if ("spacer".Equals(view.Tag))
                {
                    if (hideSpacer)
                    {
                        view.Visibility = View.VISIBLE;
                    }
                    else
                    {
                        view.Visibility = View.GONE;
                    }
                }
            }

            /* Hide button bar if both action and exit buttons are hidden */
            if (actionLabel == null && exitLabel == null)
            {
                layout.Visibility = View.GONE;
            }
        }