mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-24 18:27:11 -07:00
Merge pull request #33 from eggheadgames/release/1.2.1
Release/1.2.1 to master
This commit is contained in:
commit
c6fae1ad37
8 changed files with 56 additions and 9 deletions
|
@ -1,5 +1,7 @@
|
|||
[](https://circleci.com/gh/eggheadgames/android-about-box)
|
||||
[](https://jitpack.io/#eggheadgames/android-about-box)
|
||||

|
||||
[](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).
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -12,7 +12,7 @@ android {
|
|||
minSdkVersion 15
|
||||
targetSdkVersion 24
|
||||
versionCode 4
|
||||
versionName "1.2.0"
|
||||
versionName "1.2.1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
@ -8,6 +8,9 @@ import android.widget.Toast;
|
|||
|
||||
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
|
||||
}
|
||||
|
@ -49,11 +52,11 @@ public final class AboutBoxUtils {
|
|||
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
|
||||
|
@ -66,8 +69,9 @@ public final class AboutBoxUtils {
|
|||
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;
|
||||
|
|
|
@ -8,6 +8,9 @@ public class AboutConfig {
|
|||
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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -54,6 +55,21 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
.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();
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
.text(config.aboutLabelTitle)
|
||||
.icon(R.drawable.ic_about_black)
|
||||
|
@ -184,7 +200,7 @@ public class AboutActivity extends MaterialAboutActivity {
|
|||
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
|
||||
|
|
|
@ -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,24 @@ 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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
intent2.putExtra(Intent.EXTRA_TEXT, shareMessage);
|
||||
|
||||
activity.startActivity(Intent.createChooser(intent2, config.sharingTitle));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue