Dialer - T9 / Landscape Merges (squash)

NOTE: This is a squashed commit of all translations, fixes,
and code for the T9 dialer and landscape functionality from cm-10.1.

Dialer Landscape Mode

Bring back functionality to the landscape dialer.

Patchset 2 : Fix spacing.

Patchset 3 : Add dialpad settings. (depends on http://review.cyanogenmod.com/#change,10531)

Patchset 4 : Remove uneeded shared preference object.
             Fix preference icon.

Change-Id: Iff644890ac751dc99090a59bb824d319221e86ae

Update drawable resources according to jellybean

Change-Id: I4eae5ffc7c8b96072236e705a5a0ad44e888e33f

Dialpad : T9 Dialer

This adds t9 functionality to the dialer.

Patchset 2  : T9: Add accented characters
Patchset 3  : Support t9 in landscape mode
              Cleanup resume/pause checks
Patchset 4  : Fix "Pressing back shows keypad overlay"
Patchset 5  : Added more accented characters
Patchset 6  : Add missing return.
Patchset 7  : Use Phone.getTypeLabel instead of re-implementing it (pawitp)
              Fix T9 result disappearing on rotate for >1 number in search (pawitp)
              Allow other dialable strings (*, #, +) for number search (pawitp)
              Update strings (pawitp)
              Check if list expanded, dont revert toggle state, keep it open.
              Leave T9 enabled as default.
Patchset 8  : Fix enabling/disabling T9 while dialer open.
              Remove overlay background patterns in landscape mode.
Patchset 9  : Load database only if T9 is enabled.
Patchset 10 : Optimize T9 loading when not enabled/orientation change. (pawitp)
Patchset 11 : Rebase for 4.0.3 merge.
Patchset 12 : Move translatable strings into strings.xml (t9_map/sort type)
Patchset 13 : Fix layout issues when opening dialer via 3rd party apps

Change-Id: I010d664382a39c1613804c97cda50b543e55ac2a

Conflicts:

	src/com/android/contacts/dialpad/DialpadFragment.java

Dialer : Preference t9 enabled by default

Leave t9 enabled by default

Change-Id: Id07a69b5b47817b0545cc11607d422e273bbe0bb

Added Greek characters for T9 search

Dialpad : T9 layout/functionality fixes

This patchset addresses the following :

Highlight matches in results (Based on m0viefreak's commit)
Switch topbar to a listview to maintain consistency (Based on m0viefreak's commit)
Fix overlay issue where if list view open, and via preferences t9 is turned off and returned to dialer
Fix issue where t9 uses last input rather than re-querying
Adjust layout for more space for contacts with long names

Patchset 2 : New toggle drawables by prash

Change-Id: I00f2a6aed2d7ae0213efab8c2e2028be133551c2

Conflicts:

	src/com/android/contacts/dialpad/DialpadFragment.java

Dialpad : T9 add to contact if no match found

Allow user to save the dialed number as a contact

Patchset 2 : Set toggle to GONE rather than INVISIBLE in newContact mode
             Eliminate duplication when setting toggle visibility

Change-Id: I2b3eb5a32352c9565f2276e19576451322db22cc

Conflicts:

	src/com/android/contacts/dialpad/DialpadFragment.java
	src/com/android/contacts/dialpad/T9Search.java

T9 : Fix bug

To reproduce :
Type a few digits
Expand list
Click a contact (Dial on touch turned off)
Press backspace once

Change-Id: I3d26ad0bc03eff80b9f06f69d47e2fb742f0449a

french: T9 Dialpad and other settings (autorotate)

Change-Id: I40a60518fcddd46695bf0b5ff5d10c87874e7e90

Dialer: Fix press on button press after many resume

Move setPhoneNumberFormattingTextWatcher back to onCreateView
as having it in onResume will cause a new text watcher to be
added every resume slowing things down to a halt when the text
has to be formatted many times after many resumes

Change-Id: Id83ecc8b52ca283d8e64df579b97c588b1073ab2

Conflicts:

	src/com/android/contacts/dialpad/DialpadFragment.java

Dialer: Fix initial state for t9 sort mode

On a fresh install, t9 dialer will match by name, but preferences
has match by number selected as default. Fix this by setting default
to match by name.

Also change uppercase S in "Sorting" to lowercase, to maintain
consistency with rest of system.

Change-Id: I7e72cb75823e58ffc8cf28300ff3fba852f638b1

Bulgarian T9 search and dialer buttons

Change-Id: Icd4f4f37e5888115578c12a4086d77d823172331

Conflicts:

	res/values-bg/strings.xml

Dialer: Underp the layout

The 4.0.4 merge increased the size of the action buttons to fill
almost all the available space, due to conflicts with CM's T9
stuff.

Change-Id: I331bef0a17642006f339c4cea47834f48ff13d1c

Conflicts:

	res/layout/dialpad_fragment.xml

Dialpad : Disable overscroll for T9Top

Prevent overscroll on t9top.

Change-Id: I26ae8fb1a84a2e0bc005d4a6283bfa3b75604fc8

CM9-Add Russian T9 strings

Conflicts:

	res/values-ru/strings.xml

Change-Id: I9141b7c310aeb788946fba4d8d2f35aa36da2538

T9 Dialer : Update upon contact info changes

Refresh the local storage of contact info if contact info is updated
while dialer is still active.

Patchset 2 : cleanup
Patchset 3 : Move unregister to onResume (Can't rely on activty being present)

Change-Id: I6ab4fe199ebc67c318217ab20aa1718a02fcbcaa

Conflicts:

	src/com/android/contacts/dialpad/DialpadFragment.java

Dialer : Cleanup / landscape consistency

- Update resource ids after 4.0.4 merge
- Move additional_buttons into main layout to stay uniform with portrait
- Remove bottom padding in landscape views, since actionbar contains overflow
- Remove search button from landscape dialer and move it to actionbar
- Cleanup unused resources

Patchset 2 : Fix fakeMenu button not showing on phones w/ physical menu button

Change-Id: I7f5232bdb029d5a2498f80493d479113ef66a82b

Conflicts:

	src/com/android/contacts/activities/DialtactsActivity.java
	src/com/android/contacts/dialpad/DialpadFragment.java

Contacts (T9 and dialpad): Spanish translation

Spanish translation for Contacts (T9 and dialpad) settings activity

Change-Id: Ib1d9aa4ba466dd20450c16948c1ab8dc532028cd

Updated Hebrew Translation

Change-Id: I50be9ebe80efcb7efaef364bb0d73d4ff4e253e6

Contacts app - Update Italian Translation.

Change-Id: Ib0a48771bec594723b2ee40d174813a0890bbdcc

Contacts: PT-BR translations

Added T9 strings

Change-Id: I6848876549a77980086c64ca85e02a4f19d9dcdd

Conflicts:

        res/values-pt/strings.xml

contacts: updated german translations

Change-Id: Iaa66fc19799dcb938f34a11d29b2c1775cf011de

contacts: updated finnish translations

Change-Id: I6ddfa468009976af1adb24df6b701158358acf1c

Polish translation

Change-Id: I0a9b28ed39ded96f6cbb654573b04acc3547567d

android_packages_apps_Contacts hungarian translations

Change-Id: I394c41e2459af1b6de6078556e790bbc1a5193dd

Contacts: added missing Hebrew T9 strings and drawables

added missing t9 char mapping
added localized drawables

Change-Id: I49dde5a34875cc18b311a8c698089e39b03b6a79

Conflicts:

	res/values-iw/strings.xml

Change-Id: I4c32d79704f2868da76af0f561ca399a41d01d50

Conflicts:
	res/layout-land/dialpad_fragment.xml
	src/com/android/contacts/activities/DialtactsActivity.java
	src/com/android/contacts/dialpad/DialpadFragment.java

Contacts: Adding T9 Korean search, Change some code for complex character search.

- Koreans are used to Choseong search(searching contacts by Initial character of hangul. ex: '한' is searched by 'ㅎ').
In a cm roms, This don't work for korean name contacts. This patch added this feature for t9 search.

- But.. T9 search is only designed for alphabet search. This don't care about complex character search.
So, I have to change some code of T9 search. Also.. if another language want to implement t9 search later, They will can extend.

- I also change some code of initT9map function. This is not my code. Copied from cm7 code base.
https://github.com/CyanogenMod/android_packages_apps_Contacts/commit/63a531957818d631e957e8e0157d45298906e3fb
That commit has many changes. But I fixed some part about search only.

* This patch don't affect another languege search. Those language will work by NormalToNumber class that acts like previously.
I had tested on my Samsung GalaxyS2 few days. But i can't tested on mdpi and xhdpi.

Note: this also ported from my previous patsh for ics. http://review.cyanogenmod.com/#/c/18072/
That changed doesn't reviewed long times. Please continue the progress of that patch.

Change-Id: I178ee607b1ef2f7217374c22b7f8fc5b657ef53c

Add T9 search support in Chinese

Patch Set 2
       Add English name search support in Chinese T9.
Patch Set 3
       Add full PingYin search support in Chinese T9.
Patch Set 4
       1. Add locale changed event listener to reinitialize the T9 search to fix the bug that can not switch to locale search.
       2. Fix the highlight name problem.
Patch Set 5
       Change the comment from Chinese to English.

Change-Id: Ic6db849be094c24d932e6a8ea591811a966f6c5e

Cleanup and improve T9 search code.

- Use an AsyncTask for loading the T9 cache and show UI indication for
  it to the user.
- Some general cleanup.

Change-Id: I2a95e142baa055c6ff54ef54fe4276f83389a062

Conflicts:
	src/com/android/contacts/ContactsApplication.java

Also search nickname and organization in T9 search.

Change-Id: Ia2a92c59c8d1cc9c4df8b760eaf522fe7c6a3f6f

Contacts: Fix T9 crash in Chinese.

     The crash is due to the convert name to number, the number will
long than the real name length. When highlight the name the position is
out of array of the real name.

Change-Id: I3d956f4a40939bb54914f54efb102e730e20339f

Dialer : Fix T9 add to contacts

Use activity context rather than application
QuickContactBadge can only function with an activity context,
in its current state, it crashes with :

E/AndroidRuntime(12944): FATAL EXCEPTION: main
E/AndroidRuntime(12944): android.util.AndroidRuntimeException:
Calling startActivity() from outside of an Activity  context requires
the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

Patchset 2 : only use activity context for adapter

Patchset 3: Get rid of mContext variable and rearrange parameters

Change-Id: If6dec5a5e12e7006637331861e8d3d4275c31cd0

Contacts: Add Chinese translation

Patch Set 2: Improved translations and gotten rid of the
unnecessary dependency.

Change-Id: Ie26502ffbcdd1aa1ca07b067450516f8ff377cce

Czech: added missing national characters

Change-Id: Ifbfe7c84d136373501871fb16ce712f1e1f1ef44

Added missing hungarian translation for t9_loading

Change-Id: I45840c1cd8476894617750e71f08dd0adf42b6bd

Contacts: Simplified Chinese Translations

Change-Id: I4310827f512caa7291072d27c33a59794f833f77

Czech: fixed translation

Change-Id: I2cd778688b378701acf4782db9bd1b07134b336c

Conflicts:
	res/values-cs/strings.xml

Contacts: Updated italian translation

Related to change:
	"Cleanup and improve T9 search code"

Change-Id: Ic441d2568f3719e92d54cd03772074c9032e643a

Contacts: Restore default AOSP strings and add T9 translations
This commit adds all translations present in CM repo for T9 strings,
and cleans them up quite a bit.

This will help to prevent merge conflicts in the future when merging
from AOSP

Add Russian T9 Buttons-CM10.1

Contacts: Fix dialpad image for korean.

Forward-port http://review.cyanogenmod.org/#/c/22217/

Change-Id: I3127c38636fb1a3e547ee464abb36dda90a9856a

Contacts: Add missing romanian T9 translation

If there's a contacts DB change while the dialpad is open, reload the
cache instead of dropping it.

Fixes issue #6679.

Change-Id: I1f96482c680fbc78300e57d5de40cdad88e3029f

Fix NullPointerException on locale change.

Change-Id: Ib6f33c324164b4fda59a3cd3d7f00da82396e04d

Show formatted number in T9 result list.

Fixes issue CYAN-346

Change-Id: Ic4a30118f4223ccf341e7ead49ccee3aeb585487

Improve T9 name normalization code

- Properly highlight nickname matches
- Make sorting more intuitive
- Highlight whole matched entry for pinyin matches instead of nothing
- Cleanup

This fixes issue CYAN-201.

Change-Id: I3346dd5bd117278718a5f1048ec96a743b7436b1

Contacts: Fix hebrew typos

NOTE: Modified to only include fix for messed up png

Change-Id: I96175b2ea8fdd9450e133619f5eccb3d20747d81

Fix a number of issues with T9 dialer.

- Fix an ArrayIndexOutOfBoundsException which happened when highlighting
  the last digits of a number and the number had additional characters
  after those digits.
- Fix another potential ArrayIndexOutOfBoundsException due to the
  highlighting code relying on normalNumber being a subset of number,
  which wasn't the case due to number being additionally sent through a
  formatter. Fix that by running the formatter before normalizing.
- Fix number highlighting not working if the number match occured at the
  end of the number.
- Fix number type label & formatting not being updated on locale
  changes.
- Fix T9 search not being triggered when pressing the dial button to
  recall the last dialed number.

Change-Id: Iae1087cf1805fd2840cb6c740e763037d59bd564

Cleanup: Use framework-provided method.

Change-Id: I1b62d65b0a142f64b86a475845316c5042dfc7b1

Contacts: add partial T9 Bulgarian translation.

Contacts: add korean T9 strings (partial)