Improving home screen customization
- Created a drawer with tabs for widgets, folders, shortcuts, wallpapers (wallpapers are currently not implemented) - Tapping outside the drawer dismisses it - Moved the all apps icon to the upper right of the screen - Adding a toast that says "No more space on screen" when dragging a widget to a full screen - Fixed bug where you could stack two equal-sized widgets on top of each other on the homescreen (exposed by the new ability to drag widgets onto the home screen) Change-Id: I03b65ce54a85d24328c94e0c06e249571de449ee
This commit is contained in:
@@ -48,6 +48,7 @@ import android.view.animation.RotateAnimation;
|
||||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.widget.Scroller;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -97,6 +98,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||
|
||||
private int mTouchState = TOUCH_STATE_REST;
|
||||
|
||||
private OnTouchListener mInterceptTouchListener;
|
||||
private OnLongClickListener mLongClickListener;
|
||||
|
||||
private Launcher mLauncher;
|
||||
@@ -512,6 +514,10 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnInterceptTouchListener(View.OnTouchListener listener) {
|
||||
mInterceptTouchListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the specified listener on each screen contained in this workspace.
|
||||
*
|
||||
@@ -747,6 +753,9 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (mInterceptTouchListener != null && mInterceptTouchListener.onTouch(this, ev)) {
|
||||
return true;
|
||||
}
|
||||
final boolean workspaceLocked = mLauncher.isWorkspaceLocked();
|
||||
final boolean allAppsVisible = mLauncher.isAllAppsVisible();
|
||||
if (workspaceLocked || allAppsVisible) {
|
||||
@@ -1289,7 +1298,12 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||
mVacantCache = layout.findAllVacantCells(null, ignoreView);
|
||||
}
|
||||
|
||||
return mVacantCache.findCellForSpan(mTempEstimate, spanX, spanY, false);
|
||||
if (mVacantCache.findCellForSpan(mTempEstimate, spanX, spanY, false)) {
|
||||
return true;
|
||||
} else {
|
||||
Toast.makeText(getContext(), getContext().getString(R.string.out_of_space), Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user