1
0
Fork 0
mirror of https://github.com/ethauvin/android-about-box.git synced 2025-04-25 02:37:11 -07:00

Merge pull request #33 from eggheadgames/release/1.2.1

Release/1.2.1 to master
This commit is contained in:
mikemee 2017-08-30 16:05:39 -07:00 committed by GitHub
commit c6fae1ad37
8 changed files with 56 additions and 9 deletions

View file

@ -1,5 +1,7 @@
[![Circle CI](https://circleci.com/gh/eggheadgames/android-about-box.svg?style=svg)](https://circleci.com/gh/eggheadgames/android-about-box) [![Circle CI](https://circleci.com/gh/eggheadgames/android-about-box.svg?style=svg)](https://circleci.com/gh/eggheadgames/android-about-box)
[![Release](https://jitpack.io/v/eggheadgames/android-about-box.svg)](https://jitpack.io/#eggheadgames/android-about-box) [![Release](https://jitpack.io/v/eggheadgames/android-about-box.svg)](https://jitpack.io/#eggheadgames/android-about-box)
![Downloads](https://jitpack.io/v/eggheadgames/android-about-box/month.svg)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/eggheadgames/android-about-box/blob/develop/LICENSE)
# About Box # About Box
A modern About Box for an Android App built on the [daniel-stoneuk/material-about-library](https://github.com/daniel-stoneuk/material-about-library). A modern About Box for an Android App built on the [daniel-stoneuk/material-about-library](https://github.com/daniel-stoneuk/material-about-library).
@ -12,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. 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.
As of version 1.2.0, you can omit many features that 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 ## Installation Instructions
@ -43,6 +45,7 @@ Add AboutBox configuration to your Application class
aboutConfig.appName = getString(R.string.app_name); aboutConfig.appName = getString(R.string.app_name);
aboutConfig.appIcon = R.mipmap.ic_launcher; aboutConfig.appIcon = R.mipmap.ic_launcher;
aboutConfig.version = "1.0.0"; aboutConfig.version = "1.0.0";
aboutConfig.author = "Tolstoy";
aboutConfig.aboutLabelTitle = "About App"; aboutConfig.aboutLabelTitle = "About App";
aboutConfig.packageName = getApplicationContext().getPackageName(); aboutConfig.packageName = getApplicationContext().getPackageName();
aboutConfig.buildType = google ? AboutConfig.BuildType.GOOGLE : AboutConfig.BuildType.AMAZON; aboutConfig.buildType = google ? AboutConfig.BuildType.GOOGLE : AboutConfig.BuildType.AMAZON;

View file

@ -12,7 +12,7 @@ android {
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 24 targetSdkVersion 24
versionCode 4 versionCode 4
versionName "1.2.0" versionName "1.2.1"
} }
buildTypes { buildTypes {
release { release {

View file

@ -8,6 +8,9 @@ import android.widget.Toast;
public final class AboutBoxUtils { 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() { private AboutBoxUtils() {
//nothing //nothing
} }
@ -49,11 +52,11 @@ public final class AboutBoxUtils {
switch (buildType) { switch (buildType) {
case GOOGLE: case GOOGLE:
appURI = "market://details?id=" + packageName; appURI = "market://details?id=" + packageName;
webURI = "http://play.google.com/store/apps/details?id=" + packageName; webURI = playStoreAppURI + packageName;
break; break;
case AMAZON: case AMAZON:
appURI = "amzn://apps/android?p=" + packageName; appURI = "amzn://apps/android?p=" + packageName;
webURI = "http://www.amazon.com/gp/mas/dl/android?p=" + packageName; webURI = amznStoreAppURI + packageName;
break; break;
default: default:
//nothing //nothing
@ -66,8 +69,9 @@ public final class AboutBoxUtils {
String webURI = null; String webURI = null;
switch (buildType) { switch (buildType) {
case GOOGLE: case GOOGLE:
appURI = "market://search?q=pub:" + publisher; // per: https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html#OpeningPublisher
webURI = "http://play.google.com/store/search?q=pub:" + publisher; appURI = "market://dev?id=" + publisher;
webURI = "http://play.google.com/store/dev?id=" + publisher;
break; break;
case AMAZON: case AMAZON:
appURI = "amzn://apps/android?showAll=1&p=" + packageName; appURI = "amzn://apps/android?showAll=1&p=" + packageName;

View file

@ -8,6 +8,9 @@ public class AboutConfig {
public String appName; public String appName;
public int appIcon; public int appIcon;
public String version; public String version;
public String author;
public String extra;
public String extraTitle;
public String aboutLabelTitle; public String aboutLabelTitle;
public String logUiEventName; public String logUiEventName;
public String facebookUserName; public String facebookUserName;

View file

@ -23,6 +23,7 @@ public class AboutActivity extends MaterialAboutActivity {
public static void launch(Activity activity) { public static void launch(Activity activity) {
Intent intent = new Intent(activity, AboutActivity.class); Intent intent = new Intent(activity, AboutActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(intent); activity.startActivity(intent);
} }
@ -54,6 +55,21 @@ public class AboutActivity extends MaterialAboutActivity {
.text(R.string.egab_version) .text(R.string.egab_version)
.subText(config.version) .subText(config.version)
.build()); .build());
if (!TextUtils.isEmpty(config.author)) {
generalInfoCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.egab_author)
.subText(config.author)
.build());
}
if (!TextUtils.isEmpty(config.extra) && !TextUtils.isEmpty(config.extraTitle)) {
generalInfoCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(config.extraTitle)
.subTextHtml(config.extra)
.build());
}
return generalInfoCardBuilder.build(); return generalInfoCardBuilder.build();
} }
@ -130,7 +146,7 @@ public class AboutActivity extends MaterialAboutActivity {
} }
})); }));
} }
if (!TextUtils.isEmpty(config.companyHtmlPath)) { if (!TextUtils.isEmpty(config.companyHtmlPath) && !TextUtils.isEmpty(config.aboutLabelTitle)) {
card.addItem(new MaterialAboutActionItem.Builder() card.addItem(new MaterialAboutActionItem.Builder()
.text(config.aboutLabelTitle) .text(config.aboutLabelTitle)
.icon(R.drawable.ic_about_black) .icon(R.drawable.ic_about_black)
@ -184,7 +200,7 @@ public class AboutActivity extends MaterialAboutActivity {
if (!TextUtils.isEmpty(config.webHomePage)) { if (!TextUtils.isEmpty(config.webHomePage)) {
card.addItem(new MaterialAboutActionItem.Builder() card.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.egab_web_label) .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) .icon(R.drawable.ic_web_black_24dp)
.setOnClickListener(new MaterialAboutItemOnClickListener() { .setOnClickListener(new MaterialAboutItemOnClickListener() {
@Override @Override

View file

@ -2,7 +2,9 @@ package com.eggheadgames.aboutbox.share;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.text.TextUtils;
import com.eggheadgames.aboutbox.AboutBoxUtils;
import com.eggheadgames.aboutbox.AboutConfig; import com.eggheadgames.aboutbox.AboutConfig;
public final class ShareUtil { public final class ShareUtil {
@ -17,7 +19,24 @@ public final class ShareUtil {
Intent intent2 = new Intent(); Intent intent2 = new Intent();
intent2.setAction(Intent.ACTION_SEND); intent2.setAction(Intent.ACTION_SEND);
intent2.setType("text/plain"); 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)); activity.startActivity(Intent.createChooser(intent2, config.sharingTitle));
} }
} }

View file

@ -3,6 +3,7 @@
<string name="egab_contact_support">Contactar o Suporte</string> <string name="egab_contact_support">Contactar o Suporte</string>
<string name="egab_try_other_apps">Experimentar outras aplicações</string> <string name="egab_try_other_apps">Experimentar outras aplicações</string>
<string name="egab_version">Versão</string> <string name="egab_version">Versão</string>
<string name="egab_author">Autor</string>
<string name="egab_facebook_label">Facebook</string> <string name="egab_facebook_label">Facebook</string>
<string name="egab_twitter_label">Twitter</string> <string name="egab_twitter_label">Twitter</string>
<string name="egab_web_label">Web</string> <string name="egab_web_label">Web</string>

View file

@ -3,6 +3,7 @@
<string name="egab_contact_support">Contact Support</string> <string name="egab_contact_support">Contact Support</string>
<string name="egab_try_other_apps">Try Other Apps</string> <string name="egab_try_other_apps">Try Other Apps</string>
<string name="egab_version">Version</string> <string name="egab_version">Version</string>
<string name="egab_author">Author</string>
<string name="egab_facebook_label">Facebook</string> <string name="egab_facebook_label">Facebook</string>
<string name="egab_twitter_label">Twitter</string> <string name="egab_twitter_label">Twitter</string>
<string name="egab_web_label">Web</string> <string name="egab_web_label">Web</string>