Android Open Source - Android-MarketBin Market U I






From Project

Back to project page Android-MarketBin.

License

The source code is released under:

MIT License

If you think the Android project Android-MarketBin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.haunted.marketbin;
/*from   w  ww.j a  v  a2s. c  om*/
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;

import org.jetbrains.annotations.NotNull;

public class MarketUI {
    public static void bindAppLink(@NotNull TextView view,
                                   @NotNull IMarketDescriptor marketDescriptor,
                                   @NotNull String packageName) {
        String displayName = marketDescriptor.getMarketName();
        if (marketDescriptor.getIntentFormat() == null)
            throw new NullPointerException("MarketDescriptor.intentFormat == null for " + displayName);
        String url = String.format(marketDescriptor.getIntentFormat(), packageName);
        String href = String.format("<a href='%s'>%s</a>", url, displayName);
        view.setText(Html.fromHtml(href));
        view.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public static void showAppInMarket(@NotNull Context context,
                                       @NotNull IMarketDescriptor marketDescriptor,
                                       @NotNull String packageName) {
        String url = String.format(marketDescriptor.getIntentFormat(), packageName);
        Intent appIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        context.startActivity(appIntent);
    }
}




Java Source Code List

com.haunted.marketbin.IMarketDescriptor.java
com.haunted.marketbin.MarketBin.java
com.haunted.marketbin.MarketDescriptor.java
com.haunted.marketbin.MarketLocator.java
com.haunted.marketbin.MarketUI.java
com.haunted.marketbin.sample.FragmentCredits.java
com.haunted.marketbin.sample.FragmentMultiple.java
com.haunted.marketbin.sample.FragmentSingle.java
com.haunted.marketbin.sample.MainActivity.java
com.haunted.marketbin.sample.PackageDialogFragment.java