Skip to content

Commit

Permalink
fix(history): clean duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCShou committed Mar 30, 2024
1 parent 50cc3d2 commit cc05e4e
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions app/src/main/java/com/zcshou/gogogo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1099,20 +1099,12 @@ private void doGoLocation(View v) {
/*============================== 历史记录 相关 ==============================*/
private void initStoreHistory() {
try {
long expirationTime = System.currentTimeMillis() / 1000 -
Long.parseLong(getResources().getString(R.string.history_expiration)) * 24 * 60 * 60;
// 定位历史
DataBaseHistoryLocation dbLocation = new DataBaseHistoryLocation(getApplicationContext());
mLocationHistoryDB = dbLocation.getWritableDatabase();
mLocationHistoryDB.delete(DataBaseHistoryLocation.TABLE_NAME,
DataBaseHistoryLocation.DB_COLUMN_TIMESTAMP + " < ?",
new String[] {Long.toString(expirationTime)});
// 搜索历史
DataBaseHistorySearch dbHistory = new DataBaseHistorySearch(getApplicationContext());
mSearchHistoryDB = dbHistory.getWritableDatabase();
mSearchHistoryDB.delete(DataBaseHistorySearch.TABLE_NAME,
DataBaseHistorySearch.DB_COLUMN_TIMESTAMP + " < ?",
new String[] {Long.toString(expirationTime)});
} catch (Exception e) {
XLog.e("ERROR: sqlite init error");
}
Expand Down

0 comments on commit cc05e4e

Please sign in to comment.