[android] solves issue of status change of "search history" button on… #8087

Merged
kavikhalique merged 4 commits from search-history-toggle-issue into master 2024-05-06 22:00:03 +00:00

View file

@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
biodranik commented 2024-05-06 12:20:49 +00:00 (Migrated from github.com)
Review
    pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> {

Will it compile? Then you don't need a (Boolean) cast below.

```suggestion pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> { ``` Will it compile? Then you don't need a (Boolean) cast below.
kavikhalique commented 2024-05-06 21:17:47 +00:00 (Migrated from github.com)
Review

No we cannot do that because its required data type is of type "Object".

No we cannot do that because its required data type is of type "Object".
biodranik commented 2024-05-06 21:44:44 +00:00 (Migrated from github.com)
Review

I see, poor Java... Then your solution with an intermediate casted variable is cleaner, you were right )

I see, poor Java... Then your solution with an intermediate casted variable is cleaner, you were right )
kavikhalique commented 2024-05-06 21:58:13 +00:00 (Migrated from github.com)
Review

i reverted the last commit. Please have a look once again : )

i reverted the last commit. Please have a look once again : )
pref.setOnPreferenceChangeListener((preference, newValue) -> {
boolean newVal = (Boolean) newValue;
biodranik commented 2024-05-05 22:31:03 +00:00 (Migrated from github.com)
Review
    pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> {
```suggestion pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> { ```
kavikhalique commented 2024-05-05 22:58:40 +00:00 (Migrated from github.com)
Review

If we remove (newVal) variable then we need to refactor it everywhere because it has been used later also and everywhere we need to type cast it to boolean will it be ok?

I am committing it please review it.

If we remove (newVal) variable then we need to refactor it everywhere because it has been used later also and everywhere we need to type cast it to boolean will it be ok? I am committing it please review it.
if (newVal != isHistoryEnabled)
if (newVal != Config.isSearchHistoryEnabled())
{
Config.setSearchHistoryEnabled(newVal);
if (newVal)