wrap from last screen to first screen in android Launcher2
Posted
by poboy975
on Stack Overflow
See other posts from Stack Overflow
or by poboy975
Published on 2010-04-28T04:34:16Z
Indexed on
2010/04/28
4:43 UTC
Read the original article
Hit count: 233
hi, I'm learning java and android. and I've been looking at trying to wrap the last screen to the first screen in the android Launcher2. I've tried googleing, and searching here, but there really isnt much information about the launcher2 source...I've been modifying the workspace.java file, but there has been minimal effect. no wrap around so far...I have not been able to find a .xml file that also might control the hard stop when you reach the end of the screens. I'll give a small example of the code that i have been modifying.
original code: public void scrollRight() { clearVacantCache(); if (mNextScreen == INVALID_SCREEN && mCurrentScreen < getChildCount() -1 && mScroller.isFinished()) { snapToScreen(mCurrentScreen + 1); } modified code: public void scrollRight() { clearVacantCache(); if (mNextScreen == INVALID_SCREEN && mCurrentScreen < getChildCount() -1 && mScroller.isFinished()) { snapToScreen(mCurrentScreen + 1); }if (mCurrentScreen == getChildCount() -1 && mScroller.isFinished()) { snapToScreen(0);
I would appreciate any tips or pointers if anyone has an idea where i'm going wrong, or someplace i can search to get the answers. the code looks to me like it should work, but I'm probably missing something obvious.
© Stack Overflow or respective owner