Added contributors list to about

pull/184/head
M66B 4 years ago
parent 03d3dfc66f
commit 137c8db235

@ -1123,6 +1123,9 @@ Alternatively, you might be able to enable the *Files* app again using the Andro
Yes, you can translate the texts of FairEmail in your own language [on Crowdin](https://crowdin.com/project/open-source-email).
Registration is free.
If you would like your name or alias to be included in the list of contributors in *About* the app,
please [contact me](https://contact.faircode.eu/?product=fairemailsupport).
<br />
<a name="faq27"></a>

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

@ -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";

@ -62,6 +62,26 @@
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvContributors"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/title_contributors"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inEula" />
<LinearLayout
android:id="@+id/llContributors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvContributors" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -133,6 +133,7 @@
<string name="title_welcome">Welcome</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_gplv3" translatable="false">GNU General Public License - Version 3</string>
<string name="title_contributors">Contributors</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<contributors>
<contributor
name="Marcel Bokhorst"
alias="M66B"
contribution="Dutch" />
<contributor
name="Zidan Pragata"
alias="zidanpragata"
contribution="Indonesian" />
</contributors>
Loading…
Cancel
Save