Skip to content
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

Phoenix doesnt work on Samsung Galaxy S2 #19

Closed
figengungor opened this issue Aug 25, 2015 · 5 comments
Closed

Phoenix doesnt work on Samsung Galaxy S2 #19

figengungor opened this issue Aug 25, 2015 · 5 comments

Comments

@figengungor
Copy link

I added Phoenix to my project and it works fine with Sony Xperia. However, I can't scroll to refresh when testing my app on Samsung Galaxy S2. Do you have similar issue on that device? What might be the problem?

@shliama
Copy link
Contributor

shliama commented Aug 27, 2015

That's really weird, can you check it with the sample? I'll try to find SG S2 to test it myself, but not about the ETA

@figengungor
Copy link
Author

I tested sample and it works fine on S2. However, I am using a custom ScrollView as following with Phoenix and Phoenix doesnt work on S2 in that case but works fine with Sony Xperia. Do you have any idea what might be the problem?

import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;

public class VerticalScrollView extends ScrollView
{
private GestureDetector mGestureDetector;
View.OnTouchListener mGestureListener;

public VerticalScrollView(Context context)
{
    super(context);
    init(context);
}

public VerticalScrollView(Context context, AttributeSet attrs)
{
   super(context, attrs);
   init(context);
}

public VerticalScrollView(Context context, AttributeSet attrs, int defStyle) 
{
   super(context, attrs, defStyle);
   init(context);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
   return super.onInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev);
}

class YScrollDetector extends GestureDetector.SimpleOnGestureListener
{
   @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) 
   {             
      return Math.abs(distanceY) > Math.abs(distanceX);
    }
}

private void init(Context context)
{
   mGestureDetector = new GestureDetector(context, new YScrollDetector());
    setFadingEdgeLength(0);

}
}

And my layout goes like this:

<com.test.project.ui.VerticalScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

           < <com.yalantis.phoenix.PullToRefreshView
                android:id="@+id/pull_to_refresh"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">  ....

@shliama
Copy link
Contributor

shliama commented Aug 29, 2015

Well, maybe that's because LinearLayout under the PullToRefreshView layout. It needs subclass of AbsListView or anything that can scroll.

@figengungor
Copy link
Author

I put scrollview into pulltorefresh and now it works on S2. Thank you, @shliama.

@shliama
Copy link
Contributor

shliama commented Aug 31, 2015

great 👍 guess, the issue is closed now)

@shliama shliama closed this as completed Aug 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants