1 package com.android.systemui.qs; 2 3 import android.content.Context; 4 import android.util.AttributeSet; 5 import android.view.Gravity; 6 import android.view.View; 7 import android.view.ViewGroup; 8 import android.widget.LinearLayout; 9 10 import androidx.annotation.Nullable; 11 12 public class QuickTileLayout extends LinearLayout { 13 QuickTileLayout(Context context)14 public QuickTileLayout(Context context) { 15 this(context, null); 16 } 17 QuickTileLayout(Context context, @Nullable AttributeSet attrs)18 public QuickTileLayout(Context context, @Nullable AttributeSet attrs) { 19 super(context, attrs); 20 setGravity(Gravity.CENTER); 21 } 22 23 @Override addView(View child, int index, ViewGroup.LayoutParams params)24 public void addView(View child, int index, ViewGroup.LayoutParams params) { 25 // Make everything square at the height of this view. 26 params = new LayoutParams(params.height, params.height); 27 ((LinearLayout.LayoutParams) params).weight = 1; 28 super.addView(child, index, params); 29 } 30 } 31