aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKurian Vithayathil <kvithayathil@users.noreply.github.com>2022-09-21 05:56:26 +0000
committerGitHub <noreply@github.com>2022-09-21 05:56:26 +0000
commit0a182209982c8c5ada1869574634ee0cad48d8a8 (patch)
tree2d034c4cc375d12c832c9029b52a2e8473d41687 /app
parent1108d41eed544d68fa85daca5fdba564753e34ee (diff)
downloadinfinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.gz
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.bz2
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.lz
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.xz
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.zst
infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.zip
Fix 'Suggested Title' bug (#1120)
- Fixed issue where a post's suggested titles would fail to generate Co-authored-by: Kurian Vithayathil <no.reply@github.com>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
index 3db21105..562b55db 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
@@ -9,6 +9,7 @@ import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -351,10 +352,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
suggestTitleButton.setOnClickListener(view -> {
Toast.makeText(this, R.string.please_wait, Toast.LENGTH_SHORT).show();
String url = linkEditText.getText().toString().trim();
- if (!url.startsWith("https://") || !url.startsWith("http://")) {
+ if (!URLUtil.isHttpsUrl(url) && !URLUtil.isHttpUrl(url)) {
url = "https://" + url;
}
- new Retrofit.Builder()
+ mRetrofit.newBuilder()
.baseUrl("http://localhost/")
.addConverterFactory(ScalarsConverterFactory.create())
.build().create(TitleSuggestion.class).getHtml(url).enqueue(new Callback<String>() {