summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-04-16 16:08:56 -0700
committerYorke Lee <yorkelee@google.com>2014-04-16 16:10:01 -0700
commit0e8b0318a91143ad505cbf173a3f75a25a338696 (patch)
treef719ad7931a12e76716cb8d0f09c1154481c2af1
parenteea6a884c719f4926ed7e2f4d47ce7d18df81b48 (diff)
Remove deprecated Actionbar tabs in CallLogActivity
Bug: 10510027 Change-Id: I05e9ee28b1bac74cf5f0dad349bce94659118fee
-rw-r--r--res/layout/call_log_activity.xml18
-rw-r--r--res/values/strings.xml6
-rw-r--r--src/com/android/dialer/calllog/CallLogActivity.java67
3 files changed, 33 insertions, 58 deletions
diff --git a/res/layout/call_log_activity.xml b/res/layout/call_log_activity.xml
index 5a50823e4..6934fee48 100644
--- a/res/layout/call_log_activity.xml
+++ b/res/layout/call_log_activity.xml
@@ -14,12 +14,22 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/calllog_frame">
+ android:id="@+id/calllog_frame"
+ android:orientation="vertical">
+ <com.android.dialer.list.ViewPagerTabs
+ android:id="@+id/viewpager_header"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/actionBarSize"
+ android:textAllCaps="true"
+ android:orientation="horizontal"
+ android:layout_gravity="top"
+ style="@style/DialtactsActionBarTabTextStyle" />
<android.support.v4.view.ViewPager
android:id="@+id/call_log_pager"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-</FrameLayout>
+ android:layout_height="0dp"
+ android:layout_weight="1"/>
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d36af78ee..4832ee9df 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -698,15 +698,15 @@
<string name="dialpad_pound_letters"></string>
<!-- Title for the call log tab containing the list of all voicemails and calls
- [CHAR LIMIT=15] -->
+ [CHAR LIMIT=30] -->
<string name="call_log_all_title">All</string>
<!-- Title for the call log tab containing the list of all missed calls only
- [CHAR LIMIT=15] -->
+ [CHAR LIMIT=30] -->
<string name="call_log_missed_title">Missed</string>
<!-- Title for the call log tab containing the list of all voicemail calls only
- [CHAR LIMIT=15] -->
+ [CHAR LIMIT=30] -->
<string name="call_log_voicemail_title">Voicemail</string>
<string name="tab_speed_dial">Speed Dial</string>
diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java
index eb1f45e67..cdd0baff1 100644
--- a/src/com/android/dialer/calllog/CallLogActivity.java
+++ b/src/com/android/dialer/calllog/CallLogActivity.java
@@ -19,21 +19,18 @@ import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
-import android.app.ActionBar.Tab;
-import android.app.ActionBar.TabListener;
-import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.provider.CallLog.Calls;
import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
-import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
+import com.android.dialer.list.ViewPagerTabs;
public class CallLogActivity extends Activity {
@@ -43,6 +40,8 @@ public class CallLogActivity extends Activity {
private CallLogFragment mMissedCallsFragment;
private CallLogFragment mVoicemailFragment;
+ private String[] mTabTitles;
+
private static final int TAB_INDEX_ALL = 0;
private static final int TAB_INDEX_MISSED = 1;
private static final int TAB_INDEX_VOICEMAIL = 2;
@@ -71,44 +70,15 @@ public class CallLogActivity extends Activity {
}
@Override
- public int getCount() {
- return TAB_INDEX_COUNT;
- }
- }
-
- private final TabListener mTabListener = new TabListener() {
- @Override
- public void onTabUnselected(Tab tab, FragmentTransaction ft) {
- }
-
- @Override
- public void onTabSelected(Tab tab, FragmentTransaction ft) {
- if (mViewPager != null && mViewPager.getCurrentItem() != tab.getPosition()) {
- mViewPager.setCurrentItem(tab.getPosition(), true);
- }
+ public CharSequence getPageTitle(int position) {
+ return mTabTitles[position];
}
@Override
- public void onTabReselected(Tab tab, FragmentTransaction ft) {
- }
- };
-
- private final OnPageChangeListener mOnPageChangeListener = new OnPageChangeListener() {
-
- @Override
- public void onPageScrolled(
- int position, float positionOffset, int positionOffsetPixels) {}
-
- @Override
- public void onPageSelected(int position) {
- final ActionBar actionBar = getActionBar();
- actionBar.selectTab(actionBar.getTabAt(position));
- }
-
- @Override
- public void onPageScrollStateChanged(int arg0) {
+ public int getCount() {
+ return TAB_INDEX_COUNT;
}
- };
+ }
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -118,20 +88,23 @@ public class CallLogActivity extends Activity {
getWindow().setBackgroundDrawable(null);
final ActionBar actionBar = getActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
- addTab(actionBar, getString(R.string.call_log_all_title));
- addTab(actionBar, getString(R.string.call_log_missed_title));
- addTab(actionBar, getString(R.string.call_log_voicemail_title));
+ mTabTitles = new String[TAB_INDEX_COUNT];
+ mTabTitles[0] = getString(R.string.call_log_all_title);
+ mTabTitles[1] = getString(R.string.call_log_missed_title);
+ mTabTitles[2] = getString(R.string.call_log_voicemail_title);
mViewPager = (ViewPager) findViewById(R.id.call_log_pager);
+
mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager());
mViewPager.setAdapter(mViewPagerAdapter);
- mViewPager.setOnPageChangeListener(mOnPageChangeListener);
mViewPager.setOffscreenPageLimit(2);
+
+ ViewPagerTabs tabs = (ViewPagerTabs) findViewById(R.id.viewpager_header);
+ tabs.setViewPager(mViewPager);
}
@Override
@@ -167,12 +140,4 @@ public class CallLogActivity extends Activity {
}
return super.onOptionsItemSelected(item);
}
-
- private void addTab(ActionBar actionBar, String title) {
- final Tab tab = actionBar.newTab();
- tab.setContentDescription(title);
- tab.setText(title);
- tab.setTabListener(mTabListener);
- actionBar.addTab(tab);
- }
} \ No newline at end of file