mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-25 02:37:11 -07:00
Added default shareMessage if not set.
This commit is contained in:
parent
852005c24e
commit
0ebb478771
2 changed files with 23 additions and 3 deletions
|
@ -8,6 +8,9 @@ import android.widget.Toast;
|
|||
|
||||
public final class AboutBoxUtils {
|
||||
|
||||
public static String playStoreAppURI = "https://play.google.com/store/apps/details?id=";
|
||||
public 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
|
||||
|
|
|
@ -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,22 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
intent2.putExtra(Intent.EXTRA_TEXT, shareMessage);
|
||||
|
||||
activity.startActivity(Intent.createChooser(intent2, config.sharingTitle));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue