mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-25 18:47:12 -07:00
Added AboutBox library source code. Implemented IAnalytic and IDialog interfaces for custom usage.
This commit is contained in:
parent
8a88eb2217
commit
8b28ebfb79
56 changed files with 1296 additions and 0 deletions
|
@ -0,0 +1,43 @@
|
|||
package com.eggheadgames.aboutbox.share;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.eggheadgames.aboutbox.AboutConfig;
|
||||
import com.eggheadgames.aboutbox.BuildConfig;
|
||||
|
||||
public final class EmailUtil {
|
||||
|
||||
private EmailUtil() {
|
||||
// Utility class
|
||||
}
|
||||
|
||||
public static void contactUs(Activity activity) {
|
||||
AboutConfig config = AboutConfig.getInstance();
|
||||
|
||||
final Uri mailto = Uri.fromParts("mailto", config.emailAddress, null);
|
||||
|
||||
final String emailSubject;
|
||||
|
||||
if ("google".equals(BuildConfig.FLAVOR)) {
|
||||
emailSubject = config.emailSubject + "G";
|
||||
} else if ("amazon".equals(BuildConfig.FLAVOR)) {
|
||||
emailSubject = config.emailSubject + "K";
|
||||
} else {
|
||||
emailSubject = config.emailSubject;
|
||||
}
|
||||
|
||||
try {
|
||||
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, mailto);
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, config.emailBody);
|
||||
activity.startActivity(Intent.createChooser(emailIntent, "Send email..."));
|
||||
} catch (Exception e) {
|
||||
if (config.analytics != null) {
|
||||
config.analytics.logException(e, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue