Loading bliss/src/foundation/e/bliss/widgets/WidgetContainer.kt +46 −41 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.appwidget.AppWidgetProviderInfo import android.content.ComponentName import android.content.Context import android.content.Intent import android.graphics.Insets import android.content.res.Configuration import android.graphics.Rect import android.os.Bundle import android.os.ServiceManager Loading @@ -34,7 +34,6 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.MotionEvent import android.view.View import android.view.View.OnLayoutChangeListener import android.view.ViewGroup import android.view.WindowInsets import android.widget.Button Loading Loading @@ -72,41 +71,33 @@ class WidgetContainer(context: Context, attrs: AttributeSet?) : FrameLayout(cont private val mLauncher by lazy { Launcher.getLauncher(context) } private lateinit var mRemoveWidgetLayout: FrameLayout private lateinit var mWrapper: LinearLayout private lateinit var mResizeContainer: RelativeLayout private lateinit var mWidgetLinearLayout: LinearLayout private var mWrapperChildCount = 0 private val mResizeContainerRect = Rect() private var mInsets: Insets? = null private val mInsetPadding = context.resources.getDimension(R.dimen.widget_page_inset_padding).toInt() private val layoutListener = OnLayoutChangeListener { view, _, _, _, _, _, _, _, _ -> val childCount = (view as LinearLayout).childCount if (mWrapperChildCount == childCount) return@OnLayoutChangeListener handleRemoveButtonVisibility(childCount) } override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) { super.setPadding(0, 0, 0, 0) } override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { if (mResizeContainer.visibility == VISIBLE && ev.action == MotionEvent.ACTION_DOWN) { mResizeContainer.getHitRect(mResizeContainerRect) if ( ev.action == MotionEvent.ACTION_DOWN && !mResizeContainerRect.contains(ev.x.toInt(), ev.y.toInt()) ) { if (!mResizeContainerRect.contains(ev.x.toInt(), ev.y.toInt())) { mLauncher.hideWidgetResizeContainer() } } return super.onInterceptTouchEvent(ev) } override fun onAttachedToWindow() { super.onAttachedToWindow() mInsets = mLauncher.workspace.rootWindowInsets.getInsets(WindowInsets.Type.systemBars()) mRemoveWidgetLayout = findViewById(R.id.remove_widget_parent) mResizeContainer = findViewById(R.id.widget_resizer_container) mWidgetLinearLayout = findViewById(R.id.widget_linear_layout) findViewById<Button>(R.id.manage_widgets).setOnClickListener { WidgetsFullSheet.show(mLauncher, true, true) Loading @@ -118,37 +109,51 @@ class WidgetContainer(context: Context, attrs: AttributeSet?) : FrameLayout(cont context.startActivity(intent) } mRemoveWidgetLayout = findViewById(R.id.remove_widget_parent) mWrapper = findViewWithTag<LinearLayout?>("wrapper_children").apply { addOnLayoutChangeListener(layoutListener) handleRemoveButtonVisibility(childCount) setOnHierarchyChangeListener( object : OnHierarchyChangeListener { override fun onChildViewAdded(parent: View?, child: View?) { handleRemoveButtonVisibility((parent as LinearLayout).childCount) } mResizeContainer = findViewById<RelativeLayout?>(R.id.widget_resizer_container).apply { override fun onChildViewRemoved(parent: View?, child: View?) { handleRemoveButtonVisibility((parent as LinearLayout).childCount) } } ) } updatePadding() } override fun onConfigurationChanged(newConfig: Configuration?) { super.onConfigurationChanged(newConfig) updatePadding() } private fun updatePadding() { val insets = mLauncher.workspace.rootWindowInsets.getInsets(WindowInsets.Type.systemBars()) if (::mResizeContainer.isInitialized) { mResizeContainer.apply { val layoutParams = this.layoutParams as LayoutParams layoutParams.bottomMargin = mInsetPadding + (mInsets?.bottom ?: 0) layoutParams.bottomMargin = mInsetPadding + (insets.bottom) this.layoutParams = layoutParams } } findViewById<LinearLayout>(R.id.widget_linear_layout).apply { if (::mWidgetLinearLayout.isInitialized) { mWidgetLinearLayout.apply { setPadding( this.paddingLeft, mInsetPadding + (mInsets?.top ?: 0), mInsetPadding + (insets.top), this.paddingRight, (mInsets?.bottom ?: 0), (insets.bottom), ) } } override fun onDetachedFromWindow() { super.onDetachedFromWindow() mWrapper.removeOnLayoutChangeListener(layoutListener) } private fun handleRemoveButtonVisibility(childCount: Int) { mWrapperChildCount = childCount CoroutineScope(Dispatchers.Main).launch { if (childCount == 0) { mRemoveWidgetLayout.visibility = View.GONE Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +12 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public class StatusBarTouchController implements TouchController { private void dispatchTouchEvent(MotionEvent ev) { mLastAction = ev.getActionMasked(); if (MultiModeController.isSingleLayerMode()) { if (ev.getAction() == ACTION_UP && mLauncher.getWorkspace().getCurrentPage() != 0) { if (ev.getAction() == ACTION_UP) { mLauncher.toggleSwipeSearchState(); } } else if (mSystemUiProxy.isActive()) { Loading @@ -99,14 +99,16 @@ public class StatusBarTouchController implements TouchController { if (!mCanIntercept) { return false; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); if (MultiModeController.isSingleLayerMode() && mLauncher.swipeSearchContainer != null && mLauncher.swipeSearchContainer.getVisibility() == View.VISIBLE && ev.getY(idx) > mLauncher.swipeSearchContainer.getHeight()) { setWindowSlippery(true); return true; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { // Check!! should only set it only when threshold is not entered. mDownEvents.put(pid, new PointF(ev.getX(idx), ev.getY(idx))); Loading @@ -122,8 +124,7 @@ public class StatusBarTouchController implements TouchController { // when there is single touch event. (context: InputDispatcher.cpp line 1445) if (dy > mTouchSlop && dy > Math.abs(dx) && ev.getPointerCount() == 1 && (!MultiModeController.isSingleLayerMode() || (mLauncher.swipeSearchContainer.getVisibility() == View.GONE && mLauncher.getWorkspace().getCurrentPage() != 0))) { mLauncher.swipeSearchContainer.getVisibility() == View.GONE)) { ev.setAction(ACTION_DOWN); dispatchTouchEvent(ev); setWindowSlippery(true); Loading Loading @@ -181,6 +182,12 @@ public class StatusBarTouchController implements TouchController { return false; } } if (MultiModeController.isSingleLayerMode() && mLauncher.getWorkspace().getCurrentPage() == 0) { return false; } return SystemUiProxy.INSTANCE.get(mLauncher).isActive(); } } No newline at end of file src/com/android/launcher3/Workspace.java +16 −5 Original line number Diff line number Diff line Loading @@ -1507,10 +1507,21 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> @Override public void setCurrentPage(int currentPage, int overridePrevPage) { if (MultiModeController.isSingleLayerMode()) { if (currentPage == FIRST_SCREEN_ID) { Hotseat hotseat = getHotseat(); int height = hotseat.getHeight() + getPageIndicator().getHeight(); if (hotseat.getTranslationY() >= 0) { hotseat.setForcedTranslationY(hotseat.getHeight() + getPageIndicator().getHeight()); hotseat.setForcedTranslationY(height); } PageIndicatorDots pageIndicatorDots = (PageIndicatorDots) getPageIndicator(); if (pageIndicatorDots.getTranslationY() >= 0) { pageIndicatorDots.setForcedTranslationY(height); } mLauncher.mBlurLayer.setAlpha(1); getWindowInsetsController().hide(WindowInsetsCompat.Type.statusBars()); } } super.setCurrentPage(currentPage, overridePrevPage); Loading Loading
bliss/src/foundation/e/bliss/widgets/WidgetContainer.kt +46 −41 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.appwidget.AppWidgetProviderInfo import android.content.ComponentName import android.content.Context import android.content.Intent import android.graphics.Insets import android.content.res.Configuration import android.graphics.Rect import android.os.Bundle import android.os.ServiceManager Loading @@ -34,7 +34,6 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.MotionEvent import android.view.View import android.view.View.OnLayoutChangeListener import android.view.ViewGroup import android.view.WindowInsets import android.widget.Button Loading Loading @@ -72,41 +71,33 @@ class WidgetContainer(context: Context, attrs: AttributeSet?) : FrameLayout(cont private val mLauncher by lazy { Launcher.getLauncher(context) } private lateinit var mRemoveWidgetLayout: FrameLayout private lateinit var mWrapper: LinearLayout private lateinit var mResizeContainer: RelativeLayout private lateinit var mWidgetLinearLayout: LinearLayout private var mWrapperChildCount = 0 private val mResizeContainerRect = Rect() private var mInsets: Insets? = null private val mInsetPadding = context.resources.getDimension(R.dimen.widget_page_inset_padding).toInt() private val layoutListener = OnLayoutChangeListener { view, _, _, _, _, _, _, _, _ -> val childCount = (view as LinearLayout).childCount if (mWrapperChildCount == childCount) return@OnLayoutChangeListener handleRemoveButtonVisibility(childCount) } override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) { super.setPadding(0, 0, 0, 0) } override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { if (mResizeContainer.visibility == VISIBLE && ev.action == MotionEvent.ACTION_DOWN) { mResizeContainer.getHitRect(mResizeContainerRect) if ( ev.action == MotionEvent.ACTION_DOWN && !mResizeContainerRect.contains(ev.x.toInt(), ev.y.toInt()) ) { if (!mResizeContainerRect.contains(ev.x.toInt(), ev.y.toInt())) { mLauncher.hideWidgetResizeContainer() } } return super.onInterceptTouchEvent(ev) } override fun onAttachedToWindow() { super.onAttachedToWindow() mInsets = mLauncher.workspace.rootWindowInsets.getInsets(WindowInsets.Type.systemBars()) mRemoveWidgetLayout = findViewById(R.id.remove_widget_parent) mResizeContainer = findViewById(R.id.widget_resizer_container) mWidgetLinearLayout = findViewById(R.id.widget_linear_layout) findViewById<Button>(R.id.manage_widgets).setOnClickListener { WidgetsFullSheet.show(mLauncher, true, true) Loading @@ -118,37 +109,51 @@ class WidgetContainer(context: Context, attrs: AttributeSet?) : FrameLayout(cont context.startActivity(intent) } mRemoveWidgetLayout = findViewById(R.id.remove_widget_parent) mWrapper = findViewWithTag<LinearLayout?>("wrapper_children").apply { addOnLayoutChangeListener(layoutListener) handleRemoveButtonVisibility(childCount) setOnHierarchyChangeListener( object : OnHierarchyChangeListener { override fun onChildViewAdded(parent: View?, child: View?) { handleRemoveButtonVisibility((parent as LinearLayout).childCount) } mResizeContainer = findViewById<RelativeLayout?>(R.id.widget_resizer_container).apply { override fun onChildViewRemoved(parent: View?, child: View?) { handleRemoveButtonVisibility((parent as LinearLayout).childCount) } } ) } updatePadding() } override fun onConfigurationChanged(newConfig: Configuration?) { super.onConfigurationChanged(newConfig) updatePadding() } private fun updatePadding() { val insets = mLauncher.workspace.rootWindowInsets.getInsets(WindowInsets.Type.systemBars()) if (::mResizeContainer.isInitialized) { mResizeContainer.apply { val layoutParams = this.layoutParams as LayoutParams layoutParams.bottomMargin = mInsetPadding + (mInsets?.bottom ?: 0) layoutParams.bottomMargin = mInsetPadding + (insets.bottom) this.layoutParams = layoutParams } } findViewById<LinearLayout>(R.id.widget_linear_layout).apply { if (::mWidgetLinearLayout.isInitialized) { mWidgetLinearLayout.apply { setPadding( this.paddingLeft, mInsetPadding + (mInsets?.top ?: 0), mInsetPadding + (insets.top), this.paddingRight, (mInsets?.bottom ?: 0), (insets.bottom), ) } } override fun onDetachedFromWindow() { super.onDetachedFromWindow() mWrapper.removeOnLayoutChangeListener(layoutListener) } private fun handleRemoveButtonVisibility(childCount: Int) { mWrapperChildCount = childCount CoroutineScope(Dispatchers.Main).launch { if (childCount == 0) { mRemoveWidgetLayout.visibility = View.GONE Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +12 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ public class StatusBarTouchController implements TouchController { private void dispatchTouchEvent(MotionEvent ev) { mLastAction = ev.getActionMasked(); if (MultiModeController.isSingleLayerMode()) { if (ev.getAction() == ACTION_UP && mLauncher.getWorkspace().getCurrentPage() != 0) { if (ev.getAction() == ACTION_UP) { mLauncher.toggleSwipeSearchState(); } } else if (mSystemUiProxy.isActive()) { Loading @@ -99,14 +99,16 @@ public class StatusBarTouchController implements TouchController { if (!mCanIntercept) { return false; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); if (MultiModeController.isSingleLayerMode() && mLauncher.swipeSearchContainer != null && mLauncher.swipeSearchContainer.getVisibility() == View.VISIBLE && ev.getY(idx) > mLauncher.swipeSearchContainer.getHeight()) { setWindowSlippery(true); return true; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { // Check!! should only set it only when threshold is not entered. mDownEvents.put(pid, new PointF(ev.getX(idx), ev.getY(idx))); Loading @@ -122,8 +124,7 @@ public class StatusBarTouchController implements TouchController { // when there is single touch event. (context: InputDispatcher.cpp line 1445) if (dy > mTouchSlop && dy > Math.abs(dx) && ev.getPointerCount() == 1 && (!MultiModeController.isSingleLayerMode() || (mLauncher.swipeSearchContainer.getVisibility() == View.GONE && mLauncher.getWorkspace().getCurrentPage() != 0))) { mLauncher.swipeSearchContainer.getVisibility() == View.GONE)) { ev.setAction(ACTION_DOWN); dispatchTouchEvent(ev); setWindowSlippery(true); Loading Loading @@ -181,6 +182,12 @@ public class StatusBarTouchController implements TouchController { return false; } } if (MultiModeController.isSingleLayerMode() && mLauncher.getWorkspace().getCurrentPage() == 0) { return false; } return SystemUiProxy.INSTANCE.get(mLauncher).isActive(); } } No newline at end of file
src/com/android/launcher3/Workspace.java +16 −5 Original line number Diff line number Diff line Loading @@ -1507,10 +1507,21 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> @Override public void setCurrentPage(int currentPage, int overridePrevPage) { if (MultiModeController.isSingleLayerMode()) { if (currentPage == FIRST_SCREEN_ID) { Hotseat hotseat = getHotseat(); int height = hotseat.getHeight() + getPageIndicator().getHeight(); if (hotseat.getTranslationY() >= 0) { hotseat.setForcedTranslationY(hotseat.getHeight() + getPageIndicator().getHeight()); hotseat.setForcedTranslationY(height); } PageIndicatorDots pageIndicatorDots = (PageIndicatorDots) getPageIndicator(); if (pageIndicatorDots.getTranslationY() >= 0) { pageIndicatorDots.setForcedTranslationY(height); } mLauncher.mBlurLayer.setAlpha(1); getWindowInsetsController().hide(WindowInsetsCompat.Type.statusBars()); } } super.setCurrentPage(currentPage, overridePrevPage); Loading