mirror of
https://github.com/ethauvin/android-about-box.git
synced 2025-04-25 02:37:11 -07:00
Merge pull request #22 from eggheadgames/release/1.1.0
Release 1.1.0 to master
This commit is contained in:
commit
ff613f58d4
9 changed files with 260 additions and 190 deletions
28
README.md
28
README.md
|
@ -12,6 +12,8 @@ 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.1.0, you can also optionally provide a help file with the `aboutConfig.guideHtmlPath` setting. Leave it unset (null or empty string) and the behaviour is compatible with version 1.0.x.
|
||||||
|
|
||||||
## Installation Instructions
|
## Installation Instructions
|
||||||
|
|
||||||
Add the JitPack.io repository to your root `build.gradle`:
|
Add the JitPack.io repository to your root `build.gradle`:
|
||||||
|
@ -100,6 +102,32 @@ Open AboutBox screen
|
||||||
AboutActivity.launch(activity);
|
AboutActivity.launch(activity);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Theme
|
||||||
|
|
||||||
|
Add to your AndroidManifest.xml file
|
||||||
|
|
||||||
|
```
|
||||||
|
<activity
|
||||||
|
android:name="com.eggheadgames.aboutbox.activity.AboutActivity"
|
||||||
|
android:theme="@style/AppTheme.MaterialAboutActivity"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
Ensure that `AppTheme.MaterialAboutActivity` theme extends either of these themes, and apply primary & accent colours:
|
||||||
|
```
|
||||||
|
Theme.Mal.Light.DarkActionBar
|
||||||
|
Theme.Mal.Light.LightActionBar
|
||||||
|
Theme.Mal.Dark.LightActionBar
|
||||||
|
Theme.Mal.Dark.DarkActionBar
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
<style name="AppTheme.MaterialAboutActivity" parent="Theme.Mal.Light.DarkActionBar" >
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
```
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||
<img src="extras/example.png?raw=true">
|
<img src="extras/example.png?raw=true">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
pre:
|
pre:
|
||||||
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,android-24
|
- 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-24.0.2
|
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
|
||||||
|
|
||||||
test:
|
test:
|
||||||
override:
|
override:
|
||||||
|
|
|
@ -6,13 +6,13 @@ group='com.github.eggheadgames'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 24
|
compileSdkVersion 24
|
||||||
buildToolsVersion "24.0.2"
|
buildToolsVersion "25.0.2"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 24
|
targetSdkVersion 24
|
||||||
versionCode 3
|
versionCode 4
|
||||||
versionName "1.0.2"
|
versionName "1.1.0"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -28,8 +28,8 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.daniel-stoneuk:material-about-library:1.5.0'
|
compile 'com.github.daniel-stoneuk:material-about-library:1.8.2'
|
||||||
compile('io.branch.sdk.android:library:2.5.7') {
|
compile('io.branch.sdk.android:library:2.6.1') {
|
||||||
exclude module: 'answers.shim'
|
exclude module: 'answers.shim'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.eggheadgames.aboutbox">
|
package="com.eggheadgames.aboutbox">
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.eggheadgames.aboutbox.activity.AboutActivity"
|
android:name="com.eggheadgames.aboutbox.activity.AboutActivity"
|
||||||
android:theme="@style/AppTheme.MaterialAboutActivity" />
|
android:theme="@style/AppTheme.MaterialAboutActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ public class AboutConfig {
|
||||||
public String facebookUserName;
|
public String facebookUserName;
|
||||||
public String twitterUserName;
|
public String twitterUserName;
|
||||||
public String webHomePage;
|
public String webHomePage;
|
||||||
|
public String guideHtmlPath;
|
||||||
public String appPublisher;
|
public String appPublisher;
|
||||||
public String companyHtmlPath;
|
public String companyHtmlPath;
|
||||||
public String privacyHtmlPath;
|
public String privacyHtmlPath;
|
||||||
|
|
|
@ -5,14 +5,18 @@ import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
|
import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
|
||||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutActionItem;
|
import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem;
|
||||||
|
import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickListener;
|
||||||
|
import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem;
|
||||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
|
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
|
||||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
|
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
|
||||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutTitleItem;
|
|
||||||
import com.eggheadgames.aboutbox.AboutConfig;
|
import com.eggheadgames.aboutbox.AboutConfig;
|
||||||
|
import com.eggheadgames.aboutbox.IAnalytic;
|
||||||
import com.eggheadgames.aboutbox.R;
|
import com.eggheadgames.aboutbox.R;
|
||||||
import com.eggheadgames.aboutbox.share.EmailUtil;
|
import com.eggheadgames.aboutbox.share.EmailUtil;
|
||||||
import com.eggheadgames.aboutbox.share.ShareUtil;
|
import com.eggheadgames.aboutbox.share.ShareUtil;
|
||||||
|
@ -29,6 +33,18 @@ public class AboutActivity extends MaterialAboutActivity {
|
||||||
|
|
||||||
final AboutConfig config = AboutConfig.getInstance();
|
final AboutConfig config = AboutConfig.getInstance();
|
||||||
|
|
||||||
|
return new MaterialAboutList.Builder()
|
||||||
|
.addCard(buildGeneralInfoCard(config))
|
||||||
|
.addCard(buildSupportCard(config))
|
||||||
|
.addCard(buildShareCard(config))
|
||||||
|
.addCard(buildAboutCard(config))
|
||||||
|
.addCard(buildSocialNetworksCard(config))
|
||||||
|
.addCard(buildPrivacyCard(config))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildGeneralInfoCard(AboutConfig config) {
|
||||||
MaterialAboutCard.Builder generalInfoCardBuilder = new MaterialAboutCard.Builder();
|
MaterialAboutCard.Builder generalInfoCardBuilder = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
generalInfoCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
|
generalInfoCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
|
||||||
|
@ -40,181 +56,184 @@ public class AboutActivity extends MaterialAboutActivity {
|
||||||
.text(R.string.egab_version)
|
.text(R.string.egab_version)
|
||||||
.subText(config.version)
|
.subText(config.version)
|
||||||
.build());
|
.build());
|
||||||
|
return generalInfoCardBuilder.build();
|
||||||
|
|
||||||
MaterialAboutCard.Builder supportCardBuilder = new MaterialAboutCard.Builder();
|
|
||||||
supportCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.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.egab_contact_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
|
|
||||||
MaterialAboutCard.Builder shareCardBuilder = new MaterialAboutCard.Builder();
|
|
||||||
shareCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.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.egab_review_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
shareCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.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.egab_share_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
|
|
||||||
MaterialAboutCard.Builder aboutCardBuilder = new MaterialAboutCard.Builder();
|
|
||||||
aboutCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.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.egab_try_other_app_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
aboutCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.text(config.aboutLabelTitle)
|
|
||||||
.icon(R.drawable.ic_about_black)
|
|
||||||
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
if (config.dialog == null) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.companyHtmlPath)));
|
|
||||||
} else {
|
|
||||||
config.dialog.open(AboutActivity.this, config.companyHtmlPath, config.aboutLabelTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.analytics != null) {
|
|
||||||
config.analytics.logUiEvent(config.logUiEventName, config.aboutLabelTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
|
|
||||||
MaterialAboutCard.Builder socialNetworksCardBuilder = new MaterialAboutCard.Builder();
|
|
||||||
socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.text(R.string.egab_facebook_label)
|
|
||||||
.subText(config.facebookUserName)
|
|
||||||
.icon(R.drawable.ic_facebook_24)
|
|
||||||
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
getOpenFacebookIntent(AboutActivity.this, config.facebookUserName);
|
|
||||||
if (config.analytics != null) {
|
|
||||||
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_facebook_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.text(R.string.egab_twitter_label)
|
|
||||||
.subText(config.twitterUserName)
|
|
||||||
.icon(R.drawable.ic_twitter_24dp)
|
|
||||||
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
startTwitter(AboutActivity.this, config.twitterUserName);
|
|
||||||
if (config.analytics != null) {
|
|
||||||
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_twitter_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
socialNetworksCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.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() {
|
|
||||||
@Override
|
|
||||||
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.egab_website_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
MaterialAboutCard.Builder privacyCardBuilder = new MaterialAboutCard.Builder();
|
|
||||||
privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.text(R.string.egab_privacy_policy)
|
|
||||||
.icon(R.drawable.ic_privacy)
|
|
||||||
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick() {
|
|
||||||
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.egab_privacy_policy));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.analytics != null) {
|
|
||||||
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_privacy_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
|
||||||
.text(R.string.egab_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.egab_acknowledgements));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.analytics != null) {
|
|
||||||
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_acknowledgements_log_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build());
|
|
||||||
|
|
||||||
|
|
||||||
return new MaterialAboutList.Builder()
|
|
||||||
.addCard(generalInfoCardBuilder.build())
|
|
||||||
.addCard(supportCardBuilder.build())
|
|
||||||
.addCard(shareCardBuilder.build())
|
|
||||||
.addCard(aboutCardBuilder.build())
|
|
||||||
.addCard(socialNetworksCardBuilder.build())
|
|
||||||
.addCard(privacyCardBuilder.build())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildSupportCard(final AboutConfig config) {
|
||||||
|
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(config.guideHtmlPath)) {
|
||||||
|
card.addItem(itemHelper(R.string.egab_guide, R.drawable.ic_help_green,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
if (config.dialog == null) {
|
||||||
|
openHTMLPage(config.guideHtmlPath);
|
||||||
|
} else {
|
||||||
|
config.dialog.open(AboutActivity.this, config.guideHtmlPath, getString(R.string.egab_guide));
|
||||||
|
}
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_guide));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
card.addItem(itemHelper(R.string.egab_contact_support, R.drawable.ic_email_black,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
EmailUtil.contactUs(AboutActivity.this);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_contact_log_event));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
return card.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildShareCard(final AboutConfig config) {
|
||||||
|
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
|
card.addItem(itemHelper(R.string.egab_leave_review, R.drawable.ic_review,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
openApp(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() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
ShareUtil.share(AboutActivity.this);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_share_log_event));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
return card.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildAboutCard(final AboutConfig config) {
|
||||||
|
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
|
card.addItem(itemHelper(R.string.egab_try_other_apps, R.drawable.ic_try_other_apps,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
openPublisher(config.buildType, config.appPublisher, config.packageName);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_try_other_app_log_event));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
card.addItem(new MaterialAboutActionItem.Builder()
|
||||||
|
.text(config.aboutLabelTitle)
|
||||||
|
.icon(R.drawable.ic_about_black)
|
||||||
|
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
if (config.dialog == null) {
|
||||||
|
openHTMLPage(config.companyHtmlPath);
|
||||||
|
} else {
|
||||||
|
config.dialog.open(AboutActivity.this, config.companyHtmlPath, config.aboutLabelTitle);
|
||||||
|
}
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, config.aboutLabelTitle);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
|
|
||||||
|
return card.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildSocialNetworksCard(final AboutConfig config) {
|
||||||
|
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
|
card.addItem(new MaterialAboutActionItem.Builder()
|
||||||
|
.text(R.string.egab_facebook_label)
|
||||||
|
.subText(config.facebookUserName)
|
||||||
|
.icon(R.drawable.ic_facebook_24)
|
||||||
|
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
getOpenFacebookIntent(AboutActivity.this, config.facebookUserName);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_facebook_log_event));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
|
card.addItem(new MaterialAboutActionItem.Builder()
|
||||||
|
.text(R.string.egab_twitter_label)
|
||||||
|
.subText(config.twitterUserName)
|
||||||
|
.icon(R.drawable.ic_twitter_24dp)
|
||||||
|
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
startTwitter(AboutActivity.this, config.twitterUserName);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_twitter_log_event));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
|
|
||||||
|
card.addItem(new MaterialAboutActionItem.Builder()
|
||||||
|
.text(R.string.egab_web_label)
|
||||||
|
.subText(config.webHomePage.replace("https://", "").replace("http://", "").replace("/", ""))
|
||||||
|
.icon(R.drawable.ic_web_black_24dp)
|
||||||
|
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
openHTMLPage(config.webHomePage);
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_website_log_event));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
|
|
||||||
|
return card.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MaterialAboutCard buildPrivacyCard(final AboutConfig config) {
|
||||||
|
MaterialAboutCard.Builder card = new MaterialAboutCard.Builder();
|
||||||
|
|
||||||
|
card.addItem(itemHelper(R.string.egab_privacy_policy, R.drawable.ic_privacy,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
if (config.dialog == null) {
|
||||||
|
openHTMLPage(config.privacyHtmlPath);
|
||||||
|
} else {
|
||||||
|
config.dialog.open(AboutActivity.this, config.privacyHtmlPath, getString(R.string.egab_privacy_policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_privacy_log_event));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
card.addItem(itemHelper(R.string.egab_acknowledgements, R.drawable.ic_acknowledgements,
|
||||||
|
new MaterialAboutItemOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(boolean b) {
|
||||||
|
if (config.dialog == null) {
|
||||||
|
openHTMLPage(config.acknowledgmentHtmlPath);
|
||||||
|
} else {
|
||||||
|
config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.egab_acknowledgements));
|
||||||
|
}
|
||||||
|
logUIEventName(config.analytics, config.logUiEventName, getString(R.string.egab_acknowledgements_log_event));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return card.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private MaterialAboutActionItem itemHelper(int name, int icon, MaterialAboutItemOnClickListener listener) {
|
||||||
|
return new MaterialAboutActionItem.Builder()
|
||||||
|
.text(name)
|
||||||
|
.icon(icon)
|
||||||
|
.setOnClickListener(listener)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CharSequence getActivityTitle() {
|
protected CharSequence getActivityTitle() {
|
||||||
return getString(R.string.egab_about_screen_title);
|
return getString(R.string.egab_about_screen_title);
|
||||||
|
@ -249,7 +268,6 @@ public class AboutActivity extends MaterialAboutActivity {
|
||||||
Toast.makeText(context, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openApp(AboutConfig.BuildType buildType, String packageName) {
|
public void openApp(AboutConfig.BuildType buildType, String packageName) {
|
||||||
|
@ -267,7 +285,7 @@ public class AboutActivity extends MaterialAboutActivity {
|
||||||
default:
|
default:
|
||||||
//nothing
|
//nothing
|
||||||
}
|
}
|
||||||
open(appURI, webURI);
|
openApplication(appURI, webURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPublisher(AboutConfig.BuildType buildType, String publisher, String packageName) {
|
public void openPublisher(AboutConfig.BuildType buildType, String publisher, String packageName) {
|
||||||
|
@ -285,18 +303,28 @@ public class AboutActivity extends MaterialAboutActivity {
|
||||||
default:
|
default:
|
||||||
//nothing
|
//nothing
|
||||||
}
|
}
|
||||||
open(appURI, webURI);
|
openApplication(appURI, webURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void open(String appURI, String webURI) {
|
private void openApplication(String appURI, String webURI) {
|
||||||
try {
|
try {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(appURI)));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(appURI)));
|
||||||
} catch (ActivityNotFoundException e1) {
|
} catch (ActivityNotFoundException e1) {
|
||||||
try {
|
try {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webURI)));
|
openHTMLPage(webURI);
|
||||||
} catch (ActivityNotFoundException e2) {
|
} catch (ActivityNotFoundException e2) {
|
||||||
Toast.makeText(this, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.egab_can_not_open, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openHTMLPage(String htmlPath) {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(htmlPath)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logUIEventName(IAnalytic analytics, String eventType, String eventValue) {
|
||||||
|
if (analytics != null) {
|
||||||
|
analytics.logUiEvent(eventType, eventValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
library/src/main/res/drawable/ic_help_green.xml
Normal file
11
library/src/main/res/drawable/ic_help_green.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#00c853"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,17h-2v-2h2v2zm2.07,-7.75l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2H8c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||||
|
</vector>
|
|
@ -21,4 +21,5 @@
|
||||||
<string name="egab_acknowledgements_log_event">Acknowledgements</string>
|
<string name="egab_acknowledgements_log_event">Acknowledgements</string>
|
||||||
<string name="egab_can_not_open">Tu não tens nenhuma aplicação que possa abrir esta ligação</string>
|
<string name="egab_can_not_open">Tu não tens nenhuma aplicação que possa abrir esta ligação</string>
|
||||||
<string name="egab_email_body_prompt">Digite sua pergunta aqui: </string>
|
<string name="egab_email_body_prompt">Digite sua pergunta aqui: </string>
|
||||||
|
<string name="egab_guide">Guia</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -21,5 +21,6 @@
|
||||||
<string name="egab_acknowledgements_log_event">Acknowledgements</string>
|
<string name="egab_acknowledgements_log_event">Acknowledgements</string>
|
||||||
<string name="egab_can_not_open">You don\'t have any app that can open this link</string>
|
<string name="egab_can_not_open">You don\'t have any app that can open this link</string>
|
||||||
<string name="egab_email_body_prompt">Please type your question here: </string>
|
<string name="egab_email_body_prompt">Please type your question here: </string>
|
||||||
|
<string name="egab_guide">Guide</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue