mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
Added contributors list to about
This commit is contained in:
@@ -1144,7 +1144,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
}
|
||||
|
||||
private void onMenuTranslate() {
|
||||
Helper.view(this, Uri.parse(Helper.CROWDIN_URI), true);
|
||||
Helper.viewFAQ(this, 26);
|
||||
}
|
||||
|
||||
private void onMenuIssue() {
|
||||
|
||||
100
app/src/main/java/eu/faircode/email/Contributor.java
Normal file
100
app/src/main/java/eu/faircode/email/Contributor.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package eu.faircode.email;
|
||||
|
||||
/*
|
||||
This file is part of FairEmail.
|
||||
|
||||
FairEmail is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
FairEmail is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2018-2020 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Contributor {
|
||||
public String name;
|
||||
public String alias;
|
||||
public String contribution;
|
||||
|
||||
private Contributor() {
|
||||
}
|
||||
|
||||
static List<Contributor> loadContributors(Context context) {
|
||||
List<Contributor> result = null;
|
||||
try {
|
||||
Contributor contributor = null;
|
||||
XmlResourceParser xml = context.getResources().getXml(R.xml.contributors);
|
||||
int eventType = xml.getEventType();
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
String name = xml.getName();
|
||||
if ("contributors".equals(name))
|
||||
result = new ArrayList<>();
|
||||
else if ("contributor".equals(name)) {
|
||||
contributor = new Contributor();
|
||||
contributor.name = xml.getAttributeValue(null, "name");
|
||||
contributor.alias = xml.getAttributeValue(null, "alias");
|
||||
contributor.contribution = xml.getAttributeValue(null, "contribution");
|
||||
} else
|
||||
throw new IllegalAccessException(name);
|
||||
} else if (eventType == XmlPullParser.END_TAG) {
|
||||
if ("contributor".equals(xml.getName())) {
|
||||
result.add(contributor);
|
||||
contributor = null;
|
||||
}
|
||||
}
|
||||
|
||||
eventType = xml.next();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (!TextUtils.isEmpty(name))
|
||||
sb.append(name);
|
||||
|
||||
if (!TextUtils.isEmpty(alias)) {
|
||||
if (sb.length() > 0)
|
||||
sb.append(' ');
|
||||
if (!TextUtils.isEmpty(name))
|
||||
sb.append('(');
|
||||
sb.append(alias);
|
||||
if (!TextUtils.isEmpty(name))
|
||||
sb.append(')');
|
||||
}
|
||||
|
||||
sb.append(" - ");
|
||||
|
||||
if (!TextUtils.isEmpty(contribution)) {
|
||||
if (sb.length() > 0)
|
||||
sb.append(' ');
|
||||
sb.append(contribution);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -19,20 +19,26 @@ package eu.faircode.email;
|
||||
Copyright 2018-2020 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FragmentAbout extends FragmentBase {
|
||||
@Override
|
||||
@@ -46,6 +52,7 @@ public class FragmentAbout extends FragmentBase {
|
||||
TextView tvVersion = view.findViewById(R.id.tvVersion);
|
||||
TextView tvRelease = view.findViewById(R.id.tvRelease);
|
||||
TextView tvGplV3 = view.findViewById(R.id.tvGplV3);
|
||||
LinearLayout llContributors = view.findViewById(R.id.llContributors);
|
||||
|
||||
tvVersion.setText(getString(R.string.title_version, BuildConfig.VERSION_NAME));
|
||||
tvRelease.setText(BuildConfig.RELEASE_NAME);
|
||||
@@ -58,6 +65,19 @@ public class FragmentAbout extends FragmentBase {
|
||||
}
|
||||
});
|
||||
|
||||
final Context context = getContext();
|
||||
|
||||
TypedValue style = new TypedValue();
|
||||
context.getTheme().resolveAttribute(R.style.TextAppearance_AppCompat_Small, style, true);
|
||||
|
||||
List<Contributor> contributors = Contributor.loadContributors(context);
|
||||
for (Contributor contributor : contributors) {
|
||||
TextView tv = new TextView(context);
|
||||
TextViewCompat.setTextAppearance(tv, style.data);
|
||||
tv.setText(contributor.toString());
|
||||
llContributors.addView(tv);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,6 @@ public class Helper {
|
||||
static final String XDA_URI = "https://forum.xda-developers.com/showthread.php?t=3824168";
|
||||
static final String SUPPORT_URI = "https://contact.faircode.eu/?product=fairemailsupport";
|
||||
static final String TEST_URI = "https://play.google.com/apps/testing/" + BuildConfig.APPLICATION_ID;
|
||||
static final String CROWDIN_URI = "https://crowdin.com/project/open-source-email";
|
||||
static final String GRAVATAR_PRIVACY_URI = "https://meta.stackexchange.com/questions/44717/is-gravatar-a-privacy-risk";
|
||||
static final String LICENSE_URI = "https://www.gnu.org/licenses/gpl-3.0.html";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user