handsomejun\myApp1\myApp\.gitignore

handsomejun\myApp1\myApp\.idea\checkstyle-idea.xml
handsomejun\myApp1\myApp\.idea\compiler.xml
handsomejun\myApp1\myApp\.idea\copyright\profiles_settings.xml
handsomejun\myApp1\myApp\.idea\gradle.xml
handsomejun\myApp1\myApp\.idea\misc.xml
handsomejun\myApp1\myApp\.idea\modules.xml
handsomejun\myApp1\myApp\.idea\runConfigurations.xml
handsomejun\myApp1\myApp\app\.gitignore
handsomejun\myApp1\myApp\app\build.gradle
handsomejun\myApp1\myApp\app\libs\BaiduLBS_Android.jar
handsomejun\myApp1\myApp\app\proguard-rules.pro
handsomejun\myApp1\myApp\app\src\androidTest\java\com\example\administrator\myapp\ExampleInstrumentedTest.java
handsomejun\myApp1\myApp\app\src\debug\res\values\google_maps_api.xml
handsomejun\myApp1\myApp\app\src\main\AndroidManifest.xml
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\AddressToLatitudeLongitude.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\AlertDialog.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\LoginActivity.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\MainActivity.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\MyOrientationListener.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\func_page.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\get_goods.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\goods_2_page.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\locate_page.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\my_address_page.java
handsomejun\myApp1\myApp\app\src\main\java\com\example\administrator\myapp\register_page.java
handsomejun\myApp1\myApp\app\src\main\jniLibs\arm64-v8a\libBaiduMapSDK_base_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\arm64-v8a\libBaiduMapSDK_map_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\arm64-v8a\liblocSDK7a.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi-v7a\libBaiduMapSDK_base_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi-v7a\libBaiduMapSDK_map_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi-v7a\liblocSDK7a.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi\libBaiduMapSDK_base_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi\libBaiduMapSDK_map_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\armeabi\liblocSDK7a.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86\libBaiduMapSDK_base_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86\libBaiduMapSDK_map_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86\liblocSDK7a.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86_64\libBaiduMapSDK_base_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86_64\libBaiduMapSDK_map_v4_5_2.so
handsomejun\myApp1\myApp\app\src\main\jniLibs\x86_64\liblocSDK7a.so
handsomejun\myApp1\myApp\app\src\main\res\drawable\edit.png
handsomejun\myApp1\myApp\app\src\main\res\drawable\func.png
handsomejun\myApp1\myApp\app\src\main\res\drawable\login.png
handsomejun\myApp1\myApp\app\src\main\res\drawable\map_simulation.png
handsomejun\myApp1\myApp\app\src\main\res\drawable\map_simulation2.png
handsomejun\myApp1\myApp\app\src\main\res\drawable\register.png
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_func_page.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_get_goods.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_goods_2_page.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_locate_page.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_login.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_main.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_my_address_page.xml
handsomejun\myApp1\myApp\app\src\main\res\layout\activity_register_page.xml
handsomejun\myApp1\myApp\app\src\main\res\menu\menu_item.xml
handsomejun\myApp1\myApp\app\src\main\res\mipmap-hdpi\ic_launcher.png
handsomejun\myApp1\myApp\app\src\main\res\mipmap-mdpi\ic_launcher.png
handsomejun\myApp1\myApp\app\src\main\res\mipmap-xhdpi\ic_launcher.png
handsomejun\myApp1\myApp\app\src\main\res\mipmap-xxhdpi\ic_launcher.png
handsomejun\myApp1\myApp\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png
handsomejun\myApp1\myApp\app\src\main\res\values\array.xml
handsomejun\myApp1\myApp\app\src\main\res\values\colors.xml
handsomejun\myApp1\myApp\app\src\main\res\values\dimens.xml
handsomejun\myApp1\myApp\app\src\main\res\values\strings.xml
handsomejun\myApp1\myApp\app\src\main\res\values\styles.xml
handsomejun\myApp1\myApp\app\src\release\res\values\google_maps_api.xml
handsomejun\myApp1\myApp\app\src\test\java\com\example\administrator\myapp\ExampleUnitTest.java
handsomejun\myApp1\myApp\build.gradle
handsomejun\myApp1\myApp\gradle.properties
handsomejun\myApp1\myApp\gradle\wrapper\gradle-wrapper.jar
handsomejun\myApp1\myApp\gradle\wrapper\gradle-wrapper.properties
handsomejun\myApp1\myApp\gradlew
handsomejun\myApp1\myApp\gradlew.bat
handsomejun\myApp1\myApp\settings.gradle
This commit is contained in:
zdj 2018-03-21 17:14:43 +08:00
parent f4ebefc6da
commit 2af6155249
75 changed files with 2807 additions and 0 deletions

