mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-27 19:38: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
|
@ -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