Brion VIBBER has submitted this change and it was merged.

Change subject: Set text direction of edit summary field for RTL languages 
properly
......................................................................


Set text direction of edit summary field for RTL languages properly

Bug: 63266
Change-Id: Ic109e0f62147b56f3376134faafaef947fa23e39
---
M wikipedia/src/main/java/org/wikipedia/Utils.java
M wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
M 
wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
3 files changed, 18 insertions(+), 2 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved



diff --git a/wikipedia/src/main/java/org/wikipedia/Utils.java 
b/wikipedia/src/main/java/org/wikipedia/Utils.java
index 670d1bc..47ff769 100644
--- a/wikipedia/src/main/java/org/wikipedia/Utils.java
+++ b/wikipedia/src/main/java/org/wikipedia/Utils.java
@@ -361,4 +361,18 @@
     public static boolean isLangRTL(String lang) {
         return Arrays.binarySearch(rtlLangs, lang, null) >= 0;
     }
+
+    /**
+     * Sets text direction (RTL / LTR) for given view based on given lang.
+     *
+     * Doesn't do anything on pre Android 4.2, since their RTL support is 
terrible.
+     *
+     * @param view View to set direction of
+     * @param lang Wiki code for the language based on which to set direction
+     */
+    public static void setTextDirection(View view, String lang) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+            view.setTextDirection(Utils.isLangRTL(lang) ? 
View.TEXT_DIRECTION_RTL : View.TEXT_DIRECTION_LTR);
+        }
+    }
 }
diff --git 
a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java 
b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
index 3aff0cc..61b3be1 100644
--- a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
+++ b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java
@@ -85,7 +85,7 @@
         abuseFilterBackAction = 
findViewById(R.id.edit_section_abusefilter_back);
 
         captchaHandler = new CaptchaHandler(this, title.getSite(), 
progressDialog, sectionContainer, R.string.edit_section_activity_title);
-        editSummaryHandler = new EditSummaryHandler(this);
+        editSummaryHandler = new EditSummaryHandler(this, title);
         editPreviewFragment = (EditPreviewFragment) 
getSupportFragmentManager().findFragmentById(R.id.edit_section_preview_fragment);
 
         editSaveOptionsContainer = 
findViewById(R.id.edit_section_save_options_container);
diff --git 
a/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
 
b/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
index ae43388..6a2fc35 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/editing/summaries/EditSummaryHandler.java
@@ -17,7 +17,7 @@
     private final AutoCompleteTextView summary_edit;
     private final EditSummaryAdapter adapter;
 
-    public EditSummaryHandler(final Activity activity) {
+    public EditSummaryHandler(final Activity activity, PageTitle title) {
         this.activity = activity;
 
         container = activity.findViewById(R.id.group_edit_summary_container);
@@ -33,6 +33,8 @@
         adapter = new EditSummaryAdapter(activity, null, true);
         summary_edit.setAdapter(adapter);
 
+        Utils.setTextDirection(summary_edit, title.getSite().getLanguage());
+
         adapter.setFilterQueryProvider(new FilterQueryProvider() {
             @Override
             public Cursor runQuery(CharSequence charSequence) {

-- 
To view, visit https://gerrit.wikimedia.org/r/122576
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic109e0f62147b56f3376134faafaef947fa23e39
Gerrit-PatchSet: 5
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to