refactor(history):refactor welcome code

This commit is contained in:
ZCShou 2022-10-15 14:31:25 +08:00
parent e0b684e7c4
commit 8ac1e95d7f
No known key found for this signature in database
GPG Key ID: 40F856243C184EAB
3 changed files with 21 additions and 18 deletions

View File

@ -94,7 +94,7 @@ public class HistoryActivity extends BaseActivity {
.setPositiveButton("确定",
(dialog, which) -> {
if (deleteRecord(-1)) {
GoUtils.DisplayToast(this,"删除成功!");
GoUtils.DisplayToast(this, getResources().getString(R.string.history_delete_ok));
updateRecordList();
}
})
@ -164,7 +164,7 @@ public class HistoryActivity extends BaseActivity {
}
private void recordArchive() {
final double limits = Double.parseDouble(sharedPreferences.getString("setting_pos_history", getResources().getString(R.string.setting_pos_history_default)));
final double limits = Double.parseDouble(sharedPreferences.getString("setting_pos_history", getResources().getString(R.string.history_expiration)));
final long weekSecond = (long) (limits * 24 * 60 * 60);
try {
@ -233,7 +233,7 @@ public class HistoryActivity extends BaseActivity {
new int[]{R.id.LocationID, R.id.LocationText, R.id.TimeText, R.id.WGSLatLngText, R.id.BDLatLngText});
mRecordListView.setAdapter(simAdapt);
} else {
GoUtils.DisplayToast(HistoryActivity.this,"未搜索到指定内容");
GoUtils.DisplayToast(HistoryActivity.this, getResources().getString(R.string.history_error_search));
SimpleAdapter simAdapt = new SimpleAdapter(
HistoryActivity.this.getBaseContext(),
mAllRecord,
@ -272,7 +272,7 @@ public class HistoryActivity extends BaseActivity {
wgs84Latitude = latLngStr2[1].substring(latLngStr2[1].indexOf(':') + 1);
if (!MainActivity.showLocation(bd09Longitude, bd09Latitude, wgs84Longitude, wgs84Latitude)) {
GoUtils.DisplayToast(this, "定位失败,请手动选取定位点");
GoUtils.DisplayToast(this, getResources().getString(R.string.history_error_location));
}
this.finish();
});
@ -287,7 +287,7 @@ public class HistoryActivity extends BaseActivity {
boolean deleteRet = deleteRecord(Integer.parseInt(locID));
if (deleteRet) {
GoUtils.DisplayToast(this,"删除成功!");
GoUtils.DisplayToast(this, getResources().getString(R.string.history_delete_ok));
updateRecordList();
}
})

View File

@ -41,12 +41,18 @@
<string name="setting_group_log">记录</string>
<string name="setting_log_off">关闭日志</string>
<string name="setting_pos_history">历史记录有效期(天)</string>
<string name="setting_pos_history_default">7</string>
<string name="setting_group_about">关于</string>
<string name="setting_version">版本号</string>
<string name="setting_author">开发者</string>
<string name="setting_group_sys">系统</string>
<!-- 历史记录页面 -->
<string name="history_idle">暂无历史记录</string>
<string name="history_delete_ok">删除成功!</string>
<string name="history_expiration">7</string>
<string name="history_error_location">定位失败,请手动选取定位点</string>
<string name="history_error_search">未搜索到指定内容</string>
<!-- 通知栏 -->
<string name="note_show">显示摇杆</string>
<string name="note_hide">隐藏摇杆</string>
@ -61,16 +67,6 @@
<string name="error_gps">位置检索失败,请检查 GPS 是否开启</string>
<string name="error_network">搜索失败,请检查网络连接</string>
<!-- 更新 -->
<string name="update_title">新版本可用</string>
<string name="update_download">立即下载</string>
<string name="update_ignore">忽略一次</string>
<string name="update_time">更新时间:</string>
<string name="update_commit">提交信息:</string>
<!-- 历史记录页面 -->
<string name="history_idle">暂无历史记录</string>
<!-- 导航页 -->
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
@ -90,6 +86,13 @@
<string name="safecode">32:2F:E6:05:6C:2F:11:6D:CD:ED:AC:FF:23:02:5A:29:68:FD:45:D2;com.zcshou.gogogo</string>
<string name="ak">fb7YwlKY3ntx8hBDGMGLqX2FhlPkDMvv</string>
<!-- 更新 -->
<string name="update_title">新版本可用</string>
<string name="update_download">立即下载</string>
<string name="update_ignore">忽略一次</string>
<string name="update_time">更新时间:</string>
<string name="update_commit">提交信息:</string>
<!-- 摇杆 -->
<string name="joystick_map_tips">搜索或点击地图位置</string>
<string name="joystick_history_tips">搜索或点击历史位置</string>

View File

@ -48,8 +48,8 @@
<EditTextPreference
app:key="setting_pos_history"
app:title="@string/setting_pos_history"
app:defaultValue="@string/setting_pos_history_default"
app:summary="@string/setting_pos_history_default"
app:defaultValue="@string/history_expiration"
app:summary="@string/history_expiration"
app:iconSpaceReserved="false"/>
</PreferenceCategory>