[android] solves issue of status change of "search history" button on… #8087
1 changed files with 1 additions and 1 deletions
|
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
|
|||
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
|
||||
![]() 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".
![]() 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 )
![]() 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;
|
||||
![]()
```suggestion
pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> {
```
![]() 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)
|
||||
|
|
Reference in a new issue
Will it compile? Then you don't need a (Boolean) cast below.