forked from upstream-mirrors/OpenTracks
Minor UI improvements.
- close contextual menu after an item is selected - collapse the search widget after a search request is sent - show keyboard by default for the editors - in the search list, if edit or delete is selected in the contextual menu, close the search list since its content will get changed. - enable QueryRefinement in search widget - do not call super.onNewIntent - update search.xml to include imeOptions, queryAfterZeroResults, and set searchSuggestionThreshold to 1.
This commit is contained in:
@@ -190,7 +190,6 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
handleIntent(intent);
|
||||
}
|
||||
@@ -270,6 +269,8 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
||||
}
|
||||
startActivity(intent);
|
||||
// Close the search result since its content can change after edit.
|
||||
finish();
|
||||
return true;
|
||||
case R.id.list_context_menu_delete:
|
||||
if (markerId != null) {
|
||||
|
||||
@@ -161,7 +161,6 @@ public class TrackDetailActivity extends AbstractMyTracksActivity
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
handleIntent(intent);
|
||||
}
|
||||
|
||||
+2
@@ -61,6 +61,8 @@ public class DeleteOneMarkerDialogFragment extends DialogFragment {
|
||||
Intent intent = IntentUtils.newIntent(getActivity(), MarkerListActivity.class)
|
||||
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
||||
startActivity(intent);
|
||||
// Close the activity since its content can change after delete.
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+2
@@ -57,6 +57,8 @@ public class DeleteOneTrackDialogFragment extends DialogFragment {
|
||||
.deleteTrack(getArguments().getLong(KEY_TRACK_ID));
|
||||
Intent intent = IntentUtils.newIntent(getActivity(), TrackListActivity.class);
|
||||
startActivity(intent);
|
||||
// Close the activity since its content can change after delete.
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class Api11Adapter extends Api10Adapter {
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
mode.finish();
|
||||
return contextualActionModeCallback.onClick(item.getItemId(), position, id);
|
||||
}
|
||||
});
|
||||
@@ -100,10 +101,35 @@ public class Api11Adapter extends Api10Adapter {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void configureSearchWidget(Activity activity, MenuItem menuItem) {
|
||||
public void configureSearchWidget(Activity activity, final MenuItem menuItem) {
|
||||
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) menuItem.getActionView();
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName()));
|
||||
searchView.setQueryRefinementEnabled(true);
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
menuItem.collapseActionView();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
||||
@Override
|
||||
public boolean onSuggestionSelect(int position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSuggestionClick(int position) {
|
||||
menuItem.collapseActionView();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user