aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/contacts/ContactsAddon.java
blob: 6c0dd21dbd320e4c353b6d466cc847dd87775f7f (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
package cgeo.contacts;

import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.utils.ProcessUtils;

import org.eclipse.jdt.annotation.NonNull;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class ContactsAddon {

    private ContactsAddon() {
        // utility class
    }

    public static void openContactCard(@NonNull final Activity context, @NonNull final String userName) {
        final Parameters params = new Parameters(
                IContacts.PARAM_NAME, userName
                );

        context.startActivity(new Intent(IContacts.INTENT,
                Uri.parse(IContacts.URI_SCHEME + "://" + IContacts.URI_HOST + "?" + params.toString())));
    }

    public static boolean isAvailable() {
        return ProcessUtils.isIntentAvailable(IContacts.INTENT, Uri.parse(IContacts.URI_SCHEME + "://" + IContacts.URI_HOST));
    }

}