Skip to content

Commit

Permalink
refactor(joystick):refactor joystick code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCShou committed Oct 15, 2022
1 parent 8ac1e95 commit 311b0f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/com/zcshou/joystick/JoyStick.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ private void initJoyStickMapView() {
mSuggestionSearch = SuggestionSearch.newInstance();
mSuggestionSearch.setOnGetSuggestionResultListener(suggestionResult -> {
if (suggestionResult == null || suggestionResult.getAllSuggestions() == null) {
GoUtils.DisplayToast(mContext,"没有找到检索结果");
GoUtils.DisplayToast(mContext,getResources().getString(R.string.app_search_null));
} else {
List<Map<String, Object>> data = new ArrayList<>();
int retCnt = suggestionResult.getAllSuggestions().size();
Expand Down Expand Up @@ -439,7 +439,7 @@ public boolean onQueryTextChange(String newText) {
.city(MainActivity.mCurrentCity)
);
} catch (Exception e) {
GoUtils.DisplayToast(mContext,"搜索失败,请检查网络连接");
GoUtils.DisplayToast(mContext,getResources().getString(R.string.app_error_search));
e.printStackTrace();
}
}
Expand All @@ -466,7 +466,7 @@ public boolean onQueryTextChange(String newText) {

resetBaiduMap();

GoUtils.DisplayToast(mContext, "位置已传送");
GoUtils.DisplayToast(mContext, getResources().getString(R.string.app_location_ok));
});
btnGo.setColorFilter(getResources().getColor(R.color.colorAccent, mContext.getTheme()));

Expand Down Expand Up @@ -614,7 +614,7 @@ public boolean onQueryTextChange(String newText) {// 当搜索内容改变时触
if (searchRet.size() > 0) {
showHistory(searchRet);
} else {
GoUtils.DisplayToast(mContext,"没有找到检索结果");
GoUtils.DisplayToast(mContext, getResources().getString(R.string.app_search_null));
showHistory(mAllRecord);
}
}
Expand Down Expand Up @@ -653,7 +653,7 @@ public boolean onQueryTextChange(String newText) {// 当搜索内容改变时触
String bdLatitude = bdLatLngStr[1].substring(bdLatLngStr[1].indexOf(':') + 1);
mCurMapLngLat = new LatLng(Double.parseDouble(bdLatitude), Double.parseDouble(bdLongitude));

GoUtils.DisplayToast(mContext, "位置已传送");
GoUtils.DisplayToast(mContext, getResources().getString(R.string.app_location_ok));
});

fetchAllRecord();
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<string name="app_error_network">网络不可用,请检查网络连接</string>
<string name="app_error_permission">权限不足,请授予相关权限</string>
<string name="app_error_input">输入有误,请检查输入是否合法</string>
<string name="app_error_search">查找失败,请检查网络或定位</string>
<string name="app_search_null">没有匹配结果,请重新搜索</string>
<string name="app_location_ok">位置已传送</string>

<!-- 欢迎页 -->
<string name="welcome_btn_txt">进入应用</string>
Expand Down

0 comments on commit 311b0f7

Please sign in to comment.