summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/qs/QuickTileLayout.java
blob: bb2340c2cad512c34e545708e0f7aff3e4dfff4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.android.systemui.qs;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

public class QuickTileLayout extends LinearLayout {

    public QuickTileLayout(Context context) {
        this(context, null);
    }

    public QuickTileLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        setGravity(Gravity.CENTER);
    }

    @Override
    public void addView(View child, int index, ViewGroup.LayoutParams params) {
        // Make everything square at the height of this view.
        params = new LayoutParams(params.height, params.height);
        ((LinearLayout.LayoutParams) params).weight = 1;
        super.addView(child, index, params);
    }
}