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:
@@ -158,8 +158,7 @@ limitations under the License.
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.google.android.apps.mytracks.MarkerEditActivity"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
android:name="com.google.android.apps.mytracks.MarkerEditActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
||||
<meta-data
|
||||
@@ -186,8 +185,7 @@ limitations under the License.
|
||||
android:name="com.google.android.apps.mytracks.SettingsActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" />
|
||||
<activity
|
||||
android:name="com.google.android.apps.mytracks.TrackEditActivity"
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
android:name="com.google.android.apps.mytracks.TrackEditActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.TrackListActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:hint="@string/search_hint"
|
||||
android:includeInGlobalSearch="true"
|
||||
android:label="@string/my_tracks_app_name"
|
||||
android:searchSettingsDescription="@string/search_global_description"
|
||||
android:voicePromptText="@string/search_voice_prompt"
|
||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
|
||||
android:searchSuggestAuthority="com.google.android.maps.mytracks.search"
|
||||
android:searchSuggestThreshold="2"
|
||||
android:searchSuggestSelection=" ? " />
|
||||
android:hint="@string/search_hint"
|
||||
android:imeOptions="actionSearch"
|
||||
android:includeInGlobalSearch="true"
|
||||
android:label="@string/my_tracks_app_name"
|
||||
android:queryAfterZeroResults="true"
|
||||
android:searchSettingsDescription="@string/search_global_description"
|
||||
android:searchSuggestAuthority="com.google.android.maps.mytracks.search"
|
||||
android:searchSuggestSelection=" ? "
|
||||
android:searchSuggestThreshold="1"
|
||||
android:voicePromptText="@string/search_voice_prompt"
|
||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" />
|
||||
|
||||
@@ -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