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

Commit 5ed1fb17 authored by Nihanth Subramanya's avatar Nihanth Subramanya Committed by Steve Kondik
Browse files

Tablet tweaks: Make notifications bottom-aligned when bottom status bar is enabled

Finally got this to work. If someone can suggest what to do with
compact carrier (it looks ugly alone at the top), I'll implement it
in another patch set (till then I've made it hidden when bottom bar
is enabled)

Screenshot (without compact carrier "fix"): http://puu.sh/29GI

Change-Id: Ic2c857170787fb05d19d8985d6a0a830856fb283
parent aab21af2
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -140,6 +140,21 @@
                    />
            </com.android.systemui.statusbar.NotificationLinearLayout>
        </ScrollView>
        <ScrollView
            android:id="@+id/bottomScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fadingEdge="none"
            android:overScrollMode="ifContentScrolls"
            >
            <com.android.systemui.statusbar.NotificationLinearLayout
                android:id="@+id/bottomNotificationLinearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="bottom"
                />
        </ScrollView>

        <LinearLayout android:id="@+id/compact_carrier_layout"
            android:orientation="horizontal"
+39 −3
Original line number Diff line number Diff line
@@ -132,7 +132,9 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
    ExpandedView mExpandedView;
    WindowManager.LayoutParams mExpandedParams;
    ScrollView mScrollView;
    View mNotificationLinearLayout;
    ScrollView mBottomScrollView;
    LinearLayout mNotificationLinearLayout;
    LinearLayout mBottomNotificationLinearLayout;
    View mExpandedContents;
    // top bar
    TextView mNoNotificationsTitle;
@@ -408,7 +410,9 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
        mCompactClearButton.setOnClickListener(mClearButtonListener);
        mPowerAndCarrier = (LinearLayout)expanded.findViewById(R.id.power_and_carrier);
        mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
        mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout);
        mBottomScrollView = (ScrollView)expanded.findViewById(R.id.bottomScroll);
        mNotificationLinearLayout = (LinearLayout)expanded.findViewById(R.id.notificationLinearLayout);
        mBottomNotificationLinearLayout = (LinearLayout)expanded.findViewById(R.id.bottomNotificationLinearLayout);

        mExpandedView.setVisibility(View.GONE);
        mOngoingTitle.setVisibility(View.GONE);
@@ -458,6 +462,9 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
    private void updateCarrierLabel() {
        if (mCompactCarrier) {
            mCarrierLabelLayout.setVisibility(View.GONE);
            // Disable compact carrier when bottom bar is enabled for now
            // till we find a better solution (looks ugly alone at the top)
            if (mBottomBar)
                mCompactCarrierLayout.setVisibility(View.VISIBLE);
            if (mLatest.hasClearableItems())
                mCompactClearButton.setVisibility(View.VISIBLE);
@@ -490,6 +497,32 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
        mExpandedView.addView(powerAndCarrier, mBottomBar ? 1 : 0);
        powerAndCarrier.addView(power, mBottomBar && !mCompactCarrier ? 1 : 0);

        // Remove all notification views
        mNotificationLinearLayout.removeAllViews();
        mBottomNotificationLinearLayout.removeAllViews();

        // Readd to correct scrollview depending on mBottomBar
        if (mBottomBar) {
            mScrollView.setVisibility(View.GONE);
            mBottomNotificationLinearLayout.addView(mCompactClearButton);
            mBottomNotificationLinearLayout.addView(mNoNotificationsTitle);
            mBottomNotificationLinearLayout.addView(mOngoingTitle);
            mBottomNotificationLinearLayout.addView(mOngoingItems);
            mBottomNotificationLinearLayout.addView(mLatestTitle);
            mBottomNotificationLinearLayout.addView(mLatestItems);
            mBottomScrollView.setVisibility(View.VISIBLE);
        } else {
            mBottomScrollView.setVisibility(View.GONE);
            mNotificationLinearLayout.addView(mNoNotificationsTitle);
            mNotificationLinearLayout.addView(mOngoingTitle);
            mNotificationLinearLayout.addView(mOngoingItems);
            mNotificationLinearLayout.addView(mLatestTitle);
            mNotificationLinearLayout.addView(mLatestItems);
            mNotificationLinearLayout.addView(mCompactClearButton);
            mScrollView.setVisibility(View.VISIBLE);
            mCompactCarrierLayout.setVisibility(View.VISIBLE);
        }

        //remove small ugly grey area if compactcarrier is enabled and power widget disabled
        boolean hideArea = mCompactCarrier &&
                           Settings.System.getInt(mContext.getContentResolver(),
@@ -1457,7 +1490,10 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
            pw.println("  mTickerView: " + viewInfo(mTickerView));
            pw.println("  mScrollView: " + viewInfo(mScrollView)
                    + " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY());
            pw.println("  mBottomScrollView: " + viewInfo(mBottomScrollView)
                    + " scroll " + mBottomScrollView.getScrollX() + "," + mBottomScrollView.getScrollY());
            pw.println("mNotificationLinearLayout: " + viewInfo(mNotificationLinearLayout));
            pw.println("mBottomNotificationLinearLayout: " + viewInfo(mBottomNotificationLinearLayout));
        }

        if (true) {