Giter VIP home page Giter VIP logo

horizontalpager's People

Contributors

ysamlan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

horizontalpager's Issues

random sluggish behaviour of the horizontalpager + smoothness question

Hey!

First of all, I wanna thank you for the awesome work you did with the horizontalpager.

I use it in my project and it works very well.
Im building a launcher, where each page is a linearlayout which holds another views (images, layouts, etc..)

however, the sliding/dragging isn't smooth enough like in Helix Launcher for example (In their launcher, the widgets on the
screen are being scrolled very smoothly)

what can I do in order to get better results according to the smoothness?

I also have another problem.
The pager is becoming sluggish for 2-3 seconds at random times.
what can be the cause of that problem?

thanks i advance!@
:D

Missing fling feature

If the goal is to mimic the way Launcher does this, I believe there are two errors in HorizontalPager.

  1. FRACTION_OF_SCREEN_WIDTH_FOR_SWIPE should be set to 2.
  2. Fling motions should trigger a view swipe when acceleration is high enough (1000 pixels/sec?).

For this we need a GestureDetector. I'll try to implement this tonight.

Empty Space Between Images

Hi,

I am using the HorizontalPager class to flip from one image to the next. It works great! (Thanks for writing & sharing this)
One problem : There are large empty spaces between images, Not sure if I am doing something wrong or this is a limitation of the code.

This is the scenario I have within the xml:
<com.github.ysamlan.horizontalpager.HorizontalPager ...>
<ImageView ... />
<ImageView ... />
<ImageView ... />
<ImageView ... />
</com.github.ysamlan.horizontalpager.HorizontalPager >

The image pngs are thin & long - about 18 px (width) X 111 px (height)

Thanks much!

Child View Swipe Events

Fix:

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    getChildAt(0).dispatchTouchEvent(ev);
    this.onTouchEvent(ev);
    return true;
}

NOTE: getChildAt uses a magic number.

Rotation

Hello,

nice work. Thank you.
But I have found a bug. When switch to page 3 and rotate the screen shows page 1.

greets

Issue when swipping from a scrolled ListView

I have implemented the xml version on my project and I can observe some kind of conflict beetween the page swipe and the scrolling of a listview.

If I ever scroll the list, I will not be able to swipe consistently to another view.

To be more specific if I scroll the list and then touch it to stop it, I will be able to swipe to another page. But if I scroll the list and let it stop by itself or swipe right after the scroll without a touch, I will not be able to swipe. It will register it like if I was trying to scroll again in the list.

onConfigurationChanged problem

I was having problems with this when the orientation changed. In your example it snaps to the first screen when orientation changes, but i wanted it to snap to the current screen you are on. So what i did was took the snapToScreen code and rather than grabbing the view's getWidth() i substituted the screens width in its place and called the startScroll with duration zero. here is the code to accomplish this:

public void orientationSnapToScreen(Context ctx)  
{
Display display = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
int displayWidth = display.getWidth();

mNextScreen = Math.max(0, Math.min(getCurrentScreen(), getChildCount() - 1));
    final int newX = mNextScreen * displayWidth;
    final int delta = newX - getScrollX();

    mScroller.startScroll(getScrollX(), 0, delta, 0, 0);
}

and then you just call it like this in your code:

@ Override

public void onConfigurationChanged(Configuration newConfig)  
{

  super.onConfigurationChanged(newConfig);

  // realViewSwitcher is a HorizontalPager

  realViewSwitcher.orientationSnapToScreen(this);

}

Hope this helps :)

flip to start on last view

Hi, is there a way when you get to the last view in the list to flip to the first view. or when you are on the first view allow scrolling back to the last view? so you would always be able to scroll left or right past the start/end. Also, is there an easy way to integrate a inflator or something to better allow for custom views?
Great job!

setCurrentScreen animation doubt

I tried this with a TabWidget instead of the Radio buttons. Instead of the onCheckedChangedListener I'm using an onClickListener. Though, I'm sure this applies to radio buttons too.

When a radio button is checked, we set the current screen:
mPager.setCurrentScreen(0, true);

The second parameter implies an animation for 500 ms. This makes the UI thread block, which in turn delays the Radio button update. E.g.:

  1. User clicks button.
  2. Button is highlighted.
  3. Page change is animated for 500 ms.
  4. Button is checked.

Instead, we should check the button immediately (as if the animation was disabled) and then animate the page change. This is how it's done in the Music app.

Hence, we need to make an asynchronous call to snapToScreen() inside setCurrentScreen(). Post runnable? Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.