diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-07-22 12:12:21 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-07-22 12:12:21 +0000 |
commit | 9bb5bb99381fc40cbbc60b97a5759683de72bdca (patch) | |
tree | 47a8796d20fe91117249f7b2d9c9ccd5ed4c218c /app/src/main/java/ml | |
parent | 0a5b5cb2094e0f56c35a39fb9d0af63b6063b162 (diff) | |
download | infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar.gz infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar.bz2 infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar.lz infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar.xz infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.tar.zst infinity-for-reddit-9bb5bb99381fc40cbbc60b97a5759683de72bdca.zip |
Hide keyboard when clicking cancel button in dialogs for going to subreddit and user.
Diffstat (limited to 'app/src/main/java/ml')
4 files changed, 40 insertions, 8 deletions
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 7468655b..0969478e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -1477,7 +1477,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); startActivity(subredditIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); @@ -1518,7 +1522,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); startActivity(userIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); 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 d1df8ca5..f2096b97 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -649,7 +649,11 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); startActivity(subredditIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); @@ -690,7 +694,11 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); startActivity(userIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); 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 3926062d..04d34ab9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -1441,7 +1441,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); startActivity(subredditIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); @@ -1482,7 +1486,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); startActivity(userIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); 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 da2216e4..d6fbb3d4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -1247,7 +1247,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); startActivity(subredditIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); @@ -1288,7 +1292,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); startActivity(userIntent); }) - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) .setOnDismissListener(dialogInterface -> { if (imm != null) { imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); |