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

Commit 5ed462af authored by yoichi kakimoto's avatar yoichi kakimoto
Browse files

Fixed to Added the function to add the Phonetic name into Phonetic field automaticaly.



This fix is to add the Phonetic name automatically to Phonetic name field when user inputs a Name in Japanese language mode.

Enter in the name field and automatically enter to Phonetic field when the input charactor is confirmed.
The cases that will be entered to the Phonetic field are as follows.
1. Select enter on the keyboard
2. Select for prediction conversion candidate
3. Tap outside the input field.

Change-Id: I6a04a971814a1e84cd2db7acc5d7c80c1ca79074
Signed-off-by: default avataryoichi kakimoto <youichi.kakimoto.gt@kyocera.jp>
parent a33aca87
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListPopupWindow;
import android.widget.Toast;
@@ -100,6 +101,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;

/**
@@ -1277,6 +1279,13 @@ public class ContactEditorFragment extends Fragment implements
        if (uri != null) {
            editorView.setFullSizePhoto(uri);
        }
        final StructuredNameEditorView nameEditor = editorView.getNameEditorView();
        final TextFieldsEditorView phoneticNameEditor = editorView.getPhoneticEditorView();
        final boolean useJapaneseOrder = 
                       Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
        if (useJapaneseOrder && nameEditor != null && phoneticNameEditor != null) {
            nameEditor.setPhoneticView(phoneticNameEditor);
        }

        // The editor is ready now so make it visible
        editorView.setEnabled(mEnabled);
+10 −0
Original line number Diff line number Diff line
@@ -80,6 +80,16 @@ public interface Editor {
     */
    public void onFieldChanged(String column, String value);

    /**
     * Update the phonetic field with the specified character string.
     */
    public void updatePhonetic(String column, String value);

    /**
     * Returns the phonetic field string of the specified column.
     */
    public String getPhonetic(String column);

    /**
     * Marks the underlying ValuesDelta as deleted, but does not update the view.
     */
+13 −0
Original line number Diff line number Diff line
@@ -254,6 +254,19 @@ public class KindSectionView extends LinearLayout {
        return (StructuredNameEditorView) mEditors.getChildAt(0);
    }

    public TextFieldsEditorView getPhoneticEditorView() {
        if (!StructuredName.CONTENT_ITEM_TYPE.equals(mKindSectionData.getMimeType())) {
            return null;
        }
        for (int i = 0; i < mEditors.getChildCount(); i++) {
            final View view = mEditors.getChildAt(i);
            if (!(view instanceof StructuredNameEditorView)) {
                return (TextFieldsEditorView) view;
            }
        }
        return null;
    }

    /**
     * Binds views for the given {@link KindSectionData}.
     *
+11 −0
Original line number Diff line number Diff line
@@ -331,6 +331,17 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
        notifyEditorListener();
    }

    /** {@inheritDoc} */
    @Override
    public void updatePhonetic(String column, String value) {
    }

    /** {@inheritDoc} */
    @Override
    public String getPhonetic(String column){
        return "";
    }

    protected void saveValue(String column, String value) {
        mEntry.put(column, value);
    }
+7 −0
Original line number Diff line number Diff line
@@ -387,6 +387,13 @@ public class RawContactEditorView extends LinearLayout implements View.OnClickLi
                ? null : nameKindSectionView.getNameEditorView();
    }

    public TextFieldsEditorView getPhoneticEditorView() {
        final KindSectionView kindSectionView = mKindSectionViewMap
                .get(StructuredName.CONTENT_ITEM_TYPE);
        return kindSectionView == null
                ? null : kindSectionView.getPhoneticEditorView();
    }

    public RawContactDelta getCurrentRawContactDelta() {
        return mCurrentRawContactDelta;
    }
Loading