Update search functionality

This commit is contained in:
Victor Shcherb 2015-01-19 23:30:23 +01:00
parent 4d9bd5f23f
commit d1ec5c5f7a
4 changed files with 21 additions and 69 deletions

View file

@ -6,15 +6,20 @@
android:background="@drawable/bg_cardui"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/search_for"
style="@style/DashboardSubHeader"
android:layout_width="wrap_content"
android:layout_height="@dimen/dashHeaderHeight"
android:text="@string/search_for" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/dashHeaderHeight" >
<TextView
android:id="@+id/search_for"
style="@style/DashboardSubHeader"
android:layout_width="wrap_content"
android:text="@string/search_for" />
<Button
android:id="@+id/recents"
style="@style/DashboardGeneralButton"
android:text="@string/recents" />
</LinearLayout>
<View
@ -56,43 +61,4 @@
android:text="@string/coordinates" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/dashSearchBtnHeight"
android:orientation="horizontal" >
<Button
android:id="@+id/fav_btn"
style="@style/DashboardSearchButton"
android:drawableTop="@drawable/ic_action_fav2"
android:text="@string/my_favorites" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/dashboard_divider" />
<Button
android:id="@+id/history"
style="@style/DashboardSearchButton"
android:drawableTop="@drawable/ic_action_history2"
android:text="@string/history" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/dashboard_divider" />
<Button
android:id="@+id/transport"
style="@style/DashboardSearchButton"
android:drawableTop="@drawable/ic_action_bus2"
android:text="@string/rendering_category_transport" />
</LinearLayout>
</LinearLayout>

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="recents">Recents</string>
<string name="navigation_over_track">Start navigation over track?</string>
<string name="avoid_roads_msg">You can change route by selecting roads to avoid</string>
<string name="rendering_value__name">Default</string>

View file

@ -131,10 +131,10 @@ public class SearchActivity extends ActionBarActivity implements OsmAndLocationL
TabSpec historyTab = tabHost.newTabSpec(SEARCH_HISTORY).setIndicator(
getTabIndicator(tabHost, R.drawable.tab_search_history_icon, R.string.history));
mTabsAdapter.addTab(historyTab, getFragment(HISTORY_TAB_INDEX), null);
TabSpec transportTab = tabHost.newTabSpec(SEARCH_TRANSPORT).setIndicator(
getTabIndicator(tabHost, R.drawable.tab_search_transport_icon, R.string.transport));
mTabsAdapter.addTab(transportTab, getFragment(TRANSPORT_TAB_INDEX), null);
tabHost.setCurrentTab(tab);
// TabSpec transportTab = tabHost.newTabSpec(SEARCH_TRANSPORT).setIndicator(
// getTabIndicator(tabHost, R.drawable.tab_search_transport_icon, R.string.transport));
// mTabsAdapter.addTab(transportTab, getFragment(TRANSPORT_TAB_INDEX), null);
tabHost.setCurrentTab(Math.min(tab , HISTORY_TAB_INDEX));
} else {
setContentView(R.layout.search_activity_single);
Class<?> cl = getFragment(tab);

View file

@ -38,7 +38,7 @@ public class DashSearchFragment extends DashBaseFragment {
protected void searchActivity(final Activity activity, final OsmAndAppCustomization appCustomization, int tab) {
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
search.putExtra(SearchActivity.SHOW_ONLY_ONE_TAB, true);
//search.putExtra(SearchActivity.SHOW_ONLY_ONE_TAB, true);
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
getMyApplication().getSettings().SEARCH_TAB.set(tab);
activity.startActivity(search);
@ -69,26 +69,11 @@ public class DashSearchFragment extends DashBaseFragment {
searchActivity(activity, appCustomization, SearchActivity.LOCATION_TAB_INDEX);
}
});
(view.findViewById(R.id.fav_btn)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
searchActivity(activity, appCustomization, SearchActivity.FAVORITES_TAB_INDEX);
}
});
(view.findViewById(R.id.history)).setOnClickListener(new View.OnClickListener() {
(view.findViewById(R.id.recents)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
searchActivity(activity, appCustomization, SearchActivity.HISTORY_TAB_INDEX);
}
});
(view.findViewById(R.id.transport)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
searchActivity(activity, appCustomization, SearchActivity.TRANSPORT_TAB_INDEX);
}
});
}
}