@@ -0,0 +1,2104 @@
+package com.oasisfeng.google.play;%0A%0Aimport android.content.ActivityNotFoundException;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0Aimport android.content.pm.PackageManager.NameNotFoundException;%0Aimport android.net.Uri;%0Aimport android.preference.Preference;%0A%0A/** @author Oasis */%0Apublic class GooglePlayStore %7B%0A%0A    private static final String PLAY_SCHEME = %22market%22;%0A    private static final String PLAY_PACKAGE_NAME = %22com.android.vending%22;%0A    private static final String PLAY_URL_PREFIX = %22https://play.google.com/store/apps/details?id=%22;%0A    private static final String PLAY_HOST = %22play.google.com%22;%0A%0A    public static void showApp(final Context context, final String pkg) %7B%0A        final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_URL_PREFIX + pkg));%0A        updatePlayUrlIntent(context.getPackageManager(), intent);%0A        try %7B context.startActivity(intent);%0A        %7D catch(final ActivityNotFoundException e) %7B /* In case of Google Play malfunction */ %7D%0A    %7D%0A%0A    public static boolean isInstalledByGooglePlay(final Context context) %7B%0A        final String installer = context.getPackageManager().getInstallerPackageName(context.getPackageName());%0A        return PLAY_PACKAGE_NAME.equals(installer);%0A    %7D%0A%0A    public static void updatePreferenceIntent(final Context context, final Preference preference) %7B%0A        final Intent intent = preference.getIntent();%0A        if (intent == null) return;%0A        final Uri uri = intent.getData();%0A        if (uri == null %7C%7C PLAY_SCHEME.equals(uri.getScheme()) %7C%7C ! PLAY_HOST.equals(uri.getHost())) return;%0A        updatePlayUrlIntent(context.getPackageManager(), intent);%0A    %7D%0A%0A    private static void updatePlayUrlIntent(final PackageManager pm, final Intent intent) %7B%0A        try %7B%0A            final PackageInfo play_pkg = pm.getPackageInfo(PLAY_PACKAGE_NAME, 0);%0A            if (play_pkg.applicationInfo.enabled) intent.setPackage(PLAY_PACKAGE_NAME);%0A        %7D catch (final NameNotFoundException e) %7B /* Fall-through */ %7D%0A    %7D%0A%7D%0A

Add new utility class GooglePlayStore.