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

Commit c3a1b542 authored by kaiyiz's avatar kaiyiz Committed by Gerrit - the friendly Code Review server
Browse files

Regional: Customize hyphen feature

-Customize hyphen feature for contacts and phone number.

Change-Id: I649337a1bb28324650e3c576706630e0a420c477
parent ea1eecb4
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (C) 2008 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,6 +22,7 @@ package android.telephony;
import com.android.i18n.phonenumbers.AsYouTypeFormatter;
import com.android.i18n.phonenumbers.AsYouTypeFormatter;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
import com.android.i18n.phonenumbers.PhoneNumberUtil;


import android.os.SystemProperties;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.Editable;
import android.text.Selection;
import android.text.Selection;
@@ -152,8 +156,13 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher {
    }
    }


    private String getFormattedNumber(char lastNonSeparator, boolean hasCursor) {
    private String getFormattedNumber(char lastNonSeparator, boolean hasCursor) {
        return hasCursor ? mFormatter.inputDigitAndRememberPosition(lastNonSeparator)
        String formattedNum = hasCursor ? mFormatter
                .inputDigitAndRememberPosition(lastNonSeparator)
                : mFormatter.inputDigit(lastNonSeparator);
                : mFormatter.inputDigit(lastNonSeparator);
        if (!SystemProperties.getBoolean("persist.env.sys.hypenenable", true)) {
            return formattedNum.replace("-", "");
        }
        return formattedNum;
    }
    }


    private void stopFormatting() {
    private void stopFormatting() {