From abe6dbbae7f82a6e7b2a4d4ea6d122aacf7d9cda Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 20:17:49 +0200 Subject: [PATCH 01/15] Fixed Email subject (Close #9) --- .../main/java/com/eggheadgames/aboutbox/share/EmailUtil.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index a186245..9f7cbb7 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -5,7 +5,6 @@ import android.content.Intent; import android.net.Uri; import com.eggheadgames.aboutbox.AboutConfig; -import com.eggheadgames.aboutbox.BuildConfig; public final class EmailUtil { @@ -20,9 +19,9 @@ public final class EmailUtil { final String emailSubject; - if ("google".equals(BuildConfig.FLAVOR)) { + if (config.buildType == AboutConfig.BuildType.GOOGLE) { emailSubject = config.emailSubject + "G"; - } else if ("amazon".equals(BuildConfig.FLAVOR)) { + } else if (config.buildType == AboutConfig.BuildType.AMAZON) { emailSubject = config.emailSubject + "K"; } else { emailSubject = config.emailSubject; From 685b6e6ffe7465f8af65df2a669ba9bd78567e3e Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 20:36:38 +0200 Subject: [PATCH 02/15] Fixed Amazon link (Close #7) --- .../eggheadgames/aboutbox/activity/AboutActivity.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java index d2b1b67..d9d1cf0 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java @@ -94,7 +94,7 @@ public class AboutActivity extends MaterialAboutActivity { .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { - openPublisher(config.buildType == AboutConfig.BuildType.GOOGLE, config.appPublisher); + openPublisher(config.buildType == AboutConfig.BuildType.GOOGLE, config.appPublisher, config.packageName); if (config.analytics != null) { config.analytics.logUiEvent(config.logUiEventName, getString(R.string.try_other_app_log_event)); } @@ -256,12 +256,15 @@ public class AboutActivity extends MaterialAboutActivity { } } - public void openPublisher(boolean googlePlay, String publisher) {//true if Google Play, false if Amazon Store + public void openPublisher(boolean googlePlay, String publisher, String packageName) {//true if Google Play, false if Amazon Store + String pub = googlePlay ? publisher : packageName; try { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse((googlePlay ? "market://search?q=pub:" : "amzn://apps/android?showAll=1&p=") + publisher))); + String uriString = (googlePlay ? "market://search?q=pub:" : "amzn://apps/android?showAll=1&p=") + pub; + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uriString))); } catch (ActivityNotFoundException e1) { try { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse((googlePlay ? "http://play.google.com/store/search?q=pub:" : "http://www.amazon.com/gp/mas/dl/android?showAll=1&p=") + publisher))); + String uriString = (googlePlay ? "http://play.google.com/store/search?q=pub:" : "http://www.amazon.com/gp/mas/dl/android?showAll=1&p=") + pub; + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uriString))); } catch (ActivityNotFoundException e2) { Toast.makeText(this, R.string.can_not_open, Toast.LENGTH_SHORT).show(); } From ed10e03d6b5f00c8dd11aa00178bcfd3a2ee452c Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 20:41:49 +0200 Subject: [PATCH 03/15] Added correct error handling when facebook/twitter is not installed. (Close #8) --- .../aboutbox/activity/AboutActivity.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java index d9d1cf0..f3e024c 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java @@ -221,27 +221,36 @@ public class AboutActivity extends MaterialAboutActivity { } public static void getOpenFacebookIntent(Activity context, String name) { - Intent intent; try { context.getPackageManager().getPackageInfo("com.facebook.katana", 0); - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + name)); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + name)); + context.startActivity(intent); } catch (Exception e) { - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + name)); + try { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + name)); + context.startActivity(intent); + } catch (Exception e1) { + Toast.makeText(context, R.string.can_not_open, Toast.LENGTH_SHORT).show(); + } } - context.startActivity(intent); } public static void startTwitter(Activity context, String name) { - Intent intent; try { context.getPackageManager().getPackageInfo("com.twitter.android", 0); - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + name)); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + name)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); } catch (Exception e) { - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + name)); + try { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + name)); + context.startActivity(intent); + } catch (Exception e1) { + Toast.makeText(context, R.string.can_not_open, Toast.LENGTH_SHORT).show(); + } } - context.startActivity(intent); + } public void openApp(String packageName, boolean googlePlay) {//true if Google Play, false if Amazon Store From 5d1674a0aab9981fc06330e3498d6185257c3084 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 21:01:59 +0200 Subject: [PATCH 04/15] Changed logic to check build type (Close #6) --- .../aboutbox/activity/AboutActivity.java | 56 +++++++++++++------ .../aboutbox/share/EmailUtil.java | 15 +++-- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java index f3e024c..e28832b 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java @@ -65,7 +65,7 @@ public class AboutActivity extends MaterialAboutActivity { .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { - openApp(config.packageName, config.buildType == AboutConfig.BuildType.GOOGLE); + openApp(config.buildType, config.packageName); if (config.analytics != null) { config.analytics.logUiEvent(config.logUiEventName, getString(R.string.review_log_event)); } @@ -94,7 +94,7 @@ public class AboutActivity extends MaterialAboutActivity { .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { - openPublisher(config.buildType == AboutConfig.BuildType.GOOGLE, config.appPublisher, config.packageName); + openPublisher(config.buildType, config.appPublisher, config.packageName); if (config.analytics != null) { config.analytics.logUiEvent(config.logUiEventName, getString(R.string.try_other_app_log_event)); } @@ -235,7 +235,6 @@ public class AboutActivity extends MaterialAboutActivity { } } - public static void startTwitter(Activity context, String name) { try { context.getPackageManager().getPackageInfo("com.twitter.android", 0); @@ -253,27 +252,48 @@ public class AboutActivity extends MaterialAboutActivity { } - public void openApp(String packageName, boolean googlePlay) {//true if Google Play, false if Amazon Store - try { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse((googlePlay ? "market://details?id=" : "amzn://apps/android?p=") + packageName))); - } catch (ActivityNotFoundException e1) { - try { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse((googlePlay ? "http://play.google.com/store/apps/details?id=" : "http://www.amazon.com/gp/mas/dl/android?p=") + packageName))); - } catch (ActivityNotFoundException e2) { - Toast.makeText(this, R.string.can_not_open, Toast.LENGTH_SHORT).show(); - } + public void openApp(AboutConfig.BuildType buildType, String packageName) {//true if Google Play, false if Amazon Store + String appURI = null; + String webURI = null; + switch (buildType) { + case GOOGLE: + appURI = "market://details?id=" + packageName; + webURI = "http://play.google.com/store/apps/details?id=" + packageName; + break; + case AMAZON: + appURI = "amzn://apps/android?p=" + packageName; + webURI = "http://www.amazon.com/gp/mas/dl/android?p=" + packageName; + break; + default: + //nothing } + open(appURI, webURI); } - public void openPublisher(boolean googlePlay, String publisher, String packageName) {//true if Google Play, false if Amazon Store - String pub = googlePlay ? publisher : packageName; + public void openPublisher(AboutConfig.BuildType buildType, String publisher, String packageName) {//true if Google Play, false if Amazon Store + String appURI = null; + String webURI = null; + switch (buildType) { + case GOOGLE: + appURI = "market://search?q=pub:" + publisher; + webURI = "http://play.google.com/store/search?q=pub:" + publisher; + break; + case AMAZON: + appURI = "amzn://apps/android?showAll=1&p=" + packageName; + webURI = "http://www.amazon.com/gp/mas/dl/android?showAll=1&p=" + packageName; + break; + default: + //nothing + } + open(appURI, webURI); + } + + private void open(String appURI, String webURI) { try { - String uriString = (googlePlay ? "market://search?q=pub:" : "amzn://apps/android?showAll=1&p=") + pub; - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uriString))); + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(appURI))); } catch (ActivityNotFoundException e1) { try { - String uriString = (googlePlay ? "http://play.google.com/store/search?q=pub:" : "http://www.amazon.com/gp/mas/dl/android?showAll=1&p=") + pub; - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uriString))); + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webURI))); } catch (ActivityNotFoundException e2) { Toast.makeText(this, R.string.can_not_open, Toast.LENGTH_SHORT).show(); } diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 9f7cbb7..62ccbf3 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -19,12 +19,15 @@ public final class EmailUtil { final String emailSubject; - if (config.buildType == AboutConfig.BuildType.GOOGLE) { - emailSubject = config.emailSubject + "G"; - } else if (config.buildType == AboutConfig.BuildType.AMAZON) { - emailSubject = config.emailSubject + "K"; - } else { - emailSubject = config.emailSubject; + switch (config.buildType) { + case GOOGLE: + emailSubject = config.emailSubject + "G"; + break; + case AMAZON: + emailSubject = config.emailSubject + "K"; + break; + default: + emailSubject = config.emailSubject; } try { From 0dea2c71e0c9dffbd71a5bdd8c6eea5d2bd4c35e Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 21:09:11 +0200 Subject: [PATCH 05/15] Fixed mistyped (Close #4) --- .../com/eggheadgames/aboutbox/activity/AboutActivity.java | 8 ++++---- .../{ic_acknowledgment.xml => ic_acknowledgements.xml} | 0 library/src/main/res/values/strings.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename library/src/main/res/drawable/{ic_acknowledgment.xml => ic_acknowledgements.xml} (100%) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java index e28832b..dd6a413 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java @@ -186,19 +186,19 @@ public class AboutActivity extends MaterialAboutActivity { }) .build()); privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.acknowledgment) - .icon(R.drawable.ic_acknowledgment) + .text(R.string.acknowledgements) + .icon(R.drawable.ic_acknowledgements) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { if (config.dialog == null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.acknowledgmentHtmlPath))); } else { - config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.acknowledgment)); + config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.acknowledgements)); } if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.asknowledgment_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.acknowledgements_log_event)); } } }) diff --git a/library/src/main/res/drawable/ic_acknowledgment.xml b/library/src/main/res/drawable/ic_acknowledgements.xml similarity index 100% rename from library/src/main/res/drawable/ic_acknowledgment.xml rename to library/src/main/res/drawable/ic_acknowledgements.xml diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index b2eef7c..db56bd3 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -7,7 +7,7 @@ Facebook Twitter Web - Acknowledgment + Acknowledgements Privacy Policy About Share @@ -19,7 +19,7 @@ Twitter Website Privacy - Acknowledgement + Acknowledgements You don\'t have any app that can open this link From 690d7547f1537bd823de548d5f5eb6e5a1f90e7c Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 21:30:26 +0200 Subject: [PATCH 06/15] Added footer to email body (Close #5) --- .../eggheadgames/aboutbox/share/EmailUtil.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 62ccbf3..82962dc 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -3,9 +3,13 @@ package com.eggheadgames.aboutbox.share; import android.app.Activity; import android.content.Intent; import android.net.Uri; +import android.os.Build; +import android.text.TextUtils; import com.eggheadgames.aboutbox.AboutConfig; +import org.w3c.dom.Text; + public final class EmailUtil { private EmailUtil() { @@ -29,17 +33,27 @@ public final class EmailUtil { default: emailSubject = config.emailSubject; } + String emailBody = config.emailBody; + if (TextUtils.isEmpty(emailBody)) { + String deviceInfo = ""; + deviceInfo += "\n App version: " + config.version; + deviceInfo += "\n Android version: " + Build.VERSION.RELEASE + " (" + android.os.Build.VERSION.SDK_INT + ")"; + deviceInfo += "\n OS version: " + System.getProperty("os.version") + " (" + android.os.Build.VERSION.INCREMENTAL + ")"; + deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; + + emailBody = "Please type your question here: \n\n\n\n\n" + + "---------------------------" + deviceInfo; + } try { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, mailto); emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); - emailIntent.putExtra(Intent.EXTRA_TEXT, config.emailBody); + emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody); activity.startActivity(Intent.createChooser(emailIntent, "Send email...")); } catch (Exception e) { if (config.analytics != null) { config.analytics.logException(e, false); } } - } } From 58c3e44cc1c14c529d509c272eec9e51b11766ec Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 21:48:32 +0200 Subject: [PATCH 07/15] Added Portuguese language. (Close #3) --- .../aboutbox/share/EmailUtil.java | 2 -- library/src/main/res/values-pt/strings.xml | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 library/src/main/res/values-pt/strings.xml diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 82962dc..d073a8d 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -8,8 +8,6 @@ import android.text.TextUtils; import com.eggheadgames.aboutbox.AboutConfig; -import org.w3c.dom.Text; - public final class EmailUtil { private EmailUtil() { diff --git a/library/src/main/res/values-pt/strings.xml b/library/src/main/res/values-pt/strings.xml new file mode 100644 index 0000000..3fc9545 --- /dev/null +++ b/library/src/main/res/values-pt/strings.xml @@ -0,0 +1,25 @@ + + AboutBox + Avaliar + Contactar o Suporte + Experimentar outras aplicações + Versão + Facebook + Twitter + Web + Acknowledgment + Política de Privacidade + Sobre + Partilhar + Contactos + Avalie + Partilhar + Experimentar outras aplicações + Facebook + Twitter + Website + Privacicidade + Acknowledgement + Tu não tens nenhuma aplicação que possa abrir esta ligação + + From 7541287f69ae9c356850c3f2f893c19cccea78f9 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 22:00:03 +0200 Subject: [PATCH 08/15] Added egab to all strings keys --- .../aboutbox/activity/AboutActivity.java | 50 +++++++++---------- library/src/main/res/values-pt/strings.xml | 38 +++++++------- library/src/main/res/values/strings.xml | 42 ++++++++-------- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java index dd6a413..4766173 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/activity/AboutActivity.java @@ -37,21 +37,21 @@ public class AboutActivity extends MaterialAboutActivity { .build()); generalInfoCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.version) + .text(R.string.egab_version) .subText(config.version) .build()); MaterialAboutCard.Builder supportCardBuilder = new MaterialAboutCard.Builder(); supportCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.contact_support) + .text(R.string.egab_contact_support) .icon(R.drawable.ic_email_black) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { EmailUtil.contactUs(AboutActivity.this); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.contact_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_contact_log_event)); } } }) @@ -60,27 +60,27 @@ public class AboutActivity extends MaterialAboutActivity { MaterialAboutCard.Builder shareCardBuilder = new MaterialAboutCard.Builder(); shareCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.leave_review) + .text(R.string.egab_leave_review) .icon(R.drawable.ic_review) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { openApp(config.buildType, config.packageName); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.review_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_review_log_event)); } } }) .build()); shareCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.share) + .text(R.string.egab_share) .icon(R.drawable.ic_share_black) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { ShareUtil.share(AboutActivity.this); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.share_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_share_log_event)); } } }) @@ -89,14 +89,14 @@ public class AboutActivity extends MaterialAboutActivity { MaterialAboutCard.Builder aboutCardBuilder = new MaterialAboutCard.Builder(); aboutCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.try_other_apps) + .text(R.string.egab_try_other_apps) .icon(R.drawable.ic_try_other_apps) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override public void onClick() { openPublisher(config.buildType, config.appPublisher, config.packageName); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.try_other_app_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_try_other_app_log_event)); } } }) @@ -123,7 +123,7 @@ public class AboutActivity extends MaterialAboutActivity { MaterialAboutCard.Builder socialNetworksCardBuilder = new MaterialAboutCard.Builder(); socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.facebook_label) + .text(R.string.egab_facebook_label) .subText(config.facebookUserName) .icon(R.drawable.ic_facebook_24) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @@ -131,13 +131,13 @@ public class AboutActivity extends MaterialAboutActivity { public void onClick() { getOpenFacebookIntent(AboutActivity.this, config.facebookUserName); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.facebook_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_facebook_log_event)); } } }) .build()); socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.twitter_label) + .text(R.string.egab_twitter_label) .subText(config.twitterUserName) .icon(R.drawable.ic_twitter_24dp) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @@ -145,14 +145,14 @@ public class AboutActivity extends MaterialAboutActivity { public void onClick() { startTwitter(AboutActivity.this, config.twitterUserName); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.twitter_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_twitter_log_event)); } } }) .build()); socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.web_label) + .text(R.string.egab_web_label) .subText(config.webHomePage.replace("https://", "").replace("http://", "").replace("/", "")) .icon(R.drawable.ic_web_black_24dp) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @@ -160,7 +160,7 @@ public class AboutActivity extends MaterialAboutActivity { public void onClick() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.webHomePage))); if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.website_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_website_log_event)); } } }) @@ -168,7 +168,7 @@ public class AboutActivity extends MaterialAboutActivity { MaterialAboutCard.Builder privacyCardBuilder = new MaterialAboutCard.Builder(); privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.privacy_policy) + .text(R.string.egab_privacy_policy) .icon(R.drawable.ic_privacy) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override @@ -176,17 +176,17 @@ public class AboutActivity extends MaterialAboutActivity { if (config.dialog == null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.privacyHtmlPath))); } else { - config.dialog.open(AboutActivity.this, config.privacyHtmlPath, getString(R.string.privacy_policy)); + config.dialog.open(AboutActivity.this, config.privacyHtmlPath, getString(R.string.egab_privacy_policy)); } if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.privacy_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_privacy_log_event)); } } }) .build()); privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.acknowledgements) + .text(R.string.egab_acknowledgements) .icon(R.drawable.ic_acknowledgements) .setOnClickListener(new MaterialAboutActionItem.OnClickListener() { @Override @@ -194,11 +194,11 @@ public class AboutActivity extends MaterialAboutActivity { if (config.dialog == null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.acknowledgmentHtmlPath))); } else { - config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.acknowledgements)); + config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.egab_acknowledgements)); } if (config.analytics != null) { - config.analytics.logUiEvent(config.logUiEventName, getString(R.string.acknowledgements_log_event)); + config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_acknowledgements_log_event)); } } }) @@ -217,7 +217,7 @@ public class AboutActivity extends MaterialAboutActivity { @Override protected CharSequence getActivityTitle() { - return getString(R.string.about_screen_title); + return getString(R.string.egab_about_screen_title); } public static void getOpenFacebookIntent(Activity context, String name) { @@ -230,7 +230,7 @@ public class AboutActivity extends MaterialAboutActivity { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + name)); context.startActivity(intent); } catch (Exception e1) { - Toast.makeText(context, R.string.can_not_open, Toast.LENGTH_SHORT).show(); + Toast.makeText(context, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show(); } } } @@ -246,7 +246,7 @@ public class AboutActivity extends MaterialAboutActivity { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/" + name)); context.startActivity(intent); } catch (Exception e1) { - Toast.makeText(context, R.string.can_not_open, Toast.LENGTH_SHORT).show(); + Toast.makeText(context, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show(); } } @@ -295,7 +295,7 @@ public class AboutActivity extends MaterialAboutActivity { try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webURI))); } catch (ActivityNotFoundException e2) { - Toast.makeText(this, R.string.can_not_open, Toast.LENGTH_SHORT).show(); + Toast.makeText(this, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show(); } } } diff --git a/library/src/main/res/values-pt/strings.xml b/library/src/main/res/values-pt/strings.xml index 3fc9545..90181af 100644 --- a/library/src/main/res/values-pt/strings.xml +++ b/library/src/main/res/values-pt/strings.xml @@ -1,25 +1,25 @@ AboutBox - Avaliar - Contactar o Suporte - Experimentar outras aplicações - Versão - Facebook - Twitter - Web + Avaliar + Contactar o Suporte + Experimentar outras aplicações + Versão + Facebook + Twitter + Web Acknowledgment - Política de Privacidade - Sobre - Partilhar - Contactos - Avalie - Partilhar - Experimentar outras aplicações - Facebook - Twitter - Website - Privacicidade + Política de Privacidade + Sobre + Partilhar + Contactos + Avalie + Partilhar + Experimentar outras aplicações + Facebook + Twitter + Website + Privacicidade Acknowledgement - Tu não tens nenhuma aplicação que possa abrir esta ligação + Tu não tens nenhuma aplicação que possa abrir esta ligação diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index db56bd3..b2d6599 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -1,25 +1,25 @@ AboutBox - Leave Review - Contact Support - Try Other Apps - Version - Facebook - Twitter - Web - Acknowledgements - Privacy Policy - About - Share - Contact - Review - Share - Try Other Apps - Facebook - Twitter - Website - Privacy - Acknowledgements - You don\'t have any app that can open this link + Leave Review + Contact Support + Try Other Apps + Version + Facebook + Twitter + Web + Acknowledgements + Privacy Policy + About + Share + Contact + Review + Share + Try Other Apps + Facebook + Twitter + Website + Privacy + Acknowledgements + You don\'t have any app that can open this link From 2c0511a7fd77633d26e17733a2195278d9f3caa2 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 22:08:08 +0200 Subject: [PATCH 09/15] Fixed lint --- library/src/main/res/values-pt/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/res/values-pt/strings.xml b/library/src/main/res/values-pt/strings.xml index 90181af..b54e3d4 100644 --- a/library/src/main/res/values-pt/strings.xml +++ b/library/src/main/res/values-pt/strings.xml @@ -7,7 +7,7 @@ Facebook Twitter Web - Acknowledgment + Acknowledgements Política de Privacidade Sobre Partilhar @@ -19,7 +19,7 @@ Twitter Website Privacicidade - Acknowledgement + Acknowledgements Tu não tens nenhuma aplicação que possa abrir esta ligação From 077aad00c06fd7629b3bc44138ee6cbdbeaf7582 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 9 Feb 2017 22:17:57 +0200 Subject: [PATCH 10/15] Fixed pmd --- .../src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index d073a8d..ef3343b 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -30,6 +30,7 @@ public final class EmailUtil { break; default: emailSubject = config.emailSubject; + break; } String emailBody = config.emailBody; if (TextUtils.isEmpty(emailBody)) { From 501017078f3a8629e7cc1476326ef9900c348aa3 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 9 Feb 2017 15:12:06 -0800 Subject: [PATCH 11/15] Add platform to footer instead of header --- .../aboutbox/share/EmailUtil.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index ef3343b..06e2198 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -19,19 +19,6 @@ public final class EmailUtil { final Uri mailto = Uri.fromParts("mailto", config.emailAddress, null); - final String emailSubject; - - switch (config.buildType) { - case GOOGLE: - emailSubject = config.emailSubject + "G"; - break; - case AMAZON: - emailSubject = config.emailSubject + "K"; - break; - default: - emailSubject = config.emailSubject; - break; - } String emailBody = config.emailBody; if (TextUtils.isEmpty(emailBody)) { String deviceInfo = ""; @@ -39,6 +26,7 @@ public final class EmailUtil { deviceInfo += "\n Android version: " + Build.VERSION.RELEASE + " (" + android.os.Build.VERSION.SDK_INT + ")"; deviceInfo += "\n OS version: " + System.getProperty("os.version") + " (" + android.os.Build.VERSION.INCREMENTAL + ")"; deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; + deviceInfo += "\n Platform: " + platformName(config.buildType); emailBody = "Please type your question here: \n\n\n\n\n" + "---------------------------" + deviceInfo; @@ -46,7 +34,7 @@ public final class EmailUtil { try { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, mailto); - emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, config.emailSubject); emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody); activity.startActivity(Intent.createChooser(emailIntent, "Send email...")); } catch (Exception e) { @@ -55,4 +43,12 @@ public final class EmailUtil { } } } + + private static String platformName(AboutConfig.BuildType buildType) { + switch (buildType) { + case GOOGLE: return "Google Play"; + case AMAZON: return "Amazon Kindle"; + default: return "Unknown"; + } + } } From 6ef9141109090afa9632da16b4500c4aeb6a96bf Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 9 Feb 2017 15:25:50 -0800 Subject: [PATCH 12/15] Extract email prompt string into strings.xml --- .../main/java/com/eggheadgames/aboutbox/share/EmailUtil.java | 3 ++- library/src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 06e2198..91bb905 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -7,6 +7,7 @@ import android.os.Build; import android.text.TextUtils; import com.eggheadgames.aboutbox.AboutConfig; +import com.eggheadgames.aboutbox.R; public final class EmailUtil { @@ -28,7 +29,7 @@ public final class EmailUtil { deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; deviceInfo += "\n Platform: " + platformName(config.buildType); - emailBody = "Please type your question here: \n\n\n\n\n" + emailBody = R.string.egab_email_body_prompt + "\n\n\n\n\n" + "---------------------------" + deviceInfo; } diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index b2d6599..724d70c 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -21,5 +21,6 @@ Privacy Acknowledgements You don\'t have any app that can open this link + Please type your question here: From 4a9b0feefc42616f99475158f681d0cb056fee86 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 9 Feb 2017 15:29:19 -0800 Subject: [PATCH 13/15] Skip OS for now version to avoid scaring people :) --- .../src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java | 1 - 1 file changed, 1 deletion(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 91bb905..0bb11ec 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -25,7 +25,6 @@ public final class EmailUtil { String deviceInfo = ""; deviceInfo += "\n App version: " + config.version; deviceInfo += "\n Android version: " + Build.VERSION.RELEASE + " (" + android.os.Build.VERSION.SDK_INT + ")"; - deviceInfo += "\n OS version: " + System.getProperty("os.version") + " (" + android.os.Build.VERSION.INCREMENTAL + ")"; deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; deviceInfo += "\n Platform: " + platformName(config.buildType); From e2c64ba5a82ed6dd515ecc8c0ca8636f4a5f0d85 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 9 Feb 2017 15:34:52 -0800 Subject: [PATCH 14/15] Add Google Translated version of missing Portuguese prompt --- library/src/main/res/values-pt/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/res/values-pt/strings.xml b/library/src/main/res/values-pt/strings.xml index b54e3d4..00e8471 100644 --- a/library/src/main/res/values-pt/strings.xml +++ b/library/src/main/res/values-pt/strings.xml @@ -21,5 +21,5 @@ Privacicidade Acknowledgements Tu não tens nenhuma aplicação que possa abrir esta ligação - + Digite sua pergunta aqui: From 5303e1d71e031886809f7e5b51a5de93d798c059 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 9 Feb 2017 15:41:29 -0800 Subject: [PATCH 15/15] Use string resource correctly --- .../main/java/com/eggheadgames/aboutbox/share/EmailUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java index 0bb11ec..438612a 100644 --- a/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java +++ b/library/src/main/java/com/eggheadgames/aboutbox/share/EmailUtil.java @@ -28,7 +28,7 @@ public final class EmailUtil { deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; deviceInfo += "\n Platform: " + platformName(config.buildType); - emailBody = R.string.egab_email_body_prompt + "\n\n\n\n\n" + emailBody = activity.getString(R.string.egab_email_body_prompt) + "\n\n\n\n\n" + "---------------------------" + deviceInfo; }