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

Commit e0fa9f69 authored by Darrell Shi's avatar Darrell Shi
Browse files

Dream complications styling update.

- update complication weights so home controls, media entry chip, and
  smartspace are always shown below the clock
- instead of applying the bottom padding to home controls at the layout
  engine level in order to center align with smartspace, apply to the
  home controls chip view, which prevents the layout engine from giving
  an exception to adding padding to a root node

Bug: 259264239
Bug: 259719867
Test: https://screenshot.googleplex.com/BZNatvxHFHxqxaS
Test: https://screenshot.googleplex.com/9gxsLUZWTFy7sGX
Change-Id: Icfcc3653ad7eb52e707c8289803188388484666e
parent b96b7ad9
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -14,8 +14,13 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
-->
<ImageView
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:paddingVertical="@dimen/dream_overlay_complication_home_controls_padding">

    <ImageView
        android:id="@+id/home_controls_chip"
        android:layout_height="@dimen/keyguard_affordance_fixed_height"
        android:layout_width="@dimen/keyguard_affordance_fixed_width"
@@ -24,6 +29,6 @@
        android:tint="?android:attr/textColorPrimary"
        android:src="@drawable/controls_icon"
        android:background="@drawable/keyguard_bottom_affordance_bg"
    android:layout_marginStart="@dimen/keyguard_affordance_horizontal_offset"
    android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset"
        android:contentDescription="@string/quick_controls_title" />

</FrameLayout>
+1 −3
Original line number Diff line number Diff line
@@ -192,9 +192,7 @@ public class ComplicationLayoutEngine implements Complication.VisibilityControll
                        break;
                }

                // Add margin if specified by the complication. Otherwise add default margin
                // between complications.
                if (mLayoutParams.isMarginSpecified() || !isRoot) {
                if (!isRoot) {
                    final int margin = mLayoutParams.getMargin(mDefaultMargin);
                    switch(direction) {
                        case ComplicationLayoutParams.DIRECTION_DOWN:
+0 −7
Original line number Diff line number Diff line
@@ -260,13 +260,6 @@ public class ComplicationLayoutParams extends ViewGroup.LayoutParams {
        return mWeight;
    }

    /**
     * Returns whether margin has been specified by the complication.
     */
    public boolean isMarginSpecified() {
        return mMargin != MARGIN_UNSPECIFIED;
    }

    /**
     * Returns the margin to apply between complications, or the given default if no margin is
     * specified.
+8 −6
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.CoreStartable;
import com.android.systemui.R;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.controls.ControlsServiceInfo;
import com.android.systemui.controls.dagger.ControlsComponent;
@@ -151,7 +152,7 @@ public class DreamHomeControlsComplication implements Complication {
        @Inject
        DreamHomeControlsChipViewHolder(
                DreamHomeControlsChipViewController dreamHomeControlsChipViewController,
                @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) ImageView view,
                @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) View view,
                @Named(DREAM_HOME_CONTROLS_CHIP_LAYOUT_PARAMS) ComplicationLayoutParams layoutParams
        ) {
            mView = view;
@@ -174,7 +175,7 @@ public class DreamHomeControlsComplication implements Complication {
    /**
     * Controls behavior of the dream complication.
     */
    static class DreamHomeControlsChipViewController extends ViewController<ImageView> {
    static class DreamHomeControlsChipViewController extends ViewController<View> {
        private static final String TAG = "DreamHomeControlsCtrl";
        private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

@@ -203,7 +204,7 @@ public class DreamHomeControlsComplication implements Complication {

        @Inject
        DreamHomeControlsChipViewController(
                @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) ImageView view,
                @Named(DREAM_HOME_CONTROLS_CHIP_VIEW) View view,
                ActivityStarter activityStarter,
                Context context,
                ControlsComponent controlsComponent,
@@ -218,9 +219,10 @@ public class DreamHomeControlsComplication implements Complication {

        @Override
        protected void onViewAttached() {
            mView.setImageResource(mControlsComponent.getTileImageId());
            mView.setContentDescription(mContext.getString(mControlsComponent.getTileTitleId()));
            mView.setOnClickListener(this::onClickHomeControls);
            final ImageView chip = mView.findViewById(R.id.home_controls_chip);
            chip.setImageResource(mControlsComponent.getTileImageId());
            chip.setContentDescription(mContext.getString(mControlsComponent.getTileTitleId()));
            chip.setOnClickListener(this::onClickHomeControls);
        }

        @Override
+3 −3
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.systemui.dreams.complication.dagger;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import android.view.LayoutInflater;
import android.widget.ImageView;
import android.view.View;

import com.android.systemui.R;
import com.android.systemui.dreams.complication.DreamHomeControlsComplication;
@@ -74,8 +74,8 @@ public interface DreamHomeControlsComplicationComponent {
        @Provides
        @DreamHomeControlsComplicationScope
        @Named(DREAM_HOME_CONTROLS_CHIP_VIEW)
        static ImageView provideHomeControlsChipView(LayoutInflater layoutInflater) {
            return (ImageView) layoutInflater.inflate(R.layout.dream_overlay_home_controls_chip,
        static View provideHomeControlsChipView(LayoutInflater layoutInflater) {
            return layoutInflater.inflate(R.layout.dream_overlay_home_controls_chip,
                    null, false);
        }
    }
Loading