代码优化

This commit is contained in:
ZCShou 2021-06-12 10:58:48 +08:00
parent 8210787e5f
commit b2fb2e75a8
5 changed files with 11 additions and 11 deletions

View File

@ -19,8 +19,8 @@ public class DataBaseHistorySearch extends SQLiteOpenHelper {
private static final int DB_VERSION = 1;
private static final String DB_NAME = "HistorySearch.db";
private static final String CREATE_TABLE = "create table if not exists " + TABLE_NAME +
" (DB_COLUMN_ID INTEGER PRIMARY KEY AUTOINCREMENT, DB_COLUMN_KEY TEXT NOT NULL" +
", DB_COLUMN_DESCRIPTION TEXT, DB_COLUMN_TIMESTAMP BIGINT NOT NULL, DB_COLUMN_IS_LOCATION INTEGER NOT NULL, " +
" (DB_COLUMN_ID INTEGER PRIMARY KEY AUTOINCREMENT, DB_COLUMN_KEY TEXT NOT NULL, " +
"DB_COLUMN_DESCRIPTION TEXT, DB_COLUMN_TIMESTAMP BIGINT NOT NULL, DB_COLUMN_IS_LOCATION INTEGER NOT NULL, " +
"DB_COLUMN_LONGITUDE_WGS84 TEXT, DB_COLUMN_LATITUDE_WGS84 TEXT, " +
"DB_COLUMN_LONGITUDE_CUSTOM TEXT, DB_COLUMN_LATITUDE_CUSTOM TEXT)";

View File

@ -39,7 +39,7 @@ public class HistoryActivity extends BaseActivity {
private static final String KEY_LOCATION = "KEY_LOCATION";
private static final String KEY_TIME = "KEY_TIME";
private static final String KEY_LNG_LAT_WGS = "KEY_LNG_LAT_WGS";
private static final String KEY_LNG_LAT_BD = "KEY_LNG_LAT_BD";
private static final String KEY_LNG_LAT_CUSTOM = "KEY_LNG_LAT_CUSTOM";
private ListView mRecordListView;
private SearchView mSearchView;
@ -141,7 +141,7 @@ public class HistoryActivity extends BaseActivity {
HistoryActivity.this.getBaseContext(),
mAllRecord,
R.layout.history_item,
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_BD}, // 与下面数组元素要一一对应
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_CUSTOM}, // 与下面数组元素要一一对应
new int[]{R.id.LocationID, R.id.LoctionText, R.id.TimeText, R.id.WGSLatLngText, R.id.BDLatLngText});
mRecordListView.setAdapter(simAdapt);
} else {
@ -156,7 +156,7 @@ public class HistoryActivity extends BaseActivity {
HistoryActivity.this.getBaseContext(),
searchRet,
R.layout.history_item,
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_BD}, // 与下面数组元素要一一对应
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_CUSTOM}, // 与下面数组元素要一一对应
new int[]{R.id.LocationID, R.id.LoctionText, R.id.TimeText, R.id.WGSLatLngText, R.id.BDLatLngText});
mRecordListView.setAdapter(simAdapt);
} else {
@ -165,7 +165,7 @@ public class HistoryActivity extends BaseActivity {
HistoryActivity.this.getBaseContext(),
mAllRecord,
R.layout.history_item,
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_BD}, // 与下面数组元素要一一对应
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_CUSTOM}, // 与下面数组元素要一一对应
new int[]{R.id.LocationID, R.id.LoctionText, R.id.TimeText, R.id.WGSLatLngText, R.id.BDLatLngText});
mRecordListView.setAdapter(simAdapt);
}
@ -196,7 +196,7 @@ public class HistoryActivity extends BaseActivity {
this,
mAllRecord,
R.layout.history_item,
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_BD}, // 与下面数组元素要一一对应
new String[]{KEY_ID, KEY_LOCATION, KEY_TIME, KEY_LNG_LAT_WGS, KEY_LNG_LAT_CUSTOM}, // 与下面数组元素要一一对应
new int[]{R.id.LocationID, R.id.LoctionText, R.id.TimeText, R.id.WGSLatLngText, R.id.BDLatLngText});
mRecordListView.setAdapter(simAdapt);
} catch (Exception e) {
@ -284,7 +284,7 @@ public class HistoryActivity extends BaseActivity {
item.put(KEY_LOCATION, Location);
item.put(KEY_TIME, timeStamp2Date(Long.toString(TimeStamp), null));
item.put(KEY_LNG_LAT_WGS, "[经度:" + doubleLongitude + " 纬度:" + doubleLatitude + "]");
item.put(KEY_LNG_LAT_BD, "[经度:" + doubleBDLongitude + " 纬度:" + doubleBDLatitude + "]");
item.put(KEY_LNG_LAT_CUSTOM, "[经度:" + doubleBDLongitude + " 纬度:" + doubleBDLatitude + "]");
data.add(item);
}
cursor.close();

View File

@ -204,6 +204,7 @@ public class MainActivity extends BaseActivity
@Override
protected void onDestroy() {
XLog.i("MainActivity: onDestroy");
if (isMockServStart) {
Intent serviceGoIntent = new Intent(MainActivity.this, ServiceGo.class);
stopService(serviceGoIntent);

View File

@ -9,7 +9,6 @@ import android.text.SpannableStringBuilder;
import android.text.method.LinkMovementMethod;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

View File

@ -30,7 +30,7 @@ import com.zcshou.utils.MapUtils;
public class JoyStick extends View {
private static final int DivGo = 1000; /* 移动的时间间隔,单位 ms */
final private Context mContext;
private final Context mContext;
private WindowManager.LayoutParams mWindowParamJoyStick;
private WindowManager.LayoutParams mWindowParamMap;
@ -59,7 +59,7 @@ public class JoyStick extends View {
private final SharedPreferences sharedPreferences;
private final BitmapDescriptor mMapIndicator = BitmapDescriptorFactory.fromResource(R.drawable.icon_position);
MapView mMapView;
private MapView mMapView;
private BaiduMap mBaiduMap;
private double mLng;
private double mLat;