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

Commit 1880988d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make AllSetActivity IDP change-aware" into main

parents c2c79131 e57c0345
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@
                style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/allset_hint"
                android:textSize="@dimen/allset_page_swipe_up_text_size"
                android:gravity="center_horizontal"

+25 −7
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import androidx.core.graphics.ColorUtils;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
@@ -103,6 +104,9 @@ public class AllSetActivity extends Activity {

    private final AnimatedFloat mSwipeProgress = new AnimatedFloat(this::onSwipeProgressUpdate);

    private final InvariantDeviceProfile.OnIDPChangeListener mOnIDPChangeListener =
            modelPropertiesChanged -> updateHint();

    private TISBindHelper mTISBindHelper;

    private BgDrawable mBackground;
@@ -115,6 +119,8 @@ public class AllSetActivity extends Activity {

    private AnimatorPlaybackController mLauncherStartAnim = null;

    private TextView mHintView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -167,12 +173,9 @@ public class AllSetActivity extends Activity {
            }
        });

        TextView hint = findViewById(R.id.hint);
        DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(this).getDeviceProfile(this);
        if (!dp.isGestureMode) {
            hint.setText(R.string.allset_button_hint);
        }
        hint.setAccessibilityDelegate(new SkipButtonAccessibilityDelegate());
        mHintView = findViewById(R.id.hint);
        mHintView.setAccessibilityDelegate(new SkipButtonAccessibilityDelegate());
        updateHint();

        mTISBindHelper = new TISBindHelper(this, this::onTISConnected);

@@ -190,7 +193,21 @@ public class AllSetActivity extends Activity {
                        LOTTIE_TERTIARY_COLOR_TOKEN, R.color.all_set_bg_tertiary),
                getTheme());

        startBackgroundAnimation(dp.isTablet);
        startBackgroundAnimation(getDP().isTablet);
        getIDP().addOnChangeListener(mOnIDPChangeListener);
    }

    private InvariantDeviceProfile getIDP() {
        return LauncherAppState.getInstance(this).getInvariantDeviceProfile();
    }

    private DeviceProfile getDP() {
        return getIDP().getDeviceProfile(this);
    }

    private void updateHint() {
        mHintView.setText(
                getDP().isGestureMode ? R.string.allset_hint : R.string.allset_button_hint);
    }

    private void runOnUiHelperThread(Runnable runnable) {
@@ -311,6 +328,7 @@ public class AllSetActivity extends Activity {
    @Override
    protected void onDestroy() {
        super.onDestroy();
        getIDP().removeOnChangeListener(mOnIDPChangeListener);
        mTISBindHelper.onDestroy();
        clearBinderOverride();
        if (mBackgroundAnimatorListener != null) {