am 03864121: am f62f72f4: am 75842684: am 5c761009: am 962677f5: Switch fragment position in RTL
* commit '038641215c0a1883b5994559d0cc47940c2d8a85':
Switch fragment position in RTL
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 75f3607..9f25e4e 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -19,9 +19,7 @@
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
-import android.content.Context;
import android.content.Intent;
-import android.content.res.TypedArray;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
@@ -680,10 +678,10 @@
}
} else {
if (object == mFavoritesFragment) {
- return TabState.FAVORITES;
+ return getTabPositionForTextDirection(TabState.FAVORITES);
}
if (object == mAllFragment) {
- return TabState.ALL;
+ return getTabPositionForTextDirection(TabState.ALL);
}
}
return POSITION_NONE;
@@ -694,6 +692,7 @@
}
private Fragment getFragment(int position) {
+ position = getTabPositionForTextDirection(position);
if (mTabPagerAdapterSearchMode) {
if (position != 0) {
// This has only been observed in monkey tests.
@@ -1270,4 +1269,14 @@
Log.wtf(TAG, "Unexpected onClick event from " + view);
}
}
+
+ /**
+ * Returns the tab position adjusted for the text direction.
+ */
+ private int getTabPositionForTextDirection(int position) {
+ if (isRTL()) {
+ return TabState.COUNT - 1 - position;
+ }
+ return position;
+ }
}