Skip to content

Commit

Permalink
Merge pull request #29 from ethauvin/develop
Browse files Browse the repository at this point in the history
Various Minor Fixes
  • Loading branch information
mikemee authored Aug 22, 2017
2 parents e8e817e + 337b7da commit 85132d5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

public final class AboutBoxUtils {

public final static String playStoreAppURI = "https://play.google.com/store/apps/details?id=";
public final static String amznStoreAppURI = "https://www.amazon.com/gp/mas/dl/android?p=";

private AboutBoxUtils() {
//nothing
}
Expand Down Expand Up @@ -49,11 +52,11 @@ public static void openApp(Activity context, AboutConfig.BuildType buildType, St
switch (buildType) {
case GOOGLE:
appURI = "market://details?id=" + packageName;
webURI = "http://play.google.com/store/apps/details?id=" + packageName;
webURI = playStoreAppURI + packageName;
break;
case AMAZON:
appURI = "amzn://apps/android?p=" + packageName;
webURI = "http://www.amazon.com/gp/mas/dl/android?p=" + packageName;
webURI = amznStoreAppURI + packageName;
break;
default:
//nothing
Expand All @@ -66,8 +69,9 @@ public static void openPublisher(Activity context, AboutConfig.BuildType buildTy
String webURI = null;
switch (buildType) {
case GOOGLE:
appURI = "market://search?q=pub:" + publisher;
webURI = "http://play.google.com/store/search?q=pub:" + publisher;
// per: https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html#OpeningPublisher
appURI = "market://dev?id=" + publisher;
webURI = "http://play.google.com/store/dev?id=" + publisher;
break;
case AMAZON:
appURI = "amzn://apps/android?showAll=1&p=" + packageName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void onClick(boolean b) {
if (!TextUtils.isEmpty(config.webHomePage)) {
card.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.egab_web_label)
.subText(config.webHomePage.replace("https://", "").replace("http://", "").replace("/", ""))
.subText(config.webHomePage.replaceFirst("^https?://", "").replaceAll("/$", ""))
.icon(R.drawable.ic_web_black_24dp)
.setOnClickListener(new MaterialAboutItemOnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;

import com.eggheadgames.aboutbox.AboutBoxUtils;
import com.eggheadgames.aboutbox.AboutConfig;

public final class ShareUtil {
Expand All @@ -17,7 +19,24 @@ public static void share(Activity activity) {
Intent intent2 = new Intent();
intent2.setAction(Intent.ACTION_SEND);
intent2.setType("text/plain");
intent2.putExtra(Intent.EXTRA_TEXT, config.shareMessage);

String shareMessage = config.shareMessage;

if (!TextUtils.isEmpty(config.packageName) && !TextUtils.isEmpty(shareMessage) && config.buildType != null) {
switch (config.buildType) {
case GOOGLE:
shareMessage = AboutBoxUtils.playStoreAppURI + config.packageName;
break;
case AMAZON:
shareMessage = AboutBoxUtils.amznStoreAppURI + config.packageName;
break;
default:
break;
}
}

intent2.putExtra(Intent.EXTRA_TEXT, shareMessage);

activity.startActivity(Intent.createChooser(intent2, config.sharingTitle));
}
}

0 comments on commit 85132d5

Please sign in to comment.