diff options
| author | Kamaljeet Maini <kmaini@cyngn.com> | 2016-03-08 15:32:46 -0800 |
|---|---|---|
| committer | Stephen Bird <sbird@cyngn.com> | 2016-04-08 10:21:13 -0700 |
| commit | 795f46c1f3d51528cc9ba8aa387bd532153b8fd6 (patch) | |
| tree | 59abe693ed4fc4740f769f07cd6d549ad98eaac9 /src | |
| parent | 153585f4cb55604c034b65cb814121c1d742ee1b (diff) | |
| download | android_packages_apps_Dialer-795f46c1f3d51528cc9ba8aa387bd532153b8fd6.tar.gz android_packages_apps_Dialer-795f46c1f3d51528cc9ba8aa387bd532153b8fd6.tar.bz2 android_packages_apps_Dialer-795f46c1f3d51528cc9ba8aa387bd532153b8fd6.zip | |
Port VoLTE support from DialerNext into AOSP Dialer
Modified Dialpad fragment to show
1) VoLTE label when there is only one provider, which supports
VoLTE
2) VoLTE text below spinner icon for each provider that supports
VoLTE when there is more than one provider
Change-Id: Ifaffa16966d7d632b0262311b53d71a64f1e75ad
Issue-Id: DIALER-720
Diffstat (limited to 'src')
3 files changed, 62 insertions, 14 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index bb28d27e3..31c59ddd8 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -194,6 +194,7 @@ public class DialpadFragment extends Fragment /* Call Method Spinner */ private Spinner mCallMethodSpinner; + private View mVolteLabel; /* Call Method Infos */ private CallMethodInfo mCurrentCallMethodInfo; @@ -403,10 +404,12 @@ public class DialpadFragment extends Fragment mDelete = mDialpadView.getDeleteButton(); mCallMethodSpinner = mDialpadView.getCallMethodSpinner(); + mVolteLabel = mDialpadView.getVolteLabel(); DialtactsActivity dActivity = (DialtactsActivity) getActivity(); + boolean showVolte = true; if (dActivity != null) { - CallMethodSpinnerHelper.setupCallMethodSpinner(dActivity, mCallMethodSpinner, + CallMethodSpinnerHelper.setupCallMethodSpinner(dActivity, showVolte, mCallMethodSpinner, dActivity); } @@ -493,7 +496,7 @@ public class DialpadFragment extends Fragment availableProviders) { DialtactsActivity dActivity = (DialtactsActivity) getActivity(); if (dActivity != null) { - CallMethodSpinnerHelper.updateCallMethodSpinnerAdapter(dActivity, + CallMethodSpinnerHelper.updateCallMethodUI(dActivity, mVolteLabel, mCallMethodSpinner, dActivity, lastKnownMethod, availableProviders); } } diff --git a/src/com/android/dialer/incall/CallMethodSpinnerHelper.java b/src/com/android/dialer/incall/CallMethodSpinnerHelper.java index 595302ed7..42a1e873d 100644 --- a/src/com/android/dialer/incall/CallMethodSpinnerHelper.java +++ b/src/com/android/dialer/incall/CallMethodSpinnerHelper.java @@ -12,6 +12,7 @@ import com.android.phone.common.incall.CallMethodInfo; import com.android.phone.common.incall.CallMethodHelper; import com.android.phone.common.incall.CallMethodSpinnerAdapter; import com.android.phone.common.incall.CallMethodUtils; +import com.android.phone.common.util.VolteUtils; import java.util.ArrayList; import java.util.HashMap; @@ -32,9 +33,8 @@ public class CallMethodSpinnerHelper { void onCallMethodChangedListener(CallMethodInfo cmi); } - /** - * Creates the initial spinner configurations + * Creates the initial spinner configurations without volte icon * @param context * @param callMethodSpinner The spinner * @param callMethodChanged the listener to be called when the call method is changed @@ -42,8 +42,21 @@ public class CallMethodSpinnerHelper { public static void setupCallMethodSpinner(Context context, Spinner callMethodSpinner, final OnCallMethodChangedListener callMethodChanged) { + setupCallMethodSpinner(context, false, callMethodSpinner, callMethodChanged); + } + + /** + * Creates the initial spinner configurations with optional volte icon + * @param context + * @param showVolte Whether to show Volte icon + * @param callMethodSpinner The spinner + * @param callMethodChanged the listener to be called when the call method is changed + */ + public static void setupCallMethodSpinner(Context context, boolean showVolte, + Spinner callMethodSpinner, + final OnCallMethodChangedListener callMethodChanged) { CallMethodSpinnerAdapter callMethodSpinnerAdapter = - new CallMethodSpinnerAdapter(context, new ArrayList<CallMethodInfo>()); + new CallMethodSpinnerAdapter(context, new ArrayList<CallMethodInfo>(), showVolte); callMethodSpinner.setAdapter(callMethodSpinnerAdapter); callMethodSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -61,18 +74,39 @@ public class CallMethodSpinnerHelper { } /** - * Updates the spinner with new call methods when available. + * Updates the spinner with new call methods when available. Don't show volte label view + * @param context + * @param callMethodSpinner the spinner + * @param changeListener the listener called when something is changed + * @param lastKnownCallMethod the previous call method of either this spinner + * or the other spinners + */ + public static void updateCallMethodUI(Context context, Spinner callMethodSpinner, + final OnCallMethodChangedListener changeListener, + String lastKnownCallMethod, + HashMap<ComponentName, CallMethodInfo> + availableProviders) { + updateCallMethodUI(context, null, callMethodSpinner, changeListener, lastKnownCallMethod, + availableProviders); + } + + + /** + * Updates the spinner with new call methods when available. Show volte label view when + * appropriate * @param context + * @param volteLabel label for VoLTE text * @param callMethodSpinner the spinner * @param changeListener the listener called when something is changed * @param lastKnownCallMethod the previous call method of either this spinner * or the other spinners */ - public static void updateCallMethodSpinnerAdapter(Context context, Spinner callMethodSpinner, - final OnCallMethodChangedListener changeListener, - String lastKnownCallMethod, - HashMap<ComponentName, CallMethodInfo> - availableProviders) { + public static void updateCallMethodUI(Context context, View volteLabel, + Spinner callMethodSpinner, + final OnCallMethodChangedListener changeListener, + String lastKnownCallMethod, + HashMap<ComponentName, CallMethodInfo> + availableProviders) { CallMethodSpinnerAdapter callMethodSpinnerAdapter = (CallMethodSpinnerAdapter) callMethodSpinner.getAdapter(); int lastKnownPosition = callMethodSpinnerAdapter.getPosition(lastKnownCallMethod); @@ -104,9 +138,21 @@ public class CallMethodSpinnerHelper { CallMethodInfo info = (callMethodSpinnerAdapter.getCount() > 0) ? callMethodSpinnerAdapter.getItem(0) : null; changeListener.onCallMethodChangedListener(info); + + if (volteLabel != null){ + if (info != null && VolteUtils.isVolteInUse(context, info.mSubId)) { + volteLabel.setVisibility(View.VISIBLE); + } else { + volteLabel.setVisibility(View.GONE); + } + } } else { // multiple call methods or single provider int position = POSITION_UNKNOWN; + + if (volteLabel != null) { + volteLabel.setVisibility(View.GONE); + } callMethodSpinner.setVisibility(View.VISIBLE); if (!TextUtils.isEmpty(lastKnownCallMethod)) { position = callMethodSpinnerAdapter.getPosition(lastKnownCallMethod); diff --git a/src/com/android/dialer/widget/SearchEditTextLayout.java b/src/com/android/dialer/widget/SearchEditTextLayout.java index f694ce1c8..3f15bc3dc 100644 --- a/src/com/android/dialer/widget/SearchEditTextLayout.java +++ b/src/com/android/dialer/widget/SearchEditTextLayout.java @@ -363,9 +363,8 @@ public class SearchEditTextLayout extends FrameLayout { public void updateSpinner(String lastKnownCallMethod, HashMap<ComponentName, CallMethodInfo> availableProviders) { if (mCallMethodChangedListener != null) { - CallMethodSpinnerHelper.updateCallMethodSpinnerAdapter(getContext(), - mCallMethodSpinner, mCallMethodChangedListener, lastKnownCallMethod, - availableProviders); + CallMethodSpinnerHelper.updateCallMethodUI(getContext(), mCallMethodSpinner, + mCallMethodChangedListener, lastKnownCallMethod, availableProviders); } } |
