summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/call_log_list_item.xml3
-rw-r--r--src/com/android/dialer/DialtactsActivity.java21
-rw-r--r--src/com/android/dialer/calllog/CallLogActivity.java2
-rw-r--r--src/com/android/dialer/list/ListsFragment.java17
-rw-r--r--src/com/android/dialer/util/DialerUtils.java9
5 files changed, 39 insertions, 13 deletions
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 193859273..1e61f7768 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -25,8 +25,9 @@
above a group of call log entries. -->
<TextView
android:id="@+id/call_log_day_group_label"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="start"
android:layout_marginStart="@dimen/call_log_start_margin"
android:layout_marginEnd="@dimen/call_log_outer_margin"
android:fontFamily="sans-serif-medium"
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index bf2af138a..249e0c1aa 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -93,6 +93,7 @@ import com.android.phone.common.animation.AnimationListenerAdapter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
/**
* The dialer tab's title is 'phone', a more common name (see strings.xml).
@@ -1104,11 +1105,20 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ position = mListsFragment.getRtlPosition(position);
// Only scroll the button when the first tab is selected. The button should scroll from
// the middle to right position only on the transition from the first tab to the second
// tab.
- if (position == ListsFragment.TAB_INDEX_SPEED_DIAL && !mIsLandscape) {
- mFloatingActionButtonController.onPageScrolled(positionOffset);
+ // If the app is in RTL mode, we need to check against the second tab, rather than the
+ // first. This is because if we are scrolling between the first and second tabs, the
+ // viewpager will report that the starting tab position is 1 rather than 0, due to the
+ // reversal of the order of the tabs.
+ final boolean isLayoutRtl = DialerUtils.isRtl();
+ final boolean shouldScrollButton = position == (isLayoutRtl
+ ? ListsFragment.TAB_INDEX_RECENTS : ListsFragment.TAB_INDEX_SPEED_DIAL);
+ if (shouldScrollButton && !mIsLandscape) {
+ mFloatingActionButtonController.onPageScrolled(
+ isLayoutRtl ? 1 - positionOffset : positionOffset);
} else if (position != ListsFragment.TAB_INDEX_SPEED_DIAL) {
mFloatingActionButtonController.onPageScrolled(1);
}
@@ -1116,6 +1126,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public void onPageSelected(int position) {
+ position = mListsFragment.getRtlPosition(position);
mCurrentTabPosition = position;
}
@@ -1163,15 +1174,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private void updateFloatingActionButtonControllerAlignment(boolean animate) {
int align;
if (mIsDialpadShown) {
- align = mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_RIGHT
+ align = mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_END
: FloatingActionButtonController.ALIGN_MIDDLE;
} else {
if (!mIsLandscape) {
align = mCurrentTabPosition == ListsFragment.TAB_INDEX_SPEED_DIAL
? FloatingActionButtonController.ALIGN_MIDDLE
- : FloatingActionButtonController.ALIGN_RIGHT;
+ : FloatingActionButtonController.ALIGN_END;
} else {
- align = FloatingActionButtonController.ALIGN_RIGHT;
+ align = FloatingActionButtonController.ALIGN_END;
}
}
mFloatingActionButtonController.align(align,
diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java
index 4e969e189..1129f2795 100644
--- a/src/com/android/dialer/calllog/CallLogActivity.java
+++ b/src/com/android/dialer/calllog/CallLogActivity.java
@@ -29,9 +29,9 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import com.android.contacts.common.list.ViewPagerTabs;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
-import com.android.contacts.common.list.ViewPagerTabs;
import com.android.dialer.voicemail.VoicemailStatusHelper;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
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;
+ }
}
diff --git a/src/com/android/dialer/util/DialerUtils.java b/src/com/android/dialer/util/DialerUtils.java
index 2b4a74ccc..07a330e6c 100644
--- a/src/com/android/dialer/util/DialerUtils.java
+++ b/src/com/android/dialer/util/DialerUtils.java
@@ -34,6 +34,7 @@ import com.android.contacts.common.CallUtil;
import com.android.dialer.R;
import java.util.List;
+import java.util.Locale;
/**
* General purpose utility methods for the Dialer.
@@ -138,4 +139,12 @@ public class DialerUtils {
final CharSequence separator = resources.getString(R.string.list_delimeter);
return TextUtils.join(separator, list);
}
+
+ /**
+ * @return True if the application is currently in RTL mode.
+ */
+ public static boolean isRtl() {
+ return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) ==
+ View.LAYOUT_DIRECTION_RTL;
+ }
}