Alteração

This commit is contained in:
João Gonçalves 2015-01-02 16:46:40 +00:00
parent 425444a196
commit 48e7fe5d04
20 changed files with 159 additions and 62 deletions

BIN
DroneAppController.rar Normal file

Binary file not shown.

View File

@ -5,11 +5,11 @@
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.2.1" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1" />
<option name="modules">
<set>
<option value="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController" />
<option value="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app" />
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>

View File

@ -3,39 +3,8 @@
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Abstraction issues</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" 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="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -2,7 +2,8 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file:///media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app/app.iml" filepath="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/DroneAppController.iml" filepath="$PROJECT_DIR$/DroneAppController.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$USER_HOME$/Documentos/android/DroneAppController" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
@ -84,9 +84,9 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="asmack-2010.05.07" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="asmack-2010.05.07" level="project" />
</component>
</module>

View File

@ -3,10 +3,9 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "pt.isep.mei.simov.droneappcontroller"
minSdkVersion 15
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
@ -17,9 +16,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
}

View File

@ -35,6 +35,10 @@
android:name=".ListOfDrones"
android:label="@string/title_activity_list_of_drones" >
</activity>
<activity
android:name=".ExpertMode"
android:label="Expert Mode">
</activity>
</application>
</manifest>

View File

@ -1,7 +1,6 @@
package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

View File

@ -1,7 +1,6 @@
package pt.isep.mei.simov.droneappcontroller;
import android.util.Log;
import android.widget.Toast;
import org.jivesoftware.smack.AccountManager;
import org.jivesoftware.smack.ConnectionConfiguration;
@ -10,11 +9,7 @@ import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
import java.lang.InterruptedException;
import java.lang.Runnable;
import java.lang.String;
import java.lang.System;
import java.lang.Thread;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;

View File

@ -138,7 +138,7 @@ public class ControllerActivity extends Activity {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
Intent i = new Intent(getApplicationContext(), CalibrationActivity.class);
Intent i = new Intent(getApplicationContext(), ExpertMode.class);
startActivity(i);
}
})

View File

@ -0,0 +1,85 @@
package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
import org.jivesoftware.smack.packet.Message;
/**
* Created by João on 30-12-2014.
*/
public class ExpertMode extends Activity implements SensorEventListener {
private SensorManager sensorManager;
TextView x_tilt;
TextView y_tilt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expert_mode);
x_tilt=(TextView)findViewById(R.id.x_tilt);
y_tilt=(TextView)findViewById(R.id.y_tilt);
sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
// add listener. The listener will be HelloAndroid (this) class
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_GAME);
}
@Override
public void onSensorChanged(SensorEvent event) {
if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
// assign directions
float x=event.values[0];
float y=event.values[1];
if(x > 1){
x_tilt.setText("Trás");
} else if(x < -1) {
x_tilt.setText("Frente");
}
if(y > 1){
y_tilt.setText("Direita");
}else if(y < -1){
y_tilt.setText("Esquerda");
}
}
}
public void senMessage(String message) {
Message msg = new Message(to, Message.Type.chat);
msg.setBody(message);
if (connection != null) {
connection.sendPacket(msg);
messages.add(connection.getUser() + ":");
messages.add(message);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
}

View File

@ -3,8 +3,6 @@ package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

View File

@ -1,13 +1,11 @@
package pt.isep.mei.simov.droneappcontroller;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

View File

@ -1,17 +1,12 @@
package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.jivesoftware.smack.ConnectionConfiguration;
/**
* Created by almeida on 18-12-2014.
*/

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/x_tilt"
android:id="@+id/x_tilt"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/y_tilt"
android:id="@+id/y_tilt"
android:layout_below="@+id/x_tilt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/back"

View File

@ -8,5 +8,7 @@
<string name="title_activity_main">Controlo</string>
<string name="title_activity_calibration">Calibração</string>
<string name="title_activity_list_of_drones">Lista de drones</string>
<string name="x_tilt">X Tilt: </string>
<string name="y_tilt">Y Tilt: </string>
</resources>

View File

@ -8,5 +8,7 @@
<string name="title_activity_main">Controlo</string>
<string name="title_activity_calibration">Calibration Activity</string>
<string name="title_activity_list_of_drones">List Of Drones</string>
<string name="x_tilt">X Tilt: </string>
<string name="y_tilt">Y Tilt: </string>
</resources>