The name order of the contacts is reversed in the Android Hungarian language environment

Source: Internet
Author: User

Contact names are composed of Prefix/given Name/middle name/family Name/suffix. All over the world there is a difference in the success of name display.
For example the Chinese habit is: family name + middle name + given name
Western habits are: given name + middle name + family name
There are several types of Google defined:
fullnamestyle.undefined//undefined
Fullnamestyle.chinese//China
Fullnamestyle.korean//Korea
Fullnamestyle.japanese//Japan
FULLNAMESTYLE.CJK//One of China, Japan and Korea
Fullnamestyle.western//Western
Hungary, the country is very special, according to the traditional concept belongs to the west, but the name display habit is family name + given name + middle name
[Solution]
1, please ensure that there is added Hungarian (please refer to faq04326\faq03761)
2, modify the Datarowhandlerforstructuredname.java (alps\packages\providers\contactsprovider\src\com\android\providers\ Contacts
Modify public void Fixstructurednamecomponents (contentvalues augmented, contentvalues update) {
Final String unstruct = update.getasstring (structuredname.display_name);
Final Boolean touchedunstruct =! Textutils.isempty (unstruct);
Final Boolean touchedstruct =!areallempty (update, structured_fields);
if (touchedunstruct &&!touchedstruct) {
Namesplitter.name Name = new Namesplitter.name ();
Msplitter.split (name, unstruct);
Name.tovalues (update);
} else if (!touchedunstruct
&& (touchedstruct | | areanyspecified (UPDATE, Structured_fields))) {
We need to update the display name if any structured components
was specified, even when they was null, which is what we are checking
Areanyspecified. The touchedstruct in the condition are an optimization:
If there is non-null values, we know for a fact, some values is present.
Namesplitter.name Name = new Namesplitter.name ();
Name.fromvalues (augmented);
As the name could is changed, let's guess the name style again.
Name.fullnamestyle = fullnamestyle.undefined;
Msplitter.guessnamestyle (name);
int unadjustedfullnamestyle = Name.fullnamestyle;
Name.fullnamestyle = Msplitter.getadjustedfullnamestyle (Name.fullnamestyle);

XT and
Final String joined = Msplitter.join (name, True, true);
String mlanguage = Msplitter.getlanguage ();
if (Name.fullnamestyle = = Fullnamestyle.undefined | | name.fullnamestyle = fullnamestyle.western) && Mlanguage.equals ("Hu")) {
Final String joined = Msplitter.join (name, false, True); The middle parameter is false, which is the Boolean givennamefirst, which determines whether the givenname is at the front
}else{
Final String joined = Msplitter.join (name, True, true);
}
XT and End
Update.put (Structuredname.display_name, joined);
Update.put (Structuredname.full_name_style, Unadjustedfullnamestyle);
Update.put (Structuredname.phonetic_name_style, Name.phoneticnamestyle);
} else if (touchedunstruct && touchedstruct) {
if (!update.containskey (Structuredname.full_name_style)) {
Update.put (Structuredname.full_name_style,
Msplitter.guessfullnamestyle (unstruct));
}
if (!update.containskey (Structuredname.phonetic_name_style)) {
Update.put (Structuredname.phonetic_name_style,
Msplitter.guessphoneticnamestyle (unstruct));
}
}
}

3, modify Namesplitter.java (alps\packages\providers\contactsprovider\src\com\android\providers\contacts)
New function
Public String GetLanguage () {
return mlanguage;
}

The name order of the contacts is reversed in the Android Hungarian language environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.