Removing support library dependency

> Removed FolderAutoScrollHelper as folders are currently not scrollable

Change-Id: I261f43a665b742697e3224e1e9852ccc526badcd
This commit is contained in:
Sunny Goyal
2015-01-05 12:40:08 -08:00
parent c1b7c2ecbd
commit c46bfef5df
6 changed files with 20 additions and 95 deletions
-2
View File
@@ -23,8 +23,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
$(call all-java-files-under, WallpaperPicker/src) \
$(call all-renderscript-files-under, src) \
+2 -2
View File
@@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0"
>
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19" />
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" />
<application/>
</manifest>
@@ -20,9 +20,9 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.v4.util.LongSparseArray;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.Pools.Pool;
import android.util.Pools.SynchronizedPool;
import android.view.View;
+14 -27
View File
@@ -21,12 +21,13 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Build;
import android.os.SystemClock;
import android.support.v4.widget.AutoScrollHelper;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
@@ -123,8 +124,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private boolean mDestroyed;
private AutoScrollHelper mAutoScrollHelper;
private Runnable mDeferredAction;
private boolean mDeferDropAfterUninstall;
private boolean mUninstallSuccessful;
@@ -208,7 +207,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderName.setSelectAllOnFocus(true);
mFolderName.setInputType(mFolderName.getInputType() |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
mAutoScrollHelper = new FolderAutoScrollHelper(mScrollView);
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@@ -700,6 +698,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public boolean isLayoutRtl() {
return (getLayoutDirection() == LAYOUT_DIRECTION_RTL);
}
@@ -715,29 +714,19 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
final MotionEvent translatedEv = MotionEvent.obtain(
downTime, downTime, MotionEvent.ACTION_MOVE, d.x, d.y, 0);
if (!mAutoScrollHelper.isEnabled()) {
mAutoScrollHelper.setEnabled(true);
}
final boolean handled = mAutoScrollHelper.onTouch(this, translatedEv);
translatedEv.recycle();
if (handled) {
mTargetCell = mContent.findNearestArea(
(int) r[0], (int) r[1] + scrollOffset, 1, 1, mTargetCell);
if (isLayoutRtl()) {
mTargetCell[0] = mContent.getCountX() - mTargetCell[0] - 1;
}
if (mTargetCell[0] != mPreviousTargetCell[0]
|| mTargetCell[1] != mPreviousTargetCell[1]) {
mReorderAlarm.cancelAlarm();
} else {
mTargetCell = mContent.findNearestArea(
(int) r[0], (int) r[1] + scrollOffset, 1, 1, mTargetCell);
if (isLayoutRtl()) {
mTargetCell[0] = mContent.getCountX() - mTargetCell[0] - 1;
}
if (mTargetCell[0] != mPreviousTargetCell[0]
|| mTargetCell[1] != mPreviousTargetCell[1]) {
mReorderAlarm.cancelAlarm();
mReorderAlarm.setOnAlarmListener(mReorderAlarmListener);
mReorderAlarm.setAlarm(REORDER_DELAY);
mPreviousTargetCell[0] = mTargetCell[0];
mPreviousTargetCell[1] = mTargetCell[1];
}
mReorderAlarm.setOnAlarmListener(mReorderAlarmListener);
mReorderAlarm.setAlarm(REORDER_DELAY);
mPreviousTargetCell[0] = mTargetCell[0];
mPreviousTargetCell[1] = mTargetCell[1];
}
}
@@ -783,8 +772,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
public void onDragExit(DragObject d) {
// Exiting folder; stop the auto scroller.
mAutoScrollHelper.setEnabled(false);
// We only close the folder if this is a true drag exit, ie. not because
// a drop has occurred above the folder.
if (!d.dragComplete) {
@@ -1,59 +0,0 @@
/*
* Copyright (C) 2013 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.launcher3;
import android.support.v4.widget.AutoScrollHelper;
import android.widget.ScrollView;
/**
* An implementation of {@link AutoScrollHelper} that knows how to scroll
* through a {@link Folder}.
*/
public class FolderAutoScrollHelper extends AutoScrollHelper {
private static final float MAX_SCROLL_VELOCITY = 1500f;
private final ScrollView mTarget;
public FolderAutoScrollHelper(ScrollView target) {
super(target);
mTarget = target;
setActivationDelay(0);
setEdgeType(EDGE_TYPE_INSIDE_EXTEND);
setExclusive(true);
setMaximumVelocity(MAX_SCROLL_VELOCITY, MAX_SCROLL_VELOCITY);
setRampDownDuration(0);
setRampUpDuration(0);
}
@Override
public void scrollTargetBy(int deltaX, int deltaY) {
mTarget.scrollBy(deltaX, deltaY);
}
@Override
public boolean canTargetScrollHorizontally(int direction) {
// List do not scroll horizontally.
return false;
}
@Override
public boolean canTargetScrollVertically(int direction) {
return mTarget.canScrollVertically(direction);
}
}
+3 -4
View File
@@ -48,7 +48,6 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.IBinder;
import android.os.Parcelable;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -492,7 +491,7 @@ public class Workspace extends SmoothPagedView
CellLayout cl = ((CellLayout) child);
cl.setOnInterceptTouchListener(this);
cl.setClickable(true);
cl.setImportantForAccessibility(ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO);
cl.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
super.onChildViewAdded(parent, child);
}
@@ -2210,8 +2209,8 @@ public class Workspace extends SmoothPagedView
private void updateAccessibilityFlags() {
int accessible = mState == State.NORMAL ?
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES :
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
IMPORTANT_FOR_ACCESSIBILITY_YES :
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
setImportantForAccessibility(accessible);
}