diff options
author | Yorke Lee <yorkelee@google.com> | 2014-07-22 11:49:49 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-07-22 17:31:24 -0700 |
commit | 69c247f619fd2f2474070bdbcec32b78f6444149 (patch) | |
tree | 168f658fdfa9b86b0020c4abaccffeeb9f9c02ff /src/com/android/dialer/list/ListsFragment.java | |
parent | 769540c1ed68cb52b455630d3547a54aff71497a (diff) |
Make ViewPagerTabs and FABController RTL aware
* Underline in ViewPagerTabStrips is correctly drawn in RTL mode
* Clicking on ViewPagerTabs propogates correct onPageSelected position
to ViewPager
* FAB is now end aligned instead of right aligned
* ViewPager in Dialer is correctly reversed and behaves correctly
* Call Log groups headers in call log are now correctly aligned in RTL
Bug: 16162264
Bug: 16464471
Change-Id: I2db6b9147a628a68fba5bbbdb7276855d483bad5
Diffstat (limited to 'src/com/android/dialer/list/ListsFragment.java')
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 847edd9a0..4f96d63f4 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -10,7 +10,6 @@ import android.content.CursorLoader; import android.content.Loader; import android.content.SharedPreferences; import android.database.Cursor; -import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.provider.CallLog; @@ -26,9 +25,6 @@ import android.widget.ListView; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.list.ViewPagerTabs; import com.android.dialer.DialtactsActivity; - -import android.view.View.OnClickListener; - import com.android.dialer.R; import com.android.dialer.calllog.CallLogAdapter; import com.android.dialer.calllog.CallLogFragment; @@ -36,6 +32,7 @@ import com.android.dialer.calllog.CallLogQuery; import com.android.dialer.calllog.CallLogQueryHandler; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.list.ShortcutCardsAdapter.SwipeableShortcutCard; +import com.android.dialer.util.DialerUtils; import com.android.dialer.widget.OverlappingPaneLayout; import com.android.dialer.widget.OverlappingPaneLayout.PanelSlideListener; import com.android.dialerbind.ObjectFactory; @@ -60,7 +57,7 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste public static final int TAB_INDEX_RECENTS = 1; public static final int TAB_INDEX_ALL_CONTACTS = 2; - private static final int TAB_INDEX_COUNT = 3; + public static final int TAB_INDEX_COUNT = 3; private static final int MAX_RECENTS_ENTRIES = 20; // Oldest recents entry to display is 2 weeks old. @@ -186,7 +183,7 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste @Override public Fragment getItem(int position) { - switch (position) { + switch (getRtlPosition(position)) { case TAB_INDEX_SPEED_DIAL: mSpeedDialFragment = new SpeedDialFragment(); return mSpeedDialFragment; @@ -260,6 +257,7 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOffscreenPageLimit(2); mViewPager.setOnPageChangeListener(this); + mViewPager.setCurrentItem(getRtlPosition(TAB_INDEX_SPEED_DIAL)); mTabTitles = new String[TAB_INDEX_COUNT]; mTabTitles[TAB_INDEX_SPEED_DIAL] = getResources().getString(R.string.tab_speed_dial); @@ -387,4 +385,11 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste public RemoveView getRemoveView() { return mRemoveView; } + + public int getRtlPosition(int position) { + if (DialerUtils.isRtl()) { + return TAB_INDEX_COUNT - 1 - position; + } + return position; + } } |