Skip to content

Commit

Permalink
Merge pull request #5 from behzadbx/master
Browse files Browse the repository at this point in the history
Added rtl language support
  • Loading branch information
Pradyuman7 authored Sep 22, 2019
2 parents 0901802 + 1374b0f commit 5d8ce4a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chocobar/src/main/java/com/pd/chocobar/ChocoBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
Expand Down Expand Up @@ -178,7 +179,11 @@ else if (builder.textColor != null)
builder.icon.getIntrinsicHeight());
}

text.setCompoundDrawablesWithIntrinsicBounds(builder.icon, null, transparentHelperDrawable, null);
Configuration configuration = chocolateLayout.getResources().getConfiguration();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && configuration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
text.setCompoundDrawablesWithIntrinsicBounds(transparentHelperDrawable, null, builder.icon, null);
else
text.setCompoundDrawablesWithIntrinsicBounds(builder.icon, null, transparentHelperDrawable, null);
text.setCompoundDrawablePadding(text.getResources().getDimensionPixelOffset(R.dimen.icon_padding));
}

Expand Down Expand Up @@ -408,4 +413,4 @@ private Snackbar make() {
}


}
}

0 comments on commit 5d8ce4a

Please sign in to comment.