mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-25 02:37:11 -07:00
Compare commits
15 commits
Author | SHA1 | Date | |
---|---|---|---|
|
097f246870 | ||
|
c3e6dca4c8 | ||
|
da75a1835c | ||
|
b577541efa | ||
|
51d0b9fcbb | ||
|
5b6719dd13 | ||
|
210c48d2ed | ||
fac8415ad9 | |||
5df77387e6 | |||
|
5cf889dd42 | ||
|
77e3a67097 | ||
|
4fe12914a9 | ||
|
b5729bcfdf | ||
6fbb16f264 | |||
|
696fea95ee |
7 changed files with 48 additions and 39 deletions
|
@ -14,7 +14,7 @@ Android About Box is configured with a set of (mostly) strings for the company n
|
|||
|
||||
When triggered from a menu item, it will display the app name, icon and version, provide links to contact support, leave a review, share the app, go to other apps by the same company in the app store -- as well as links to Facebook etc.
|
||||
|
||||
You can omit most features if they don't apply (e.g. like website), by not setting the values.
|
||||
You can omit most features if they don't apply (e.g. like website), by not setting the values.
|
||||
|
||||
## Installation Instructions
|
||||
|
||||
|
@ -88,7 +88,7 @@ Add AboutBox configuration to your Application class
|
|||
aboutConfig.emailSubject = EMAIL_SUBJECT;
|
||||
aboutConfig.emailBody = EMAIL_BODY;
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Open the About Box from your app
|
||||
|
@ -106,6 +106,7 @@ By default, the default Android share intent will be called with the values spec
|
|||
aboutConfig.shareMessage = getString(R.string.share_message);
|
||||
aboutConfig.sharingTitle = getString(R.string.sharing_title);
|
||||
```
|
||||
The `share_message` string will have an app store URL appended to it (appropriately constructed for Google Play or Amazon).
|
||||
|
||||
Alternatively, you can provide a custom sharing function (and omit `shareMessage` and `sharingTitle`):
|
||||
```java
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
dependencies:
|
||||
pre:
|
||||
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,android-25
|
||||
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
|
||||
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.3
|
||||
|
||||
test:
|
||||
override:
|
||||
|
|
|
@ -5,14 +5,14 @@ apply plugin: 'com.github.dcendents.android-maven'
|
|||
group='com.github.eggheadgames'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
buildToolsVersion "25.0.2"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 24
|
||||
versionCode 4
|
||||
versionName "1.2.1"
|
||||
versionCode 7
|
||||
versionName "1.3.1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -28,5 +28,5 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.daniel-stoneuk:material-about-library:1.8.2'
|
||||
compile 'com.github.daniel-stoneuk:material-about-library:2.2.1'
|
||||
}
|
||||
|
|
|
@ -69,9 +69,17 @@ public final class AboutBoxUtils {
|
|||
String webURI = null;
|
||||
switch (buildType) {
|
||||
case GOOGLE:
|
||||
// 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;
|
||||
// see:
|
||||
// https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html#OpeningPublisher
|
||||
// https://stackoverflow.com/questions/32029408/how-to-open-developer-page-on-google-play-store-market
|
||||
// https://issuetracker.google.com/65244694
|
||||
if (publisher.matches("\\d+")) {
|
||||
webURI = "https://play.google.com/store/apps/dev?id=" + publisher;
|
||||
appURI = webURI;
|
||||
} else {
|
||||
appURI = "market://search?q=pub:" + publisher;
|
||||
webURI = "https://play.google.com/store/search?q=pub:" + publisher;
|
||||
}
|
||||
break;
|
||||
case AMAZON:
|
||||
appURI = "amzn://apps/android?showAll=1&p=" + packageName;
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.text.TextUtils;
|
|||
|
||||
import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickListener;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem;
|
||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
|
||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
|
||||
|
@ -79,9 +79,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
|
||||
if (!TextUtils.isEmpty(config.guideHtmlPath)) {
|
||||
card.addItem(itemHelper(R.string.egab_guide, R.drawable.ic_help_green,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
if (config.dialog == null) {
|
||||
AboutBoxUtils.openHTMLPage(AboutActivity.this, config.guideHtmlPath);
|
||||
} else {
|
||||
|
@ -93,9 +93,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
);
|
||||
}
|
||||
card.addItem(itemHelper(R.string.egab_contact_support, R.drawable.ic_email_black,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
EmailUtil.contactUs(AboutActivity.this);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_contact_log_event));
|
||||
}
|
||||
|
@ -109,18 +109,18 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||
if (config.buildType != null && !TextUtils.isEmpty(config.packageName)) {
|
||||
card.addItem(itemHelper(R.string.egab_leave_review, R.drawable.ic_review,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
AboutBoxUtils.openApp(AboutActivity.this, config.buildType, config.packageName);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_review_log_event));
|
||||
}
|
||||
}));
|
||||
}
|
||||
card.addItem(itemHelper(R.string.egab_share, R.drawable.ic_share_black,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
if (config.share == null) {
|
||||
ShareUtil.share(AboutActivity.this);
|
||||
} else {
|
||||
|
@ -137,9 +137,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||
if (config.buildType != null && !TextUtils.isEmpty(config.appPublisher) && !TextUtils.isEmpty(config.packageName)) {
|
||||
card.addItem(itemHelper(R.string.egab_try_other_apps, R.drawable.ic_try_other_apps,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
AboutBoxUtils.openPublisher(AboutActivity.this, config.buildType,
|
||||
config.appPublisher, config.packageName);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_try_other_app_log_event));
|
||||
|
@ -150,9 +150,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
card.addItem(new MaterialAboutActionItem.Builder()
|
||||
.text(config.aboutLabelTitle)
|
||||
.icon(R.drawable.ic_about_black)
|
||||
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||
.setOnClickAction(new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
if (config.dialog == null) {
|
||||
AboutBoxUtils.openHTMLPage(AboutActivity.this, config.companyHtmlPath);
|
||||
} else {
|
||||
|
@ -174,9 +174,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
.text(R.string.egab_facebook_label)
|
||||
.subText(config.facebookUserName)
|
||||
.icon(R.drawable.ic_facebook_24)
|
||||
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||
.setOnClickAction(new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
AboutBoxUtils.getOpenFacebookIntent(AboutActivity.this, config.facebookUserName);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_facebook_log_event));
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
.text(R.string.egab_twitter_label)
|
||||
.subText(config.twitterUserName)
|
||||
.icon(R.drawable.ic_twitter_24dp)
|
||||
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||
.setOnClickAction(new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
AboutBoxUtils.startTwitter(AboutActivity.this, config.twitterUserName);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_twitter_log_event));
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
.text(R.string.egab_web_label)
|
||||
.subText(config.webHomePage.replaceFirst("^https?://", "").replaceAll("/$", ""))
|
||||
.icon(R.drawable.ic_web_black_24dp)
|
||||
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||
.setOnClickAction(new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
AboutBoxUtils.openHTMLPage(AboutActivity.this, config.webHomePage);
|
||||
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_website_log_event));
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||
if (!TextUtils.isEmpty(config.privacyHtmlPath)) {
|
||||
card.addItem(itemHelper(R.string.egab_privacy_policy, R.drawable.ic_privacy,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
if (config.dialog == null) {
|
||||
AboutBoxUtils.openHTMLPage(AboutActivity.this, config.privacyHtmlPath);
|
||||
} else {
|
||||
|
@ -235,9 +235,9 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
}
|
||||
if (!TextUtils.isEmpty(config.acknowledgmentHtmlPath)) {
|
||||
card.addItem(itemHelper(R.string.egab_acknowledgements, R.drawable.ic_acknowledgements,
|
||||
new MaterialAboutItemOnClickListener() {
|
||||
new MaterialAboutItemOnClickAction() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
public void onClick() {
|
||||
if (config.dialog == null) {
|
||||
AboutBoxUtils.openHTMLPage(AboutActivity.this, config.acknowledgmentHtmlPath);
|
||||
} else {
|
||||
|
@ -251,11 +251,11 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
return card.build();
|
||||
}
|
||||
|
||||
private MaterialAboutActionItem itemHelper(int name, int icon, MaterialAboutItemOnClickListener listener) {
|
||||
private MaterialAboutActionItem itemHelper(int name, int icon, MaterialAboutItemOnClickAction clickAction) {
|
||||
return new MaterialAboutActionItem.Builder()
|
||||
.text(name)
|
||||
.icon(icon)
|
||||
.setOnClickListener(listener)
|
||||
.setOnClickAction(clickAction)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ public final class ShareUtil {
|
|||
if (!TextUtils.isEmpty(config.packageName) && !TextUtils.isEmpty(shareMessage) && config.buildType != null) {
|
||||
switch (config.buildType) {
|
||||
case GOOGLE:
|
||||
shareMessage = AboutBoxUtils.playStoreAppURI + config.packageName;
|
||||
shareMessage = shareMessage + AboutBoxUtils.playStoreAppURI + config.packageName;
|
||||
break;
|
||||
case AMAZON:
|
||||
shareMessage = AboutBoxUtils.amznStoreAppURI + config.packageName;
|
||||
shareMessage = shareMessage + AboutBoxUtils.amznStoreAppURI + config.packageName;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme.MaterialAboutActivity" parent="Theme.Mal" >
|
||||
<style name="AppTheme.MaterialAboutActivity" parent="Theme.Mal.Light.DarkActionBar" >
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue