lsjwzh / RecyclerViewPager

Deprecated
Apache License 2.0
3.53k stars 667 forks source link

Issue in RTL #185

Open zeeshanrasool91 opened 7 years ago

zeeshanrasool91 commented 7 years ago

i am facing scroll issue in RTL layout

AndroidDeveloperLB commented 6 years ago

You should explain the issue, so that people could find how to solve it.

zeeshanrasool91 commented 6 years ago

Yes i was using rosetta library for language change, when i change language to arabic and orientation changes i cannot perform scrolling on it

zeeshanrasool91 commented 6 years ago

Dear, i was using Rosetta Library when i switch to RTL layout using arabic language, Horizontal Scrolling was not working in it

On Tue, Nov 28, 2017 at 1:24 PM, AndroidDeveloperLB < notifications@github.com> wrote:

You should explain the issue, so that people could find how to solve it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lsjwzh/RecyclerViewPager/issues/185#issuecomment-347448166, or mute the thread https://github.com/notifications/unsubscribe-auth/AHFTedVQNgiiFxctcfwJYMG32cuCp0D6ks5s68NIgaJpZM4PMlh- .

-- Regards: Zeeshan Rasool

AndroidDeveloperLB commented 6 years ago

I'm not the owner of this repo. I think you should show a minimized sample project, that introduces the issue.

zeeshanrasool91 commented 6 years ago

okay Man Should i Share GIF with issue or Sample Project or APK file

AndroidDeveloperLB commented 6 years ago

I think I know what you are talking about RTL. However, I think it's an issue on ViewPager itself, so I've reported about this here: https://issuetracker.google.com/issues/71339606

The only workaround is to make some calculations to handle this. For example, to get the current item, you will have to substract from the entire collection.

Example: in LTR, you use itemsList.get(pos) In RTL, you use itemsList.get(itemsList.size()-pos)

I think there are some repos that demonstrate how to deal with RTL on ViewPager.

zeeshanrasool91 commented 6 years ago

Yes, This Discussion Contains the Issue which I am facing anyways thanks to response.

On Wed, Dec 27, 2017 at 6:38 PM, AndroidDeveloperLB < notifications@github.com> wrote:

I think I know what you are talking about RTL. However, I think it's an issue on ViewPager itself, so I've reported about this here: https://issuetracker.google.com/issues/71339606

The only workaround is to make some calculations to handle this. For example, to get the current item, you will have to substract from the entire collection.

Example: in LTR, you use itemsList.get(pos) In RTL, you use 'itemsList.get(itemsList.size()-pos)`

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lsjwzh/RecyclerViewPager/issues/185#issuecomment-354115130, or mute the thread https://github.com/notifications/unsubscribe-auth/AHFTedSqNHurqsiSSJkgw96BpQsJTu2Lks5tEkhDgaJpZM4PMlh- .

-- Regards: Zeeshan Rasool

AndroidDeveloperLB commented 6 years ago

Please consider starring it, then. Maybe also write your own insights about it

zeeshanrasool91 commented 6 years ago

I gave you star already loved your work man,

zeeshanrasool91 commented 6 years ago

@AndroidDeveloperLB Dear I found Something in your Code I tried to solve it by simply making reverse layout parameter true for RTL and For LTR false but for that, I have to comment your code portion

@Override public void setLayoutManager(LayoutManager layout) { super.setLayoutManager(layout);

    /*if (layout instanceof LinearLayoutManager) {
        reverseLayout = ((LinearLayoutManager) layout).getReverseLayout();
    }*/
}

then it worked.

zeeshanrasool91 commented 6 years ago

i think that might be something with your calculations

AndroidDeveloperLB commented 6 years ago

@zeeshanrasool91 Thanks. Sadly this will work only on RecyclerView based solutions, like yours, but the issue I wrote is about ViewPager.

dmitrychistyakov commented 6 years ago

Another approach for recyclerView - use android:layoutDirection="ltr" in xml layout with RecyclerViewPager

AndroidDeveloperLB commented 6 years ago

@dmitrychistyakov We are talking about ViewPager. Not RecyclerView.