Skip to content

Commit

Permalink
Honor the supportsRtl declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengees committed Feb 24, 2017
1 parent 4debdf6 commit 4d51096
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.support.annotation.NonNull;
import android.view.View;

import static android.content.pm.ApplicationInfo.FLAG_SUPPORTS_RTL;

/**
* Some utils to set different Orientations.
*
Expand Down Expand Up @@ -64,7 +67,8 @@ public static void unlockOrientation(@NonNull Activity activity) {
@SuppressWarnings("SimplifiableIfStatement")
public static boolean isRTL(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL &&
context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
} else {
return false;
}
Expand Down

0 comments on commit 4d51096

Please sign in to comment.