Compare commits
No commits in common. 'master' and 'syd_Branch' have entirely different histories.
master
...
syd_Branch
Before Width: | Height: | Size: 1.1 MiB |
@ -1,9 +0,0 @@
|
|||||||
*.iml
|
|
||||||
.gradle
|
|
||||||
/local.properties
|
|
||||||
/.idea/workspace.xml
|
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
|
||||||
/build
|
|
||||||
/captures
|
|
||||||
.externalNativeBuild
|
|
@ -1,3 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="11" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<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>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="central" />
|
|
||||||
<option name="name" value="Maven Central repository" />
|
|
||||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="jboss.community" />
|
|
||||||
<option name="name" value="JBoss Community repository" />
|
|
||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="BintrayJCenter" />
|
|
||||||
<option name="name" value="BintrayJCenter" />
|
|
||||||
<option name="url" value="https://jcenter.bintray.com/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="Google" />
|
|
||||||
<option name="name" value="Google" />
|
|
||||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
|
||||||
</remote-repository>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1 +0,0 @@
|
|||||||
/build
|
|
@ -1,35 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 23
|
|
||||||
buildToolsVersion '25.0.2'
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId 'com.example.cauc.falldetecion'
|
|
||||||
minSdkVersion 23
|
|
||||||
targetSdkVersion 23
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api fileTree(include: ['*.jar'], dir: 'libs')
|
|
||||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
|
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
|
||||||
})
|
|
||||||
api 'com.android.support:appcompat-v7:23.4.0'
|
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
api 'com.android.support:design:23.2.0'
|
|
||||||
api 'de.hdodenhof:circleimageview:2.1.0'
|
|
||||||
api 'com.github.zcweng:switch-button:0.0.3@aar'
|
|
||||||
api files('libs/AMap3DMap_4.1.3_AMapLocation_3.2.0_20161208.jar')
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# By default, the flags in this file are appended to flags specified
|
|
||||||
# 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 *;
|
|
||||||
#}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
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.wellxiang.falldetecion", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
|
|
||||||
public class AlertDialogFragment extends DialogFragment {
|
|
||||||
private TextView textView;
|
|
||||||
private AlertDialog.Builder builder;
|
|
||||||
private AlertDialog alertDialog;
|
|
||||||
private Timer timer;
|
|
||||||
private Handler handler;
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
textView = new TextView(getContext());
|
|
||||||
builder = new AlertDialog.Builder(getActivity())
|
|
||||||
.setTitle("跌倒警报")
|
|
||||||
.setView(textView)
|
|
||||||
.setMessage("检测到跌倒发生,是否发出警报?")
|
|
||||||
.setIcon(R.drawable.ic_warning)
|
|
||||||
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
alertDialog = builder.create();
|
|
||||||
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
|
||||||
countDown();
|
|
||||||
handler = new Handler(){
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
if(msg.what > 0){
|
|
||||||
Log.v("time", msg.what + "");
|
|
||||||
//动态显示倒计时
|
|
||||||
textView.setText(" " + msg.what + "秒后自动报警");
|
|
||||||
}else{
|
|
||||||
//倒计时结束自动关闭
|
|
||||||
if(alertDialog != null){
|
|
||||||
alertDialog.dismiss();
|
|
||||||
Log.d("Shawn","alertDialog.dismiss()");
|
|
||||||
}
|
|
||||||
timer.cancel();
|
|
||||||
Log.d("Shawn", "timer.cancel()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return alertDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void countDown(){
|
|
||||||
|
|
||||||
Log.d("Shawn", "CountDown()");
|
|
||||||
timer = new Timer();
|
|
||||||
TimerTask timerTask = new TimerTask() {
|
|
||||||
int countTime = 8;
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (countTime > 0){
|
|
||||||
countTime --;
|
|
||||||
}
|
|
||||||
Message msg = handler.obtainMessage();
|
|
||||||
msg.what = countTime;
|
|
||||||
handler.sendMessage(msg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
timer.schedule(timerTask, 100, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,158 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
|
|
||||||
public class Fall{
|
|
||||||
|
|
||||||
private float highThresholdValue;
|
|
||||||
private float lowThresholdValue;
|
|
||||||
// private int SENSOR_RATE;
|
|
||||||
private boolean isFell;
|
|
||||||
public static float[] svmData;
|
|
||||||
public static float[] svmFilteringData;
|
|
||||||
public static int svmCount = 0;
|
|
||||||
public static final String TAG = "cauc";
|
|
||||||
|
|
||||||
|
|
||||||
public Fall(){
|
|
||||||
svmData = new float[150];
|
|
||||||
svmFilteringData = new float[150];
|
|
||||||
isFell = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
设置阈值
|
|
||||||
*/
|
|
||||||
public void setThresholdValue(float highThreshold, float lowThreshold){
|
|
||||||
this.highThresholdValue = highThreshold;
|
|
||||||
this.lowThresholdValue = lowThreshold;
|
|
||||||
Log.d(TAG, highThreshold + " " + lowThreshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
设置传感器采样率
|
|
||||||
*/
|
|
||||||
// public void setSENSOR_RATE(int sensor_rate){
|
|
||||||
// SENSOR_RATE = sensor_rate;
|
|
||||||
// }
|
|
||||||
/*
|
|
||||||
跌倒检测
|
|
||||||
*/
|
|
||||||
public void fallDetection(){
|
|
||||||
Log.d(TAG, "Fall.fallDetection()");
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
boolean running = true;
|
|
||||||
while(running){
|
|
||||||
//阈值法
|
|
||||||
for(int i = 0; i < svmFilteringData.length; i++){
|
|
||||||
if(svmFilteringData[i] <= lowThresholdValue){
|
|
||||||
if(i < svmFilteringData.length-10){
|
|
||||||
for (int j = i; j < i + 10; j++) {
|
|
||||||
if (svmFilteringData[j] >= highThresholdValue) {
|
|
||||||
running = false;
|
|
||||||
setFell(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
for (int j = i; j < svmFilteringData.length; j++) {
|
|
||||||
if (svmFilteringData[j] >= highThresholdValue) {
|
|
||||||
running = false;
|
|
||||||
setFell(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int k = 0; k < (10-(svmFilteringData.length - i)); k++){
|
|
||||||
if (svmFilteringData[k] >= highThresholdValue) {
|
|
||||||
running = false;
|
|
||||||
setFell(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
3s内svm原始数据收集
|
|
||||||
*/
|
|
||||||
public static void svmCollector(float svm){
|
|
||||||
|
|
||||||
if(svmCount < svmData.length){
|
|
||||||
svmData[svmCount] = svm;
|
|
||||||
}else{
|
|
||||||
svmCount = 0;
|
|
||||||
svmData[svmCount] = svm;
|
|
||||||
}
|
|
||||||
svmCount++;
|
|
||||||
// Log.d(TAG, "Fall.svmCollector" + svmData[svmCount]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
svm中值滤波
|
|
||||||
*/
|
|
||||||
public static void setSvmFilteringData(){
|
|
||||||
//中值滤波取的三个值
|
|
||||||
float s1, s2, s3, temp;
|
|
||||||
//冒泡排序
|
|
||||||
for (int i = 0; i < svmFilteringData.length-1; i++){
|
|
||||||
if(i == 0){
|
|
||||||
s1 = svmData[i];
|
|
||||||
s2 = svmData[i + 1];
|
|
||||||
s3 = svmData[i + 2];
|
|
||||||
}else if(i < svmFilteringData.length-2){
|
|
||||||
s1 = svmData[i - 1];
|
|
||||||
s2 = svmData[i];
|
|
||||||
s3 = svmData[i + 1];
|
|
||||||
}else{
|
|
||||||
s1 = svmData[i - 1];
|
|
||||||
s2 = svmData[i];
|
|
||||||
s3 = svmData[0];
|
|
||||||
}
|
|
||||||
if(s1 > s2){
|
|
||||||
temp = s1;
|
|
||||||
s1 = s2;
|
|
||||||
s2 = temp;
|
|
||||||
}
|
|
||||||
if(s2 > s3){
|
|
||||||
temp = s2;
|
|
||||||
s2 = s3;
|
|
||||||
s3 = temp;
|
|
||||||
}
|
|
||||||
svmFilteringData[i] = s2;
|
|
||||||
Log.d(TAG, s1 + " " + s2 + " " + s3);
|
|
||||||
// Log.d(TAG, "Fall.setSvmFilteringData" + svmFilteringData[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFell() {
|
|
||||||
// Log.e(TAG, "isFELL" + isFell);
|
|
||||||
return isFell;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFell(boolean fell) {
|
|
||||||
isFell = fell;
|
|
||||||
// Log.e(TAG, "setFELL" + isFell);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cleanData(){
|
|
||||||
Log.d(TAG , "Fall.clean()");
|
|
||||||
for (int i = 0; i < svmData.length; i++){
|
|
||||||
svmData[i] = 0;
|
|
||||||
}
|
|
||||||
//中值滤波
|
|
||||||
for (int i = 0; i < svmFilteringData.length; i++){
|
|
||||||
svmFilteringData[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,213 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
public class FallDetectionService extends Service {
|
|
||||||
|
|
||||||
private FallSensorManager fallSensorManager;
|
|
||||||
public Fall fall;
|
|
||||||
private final int FELL = 0;
|
|
||||||
private final int TIME = 1;
|
|
||||||
private boolean running = false;
|
|
||||||
private TextView countingView;
|
|
||||||
private Dialog dialog;
|
|
||||||
private Timer timer;
|
|
||||||
private final String TAG = "FallDetection";
|
|
||||||
private DetectThread detectThread;
|
|
||||||
private IntentFilter intentFilter;
|
|
||||||
private LocalBroadcastManager localBroadcastManager;
|
|
||||||
private FallLocalReceiver fallLocalReceiver;
|
|
||||||
|
|
||||||
public FallDetectionService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
// TODO: Return the communication channel to the service.
|
|
||||||
throw new UnsupportedOperationException("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
Log.d(TAG, "FallDetectionService.onCreate()");
|
|
||||||
|
|
||||||
fallSensorManager = new FallSensorManager(this);
|
|
||||||
fallSensorManager.initSensor();
|
|
||||||
fallSensorManager.registerSensor();
|
|
||||||
fall = new Fall();
|
|
||||||
fall.setThresholdValue(25,5);
|
|
||||||
running = true;
|
|
||||||
//在通知栏上显示服务运行
|
|
||||||
showInNotification();
|
|
||||||
|
|
||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
|
||||||
intentFilter = new IntentFilter();
|
|
||||||
intentFilter.addAction("com.broadcast.FALL_LOCAL_BROADCAST");
|
|
||||||
fallLocalReceiver = new FallLocalReceiver();
|
|
||||||
localBroadcastManager.registerReceiver(fallLocalReceiver, intentFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
Log.d(TAG, "FallDetectionService.onStartCommand");
|
|
||||||
detectThread = new DetectThread();
|
|
||||||
detectThread.start();
|
|
||||||
return super.onStartCommand(intent, flags, startId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
fallSensorManager.unregisterSensor();
|
|
||||||
localBroadcastManager.unregisterReceiver(fallLocalReceiver);
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
//开一个线程用于检测跌倒
|
|
||||||
class DetectThread extends Thread{
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
fall.fallDetection();
|
|
||||||
Log.d(TAG, "DetectThread.start()");
|
|
||||||
while (running) {
|
|
||||||
if (fall.isFell()) {
|
|
||||||
Log.e(TAG, "跌倒了");
|
|
||||||
running = false;
|
|
||||||
Message msg = handler.obtainMessage();
|
|
||||||
msg.what = FELL;
|
|
||||||
handler.sendMessage(msg);
|
|
||||||
fall.setFell(false);
|
|
||||||
fall.cleanData();
|
|
||||||
stopSelf();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Handler handler = new Handler(){
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
switch(msg.what){
|
|
||||||
case FELL:
|
|
||||||
Log.e(TAG, "FELL");
|
|
||||||
//报警
|
|
||||||
showAlertDialog();
|
|
||||||
Intent intent = new Intent("com.broadcast.FALL_LOCAL_BROADCAST");
|
|
||||||
localBroadcastManager.sendBroadcast(intent);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TIME:
|
|
||||||
if(msg.arg1 > 0){
|
|
||||||
//动态显示倒计时
|
|
||||||
countingView.setText(" "
|
|
||||||
+ msg.arg1 + "秒后自动报警");
|
|
||||||
}else{
|
|
||||||
//倒计时结束自动关闭
|
|
||||||
if(dialog != null){
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
timer.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
弹窗报警
|
|
||||||
*/
|
|
||||||
private void showAlertDialog() {
|
|
||||||
countingView = new TextView(getApplicationContext());
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
|
||||||
getApplicationContext());
|
|
||||||
builder.setTitle("跌倒警报");
|
|
||||||
builder.setView(countingView);
|
|
||||||
builder.setMessage("检测到跌倒发生,是否发出警报?");
|
|
||||||
builder.setIcon(R.drawable.ic_warning);
|
|
||||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
timer.cancel();
|
|
||||||
dialog.dismiss();
|
|
||||||
running = true;
|
|
||||||
Log.d(TAG, running + "");
|
|
||||||
detectThread.interrupt();
|
|
||||||
detectThread = null;
|
|
||||||
if(detectThread == null){
|
|
||||||
detectThread = new DetectThread();
|
|
||||||
detectThread.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog = builder.create();
|
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
|
||||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
|
||||||
countDown();
|
|
||||||
dialog.show();
|
|
||||||
Log.d(TAG, "dialog.create()");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
倒计时
|
|
||||||
*/
|
|
||||||
private void countDown() {
|
|
||||||
timer = new Timer();
|
|
||||||
TimerTask timerTask = new TimerTask() {
|
|
||||||
int countTime = 6;
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if(countTime > 0){
|
|
||||||
countTime --;
|
|
||||||
}
|
|
||||||
Message msgTime = handler.obtainMessage();
|
|
||||||
msgTime.what = TIME;
|
|
||||||
msgTime.arg1 = countTime;
|
|
||||||
handler.sendMessage(msgTime);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
timer.schedule(timerTask, 100, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
在通知栏上显示服务运行
|
|
||||||
*/
|
|
||||||
private void showInNotification() {
|
|
||||||
Intent intent = new Intent(this,MainActivity.class);
|
|
||||||
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
|
|
||||||
Notification notification = new NotificationCompat.Builder(this)
|
|
||||||
.setContentTitle("老人跌到检测")
|
|
||||||
.setContentText("老人跌倒检测正在运行")
|
|
||||||
.setWhen(System.currentTimeMillis())
|
|
||||||
.setSmallIcon(R.drawable.ic_app)
|
|
||||||
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_app))
|
|
||||||
.setContentIntent(pi)
|
|
||||||
.build();
|
|
||||||
startForeground(1,notification);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import com.suke.widget.SwitchButton;
|
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
|
||||||
|
|
||||||
private SwitchButton switchButton;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
View view = inflater.inflate(R.layout.fragment_home,null);
|
|
||||||
switchButton = (SwitchButton) view.findViewById(R.id.switchButton);
|
|
||||||
switchButton.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(SwitchButton view, boolean isChecked) {
|
|
||||||
if(view.isChecked()){
|
|
||||||
Intent startIntent = new Intent(getContext(), FallDetectionService.class);
|
|
||||||
getContext().startService(startIntent);
|
|
||||||
}else{
|
|
||||||
Intent stopIntent = new Intent(getContext(), FallDetectionService.class);
|
|
||||||
getContext().stopService(stopIntent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 835 KiB |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 218 KiB |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 99 B |
Before Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 652 B |
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/appbar"
|
|
||||||
layout="@layout/include_toolbar"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/frame_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_below="@+id/appbar"
|
|
||||||
android:scrollbars="none"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"></FrameLayout>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<android.support.design.widget.NavigationView
|
|
||||||
android:id="@+id/navigation_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="start"
|
|
||||||
app:headerLayout="@layout/navigation_header"
|
|
||||||
app:menu="@menu/drawer"></android.support.design.widget.NavigationView>
|
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<include android:id="@+id/appbar"
|
|
||||||
layout="@layout/include_toolbar"
|
|
||||||
android:title="@string/navigation_place"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
|
||||||
|
|
||||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/map"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
class="com.amap.api.maps.SupportMapFragment" />
|
|
||||||
</FrameLayout>
|
|
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.AppBarLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/appbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:layout_collapseMode="pin"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/map_activity"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
<include android:id="@+id/appbar"
|
|
||||||
layout="@layout/include_toolbar"
|
|
||||||
android:title="@string/navigation_place"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
|
||||||
<com.amap.api.maps.MapView
|
|
||||||
android:id="@+id/map"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
</com.amap.api.maps.MapView>
|
|
||||||
<ToggleButton
|
|
||||||
android:id="@+id/tb"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:textOff="普通地图"
|
|
||||||
android:textOn="卫星地图"
|
|
||||||
android:checked="false"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="250dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/address"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_centerHorizontal="true" />
|
|
||||||
</RelativeLayout>
|
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:background="?attr/colorPrimaryDark"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:src="@mipmap/profile_image"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
|
||||||
</LinearLayout>
|
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
<group android:checkableBehavior="single">
|
|
||||||
<item
|
|
||||||
android:id="@+id/navigation_item_home"
|
|
||||||
android:icon="@drawable/ic_home"
|
|
||||||
android:title="@string/navigation_home"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/navigation_item_place"
|
|
||||||
android:icon="@drawable/ic_place"
|
|
||||||
android:title="@string/navigation_place"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/navigation_item_settings"
|
|
||||||
android:icon="@drawable/ic_settings"
|
|
||||||
android:title="@string/navigation_settings"/>
|
|
||||||
|
|
||||||
</group>
|
|
||||||
</menu>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:id="@+id/id_menu_settings"
|
|
||||||
android:title="@string/navigation_settings"/>
|
|
||||||
</menu>
|
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 10 KiB |
@ -1,6 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
|
||||||
(such as screen margins) for screens with more than 820dp of available width. This
|
|
||||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
|
||||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
|
||||||
</resources>
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="primary">#4C637A</color>
|
|
||||||
<color name="primary_dark">#A2C6EA</color>
|
|
||||||
<color name="primary_light">#CDE6FA</color>
|
|
||||||
<color name="accent">#4C637A</color>
|
|
||||||
<color name="primary_text">#212121</color>
|
|
||||||
<color name="secondary_text">#727272</color>
|
|
||||||
<color name="icons">#FFFFFF</color>
|
|
||||||
<color name="divider">#B6B6B6</color>
|
|
||||||
<color name="window_background">#FFF5F5F5</color>
|
|
||||||
<color name="tab_bgcolor">#eeeeee</color>
|
|
||||||
<color name="home_back">#C4CEB3</color>】
|
|
||||||
<color name="about_content">#AFB79C</color>
|
|
||||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
|
||||||
</resources>
|
|
@ -1,15 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">老人跌倒检测</string>
|
|
||||||
<string name="navigation_home">主页</string>
|
|
||||||
<string name="navigation_place">地图与位置</string>
|
|
||||||
<string name="navigation_settings">设置</string>
|
|
||||||
<string name="navigation_about">关于</string>
|
|
||||||
<string name="appbar_scrolling_view_behavior" translatable="false">android.support.design.widget.AppBarLayout$ScrollingViewBehavior</string>
|
|
||||||
<string name="drawer_open">open</string>
|
|
||||||
<string name="drawer_close">close</string>
|
|
||||||
|
|
||||||
<string-array name="sex">
|
|
||||||
<item>男</item>
|
|
||||||
<item>女</item>
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
|
@ -1,12 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/primary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
|
||||||
<item name="colorAccent">@color/accent</item>
|
|
||||||
<item name="android:windowBackground">@color/window_background</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,49 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="个人信息"
|
|
||||||
android:summary="个人信息"
|
|
||||||
android:key="pre_key_personal_settings">
|
|
||||||
<EditTextPreference
|
|
||||||
android:maxLines="1"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:defaultValue="李奶奶"
|
|
||||||
android:key="pre_key_name"
|
|
||||||
android:title="姓名:"
|
|
||||||
android:summary="请输入姓名"/>
|
|
||||||
<ListPreference
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:key="pre_key_sex"
|
|
||||||
android:title="性别:"
|
|
||||||
android:summary="请选择性别"
|
|
||||||
android:dialogTitle="性别选择"
|
|
||||||
android:entries="@array/sex"
|
|
||||||
android:entryValues="@array/sex"/>
|
|
||||||
<EditTextPreference
|
|
||||||
android:title="年龄"
|
|
||||||
android:summary="请输入年龄"
|
|
||||||
android:key="pre_key_age"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="报警设置"
|
|
||||||
android:summary="报警设置"
|
|
||||||
android:key="pre_key_alert_settings">
|
|
||||||
<RingtonePreference
|
|
||||||
android:title="铃声设置"
|
|
||||||
android:summary="铃声设置"
|
|
||||||
android:showSilent="false"
|
|
||||||
android:key="pre_key_alarm"
|
|
||||||
android:ringtoneType="alarm"/>
|
|
||||||
<SwitchPreference
|
|
||||||
android:title="振动"
|
|
||||||
android:summary="振动开关"
|
|
||||||
android:key="pre_key_vibrate"/>
|
|
||||||
<EditTextPreference
|
|
||||||
android:title="紧急联系人"
|
|
||||||
android:summary="紧急联系人电话"
|
|
||||||
android:key="pre_key_phone"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.cauc.falldetecion;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.4.2'
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
|
||||||
defaultApplicationId = 'com.example.cauc.falldetecion'
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task clean(type: Delete) {
|
|
||||||
delete rootProject.buildDir
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
# 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
|
|
@ -1,6 +0,0 @@
|
|||||||
#Thu Sep 14 17:41:20 CST 2023
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
|
@ -1,160 +0,0 @@
|
|||||||
#!/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 "$@"
|
|
@ -1,90 +0,0 @@
|
|||||||
@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
|
|
@ -1 +0,0 @@
|
|||||||
include ':app'
|
|