Search in sources :

Example 81 with ViewGroup

use of android.view.ViewGroup in project android_frameworks_base by ParanoidAndroid.

the class NavbarEditor method adjustPadding.

/**
     * Accommodates the padding between keys based on
     * number of keys in use.
     */
private void adjustPadding() {
    ViewGroup viewParent = (ViewGroup) mParent.findViewById(R.id.mid_nav_buttons);
    int sCount = visibleCount;
    for (int v = 0; v < viewParent.getChildCount(); v++) {
        View cView = viewParent.getChildAt(v);
        if (cView instanceof KeyButtonView) {
            View nextPadding = viewParent.getChildAt(v + 1);
            if (nextPadding != null) {
                View nextKey = viewParent.getChildAt(v + 2);
                String nextTag = NAVBAR_EMPTY;
                if (nextKey != null) {
                    nextTag = (String) nextKey.getTag();
                }
                String curTag = (String) cView.getTag();
                if (nextKey != null && nextTag != null && curTag != null && !curTag.equals(NAVBAR_EMPTY)) {
                    if (!nextTag.equals(NAVBAR_EMPTY)) {
                        nextPadding.setVisibility(View.VISIBLE);
                    } else {
                        if (sCount > 1) {
                            nextPadding.setVisibility(View.VISIBLE);
                        } else {
                            nextPadding.setVisibility(View.GONE);
                        }
                    }
                    sCount--;
                } else {
                    nextPadding.setVisibility(View.GONE);
                }
            }
        }
    }
}
Also used : KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) View(android.view.View) TextView(android.widget.TextView)

Example 82 with ViewGroup

use of android.view.ViewGroup in project android_frameworks_base by ParanoidAndroid.

the class NavigationBarView method onLayout.

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    ViewGroup mid_nav = (ViewGroup) mCurrentView.findViewById(R.id.mid_nav_buttons);
    View[] vViews = new View[mid_nav.getChildCount()];
    for (int cc = 0; cc < mid_nav.getChildCount(); cc++) {
        vViews[cc] = mid_nav.getChildAt(cc);
    }
    mDelegateHelper.setInitialTouchRegion(vViews);
}
Also used : ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) View(android.view.View) Point(android.graphics.Point)

Example 83 with ViewGroup

use of android.view.ViewGroup in project android_frameworks_base by ParanoidAndroid.

the class NavigationBarView method reorient.

public void reorient() {
    int rot = mContext.getResources().getConfiguration().orientation;
    for (int i = 1; i < 3; i++) {
        mRotatedViews[i].setVisibility(View.GONE);
    }
    mCurrentView = mRotatedViews[rot];
    mCurrentView.setVisibility(View.VISIBLE);
    if (NavbarEditor.isDevicePhone()) {
        rot = mDisplay.getRotation();
        mVertical = (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270);
    } else {
        mVertical = getWidth() > 0 && getHeight() > getWidth();
    }
    mEditBar = new NavbarEditor((ViewGroup) mCurrentView.findViewById(R.id.container), mVertical);
    mEditBar.updateKeys();
    mEditBar.updateLowLights(mCurrentView);
    toggleButtonListener(true);
    mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
    // force the low profile & disabled states into compliance
    setLowProfile(mLowProfile, false, true);
    setDisabledFlags(mDisabledFlags, true);
    setMenuVisibility(mShowMenu, true);
    if (DEBUG) {
        Slog.d(TAG, "reorient(): rot=" + mDisplay.getRotation());
    }
    setNavigationIconHints(mNavigationIconHints, true);
    // Reset recents hints after reorienting, if recents icon is present
    View recent = getRecentsButton();
    if (recent != null) {
        ((ImageView) recent).setImageDrawable(mVertical ? mRecentsLandIcon : mRecentsIcon);
    }
}
Also used : ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) Point(android.graphics.Point)

Example 84 with ViewGroup

use of android.view.ViewGroup in project android_frameworks_base by ParanoidAndroid.

the class PhoneWindow method openPanel.

private void openPanel(PanelFeatureState st, KeyEvent event) {
    // Already open, return
    if (st.isOpen || isDestroyed()) {
        return;
    }
    // (The app should be using an action bar for menu items.)
    if (st.featureId == FEATURE_OPTIONS_PANEL) {
        Context context = getContext();
        Configuration config = context.getResources().getConfiguration();
        boolean isXLarge = (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
        boolean isHoneycombApp = context.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.HONEYCOMB;
        if (isXLarge && isHoneycombApp) {
            return;
        }
    }
    Callback cb = getCallback();
    if ((cb != null) && (!cb.onMenuOpened(st.featureId, st.menu))) {
        // Callback doesn't want the menu to open, reset any state
        closePanel(st, true);
        return;
    }
    final WindowManager wm = getWindowManager();
    if (wm == null) {
        return;
    }
    // Prepare panel (should have been done before, but just in case)
    if (!preparePanel(st, event)) {
        return;
    }
    int width = WRAP_CONTENT;
    if (st.decorView == null || st.refreshDecorView) {
        if (st.decorView == null) {
            // Initialize the panel decor, this will populate st.decorView
            if (!initializePanelDecor(st) || (st.decorView == null))
                return;
        } else if (st.refreshDecorView && (st.decorView.getChildCount() > 0)) {
            // Decor needs refreshing, so remove its views
            st.decorView.removeAllViews();
        }
        // This will populate st.shownPanelView
        if (!initializePanelContent(st) || !st.hasPanelItems()) {
            return;
        }
        ViewGroup.LayoutParams lp = st.shownPanelView.getLayoutParams();
        if (lp == null) {
            lp = new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
        }
        int backgroundResId;
        if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
            // If the contents is fill parent for the width, set the
            // corresponding background
            backgroundResId = st.fullBackground;
            width = MATCH_PARENT;
        } else {
            // Otherwise, set the normal panel background
            backgroundResId = st.background;
        }
        st.decorView.setWindowBackground(getContext().getResources().getDrawable(backgroundResId));
        ViewParent shownPanelParent = st.shownPanelView.getParent();
        if (shownPanelParent != null && shownPanelParent instanceof ViewGroup) {
            ((ViewGroup) shownPanelParent).removeView(st.shownPanelView);
        }
        st.decorView.addView(st.shownPanelView, lp);
        /*
             * Give focus to the view, if it or one of its children does not
             * already have it.
             */
        if (!st.shownPanelView.hasFocus()) {
            st.shownPanelView.requestFocus();
        }
    } else if (!st.isInListMode()) {
        width = MATCH_PARENT;
    } else if (st.createdPanelView != null) {
        // If we already had a panel view, carry width=MATCH_PARENT through
        // as we did above when it was created.
        ViewGroup.LayoutParams lp = st.createdPanelView.getLayoutParams();
        if (lp != null && lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
            width = MATCH_PARENT;
        }
    }
    st.isOpen = true;
    st.isHandled = false;
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, WRAP_CONTENT, st.x, st.y, WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, st.decorView.mDefaultOpacity);
    if (st.isCompact) {
        lp.gravity = getOptionsPanelGravity();
        sRotationWatcher.addWindow(this);
    } else {
        lp.gravity = st.gravity;
    }
    lp.windowAnimations = st.windowAnimations;
    wm.addView(st.decorView, lp);
// Log.v(TAG, "Adding main menu to window manager.");
}
Also used : Context(android.content.Context) LayoutParams(android.view.WindowManager.LayoutParams) Configuration(android.content.res.Configuration) ViewGroup(android.view.ViewGroup) ViewParent(android.view.ViewParent) LayoutParams(android.view.WindowManager.LayoutParams) WindowManager(android.view.WindowManager) IWindowManager(android.view.IWindowManager)

Example 85 with ViewGroup

use of android.view.ViewGroup in project android_frameworks_base by ParanoidAndroid.

the class PieStatusPanel method hidePanel.

private void hidePanel(View panel) {
    ViewGroup parent = getPanelParent(panel);
    mScrollView.removeAllViews();
    parent.removeAllViews();
    parent.addView(panel, panel.getLayoutParams());
    updateContainer(false);
}
Also used : ViewGroup(android.view.ViewGroup)

Aggregations

ViewGroup (android.view.ViewGroup)2280 View (android.view.View)1268 TextView (android.widget.TextView)439 ImageView (android.widget.ImageView)279 ArrayList (java.util.ArrayList)198 ViewParent (android.view.ViewParent)184 ListView (android.widget.ListView)156 Paint (android.graphics.Paint)125 FrameLayout (android.widget.FrameLayout)121 LayoutInflater (android.view.LayoutInflater)115 AdapterView (android.widget.AdapterView)115 LinearLayout (android.widget.LinearLayout)110 AbsListView (android.widget.AbsListView)106 Animator (android.animation.Animator)94 Drawable (android.graphics.drawable.Drawable)93 RecyclerView (android.support.v7.widget.RecyclerView)91 AnimatedView (carbon.animation.AnimatedView)88 ComponentView (carbon.component.ComponentView)88 RippleView (carbon.drawable.ripple.RippleView)88 ShadowView (carbon.shadow.ShadowView)88