1a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng/*
2a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * Copyright (C) 2011 The Android Open Source Project
3a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng *
4a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * Licensed under the Apache License, Version 2.0 (the "License");
5a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * you may not use this file except in compliance with the License.
6a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * You may obtain a copy of the License at
7a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng *
8a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng *      http://www.apache.org/licenses/LICENSE-2.0
9a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng *
10a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * Unless required by applicable law or agreed to in writing, software
11a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * distributed under the License is distributed on an "AS IS" BASIS,
12a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * See the License for the specific language governing permissions and
14a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * limitations under the License.
15a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng */
16a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
17a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Chengpackage com.android.contacts.common;
18a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
19a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Chengimport android.content.Context;
20a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Chengimport android.content.res.Resources;
21a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Chengimport android.provider.ContactsContract.StatusUpdates;
22a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
23a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng/**
24a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng * Provides static function to get default contact status message.
25a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng */
26a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Chengpublic class ContactStatusUtil {
27a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
28a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng    private static final String TAG = "ContactStatusUtil";
29a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
30a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng    public static String getStatusString(Context context, int presence) {
31a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng        Resources resources = context.getResources();
32a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng        switch (presence) {
33a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.AVAILABLE:
34a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng                return resources.getString(R.string.status_available);
35a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.IDLE:
36a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.AWAY:
37a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng                return resources.getString(R.string.status_away);
38a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.DO_NOT_DISTURB:
39a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng                return resources.getString(R.string.status_busy);
40a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.OFFLINE:
41a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            case StatusUpdates.INVISIBLE:
42a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng            default:
43a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng                return null;
44a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng        }
45a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng    }
46a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng
47a8feb7b88f2f67d8a80762dc54d336f1ea3a22d3Chiao Cheng}
48