maxkeppeler / sheets

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.
https://maxkeppeler.github.io/sheets/
Apache License 2.0
921 stars 77 forks source link

RTL support #27

Open mohamadjavadx opened 3 years ago

mohamadjavadx commented 3 years ago

Is your feature request related to a problem? Please describe. well first of all thanks for quick fix on #24

Right to Left support is the feature that I think it would nice to have on this lib currently if we try using this library on languages like farsi or arabic, the position of buttons, text, horizontal recycler view, and ... are not appropriate

Describe the solution you'd like also it's easy to implement just add another copy of layout with tag (android:layoutDirection="rtl") on root layout or kotlin code (window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL)

Additional context I think this link is super helpful https://material.io/design/usability/bidirectionality.html

maxkeppeler commented 3 years ago

I don't have experience with this yet. I just enabled pseudoLocalesEnabled and used arabic locale on my device - and most of the bottom sheets mirror the layout perfectly. Why do I need to add window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL?

maxkeppeler commented 3 years ago

I see that the OptionSheet in LIST style doesn't align the text to the right. And numbers are not localized (I did not even know that this is a thing). And icons need to be localized as well, especially for the ClockTimeSheet and TimeSheet.

mohamadjavadx commented 3 years ago

well actually we making apps fully forced to RTL and use native language of that country , regardless phone language or location so I personally put ((android:layoutDirection="rtl")) to every xml file to achieve this.

I think if there was a setter which force layout locale it would nice

mohamadjavadx commented 3 years ago

some example for clefication:

image

image

image

image

maxkeppeler commented 3 years ago

But what you showcase automatically happened, when my phone was in a rtl language and then it enforced the rtl mirroring in the sample app, without me adding anything. So you want to override that to always enforce rtl and never ltr?

mohamadjavadx commented 3 years ago

automatically happened, when my phone was in a rtl language and then it enforced the rtl mirroring in the sample app

well this is not true, because as you see for example the number pad is mirroring too which it should not, and there are some other cases like this image

So you want to override that to always enforce rtl and never ltr?

yes, it's only way to achieve a native app (by native I meant a fully Arabic app that Arab people are going to use or any other RTL language )

maxkeppeler commented 3 years ago

I have a few more questions now.

  1. What about the time & calendar value, does it need to be mirrored too?
  2. Why do you suggest the switch between the icon buttons? I guess the icon itself should be mirrored, but not its position?
  3. In the photo, the title should be aligned to the close icon button?
  4. If it's rtl, why is the order of the numbers still ltr? When I check the guidelines, I don't recognize a rule which would prevent it from being mirrored (time relevance etc.)
maxkeppeler commented 3 years ago

I also have trouble displaying the TextInputLayout Hint to rtl and found this issue: https://issuetracker.google.com/issues/37055931

Any idea how to fix this? The hint stays aligned to the left and animates upwards to the outlined box. (That's in rtl the same place where the endIcon is.)

mohamadjavadx commented 3 years ago
  1. What about the time & calendar value, does it need to be mirrored too?

numbers are LTR in all languages so the answer is no, so for time hh:mm:ss, and for date yy:mm:dd (however the calendar is useless Persians and Arabs have there own calendar system one based on sun and the other based on moon position from earth)

2. Why do you suggest the switch between the icon buttons?

I don't suggest switch between the icon buttons, my point was a horizontal list view in RTL view should start from right, and about icons it's overkill to mirror them but if you feel to it, it's ok

  • In the photo, the title should be aligned to the close icon button?

I don't get what you mean

4. If it's rtl, why is the order of the numbers still ltr? When I check the guidelines, I don't recognize a rule which would prevent it from being mirrored (time relevance etc.)

numbers are LTR in all languages, and I can't explain it to you well because of my poor english but trust me, and if you want I can draw layouts that you are not sure about

I also have trouble displaying the TextInputLayout Hint to rtl

that's not a good idea to force TextInputLayout to rtl or ltr, the language of text decide it self

mohamadjavadx commented 3 years ago

just set textAlignment to viewStart and it's ok

mohamadjavadx commented 3 years ago

wow we talked a lot about this I think this library is super cool if I have some free time I will contribute and add this my self, but it's like 2 month later, right now I'm in middle of some project. btw thanks

maxkeppeler commented 3 years ago

Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔

maxkeppeler commented 3 years ago

Current progress is in the branch feature-bidirectionality, I probably finish it before you have time - I have to get a better understanding of the changes in rtl mode. And thanks!

mohamadjavadx commented 3 years ago

Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔

https://user-images.githubusercontent.com/57070063/103782761-1d58e100-504d-11eb-8613-269ff0668316.mp4

mohamadjavadx commented 3 years ago

Current progress is in the branch feature-bidirectionality, I probably finish it before you have time - I have to get a better understanding of the changes in rtl mode. And thanks!

cool, maybe I try to provide it in farsi language not just rtl

maxkeppeler commented 3 years ago

That's weird, so It only works with a rtl language? When enforced rtl with a ltr language, it stays on the left despite the gravity. But that's great, that fixes this problem.

On Wed, 6 Jan 2021, 16:00 mohamadjavad notifications@github.com wrote:

Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔

https://user-images.githubusercontent.com/57070063/103782761-1d58e100-504d-11eb-8613-269ff0668316.mp4

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MaxKeppeler/bottom-sheets/issues/27#issuecomment-755348508, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTAQMBAZE5NJ2NTQDHGEETSYR3HFANCNFSM4VSJJ4LA .

mohamadjavadx commented 3 years ago

That's weird, so It only works with a rtl language? When enforced rtl with a ltr language, it stays on the left despite the gravity. But that's great, that fixes this problem. On Wed, 6 Jan 2021, 16:00 mohamadjavad @.***> wrote: Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔 https://user-images.githubusercontent.com/57070063/103782761-1d58e100-504d-11eb-8613-269ff0668316.mp4 — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#27 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTAQMBAZE5NJ2NTQDHGEETSYR3HFANCNFSM4VSJJ4LA .

yes, there is no problem language will take care