diff options
author | Andrew Lee <anwlee@google.com> | 2014-04-16 22:49:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-16 22:49:42 +0000 |
commit | eea6a884c719f4926ed7e2f4d47ce7d18df81b48 (patch) | |
tree | 5d0264b22bd247d25fce21004bc6cbf501cfa344 | |
parent | 07e71d9303ad180804a4e7758d0c1a81b7d53699 (diff) | |
parent | 470fc45faecfdcea385ffca127162419cf7417e6 (diff) |
Merge "Add voicemail tab to call history tab bar."
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogActivity.java | 40 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 7 |
3 files changed, 26 insertions, 25 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index d67c788da..d36af78ee 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -705,6 +705,10 @@ [CHAR LIMIT=15] --> <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] --> + <string name="call_log_voicemail_title">Voicemail</string> + <string name="tab_speed_dial">Speed Dial</string> <string name="tab_recents">Recents</string> diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index d1b362365..eb1f45e67 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -26,19 +26,14 @@ import android.content.Intent; import android.os.Bundle; import android.provider.CallLog.Calls; import android.support.v13.app.FragmentPagerAdapter; -import android.support.v4.view.PagerTabStrip; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.TypefaceSpan; 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.calllog.CallLogFragment; public class CallLogActivity extends Activity { @@ -46,11 +41,13 @@ public class CallLogActivity extends Activity { private ViewPagerAdapter mViewPagerAdapter; private CallLogFragment mAllCallsFragment; private CallLogFragment mMissedCallsFragment; + private CallLogFragment mVoicemailFragment; private static final int TAB_INDEX_ALL = 0; private static final int TAB_INDEX_MISSED = 1; + private static final int TAB_INDEX_VOICEMAIL = 2; - private static final int TAB_INDEX_COUNT = 2; + private static final int TAB_INDEX_COUNT = 3; public class ViewPagerAdapter extends FragmentPagerAdapter { public ViewPagerAdapter(FragmentManager fm) { @@ -66,6 +63,9 @@ public class CallLogActivity extends Activity { case TAB_INDEX_MISSED: mMissedCallsFragment = new CallLogFragment(Calls.MISSED_TYPE); return mMissedCallsFragment; + case TAB_INDEX_VOICEMAIL: + mVoicemailFragment = new CallLogFragment(Calls.VOICEMAIL_TYPE); + return mVoicemailFragment; } throw new IllegalStateException("No fragment at position " + position); } @@ -123,25 +123,15 @@ public class CallLogActivity extends Activity { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); - final Tab allTab = actionBar.newTab(); - final String allTitle = getString(R.string.call_log_all_title); - allTab.setContentDescription(allTitle); - allTab.setText(allTitle); - allTab.setTabListener(mTabListener); - actionBar.addTab(allTab); - - final Tab missedTab = actionBar.newTab(); - final String missedTitle = getString(R.string.call_log_missed_title); - missedTab.setContentDescription(missedTitle); - missedTab.setText(missedTitle); - missedTab.setTabListener(mTabListener); - actionBar.addTab(missedTab); + 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)); mViewPager = (ViewPager) findViewById(R.id.call_log_pager); mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOnPageChangeListener(mOnPageChangeListener); - mViewPager.setOffscreenPageLimit(1); + mViewPager.setOffscreenPageLimit(2); } @Override @@ -177,4 +167,12 @@ 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 diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 9526f392b..18f37f211 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -30,7 +30,6 @@ import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.ContactsContract; import android.provider.VoicemailContract.Status; -import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.view.LayoutInflater; import android.view.View; @@ -48,7 +47,6 @@ import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; import com.android.dialerbind.ObjectFactory; -import com.android.internal.telephony.ITelephony; import java.util.List; @@ -84,8 +82,6 @@ public class CallLogFragment extends ListFragment private final Handler mHandler = new Handler(); - private TelephonyManager mTelephonyManager; - private class CustomContentObserver extends ContentObserver { public CustomContentObserver() { super(mHandler); @@ -346,6 +342,9 @@ public class CallLogFragment extends ListFragment case Calls.MISSED_TYPE: message = getString(R.string.recentMissed_empty); break; + case Calls.VOICEMAIL_TYPE: + message = getString(R.string.recentVoicemails_empty); + break; case CallLogQueryHandler.CALL_TYPE_ALL: message = getString(R.string.recentCalls_empty); break; |