Link to localized website version from about screen
This commit is contained in:
parent
6e5004be22
commit
0c38218141
|
@ -0,0 +1,4 @@
|
||||||
|
en
|
||||||
|
fr
|
||||||
|
nl
|
||||||
|
it
|
|
@ -17,6 +17,13 @@ import de.danoeh.antennapod.activity.BugReportActivity;
|
||||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||||
import de.danoeh.antennapod.fragment.preferences.about.AboutFragment;
|
import de.danoeh.antennapod.fragment.preferences.about.AboutFragment;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
|
@ -106,7 +113,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
findPreference(PREF_DOCUMENTATION).setOnPreferenceClickListener(preference -> {
|
findPreference(PREF_DOCUMENTATION).setOnPreferenceClickListener(preference -> {
|
||||||
IntentUtils.openInBrowser(getContext(), "https://antennapod.org/documentation/");
|
IntentUtils.openInBrowser(getContext(), getLocalizedWebsiteLink() + "/documentation/");
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
findPreference(PREF_VIEW_FORUM).setOnPreferenceClickListener(preference -> {
|
findPreference(PREF_VIEW_FORUM).setOnPreferenceClickListener(preference -> {
|
||||||
|
@ -114,7 +121,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
findPreference(PREF_CONTRIBUTE).setOnPreferenceClickListener(preference -> {
|
findPreference(PREF_CONTRIBUTE).setOnPreferenceClickListener(preference -> {
|
||||||
IntentUtils.openInBrowser(getContext(), "https://antennapod.org/contribute/");
|
IntentUtils.openInBrowser(getContext(), getLocalizedWebsiteLink() + "/contribute/");
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
findPreference(PREF_SEND_BUG_REPORT).setOnPreferenceClickListener(preference -> {
|
findPreference(PREF_SEND_BUG_REPORT).setOnPreferenceClickListener(preference -> {
|
||||||
|
@ -123,6 +130,20 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getLocalizedWebsiteLink() {
|
||||||
|
try (InputStream is = getContext().getAssets().open("website-languages.txt")) {
|
||||||
|
String[] languages = IOUtils.toString(is, StandardCharsets.UTF_8.name()).split("\n");
|
||||||
|
String deviceLanguage = Locale.getDefault().getLanguage();
|
||||||
|
if (ArrayUtils.contains(languages, deviceLanguage) && !"en".equals(deviceLanguage)) {
|
||||||
|
return "https://antennapod.org/" + deviceLanguage;
|
||||||
|
} else {
|
||||||
|
return "https://antennapod.org";
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setupSearch() {
|
private void setupSearch() {
|
||||||
SearchPreference searchPreference = findPreference("searchPreference");
|
SearchPreference searchPreference = findPreference("searchPreference");
|
||||||
SearchConfiguration config = searchPreference.getSearchConfiguration();
|
SearchConfiguration config = searchPreference.getSearchConfiguration();
|
||||||
|
|
|
@ -1,18 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
curl -s https://raw.githubusercontent.com/AntennaPod/antennapod.github.io/master/_config.yml | yq -r ".languages[]" > ./app/src/main/assets/website-languages.txt
|
||||||
echo "Usage:\n ./makeRelease 1.2.3rc0 Directory/"
|
python ./createContributors.py
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
|
||||||
DEST=$2
|
|
||||||
VERSION_NAME=$1
|
|
||||||
|
|
||||||
rm CONTRIBUTORS
|
|
||||||
./createDevelopersList.py
|
|
||||||
./createTranslatorsList.py
|
|
||||||
|
|
||||||
./gradlew clean assemblePlayDebug assemblePlayRelease
|
|
||||||
cp app/build/outputs/apk/app-play-debug.apk $DEST/AntennaPod_${VERSION_NAME}_debug.apk
|
|
||||||
cp app/build/outputs/apk/app-play-release.apk $DEST/AntennaPod_${VERSION_NAME}_release.apk
|
|
||||||
|
|
Loading…
Reference in New Issue