Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
964358d
a few optimizations
zcteo Dec 22, 2024
ac97d38
chore(deps): bump github/codeql-action from 3.27.9 to 3.28.0
dependabot[bot] Dec 23, 2024
2feb116
Don't display welcome activity after agreement
ZnDong Dec 24, 2024
92154f5
Fix lon and lat being written inversely during offset
zcteo Dec 26, 2024
87109ea
Change MainActivity.showLocation to non-static
zcteo Dec 26, 2024
d9f1c46
Merge pull request #202 from ZCShou/dependabot/github_actions/github/…
ZCShou Dec 26, 2024
1c87653
Merge pull request #201 from zcteo/master
ZCShou Dec 26, 2024
7d41fbc
Merge pull request #204 from ZnDong/welcome-show-once
ZCShou Dec 27, 2024
332b0d8
chore(deps): bump softprops/action-gh-release from 2.2.0 to 2.2.1
dependabot[bot] Jan 13, 2025
3b60f1c
chore(deps): bump github/codeql-action from 3.28.0 to 3.28.1
dependabot[bot] Jan 13, 2025
bf2862a
Merge pull request #213 from ZCShou/dependabot/github_actions/github/…
ZCShou Jan 14, 2025
f5153a3
Merge pull request #212 from ZCShou/dependabot/github_actions/softpro…
ZCShou Jan 14, 2025
ec1c28b
chore(deps): bump github/codeql-action from 3.28.1 to 3.28.8
dependabot[bot] Feb 3, 2025
3f947c2
Merge pull request #217 from ZCShou/dependabot/github_actions/github/…
ZCShou Feb 5, 2025
9d5707c
chore(deps): bump github/codeql-action from 3.28.8 to 3.28.9
dependabot[bot] Feb 10, 2025
897feca
Merge pull request #219 from ZCShou/dependabot/github_actions/github/…
ZCShou Feb 14, 2025
fd3cf51
chore(deps): bump github/codeql-action from 3.28.9 to 3.28.11
dependabot[bot] Mar 10, 2025
bc6775d
Merge pull request #225 from ZCShou/dependabot/github_actions/github/…
ZCShou Mar 11, 2025
8a5ac34
chore(deps): bump github/codeql-action from 3.28.11 to 3.28.13
dependabot[bot] Mar 24, 2025
f808366
Merge pull request #229 from ZCShou/dependabot/github_actions/github/…
ZCShou Mar 25, 2025
fa0d1f0
chore(deps): bump github/codeql-action from 3.28.13 to 3.28.15
dependabot[bot] Apr 14, 2025
8d333ad
Merge pull request #232 from ZCShou/dependabot/github_actions/github/…
ZCShou Apr 17, 2025
d27c247
chore(deps): bump softprops/action-gh-release from 2.2.1 to 2.2.2
dependabot[bot] Apr 21, 2025
6275b12
chore(deps): bump ardalanamini/auto-changelog from 4.0.2 to 4.0.3
dependabot[bot] Jun 9, 2025
383e36d
chore(deps): bump github/codeql-action from 3.28.15 to 3.28.19
dependabot[bot] Jun 9, 2025
41acbe5
Merge pull request #249 from ZCShou/dependabot/github_actions/github/…
ZCShou Jun 10, 2025
892d178
Merge pull request #248 from ZCShou/dependabot/github_actions/ardalan…
ZCShou Jun 10, 2025
f10dba8
Merge pull request #235 from ZCShou/dependabot/github_actions/softpro…
ZCShou Jun 10, 2025
570975b
chore(deps): bump github/codeql-action from 3.28.19 to 3.29.0
dependabot[bot] Jun 16, 2025
c75c747
chore(deps): bump softprops/action-gh-release from 2.2.2 to 2.3.2
dependabot[bot] Jun 16, 2025
a78daf5
Merge pull request #253 from ZCShou/dependabot/github_actions/softpro…
ZCShou Jun 17, 2025
73b0f8d
Merge pull request #252 from ZCShou/dependabot/github_actions/github/…
ZCShou Jun 17, 2025
e590df5
chore(deps): bump ardalanamini/auto-changelog from 4.0.3 to 4.0.4
dependabot[bot] Jun 30, 2025
cea9e08
chore(deps): bump github/codeql-action from 3.29.0 to 3.29.2
dependabot[bot] Jun 30, 2025
a2c88a0
Merge pull request #259 from ZCShou/dependabot/github_actions/github/…
ZCShou Jul 2, 2025
c8649c6
Merge pull request #258 from ZCShou/dependabot/github_actions/ardalan…
ZCShou Jul 2, 2025
b6ee7da
Merge branch 'master' into master
YorkeLeo Oct 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5
uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.5
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ plugins {
id "com.google.android.libraries.mapsplatform.secrets-gradle-plugin"
}

