-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-13610] correctly handle scrollableView inside tableview/listview and scrollview AGAIN #4748
Changes from 3 commits
6911d6b
f7ebf6d
fe6c8e7
9b9c1ba
b2bf12c
55f165b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,14 @@ | |
import org.appcelerator.titanium.proxy.TiViewProxy; | ||
import org.appcelerator.titanium.util.TiConvert; | ||
import org.appcelerator.titanium.util.TiEventHelper; | ||
import org.appcelerator.titanium.util.TiUIHelper; | ||
import org.appcelerator.titanium.view.TiCompositeLayout; | ||
import org.appcelerator.titanium.view.TiCompositeLayout.LayoutParams; | ||
import org.appcelerator.titanium.view.TiUIView; | ||
|
||
import ti.modules.titanium.ui.ScrollableViewProxy; | ||
import ti.modules.titanium.ui.widget.TiUIScrollView.TiScrollViewLayout; | ||
import android.annotation.SuppressLint; | ||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Build; | ||
|
@@ -33,8 +35,11 @@ | |
import android.view.View; | ||
import android.view.View.OnClickListener; | ||
import android.view.ViewGroup; | ||
import android.widget.ListView; | ||
import android.widget.RelativeLayout; | ||
import android.widget.ScrollView; | ||
|
||
@SuppressLint("NewApi") | ||
public class TiUIScrollableView extends TiUIView | ||
{ | ||
private static final String TAG = "TiUIScrollableView"; | ||
|
@@ -100,6 +105,8 @@ public boolean onInterceptTouchEvent(MotionEvent event) { | |
@Override | ||
public void onPageScrollStateChanged(int scrollState) | ||
{ | ||
mPager.requestDisallowInterceptTouchEvent(state != ViewPager.SCROLL_STATE_IDLE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean "scrollState" here? |
||
|
||
if ((scrollState == ViewPager.SCROLL_STATE_IDLE) && isValidScroll) { | ||
int oldIndex = mCurIndex; | ||
|
||
|
@@ -550,27 +557,6 @@ public boolean onTrackballEvent(MotionEvent event) | |
return super.onTrackballEvent(event); | ||
} | ||
|
||
@Override | ||
public boolean dispatchTouchEvent(MotionEvent ev) | ||
{ | ||
// If the parent is a scroll view, then we prevent the scroll view from intercepting touch events | ||
if (getParent() instanceof TiScrollViewLayout) { | ||
int action = ev.getAction(); | ||
switch (action) { | ||
case MotionEvent.ACTION_DOWN: | ||
requestDisallowInterceptTouchEvent(true); | ||
break; | ||
|
||
case MotionEvent.ACTION_UP: | ||
case MotionEvent.ACTION_CANCEL: | ||
requestDisallowInterceptTouchEvent(false); | ||
break; | ||
|
||
} | ||
} | ||
return super.dispatchTouchEvent(ev); | ||
} | ||
|
||
@Override | ||
public boolean dispatchKeyEvent(KeyEvent event) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ | |
import android.view.Gravity; | ||
import android.view.View; | ||
import android.view.View.MeasureSpec; | ||
import android.view.ViewParent; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary import. |
||
import android.view.inputmethod.InputMethodManager; | ||
import android.widget.TextView; | ||
|
||
|
@@ -1005,4 +1006,17 @@ public static void firePostLayoutEvent(TiViewProxy proxy) | |
proxy.fireEvent(TiC.EVENT_POST_LAYOUT, null, false); | ||
} | ||
} | ||
|
||
public static boolean isViewInsideViewOfClass(View view, Class<?>[] testClass) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems you don't need this function at all. |
||
ViewParent parent = view.getParent(); | ||
if (parent != null) { | ||
for (int i = 0; i < testClass.length; i++) { | ||
if (testClass[i].isAssignableFrom(parent.getClass())) | ||
return true; | ||
} | ||
if (parent instanceof View) | ||
return isViewInsideViewOfClass((View)parent, testClass); | ||
} | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary import in line 19, 38 and 40.