Skip to content

Commit

Permalink
更新了 Gradle 插件版本
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCShou committed Oct 5, 2020
1 parent c1d7436 commit d9c33da
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 149 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GoGoGo</name>
<comment>Project GoGoGo created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
20 changes: 20 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
63 changes: 19 additions & 44 deletions app/src/main/java/com/zcshou/gogogo/FragmentSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,61 +35,38 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

EditTextPreference pfWalk = findPreference("setting_walk");
if (pfWalk != null) {
pfWalk.setSummaryProvider( new Preference.SummaryProvider<EditTextPreference>() {// 使用自定义 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<EditTextPreference>) 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<EditTextPreference>() {
@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<EditTextPreference>) 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<EditTextPreference>() {
@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<EditTextPreference>) 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));
}
}

Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/com/zcshou/gogogo/GoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
});
}
}
116 changes: 48 additions & 68 deletions app/src/main/java/com/zcshou/gogogo/HistoryActivity.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
});
}

Expand Down
46 changes: 17 additions & 29 deletions app/src/main/java/com/zcshou/gogogo/WelcomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 之后才能生效

Expand Down Expand Up @@ -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();
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit d9c33da

Please sign in to comment.