Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84f8765d authored by cretin45's avatar cretin45
Browse files

Dialer: Filter IP call from call log context menu if config is false

Change-Id: I3b8852894d91aae8ef1bbdeffaea5077047f4c5e
parent 9a281de7
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents.Insert;
import android.provider.ContactsContract.Intents.Insert;
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.view.ContextMenu;
import android.view.ContextMenu;
@@ -287,22 +288,27 @@ public class CallLogFragment extends ListFragment
        final MenuItem editBeforeCallMenuItem = menu.findItem(R.id.menu_edit_before_call);
        final MenuItem editBeforeCallMenuItem = menu.findItem(R.id.menu_edit_before_call);
        final MenuItem sendTextMessageMenuItem = menu.findItem(R.id.menu_send_text_message);
        final MenuItem sendTextMessageMenuItem = menu.findItem(R.id.menu_send_text_message);
        final MenuItem addToContactMenuItem = menu.findItem(R.id.menu_add_to_contacts);
        final MenuItem addToContactMenuItem = menu.findItem(R.id.menu_add_to_contacts);

        final boolean isIPPrefixEnabled =
                getResources().getBoolean(R.bool.config_ip_prefix_enable);
        AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
        AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
        mNumber = getValidCallLogNumber(info.position);
        mNumber = getValidCallLogNumber(info.position);


        menu.setHeaderTitle(mNumber);
        menu.setHeaderTitle(mNumber);


        if (MoreContactUtils.isMultiSimEnable(mContext, MSimConstants.SUB1)) {
        if (isIPPrefixEnabled && MoreContactUtils.isMultiSimEnable(mContext, MSimConstants.SUB1)) {
            String sub1Name = MoreContactUtils.getSimSpnName(MSimConstants.SUB1);
            String sub1Name = MoreContactUtils.getSimSpnName(MSimConstants.SUB1);
            sub1Name = Settings.Global.getSimNameForSubscription(getActivity(),
                    MSimConstants.SUB1, sub1Name);
            ipCallBySlot1MenuItem.setTitle(getActivity().getString(
            ipCallBySlot1MenuItem.setTitle(getActivity().getString(
                    com.android.contacts.common.R.string.ip_call_by_slot, sub1Name));
                    com.android.contacts.common.R.string.ip_call_by_slot, sub1Name));
            ipCallBySlot1MenuItem.setVisible(true);
            ipCallBySlot1MenuItem.setVisible(true);
        } else {
        } else {
            ipCallBySlot1MenuItem.setVisible(false);
            ipCallBySlot1MenuItem.setVisible(false);
        }
        }
        if (MoreContactUtils.isMultiSimEnable(mContext, MSimConstants.SUB2)) {
        if (isIPPrefixEnabled && MoreContactUtils.isMultiSimEnable(mContext, MSimConstants.SUB2)) {
            String sub2Name = MoreContactUtils.getSimSpnName(MSimConstants.SUB2);
            String sub2Name = MoreContactUtils.getSimSpnName(MSimConstants.SUB2);
            sub2Name = Settings.Global.getSimNameForSubscription(getActivity(),
                    MSimConstants.SUB2, sub2Name);
            ipCallBySlot2MenuItem.setTitle(getActivity().getString(
            ipCallBySlot2MenuItem.setTitle(getActivity().getString(
                    com.android.contacts.common.R.string.ip_call_by_slot, sub2Name));
                    com.android.contacts.common.R.string.ip_call_by_slot, sub2Name));
            ipCallBySlot2MenuItem.setVisible(true);
            ipCallBySlot2MenuItem.setVisible(true);