Last active
August 29, 2015 14:10
-
-
Save HanCheng/32e4612a267d1f876dba to your computer and use it in GitHub Desktop.
Update for the filter message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. So in order to save a copy of flightSearch in memory, one way to do that is create a copy constructor in FlightSearch.java, just copy all the private member variable, like: | |
public FlightSearch(FlightSearch flightSearch) { | |
this.mOriginAirport = flightSearch.getOriginAirport(); | |
this.mDestinationAirport = flightSearch.getDestinationAirport(); | |
this.mFlightSearchMode = flightSearch.getFlightSearchMode(); | |
this.mBookingClass = .... | |
this.mPrefersNonStop = ... | |
this.mOutboundDate = .. | |
this.mReturnDate = .. | |
this.mNumberOfTravelers = ... | |
this.segments = .. | |
} | |
public FlightSearch() {} | |
2. So in FlightSearchFormResult.java, in method updateFlightSearchButton() | |
add: | |
if (!mOldFlightSearch.isValid() || mOldFlightSearch.equals(mFlightSearch)) { | |
mOldFlightSearch = new FlightSearch(mFlightSearch); | |
} | |
so we can update the old value by copying the value. | |
3. Then we can use oldFlightSearch.equals(newFlightSearch) to decide to reset filter. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment