package com.github.paolorotolo.appintro.util;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import android.text.TextUtils;
import android.view.View;

import java.util.Locale;

public class LayoutUtil {

    public static boolean isRtl(@NonNull Context ctx) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            try {
                ApplicationInfo info = ctx.getPackageManager().getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);
                return (info.flags &= ApplicationInfo.FLAG_SUPPORTS_RTL) != 0;
            } catch (PackageManager.NameNotFoundException e) {
                return defaultIsRtlBehavior();
            }
        }

        return false;

    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
    private static boolean defaultIsRtlBehavior() {
        return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
    }
}

@@ -437,12 +437,15 @@
     
-if (
+return 
 Buil
@@ -499,19 +499,16 @@
 BEAN_MR1
-) %7B
 %0A       
@@ -516,383 +516,102 @@
     
-try %7B%0A                ApplicationInfo info = ctx.getPackageManager().getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);%0A                return (info.flags &= ApplicationInfo.FLAG_SUPPORTS_RTL) != 0;%0A            %7D catch (PackageManager.NameNotFoundException e) %7B%0A                return defaultIsRtlBehavior();%0A            %7D%0A        %7D%0A%0A        return false
+    && ctx.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL
 ;%0A%0A 

Fix method to check if layout is RTL. Closes #587