diff --git a/.project b/.project
new file mode 100644
index 0000000..dfaf4e8
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ GoGoGo
+ Project GoGoGo created by Buildship.
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..27b37ed
--- /dev/null
+++ b/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
+connection.project.dir=
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=C\:/Program Files/Java/jdk-11.0.8
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/app/build.gradle b/app/build.gradle
index d556b64..536336c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,7 +16,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- buildToolsVersion '28.0.3'
+ buildToolsVersion '29.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
index 49c33e5..a2c272c 100644
Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 0000000..a4aada9
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,20 @@
+{
+ "version": 1,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "com.zcshou.gogogo",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "properties": [],
+ "versionCode": 106,
+ "versionName": "1.0.6",
+ "enabled": true,
+ "outputFile": "app-release.apk"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/zcshou/gogogo/FragmentSettings.java b/app/src/main/java/com/zcshou/gogogo/FragmentSettings.java
index 9ba0223..29de715 100644
--- a/app/src/main/java/com/zcshou/gogogo/FragmentSettings.java
+++ b/app/src/main/java/com/zcshou/gogogo/FragmentSettings.java
@@ -3,9 +3,7 @@
import android.os.Bundle;
import android.text.InputType;
import android.text.TextUtils;
-import android.widget.EditText;
-import androidx.annotation.NonNull;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@@ -37,61 +35,38 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
EditTextPreference pfWalk = findPreference("setting_walk");
if (pfWalk != null) {
- pfWalk.setSummaryProvider( new Preference.SummaryProvider() {// 使用自定义 SummaryProvider
- @Override
- public CharSequence provideSummary(EditTextPreference preference) {
- String text = preference.getText();
- if (TextUtils.isEmpty(text)) {
- return "未设置";
- }
- return "当前值: " + text;
- }
- });
- pfWalk.setOnBindEditTextListener( new EditTextPreference.OnBindEditTextListener() {
- @Override
- public void onBindEditText(@NonNull EditText editText) {
- editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER);
+ // 使用自定义 SummaryProvider
+ pfWalk.setSummaryProvider((Preference.SummaryProvider) preference -> {
+ String text = preference.getText();
+ if (TextUtils.isEmpty(text)) {
+ return "未设置";
}
+ return "当前值: " + text;
});
+ pfWalk.setOnBindEditTextListener(editText -> editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER));
}
EditTextPreference pfRun = findPreference("setting_run");
if (pfRun != null) {
- pfRun.setSummaryProvider( new Preference.SummaryProvider() {
- @Override
- public CharSequence provideSummary(EditTextPreference preference) {
- String text = preference.getText();
- if (TextUtils.isEmpty(text)) {
- return "未设置";
- }
- return "当前值: " + text;
- }
- });
- pfRun.setOnBindEditTextListener( new EditTextPreference.OnBindEditTextListener() {
- @Override
- public void onBindEditText(@NonNull EditText editText) {
- editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER);
+ pfRun.setSummaryProvider((Preference.SummaryProvider) preference -> {
+ String text = preference.getText();
+ if (TextUtils.isEmpty(text)) {
+ return "未设置";
}
+ return "当前值: " + text;
});
+ pfRun.setOnBindEditTextListener(editText -> editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER));
}
EditTextPreference pfBike = findPreference("setting_bike");
if (pfBike != null) {
- pfBike.setSummaryProvider(new Preference.SummaryProvider() {
- @Override
- public CharSequence provideSummary(EditTextPreference preference) {
- String text = preference.getText();
- if (TextUtils.isEmpty(text)) {
- return "未设置";
- }
- return "当前值: " + text;
- }
- });
- pfBike.setOnBindEditTextListener( new EditTextPreference.OnBindEditTextListener() {
- @Override
- public void onBindEditText(@NonNull EditText editText) {
- editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER);
+ pfBike.setSummaryProvider((Preference.SummaryProvider) preference -> {
+ String text = preference.getText();
+ if (TextUtils.isEmpty(text)) {
+ return "未设置";
}
+ return "当前值: " + text;
});
+ pfBike.setOnBindEditTextListener(editText -> editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER));
}
}
diff --git a/app/src/main/java/com/zcshou/gogogo/GoApplication.java b/app/src/main/java/com/zcshou/gogogo/GoApplication.java
index 81317a1..ef013da 100644
--- a/app/src/main/java/com/zcshou/gogogo/GoApplication.java
+++ b/app/src/main/java/com/zcshou/gogogo/GoApplication.java
@@ -20,10 +20,7 @@ public void onCreate() {
mVibrator = (Vibrator)getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);
SDKInitializer.initialize(getApplicationContext());
// 谷歌广告 SDK 初始化
- MobileAds.initialize(getApplicationContext(), new OnInitializationCompleteListener() {
- @Override
- public void onInitializationComplete(InitializationStatus initializationStatus) {
- }
+ MobileAds.initialize(getApplicationContext(), initializationStatus -> {
});
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/zcshou/gogogo/HistoryActivity.java b/app/src/main/java/com/zcshou/gogogo/HistoryActivity.java
index c4a7596..398edb9 100644
--- a/app/src/main/java/com/zcshou/gogogo/HistoryActivity.java
+++ b/app/src/main/java/com/zcshou/gogogo/HistoryActivity.java
@@ -1,7 +1,6 @@
package com.zcshou.gogogo;
import android.annotation.SuppressLint;
-import android.content.DialogInterface;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
@@ -15,7 +14,6 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SearchView;
@@ -110,22 +108,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
.setTitle("Warning")//这里是表头的内容
.setMessage("确定要删除全部历史记录吗?")//这里是中间显示的具体信息
.setPositiveButton("确定",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- boolean deleteRet = deleteRecord(sqLiteDatabase, -1);
-
- if (deleteRet) {
- DisplayToast("删除成功!");
- initListView();
- }
+ (dialog, which) -> {
+ boolean deleteRet = deleteRecord(sqLiteDatabase, -1);
+
+ if (deleteRet) {
+ DisplayToast("删除成功!");
+ initListView();
}
})
.setNegativeButton("取消",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
+ (dialog, which) -> {
})
.show();
return true;
@@ -162,62 +154,50 @@ private void initListView() {
}
private void setSearchResultClickListener() {
- listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
- String bd09Longitude;
- String bd09Latitude;
- String wgs84Longitude;
- String wgs84Latitude;
- //bd09坐标
- 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);
- //wgs84坐标
- String wgs84LatLng = (String) ((TextView) view.findViewById(R.id.WGSLatLngText)).getText();
- wgs84LatLng = wgs84LatLng.substring(wgs84LatLng.indexOf("[") + 1, wgs84LatLng.indexOf("]"));
- String[] latLngStr2 = wgs84LatLng.split(" ");
- wgs84Longitude = latLngStr2[0].substring(latLngStr2[0].indexOf(":") + 1);
- wgs84Latitude = latLngStr2[1].substring(latLngStr2[1].indexOf(":") + 1);
-
- if (!showHistoryLocation(bd09Longitude, bd09Latitude, wgs84Longitude, wgs84Latitude)) {
- DisplayToast("定位失败,请手动选取定位点");
- }
-
- returnLastActivity();
+ listView.setOnItemClickListener((adapterView, view, i, l) -> {
+ String bd09Longitude;
+ String bd09Latitude;
+ String wgs84Longitude;
+ String wgs84Latitude;
+ //bd09坐标
+ 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);
+ //wgs84坐标
+ String wgs84LatLng = (String) ((TextView) view.findViewById(R.id.WGSLatLngText)).getText();
+ wgs84LatLng = wgs84LatLng.substring(wgs84LatLng.indexOf("[") + 1, wgs84LatLng.indexOf("]"));
+ String[] latLngStr2 = wgs84LatLng.split(" ");
+ wgs84Longitude = latLngStr2[0].substring(latLngStr2[0].indexOf(":") + 1);
+ wgs84Latitude = latLngStr2[1].substring(latLngStr2[1].indexOf(":") + 1);
+
+ if (!showHistoryLocation(bd09Longitude, bd09Latitude, wgs84Longitude, wgs84Latitude)) {
+ DisplayToast("定位失败,请手动选取定位点");
}
+
+ returnLastActivity();
});
- listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
- @Override
- public boolean onItemLongClick(AdapterView> parent, final View view, int position, long id) {
- new AlertDialog.Builder(HistoryActivity.this)
- .setTitle("Warning")//这里是表头的内容
- .setMessage("确定要删除该项历史记录吗?")//这里是中间显示的具体信息
- .setPositiveButton("确定",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- String locID = (String) ((TextView) view.findViewById(R.id.LocationID)).getText();
- boolean deleteRet = deleteRecord(sqLiteDatabase, Integer.parseInt(locID));
-
- if (deleteRet) {
- DisplayToast("删除成功!");
- initListView();
- }
- }
- })
- .setNegativeButton("取消",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- })
- .show();
- return true;
- }
+ listView.setOnItemLongClickListener((parent, view, position, id) -> {
+ new AlertDialog.Builder(HistoryActivity.this)
+ .setTitle("Warning")//这里是表头的内容
+ .setMessage("确定要删除该项历史记录吗?")//这里是中间显示的具体信息
+ .setPositiveButton("确定",
+ (dialog, which) -> {
+ String locID = (String) ((TextView) view.findViewById(R.id.LocationID)).getText();
+ boolean deleteRet = deleteRecord(sqLiteDatabase, Integer.parseInt(locID));
+
+ if (deleteRet) {
+ DisplayToast("删除成功!");
+ initListView();
+ }
+ })
+ .setNegativeButton("取消",
+ (dialog, which) -> {
+ })
+ .show();
+ return true;
});
}
diff --git a/app/src/main/java/com/zcshou/gogogo/WelcomeActivity.java b/app/src/main/java/com/zcshou/gogogo/WelcomeActivity.java
index ed928cd..b6f2f36 100644
--- a/app/src/main/java/com/zcshou/gogogo/WelcomeActivity.java
+++ b/app/src/main/java/com/zcshou/gogogo/WelcomeActivity.java
@@ -19,7 +19,6 @@
import android.text.SpannableStringBuilder;
import android.text.method.LinkMovementMethod;
import android.view.Gravity;
-import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.CheckBox;
@@ -66,12 +65,7 @@ protected void onCreate(Bundle savedInstanceState) {
int cnt = Integer.parseInt(getResources().getString(R.string.welcome_btn_cnt));
time = new TimeCount(cnt, 1000);
startBtn = findViewById(R.id.startButton);
- startBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- startMainActivity();
- }
- });
+ startBtn.setOnClickListener(v -> startMainActivity());
startBtn.setClickable(false); // 放在 setOnClickListener 之后才能生效
@@ -321,32 +315,26 @@ private void showProtocolDialog() {
tvContent.setMovementMethod(LinkMovementMethod.getInstance());
tvContent.setText(ssb, TextView.BufferType.SPANNABLE);
- tvCancel.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- alertDialog.cancel();
- finish();
- }
+ tvCancel.setOnClickListener(v -> {
+ alertDialog.cancel();
+ finish();
});
- tvAgree.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (tvCheck.isChecked()) {
- //实例化Editor对象
- SharedPreferences.Editor editor = preferences.edit();
- //存入数据
- editor.putBoolean("isFirstUse", false);
- //提交修改
- editor.apply();
-
- isFirstUse = false;
- }
+ tvAgree.setOnClickListener(v -> {
+ if (tvCheck.isChecked()) {
+ //实例化Editor对象
+ SharedPreferences.Editor editor = preferences.edit();
+ //存入数据
+ editor.putBoolean("isFirstUse", false);
+ //提交修改
+ editor.apply();
+
+ isFirstUse = false;
+ }
- requestNeedPermissions();
+ requestNeedPermissions();
- alertDialog.cancel();
- }
+ alertDialog.cancel();
});
}
}
diff --git a/build.gradle b/build.gradle
index 8f67126..1877b07 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
+ classpath 'com.android.tools.build:gradle:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 971a7aa..235b4c7 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Jul 30 22:35:12 CST 2018
+#Mon Oct 05 10:08:54 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip