Merge "DO NOT MERGE: Downbranch don't need this adjustment [Output Switcher] Adjust properties in dialog" into sc-v2-dev

This commit is contained in:
Shaowei Shen
2021-12-07 02:10:56 +00:00
committed by Android (Google) Code Review
4 changed files with 35 additions and 28 deletions

View File

@@ -13,17 +13,20 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
<stroke
android:color="?androidprv:attr/colorAccentPrimaryVariant"
android:width="1dp"/>
<corners android:radius="20dp"/>
<padding
android:left="16dp"
android:right="16dp"
android:top="8dp"
android:bottom="8dp" />
<solid android:color="@android:color/transparent" />
</shape>
android:insetBottom="6dp"
android:insetTop="6dp">
<shape android:shape="rectangle">
<stroke
android:color="?androidprv:attr/colorAccentPrimaryVariant"
android:width="1dp"/>
<corners android:radius="20dp"/>
<padding
android:left="16dp"
android:right="16dp"
android:top="8dp"
android:bottom="8dp"/>
<solid android:color="@android:color/transparent"/>
</shape>
</inset>

View File

@@ -24,9 +24,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dp"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:paddingStart="16dp"
android:paddingStart="24dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/header_icon"
@@ -36,7 +36,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="20dp"
android:paddingBottom="24dp"
@@ -59,7 +59,7 @@
android:gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
android:textColor="?android:attr/textColorSecondary"
android:fontFamily="roboto-regular"
android:textSize="16sp"/>
</LinearLayout>
@@ -90,7 +90,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="24dp"
android:layout_marginBottom="18dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal">
@@ -98,7 +98,7 @@
android:id="@+id/stop"
style="@style/MediaOutputRoundedOutlinedButton"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:text="@string/keyboard_key_media_stop"
android:visibility="gone"/>
@@ -112,7 +112,7 @@
android:id="@+id/done"
style="@style/MediaOutputRoundedOutlinedButton"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:text="@string/inline_done_button"/>
</LinearLayout>

View File

@@ -63,13 +63,14 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
View mDialogView;
private TextView mHeaderTitle;
private TextView mHeaderSubtitle;
private ImageView mHeaderIcon;
private RecyclerView mDevicesRecyclerView;
private LinearLayout mDeviceListLayout;
private Button mDoneButton;
private Button mStopButton;
private int mListMaxHeight;
protected ImageView mHeaderIcon;
MediaOutputBaseAdapter mAdapter;
private final ViewTreeObserver.OnGlobalLayoutListener mDeviceListLayoutListener = () -> {
@@ -140,7 +141,6 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
mMediaOutputController.stop();
}
@VisibleForTesting
void refresh() {
// Update header icon
final int iconRes = getHeaderIconRes();
@@ -154,12 +154,6 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
} else {
mHeaderIcon.setVisibility(View.GONE);
}
if (mHeaderIcon.getVisibility() == View.VISIBLE) {
final int size = getHeaderIconSize();
final int padding = mContext.getResources().getDimensionPixelSize(
R.dimen.media_output_dialog_header_icon_padding);
mHeaderIcon.setLayoutParams(new LinearLayout.LayoutParams(size + padding, size));
}
// Update title and subtitle
mHeaderTitle.setText(getHeaderText());
final CharSequence subTitle = getHeaderSubtitle();

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import androidx.core.graphics.drawable.IconCompat;
@@ -75,6 +76,15 @@ public class MediaOutputGroupDialog extends MediaOutputBaseDialog {
return mContext.getString(R.string.media_output_dialog_multiple_devices, size);
}
@Override
void refresh() {
super.refresh();
final int size = getHeaderIconSize();
final int padding = mContext.getResources().getDimensionPixelSize(
R.dimen.media_output_dialog_header_icon_padding);
mHeaderIcon.setLayoutParams(new LinearLayout.LayoutParams(size + padding, size));
}
@Override
int getStopButtonVisibility() {
return View.VISIBLE;