Merge pull request #1692 from CatimaLoyalty/1647-2

Only list contributors with at least 5 commits
This commit is contained in:
Sylvia van Os
2024-01-12 12:27:18 +01:00
committed by GitHub
3 changed files with 27 additions and 20 deletions

View File

@@ -28,9 +28,10 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Update contributors
id: update_contributors
uses: TheLastProject/contributors-to-file-action@v3.0.2
uses: TheLastProject/contributors-to-file-action@v3.2.0
with:
file_in_repo: app/src/main/res/raw/contributors.txt
min_commit_count: 5
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
with:

View File

@@ -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) {

View File

@@ -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("<br/><br/>");
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("<br/><br/>");
contributorInfo.append(String.format(context.getString(R.string.app_contributors), getContributors()));
contributorInfo.append("<br/><br/>");
contributorInfo.append(String.format(context.getString(R.string.app_libraries), getThirdPartyLibraries()));
contributorInfo.append("<br/><br/>");
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() {