9
handsomejun/myApp1/myApp/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="checkstyle-version" value="8.2" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/myApp.iml" filepath="$PROJECT_DIR$/myApp.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,41 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.administrator.myapp"
minSdkVersion 24
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets{
main{
jniLibs.srcDir 'libs'
//so的路径为该libs路径SDK的so文件
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.4'
testCompile 'junit:junit:4.12'
compile 'junit:junit:4.12'
compile files('libs/BaiduLBS_Android.jar')
}

Binary file not shown.

View File

@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Administrator\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package com.example.administrator.myapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.administrator.myapp", appContext.getPackageName());
}
}

View File

@ -0,0 +1,26 @@
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=3E:6F:35:29:AE:1A:E9:0A:29:12:FF:C3:C9:17:C9:D8:38:6D:42:C9%3Bcom.example.administrator.myapp
You can also add your credentials to an existing key, using these values:
Package name:
3E:6F:35:29:AE:1A:E9:0A:29:12:FF:C3:C9:17:C9:D8:38:6D:42:C9
SHA-1 certificate fingerprint:
3E:6F:35:29:AE:1A:E9:0A:29:12:FF:C3:C9:17:C9:D8:38:6D:42:C9
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
YOUR_KEY_HERE
</string>
</resources>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.myapp">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
//获取设备网络状态,禁用后无法获取网络状态
<uses-permission android:name="android.permission.INTERNET"/>
//网络权限,当禁用后,无法进行检索等相关业务
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
//读取设备硬件信息,统计数据
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
//读取系统信息,包含系统版本等信息,用作统计
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
//获取设备的网络状态,鉴权所需网络代理
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
//允许sd卡写权限需写入地图数据禁用后无法显示地图
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
//获取统计数据
<uses-permission android:name="android.permission.GET_TASKS" />
//鉴权所需该权限获取进程列表
<uses-permission android:name="android.permission.CAMERA" />
//使用步行AR导航配置Camera权限
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".func_page" />
<activity
android:name=".register_page"
android:label="@string/title_activity_register_page" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="GMXfqTpGsQAlmFAGP04Qw8VqGpqfWie0" />
<activity android:name=".MainActivity">
</activity>
<activity android:name=".locate_page">
</activity>
<activity android:name=".goods_2_page">
</activity>
<activity android:name=".get_goods" />
<activity android:name=".my_address_page">
</activity>
<activity android:name=".AlertDialog"></activity>
<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote">
</service>
</application>
</manifest>

View File

@ -0,0 +1,84 @@
package com.example.administrator.myapp;
/**
* Created by 小老宰 on 2018/3/16.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
* Created by wanglei on 2017/6/20.
* 根据百度地图API根据地址得到经纬度
*/
public class AddressToLatitudeLongitude {
private String address = "哈尔滨";//地址
private double Latitude = 45.7732246332393;//纬度
private double Longitude = 126.65771685544611;//经度
public AddressToLatitudeLongitude(String addr_str) {
this.address = addr_str;
}
/*
*根据地址得到地理坐标
*/
public void getLatAndLngByAddress(){
String addr = "";
String lat = "";
String lng = "";
try {
addr = java.net.URLEncoder.encode(address,"UTF-8");//编码
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String url = String.format("http://api.map.baidu.com/geocoder/v2/?"
+"address=%s&ak=4rcKAZKG9OIl0wDkICSLx8BA&output=json",addr);
URL myURL = null;
URLConnection httpsConn = null;
//进行转码
try {
myURL = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
httpsConn = (URLConnection) myURL.openConnection();//建立连接
if (httpsConn != null) {
InputStreamReader insr = new InputStreamReader(//传输数据
httpsConn.getInputStream(), "UTF-8");
BufferedReader br = new BufferedReader(insr);
String data = null;
if ((data = br.readLine()) != null) {
System.out.println(data);
//这里的data为以下的json格式字符串,因为简单所以就不使用json解析了直接字符串处理
//{"status":0,"result":{"location":{"lng":118.77807440802562,"lat":32.05723550180587},"precise":0,"confidence":12,"level":"城市"}}
lat = data.substring(data.indexOf("\"lat\":")+("\"lat\":").length(), data.indexOf("},\"precise\""));
lng = data.substring(data.indexOf("\"lng\":")+("\"lng\":").length(), data.indexOf(",\"lat\""));
}
insr.close();
br.close();
}
} catch (IOException e) {
e.printStackTrace();
}
this.Latitude = Double.parseDouble(lat);
this.Longitude = Double.parseDouble(lng);
}
public Double getLatitude() {
return this.Latitude;
}
public Double getLongitude() {
return this.Longitude;
}
public static void main(String[] args) {
AddressToLatitudeLongitude at = new AddressToLatitudeLongitude("安徽省亳州市亳州一中");
at.getLatAndLngByAddress();
System.out.println(at.getLatitude() + " " + at.getLongitude());
}
}

View File

@ -0,0 +1,41 @@
package com.example.administrator.myapp;
import android.content.DialogInterface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class AlertDialog extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void showdialog(View view)
{
//Toast.makeText(this,"clickme",Toast.LENGTH_LONG).show();
android.support.v7.app.AlertDialog.Builder alertdialogbuilder=new android.support.v7.app.AlertDialog.Builder(this);
alertdialogbuilder.setMessage("您确认要退出程序");
alertdialogbuilder.setPositiveButton("确定", click1);
alertdialogbuilder.setNegativeButton("取消", click2);
android.support.v7.app.AlertDialog alertdialog1=alertdialogbuilder.create();
alertdialog1.show();
}
private DialogInterface.OnClickListener click1=new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface arg0,int arg1)
{
android.os.Process.killProcess(android.os.Process.myPid());
}
};
private DialogInterface.OnClickListener click2=new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface arg0,int arg1)
{
arg0.cancel();
}
};
}

View File

@ -0,0 +1,364 @@
package com.example.administrator.myapp;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.CursorLoader;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.READ_CONTACTS;
/**
* A login screen that offers login via email/password.
*/
public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {
/**
*
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;
/**
* A dummy authentication store containing known user names and passwords.
* TODO: remove after connecting to a real authentication system.
*/
private static final String[] DUMMY_CREDENTIALS = new String[]{
"foo@example.com:hello", "bar@example.com:world"
};
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/
private UserLoginTask mAuthTask = null;
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
populateAutoComplete();
mPasswordView = (EditText) findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
Button mEmailSignInButton = (Button) findViewById(R.id.login_button);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress);
findViewById(R.id.login_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this,func_page.class));
}
});
findViewById(R.id.register_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this,register_page.class));
}
});
}
private void populateAutoComplete() {
if (!mayRequestContacts()) {
return;
}
getLoaderManager().initLoader(0, null, this);
}
private boolean mayRequestContacts() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
return true;
}
if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE)
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onClick(View v) {
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
}
});
} else {
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
}
return false;
}
/**
* Callback received when a permissions request has been completed.
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == REQUEST_READ_CONTACTS) {
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
populateAutoComplete();
}
}
}
/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/
private void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(email)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
} else if (!isEmailValid(email)) {
mEmailView.setError(getString(R.string.error_invalid_email));
focusView = mEmailView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
showProgress(true);
mAuthTask = new UserLoginTask(email, password);
mAuthTask.execute((Void) null);
}
}
private boolean isEmailValid(String email) {
//TODO: Replace this with your own logic
return email.contains("@");
}
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
return password.length() > 4;
}
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
});
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mProgressView.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
List<String> emails = new ArrayList<>();
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
emails.add(cursor.getString(ProfileQuery.ADDRESS));
cursor.moveToNext();
}
addEmailsToAutoComplete(emails);
}
@Override
public void onLoaderReset(Loader<Cursor> cursorLoader) {
}
private interface ProfileQuery {
String[] PROJECTION = {
ContactsContract.CommonDataKinds.Email.ADDRESS,
ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
};
int ADDRESS = 0;
int IS_PRIMARY = 1;
}
private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
ArrayAdapter<String> adapter =
new ArrayAdapter<>(LoginActivity.this,
android.R.layout.simple_dropdown_item_1line, emailAddressCollection);
mEmailView.setAdapter(adapter);
}
/**
* Represents an asynchronous login/registration task used to authenticate
* the user.
*/
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
private final String mEmail;
private final String mPassword;
UserLoginTask(String email, String password) {
mEmail = email;
mPassword = password;
}
@Override
protected Boolean doInBackground(Void... params) {
// TODO: attempt authentication against a network service.
try {
// Simulate network access.
Thread.sleep(2000);
} catch (InterruptedException e) {
return false;
}
for (String credential : DUMMY_CREDENTIALS) {
String[] pieces = credential.split(":");
if (pieces[0].equals(mEmail)) {
// Account exists, return true if the password matches.
return pieces[1].equals(mPassword);
}
}
// TODO: register the new account here.
return true;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
finish();
} else {
mPasswordView.setError(getString(R.string.error_incorrect_password));
mPasswordView.requestFocus();
}
}
@Override
protected void onCancelled() {
mAuthTask = null;
showProgress(false);
}
}
}

View File

@ -0,0 +1,297 @@
package com.example.administrator.myapp;
/**
* Created by 小老宰 on 2018/3/16.
*/
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationConfiguration;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
public class MainActivity extends ActionBarActivity {
private MapView myMapView = null;//地图控件
private BaiduMap myBaiduMap;//百度地图对象
private LocationClient mylocationClient;//定位服务客户对象
private MylocationListener mylistener;//重写的监听类
private Context context;
private double myLatitude;//纬度用于存储自己所在位置的纬度
private double myLongitude;//经度用于存储自己所在位置的经度
private float myCurrentX;
private BitmapDescriptor myIconLocation1;//图标1当前位置的箭头图标
// private BitmapDescriptor myIconLocation2;//图表2,前往位置的中心图标
private MyOrientationListener myOrientationListener;//方向感应器类对象
private MyLocationConfiguration.LocationMode locationMode;//定位图层显示方式
// private MyLocationConfiguration.LocationMode locationMode2;//定位图层显示方式
private LinearLayout myLinearLayout1; //经纬度搜索区域1
private LinearLayout myLinearLayout2; //地址搜索区域2
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// requestWindowFeature(Window.FEATURE_NO_TITLE);
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_main);
this.context = this;
initView();
initLocation();
}
private void initView() {
myMapView = (MapView) findViewById(R.id.baiduMapView);
myBaiduMap = myMapView.getMap();
//根据给定增量缩放地图级别
MapStatusUpdate msu= MapStatusUpdateFactory.zoomTo(18.0f);
myBaiduMap.setMapStatus(msu);
}
private void initLocation() {
locationMode = MyLocationConfiguration.LocationMode.NORMAL;
//定位服务的客户端宿主程序在客户端声明此类并调用目前只支持在主线程中启动
mylocationClient = new LocationClient(this);
mylistener = new MylocationListener();
//注册监听器
mylocationClient.registerLocationListener(mylistener);
//配置定位SDK各配置参数比如定位模式定位时间间隔坐标系类型等
LocationClientOption mOption = new LocationClientOption();
//设置坐标类型
mOption.setCoorType("bd09ll");
//设置是否需要地址信息默认为无地址
mOption.setIsNeedAddress(true);
//设置是否打开gps进行定位
mOption.setOpenGps(true);
//设置扫描间隔单位是毫秒 <1000(1s)定时定位无效
int span = 1000;
mOption.setScanSpan(span);
//设置 LocationClientOption
mylocationClient.setLocOption(mOption);
//初始化图标,BitmapDescriptorFactory是bitmap 描述信息工厂类.
//myIconLocation1 = BitmapDescriptorFactory.fromResource(R.drawable.location_marker);
// myIconLocation2 = BitmapDescriptorFactory.fromResource(R.drawable.icon_target);
//配置定位图层显示方式,三个参数的构造器
MyLocationConfiguration configuration
= new MyLocationConfiguration(locationMode, true, myIconLocation1);
//设置定位图层配置信息只有先允许定位图层后设置定位图层配置信息才会生效参见 setMyLocationEnabled(boolean)
myBaiduMap.setMyLocationConfigeration(configuration);
myOrientationListener = new MyOrientationListener(context);
//通过接口回调来实现实时方向的改变
myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
@Override
public void onOrientationChanged(float x) {
myCurrentX = x;
}
});
}
/*
*创建菜单操作
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_item, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
/*
*第一个功能返回自己所在的位置箭头表示
*/
case R.id.menu_item_mylocation://返回当前位置
getLocationByLL(myLatitude, myLongitude);
break;
/*
*第二个功能根据经度和纬度前往位置
*/
case R.id.menu_item_llsearch://根据经纬度搜索地点
myLinearLayout1 = (LinearLayout) findViewById(R.id.linearLayout1);
//经纬度输入区域1可见
myLinearLayout1.setVisibility(View.VISIBLE);
final EditText myEditText_lg = (EditText) findViewById(R.id.editText_lg);
final EditText myEditText_la = (EditText) findViewById(R.id.editText_la);
Button button_ll = (Button) findViewById(R.id.button_llsearch);
button_ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final double mylg = Double.parseDouble(myEditText_lg.getText().toString());
final double myla = Double.parseDouble(myEditText_la.getText().toString());
getLocationByLL(myla, mylg);
//隐藏前面经纬度输入区域
myLinearLayout1.setVisibility(View.GONE);
// Toast.makeText(context, "", Toast.LENGTH_SHORT).show();
//隐藏输入法键盘
InputMethodManager imm =(InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
});
break;
/*
*第三个功能根据地址名前往所在的位置
*/
case R.id.menu_item_sitesearch://根据地址搜索
myLinearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
//显示地址搜索区域2
myLinearLayout2.setVisibility(View.VISIBLE);
final EditText myEditText_site = (EditText) findViewById(R.id.editText_site);
Button button_site = (Button) findViewById(R.id.button_sitesearch);
button_site.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String site_str = myEditText_site.getText().toString();
new Thread(new Runnable() {
@Override
public void run() {
AddressToLatitudeLongitude at = new AddressToLatitudeLongitude(site_str);
at.getLatAndLngByAddress();
getLocationByLL(at.getLatitude(), at.getLongitude());
}
}).start();
//隐藏前面地址输入区域
myLinearLayout2.setVisibility(View.GONE);
//隐藏输入法键盘
InputMethodManager imm = (InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
});
break;
}
return super.onOptionsItemSelected(item);
}
/*
*根据经纬度前往
*/
public void getLocationByLL(double la, double lg)
{
//地理坐标的数据结构
LatLng latLng = new LatLng(la, lg);
//描述地图状态将要发生的变化,通过当前经纬度来使地图显示到该位置
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
myBaiduMap.setMapStatus(msu);
}
/*
*定位请求回调接口
*/
public class MylocationListener implements BDLocationListener
{
//定位请求回调接口
private boolean isFirstIn=true;
//定位请求回调函数,这里面会得到定位信息
@Override
public void onReceiveLocation(BDLocation bdLocation) {
//BDLocation 回调的百度坐标类内部封装了如经纬度半径等属性信息
//MyLocationData 定位数据,定位数据建造器
/*
* 可以通过BDLocation配置如下参数
* 1.accuracy 定位精度
* 2.latitude 百度纬度坐标
* 3.longitude 百度经度坐标
* 4.satellitesNum GPS定位时卫星数目 getSatelliteNumber() gps定位结果时获取gps锁定用的卫星数
* 5.speed GPS定位时速度 getSpeed()获取速度仅gps定位结果时有速度信息单位公里/小时默认值0.0f
* 6.direction GPS定位时方向角度
* */
myLatitude = bdLocation.getLatitude();
myLongitude = bdLocation.getLongitude();
MyLocationData data = new MyLocationData.Builder()
.direction(myCurrentX)//设定图标方向
.accuracy(bdLocation.getRadius())//getRadius 获取定位精度,默认值0.0f
.latitude(myLatitude)//百度纬度坐标
.longitude(myLongitude)//百度经度坐标
.build();
//设置定位数据, 只有先允许定位图层后设置数据才会生效参见 setMyLocationEnabled(boolean)
myBaiduMap.setMyLocationData(data);
//判断是否为第一次定位,是的话需要定位到用户当前位置
if (isFirstIn) {
//根据当前所在位置经纬度前往
getLocationByLL(myLatitude, myLongitude);
isFirstIn = false;
//提示当前所在地址信息
// Toast.makeText(context, bdLocation.getAddrStr(), Toast.LENGTH_SHORT).show();
}
}
}
/*
*定位服务的生命周期达到节省
*/
@Override
protected void onStart() {
super.onStart();
//开启定位显示位置图标
myBaiduMap.setMyLocationEnabled(true);
if(!mylocationClient.isStarted())
{
mylocationClient.start();
}
myOrientationListener.start();
// getLocationByLL(117.11,40.2);
}
@Override
protected void onStop() {
super.onStop();
//停止定位
myBaiduMap.setMyLocationEnabled(false);
mylocationClient.stop();
myOrientationListener.stop();
}
@Override
protected void onResume() {
super.onResume();
myMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
myMapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
myMapView.onDestroy();
}
}

