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

Commit d8c36143 authored by Danesh M's avatar Danesh M
Browse files

PowerWidgets : Consume free space when disabled

Eliminate free space when the notification widgets are disabled.

Patchset 2 - Restore import order

Change-Id: Ic844fedd407a8ee363e3de97370d6b264fe045d5
parent f6f2e58a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -32,17 +32,16 @@ import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.view.ViewGroup;

import com.android.systemui.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PowerWidget extends FrameLayout {
    private static final String TAG = "PowerWidget";
@@ -128,6 +127,11 @@ public class PowerWidget extends FrameLayout {
        // get an initial width
        updateButtonLayoutWidth();
        setupWidget();
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        updateVisibility();
    }

@@ -358,9 +362,13 @@ public class PowerWidget extends FrameLayout {
        // now check if we need to display the widget still
        boolean displayPowerWidget = Settings.System.getInt(mContext.getContentResolver(),
                   Settings.System.EXPANDED_VIEW_WIDGET, 1) == 1;
        View notifScroll = ((ViewGroup) getParent()).findViewById(R.id.scroll);
        MarginLayoutParams param = (MarginLayoutParams) notifScroll.getLayoutParams();
        if(!displayPowerWidget) {
            param.topMargin = (int) getResources().getDimension(R.dimen.notification_panel_header_height);
            setVisibility(View.GONE);
        } else {
            param.topMargin = (int) getResources().getDimension(R.dimen.notification_panel_header_and_widget);
            setVisibility(View.VISIBLE);
        }
    }