diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:41 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:41 -0800 |
commit | e9ebcf259bb3dcb9debe0d88db4938cdf3218b9d (patch) | |
tree | 2b6ca0d790af05528a3087d889132b29c52860a6 | |
parent | 70db7ee6ceb8cda604229fe67d5a46ea625f9c98 (diff) | |
download | IM-e9ebcf259bb3dcb9debe0d88db4938cdf3218b9d.tar.gz |
auto import from //depot/cupcake/@137055
28 files changed, 372 insertions, 312 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 09038af..c0b26aa 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -136,7 +136,7 @@ <activity android:name=".app.NewChatActivity" android:configChanges="orientation|keyboardHidden" - android:windowSoftInputMode="stateHidden"> + android:windowSoftInputMode="stateUnchanged"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> diff --git a/plugin/com/android/im/plugin/ImpsConfigNames.java b/plugin/com/android/im/plugin/ImpsConfigNames.java index de64cd4..15e82b7 100644 --- a/plugin/com/android/im/plugin/ImpsConfigNames.java +++ b/plugin/com/android/im/plugin/ImpsConfigNames.java @@ -119,4 +119,9 @@ public interface ImpsConfigNames extends ImConfigNames { * set, the default one will be used. */ public static final String CUSTOM_PASSWORD_DIGEST = "imps.custom-password-digest"; + + /** + * Determines whether the provider support user-defined presence text. + */ + public static final String SUPPORT_USER_DEFINED_PRESENCE = "imps.support-user-defined-presence"; } diff --git a/res/drawable/bubble.xml b/res/drawable/bubble.xml new file mode 100644 index 0000000..c9a7bc7 --- /dev/null +++ b/res/drawable/bubble.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright (C) 2008 Esmertec AG. + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/list_item_im_bubble_pressed" /> + <item android:state_selected="true" android:drawable="@drawable/list_item_im_bubble_selected" /> + <item android:state_enabled="false" android:drawable="@drawable/list_item_im_bubble_default" /> + <item android:drawable="@drawable/list_item_im_bubble_default" /> +</selector> diff --git a/res/drawable/list_item_im_bubble.9.png b/res/drawable/list_item_im_bubble.9.png Binary files differdeleted file mode 100644 index 0c539cf..0000000 --- a/res/drawable/list_item_im_bubble.9.png +++ /dev/null diff --git a/res/drawable/list_item_im_bubble_default.9.png b/res/drawable/list_item_im_bubble_default.9.png Binary files differnew file mode 100644 index 0000000..92f7058 --- /dev/null +++ b/res/drawable/list_item_im_bubble_default.9.png diff --git a/res/drawable/list_item_im_bubble_pressed.9.png b/res/drawable/list_item_im_bubble_pressed.9.png Binary files differnew file mode 100644 index 0000000..2032bc0 --- /dev/null +++ b/res/drawable/list_item_im_bubble_pressed.9.png diff --git a/res/drawable/list_item_im_bubble_selected.9.png b/res/drawable/list_item_im_bubble_selected.9.png Binary files differnew file mode 100644 index 0000000..bd0a1e2 --- /dev/null +++ b/res/drawable/list_item_im_bubble_selected.9.png diff --git a/res/layout/chat_view.xml b/res/layout/chat_view.xml index 3a4363d..0b76029 100644 --- a/res/layout/chat_view.xml +++ b/res/layout/chat_view.xml @@ -159,6 +159,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine|textImeMultiLine" + android:imeOptions="actionSend|flagNoEnterAction" android:maxLines="4" android:maxLength="2000" android:hint="@string/compose_hint"/> diff --git a/res/layout/contact_list_view.xml b/res/layout/contact_list_view.xml index 0bc4018..01e3b50 100644 --- a/res/layout/contact_list_view.xml +++ b/res/layout/contact_list_view.xml @@ -27,13 +27,13 @@ android:id="@+id/userPresence" android:orientation="horizontal" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:paddingLeft="9dip" - android:paddingTop="5dip" - android:paddingRight="5dip" - android:paddingBottom="5dip" + android:layout_height="64dip" android:layout_centerVertical="true" - android:background="#ffff"> + android:paddingTop="9dip" + android:paddingLeft="5dip" + android:paddingBottom="5dip" + android:paddingRight="5dip" + android:background="#ffa9a9a9"> <LinearLayout android:layout_width="wrap_content" @@ -57,7 +57,20 @@ android:layout_gravity="center_vertical" android:layout_weight="1" android:layout_width="0dip" - android:layout_height="wrap_content"/> + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceMediumInverse" + android:visibility="gone"/> + + <TextView android:id="@+id/statusView" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="5dip" + android:paddingLeft="3dip" + android:singleLine="true" + android:visibility="gone" + android:textAppearance="?android:attr/textAppearanceLargeInverse"/> </com.android.im.app.UserPresenceView> diff --git a/res/layout/contact_view.xml b/res/layout/contact_view.xml index daad1ca..b64d990 100644 --- a/res/layout/contact_view.xml +++ b/res/layout/contact_view.xml @@ -28,56 +28,59 @@ android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft" android:paddingRight="9dip"> - <LinearLayout android:id="@+id/contactInfo" - android:orientation="vertical" - android:paddingLeft="6dip" - android:layout_width="fill_parent" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content"> + <RelativeLayout + android:id="@+id/contactInfo" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1" + android:layout_marginRight="5dip" + android:paddingLeft="6dip"> - <LinearLayout android:orientation="horizontal" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <TextView android:id="@+id/line1" - android:maxLines="1" - android:layout_width="0dip" - android:layout_weight="1" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceLarge" /> - - <TextView android:id="@+id/timestamp" - android:singleLine="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone" - android:textAppearance="?android:attr/textAppearanceSmall"/> - </LinearLayout> + <ImageView + android:id="@+id/presence" + android:scaleType="fitXY" + android:layout_centerVertical="true" + android:layout_alignParentRight="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="6dip"> + </ImageView> <LinearLayout - android:orientation="horizontal" + android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="wrap_content"> - <!-- - <ImageView - android:id="@+id/presence" - android:layout_width="18dip" - android:layout_height="18dip" /> - --> - - <com.android.im.app.Ticker - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="4dip"> + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/presence" + android:layout_centerVertical="true"> - <TextView android:id="@+id/line2" - android:maxLines="1" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall"/> - </com.android.im.app.Ticker> - </LinearLayout> + <LinearLayout android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + + <TextView android:id="@+id/line1" + android:maxLines="1" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="wrap_content" + android:textStyle="bold" + android:textAppearance="?android:attr/textAppearanceMedium" + android:ellipsize="marquee" /> - </LinearLayout> + <TextView android:id="@+id/timestamp" + android:singleLine="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="8dip" + android:visibility="gone" + android:textAppearance="?android:attr/textAppearanceSmall"/> + </LinearLayout> + <TextView android:id="@+id/line2" + android:maxLines="1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:ellipsize="marquee"/> + </LinearLayout> + </RelativeLayout> </view> diff --git a/res/layout/group_view.xml b/res/layout/group_view.xml index 2ab2e12..a8bfad1 100644 --- a/res/layout/group_view.xml +++ b/res/layout/group_view.xml @@ -37,7 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="4dip" + android:paddingRight="10dip" android:textAppearance="?android:attr/textAppearanceSmall"/> </LinearLayout> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 304975d..3d4b63d 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -179,9 +179,9 @@ <string name="not_signed_in">"No has accedido a tu cuenta."</string> <string name="general_error">"Código de error <xliff:g id="CODE">%1$d</xliff:g>"</string> <string-array name="default_smiley_names"> - <item>"Feliz"</item> + <item>"Contento"</item> <item>"Triste"</item> - <item>"Guiñando"</item> + <item>"Guiño"</item> <item>"Sacando la lengua"</item> <item>"Sorprendido"</item> <item>"Besando"</item> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 4838cf9..8fbf37b 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -15,12 +15,12 @@ --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="im_label">"MI"</string> + <string name="im_label">"Chat"</string> <string name="menu_cancel_signin">"Annuler la connexion"</string> <string name="menu_add_contact">"Ajouter un contact"</string> <string name="menu_remove_contact">"Supprimer le contact"</string> <string name="menu_block_contact">"Bloquer le contact"</string> - <string name="menu_view_blocked">"Bloqué"</string> + <string name="menu_view_blocked">"Bloqués"</string> <string name="menu_view_accounts">"Liste des comptes"</string> <string name="menu_settings">"Paramètres"</string> <string name="menu_start_chat">"Lancer un chat"</string> @@ -46,12 +46,12 @@ <string name="add_account">"Ajouter un compte <xliff:g id="ACCOUNT">%1$s</xliff:g>"</string> <string name="label_username">"Nom d\'utilisateur :"</string> <string name="label_password">"Mot de passe :"</string> - <string name="remember_password">"Mémoriser mon mot de passe."</string> - <string name="keep_me_signed_in">"Me connecter automatiquement."</string> + <string name="remember_password">"Mémoriser mon mot de passe"</string> + <string name="keep_me_signed_in">"Me connecter automatiquement"</string> <string name="sign_up">"Vous ne possédez pas de compte ?"</string> <string name="check_auto_sign_in">"Cette option vous connecte automatiquement à chaque fois que vous ouvrez cette application. Pour désactiver l\'option, déconnectez-vous, puis décochez la case \"Connexion automatique\"."</string> <string name="sign_in">"Se connecter"</string> - <string name="signing_in_to">"Se connecter à <xliff:g id="ACCOUNT">%1$s</xliff:g>"</string> + <string name="signing_in_to">"Connexion à <xliff:g id="ACCOUNT">%1$s</xliff:g>"</string> <string name="signing_in_wait">"Connexion..."</string> <!-- no translation found for bg_data_prompt_title (4861800723853178111) --> <skip /> @@ -120,12 +120,12 @@ <string name="setting_title">"Paramètres généraux"</string> <string name="hide_offline_contacts">"Masquer les contacts hors ligne"</string> <string name="notification_group_title">"Paramètres des notifications"</string> - <string name="notification_enabled_title">"Notifications de MI"</string> - <string name="notification_enabled_summary">"Signaler la réception d\'un MI dans la barre d\'état"</string> - <string name="notification_vibrate_title">"Vibrer"</string> - <string name="notification_vibrate_summary">"Vibre également à la réception d\'un MI"</string> + <string name="notification_enabled_title">"Notifications de chat"</string> + <string name="notification_enabled_summary">"Signaler la réception d\'un chat dans la barre d\'état"</string> + <string name="notification_vibrate_title">"Vibreur"</string> + <string name="notification_vibrate_summary">"Vibre également à la réception d\'un chat"</string> <string name="notification_sound_title">"Son"</string> - <string name="notification_sound_summary">"Déclencher la sonnerie lors de la réception d\'un MI"</string> + <string name="notification_sound_summary">"Déclencher la sonnerie lors de la réception d\'un chat"</string> <string name="notification_ringtone_title">"Sélectionner une sonnerie"</string> <string name="invitation_prompt">"<xliff:g id="USER">%1$s</xliff:g> vous a invité à rejoindre un chat en groupe."</string> <string name="invitation_sent_prompt">"L\'invitation a été envoyé à <xliff:g id="USER">%1$s</xliff:g>."</string> @@ -145,8 +145,8 @@ <string name="delete_contact_success">"Contact \"<xliff:g id="USER">%1$s</xliff:g>\" supprimé."</string> <string name="block_contact_success">"Contact \"<xliff:g id="USER">%1$s</xliff:g>\" bloqué."</string> <string name="unblock_contact_success">"Contact \"<xliff:g id="USER">%1$s</xliff:g>\" débloqué."</string> - <string name="perm_label">"démarrer le service de MI"</string> - <string name="perm_desc">"Permet aux applications de lancer le service de MI via Intent."</string> + <string name="perm_label">"démarrer le service de chat"</string> + <string name="perm_desc">"Permet aux applications de lancer le service de chat via Intent."</string> <string name="error">"Avertissement"</string> <string name="login_service_failed">"Connexion au service <xliff:g id="SERVICE">%1$s</xliff:g> impossible. Veuillez réessayer ultérieurement."\n"(Détails : <xliff:g id="DESCRIPTION">%2$s</xliff:g>)"</string> <string name="add_list_failed">"La liste n\'a pas été ajoutée."</string> @@ -175,7 +175,7 @@ <string name="session_expired">"La session a expiré. Veuillez vous reconnecter."</string> <string name="forced_logout">"vous vous êtes connecté depuis un autre client."</string> <string name="already_logged_in">"vous êtes déjà connecté depuis un autre client."</string> - <string name="msisdn_error">"Désolé, impossible de lire le numéro de téléphone de votre carte SIM. Veuillez contacter votre opérateur pour obtenir de l\'aide."</string> + <string name="msisdn_error">"Impossible de lire le numéro de téléphone de votre carte SIM. Veuillez contacter votre opérateur pour obtenir de l\'aide."</string> <string name="not_signed_in">"Vous n\'êtes pas connecté actuellement."</string> <string name="general_error">"Code d\'erreur <xliff:g id="CODE">%1$d</xliff:g>"</string> <string-array name="default_smiley_names"> @@ -184,8 +184,8 @@ <item>"Clin d\'oeil"</item> <item>"Tire la langue"</item> <item>"Surpris"</item> - <item>"Bisous"</item> - <item>"Crier"</item> + <item>"Bisou"</item> + <item>"Hurle"</item> <item>"Cool"</item> <item>"Argent"</item> <item>"Embarrassé"</item> @@ -194,7 +194,7 @@ <item>"Indécis"</item> <item>"Pleure"</item> <item>"Motus et bouche cousue"</item> - <item>"Rire"</item> + <item>"Rigole"</item> <item>"Confus"</item> </string-array> <string-array name="default_smiley_texts"> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index e3b801f..ec1e57d 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -15,12 +15,12 @@ --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="im_label">"IM"</string> + <string name="im_label">"Chat"</string> <string name="menu_cancel_signin">"Annulla accesso"</string> <string name="menu_add_contact">"Aggiungi contatto"</string> <string name="menu_remove_contact">"Elimina contatto"</string> <string name="menu_block_contact">"Blocca contatto"</string> - <string name="menu_view_blocked">"Bloccato"</string> + <string name="menu_view_blocked">"Bloccati"</string> <string name="menu_view_accounts">"Elenco account"</string> <string name="menu_settings">"Impostazioni"</string> <string name="menu_start_chat">"Inizia conversazione"</string> @@ -120,12 +120,12 @@ <string name="setting_title">"Impostazioni generali"</string> <string name="hide_offline_contacts">"Nascondi contatti offline"</string> <string name="notification_group_title">"Impostazioni notifiche"</string> - <string name="notification_enabled_title">"Notifiche IM"</string> - <string name="notification_enabled_summary">"Notifica in barra di stato quando arriva msg IM"</string> + <string name="notification_enabled_title">"Notifiche chat"</string> + <string name="notification_enabled_summary">"Notifica in barra di stato all\'arrivo di un messaggio"</string> <string name="notification_vibrate_title">"Vibrazione"</string> - <string name="notification_vibrate_summary">"Vibra anche quando arriva msg IM"</string> + <string name="notification_vibrate_summary">"Vibra anche all\'arrivo di msg chat"</string> <string name="notification_sound_title">"Allarme"</string> - <string name="notification_sound_summary">"Usa suoneria anche quando arriva msg IM"</string> + <string name="notification_sound_summary">"Usa anche suoneria all\'arrivo di msg chat"</string> <string name="notification_ringtone_title">"Seleziona suoneria"</string> <string name="invitation_prompt">"<xliff:g id="USER">%1$s</xliff:g> ti ha invitato a unirti a una conversazione di gruppo."</string> <string name="invitation_sent_prompt">"L\'invito è stato inviato a <xliff:g id="USER">%1$s</xliff:g>."</string> @@ -181,20 +181,20 @@ <string-array name="default_smiley_names"> <item>"Felice"</item> <item>"Triste"</item> - <item>"Fare l\'occhiolino"</item> - <item>"Lingua fuori"</item> + <item>"Occhiolino"</item> + <item>"Linguaccia"</item> <item>"Sorpreso"</item> - <item>"Baciare"</item> - <item>"Urlare"</item> - <item>"Favoloso"</item> - <item>"Bocca a forma di dollaro"</item> + <item>"Bacio"</item> + <item>"Urlo"</item> + <item>"Fico"</item> + <item>"Fatti, non parole"</item> <item>"Gaffe"</item> <item>"Imbarazzato"</item> <item>"Angelo"</item> <item>"Indeciso"</item> - <item>"Piangere"</item> + <item>"Piango"</item> <item>"Labbra cucite"</item> - <item>"Sorridere"</item> + <item>"Risata"</item> <item>"Confuso"</item> </string-array> <string-array name="default_smiley_texts"> diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml index 9d6b208..dffe5ef 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -34,9 +34,9 @@ <string name="menu_plus">"Meny+"</string> <string name="default_input_title">"Inndata"</string> <string name="confirm">"Bekreft"</string> - <string name="confirm_delete_contact">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" vil bli slettet."</string> - <string name="confirm_block_contact">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" vil bli blokkert."</string> - <string name="confirm_unblock_contact">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" vil bli avblokkert."</string> + <string name="confirm_delete_contact">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" vil bli slettet."</string> + <string name="confirm_block_contact">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" vil bli blokkert."</string> + <string name="confirm_unblock_contact">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" vil bli avblokkert."</string> <string name="ok">"OK"</string> <string name="cancel">"Avbryt"</string> <string name="yes">"OK"</string> @@ -49,7 +49,7 @@ <string name="remember_password">"Husk passord."</string> <string name="keep_me_signed_in">"Logg inn automatisk."</string> <string name="sign_up">"Mangler du konto?"</string> - <string name="check_auto_sign_in">"Dette valget logger deg automatisk inn hver gang du åpner applikasjonen. For å avmerke valget, logg ut og fjern så haken ved \\\\\\\"Logg inn automatis\\\\\\\"."</string> + <string name="check_auto_sign_in">"Dette valget logger deg automatisk inn hver gang du åpner applikasjonen. For å avmerke valget, logg ut og fjern så haken ved \"Logg inn automatis\"."</string> <string name="sign_in">"Logg inn"</string> <string name="signing_in_to">"Logger inn på <xliff:g id="ACCOUNT">%1$s</xliff:g>"</string> <string name="signing_in_wait">"Logger inn…"</string> @@ -143,10 +143,10 @@ <string name="subscription_notify_text">"Ny venneinvitasjon fra <xliff:g id="USER">%s</xliff:g>"</string> <string name="notify_groupchat_label">"Invitasjon til gruppesamtale"</string> <string name="group_chat_invite_notify_text">"Ny invitasjon til gruppesamtale fra <xliff:g id="USER">%s</xliff:g>"</string> - <string name="add_contact_success">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" ble lagt til."</string> - <string name="delete_contact_success">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" ble slettet."</string> - <string name="block_contact_success">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" ble blokkert."</string> - <string name="unblock_contact_success">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" ble avblokkert."</string> + <string name="add_contact_success">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" ble lagt til."</string> + <string name="delete_contact_success">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" ble slettet."</string> + <string name="block_contact_success">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" ble blokkert."</string> + <string name="unblock_contact_success">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" ble avblokkert."</string> <string name="perm_label">"start lynmeldingstjeneste"</string> <string name="perm_desc">"Tillater applikasjoner å starte lynmeldingstjenesten."</string> <string name="error">"NB"</string> @@ -160,7 +160,7 @@ <string name="load_contact_list_failed">"Kontaktlisten ble ikke lastet."</string> <string name="cant_connect_to_server">"Kan ikke koble til tjeneren. Sjekk tilkoblingen."</string> <string name="contact_already_exist">"<xliff:g id="USER">%1$s</xliff:g> finnes allerede i kontaktlisten."</string> - <string name="contact_blocked">"Kontakten \\\\\\\"<xliff:g id="USER">%1$s</xliff:g>\\\\\\\" er nå blokkert."</string> + <string name="contact_blocked">"Kontakten \"<xliff:g id="USER">%1$s</xliff:g>\" er nå blokkert."</string> <string name="contact_not_loaded">"Vent mens kontaktlisten lastes."</string> <string name="network_error">"Det oppsto en nettfeil."</string> <string name="service_not_support">"Tjeneren støtter ikke denne funksjonen."</string> @@ -212,8 +212,8 @@ <item>":-!"</item> <item>":-["</item> <item>"O:-)"</item> - <item>":-\\\\\\\\"</item> - <item>":\\\\\\\'("</item> + <item>":-\\"</item> + <item>":\\\\\'("</item> <item>":-X"</item> <item>":-D"</item> <item>"o_O"</item> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index d437686..01c1ee4 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -27,7 +27,7 @@ <string name="menu_sign_out">"Afmelden"</string> <string name="menu_view_profile">"Profiel weergeven"</string> <string name="menu_end_conversation">"Chat beëindigen"</string> - <string name="menu_view_contact_list">"Lijst met contactpersonen"</string> + <string name="menu_view_contact_list">"Lijst met contacten"</string> <string name="menu_invite_contact">"Uitnodigen..."</string> <string name="menu_switch_chats">"Schakelen tussen chats"</string> <string name="menu_insert_smiley">"Smiley invoegen"</string> @@ -67,11 +67,11 @@ <string name="unknown_contact">"("<i>"Onbekend"</i>")"</string> <string name="empty_contact_group">"Leeg"</string> <string name="empty_conversation_group">"Geen gesprekken"</string> - <string name="contacts_picker_title">"Contactpersonen selecteren om uit te nodigen"</string> + <string name="contacts_picker_title">"Contacten selecteren om uit te nodigen"</string> <string name="contact_filter_hint">"Typ om een contactpersoon te vinden"</string> - <string name="empty_contact_list">"Kan geen contactpersonen vinden."</string> - <string name="blocked_list_title">"Geblokkeerde contactpersonen - <xliff:g id="USER">%1$s</xliff:g>"</string> - <string name="no_blocked_contact">"Geen geblokkeerde contactpersonen."</string> + <string name="empty_contact_list">"Kan geen contacten vinden."</string> + <string name="blocked_list_title">"Geblokkeerde contacten - <xliff:g id="USER">%1$s</xliff:g>"</string> + <string name="no_blocked_contact">"Geen geblokkeerde contacten."</string> <string name="contact_profile_title">"Profiel van contactpersoon"</string> <string name="label_status">"Status:"</string> <string name="label_client_type">"Type client:"</string> @@ -109,16 +109,16 @@ <string name="msg_sent_failed">"Dit bericht kan niet worden verzonden."</string> <string name="disconnected_warning">"Verbinding met de server is verbroken. Berichten worden verzonden wanneer u online bent."</string> <string name="contact_offline_warning">"<xliff:g id="USER_0">%1$s</xliff:g> is offline. Berichten die u verzendt, worden afgeleverd wanneer <xliff:g id="USER_1">%1$s</xliff:g> online komt."</string> - <string name="contact_not_in_list_warning">"<xliff:g id="USER">%1$s</xliff:g> staat niet in uw lijst met contactpersonen"</string> + <string name="contact_not_in_list_warning">"<xliff:g id="USER">%1$s</xliff:g> staat niet in uw lijst met contacten"</string> <string name="select_link_title">"Link selecteren"</string> <string name="empty_chat_list">"Geen actieve chats."</string> <string name="add_contact_title">"Contactpersoon toevoegen"</string> <string name="input_contact_label">"E-mailadres van persoon die u wilt uitnodigen:"</string> <string name="choose_list_label">"Een lijst kiezen:"</string> - <string name="invite_instruction">"Typ een naam om toe te voegen vanuit \'Contactpersonen\'."</string> + <string name="invite_instruction">"Typ een naam om toe te voegen vanuit \'Contacten\'."</string> <string name="invite_label">"Uitnodiging verzenden"</string> <string name="setting_title">"Algemene instellingen"</string> - <string name="hide_offline_contacts">"Offline contactpersonen verbergen"</string> + <string name="hide_offline_contacts">"Offline contacten verbergen"</string> <string name="notification_group_title">"Instellingen voor meldingen"</string> <string name="notification_enabled_title">"Meldingen voor chatberichten"</string> <string name="notification_enabled_summary">"Melding op statusbalk weergeven wanneer een chatbericht wordt ontvangen"</string> @@ -131,7 +131,7 @@ <string name="invitation_sent_prompt">"Er is een uitnodiging verzonden naar <xliff:g id="USER">%1$s</xliff:g>."</string> <string name="accept_invitation">"Accepteren"</string> <string name="decline_invitation">"Afwijzen"</string> - <string name="subscription_prompt">"<xliff:g id="USER">%1$s</xliff:g> heeft u uitgenodigd voor zijn/haar lijst met contactpersonen."</string> + <string name="subscription_prompt">"<xliff:g id="USER">%1$s</xliff:g> heeft u uitgenodigd voor zijn/haar lijst met contacten."</string> <string name="approve_subscription">"Accepteren"</string> <string name="decline_subscription">"Afwijzen"</string> <string name="approve_subscription_error">"Kan het abonnement van <xliff:g id="USER">%1$s</xliff:g> niet goedkeuren. Probeer het later opnieuw."</string> @@ -155,11 +155,11 @@ <string name="select_contact">"Selecteer eerst een contactpersoon."</string> <string name="disconnected">"Verbinding verbroken!"\n</string> <string name="service_error">"Servicefout."</string> - <string name="load_contact_list_failed">"De lijst met contactpersonen is niet geladen."</string> + <string name="load_contact_list_failed">"De lijst met contacten is niet geladen."</string> <string name="cant_connect_to_server">"Kan geen verbinding maken met de server. Controleer uw verbinding."</string> - <string name="contact_already_exist">"<xliff:g id="USER">%1$s</xliff:g> staat al in uw lijst met contactpersonen."</string> + <string name="contact_already_exist">"<xliff:g id="USER">%1$s</xliff:g> staat al in uw lijst met contacten."</string> <string name="contact_blocked">"Contactpersoon \'<xliff:g id="USER">%1$s</xliff:g>\' is geblokkeerd."</string> - <string name="contact_not_loaded">"Uw lijst met contactpersonen wordt geladen."</string> + <string name="contact_not_loaded">"Uw lijst met contacten wordt geladen."</string> <string name="network_error">"Er is een netwerkfout opgetreden."</string> <string name="service_not_support">"Deze functionaliteit wordt niet ondersteund door de server."</string> <string name="invalid_password">"Het opgegeven wachtwoord is ongeldig."</string> @@ -202,7 +202,7 @@ <item>":-("</item> <item>";-)"</item> <item>":-P"</item> - <item>"=-O"</item> + <item>"Err:502"</item> <item>":-*"</item> <item>":O"</item> <item>"B-)"</item> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 8cf3cd9..837d030 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -30,7 +30,7 @@ <string name="menu_view_contact_list">"Lista kontaktów"</string> <string name="menu_invite_contact">"Zaproś…"</string> <string name="menu_switch_chats">"Przełącz czaty"</string> - <string name="menu_insert_smiley">"Wstaw emotikon"</string> + <string name="menu_insert_smiley">"Wstaw buźkę"</string> <string name="menu_plus">"Menu+"</string> <string name="default_input_title">"Katalog wejściowy"</string> <string name="confirm">"Potwierdź"</string> @@ -73,7 +73,7 @@ <string name="blocked_list_title">"Zablokowane kontakty - <xliff:g id="USER">%1$s</xliff:g>"</string> <string name="no_blocked_contact">"Brak zablokowanych kontaktów."</string> <string name="contact_profile_title">"Profil kontaktu"</string> - <string name="label_status">"Stan:"</string> + <string name="label_status">"Status:"</string> <string name="label_client_type">"Typ klienta:"</string> <string name="client_type_computer">"Komputer"</string> <string name="client_type_mobile">"Przenośny"</string> @@ -120,12 +120,12 @@ <string name="setting_title">"Ustawienia ogólne"</string> <string name="hide_offline_contacts">"Ukryj kontakty offline"</string> <string name="notification_group_title">"Ustawienia powiadomień"</string> - <string name="notification_enabled_title">"Powiadomienia wiadomości błyskawicznych"</string> - <string name="notification_enabled_summary">"Sygnalizuj nadejście wiadomości błyskawicznej na pasku stanu"</string> + <string name="notification_enabled_title">"Powiadamiaj o czacie"</string> + <string name="notification_enabled_summary">"Sygnalizuj nową wiadomość na czacie na pasku stanu"</string> <string name="notification_vibrate_title">"Wibracje"</string> - <string name="notification_vibrate_summary">"Sygnalizuj nadejście wiadomości błyskawicznej wibracją"</string> + <string name="notification_vibrate_summary">"Sygnalizuj wiadomość na czacie wibracją"</string> <string name="notification_sound_title">"Dźwięk"</string> - <string name="notification_sound_summary">"Sygnalizuj nadejście wiadomości błyskawicznej dzwonkiem"</string> + <string name="notification_sound_summary">"Sygnalizuj wiadomość na czacie dzwonkiem"</string> <string name="notification_ringtone_title">"Wybierz dzwonek"</string> <string name="invitation_prompt">"<xliff:g id="USER">%1$s</xliff:g> przesyła zaproszenie do czatu grupowego."</string> <string name="invitation_sent_prompt">"Wysłano zaproszenie do użytkownika <xliff:g id="USER">%1$s</xliff:g>."</string> @@ -146,7 +146,7 @@ <string name="block_contact_success">"Zablokowano kontakt „<xliff:g id="USER">%1$s</xliff:g>”."</string> <string name="unblock_contact_success">"Odblokowano kontakt „<xliff:g id="USER">%1$s</xliff:g>”."</string> <string name="perm_label">"uruchom usługę wiadomości błyskawicznych"</string> - <string name="perm_desc">"Umożliwia aplikacjom uruchamianie usługi wiadomości błyskawicznych przez zamierzenie."</string> + <string name="perm_desc">"Umożliwia aplikacjom uruchamianie czatu na żądanie."</string> <string name="error">"Uwaga"</string> <string name="login_service_failed">"Nie można zalogować do usługi <xliff:g id="SERVICE">%1$s</xliff:g>. Spróbuj ponownie później."\n"(Szczegóły: <xliff:g id="DESCRIPTION">%2$s</xliff:g>)"</string> <string name="add_list_failed">"Nie dodano listy."</string> diff --git a/samples/PluginDemo/res/values-es/strings.xml b/samples/PluginDemo/res/values-es/strings.xml index 8fde664..5f0338d 100644 --- a/samples/PluginDemo/res/values-es/strings.xml +++ b/samples/PluginDemo/res/values-es/strings.xml @@ -35,9 +35,9 @@ <string name="input_contact_label">"Nombre de pantalla de la persona que quieres añadir:"</string> <string name="invite_label">"Añadir amigo"</string> <string-array name="smiley_names"> - <item>"Feliz"</item> + <item>"Contento"</item> <item>"Triste"</item> - <item>"Guiñando"</item> + <item>"Guiño"</item> <item>"Sacando la lengua"</item> <item>"Sorprendido"</item> <item>"Besando"</item> diff --git a/samples/PluginDemo/res/values-fr/strings.xml b/samples/PluginDemo/res/values-fr/strings.xml index 8d490e3..7d6af6f 100644 --- a/samples/PluginDemo/res/values-fr/strings.xml +++ b/samples/PluginDemo/res/values-fr/strings.xml @@ -40,8 +40,8 @@ <item>"Clin d\'œil"</item> <item>"Tire la langue"</item> <item>"Surpris"</item> - <item>"Bisous"</item> - <item>"Crier"</item> + <item>"Bisou"</item> + <item>"Hurle"</item> <item>"Cool"</item> <item>"Argent"</item> <item>"Embarrassé"</item> @@ -50,7 +50,7 @@ <item>"Indécis"</item> <item>"Pleure"</item> <item>"Motus et bouche cousue"</item> - <item>"Rire"</item> + <item>"Rigole"</item> <item>"Confus"</item> </string-array> <string-array name="smiley_texts"> diff --git a/samples/PluginDemo/res/values-it/strings.xml b/samples/PluginDemo/res/values-it/strings.xml index 19dbc78..622b5ef 100644 --- a/samples/PluginDemo/res/values-it/strings.xml +++ b/samples/PluginDemo/res/values-it/strings.xml @@ -19,7 +19,7 @@ <string name="menu_remove_contact">"Elimina contatto"</string> <string name="menu_block_contact">"Blocca"</string> <string name="menu_contact_list">"Elenco contatti"</string> - <string name="menu_start_chat">"Invia IM"</string> + <string name="menu_start_chat">"Invia msg chat"</string> <string name="menu_view_profile">"Info amico"</string> <string name="menu_end_conversation">"Termina conversazione"</string> <string name="menu_switch_chats">"Cambia conversazione"</string> @@ -37,20 +37,20 @@ <string-array name="smiley_names"> <item>"Felice"</item> <item>"Triste"</item> - <item>"Fare l\'occhiolino"</item> - <item>"Lingua fuori"</item> + <item>"Occhiolino"</item> + <item>"Linguaccia"</item> <item>"Sorpreso"</item> - <item>"Baciare"</item> - <item>"Urlare"</item> - <item>"Favoloso"</item> - <item>"Bocca a forma di dollaro"</item> + <item>"Bacio"</item> + <item>"Urlo"</item> + <item>"Fico"</item> + <item>"Fatti, non parole"</item> <item>"Gaffe"</item> <item>"Imbarazzato"</item> <item>"Angelo"</item> <item>"Indeciso"</item> - <item>"Piangere"</item> + <item>"Piango"</item> <item>"Labbra cucite"</item> - <item>"Sorridere"</item> + <item>"Risata"</item> <item>"Confuso"</item> </string-array> <string-array name="smiley_texts"> diff --git a/samples/PluginDemo/res/values-nb/strings.xml b/samples/PluginDemo/res/values-nb/strings.xml index 6a92d62..57056b6 100644 --- a/samples/PluginDemo/res/values-nb/strings.xml +++ b/samples/PluginDemo/res/values-nb/strings.xml @@ -67,7 +67,7 @@ <item>":-["</item> <item>"O:-)"</item> <item>":-\\\\"</item> - <item>":\\\'("</item> + <item>":\'("</item> <item>":-X"</item> <item>":-D"</item> <item>"o_O"</item> diff --git a/samples/PluginDemo/res/values-nl/strings.xml b/samples/PluginDemo/res/values-nl/strings.xml index f719753..38b96fe 100644 --- a/samples/PluginDemo/res/values-nl/strings.xml +++ b/samples/PluginDemo/res/values-nl/strings.xml @@ -18,7 +18,7 @@ <string name="menu_add_contact">"Contactpersoon toevoegen"</string> <string name="menu_remove_contact">"Contactpersoon verwijderen"</string> <string name="menu_block_contact">"Blokkeren"</string> - <string name="menu_contact_list">"Lijst met contactpersonen"</string> + <string name="menu_contact_list">"Lijst met contacten"</string> <string name="menu_start_chat">"Chat verzenden"</string> <string name="menu_view_profile">"Buddygegevens"</string> <string name="menu_end_conversation">"Conversatie beëindigen"</string> @@ -26,7 +26,7 @@ <string name="menu_insert_smiley">"Emoticons invoegen"</string> <string name="sign_up">"Een nieuw account verkrijgen"</string> <string name="check_save_password">"Als u uw telefoon verliest of als deze wordt gestolen, moet u voor uw veiligheid naar de website gaan op uw computer en uw wachtwoord wijzigen."</string> - <string name="buddy_list_title">"Lijst met contactpersonen - <xliff:g id="USERNAME">%1$s</xliff:g>"</string> + <string name="buddy_list_title">"Lijst met contacten - <xliff:g id="USERNAME">%1$s</xliff:g>"</string> <string name="label_username">"Gebruikersnaam:"</string> <string name="ongoing_conversation">"Conversaties (<xliff:g id="NUMBER">%1$d</xliff:g>)"</string> <string name="contact_profile_title">"Contactgegevens"</string> @@ -58,7 +58,7 @@ <item>":-("</item> <item>";-)"</item> <item>":-P"</item> - <item>"=-O"</item> + <item>"Err:502"</item> <item>":-*"</item> <item>":O"</item> <item>"B-)"</item> diff --git a/samples/PluginDemo/res/values-pl/strings.xml b/samples/PluginDemo/res/values-pl/strings.xml index 8a088d2..4b57b8a 100644 --- a/samples/PluginDemo/res/values-pl/strings.xml +++ b/samples/PluginDemo/res/values-pl/strings.xml @@ -19,16 +19,16 @@ <string name="menu_remove_contact">"Usuń kontakt"</string> <string name="menu_block_contact">"Zablokuj"</string> <string name="menu_contact_list">"Lista kontaktów"</string> - <string name="menu_start_chat">"Wyślij wiadomość"</string> + <string name="menu_start_chat">"Wyślij wiadomość przez czat"</string> <string name="menu_view_profile">"Informacje o znajomym"</string> <string name="menu_end_conversation">"Zakończ rozmowę"</string> <string name="menu_switch_chats">"Przełącz czaty"</string> - <string name="menu_insert_smiley">"Wstaw emotikony"</string> + <string name="menu_insert_smiley">"Wstaw buźkę"</string> <string name="sign_up">"Utwórz nowe konto"</string> <string name="check_save_password">"Ze względów bezpieczeństwa w przypadku zgubienia lub kradzieży telefonu odwiedź witrynę internetową ze swojego komputera i zmień hasło."</string> - <string name="buddy_list_title">"Lista kontaktów — <xliff:g id="USERNAME">%1$s</xliff:g>"</string> + <string name="buddy_list_title">"Lista kontaktów – <xliff:g id="USERNAME">%1$s</xliff:g>"</string> <string name="label_username">"Nazwa użytkownika:"</string> - <string name="ongoing_conversation">"Rozmowy <xliff:g id="NUMBER">%1$d</xliff:g>"</string> + <string name="ongoing_conversation">"Rozmowy: <xliff:g id="NUMBER">%1$d</xliff:g>"</string> <string name="contact_profile_title">"Informacje kontaktowe"</string> <string name="presence_available">"Dostępny"</string> <string name="add_contact_title">"Dodaj kontakt"</string> diff --git a/src/com/android/im/app/ChatView.java b/src/com/android/im/app/ChatView.java index bc1da91..f3d0d34 100644 --- a/src/com/android/im/app/ChatView.java +++ b/src/com/android/im/app/ChatView.java @@ -348,15 +348,27 @@ public class ChatView extends LinearLayout { case KeyEvent.KEYCODE_ENTER: if (event.isAltPressed()) { mEdtInput.append("\n"); - } else { - handleEnterKey(); + return true; } - return true; } } return false; } }); + + mEdtInput.setOnEditorActionListener(new TextView.OnEditorActionListener() { + public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + if (event != null) { + if (event.isAltPressed()) { + return false; + } + } + + sendMessage(); + return true; + } + }); + // TODO: this is a hack to implement BUG #1611278, when dispatchKeyEvent() works with // the soft keyboard, we should remove this hack. mEdtInput.addTextChangedListener(new TextWatcher() { @@ -411,26 +423,6 @@ public class ChatView extends LinearLayout { unregisterChatSessionListener(); } - private void handleEnterKey() { - Configuration config = getResources().getConfiguration(); - if (config.orientation == config.ORIENTATION_LANDSCAPE) { - // in the landscape mode, we'll send the message if the user is using a physical - // keyboard. However, on the soft keyboard, we'll close the keyboard and put the - // focus on the Send button, in order to prevent accidental sending the message. - if (config.hardKeyboardHidden == config.HARDKEYBOARDHIDDEN_NO) { - sendMessage(); - } else { - closeSoftKeyboard(); - mSendButton.requestFocus(); - } - } else { - // in the portrait mode, the user would always be using the soft keyboard, so pressing - // the Enter key would close the keyboard and puts the focus on the Send button. - closeSoftKeyboard(); - mSendButton.requestFocus(); - } - } - private void closeSoftKeyboard() { InputMethodManager inputMethodManager = (InputMethodManager)mApp.getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/src/com/android/im/app/ContactView.java b/src/com/android/im/app/ContactView.java index c5d807d..38ee6cf 100644 --- a/src/com/android/im/app/ContactView.java +++ b/src/com/android/im/app/ContactView.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; -import android.os.Handler; import android.provider.Im; import android.text.Spannable; import android.text.SpannableString; @@ -34,8 +33,6 @@ import android.text.style.RelativeSizeSpan; import android.text.style.UnderlineSpan; import android.util.AttributeSet; import android.view.View; -import android.view.animation.Animation; -import android.view.animation.TranslateAnimation; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -81,12 +78,8 @@ public class ContactView extends LinearLayout { private TextView mLine2; private TextView mTimeStamp; - private Handler mHandler; - private boolean mLayoutDirty; - public ContactView(Context context, AttributeSet attrs) { super(context, attrs); - mLayoutDirty = true; } @Override @@ -98,58 +91,6 @@ public class ContactView extends LinearLayout { mLine2 = (TextView) findViewById(R.id.line2); mLine2.setCompoundDrawablePadding(5); mTimeStamp = (TextView)findViewById(R.id.timestamp); - - mHandler = new Handler(); - } - - @Override - public void setSelected(boolean selected) { - super.setSelected(selected); - if(selected) { - // While layout, the width of children is unknown, we have to start - // animation when layout is done. - if (mLayoutDirty) { - mHandler.post(new Runnable() { - public void run() { - startAnimationNow(); - } - }); - } else { - startAnimationNow(); - } - } else { - mLine2.clearAnimation(); - } - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - mLayoutDirty = false; - super.onLayout(changed, l, t, r, b); - } - - @Override - public void requestLayout() { - super.requestLayout(); - mLayoutDirty = true; - } - - /*package*/ void startAnimationNow() { - View parent = (View)mLine2.getParent(); - int width = mLine2.getWidth(); - - int parentWidth = parent.getWidth() - parent.getPaddingLeft() - - parent.getPaddingRight(); - if(width > parentWidth) { - int fromXDelta = parentWidth; - int toXDelta = - width; - int duration = (fromXDelta - toXDelta) * 32; - Animation animation = new TranslateAnimation(fromXDelta, toXDelta, 0, 0); - animation.setDuration(duration); - animation.setRepeatMode(Animation.RESTART); - animation.setRepeatCount(Animation.INFINITE); - mLine2.startAnimation(animation); - } } public void bind(Cursor cursor, String underLineText, boolean scrolling) { @@ -263,7 +204,7 @@ public class ContactView extends LinearLayout { View contactInfoPanel = findViewById(R.id.contactInfo); if (hasChat && showChatMsg) { - contactInfoPanel.setBackgroundResource(R.drawable.list_item_im_bubble); + contactInfoPanel.setBackgroundResource(R.drawable.bubble); mLine1.setTextColor(r.getColor(R.color.chat_contact)); } else { contactInfoPanel.setBackgroundDrawable(null); diff --git a/src/com/android/im/app/FrontDoorPlugin.java b/src/com/android/im/app/FrontDoorPlugin.java index 4ef7041..51e686c 100644 --- a/src/com/android/im/app/FrontDoorPlugin.java +++ b/src/com/android/im/app/FrontDoorPlugin.java @@ -50,6 +50,16 @@ public class FrontDoorPlugin extends Service { private final static String TAG = ImApp.LOG_TAG; private final static boolean LOCAL_DEBUG = false; + // database access constants for branding resource map cache table + private final static String[] BRANDING_RESOURCE_MAP_CACHE_PROJECTION = { + Im.BrandingResourceMapCache.PROVIDER_ID, + Im.BrandingResourceMapCache.APP_RES_ID, + Im.BrandingResourceMapCache.PLUGIN_RES_ID + }; + private final static int BRANDING_RESOURCE_MAP_CACHE_PROVIDER_ID_COLUMN = 0; + private final static int BRANDING_RESOURCE_MAP_CACHE_APP_RES_ID_COLUMN = 1; + private final static int BRANDING_RESOURCE_MAP_CACHE_PLUGIN_RES_ID_COLUMN = 2; + private ArrayList<String> mProviderNames; private HashMap<String, String> mPackageNames; private HashMap<String, String> mClassNames; @@ -58,12 +68,18 @@ public class FrontDoorPlugin extends Service { @Override public IBinder onBind(Intent intent) { - loadThirdPartyPlugins(); - loadBrandingResources(); + // temporary provider ID<->Name mappings + HashMap<String, Long> providerNameToId = new HashMap<String, Long>(); + HashMap<Long, String> providerIdToName = new HashMap<Long, String>(); + + loadThirdPartyPlugins(providerNameToId, providerIdToName); + loadBrandingResources(providerNameToId, providerIdToName); + return mBinder; } - private void loadThirdPartyPlugins() { + private void loadThirdPartyPlugins(HashMap<String, Long> providerNameToId, + HashMap<Long, String> providerIdToName) { mProviderNames = new ArrayList<String>(); mPackageNames = new HashMap<String, String>(); mClassNames = new HashMap<String, String>(); @@ -100,7 +116,9 @@ public class FrontDoorPlugin extends Service { mClassNames.put(providerName, serviceInfo.name); mSrcPaths.put(providerName, serviceInfo.applicationInfo.sourceDir); - updateProviderDb(providerName, providerFullName, signUpUrl); + long providerId = updateProviderDb(providerName, providerFullName, signUpUrl); + providerNameToId.put(providerName, providerId); + providerIdToName.put(providerId, providerName); } } @@ -151,9 +169,102 @@ public class FrontDoorPlugin extends Service { return providerId; } - private void loadBrandingResources() { + private void loadBrandingResources(HashMap<String, Long> providerNameToId, + HashMap<Long, String> providerIdToName) { mBrandingResources = new HashMap<String, Map<Integer, Integer>>(); + if (loadBrandingResourcesFromCache(providerIdToName) <= 0) { + Log.w(TAG, "Can't load from cache. Load from plugins..."); + loadBrandingResourcesFromPlugins(); + saveBrandingResourcesToCache(providerNameToId); + } + } + + /** + * Try loading the branding resources from the database. + * @param providerIdToName a map between provider ID and name. + * @return 0 if the resources are not cached yet; otherwise the total count of res id + * pairs. + */ + private int loadBrandingResourcesFromCache(HashMap<Long, String> providerIdToName) { + ContentResolver cr = getContentResolver(); + Cursor c = cr.query( + Im.BrandingResourceMapCache.CONTENT_URI, /* URI */ + BRANDING_RESOURCE_MAP_CACHE_PROJECTION, /* projection */ + null, /* where */ + null, /* where args */ + null /* sort */); + + int count = 0; + if (c != null) { + try { + while (c.moveToNext()) { + long providerId = c.getLong(BRANDING_RESOURCE_MAP_CACHE_PROVIDER_ID_COLUMN); + String provider = providerIdToName.get(providerId); + if (TextUtils.isEmpty(provider)) { + Log.e(TAG, "Empty provider name in branding resource map cache table."); + continue; + } + int appResId = c.getInt(BRANDING_RESOURCE_MAP_CACHE_APP_RES_ID_COLUMN); + int pluginResId = c.getInt(BRANDING_RESOURCE_MAP_CACHE_PLUGIN_RES_ID_COLUMN); + + Map<Integer, Integer> resMap = mBrandingResources.get(provider); + if (resMap == null) { + resMap = new HashMap<Integer, Integer>(); + mBrandingResources.put(provider, resMap); + } + + resMap.put(appResId, pluginResId); + + count++; + } + } finally { + c.close(); + } + } else { + Log.e(TAG, "Query of branding resource map cache table returns empty cursor"); + } + + return count; + } + + /** + * Cache the loaded branding resources in IM database table, so that we can use it + * directly and save loading time. + * @param providerNameToId a map between provider name and ID. + */ + private void saveBrandingResourcesToCache(HashMap<String, Long> providerNameToId) { + ContentResolver cr = getContentResolver(); + + ArrayList<ContentValues> valuesList = new ArrayList<ContentValues>(); + for (String provider : mBrandingResources.keySet()) { + long providerId = providerNameToId.get(provider); + + Map<Integer, Integer> resMap = mBrandingResources.get(provider); + for (int appResId : resMap.keySet()) { + int pluginResId = resMap.get(appResId); + + ContentValues values = new ContentValues(); + values.put(Im.BrandingResourceMapCache.PROVIDER_ID, providerId); + values.put(Im.BrandingResourceMapCache.APP_RES_ID, appResId); + values.put(Im.BrandingResourceMapCache.PLUGIN_RES_ID, pluginResId); + + valuesList.add(values); + } + } + + int size = valuesList.size(); + if (size > 0) { + cr.bulkInsert( + Im.BrandingResourceMapCache.CONTENT_URI, + valuesList.toArray(new ContentValues[size])); + } + } + + /** + * Load the branding resources from all plugin packages. + */ + private void loadBrandingResourcesFromPlugins() { for (String provider : mProviderNames) { if (!mBrandingResources.containsKey(provider)) { if (LOCAL_DEBUG) log("loadBrandingResources: load resource map for " + provider); @@ -166,6 +277,9 @@ public class FrontDoorPlugin extends Service { } } + /** + * Load branding resources from one plugin package. + */ private Map<Integer, Integer> loadBrandingResource(String className, String srcPath) { Map retVal = null; diff --git a/src/com/android/im/app/Ticker.java b/src/com/android/im/app/Ticker.java deleted file mode 100644 index 53d1ae1..0000000 --- a/src/com/android/im/app/Ticker.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007-2008 Esmertec AG. - * Copyright (C) 2007-2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.im.app; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.widget.FrameLayout; - -public class Ticker extends FrameLayout { - - public Ticker(Context context) { - super(context); - } - - public Ticker(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public Ticker(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void measureChild(View child, int parentWidthMeasureSpec, - int parentHeightMeasureSpec) { - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - - int childWidthMeasureSpec; - int childHeightMeasureSpec; - - // Let the child be as wide as it wants, regardless of our bounds - childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); - childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec, mPaddingLeft - + mPaddingRight, lp.width); - - child.measure(childWidthMeasureSpec, childHeightMeasureSpec); - } -} diff --git a/src/com/android/im/app/UserPresenceView.java b/src/com/android/im/app/UserPresenceView.java index d07a00d..1250600 100644 --- a/src/com/android/im/app/UserPresenceView.java +++ b/src/com/android/im/app/UserPresenceView.java @@ -20,6 +20,7 @@ import com.android.im.IImConnection; import com.android.im.R; import com.android.im.engine.ImErrorInfo; import com.android.im.engine.Presence; +import com.android.im.plugin.ImpsConfigNames; import com.google.android.collect.Lists; import android.app.Activity; @@ -37,6 +38,7 @@ import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; +import android.widget.TextView; import java.util.List; @@ -45,7 +47,7 @@ public class UserPresenceView extends LinearLayout { private ImageButton mStatusDialogButton; // views of the popup window - EditText mStatusEditor; + TextView mStatusBar; private final SimpleAlertHandler mHandler; @@ -53,7 +55,7 @@ public class UserPresenceView extends LinearLayout { private long mProviderId; Presence mPresence; - private String mLastStatusEditText; + private String mLastStatusText; final List<StatusItem> mStatusItems = Lists.newArrayList(); public UserPresenceView(Context context, AttributeSet attrs) { @@ -66,35 +68,11 @@ public class UserPresenceView extends LinearLayout { super.onFinishInflate(); mStatusDialogButton = (ImageButton)findViewById(R.id.statusDropDownButton); - mStatusEditor = (EditText)findViewById(R.id.statusEdit); - mStatusDialogButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { showStatusListDialog(); } }); - - mStatusEditor.setOnKeyListener(new OnKeyListener() { - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (KeyEvent.ACTION_DOWN == event.getAction()) { - switch (keyCode) { - case KeyEvent.KEYCODE_DPAD_CENTER: - case KeyEvent.KEYCODE_ENTER: - updateStatusText(); - return true; - } - } - return false; - } - }); - - mStatusEditor.setOnFocusChangeListener(new View.OnFocusChangeListener(){ - public void onFocusChange(View v, boolean hasFocus) { - if (!hasFocus) { - updateStatusText(); - } - } - }); } private void showStatusListDialog() { @@ -139,11 +117,11 @@ public class UserPresenceView extends LinearLayout { } void updateStatusText() { - String newStatusText = mStatusEditor.getText().toString(); + String newStatusText = mStatusBar.getText().toString(); if (TextUtils.isEmpty(newStatusText)) { newStatusText = ""; } - if (!newStatusText.equals(mLastStatusEditText)) { + if (!newStatusText.equals(mLastStatusText)) { updatePresence(-1, newStatusText); } } @@ -173,8 +151,12 @@ public class UserPresenceView extends LinearLayout { if (TextUtils.isEmpty(statusText)) { statusText = brandingRes.getString(PresenceUtils.getStatusStringRes(status)); } - mStatusEditor.setText(statusText); - mLastStatusEditText = statusText; + mLastStatusText = statusText; + + if (mStatusBar == null) { + mStatusBar = initStatusBar(mProviderId); + } + mStatusBar.setText(statusText); // Disable the user to edit the custom status text because // the AIM and MSN server don't support it now. @@ -182,7 +164,45 @@ public class UserPresenceView extends LinearLayout { String providerName = provider == null ? null : provider.mName; if (Im.ProviderNames.AIM.equals(providerName) || Im.ProviderNames.MSN.equals(providerName)) { - mStatusEditor.setFocusable(false); + mStatusBar.setFocusable(false); + } + } + + private TextView initStatusBar(long providerId) { + String value = Im.ProviderSettings.getStringValue( + mContext.getContentResolver(), providerId, + ImpsConfigNames.SUPPORT_USER_DEFINED_PRESENCE); + + if ("true".equalsIgnoreCase(value)) { + EditText statusEdit = (EditText) findViewById(R.id.statusEdit); + statusEdit.setVisibility(View.VISIBLE); + statusEdit.setOnKeyListener(new OnKeyListener() { + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (KeyEvent.ACTION_DOWN == event.getAction()) { + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + updateStatusText(); + return true; + } + } + return false; + } + }); + + statusEdit.setOnFocusChangeListener(new View.OnFocusChangeListener(){ + public void onFocusChange(View v, boolean hasFocus) { + if (!hasFocus) { + updateStatusText(); + } + } + }); + + return statusEdit; + } else { + TextView statusView = (TextView) findViewById(R.id.statusView); + statusView.setVisibility(View.VISIBLE); + return statusView; } } |