Last active
August 29, 2015 14:09
-
-
Save HanCheng/5eddf854c0865f2a1b70 to your computer and use it in GitHub Desktop.
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. created method in FlightSearchResultsActivity called: | |
private boolean isFilterApplied() {} | |
private void updateFilterMessage() { | |
if (isFilterApplied() && mSearchHasCompleted) { | |
Set<ItineraryFilter> itineraryFilters = ItinerarySet.getInstance().itineraryFilters(); | |
final String sb = getSelectedFiltersString(this, itineraryFilters); | |
mFilterMessagePanel.setVisibility(VISIBLE); | |
mFilterMessagePanel.post(new Runnable() { | |
@Override | |
public void run() { | |
mFilterMessage.setText("Filters Applied: " + sb); | |
} | |
}); | |
} else { | |
mFilterMessagePanel.setVisibility(GONE); | |
} | |
} | |
2. set this updateFilterMessage() into onResume. | |
public void onResume() { | |
super.onResume(); | |
mBus.register(this); | |
// KLT: This is set true so list updates after coming back from filter screen. | |
if (mSearchHasCompleted) { | |
updateItinerarySummaryText(ItinerarySet.getInstance()); | |
updateFilterMessage(); | |
} else if (mPartialresults != null) { | |
updateItinerarySummaryText(mPartialresults); | |
} | |
if (ItinerarySet.getInstance() != null && ItinerarySet.getInstance().isComplete()) { | |
onSearchComplete(ItinerarySet.getInstance()); | |
} | |
mItinerarySet = ItinerarySet.getInstance(); | |
updateFilterMessage(); | |
} | |
3. add layout info in seach_result_header.xml | |
<RelativeLayout | |
android:id="@+id/filter_summary_message" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginLeft="@dimen/activity_horizontal_margin" | |
android:layout_marginRight="@dimen/activity_horizontal_margin" | |
android:layout_marginTop="2dp" | |
android:layout_marginBottom="5dp" | |
android:visibility="gone"> | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentLeft="true" | |
android:layout_alignParentStart="true" | |
android:background="@drawable/itinerary_summary_highlighter" | |
android:textColor="@color/tripadvisor_list_text_disabled_gray" | |
android:textSize="13sp" | |
custom:fontType="regular"/> | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
android:id="@+id/applied_filters_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:paddingEnd="4dip" | |
android:paddingLeft="4dip" | |
android:paddingRight="4dip" | |
android:paddingStart="4dip" | |
android:textColor="@color/tripadvisor_list_text_disabled_gray" | |
android:textSize="13sp" | |
custom:fontType="regular"/> | |
</RelativeLayout> | |
4. for ticket : https://jira.tripadvisor.com/browse/FLT-1691 | |
I found that the method getSelectedFiltersString() in Utils is not right, so I am thinking is to change that when filter class is null && | |
the size in each of filters is 0, means we do not apply any filter. | |
So in Utils.java, I create the filter reference for each filters. and get these reference value from mUserItineraryFilters in | |
ItinerarySet.java. So, I can iterate all the museritineraryFilter | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment