Skip to content

Commit

Permalink
Merge pull request #33 from eggheadgames/release/1.2.1
Browse files Browse the repository at this point in the history
Release/1.2.1 to master
  • Loading branch information
mikemee authored Aug 30, 2017
2 parents 83c54ea + 0fb1c6f commit c6fae1a
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 9 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
[![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
A modern About Box for an Android App built on the [daniel-stoneuk/material-about-library](https://github.com/daniel-stoneuk/material-about-library).
Expand All @@ -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.

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

Expand Down Expand Up @@ -43,6 +45,7 @@ Add AboutBox configuration to your Application class
aboutConfig.appName = getString(R.string.app_name);
aboutConfig.appIcon = R.mipmap.ic_launcher;
aboutConfig.version = "1.0.0";
aboutConfig.author = "Tolstoy";
aboutConfig.aboutLabelTitle = "About App";
aboutConfig.packageName = getApplicationContext().getPackageName();
aboutConfig.buildType = google ? AboutConfig.BuildType.GOOGLE : AboutConfig.BuildType.AMAZON;
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 15
targetSdkVersion 24
versionCode 4
versionName "1.2.0"
versionName "1.2.1"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

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() {
//nothing
}
Expand Down Expand Up @@ -49,11 +52,11 @@ public static void openApp(Activity context, AboutConfig.BuildType buildType, St
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
Expand All @@ -66,8 +69,9 @@ public static void openPublisher(Activity context, AboutConfig.BuildType buildTy
String webURI = null;
switch (buildType) {
case GOOGLE:
appURI = "market://search?q=pub:" + publisher;
webURI = "http://play.google.com/store/search?q=pub:" + publisher;
// 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;
break;
case AMAZON:
appURI = "amzn://apps/android?showAll=1&p=" + packageName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public enum BuildType {AMAZON, GOOGLE}
public String appName;
public int appIcon;
public String version;
public String author;
public String extra;
public String extraTitle;
public String aboutLabelTitle;
public String logUiEventName;
public String facebookUserName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AboutActivity extends MaterialAboutActivity {

public static void launch(Activity activity) {
Intent intent = new Intent(activity, AboutActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(intent);
}

Expand Down Expand Up @@ -54,6 +55,21 @@ private MaterialAboutCard buildGeneralInfoCard(AboutConfig config) {
.text(R.string.egab_version)
.subText(config.version)
.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();
}

Expand Down Expand Up @@ -130,7 +146,7 @@ public void onClick(boolean b) {
}
}));
}
if (!TextUtils.isEmpty(config.companyHtmlPath)) {
if (!TextUtils.isEmpty(config.companyHtmlPath) && !TextUtils.isEmpty(config.aboutLabelTitle)) {
card.addItem(new MaterialAboutActionItem.Builder()
.text(config.aboutLabelTitle)
.icon(R.drawable.ic_about_black)
Expand Down Expand Up @@ -184,7 +200,7 @@ public void onClick(boolean b) {
if (!TextUtils.isEmpty(config.webHomePage)) {
card.addItem(new MaterialAboutActionItem.Builder()
.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)
.setOnClickListener(new MaterialAboutItemOnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

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 {
Expand All @@ -17,7 +19,24 @@ public static void share(Activity activity) {
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;
default:
break;
}
}

intent2.putExtra(Intent.EXTRA_TEXT, shareMessage);

activity.startActivity(Intent.createChooser(intent2, config.sharingTitle));
}
}
1 change: 1 addition & 0 deletions library/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<string name="egab_contact_support">Contactar o Suporte</string>
<string name="egab_try_other_apps">Experimentar outras aplicações</string>
<string name="egab_version">Versão</string>
<string name="egab_author">Autor</string>
<string name="egab_facebook_label">Facebook</string>
<string name="egab_twitter_label">Twitter</string>
<string name="egab_web_label">Web</string>
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<string name="egab_contact_support">Contact Support</string>
<string name="egab_try_other_apps">Try Other Apps</string>
<string name="egab_version">Version</string>
<string name="egab_author">Author</string>
<string name="egab_facebook_label">Facebook</string>
<string name="egab_twitter_label">Twitter</string>
<string name="egab_web_label">Web</string>
Expand Down

0 comments on commit c6fae1a

Please sign in to comment.