1
0
Fork 0
mirror of https://github.com/ethauvin/android-about-box.git synced 2025-04-26 02:57:12 -07:00

refactored

This commit is contained in:
Alex Dibrivnyi 2017-04-13 18:46:31 +03:00
parent 94842b51da
commit 23fae473aa

View file

@ -62,7 +62,7 @@ public class AboutActivity extends MaterialAboutActivity {
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() { .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
@Override @Override
public void onClick() { public void onClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.webHomePage))); openHTMLPage(config.webHomePage);
if (config.analytics != null) { if (config.analytics != null) {
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_guide)); config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_guide));
} }
@ -120,7 +120,7 @@ public class AboutActivity extends MaterialAboutActivity {
@Override @Override
public void onClick() { public void onClick() {
if (config.dialog == null) { if (config.dialog == null) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.companyHtmlPath))); openHTMLPage(config.companyHtmlPath);
} else { } else {
config.dialog.open(AboutActivity.this, config.companyHtmlPath, config.aboutLabelTitle); config.dialog.open(AboutActivity.this, config.companyHtmlPath, config.aboutLabelTitle);
} }
@ -170,7 +170,7 @@ public class AboutActivity extends MaterialAboutActivity {
.setOnClickListener(new MaterialAboutActionItem.OnClickListener() { .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
@Override @Override
public void onClick() { public void onClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.webHomePage))); openHTMLPage(config.webHomePage);
if (config.analytics != null) { if (config.analytics != null) {
config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_website_log_event)); config.analytics.logUiEvent(config.logUiEventName, getString(R.string.egab_website_log_event));
} }
@ -186,7 +186,7 @@ public class AboutActivity extends MaterialAboutActivity {
@Override @Override
public void onClick() { public void onClick() {
if (config.dialog == null) { if (config.dialog == null) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.privacyHtmlPath))); openHTMLPage(config.privacyHtmlPath);
} else { } else {
config.dialog.open(AboutActivity.this, config.privacyHtmlPath, getString(R.string.egab_privacy_policy)); config.dialog.open(AboutActivity.this, config.privacyHtmlPath, getString(R.string.egab_privacy_policy));
} }
@ -204,7 +204,7 @@ public class AboutActivity extends MaterialAboutActivity {
@Override @Override
public void onClick() { public void onClick() {
if (config.dialog == null) { if (config.dialog == null) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(config.acknowledgmentHtmlPath))); openHTMLPage(config.acknowledgmentHtmlPath);
} else { } else {
config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.egab_acknowledgements)); config.dialog.open(AboutActivity.this, config.acknowledgmentHtmlPath, getString(R.string.egab_acknowledgements));
} }
@ -305,10 +305,14 @@ public class AboutActivity extends MaterialAboutActivity {
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)));
}
} }