Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a041b7c authored by narinder Rana's avatar narinder Rana
Browse files

system icon move to left

parent eec05eb0
Loading
Loading
Loading
Loading
+68 −2
Original line number Diff line number Diff line
@@ -380,10 +380,75 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
    public void moveLeftRightSystemIcon(int ishide_notificationIcon){

        Log.e("MoveLeftRightSystemIcon", "MoveLeftRightSystemIcon ......Testing ....."+ishide_notificationIcon);
        int childCount = getChildCount();

        mLayoutStates.clear();
        float width = getWidth();
        float translationX = width - getPaddingEnd();
        float contentStart = getPaddingStart();
        int childCount = getChildCount();
        // Underflow === don't show content until that index
        if (DEBUG) android.util.Log.d(TAG, "calculateIconTranslations: start=" + translationX
                + " width=" + width + " underflow=" + mNeedsUnderflow);

        // Collect all of the states which want to be visible
        for (int i = childCount - 1; i >= 0; i--) {
            View child = getChildAt(i);
            StatusIconDisplayable iconView = (StatusIconDisplayable) child;
            StatusIconState childState = getViewStateFromChild(child);

            if (!iconView.isIconVisible() || iconView.isIconBlocked()
                    || mIgnoredSlots.contains(iconView.getSlot())) {
                childState.visibleState = STATE_HIDDEN;
                if (DEBUG) Log.d(TAG, "skipping child (" + iconView.getSlot() + ") not visible");
                continue;
            }

            childState.visibleState = STATE_ICON;
            childState.xTranslation = translationX - getViewTotalWidth(child);
            mLayoutStates.add(0, childState);

            translationX -= getViewTotalWidth(child);
        }

        // Show either 1-MAX_ICONS icons, or (MAX_ICONS - 1) icons + overflow
        int totalVisible = mLayoutStates.size();
        int maxVisible = totalVisible <= MAX_ICONS ? MAX_ICONS : MAX_ICONS - 1;

        mUnderflowStart = 0;
        int visible = 0;
        int firstUnderflowIndex = -1;
        for (int i = totalVisible - 1; i >= 0; i--) {
            StatusIconState state = mLayoutStates.get(i);
            // Allow room for underflow if we found we need it in onMeasure
            if (mNeedsUnderflow && (state.xTranslation < (contentStart + mUnderflowWidth))||
                    (mShouldRestrictIcons && visible >= maxVisible)) {
                firstUnderflowIndex = i;
                break;
            }
            mUnderflowStart = (int) Math.max(contentStart, state.xTranslation - mUnderflowWidth);
            visible++;
        }

        if (firstUnderflowIndex != -1) {
            int totalDots = 0;
            int dotWidth = mStaticDotDiameter + mDotPadding;
            int dotOffset = mUnderflowStart + mUnderflowWidth - mIconDotFrameWidth;
            for (int i = firstUnderflowIndex; i >= 0; i--) {
                StatusIconState state = mLayoutStates.get(i);
                if (totalDots < MAX_DOTS) {
                    state.xTranslation = dotOffset;
                    state.visibleState = STATE_DOT;
                    dotOffset -= dotWidth;
                    totalDots++;
                } else {
                    state.visibleState = STATE_HIDDEN;
                }
            }
        }

        if(ishide_notificationIcon==1){
           //hide notificaton icon and move system icon right to left
            Log.e("MoveLeftRightSystemIcon", "MoveLeftRightSystemIcon ......Testing .....true"+);
           if (!isLayoutRtl()) {
               for (int i = 0; i < childCount; i++) {
                   View child = getChildAt(i);
@@ -393,6 +458,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
           }
       }
       else {
            Log.e("MoveLeftRightSystemIcon", "MoveLeftRightSystemIcon ......Testing .....falsh "+);
           //show notification icon and move system icon left to right
           if (isLayoutRtl()) {
               for (int i = 0; i < childCount; i++) {