1
0
Fork 0
mirror of https://github.com/ethauvin/android-about-box.git synced 2025-04-24 18:27:11 -07:00

Merge pull request #29 from ethauvin/develop

Various Minor Fixes
This commit is contained in:
mikemee 2017-08-22 06:34:57 -07:00 committed by GitHub
commit 85132d5e50
3 changed files with 29 additions and 6 deletions

View file

@ -8,6 +8,9 @@ import android.widget.Toast;
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
}
@ -49,11 +52,11 @@ public final class AboutBoxUtils {
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
@ -66,8 +69,9 @@ public final class AboutBoxUtils {
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;

View file

@ -184,7 +184,7 @@ public class AboutActivity extends MaterialAboutActivity {
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

View file

@ -2,7 +2,9 @@ package com.eggheadgames.aboutbox.share;
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 {
@ -17,7 +19,24 @@ public final class ShareUtil {
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));
}
}