View File

@ -0,0 +1,82 @@
package com.example.administrator.myapp;
/**
* Created by 小老宰 on 2018/3/16.
*/
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
public class MyOrientationListener implements SensorEventListener{
private SensorManager mSensorManager;
private Sensor mSensor;
private Context mContext;
private float lastX;
private OnOrientationListener mOnOrientationListener;
public MyOrientationListener(Context context)
{
this.mContext=context;
}
public void start()
{
mSensorManager= (SensorManager) mContext
.getSystemService(Context.SENSOR_SERVICE);
if(mSensorManager!= null)
{
//获得方向传感器
mSensor=mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
}
//判断是否有方向传感器
if(mSensor!=null)
{
//注册监听器
mSensorManager.registerListener(this,mSensor,SensorManager.SENSOR_DELAY_UI);
}
}
public void stop()
{
mSensorManager.unregisterListener(this);
}
//方向改变
@Override
public void onSensorChanged(SensorEvent event) {
if(event.sensor.getType()==Sensor.TYPE_ORIENTATION)
{
float x=event.values[SensorManager.DATA_X];
if(Math.abs(x-lastX)>1.0)
{
if(mOnOrientationListener!=null)
{
mOnOrientationListener.onOrientationChanged(x);
}
}
lastX=x;
}
}
public void setOnOrientationListener(OnOrientationListener listener)
{
mOnOrientationListener=listener;
}
public interface OnOrientationListener
{
void onOrientationChanged(float x);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
}

View File

@ -0,0 +1,35 @@
package com.example.administrator.myapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class func_page extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_func_page);
findViewById(R.id.locate_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(func_page.this,MainActivity.class));
}
});
findViewById(R.id.address_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(func_page.this,my_address_page.class));
}
});
}
}

View File

@ -0,0 +1,23 @@
package com.example.administrator.myapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class get_goods extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_goods);
findViewById(R.id.return_button4).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(get_goods.this,func_page.class));
}
});
}
}

View File

