Merge "[Overlay] Adjust Media Controls button size and position" into tm-qpr-dev

This commit is contained in:
Coco Duan
2023-03-17 17:30:35 +00:00
committed by Android (Google) Code Review
7 changed files with 30 additions and 46 deletions

View File

@@ -14,22 +14,15 @@
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<FrameLayout <com.android.systemui.animation.view.LaunchableImageView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:id="@+id/home_controls_chip"
android:layout_width="wrap_content" android:layout_height="@dimen/dream_overlay_bottom_affordance_height"
android:paddingVertical="@dimen/dream_overlay_complication_home_controls_padding"> android:layout_width="@dimen/dream_overlay_bottom_affordance_width"
android:layout_gravity="bottom|start"
<com.android.systemui.animation.view.LaunchableImageView android:padding="@dimen/dream_overlay_bottom_affordance_padding"
android:id="@+id/home_controls_chip" android:background="@drawable/dream_overlay_bottom_affordance_bg"
android:layout_height="@dimen/dream_overlay_bottom_affordance_height" android:scaleType="fitCenter"
android:layout_width="@dimen/dream_overlay_bottom_affordance_width" android:tint="?android:attr/textColorPrimary"
android:layout_gravity="bottom|start" android:src="@drawable/controls_icon"
android:padding="@dimen/dream_overlay_bottom_affordance_padding" android:contentDescription="@string/quick_controls_title" />
android:background="@drawable/dream_overlay_bottom_affordance_bg"
android:scaleType="fitCenter"
android:tint="?android:attr/textColorPrimary"
android:src="@drawable/controls_icon"
android:contentDescription="@string/quick_controls_title" />
</FrameLayout>

View File

@@ -17,13 +17,12 @@
<ImageView <ImageView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/media_entry_chip" android:id="@+id/media_entry_chip"
android:layout_height="@dimen/keyguard_affordance_fixed_height" android:layout_height="@dimen/dream_overlay_bottom_affordance_height"
android:layout_width="@dimen/keyguard_affordance_fixed_width" android:layout_width="@dimen/dream_overlay_bottom_affordance_width"
android:layout_gravity="bottom|start" android:layout_gravity="bottom|start"
android:scaleType="center" android:scaleType="fitCenter"
android:padding="@dimen/dream_overlay_bottom_affordance_padding"
android:tint="?android:attr/textColorPrimary" android:tint="?android:attr/textColorPrimary"
android:src="@drawable/ic_music_note" android:src="@drawable/ic_music_note"
android:background="@drawable/keyguard_bottom_affordance_bg" android:background="@drawable/dream_overlay_bottom_affordance_bg"
android:layout_marginStart="@dimen/keyguard_affordance_horizontal_offset"
android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset"
android:contentDescription="@string/controls_media_title" /> android:contentDescription="@string/controls_media_title" />

View File

@@ -1591,7 +1591,6 @@
<dimen name="dream_overlay_bottom_affordance_padding">14dp</dimen> <dimen name="dream_overlay_bottom_affordance_padding">14dp</dimen>
<dimen name="dream_overlay_complication_clock_time_text_size">86dp</dimen> <dimen name="dream_overlay_complication_clock_time_text_size">86dp</dimen>
<dimen name="dream_overlay_complication_clock_time_translation_y">28dp</dimen> <dimen name="dream_overlay_complication_clock_time_translation_y">28dp</dimen>
<dimen name="dream_overlay_complication_home_controls_padding">28dp</dimen>
<dimen name="dream_overlay_complication_clock_subtitle_text_size">24sp</dimen> <dimen name="dream_overlay_complication_clock_subtitle_text_size">24sp</dimen>
<dimen name="dream_overlay_complication_preview_text_size">36sp</dimen> <dimen name="dream_overlay_complication_preview_text_size">36sp</dimen>
<dimen name="dream_overlay_complication_preview_icon_padding">28dp</dimen> <dimen name="dream_overlay_complication_preview_icon_padding">28dp</dimen>

View File

@@ -33,7 +33,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLogger;
import com.android.systemui.CoreStartable; import com.android.systemui.CoreStartable;
import com.android.systemui.R;
import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.controls.ControlsServiceInfo; import com.android.systemui.controls.ControlsServiceInfo;
import com.android.systemui.controls.dagger.ControlsComponent; import com.android.systemui.controls.dagger.ControlsComponent;
@@ -157,14 +156,14 @@ public class DreamHomeControlsComplication implements Complication {
* Contains values/logic associated with the dream complication view. * Contains values/logic associated with the dream complication view.
*/ */
public static class DreamHomeControlsChipViewHolder implements ViewHolder { public static class DreamHomeControlsChipViewHolder implements ViewHolder {
private final View mView; private final ImageView mView;
private final ComplicationLayoutParams mLayoutParams; private final ComplicationLayoutParams mLayoutParams;
private final DreamHomeControlsChipViewController mViewController; private final DreamHomeControlsChipViewController mViewController;
@Inject @Inject
DreamHomeControlsChipViewHolder( DreamHomeControlsChipViewHolder(
DreamHomeControlsChipViewController dreamHomeControlsChipViewController, DreamHomeControlsChipViewController dreamHomeControlsChipViewController,
@Named(DREAM_HOME_CONTROLS_CHIP_VIEW) View view, @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) ImageView view,
@Named(DREAM_HOME_CONTROLS_CHIP_LAYOUT_PARAMS) ComplicationLayoutParams layoutParams @Named(DREAM_HOME_CONTROLS_CHIP_LAYOUT_PARAMS) ComplicationLayoutParams layoutParams
) { ) {
mView = view; mView = view;
@@ -174,7 +173,7 @@ public class DreamHomeControlsComplication implements Complication {
} }
@Override @Override
public View getView() { public ImageView getView() {
return mView; return mView;
} }
@@ -187,7 +186,7 @@ public class DreamHomeControlsComplication implements Complication {
/** /**
* Controls behavior of the dream complication. * Controls behavior of the dream complication.
*/ */
static class DreamHomeControlsChipViewController extends ViewController<View> { static class DreamHomeControlsChipViewController extends ViewController<ImageView> {
private static final String TAG = "DreamHomeControlsCtrl"; private static final String TAG = "DreamHomeControlsCtrl";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
@@ -216,7 +215,7 @@ public class DreamHomeControlsComplication implements Complication {
@Inject @Inject
DreamHomeControlsChipViewController( DreamHomeControlsChipViewController(
@Named(DREAM_HOME_CONTROLS_CHIP_VIEW) View view, @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) ImageView view,
ActivityStarter activityStarter, ActivityStarter activityStarter,
Context context, Context context,
ControlsComponent controlsComponent, ControlsComponent controlsComponent,
@@ -231,10 +230,9 @@ public class DreamHomeControlsComplication implements Complication {
@Override @Override
protected void onViewAttached() { protected void onViewAttached() {
final ImageView chip = mView.findViewById(R.id.home_controls_chip); mView.setImageResource(mControlsComponent.getTileImageId());
chip.setImageResource(mControlsComponent.getTileImageId()); mView.setContentDescription(mContext.getString(mControlsComponent.getTileTitleId()));
chip.setContentDescription(mContext.getString(mControlsComponent.getTileTitleId())); mView.setOnClickListener(this::onClickHomeControls);
chip.setOnClickListener(this::onClickHomeControls);
} }
@Override @Override

View File

@@ -19,7 +19,7 @@ package com.android.systemui.dreams.complication.dagger;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.widget.ImageView;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.dreams.complication.DreamHomeControlsComplication; import com.android.systemui.dreams.complication.DreamHomeControlsComplication;
@@ -74,8 +74,8 @@ public interface DreamHomeControlsComplicationComponent {
@Provides @Provides
@DreamHomeControlsComplicationScope @DreamHomeControlsComplicationScope
@Named(DREAM_HOME_CONTROLS_CHIP_VIEW) @Named(DREAM_HOME_CONTROLS_CHIP_VIEW)
static View provideHomeControlsChipView(LayoutInflater layoutInflater) { static ImageView provideHomeControlsChipView(LayoutInflater layoutInflater) {
return layoutInflater.inflate(R.layout.dream_overlay_home_controls_chip, return (ImageView) layoutInflater.inflate(R.layout.dream_overlay_home_controls_chip,
null, false); null, false);
} }
} }

View File

@@ -101,8 +101,8 @@ public interface RegisteredComplicationsModule {
@Named(DREAM_MEDIA_ENTRY_LAYOUT_PARAMS) @Named(DREAM_MEDIA_ENTRY_LAYOUT_PARAMS)
static ComplicationLayoutParams provideMediaEntryLayoutParams(@Main Resources res) { static ComplicationLayoutParams provideMediaEntryLayoutParams(@Main Resources res) {
return new ComplicationLayoutParams( return new ComplicationLayoutParams(
res.getDimensionPixelSize(R.dimen.keyguard_affordance_fixed_width), ViewGroup.LayoutParams.WRAP_CONTENT,
res.getDimensionPixelSize(R.dimen.keyguard_affordance_fixed_height), ViewGroup.LayoutParams.WRAP_CONTENT,
ComplicationLayoutParams.POSITION_BOTTOM ComplicationLayoutParams.POSITION_BOTTOM
| ComplicationLayoutParams.POSITION_START, | ComplicationLayoutParams.POSITION_START,
ComplicationLayoutParams.DIRECTION_END, ComplicationLayoutParams.DIRECTION_END,

View File

@@ -35,7 +35,6 @@ import android.view.View;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.animation.view.LaunchableImageView; import com.android.systemui.animation.view.LaunchableImageView;
import com.android.systemui.condition.SelfExecutingMonitor; import com.android.systemui.condition.SelfExecutingMonitor;
@@ -88,9 +87,6 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
@Captor @Captor
private ArgumentCaptor<ControlsListingController.ControlsListingCallback> mCallbackCaptor; private ArgumentCaptor<ControlsListingController.ControlsListingCallback> mCallbackCaptor;
@Mock
private View mView;
@Mock @Mock
private LaunchableImageView mHomeControlsView; private LaunchableImageView mHomeControlsView;
@@ -115,7 +111,6 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
when(mControlsComponent.getControlsListingController()).thenReturn( when(mControlsComponent.getControlsListingController()).thenReturn(
Optional.of(mControlsListingController)); Optional.of(mControlsListingController));
when(mControlsComponent.getVisibility()).thenReturn(AVAILABLE); when(mControlsComponent.getVisibility()).thenReturn(AVAILABLE);
when(mView.findViewById(R.id.home_controls_chip)).thenReturn(mHomeControlsView);
mMonitor = SelfExecutingMonitor.createInstance(); mMonitor = SelfExecutingMonitor.createInstance();
} }
@@ -223,7 +218,7 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
public void testClick_logsUiEvent() { public void testClick_logsUiEvent() {
final DreamHomeControlsComplication.DreamHomeControlsChipViewController viewController = final DreamHomeControlsComplication.DreamHomeControlsChipViewController viewController =
new DreamHomeControlsComplication.DreamHomeControlsChipViewController( new DreamHomeControlsComplication.DreamHomeControlsChipViewController(
mView, mHomeControlsView,
mActivityStarter, mActivityStarter,
mContext, mContext,
mControlsComponent, mControlsComponent,