Introducing the MSDLPlayer in Launcher via a wrapper singleton.
The player is the main API to the MSDL library (also used in SysUI) that implements the Multi-sensory Design Language in the system UI. This CL also includes an example of the API usage, when the user swipes up to reveal AllApps, or taps on QSB. Test: manual. Verified that the MSDL haptics play when swiping to reveal AllApps and tapping on QSB. Flag: com.android.launcher3.msdl_feedback Bug: 371322466 Bug: 371250001 Change-Id: Ie13fd5494efc9fc80cdb94a7bdd6e20b2e4633a8
This commit is contained in:
1 parent
230b2f50a7
commit
9c774c4cf0
4 files changed
+80
-5
No files matched your search
@@ -48,6 +48,7 @@ import androidx.annotation.Nullable;
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
@@ -57,14 +58,16 @@ import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.AllAppsSwipeController;
|
||||
import com.android.launcher3.util.MSDLPlayerWrapper;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.ScrollableLayoutManager;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.VibratorWrapper;
|
||||
import com.android.launcher3.views.ScrimView;
|
||||
|
||||
import com.google.android.msdl.data.model.MSDLToken;
|
||||
|
||||
/**
|
||||
* Handles AllApps view transition.
|
||||
* 1) Slides all apps view using direct manipulation
|
||||
@@ -186,7 +189,7 @@ public class AllAppsTransitionController
|
||||
private boolean mIsTablet;
|
||||
|
||||
private boolean mHasScaleEffect;
|
||||
private final VibratorWrapper mVibratorWrapper;
|
||||
private final MSDLPlayerWrapper mMSDLPlayerWrapper;
|
||||
|
||||
public AllAppsTransitionController(Launcher l) {
|
||||
mLauncher = l;
|
||||
@@ -200,7 +203,7 @@ public class AllAppsTransitionController
|
||||
setShiftRange(dp.allAppsShiftRange);
|
||||
mAllAppScale.value = 1;
|
||||
mLauncher.addOnDeviceProfileChangeListener(this);
|
||||
mVibratorWrapper = VibratorWrapper.INSTANCE.get(mLauncher.getApplicationContext());
|
||||
mMSDLPlayerWrapper = MSDLPlayerWrapper.INSTANCE.get(mLauncher.getApplicationContext());
|
||||
}
|
||||
|
||||
public float getShiftRange() {
|
||||
@@ -373,8 +376,16 @@ public class AllAppsTransitionController
|
||||
setAlphas(toState, config, builder);
|
||||
// This controls both haptics for tapping on QSB and going to all apps.
|
||||
if (ALL_APPS.equals(toState) && mLauncher.isInState(NORMAL)) {
|
||||
mLauncher.getAppsView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
if (Flags.msdlFeedback()) {
|
||||
if (config.isUserControlled()) {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.SWIPE_THRESHOLD_INDICATOR);
|
||||
} else {
|
||||
mMSDLPlayerWrapper.playToken(MSDLToken.TAP_HIGH_EMPHASIS);
|
||||
}
|
||||
} else {
|
||||
mLauncher.getAppsView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user