@ -0,0 +1,105 @@
package com.example.administrator.myapp;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.*;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class goods_2_page extends Activity {
private Spinner myspinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_goods_2_page);
myspinner= (Spinner) findViewById(R.id.goods_list);
// 建立数据源
String[] mItems = getResources().getStringArray(R.array.goods2);
// 建立Adapter并且绑定数据源
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, mItems);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//绑定 Adapter到控件
myspinner.setAdapter(adapter);
//首先确保spinner 已经初始化把这里改一下
myspinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String str=myspinner.getSelectedItem().toString();
/* if ("包裹2".equals(str)){
Intent intent = new Intent(locate_page.this, goods_2_page.class);
startActivity(intent);
finish();
}*/
if (getResources().getStringArray(R.array.goods)[0].equals(str)){
Intent intent = new Intent(goods_2_page.this,locate_page.class );
startActivity(intent);
finish();
/* for(int i=1;i<(getResources().getStringArray(R.array.goods)).length;i++){
if (getResources().getStringArray(R.array.goods)[i].equals(str)){
String temp = getResources().getStringArray(R.array.goods)[0];
getResources().getStringArray(R.array.goods)[0] = getResources().getStringArray(R.array.goods)[i];
getResources().getStringArray(R.array.goods)[i] = temp;
Intent intent = new Intent(locate_page.this, goods_2_page.class);
startActivity(intent);
finish();
}*/
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
findViewById(R.id.return_button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//startActivity(new Intent(func_page.this,locate_page.class));
finish();
}
});
}
public void showdialog(View view)
{
//Toast.makeText(this,"clickme",Toast.LENGTH_LONG).show();
android.support.v7.app.AlertDialog.Builder alertdialogbuilder=new android.support.v7.app.AlertDialog.Builder(this);
alertdialogbuilder.setMessage("确认收货?");
alertdialogbuilder.setPositiveButton("确定", click1);
alertdialogbuilder.setNegativeButton("取消", click2);
android.support.v7.app.AlertDialog alertdialog1=alertdialogbuilder.create();
alertdialog1.show();
}
private DialogInterface.OnClickListener click1=new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface arg0,int arg1)
{
// android.os.Process.killProcess(android.os.Process.myPid());
startActivity(new Intent(goods_2_page.this,get_goods.class));
}
};
private DialogInterface.OnClickListener click2=new DialogInterface.OnClickListener()
{@Override
public void onClick(DialogInterface arg0,int arg1)
{
arg0.cancel();
}
};
}

View File

@ -0,0 +1,110 @@
package com.example.administrator.myapp;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class locate_page extends Activity {
private Spinner myspinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locate_page);
myspinner= (Spinner) findViewById(R.id.goods_list);
// 建立数据源
String[] mItems = getResources().getStringArray(R.array.goods);
// 建立Adapter并且绑定数据源
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, mItems);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//绑定 Adapter到控件
myspinner.setAdapter(adapter);
//首先确保spinner 已经初始化把这里改一下
myspinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String str=myspinner.getSelectedItem().toString();
/* if ("包裹2".equals(str)){
Intent intent = new Intent(locate_page.this, goods_2_page.class);
startActivity(intent);
finish();
}*/
if (getResources().getStringArray(R.array.goods)[1].equals(str)){
Intent intent = new Intent(locate_page.this, goods_2_page.class);
startActivity(intent);
finish();
/* for(int i=1;i<(getResources().getStringArray(R.array.goods)).length;i++){
if (getResources().getStringArray(R.array.goods)[i].equals(str)){
String temp = getResources().getStringArray(R.array.goods)[0];
getResources().getStringArray(R.array.goods)[0] = getResources().getStringArray(R.array.goods)[i];
getResources().getStringArray(R.array.goods)[i] = temp;
Intent intent = new Intent(locate_page.this, goods_2_page.class);
startActivity(intent);
finish();
}*/
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
/* findViewById(R.id.get_goods).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(locate_page.this,get_goods.class));
}
});*/
findViewById(R.id.return_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
public void showdialog(View view)
{
//Toast.makeText(this,"clickme",Toast.LENGTH_LONG).show();
AlertDialog.Builder alertdialogbuilder=new AlertDialog.Builder(this);
alertdialogbuilder.setMessage("确认收货?");
alertdialogbuilder.setPositiveButton("确定", click1);
alertdialogbuilder.setNegativeButton("取消", click2);
AlertDialog alertdialog1=alertdialogbuilder.create();
alertdialog1.show();
}
private DialogInterface.OnClickListener click1=new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface arg0,int arg1)
{
// android.os.Process.killProcess(android.os.Process.myPid());
startActivity(new Intent(locate_page.this,get_goods.class));
}
};
private DialogInterface.OnClickListener click2=new DialogInterface.OnClickListener()
{@Override
public void onClick(DialogInterface arg0,int arg1)
{
arg0.cancel();
}
};
}

View File

@ -0,0 +1,21 @@
package com.example.administrator.myapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
public class my_address_page extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_address_page);
findViewById(R.id.return_button3).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//startActivity(new Intent(func_page.this,locate_page.class));
finish();
}
});
}
}

View File

