summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/proguard.cfg7
-rw-r--r--app/src/main/assets/website-languages.txt4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java25
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java43
-rw-r--r--app/src/main/res/layout/feeditemlist_item.xml2
-rw-r--r--app/src/main/res/layout/gpodnetauth_credentials.xml137
-rw-r--r--app/src/main/res/layout/gpodnetauth_host.xml59
7 files changed, 116 insertions, 161 deletions
diff --git a/app/proguard.cfg b/app/proguard.cfg
index a70b226cd..1667bcb14 100644
--- a/app/proguard.cfg
+++ b/app/proguard.cfg
@@ -42,13 +42,6 @@
-dontwarn okhttp3.**
-dontwarn okio.**
-# greenrobot EventBus
--keepattributes *Annotation*
--keepclassmembers class * {
- @org.greenrobot.eventbus.Subscribe <methods>;
-}
--keep enum org.greenrobot.eventbus.ThreadMode { *; }
-
# android-iconify
-keep class com.joanzapata.** { *; }
diff --git a/app/src/main/assets/website-languages.txt b/app/src/main/assets/website-languages.txt
new file mode 100644
index 000000000..b52b558f9
--- /dev/null
+++ b/app/src/main/assets/website-languages.txt
@@ -0,0 +1,4 @@
+en
+fr
+nl
+it
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
index e2c5036df..7f5205db4 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/MainPreferencesFragment.java
@@ -17,6 +17,13 @@ import de.danoeh.antennapod.activity.BugReportActivity;
import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.util.IntentUtils;
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 {
@@ -106,7 +113,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
}
);
findPreference(PREF_DOCUMENTATION).setOnPreferenceClickListener(preference -> {
- IntentUtils.openInBrowser(getContext(), "https://antennapod.org/documentation/");
+ IntentUtils.openInBrowser(getContext(), getLocalizedWebsiteLink() + "/documentation/");
return true;
});
findPreference(PREF_VIEW_FORUM).setOnPreferenceClickListener(preference -> {
@@ -114,7 +121,7 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
return true;
});
findPreference(PREF_CONTRIBUTE).setOnPreferenceClickListener(preference -> {
- IntentUtils.openInBrowser(getContext(), "https://antennapod.org/contribute/");
+ IntentUtils.openInBrowser(getContext(), getLocalizedWebsiteLink() + "/contribute/");
return true;
});
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() {
SearchPreference searchPreference = findPreference("searchPreference");
SearchConfiguration config = searchPreference.getSearchConfiguration();
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java
index 358985cea..e3e069868 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java
@@ -2,7 +2,6 @@ package de.danoeh.antennapod.fragment.preferences.synchronization;
import android.app.Dialog;
import android.content.Context;
-import android.graphics.Paint;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
@@ -12,31 +11,20 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
-import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.ViewFlipper;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
-
import com.google.android.material.button.MaterialButton;
-import com.google.android.material.textfield.TextInputLayout;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.core.sync.SyncService;
+import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.sync.SynchronizationProviderViewData;
import de.danoeh.antennapod.core.sync.SynchronizationSettings;
import de.danoeh.antennapod.core.util.FileNameGenerator;
-import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService;
import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetDevice;
import io.reactivex.Completable;
@@ -44,6 +32,11 @@ import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Guides the user through the authentication process.
*/
@@ -70,7 +63,7 @@ public class GpodderAuthenticationFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
- dialog.setTitle(GpodnetService.DEFAULT_BASE_HOST);
+ dialog.setTitle(R.string.gpodnetauth_login_butLabel);
dialog.setNegativeButton(R.string.cancel_label, null);
dialog.setCancelable(false);
this.setCancelable(false);
@@ -85,23 +78,13 @@ public class GpodderAuthenticationFragment extends DialogFragment {
private void setupHostView(View view) {
final Button selectHost = view.findViewById(R.id.chooseHostButton);
- final RadioGroup serverRadioGroup = view.findViewById(R.id.serverRadioGroup);
final EditText serverUrlText = view.findViewById(R.id.serverUrlText);
-
- if (!GpodnetService.DEFAULT_BASE_HOST.equals(SynchronizationCredentials.getHosturl())) {
- serverUrlText.setText(SynchronizationCredentials.getHosturl());
- }
- final TextInputLayout serverUrlTextInput = view.findViewById(R.id.serverUrlTextInput);
- serverRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {
- serverUrlTextInput.setVisibility(checkedId == R.id.customServerRadio ? View.VISIBLE : View.GONE);
- });
selectHost.setOnClickListener(v -> {
- SynchronizationCredentials.clear(getContext());
- if (serverRadioGroup.getCheckedRadioButtonId() == R.id.customServerRadio) {
- SynchronizationCredentials.setHosturl(serverUrlText.getText().toString());
- } else {
- SynchronizationCredentials.setHosturl(GpodnetService.DEFAULT_BASE_HOST);
+ if (serverUrlText.getText().length() == 0) {
+ return;
}
+ SynchronizationCredentials.clear(getContext());
+ SynchronizationCredentials.setHosturl(serverUrlText.getText().toString());
service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
@@ -116,12 +99,8 @@ public class GpodderAuthenticationFragment extends DialogFragment {
final Button login = view.findViewById(R.id.butLogin);
final TextView txtvError = view.findViewById(R.id.credentialsError);
final ProgressBar progressBar = view.findViewById(R.id.progBarLogin);
- final TextView createAccount = view.findViewById(R.id.createAccountButton);
final TextView createAccountWarning = view.findViewById(R.id.createAccountWarning);
- createAccount.setPaintFlags(createAccount.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
- createAccount.setOnClickListener(v -> IntentUtils.openInBrowser(getContext(), "https://gpodder.net/register/"));
-
if (SynchronizationCredentials.getHosturl().startsWith("http://")) {
createAccountWarning.setVisibility(View.VISIBLE);
}
diff --git a/app/src/main/res/layout/feeditemlist_item.xml b/app/src/main/res/layout/feeditemlist_item.xml
index 675d3ee58..b6a332acc 100644
--- a/app/src/main/res/layout/feeditemlist_item.xml
+++ b/app/src/main/res/layout/feeditemlist_item.xml
@@ -117,8 +117,8 @@
android:layout_height="14sp"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
- android:src="@drawable/ic_inbox"
android:contentDescription="@string/is_inbox_label"
+ app:srcCompat="@drawable/ic_inbox"
app:tint="?attr/colorAccent" />
<ImageView
diff --git a/app/src/main/res/layout/gpodnetauth_credentials.xml b/app/src/main/res/layout/gpodnetauth_credentials.xml
index 8cf6941c9..91224744b 100644
--- a/app/src/main/res/layout/gpodnetauth_credentials.xml
+++ b/app/src/main/res/layout/gpodnetauth_credentials.xml
@@ -1,107 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_marginBottom="8dp">
-
- <ImageView
- android:layout_width="64dp"
- android:layout_height="64dp"
- app:srcCompat="@drawable/gpodder_icon"/>
-
- <TextView
- android:id="@+id/createAccountButton"
- android:layout_width="0dp"
- android:textAlignment="textEnd"
- android:layout_height="wrap_content"
- android:background="?attr/selectableItemBackground"
- android:textColor="?colorAccent"
- android:layout_weight="1"
- android:layout_gravity="center_vertical|end"
- android:text="@string/create_account"/>
- </LinearLayout>
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
<TextView
- android:id="@+id/createAccountWarning"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/gpodnetauth_encryption_warning"
- android:textColor="#F44336"
- android:textStyle="bold"
- android:visibility="invisible" />
+ android:id="@+id/createAccountWarning"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/gpodnetauth_encryption_warning"
+ android:textColor="#F44336"
+ android:textStyle="bold"
+ android:visibility="invisible" />
<com.google.android.material.textfield.TextInputLayout
- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
- android:id="@+id/etxtUsername"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/username_label"
- android:lines="1"
- android:imeOptions="actionNext|flagNoFullscreen"/>
+ android:id="@+id/etxtUsername"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/username_label"
+ android:lines="1"
+ android:imeOptions="actionNext|flagNoFullscreen" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
- android:id="@+id/etxtPassword"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/password_label"
- android:inputType="textPassword"
- android:lines="1"
- android:imeOptions="actionNext|flagNoFullscreen"
- android:imeActionLabel="@string/gpodnetauth_login_butLabel"/>
+ android:id="@+id/etxtPassword"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/password_label"
+ android:inputType="textPassword"
+ android:lines="1"
+ android:imeOptions="actionNext|flagNoFullscreen"
+ android:imeActionLabel="@string/gpodnetauth_login_butLabel" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="end|center_vertical">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="end|center_vertical">
<TextView
- android:id="@+id/credentialsError"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:textColor="@color/download_failed_red"
- android:textSize="@dimen/text_size_small"
- android:maxLines="2"
- android:ellipsize="end"
- android:gravity="center"
- tools:text="Error message"
- tools:background="@android:color/holo_green_dark"/>
+ android:id="@+id/credentialsError"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/download_failed_red"
+ android:textSize="@dimen/text_size_small"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:gravity="center"
+ tools:text="Error message"
+ tools:background="@android:color/holo_green_dark" />
<ProgressBar
- android:id="@+id/progBarLogin"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="gone"
- android:layout_gravity="right"/>
+ android:id="@+id/progBarLogin"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ android:layout_gravity="right" />
<Button
- android:id="@+id/butLogin"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/gpodnetauth_login_butLabel"/>
+ android:id="@+id/butLogin"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/gpodnetauth_login_butLabel" />
+
</LinearLayout>
</LinearLayout>
diff --git a/app/src/main/res/layout/gpodnetauth_host.xml b/app/src/main/res/layout/gpodnetauth_host.xml
index 52c5fdb5d..bcee9b880 100644
--- a/app/src/main/res/layout/gpodnetauth_host.xml
+++ b/app/src/main/res/layout/gpodnetauth_host.xml
@@ -1,50 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <RadioGroup
- android:id="@+id/serverRadioGroup"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <RadioButton
- android:id="@+id/officialServerRadio"
- android:text="@string/gpodnetauth_server_official"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:checked="true"/>
- <RadioButton
- android:id="@+id/customServerRadio"
- android:text="@string/gpodnetauth_server_custom"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
- </RadioGroup>
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
- android:id="@+id/serverUrlTextInput"
- style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
- android:visibility="gone"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
- android:id="@+id/serverUrlText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/gpodnetauth_host"
- android:inputType="textNoSuggestions"
- android:lines="1"
- android:imeOptions="actionNext|flagNoFullscreen" />
+ android:id="@+id/serverUrlText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/gpodnetauth_host"
+ android:inputType="textNoSuggestions"
+ android:lines="1"
+ android:imeOptions="actionNext|flagNoFullscreen" />
</com.google.android.material.textfield.TextInputLayout>
<Button
- android:id="@+id/chooseHostButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right|end"
- android:text="@string/gpodnetauth_select_server"/>
+ android:id="@+id/chooseHostButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|end"
+ android:text="@string/gpodnetauth_select_server" />
-</LinearLayout> \ No newline at end of file
+</LinearLayout>