Commit 8008aa1e authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Bind LeftPanel scroll with Workspace

parent dfc7491d
Pipeline #134078 passed with stage
in 2 minutes and 57 seconds
......@@ -33,7 +33,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly fileTree(dir: "../app/libs", include: 'framework.jar')
//compileOnly fileTree(dir: "../app/libs", include: 'framework.jar')
implementation project(':QuickstepCompat')
implementation project(':QuickstepCompatVQ')
......
......@@ -109,7 +109,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
compileOnly files('libs/framework.jar')
//compileOnly files('libs/framework.jar')
implementation project(':SystemUISharedLib')
apiNougatImplementation 'org.cyanogenmod:platform.sdk:6.0'
apiOreoImplementation files('libs/lineage-sdk-oreo.jar')
......
......@@ -6,7 +6,6 @@ import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.View
import android.view.WindowInsets
import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider
import foundation.e.blisslauncher.core.blur.ShaderBlurDrawable
import foundation.e.blisslauncher.core.runOnMainThread
......
......@@ -5,7 +5,6 @@ import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.WindowInsets
import android.widget.GridLayout
import foundation.e.blisslauncher.BlissLauncher
import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider
......
......@@ -29,12 +29,10 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.GridLayout;
import android.widget.Toast;
import foundation.e.blisslauncher.BuildConfig;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.core.Utilities;
......@@ -70,13 +68,11 @@ import foundation.e.blisslauncher.features.test.dragndrop.DropTarget;
import foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController;
import foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider;
import foundation.e.blisslauncher.features.test.uninstall.UninstallHelper;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import org.jetbrains.annotations.NotNull;
public class LauncherPagedView extends PagedView<PageIndicatorDots> implements View.OnTouchListener,
......@@ -1126,19 +1122,20 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
((amount >= 0 && !mIsRtl) || (amount <= 0 && mIsRtl));
if (shouldScrollOverlay) {
Log.d(TAG, "overScroll() called with: amount = [" + amount + "]");
if (!mStartedSendingScrollEvents && mScrollInteractionBegan) {
mStartedSendingScrollEvents = true;
mLauncherOverlay.onScrollInteractionBegin();
}
mLastOverlayScroll = Math.abs(((float) amount) / getMeasuredWidth());
mLauncherOverlay.onScrollChange(mLastOverlayScroll, mIsRtl);
mLauncherOverlay.onScrollChange(mLastOverlayScroll, true, mIsRtl);
} else {
dampedOverScroll(amount);
}
if (shouldZeroOverlay) {
mLauncherOverlay.onScrollChange(0, mIsRtl);
mLauncherOverlay.onScrollChange(0, true, mIsRtl);
}
}
......@@ -2351,6 +2348,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
* The overlay scroll is being controlled locally, just update our overlay effect
*/
public void onOverlayScrollChanged(float scroll) {
Log.d(TAG, "onOverlayScrollChanged() called with: scroll = [" + scroll + "]");
if (Float.compare(scroll, 1f) == 0) {
mOverlayShown = true;
// Not announcing the overlay page for accessibility since it announces itself.
......@@ -2461,6 +2459,10 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
});
}
public void computeScrollWithoutInvalidation() {
computeScrollHelper(false);
}
public interface ItemOperator {
/**
* Process the next itemInfo, possibly with side-effect on the next item.
......
......@@ -16,7 +16,6 @@ package foundation.e.blisslauncher.core.customviews;
* limitations under the License.
*/
import static foundation.e.blisslauncher.core.touch.OverScroll.OVERSCROLL_DAMP_FACTOR;
import android.animation.LayoutTransition;
......@@ -53,7 +52,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
protected static final int INVALID_PAGE = -1;
protected static final ComputePageScrollsLogic SIMPLE_SCROLL_LOGIC =
(v) -> v.getVisibility() != GONE;
(v) -> v.getVisibility() != GONE;
public static final int PAGE_SNAP_ANIMATION_DURATION = 750;
......@@ -157,10 +156,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
super(context, attrs, defStyle);
Log.d(TAG, "PagedView() called with: context = [" + context + "], attrs = [" + attrs +
"], defStyle = [" + defStyle + "]");
"], defStyle = [" + defStyle + "]");
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.PagedView, defStyle, 0);
R.styleable.PagedView, defStyle, 0
);
mPageIndicatorViewId = a.getResourceId(R.styleable.PagedView_pageIndicator, -1);
a.recycle();
......@@ -405,7 +405,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
if (getUnboundedScrollX() != mScroller.getCurrPos()
|| mOverScrollX != mScroller.getCurrPos()) {
|| mOverScrollX != mScroller.getCurrPos()) {
scrollTo(mScroller.getCurrPos(), 0);
}
if (shouldInvalidate) {
......@@ -438,7 +438,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public int getNormalChildHeight() {
return getExpectedHeight() - getPaddingTop() - getPaddingBottom()
- mInsets.top - mInsets.bottom;
- mInsets.top - mInsets.bottom;
}
public int getExpectedWidth() {
......@@ -448,7 +448,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// Used for recents view.
public int getNormalChildWidth() {
return getExpectedWidth() - getPaddingLeft() - getPaddingRight()
- mInsets.left - mInsets.right;
- mInsets.left - mInsets.right;
}
@Override
......@@ -493,9 +493,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (DEBUG) Log.d(TAG, "PagedView.onMeasure(): " + widthSize + ", " + heightSize);
int myWidthSpec = MeasureSpec.makeMeasureSpec(
widthSize - mInsets.left - mInsets.right, MeasureSpec.EXACTLY);
widthSize - mInsets.left - mInsets.right, MeasureSpec.EXACTLY);
int myHeightSpec = MeasureSpec.makeMeasureSpec(
heightSize - mInsets.top - mInsets.bottom, MeasureSpec.EXACTLY);
heightSize - mInsets.top - mInsets.bottom, MeasureSpec.EXACTLY);
// measureChildren takes accounts for content padding, we only need to care about extra
// space due to insets.
......@@ -535,13 +535,17 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
transition.addTransitionListener(new LayoutTransition.TransitionListener() {
@Override
public void startTransition(LayoutTransition transition, ViewGroup container,
View view, int transitionType) {
public void startTransition(
LayoutTransition transition, ViewGroup container,
View view, int transitionType
) {
}
@Override
public void endTransition(LayoutTransition transition, ViewGroup container,
View view, int transitionType) {
public void endTransition(
LayoutTransition transition, ViewGroup container,
View view, int transitionType
) {
// Wait until all transitions are complete.
if (!transition.isRunning()) {
transition.removeTransitionListener(this);
......@@ -567,8 +571,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
* Initializes {@code outPageScrolls} with scroll positions for view at that index. The length
* of {@code outPageScrolls} should be same as the the childCount
*/
protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
ComputePageScrollsLogic scrollLogic) {
protected boolean getPageScrolls(
int[] outPageScrolls, boolean layoutChildren,
ComputePageScrollsLogic scrollLogic
) {
final int childCount = getChildCount();
final int startIndex = mIsRtl ? childCount - 1 : 0;
......@@ -576,13 +582,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
final int delta = mIsRtl ? -1 : 1;
final int verticalCenter = (getPaddingTop() + getMeasuredHeight() + mInsets.top
- mInsets.bottom - getPaddingBottom()) / 2;
- mInsets.bottom - getPaddingBottom()) / 2;
final int scrollOffsetLeft = mInsets.left + getPaddingLeft();
final int scrollOffsetRight = getWidth() - getPaddingRight() - mInsets.right;
boolean pageScrollChanged = false;
for (int i = startIndex, childLeft = scrollOffsetLeft + offsetForPageScrolls(); i != endIndex; i += delta) {
for (int i = startIndex, childLeft =
scrollOffsetLeft + offsetForPageScrolls(); i != endIndex; i += delta) {
final View child = getPageAt(i);
if (scrollLogic.shouldIncludeView(child)) {
final int childWidth = child.getMeasuredWidth();
......@@ -597,8 +604,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// In case the pages are of different width, align the page to left or right edge
// based on the orientation.
final int pageScroll = mIsRtl
? (childLeft - scrollOffsetLeft)
: Math.max(0, childRight - scrollOffsetRight);
? (childLeft - scrollOffsetLeft)
: Math.max(0, childRight - scrollOffsetRight);
if (outPageScrolls[i] != pageScroll) {
pageScrollChanged = true;
outPageScrolls[i] = pageScroll;
......@@ -651,7 +658,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return 0;
}
@Override
public void onViewAdded(View child) {
super.onViewAdded(child);
......@@ -824,7 +830,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
*/
final int action = ev.getAction();
if ((action == MotionEvent.ACTION_MOVE) &&
(mTouchState == TOUCH_STATE_SCROLLING)) {
(mTouchState == TOUCH_STATE_SCROLLING)) {
return true;
}
......@@ -863,7 +869,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
*/
final int xDist = Math.abs(mScroller.getFinalPos() - mScroller.getCurrPos());
final boolean finishedScrolling =
(mScroller.isFinished() || xDist < mTouchSlop / 3);
(mScroller.isFinished() || xDist < mTouchSlop / 3);
if (finishedScrolling) {
mTouchState = TOUCH_STATE_REST;
......@@ -1027,7 +1033,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
} else {
dampedOverScroll(amount);
} }
}
}
protected void enableFreeScroll(boolean settleOnPageInFreeScroll) {
setEnableFreeScroll(true);
......@@ -1113,8 +1120,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
} else {
awakenScrollBars();
}
}
else {
} else {
determineScrollingStart(ev);
}
break;
......@@ -1130,11 +1136,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
final int deltaX = (int) (x - mDownMotionX);
final int pageWidth = getPageAt(mCurrentPage).getMeasuredWidth();
boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
SIGNIFICANT_MOVE_THRESHOLD;
SIGNIFICANT_MOVE_THRESHOLD;
mTotalMotionX += Math.abs(mLastMotionX + mLastMotionXRemainder - x);
boolean isFling =
mTotalMotionX > mTouchSlop && shouldFlingForVelocity(velocityX);
mTotalMotionX > mTouchSlop && shouldFlingForVelocity(velocityX);
boolean isDeltaXLeft = mIsRtl ? deltaX > 0 : deltaX < 0;
boolean isVelocityXLeft = mIsRtl ? velocityX > 0 : velocityX < 0;
......@@ -1145,7 +1151,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// just return to the starting page, or if we should skip one further.
boolean returnToOriginalPage = false;
if (Math.abs(deltaX) > pageWidth * RETURN_TO_ORIGINAL_PAGE_THRESHOLD &&
Math.signum(velocityX) != Math.signum(deltaX) && isFling) {
Math.signum(velocityX) != Math.signum(deltaX) && isFling) {
returnToOriginalPage = true;
}
......@@ -1156,12 +1162,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// move to the left and fling to the right will register as a fling to
// the right.
if (((isSignificantMove && !isDeltaXLeft && !isFling) ||
(isFling && !isVelocityXLeft)) && mCurrentPage > 0) {
(isFling && !isVelocityXLeft)) && mCurrentPage > 0) {
finalPage = returnToOriginalPage ? mCurrentPage : mCurrentPage - 1;
snapToPageWithVelocity(finalPage, velocityX);
} else if (((isSignificantMove && isDeltaXLeft && !isFling) ||
(isFling && isVelocityXLeft)) &&
mCurrentPage < getChildCount() - 1) {
(isFling && isVelocityXLeft)) &&
mCurrentPage < getChildCount() - 1) {
finalPage = returnToOriginalPage ? mCurrentPage : mCurrentPage + 1;
snapToPageWithVelocity(finalPage, velocityX);
} else {
......@@ -1181,10 +1187,15 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
} else {
mScroller.setInterpolator(mDefaultInterpolator);
mScroller.fling(initialScrollX,
-velocityX, mMinScroll, mMaxScroll, Math.round(getWidth() * 0.5f * OVERSCROLL_DAMP_FACTOR));
-velocityX,
mMinScroll,
mMaxScroll,
Math.round(getWidth() * 0.5f * OVERSCROLL_DAMP_FACTOR)
);
int finalX = mScroller.getFinalPos();
mNextPage = getPageNearestToCenterOfScreen(finalX);
int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
int firstPageScroll =
getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
if (finalX > 0
&& finalX < mMaxScroll) {
......@@ -1208,13 +1219,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mScroller.extendDuration(extraScrollDuration);
}
}
}
invalidate();
}
onScrollInteractionEnd();
}
else if (mTouchState == TOUCH_STATE_PREV_PAGE) {
} else if (mTouchState == TOUCH_STATE_PREV_PAGE) {
// at this point we have not moved beyond the touch slop
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
// we can just page
......@@ -1224,8 +1233,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
} else {
snapToDestination();
}
}
else if (mTouchState == TOUCH_STATE_NEXT_PAGE) {
} else if (mTouchState == TOUCH_STATE_NEXT_PAGE) {
// at this point we have not moved beyond the touch slop
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
// we can just page
......@@ -1294,7 +1302,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
if (hScroll != 0 || vScroll != 0) {
boolean isForwardScroll = mIsRtl ? (hScroll < 0 || vScroll < 0)
: (hScroll > 0 || vScroll > 0);
: (hScroll > 0 || vScroll > 0);
if (isForwardScroll) {
scrollRight();
} else {
......@@ -1325,7 +1333,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
private void onSecondaryPointerUp(MotionEvent ev) {
final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >>
MotionEvent.ACTION_POINTER_INDEX_SHIFT;
MotionEvent.ACTION_POINTER_INDEX_SHIFT;
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
......@@ -1418,7 +1426,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// duration as a function of the distance the page needs to travel.
float distanceRatio = Math.min(1f, 1.0f * Math.abs(delta) / (2 * halfScreenSize));
float distance = halfScreenSize + halfScreenSize *
distanceInfluenceForSnapDuration(distanceRatio);
distanceInfluenceForSnapDuration(distanceRatio);
velocity = Math.abs(velocity);
velocity = Math.max(mMinSnapVelocity, velocity);
......@@ -1456,10 +1464,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
}
protected boolean snapToPage(int whichPage, int delta, int duration, boolean immediate) {
Log.d(TAG,
"snapToPage() called with: whichPage = [" + whichPage + "], delta = [" + delta +
"], duration = [" + duration + "], immediate = [" + immediate + "], " +
"unboundedScrollX = [" + getUnboundedScrollX() + "]");
Log.d(
TAG,
"snapToPage() called with: whichPage = [" + whichPage + "], delta = [" + delta +
"], duration = [" + duration + "], immediate = [" + immediate + "], " +
"unboundedScrollX = [" + getUnboundedScrollX() + "]"
);
if (mFirstLayout) {
setCurrentPage(whichPage);
return false;
......@@ -1528,7 +1538,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
public String getCurrentPageDescription() {
return getContext().getString(R.string.default_scroll_format,
getNextPage() + 1, getChildCount());
getNextPage() + 1, getChildCount()
);
}
public int getPageSpacing() {
......
......@@ -57,23 +57,23 @@ class PageIndicatorDots(context: Context, attrs: AttributeSet?, defStyleAttr: In
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
override fun setScroll(currentScroll: Int, totalScroll: Int) {
var currentScroll = currentScroll
var currScroll = currentScroll
if (mNumPages > 1) {
// Ignore this as of now.
if (mIsRtl) {
currentScroll = totalScroll - currentScroll
currScroll = totalScroll - currScroll
}
val scrollPerPage = totalScroll / (mNumPages - 1)
val pageToLeft = currentScroll / scrollPerPage
val pageToLeft = currScroll / scrollPerPage
val pageToLeftScroll = pageToLeft * scrollPerPage
val pageToRightScroll = pageToLeftScroll + scrollPerPage
val scrollThreshold =
SHIFT_THRESHOLD * scrollPerPage
when {
currentScroll < pageToLeftScroll + scrollThreshold -> { // scroll is within the left page's threshold
currScroll < pageToLeftScroll + scrollThreshold -> { // scroll is within the left page's threshold
animateToPosition(pageToLeft.toFloat())
}
currentScroll > pageToRightScroll - scrollThreshold -> { // scroll is far enough from left page to go to the right page
currScroll > pageToRightScroll - scrollThreshold -> { // scroll is far enough from left page to go to the right page
animateToPosition(pageToLeft + 1.toFloat())
}
else -> { // scroll is between left and right page
......@@ -247,7 +247,7 @@ class PageIndicatorDots(context: Context, attrs: AttributeSet?, defStyleAttr: In
if (mEntryAnimationRadiusFactors == null) {
val activeRect = activeRect
outline!!.setRoundRect(
activeRect!!.left.toInt(),
activeRect.left.toInt(),
activeRect.top.toInt(),
activeRect.right.toInt(),
activeRect.bottom.toInt(),
......
......@@ -28,8 +28,6 @@ import foundation.e.blisslauncher.features.test.anim.Interpolators
import foundation.e.blisslauncher.features.test.dragndrop.DropTarget
import foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider
import java.lang.Double.MAX_VALUE
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.util.ArrayList
import java.util.Arrays
import java.util.Stack
......@@ -64,7 +62,7 @@ open class CellLayout @JvmOverloads constructor(
// return an (x, y) value from helper functions. Do NOT use them to maintain other state.
private val mTmpCellXY = IntArray(2)
@Retention(RetentionPolicy.SOURCE)
@Retention(AnnotationRetention.SOURCE)
@IntDef(WORKSPACE, HOTSEAT)
annotation class ContainerType
......
......@@ -12,7 +12,6 @@ import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewDebug;
import android.view.WindowInsets;
......
......@@ -5,6 +5,7 @@ import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.ActivityOptions
import android.app.AlertDialog
import android.app.usage.UsageStats
......@@ -40,6 +41,7 @@ import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
......@@ -65,7 +67,6 @@ import foundation.e.blisslauncher.core.customviews.AbstractFloatingView
import foundation.e.blisslauncher.core.customviews.BlissFrameLayout
import foundation.e.blisslauncher.core.customviews.BlissInput
import foundation.e.blisslauncher.core.customviews.InsettableFrameLayout
import foundation.e.blisslauncher.core.customviews.InsettableScrollLayout
import foundation.e.blisslauncher.core.customviews.LauncherPagedView
import foundation.e.blisslauncher.core.customviews.RoundedWidgetView
import foundation.e.blisslauncher.core.customviews.SquareFrameLayout
......@@ -106,6 +107,7 @@ import foundation.e.blisslauncher.features.weather.WeatherUpdateService
import foundation.e.blisslauncher.features.widgets.WidgetManager
import foundation.e.blisslauncher.features.widgets.WidgetViewBuilder
import foundation.e.blisslauncher.features.widgets.WidgetsActivity
import foundation.e.blisslauncher.features.widgets.WidgetsRootView
import foundation.e.blisslauncher.uioverrides.OverlayCallbackImpl
import foundation.e.blisslauncher.uioverrides.UiFactory
import io.reactivex.Observable
......@@ -125,6 +127,9 @@ import me.relex.circleindicator.CircleIndicator
class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionClickListener {
private lateinit var widgetRootView: WidgetsRootView
private lateinit var overlayCallbackImpl: OverlayCallbackImpl
// Folder start scale
private var startScaleFinal: Float = 0f
private var mCancelTouchController: Runnable? = null
......@@ -281,7 +286,8 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
}
})
createOrUpdateIconGrid()
setLauncherOverlay(OverlayCallbackImpl(this))
overlayCallbackImpl = OverlayCallbackImpl(this)
setLauncherOverlay(overlayCallbackImpl)
}
private fun askForNotificationIfFirstTime() {
......@@ -291,11 +297,16 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
var permissionString = Settings.Secure.getString(cr, setting)
val cn = ComponentName(this, NotificationListener::class.java)
val enabled = permissionString != null && (permissionString.contains(cn.flattenToString()) || permissionString.contains(cn.flattenToShortString()))
val enabled =
permissionString != null && (permissionString.contains(cn.flattenToString()) || permissionString.contains(
cn.flattenToShortString()
))
if (!enabled) {
val launcherApps: LauncherApps = getSystemService(LAUNCHER_APPS_SERVICE) as LauncherApps
val launcherInfo = launcherApps.getApplicationInfo(packageName, 0, Process.myUserHandle())
val launcherApps: LauncherApps =
getSystemService(LAUNCHER_APPS_SERVICE) as LauncherApps
val launcherInfo =
launcherApps.getApplicationInfo(packageName, 0, Process.myUserHandle())
if (launcherInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
val args = Bundle()
args.putString(":settings:fragment_args_key", cn.flattenToString())
......@@ -416,24 +427,17 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
}
private fun setupWidgetPage() {
widgetPage = layoutInflater.inflate(R.layout.widgets_page, rootView, false) as InsettableFrameLayout
widgetPage =
layoutInflater.inflate(R.layout.widgets_page, rootView, false) as InsettableFrameLayout
rootView.addView(widgetPage)
widgetContainer = widgetPage.findViewById(R.id.widget_container)
widgetPage.visibility = View.GONE
widgetPage.translationX = (widgetPage.measuredWidth * -1.00f)
val scrollView: InsettableScrollLayout =
widgetPage.findViewById(R.id.widgets_scroll_container)
scrollView.setOnTouchListener { v: View?, event: MotionEvent? ->
if (widgetPage.findViewById<View>(R.id.widget_resizer_container)
.visibility
== View.VISIBLE
) {
hideWidgetResizeContainer()
}
false
widgetPage.visibility = View.VISIBLE
widgetPage.post {
widgetPage.translationX = -(widgetPage.measuredWidth * 1.00f)
}
widgetRootView = widgetPage.findViewById(R.id.widgets_scroll_container)
widgetPage.findViewById<View>(R.id.used_apps_layout).clipToOutline = true
widgetPage.tag = "Widget page"
......@@ -453,7 +457,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
// divided by 2 because of left and right padding.
val padding = (mDeviceProfile.availableWidthPx / 2 - Utilities.pxFromDp(8, this) -