summaryrefslogtreecommitdiff
path: root/samples/PluginDemo/src/com/android/im/plugin/demo/DemoImPlugin.java
blob: 5fe6cc0a5dd01d6cf55887a00ea637eb8338fb2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
 * 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.
 */
package com.android.im.plugin.demo;

import com.android.im.plugin.BrandingResourceIDs;
import com.android.im.plugin.ImPlugin;
import com.android.im.plugin.ImConfigNames;
import com.android.im.plugin.ImpsConfigNames;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

import java.util.HashMap;
import java.util.Map;

/**
 * Simple example of writing a plug-in for the IM application.
 *
 */
public class DemoImPlugin extends Service implements ImPlugin {

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

   public Map getProviderConfig() {
       HashMap<String, String> config = new HashMap<String, String>();
       // The protocol name MUST be IMPS now.
       config.put(ImConfigNames.PROTOCOL_NAME, "IMPS");
       config.put(ImpsConfigNames.HOST, "http://xxx.xxxx.xxx");
       config.put(ImpsConfigNames.CLIENT_ID, "Jimmy");
       config.put(ImpsConfigNames.DATA_CHANNEL, "HTTP");
       config.put(ImpsConfigNames.DATA_ENCODING, "WBXML");
       config.put(ImpsConfigNames.CIR_CHANNEL, "STCP");
       config.put(ImpsConfigNames.CUSTOM_PRESENCE_MAPPING,
               "com.android.im.plugin.demo.DemoPresenceMapping");
       return config;
   }

   public Map getResourceMap() {
       HashMap<Integer, Integer> resMapping = new HashMap<Integer, Integer>();
/*       resMapping.put(BrandingResourceIDs.DRAWABLE_LOGO, R.drawable.im_logo);
       resMapping.put(BrandingResourceIDs.DRAWABLE_PRESENCE_ONLINE,
               android.R.drawable.presence_online);
       resMapping.put(BrandingResourceIDs.DRAWABLE_PRESENCE_AWAY,
               android.R.drawable.presence_away);
       resMapping.put(BrandingResourceIDs.DRAWABLE_PRESENCE_BUSY,
               android.R.drawable.presence_busy);
       resMapping.put(BrandingResourceIDs.DRAWABLE_PRESENCE_INVISIBLE,
               android.R.drawable.presence_invisible);
       resMapping.put(BrandingResourceIDs.DRAWABLE_PRESENCE_OFFLINE,
               android.R.drawable.presence_offline);
       resMapping.put(BrandingResourceIDs.DRAWABLE_SPLASH_SCREEN,
               R.drawable.im_logo_splashscr);
       resMapping.put(BrandingResourceIDs.DRAWABLE_READ_CHAT,
               R.drawable.chat);
       resMapping.put(BrandingResourceIDs.DRAWABLE_UNREAD_CHAT,
               R.drawable.chat_new);

       resMapping.put(BrandingResourceIDs.STRING_BUDDY_LIST_TITLE,
               R.string.buddy_list_title);
       resMapping.put(BrandingResourceIDs.STRING_ARRAY_SMILEY_NAMES,
               R.array.smiley_names);
       resMapping.put(BrandingResourceIDs.STRING_ARRAY_SMILEY_TEXTS,
               R.array.smiley_texts);
       resMapping.put(BrandingResourceIDs.STRING_PRESENCE_AVAILABLE,
               R.string.presence_available);

       resMapping.put(BrandingResourceIDs.STRING_LABEL_USERNAME,
               R.string.label_username);
       resMapping.put(BrandingResourceIDs.STRING_ONGOING_CONVERSATION,
               R.string.ongoing_conversation);
       resMapping.put(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE,
               R.string.add_contact_title);
       resMapping.put(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT,
               R.string.input_contact_label);
       resMapping.put(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT,
               R.string.invite_label);
       resMapping.put(BrandingResourceIDs.STRING_CONTACT_INFO_TITLE,
               R.string.contact_profile_title);

       resMapping.put(BrandingResourceIDs.STRING_MENU_ADD_CONTACT,
               R.string.menu_add_contact);
       resMapping.put(BrandingResourceIDs.STRING_MENU_BLOCK_CONTACT,
               R.string.menu_block_contact);
       resMapping.put(BrandingResourceIDs.STRING_MENU_CONTACT_LIST,
               R.string.menu_contact_list);
       resMapping.put(BrandingResourceIDs.STRING_MENU_DELETE_CONTACT,
               R.string.menu_remove_contact);
       resMapping.put(BrandingResourceIDs.STRING_MENU_END_CHAT,
               R.string.menu_end_conversation);
       resMapping.put(BrandingResourceIDs.STRING_MENU_INSERT_SMILEY,
               R.string.menu_insert_smiley);
       resMapping.put(BrandingResourceIDs.STRING_MENU_START_CHAT,
               R.string.menu_start_chat);
       resMapping.put(BrandingResourceIDs.STRING_MENU_VIEW_PROFILE,
               R.string.menu_view_profile);
       resMapping.put(BrandingResourceIDs.STRING_MENU_SWITCH_CHATS,
               R.string.menu_switch_chats);

       resMapping.put(BrandingResourceIDs.STRING_TOAST_CHECK_SAVE_PASSWORD,
               R.string.check_save_password);
       resMapping.put(BrandingResourceIDs.STRING_LABEL_SIGN_UP,
               R.string.sign_up);*/
       return resMapping;
   }

   public int[] getSmileyIconIds() {
       return SMILEY_RES_IDS;
   }

    /**
     * An array of the smiley icon IDs. Note that the sequence of the array MUST
     * match the smiley texts and smiley names defined in strings.xml.
     */
    static final int[] SMILEY_RES_IDS = {
/*        R.drawable.emo_im_happy,
        R.drawable.emo_im_sad,
        R.drawable.emo_im_winking,
        R.drawable.emo_im_tongue_sticking_out,
        R.drawable.emo_im_surprised,
        R.drawable.emo_im_kissing,
        R.drawable.emo_im_yelling,
        R.drawable.emo_im_cool,
        R.drawable.emo_im_money_mouth,
        R.drawable.emo_im_foot_in_mouth,
        R.drawable.emo_im_embarrassed,
        R.drawable.emo_im_angel,
        R.drawable.emo_im_undecided,
        R.drawable.emo_im_crying,
        R.drawable.emo_im_lips_are_sealed,
        R.drawable.emo_im_laughing,
        R.drawable.emo_im_wtf */
    };

}