[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
kavikhalique commented 2024-05-05 12:15:22 +00:00 (Migrated from github.com)

Fixes #8078

Solves the issue of showing changes after even taps on search History button inside settings.

Fixes #8078 Solves the issue of showing changes after even taps on search History button inside settings.
biodranik (Migrated from github.com) reviewed 2024-05-05 12:24:39 +00:00
biodranik (Migrated from github.com) commented 2024-05-05 12:24:39 +00:00

Will this work?

    pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> {
      if (newValue != Config.isSearchHistoryEnabled())
Will this work? ``` pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> { if (newValue != Config.isSearchHistoryEnabled()) ```
kavikhalique (Migrated from github.com) reviewed 2024-05-05 12:26:31 +00:00
kavikhalique (Migrated from github.com) commented 2024-05-05 12:26:31 +00:00

Yes ofcourse but i did that to keep it in proper format

Yes ofcourse but i did that to keep it in proper format
biodranik (Migrated from github.com) reviewed 2024-05-05 12:27:39 +00:00
biodranik (Migrated from github.com) commented 2024-05-05 12:27:39 +00:00

What is "proper format"?

What is "proper format"?
kavikhalique (Migrated from github.com) reviewed 2024-05-05 12:32:31 +00:00
kavikhalique (Migrated from github.com) commented 2024-05-05 12:32:31 +00:00

Like declaring a variable first storing value into that and then using it for further :)

Like declaring a variable first storing value into that and then using it for further :)
biodranik (Migrated from github.com) reviewed 2024-05-05 13:12:22 +00:00
biodranik (Migrated from github.com) commented 2024-05-05 13:12:22 +00:00

So you likely meant "a more complex code to read", right?

So you likely meant "a more complex code to read", right?
kavikhalique (Migrated from github.com) reviewed 2024-05-05 14:10:02 +00:00
kavikhalique (Migrated from github.com) commented 2024-05-05 14:10:01 +00:00

Yes, but easy to understand.
But since you suggested so i have changed the code accordingly : )

Yes, but easy to understand. But since you suggested so i have changed the code accordingly : )
biodranik (Migrated from github.com) reviewed 2024-05-05 14:41:32 +00:00
biodranik (Migrated from github.com) commented 2024-05-05 14:41:31 +00:00

My suggestion was one line shorter )

My suggestion was one line shorter )
kavikhalique (Migrated from github.com) reviewed 2024-05-05 21:35:40 +00:00
kavikhalique (Migrated from github.com) commented 2024-05-05 21:35:40 +00:00

Yes i did that :)

Yes i did that :)
biodranik (Migrated from github.com) reviewed 2024-05-05 22:31:03 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
pref.setOnPreferenceChangeListener((preference, newValue) -> {
boolean newVal = (Boolean) newValue;
biodranik (Migrated from github.com) commented 2024-05-05 22:31:03 +00:00
    pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> {
```suggestion pref.setOnPreferenceChangeListener((preference, Boolean newValue) -> { ```
kavikhalique (Migrated from github.com) reviewed 2024-05-05 22:38:55 +00:00
kavikhalique (Migrated from github.com) commented 2024-05-05 22:38:54 +00:00

My suggestion was one line shorter )

I missed that another line that time. Since it was pre written code so i pre assumed that i will not be asked to delete the pre written codes : )

> My suggestion was one line shorter ) I missed that another line that time. Since it was pre written code so i pre assumed that i will not be asked to delete the pre written codes : )
kavikhalique (Migrated from github.com) reviewed 2024-05-05 22:58:40 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
pref.setOnPreferenceChangeListener((preference, newValue) -> {
boolean newVal = (Boolean) newValue;
kavikhalique (Migrated from github.com) commented 2024-05-05 22:58:40 +00:00

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.
biodranik (Migrated from github.com) reviewed 2024-05-06 12:20:49 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
biodranik (Migrated from github.com) commented 2024-05-06 12:20:49 +00:00
    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 (Migrated from github.com) reviewed 2024-05-06 21:17:47 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
kavikhalique (Migrated from github.com) commented 2024-05-06 21:17:47 +00:00

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 (Migrated from github.com) approved these changes 2024-05-06 21:46:34 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
biodranik (Migrated from github.com) commented 2024-05-06 21:44:44 +00:00

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 (Migrated from github.com) reviewed 2024-05-06 21:58:13 +00:00
@ -258,7 +258,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment
((TwoStatePreference) pref).setChecked(isHistoryEnabled);
kavikhalique (Migrated from github.com) commented 2024-05-06 21:58:13 +00:00

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

i reverted the last commit. Please have a look once again : )
biodranik (Migrated from github.com) approved these changes 2024-05-06 21:59:17 +00:00
biodranik (Migrated from github.com) left a comment

Thanks! It is always inspiring to see how a one-line change fixes some bug or issue )

Thanks! It is always inspiring to see how a one-line change fixes some bug or issue )
This repo is archived. You cannot comment on pull requests.
No reviewers
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#8087
No description provided.