@ -0,0 +1,350 @@
package com.example.administrator.myapp;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.CursorLoader;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.READ_CONTACTS;
/**
* A login screen that offers login via email/password.
*/
public class register_page extends AppCompatActivity implements LoaderCallbacks<Cursor> {
/**
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;
/**
* A dummy authentication store containing known user names and passwords.
* TODO: remove after connecting to a real authentication system.
*/
private static final String[] DUMMY_CREDENTIALS = new String[]{
"foo@example.com:hello", "bar@example.com:world"
};
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/
private UserLoginTask mAuthTask = null;
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_page);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
populateAutoComplete();
mPasswordView = (EditText) findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress);
}
private void populateAutoComplete() {
if (!mayRequestContacts()) {
return;
}
getLoaderManager().initLoader(0, null, this);
}
private boolean mayRequestContacts() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
return true;
}
if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE)
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onClick(View v) {
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
}
});
} else {
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
}
return false;
}
/**
* Callback received when a permissions request has been completed.
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == REQUEST_READ_CONTACTS) {
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
populateAutoComplete();
}
}
}
/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/
private void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(email)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
} else if (!isEmailValid(email)) {
mEmailView.setError(getString(R.string.error_invalid_email));
focusView = mEmailView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
showProgress(true);
mAuthTask = new UserLoginTask(email, password);
mAuthTask.execute((Void) null);
}
}
private boolean isEmailValid(String email) {
//TODO: Replace this with your own logic
return email.contains("@");
}
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
return password.length() > 4;
}
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
});
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mProgressView.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
List<String> emails = new ArrayList<>();
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
emails.add(cursor.getString(ProfileQuery.ADDRESS));
cursor.moveToNext();
}
addEmailsToAutoComplete(emails);
}
@Override
public void onLoaderReset(Loader<Cursor> cursorLoader) {
}
private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
ArrayAdapter<String> adapter =
new ArrayAdapter<>(register_page.this,
android.R.layout.simple_dropdown_item_1line, emailAddressCollection);
mEmailView.setAdapter(adapter);
}
private interface ProfileQuery {
String[] PROJECTION = {
ContactsContract.CommonDataKinds.Email.ADDRESS,
ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
};
int ADDRESS = 0;
int IS_PRIMARY = 1;
}
/**
* Represents an asynchronous login/registration task used to authenticate
* the user.
*/
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
private final String mEmail;
private final String mPassword;
UserLoginTask(String email, String password) {
mEmail = email;
mPassword = password;
}
@Override
protected Boolean doInBackground(Void... params) {
// TODO: attempt authentication against a network service.
try {
// Simulate network access.
Thread.sleep(2000);
} catch (InterruptedException e) {
return false;
}
for (String credential : DUMMY_CREDENTIALS) {
String[] pieces = credential.split(":");
if (pieces[0].equals(mEmail)) {
// Account exists, return true if the password matches.
return pieces[1].equals(mPassword);
}
}
// TODO: register the new account here.
return true;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
finish();
} else {
mPasswordView.setError(getString(R.string.error_incorrect_password));
mPasswordView.requestFocus();
}
}
@Override
protected void onCancelled() {
mAuthTask = null;
showProgress(false);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/func"
tools:context="com.example.administrator.myapp.func_page">
<LinearLayout
android:layout_width="395dp"
android:layout_height="587dp"
android:orientation="vertical"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
<Button
android:id="@+id/locate_button"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="120dp"
android:layout_marginTop="200dp"
android:text="定位" />
<Button
android:id="@+id/address_button"
android:layout_width="150dp"
android:layout_marginTop="0dp"
android:layout_marginLeft="120dp"
android:layout_height="wrap_content"
android:text="我的地址" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.myapp.get_goods">
<LinearLayout
android:layout_width="410dp"
android:layout_height="603dp"
android:orientation="horizontal"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="1dp"
android:weightSum="1">
<Button
android:id="@+id/return_button4"
android:layout_width="77dp"
android:layout_height="wrap_content"
android:text="返回" />
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView2"
android:layout_width="wrap_content"
android:layout_marginTop="120dp"
android:layout_marginLeft="90dp"
android:layout_height="wrap_content"
android:background="@null"
android:text="收货成功!" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.myapp.locate_page"
android:background="@drawable/map_simulation2">
<android.support.constraint.ConstraintLayout
android:layout_width="0dp"
android:layout_height="0dp"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
</android.support.constraint.ConstraintLayout>
<LinearLayout
android:layout_width="395dp"
android:layout_height="587dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<Button
android:id="@+id/return_button2"
android:layout_width="58dp"
android:layout_height="39dp"
android:layout_marginTop="15dp"
android:text="返回" />
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@null"
android:text="快递员电话1383838438" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="117dp"
android:layout_height="73dp"
android:layout_marginLeft="135dp"
android:layout_marginTop="425dp"
android:orientation="vertical">
<Button
android:id="@+id/get_goods"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="确认收货"
android:onClick="showdialog"/>
</LinearLayout>
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="200dp"
android:layout_height="65dp"
android:layout_marginLeft="-250dp"
android:layout_marginTop="0dp"
android:background="@null"
android:text="预计到达时间:一小时" />
<Spinner
android:id="@+id/goods_list"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:entries="@array/goods2"
android:spinnerMode="dropdown" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.myapp.locate_page"
android:background="@drawable/map_simulation">
<LinearLayout
android:layout_width="395dp"
android:layout_height="587dp"
android:orientation="vertical"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
<Button
android:id="@+id/return_button"
android:layout_width="58dp"
android:layout_height="39dp"
android:layout_marginTop="5dp"
android:text="返回" />
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="快递员电话1383838438"
android:background="@null"
android:layout_marginTop="15dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="117dp"
android:layout_height="73dp"
android:layout_marginTop="425dp"
android:layout_marginLeft="135dp"
android:orientation="vertical">
<Button
android:id="@+id/get_goods"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="确认收货"
android:onClick="showdialog"/>
</LinearLayout>
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="200dp"
android:layout_height="65dp"
android:layout_marginTop="0dp"
android:layout_marginLeft="-250dp"
android:background="@null"
android:text="预计到达时间:一小时" />
<Spinner
android:id="@+id/goods_list"
android:layout_width="151dp"
android:layout_height="wrap_content"
android:spinnerMode="dropdown"
android:entries="@array/goods"/>
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,98 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/login"
tools:context="com.example.administrator.myapp.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"/>
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="250dp">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="70dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/login_button"
style="?android:textAppearanceSmall"
android:layout_width="118dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:text="登录"
android:textStyle="bold" />
<Button
android:id="@+id/register_button"
style="?android:textAppearanceSmall"
android:layout_width="118dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:text="注册"
android:textStyle="bold" />
</LinearLayout>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:id="@+id/linearLayout1"
android:visibility="gone"
>
<EditText
android:layout_width="120dp"
android:layout_height="match_parent"
android:hint="经度"
android:id="@+id/editText_lg" />
<EditText
android:layout_width="120dp"
android:layout_height="match_parent"
android:hint="纬度"
android:id="@+id/editText_la" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="前往"
android:id="@+id/button_llsearch"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:id="@+id/linearLayout2"
android:visibility="gone"
>
<EditText
android:layout_width="240dp"
android:layout_height="match_parent"
android:hint="地址"
android:id="@+id/editText_site" />
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="前往"
android:id="@+id/button_sitesearch"/>
</LinearLayout>
<com.baidu.mapapi.map.MapView
android:id="@+id/baiduMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
</LinearLayout>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/edit"
tools:context="com.example.administrator.myapp.get_goods">
<LinearLayout
android:layout_width="0dp"
android:layout_height="52dp"
android:orientation="horizontal"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
<Button
android:id="@+id/return_button3"
android:layout_width="58dp"
android:layout_height="39dp"
android:layout_marginTop="0dp"
android:text="返回" />
</LinearLayout>
<LinearLayout
android:layout_width="415dp"
android:layout_height="190dp"
android:orientation="vertical"
android:weightSum="1"
tools:layout_editor_absoluteX="-6dp"
tools:layout_editor_absoluteY="42dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<EditText
android:id="@+id/autoCompleteTextView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_weight="0.09"
android:text="宰大军" />
<EditText
android:id="@+id/autoCompleteTextView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginLeft="70dp"
android:layout_marginTop="40dp"
android:text="电话号码1383838438" />
</LinearLayout>
<LinearLayout
android:layout_width="414dp"
android:layout_height="67dp"
android:orientation="horizontal"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="108dp">
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView4"
android:layout_width="match_parent"
android:background="@null"
android:layout_height="55dp"
android:layout_marginLeft="20dp"
android:text="湖南省长沙市开福区福元路一号2-4" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="95dp"
android:layout_weight="0.08"
android:orientation="horizontal">
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="200dp"
android:text="保存" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="删除" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,80 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/register"
tools:context="com.example.administrator.myapp.register_page"
>
<!-- Login progress -->
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="70dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="用户名"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="密码"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="注册"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.administrator.myapp.MainActivity">
<item
android:id="@+id/menu_item_mylocation"
android:title="我的位置"
app:showAsAction="never" />
<item
android:id="@+id/menu_item_llsearch"
android:title="经纬度搜索"
app:showAsAction="never" />
<item
android:id="@+id/menu_item_sitesearch"
android:title="地址搜索"
app:showAsAction="never" />
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="goods">
<item>包裹1</item>
<item>包裹2</item>
</string-array>
<string-array name="goods2">
<item>包裹2</item>
<item>包裹1</item>
</string-array>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@ -0,0 +1,19 @@
<resources>
<string name="app_name">myApp</string>
<!-- Strings related to login -->
<string name="prompt_email">Email</string>
<string name="prompt_password">Password (optional)</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_sign_in_short">Sign in</string>
<string name="error_invalid_email">This email address is invalid</string>
<string name="error_invalid_password">This password is too short</string>
<string name="error_incorrect_password">This password is incorrect</string>
<string name="error_field_required">This field is required</string>
<string name="permission_rationale">"Contacts permissions are needed for providing email
completions."
</string>
<string name="title_activity_register">Sign in</string>
<string name="title_activity_register_page">Sign in</string>
<string name="title_activity_locate_page">Map</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -0,0 +1,22 @@
<resources>
<!--
TODO: Before you release your application, you need a Google Maps API key.
To do this, you can either add your release key credentials to your existing
key, or create a new key.
Note that this file specifies the API key for the release build target.
If you have previously set up a key for the debug target with the debug signing certificate,
you will also need to set up a key for your release certificate.
Follow the directions here:
https://developers.google.com/maps/documentation/android/signup
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
YOUR_KEY_HERE
</string>
</resources>

View File

@ -0,0 +1,17 @@
package com.example.administrator.myapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Jan 17 10:51:05 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

160
handsomejun/myApp1/myApp/gradlew vendored Normal file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
handsomejun/myApp1/myApp/gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
include ':app'