@@ -29,7 +29,7 @@ public class ResideMenu extends FrameLayout{
2929
3030 public static final int DIRECTION_LEFT = 0 ;
3131 public static final int DIRECTION_RIGHT = 1 ;
32- private static final int PRESSED_MOVE_HORIZANTAL = 2 ;
32+ private static final int PRESSED_MOVE_HORIZONTAL = 2 ;
3333 private static final int PRESSED_DOWN = 3 ;
3434 private static final int PRESSED_DONE = 4 ;
3535 private static final int PRESSED_MOVE_VERTICAL = 5 ;
@@ -41,18 +41,16 @@ public class ResideMenu extends FrameLayout{
4141 private ScrollView scrollViewLeftMenu ;
4242 private ScrollView scrollViewRightMenu ;
4343 private ScrollView scrollViewMenu ;
44- /** the activity that view attach to */
44+ /** Current attaching activity. */
4545 private Activity activity ;
46- /** the decorview of the activity */
46+ /** The DecorView of current activity. */
4747 private ViewGroup viewDecor ;
48- /** the viewgroup of the activity */
4948 private TouchDisableView viewActivity ;
50- /** the flag of menu open status */
49+ /** The flag of menu opening status. */
5150 private boolean isOpened ;
52- private GestureDetector gestureDetector ;
5351 private float shadowAdjustScaleX ;
5452 private float shadowAdjustScaleY ;
55- /** the view which don't want to intercept touch event */
53+ /** Views which need stop to intercept touch events. */
5654 private List <View > ignoredViews ;
5755 private List <ResideMenuItem > leftMenuItems ;
5856 private List <ResideMenuItem > rightMenuItems ;
@@ -63,7 +61,7 @@ public class ResideMenu extends FrameLayout{
6361 private int scaleDirection = DIRECTION_LEFT ;
6462 private int pressedState = PRESSED_DOWN ;
6563 private List <Integer > disabledSwipeDirection = new ArrayList <Integer >();
66- //valid scale factor is between 0.0f and 1.0f.
64+ // Valid scale factor is between 0.0f and 1.0f.
6765 private float mScaleValue = 0.5f ;
6866
6967 public ResideMenu (Context context ) {
@@ -95,7 +93,7 @@ protected boolean fitSystemWindows(Rect insets) {
9593 }
9694
9795 /**
98- * use the method to set up the activity which residemenu need to show ;
96+ * Set up the activity;
9997 *
10098 * @param activity
10199 */
@@ -135,16 +133,16 @@ private void setShadowAdjustScaleXByOrientation(){
135133 }
136134
137135 /**
138- * set the menu background picture ;
136+ * Set the background image of menu ;
139137 *
140- * @param imageResrouce
138+ * @param imageResource
141139 */
142- public void setBackground (int imageResrouce ){
143- imageViewBackground .setImageResource (imageResrouce );
140+ public void setBackground (int imageResource ){
141+ imageViewBackground .setImageResource (imageResource );
144142 }
145143
146144 /**
147- * the visiblity of shadow under the activity view ;
145+ * The visibility of the shadow under the activity;
148146 *
149147 * @param isVisible
150148 */
@@ -156,8 +154,9 @@ public void setShadowVisible(boolean isVisible){
156154 }
157155
158156 /**
159- * add a single items to left menu;
157+ * Add a single item to the left menu;
160158 *
159+ * WARNING: It will be removed from v2.0.
161160 * @param menuItem
162161 */
163162 @ Deprecated
@@ -167,7 +166,7 @@ public void addMenuItem(ResideMenuItem menuItem){
167166 }
168167
169168 /**
170- * add a single items;
169+ * Add a single items;
171170 *
172171 * @param menuItem
173172 * @param direction
@@ -183,8 +182,7 @@ public void addMenuItem(ResideMenuItem menuItem, int direction){
183182 }
184183
185184 /**
186- * set the menu items by array list to left menu;
187- *
185+ * WARNING: It will be removed from v2.0.
188186 * @param menuItems
189187 */
190188 @ Deprecated
@@ -194,7 +192,7 @@ public void setMenuItems(List<ResideMenuItem> menuItems){
194192 }
195193
196194 /**
197- * set the menu items by array list ;
195+ * Set menu items by a array ;
198196 *
199197 * @param menuItems
200198 * @param direction
@@ -217,8 +215,7 @@ private void rebuildMenu(){
217215 }
218216
219217 /**
220- * get the left menu items;
221- *
218+ * WARNING: It will be removed from v2.0.
222219 * @return
223220 */
224221 @ Deprecated
@@ -227,7 +224,7 @@ public List<ResideMenuItem> getMenuItems() {
227224 }
228225
229226 /**
230- * get the menu items;
227+ * Return instances of menu items;
231228 *
232229 * @return
233230 */
@@ -239,8 +236,8 @@ public List<ResideMenuItem> getMenuItems(int direction) {
239236 }
240237
241238 /**
242- * if you need to do something on the action of closing or opening
243- * menu, set the listener here.
239+ * If you need to do something on closing or opening menu,
240+ * set a listener here.
244241 *
245242 * @return
246243 */
@@ -254,7 +251,7 @@ public OnMenuListener getMenuListener() {
254251 }
255252
256253 /**
257- * show the reside menu;
254+ * Show the menu;
258255 */
259256 public void openMenu (int direction ){
260257
@@ -272,7 +269,7 @@ public void openMenu(int direction){
272269 }
273270
274271 /**
275- * close the menu;
272+ * Close the menu;
276273 */
277274 public void closeMenu (){
278275
@@ -374,7 +371,7 @@ public void onAnimationRepeat(Animator animation) {
374371 };
375372
376373 /**
377- * a helper method to build scale down animation;
374+ * A helper method to build scale down animation;
378375 *
379376 * @param target
380377 * @param targetScaleX
@@ -396,7 +393,7 @@ private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float
396393 }
397394
398395 /**
399- * a helper method to build scale up animation;
396+ * A helper method to build scale up animation;
400397 *
401398 * @param target
402399 * @param targetScaleX
@@ -427,9 +424,9 @@ private AnimatorSet buildMenuAnimation(View target, float alpha){
427424 }
428425
429426 /**
430- * if there ware some view you don't want reside menu
431- * to intercept their touch event,you can use the method
432- * to set .
427+ * If there were some view you don't want reside menu
428+ * to intercept their touch event, you could add it to
429+ * ignored views .
433430 *
434431 * @param v
435432 */
@@ -438,22 +435,22 @@ public void addIgnoredView(View v){
438435 }
439436
440437 /**
441- * remove the view from ignored view list ;
438+ * Remove a view from ignored views ;
442439 * @param v
443440 */
444441 public void removeIgnoredView (View v ){
445442 ignoredViews .remove (v );
446443 }
447444
448445 /**
449- * clear the ignored view list;
446+ * Clear the ignored view list;
450447 */
451448 public void clearIgnoredViewList (){
452449 ignoredViews .clear ();
453450 }
454451
455452 /**
456- * if the motion evnent was relative to the view
453+ * If the motion event was relative to the view
457454 * which in ignored view list,return true;
458455 *
459456 * @param ev
@@ -507,7 +504,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
507504 break ;
508505
509506 if (pressedState != PRESSED_DOWN &&
510- pressedState != PRESSED_MOVE_HORIZANTAL )
507+ pressedState != PRESSED_MOVE_HORIZONTAL )
511508 break ;
512509
513510 int xOffset = (int ) (ev .getX () - lastActionDownX );
@@ -519,10 +516,10 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
519516 break ;
520517 }
521518 if (xOffset < -50 || xOffset > 50 ) {
522- pressedState = PRESSED_MOVE_HORIZANTAL ;
519+ pressedState = PRESSED_MOVE_HORIZONTAL ;
523520 ev .setAction (MotionEvent .ACTION_CANCEL );
524521 }
525- } else if (pressedState == PRESSED_MOVE_HORIZANTAL ) {
522+ } else if (pressedState == PRESSED_MOVE_HORIZONTAL ) {
526523 if (currentActivityScaleX < 0.95 )
527524 showScrollViewMenu (scrollViewMenu );
528525
@@ -542,7 +539,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
542539 case MotionEvent .ACTION_UP :
543540
544541 if (isInIgnoredView ) break ;
545- if (pressedState != PRESSED_MOVE_HORIZANTAL ) break ;
542+ if (pressedState != PRESSED_MOVE_HORIZONTAL ) break ;
546543
547544 pressedState = PRESSED_DONE ;
548545 if (isOpened ()){
@@ -582,12 +579,12 @@ public void setScaleValue(float scaleValue) {
582579 public interface OnMenuListener {
583580
584581 /**
585- * the method will call on the finished time of opening menu's animation .
582+ * This method will be called at the finished time of opening menu animations .
586583 */
587584 public void openMenu ();
588585
589586 /**
590- * the method will call on the finished time of closing menu's animation .
587+ * This method will be called at the finished time of closing menu animations .
591588 */
592589 public void closeMenu ();
593590 }
0 commit comments