def getGitCommitHash() {
return providers.exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
}.standardOutput.asText.get().trim()
}

android {
ndkVersion = '26.2.11394342'
compileSdk = 32
Expand Down
50 changes: 9 additions & 41 deletions app/src/main/java/com/zcshou/gogogo/HistoryActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.zcshou.gogogo;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
Expand Down Expand Up @@ -28,8 +30,6 @@
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Objects;
import java.util.Locale;
import java.util.List;
import java.util.Map;

Expand All @@ -48,7 +48,6 @@ public class HistoryActivity extends BaseActivity {
private LinearLayout mSearchLayout;
private SQLiteDatabase mHistoryLocationDB;
private List<Map<String, Object>> mAllRecord;
private SharedPreferences sharedPreferences;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -68,8 +67,6 @@ protected void onCreate(Bundle savedInstanceState) {
actionBar.setDisplayHomeAsUpEnabled(true);
}

sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

initLocationDataBase();

initSearchView();
Expand Down Expand Up @@ -175,6 +172,7 @@ private List<Map<String, Object>> fetchAllRecord() {
private void recordArchive() {
double limits;
try {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
limits = Double.parseDouble(sharedPreferences.getString("setting_pos_history", getResources().getString(R.string.history_expiration)));
} catch (NumberFormatException e) { // GOOD: The exception is caught.
limits = 7;
Expand Down Expand Up @@ -295,50 +293,20 @@ private void showInputDialog(String locID, String name) {
builder.show();
}

private String[] randomOffset(String longitude, String latitude) {
String max_offset_default = getResources().getString(R.string.setting_random_offset_default);
double lon_max_offset = Double.parseDouble(Objects.requireNonNull(sharedPreferences.getString("setting_lon_max_offset", max_offset_default)));
double lat_max_offset = Double.parseDouble(Objects.requireNonNull(sharedPreferences.getString("setting_lat_max_offset", max_offset_default)));
double lon = Double.parseDouble(longitude);
double lat = Double.parseDouble(latitude);

double randomLonOffset = (Math.random() * 2 - 1) * lon_max_offset; // Longitude offset (meters)
double randomLatOffset = (Math.random() * 2 - 1) * lat_max_offset; // Latitude offset (meters)

lon += randomLonOffset / 111320; // (meters -> longitude)
lat += randomLatOffset / 110574; // (meters -> latitude)

String offsetMessage = String.format(Locale.US, "经度偏移: %.2f米\n纬度偏移: %.2f米", randomLonOffset, randomLatOffset);
GoUtils.DisplayToast(this, offsetMessage);

return new String[]{String.valueOf(lon), String.valueOf(lat)};
}

private void initRecordListView() {
noRecordText = findViewById(R.id.record_no_textview);
mSearchLayout = findViewById(R.id.search_linear);
mRecordListView = findViewById(R.id.record_list_view);
mRecordListView.setOnItemClickListener((adapterView, view, i, l) -> {
String bd09Longitude;
String bd09Latitude;
String name;
name = (String) ((TextView) view.findViewById(R.id.LocationText)).getText();
String bd09LatLng = (String) ((TextView) view.findViewById(R.id.BDLatLngText)).getText();
bd09LatLng = bd09LatLng.substring(bd09LatLng.indexOf('[') + 1, bd09LatLng.indexOf(']'));
String[] latLngStr = bd09LatLng.split(" ");
bd09Longitude = latLngStr[0].substring(latLngStr[0].indexOf(':') + 1);
bd09Latitude = latLngStr[1].substring(latLngStr[1].indexOf(':') + 1);

// Random offset
if(sharedPreferences.getBoolean("setting_random_offset", false)) {
String[] offsetResult = randomOffset(bd09Longitude, bd09Latitude);
bd09Longitude = offsetResult[0];
bd09Latitude = offsetResult[1];
}

if (!MainActivity.showLocation(name, bd09Longitude, bd09Latitude)) {
GoUtils.DisplayToast(this, getResources().getString(R.string.history_error_location));
}
String bd09Longitude = latLngStr[0].substring(latLngStr[0].indexOf(':') + 1);
String bd09Latitude = latLngStr[1].substring(latLngStr[1].indexOf(':') + 1);
Intent resultIntent = new Intent();
resultIntent.putExtra("bd09_lon", bd09Longitude);
resultIntent.putExtra("bd09_lat", bd09Latitude);
setResult(Activity.RESULT_OK, resultIntent);
this.finish();
});

Expand Down
Loading