diff --git a/app/src/main/java/protect/card_locker/AboutActivity.java b/app/src/main/java/protect/card_locker/AboutActivity.java
index 2eeb11467..58178a424 100644
--- a/app/src/main/java/protect/card_locker/AboutActivity.java
+++ b/app/src/main/java/protect/card_locker/AboutActivity.java
@@ -7,6 +7,7 @@ import android.view.View;
import android.widget.ScrollView;
import android.widget.TextView;
+import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@@ -98,11 +99,7 @@ public class AboutActivity extends CatimaAppCompatActivity {
}
private void showCredits() {
- new MaterialAlertDialogBuilder(this)
- .setTitle(R.string.credits)
- .setMessage(content.getContributorInfo())
- .setPositiveButton(R.string.ok, null)
- .show();
+ showHTML(R.string.credits, content.getContributorInfo(), null);
}
private void showHistory(View view) {
@@ -117,7 +114,7 @@ public class AboutActivity extends CatimaAppCompatActivity {
showHTML(R.string.privacy_policy, content.getPrivacyInfo(), view);
}
- private void showHTML(@StringRes int title, final Spanned text, View view) {
+ private void showHTML(@StringRes int title, final Spanned text, @Nullable View view) {
int dialogContentPadding = getResources().getDimensionPixelSize(R.dimen.alert_dialog_content_padding);
TextView textView = new TextView(this);
textView.setText(text);
@@ -125,12 +122,21 @@ public class AboutActivity extends CatimaAppCompatActivity {
ScrollView scrollView = new ScrollView(this);
scrollView.addView(textView);
scrollView.setPadding(dialogContentPadding, dialogContentPadding / 2, dialogContentPadding, 0);
- new MaterialAlertDialogBuilder(this)
+
+ // Create dialog
+ MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder(this);
+ materialAlertDialogBuilder
.setTitle(title)
.setView(scrollView)
- .setPositiveButton(R.string.ok, null)
- .setNeutralButton(R.string.view_online, (dialog, which) -> openExternalBrowser(view))
- .show();
+ .setPositiveButton(R.string.ok, null);
+
+ // Add View online button if an URL is linked to this view
+ if (view != null && view.getTag() != null) {
+ materialAlertDialogBuilder.setNeutralButton(R.string.view_online, (dialog, which) -> openExternalBrowser(view));
+ }
+
+ // Show dialog
+ materialAlertDialogBuilder.show();
}
private void openExternalBrowser(View view) {
diff --git a/app/src/main/java/protect/card_locker/AboutContent.java b/app/src/main/java/protect/card_locker/AboutContent.java
index 005ec7d3b..e4e8d87fc 100644
--- a/app/src/main/java/protect/card_locker/AboutContent.java
+++ b/app/src/main/java/protect/card_locker/AboutContent.java
@@ -129,19 +129,19 @@ public class AboutContent {
return result.toString();
}
- public String getContributorInfo() {
+ public Spanned getContributorInfo() {
StringBuilder contributorInfo = new StringBuilder();
contributorInfo.append(getCopyright());
- contributorInfo.append("\n\n");
+ contributorInfo.append("
");
contributorInfo.append(context.getString(R.string.app_copyright_old));
- contributorInfo.append("\n\n");
- contributorInfo.append(HtmlCompat.fromHtml(String.format(context.getString(R.string.app_contributors), getContributors()), HtmlCompat.FROM_HTML_MODE_COMPACT));
- contributorInfo.append("\n\n");
- contributorInfo.append(HtmlCompat.fromHtml(String.format(context.getString(R.string.app_libraries), getThirdPartyLibraries()), HtmlCompat.FROM_HTML_MODE_COMPACT));
- contributorInfo.append("\n\n");
- contributorInfo.append(HtmlCompat.fromHtml(String.format(context.getString(R.string.app_resources), getUsedThirdPartyAssets()), HtmlCompat.FROM_HTML_MODE_COMPACT));
+ contributorInfo.append("
");
+ contributorInfo.append(String.format(context.getString(R.string.app_contributors), getContributors()));
+ contributorInfo.append("
");
+ contributorInfo.append(String.format(context.getString(R.string.app_libraries), getThirdPartyLibraries()));
+ contributorInfo.append("
");
+ contributorInfo.append(String.format(context.getString(R.string.app_resources), getUsedThirdPartyAssets()));
- return contributorInfo.toString();
+ return HtmlCompat.fromHtml(contributorInfo.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT);
}
public Spanned getHistoryInfo() {