List of usage examples for android.support.v4.text TextUtilsCompat getLayoutDirectionFromLocale
public static int getLayoutDirectionFromLocale(Locale locale)
From source file:Main.java
public static boolean isRtl() { return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:Main.java
public static boolean isRTL() { int layoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()); return layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataTabsFragment.java
private static int adjustIndexForDirectionality(int index) { if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL) { return CBD_TAB_COUNT - 1 - index; }/*ww w .ja v a2 s .c om*/ return index; }
From source file:org.mozilla.focus.locale.LocaleAwareAppCompatActivity.java
/** * Force set layout direction to RTL or LTR by Locale. * * @param view/* w w w.java 2 s. co m*/ * @param locale */ public static void setLayoutDirection(View view, Locale locale) { switch (TextUtilsCompat.getLayoutDirectionFromLocale(locale)) { case ViewCompat.LAYOUT_DIRECTION_RTL: ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_RTL); break; case ViewCompat.LAYOUT_DIRECTION_LTR: default: ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LTR); break; } }
From source file:com.facebook.react.modules.i18nmanager.I18nUtil.java
private boolean isDevicePreferredLanguageRTL() { final int directionality = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()); return directionality == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:com.metinkale.prayerapp.utils.RTLViewPager.java
private boolean isRTL() { return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == LAYOUT_DIRECTION_RTL; }
From source file:com.onyx.deskclock.deskclock.widget.RtlViewPager.java
/** * Get a "RTL friendly" index. If the locale is LTR, the index is returned as is. * Otherwise it's transformed so view pager can render views using the new index for RTL. For * example, the second view will be rendered to the left of first view. * * @param index The logical index.//from ww w. ja v a 2 s.c o m */ public int getRtlAwareIndex(int index) { if (Build.VERSION.SDK_INT >= 17) { if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) { return getAdapter().getCount() - index - 1; } } else { if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) { return getAdapter().getCount() - index - 1; } } return index; }
From source file:com.booking.rtlviewpager.RtlViewPager.java
protected boolean isRtl() { return TextUtilsCompat.getLayoutDirectionFromLocale( getContext().getResources().getConfiguration().locale) == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:org.islamic.civil.util.view.RtlViewPager.java
protected boolean isRtl() { return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:org.safegees.safegees.gui.fragment.ProfileContactFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_profile_contact, container, false); ArrayList<Friend> friends = SafegeesDAO.getInstance(view.getContext()).getMutualFriends(); Friend friend = friends.get(position); //this.getActivity().onBackPressed(); //ImageButton closeContact = (ImageButton) view.findViewById(R.id.close_contact); //closeContact.setOnClickListener(this); imageView = (ImageView) view.findViewById(R.id.result); editName = (EditText) view.findViewById(R.id.editName); editSurname = (EditText) view.findViewById(R.id.editSurname); editEmail = (EditText) view.findViewById(R.id.editEmail); editPhone = (EditText) view.findViewById(R.id.editPhone); editTopic = (TextView) view.findViewById(R.id.editTopic); LinearLayout llName = (LinearLayout) view.findViewById(R.id.lay_name); LinearLayout llSurname = (LinearLayout) view.findViewById(R.id.lay_surname); LinearLayout llMail = (LinearLayout) view.findViewById(R.id.lay_mail); LinearLayout llPhone = (LinearLayout) view.findViewById(R.id.lay_phone); //LinearLayout llBio = (LinearLayout) view.findViewById(R.id.lay_topic); //Show arrows to reveal user if there are more contacts ImageView arrowLeft = (ImageView) view.findViewById(R.id.contact_left); ImageView arrowRight = (ImageView) view.findViewById(R.id.contact_right); //Change arrows if Language is LTR (Ar or FA) //And reveal the accurate arrow if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) { arrowLeft.setBackgroundResource(R.drawable.ic_chevron_right_black_24dp); arrowRight.setBackgroundResource(R.drawable.ic_chevron_left_black_24dp); if (position == 0) arrowRight.setVisibility(View.INVISIBLE); if (position == friends.size() - 1) arrowLeft.setVisibility(View.INVISIBLE); } else {//from w ww . j a va 2 s . c o m if (position == 0) arrowLeft.setVisibility(View.INVISIBLE); if (position == friends.size() - 1) arrowRight.setVisibility(View.INVISIBLE); } if (friend != null) { this.editName.setText(friend.getName() != null ? friend.getName() : ""); this.editSurname.setText(friend.getSurname() != null ? friend.getSurname() : ""); this.editEmail.setText(friend.getPublicEmail() != null ? friend.getPublicEmail() : ""); this.editPhone.setText(friend.getPhoneNumber() != null ? friend.getPhoneNumber() : ""); this.editTopic.setText(friend.getBio() != null ? "\"" + friend.getBio() + "\"" : ""); ViewGroup.LayoutParams params = editTopic.getLayoutParams(); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; editTopic.setLayoutParams(params); } if (friend.getName() == null || friend.getName().equals("")) llName.setVisibility(View.GONE); if (friend.getSurname() == null || friend.getSurname().equals("")) llSurname.setVisibility(View.GONE); if (friend.getPublicEmail() == null || friend.getPublicEmail().equals("")) llMail.setVisibility(View.GONE); if (friend.getPhoneNumber() == null || friend.getPhoneNumber().equals("")) llPhone.setVisibility(View.GONE); if (friend.getBio() == null || friend.getBio().equals("")) editTopic.setVisibility(View.GONE); //Add image from friend if (friend.getPublicEmail() != null) { Bitmap bitmap = ImageController.getContactImageBitmap(getContext(), friend.getPublicEmail()); if (bitmap != null) this.imageView.setImageBitmap(bitmap); } // Inflate the layout for this fragment return view; }