// Path: app/src/main/java/io/github/mobodev/heartbeatfixerforgcm/utils/PlayStoreUtils.java
// public class PlayStoreUtils {
// 
//     private static final String MARKET_DETAILS_PREFIX = "market://details?id=";
//     private static final String WEB_DETAIL_PREFIX = "https://play.google.com/store/apps/details?id=";
// 
//     public static String generateAppDetailPageLink(String packageName, boolean isWebPage) {
//         return (isWebPage ? WEB_DETAIL_PREFIX : MARKET_DETAILS_PREFIX) + packageName;
//     }
// 
//     public static void launchAppDetailPage(Context context, String packageName, boolean isWebPage) {
//         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(generateAppDetailPageLink(packageName, isWebPage)));
//         startActivitySafe(context, intent);
//     }
// 
//     public static void launchAuthorAppsPage(Context context) {
//         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:MoboDev"));
//         startActivitySafe(context, intent);
//     }
// 
//     private static void startActivitySafe(Context context, Intent intent) {
//         try {
//             context.startActivity(intent);
//         } catch (ActivityNotFoundException e) {
//             Toast.makeText(context, R.string.toast_play_store_unavailable, Toast.LENGTH_SHORT).show();
//         }
//     }
// }


import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import io.github.mobodev.heartbeatfixerforgcm.R;
import io.github.mobodev.heartbeatfixerforgcm.utils.PlayStoreUtils;
package io.github.mobodev.heartbeatfixerforgcm.preference;



/**
 * Created by shaobin on 1/18/15.
 */
public class RecommendAppPreference extends Preference {
    public RecommendAppPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    public RecommendAppPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public RecommendAppPreference(Context context) {
        super(context);
        init();
    }

    private void init() {
        setTitle(R.string.pref_recommend_apps_title);
        setSummary(R.string.pref_recommend_apps_description);
    }

    @Override
    protected void onClick() {
// Path: app/src/main/java/io/github/mobodev/heartbeatfixerforgcm/utils/PlayStoreUtils.java
// public class PlayStoreUtils {
// 
//     private static final String MARKET_DETAILS_PREFIX = "market://details?id=";
//     private static final String WEB_DETAIL_PREFIX = "https://play.google.com/store/apps/details?id=";
// 
//     public static String generateAppDetailPageLink(String packageName, boolean isWebPage) {
//         return (isWebPage ? WEB_DETAIL_PREFIX : MARKET_DETAILS_PREFIX) + packageName;
//     }
// 
//     public static void launchAppDetailPage(Context context, String packageName, boolean isWebPage) {
//         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(generateAppDetailPageLink(packageName, isWebPage)));
//         startActivitySafe(context, intent);
//     }
// 
//     public static void launchAuthorAppsPage(Context context) {
//         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:MoboDev"));
//         startActivitySafe(context, intent);
//     }
// 
//     private static void startActivitySafe(Context context, Intent intent) {
//         try {
//             context.startActivity(intent);
//         } catch (ActivityNotFoundException e) {
//             Toast.makeText(context, R.string.toast_play_store_unavailable, Toast.LENGTH_SHORT).show();
//         }
//     }
// }


// Path: app/src/main/java/io/github/mobodev/heartbeatfixerforgcm/preference/RecommendAppPreference.java
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import io.github.mobodev.heartbeatfixerforgcm.R;
import io.github.mobodev.heartbeatfixerforgcm.utils.PlayStoreUtils;

package io.github.mobodev.heartbeatfixerforgcm.preference;



/**
 * Created by shaobin on 1/18/15.
 */
public class RecommendAppPreference extends Preference {
    public RecommendAppPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    public RecommendAppPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public RecommendAppPreference(Context context) {
        super(context);
        init();
    }

    private void init() {
        setTitle(R.string.pref_recommend_apps_title);
        setSummary(R.string.pref_recommend_apps_description);
    }

    @Override
    protected void onClick() {
        PlayStoreUtils.launchAuthorAppsPage(getContext());