aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2021-06-22 05:17:50 +0000
committerGitHub <noreply@github.com>2021-06-22 05:17:50 +0000
commit94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e (patch)
tree61b8eaac123f0b2b593facb062e19365cca9b651 /app/src/main/java/ml
parent11ec08c12fbbf20a52dae50359fa520c29d66367 (diff)
parentcfe7ccbf59f6df0f778a8c6fe18218ea80b626e4 (diff)
downloadinfinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar.gz
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar.bz2
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar.lz
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar.xz
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.tar.zst
infinity-for-reddit-94b5c238fbed2c8a4a2ebef41f5f5821d1c0c40e.zip
Merge pull request #376 from Tijs-B/master
Add editor done action to dialog_go_to_thing_edit_text
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java25
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java25
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java23
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java25
5 files changed, 111 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
index 78fdc00f..52ff2e14 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
@@ -12,6 +12,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
@@ -177,6 +178,18 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
+ pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
+ startActivity(pmIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.choose_a_user)
.setView(rootView)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
index 8cd31bd6..bcb42023 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -16,6 +16,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -1377,6 +1378,18 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
+ subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
+ startActivity(subredditIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
.setView(rootView)
@@ -1406,6 +1419,18 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
+ userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
+ startActivity(userIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
.setView(rootView)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
index 5ca8a554..d6a8b515 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
@@ -11,6 +11,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
@@ -548,6 +549,18 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
+ subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
+ startActivity(subredditIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
.setView(rootView)
@@ -577,6 +590,18 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
+ userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
+ startActivity(userIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
.setView(rootView)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
index 1b855654..17725662 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -14,6 +14,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -1338,6 +1339,18 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
+ subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
+ startActivity(subredditIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
.setView(rootView)
@@ -1367,6 +1380,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
+ userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
+ startActivity(userIntent);
+ }
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
.setView(rootView)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
index a93ba9fc..2106627c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
@@ -17,6 +17,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -1149,6 +1150,18 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class);
+ subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString());
+ startActivity(subredditIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
.setView(rootView)
@@ -1178,6 +1191,18 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
+ thingEditText.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if (i == EditorInfo.IME_ACTION_DONE) {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent userIntent = new Intent(this, ViewUserDetailActivity.class);
+ userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString());
+ startActivity(userIntent);
+ return true;
+ }
+ return false;
+ });
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
.setView(rootView)