-
Notifications
You must be signed in to change notification settings - Fork 31
Support RTL 🌐 #1
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
Conversation
@@ -176,7 +176,7 @@ public void setIconColor(@ColorInt final int color) { | |||
/** | |||
* Change drawable icon size | |||
* | |||
* @param widthRes Set width resource id | |||
* @param widthRes Set width resource id |
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.
Sorry, this was auto formatted 🙇
updateIcons(); | ||
} else { | ||
setVectorDrawable(INDEX_LEFT, resourceId); | ||
} |
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.
This logic is same in several method so I moved it to setVectorDrawable()
method.
@@ -278,7 +284,7 @@ private static Bitmap drawable2Bitmap(final Drawable drawable, final int iconWid | |||
* {@link android.content.res.Resources} or a {@link android.content.res.TypedArray}. | |||
*/ | |||
private static void fixDrawable(@NonNull final Drawable drawable) { | |||
if (Build.VERSION.SDK_INT == 21 | |||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP |
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.
Just changed.
Resources resources = getContext().getResources(); | ||
Locale locale = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N | ||
? resources.getConfiguration().getLocales().getFirstMatch(resources.getAssets().getLocales()) | ||
: resources.getConfiguration().locale; |
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.
After Android N, configuration.locale
became deprecated.
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
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.
JFYI: You might have known.
If you use this chrome plugin, you can see VectorDrawable icon on GitHub page like this. It helps you to review PR.
android:textColor="#795548" | ||
android:textSize="@dimen/text_large" | ||
app:cit_drawableStart="@drawable/ic_language_black_24px" | ||
app:cit_iconColor="#4E342E" |
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.
I choosed Brown 500 and 800 here from https://material.io/guidelines/style/color.html
because it reminds me something like Earth 🌍
@@ -131,4 +133,4 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
``` | |||
|
|||
[preview]: /arts/preview.png | |||
[preview]: /arts/preview.jpg |
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.
It was too big so I changed the width to 300 px.
Thank you so much! 😄 |
Thanks for the quick review! 😄 |
Overview
Thanks for the cool library.
This library didn't support RTL attributes such as
drawableStart
anddrawableEnd
.I added these two in this PR.
cit_drawableStart
andcit_drawableEnd
attributes.set
methods.Screenshot
See the text on the bottom.
Note
This contains a little refactoring. If you don't like it, feel free to comment. Thanks!