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

Commit 0f405d78 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove unused hints code." into ub-launcher3-qt-r1-dev

parents 355a04ed f3231f41
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.PropertySetter;
import com.android.quickstep.hints.ProactiveHintsContainer;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.RecentsView;
@@ -55,14 +54,6 @@ public final class RecentsViewStateController extends
        if (state.overviewUi) {
            mRecentsView.updateEmptyMessage();
            mRecentsView.resetTaskVisuals();
            mRecentsView.setHintVisibility(1f);
        } else {
            mRecentsView.setHintVisibility(0f);
            ProactiveHintsContainer
                    proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
            if (proactiveHintsContainer != null) {
                proactiveHintsContainer.removeAllViews();
            }
        }
        setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state.getVisibleElements(mLauncher));
        mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress());
@@ -75,14 +66,6 @@ public final class RecentsViewStateController extends

        if (!toState.overviewUi) {
            builder.addOnFinishRunnable(mRecentsView::resetTaskVisuals);
            mRecentsView.setHintVisibility(0f);
            builder.addOnFinishRunnable(() -> {
                ProactiveHintsContainer
                        proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
                if (proactiveHintsContainer != null) {
                    proactiveHintsContainer.removeAllViews();
                }
            });
        }

        if (toState.overviewUi) {
@@ -94,7 +77,6 @@ public final class RecentsViewStateController extends
            updateAnim.setDuration(config.duration);
            builder.play(updateAnim);
            mRecentsView.updateEmptyMessage();
            builder.addOnFinishRunnable(() -> mRecentsView.setHintVisibility(1f));
        }

        PropertySetter propertySetter = config.getPropertySetter(builder);
+0 −78
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep.hints;

import android.app.PendingIntent;
import android.graphics.drawable.Icon;
import android.os.Bundle;

public final class HintUtil {

    public static final String ID_KEY = "id";
    public static final String ICON_KEY = "icon";
    public static final String TEXT_KEY = "text";
    public static final String TAP_ACTION_KEY = "tap_action";

    private HintUtil() {}

    public static Bundle makeHint(String id, Icon icon, CharSequence text) {
        Bundle hint = new Bundle();
        hint.putString(ID_KEY, id);
        hint.putParcelable(ICON_KEY, icon);
        hint.putCharSequence(TEXT_KEY, text);
        return hint;
    }

    public static Bundle makeHint(Icon icon, CharSequence text, PendingIntent tapAction) {
        Bundle hint = new Bundle();
        hint.putParcelable(ICON_KEY, icon);
        hint.putCharSequence(TEXT_KEY, text);
        hint.putParcelable(TAP_ACTION_KEY, tapAction);
        return hint;
    }

    public static String getId(Bundle hint) {
        String id = hint.getString(ID_KEY);
        if (id == null) {
            throw new IllegalArgumentException("Hint does not contain an ID");
        }
        return id;
    }

    public static Icon getIcon(Bundle hint) {
        Icon icon = hint.getParcelable(ICON_KEY);
        if (icon == null) {
            throw new IllegalArgumentException("Hint does not contain an icon");
        }
        return icon;
    }

    public static CharSequence getText(Bundle hint) {
        CharSequence text = hint.getCharSequence(TEXT_KEY);
        if (text == null) {
            throw new IllegalArgumentException("Hint does not contain text");
        }
        return text;
    }

    public static PendingIntent getTapAction(Bundle hint) {
        PendingIntent tapAction = hint.getParcelable(TAP_ACTION_KEY);
        if (tapAction == null) {
            throw new IllegalArgumentException("Hint does not contain a tap action");
        }
        return tapAction;
    }
}
+0 −71
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep.hints;

import static com.android.quickstep.hints.HintUtil.getIcon;
import static com.android.quickstep.hints.HintUtil.getText;

import android.content.Context;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.android.launcher3.R;

public class HintView extends LinearLayout {
    private ImageView mIconView;
    private TextView mLabelView;

    public HintView(Context context) {
        super(context);
    }

    public HintView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public HintView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public HintView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public void setHint(Bundle hint) {
        mLabelView.setText(getText(hint));

        Icon icon = getIcon(hint);
        if (icon == null) {
            mIconView.setVisibility(GONE);
        } else {
            mIconView.setImageIcon(icon);
            mIconView.setVisibility(VISIBLE);
        }
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mIconView = findViewById(R.id.icon);
        mLabelView = findViewById(R.id.label);
    }
}
+0 −55
Original line number Diff line number Diff line
package com.android.quickstep.hints;

import android.content.Context;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.View;
import android.widget.FrameLayout;

public class ProactiveHintsContainer extends FrameLayout {

  public static final FloatProperty<ProactiveHintsContainer> HINT_VISIBILITY =
      new FloatProperty<ProactiveHintsContainer>("hint_visibility") {
        @Override
        public void setValue(ProactiveHintsContainer proactiveHintsContainer, float v) {
          proactiveHintsContainer.setHintVisibility(v);
        }

        @Override
        public Float get(ProactiveHintsContainer proactiveHintsContainer) {
          return proactiveHintsContainer.mHintVisibility;
        }
      };

  private float mHintVisibility;

  public ProactiveHintsContainer(Context context) {
    super(context);
  }

  public ProactiveHintsContainer(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
  }

  public void setView(View v) {
    removeAllViews();
    addView(v);
  }

  public void setHintVisibility(float v) {
    if (v == 1) {
      setVisibility(VISIBLE);
    } else {
      setVisibility(GONE);
    }
    mHintVisibility = v;
  }
}
+0 −28
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep.hints;

public final class UiHintListenerConstants {

    private UiHintListenerConstants() {}

    // Operations
    public static final int ON_HINTS_RETURNED_CODE = 5;

    // Keys
    public static final String SESSION_ID_KEY = "session_id";
    public static final String HINTS_KEY = "hints";
}
Loading