diff --git a/DroneAppController/.idea/.name b/DroneAppController/.idea/.name
index 18d4670..f1f4cb3 100644
--- a/DroneAppController/.idea/.name
+++ b/DroneAppController/.idea/.name
@@ -1 +1 @@
-DroneAppController
\ No newline at end of file
+Drone App Controller
\ No newline at end of file
diff --git a/DroneAppController/.idea/gradle.xml b/DroneAppController/.idea/gradle.xml
index 2cbb09b..d57b206 100644
--- a/DroneAppController/.idea/gradle.xml
+++ b/DroneAppController/.idea/gradle.xml
@@ -5,11 +5,11 @@
-
+
diff --git a/DroneAppController/.idea/misc.xml b/DroneAppController/.idea/misc.xml
index 9076de5..34d4245 100644
--- a/DroneAppController/.idea/misc.xml
+++ b/DroneAppController/.idea/misc.xml
@@ -3,8 +3,39 @@
+
+
+
+
+
+
+
+
+
+
+ Abstraction issues
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DroneAppController/.idea/modules.xml b/DroneAppController/.idea/modules.xml
index 1fca609..abb38fc 100644
--- a/DroneAppController/.idea/modules.xml
+++ b/DroneAppController/.idea/modules.xml
@@ -2,8 +2,7 @@
-
-
+
diff --git a/DroneAppController/DroneAppController.iml b/DroneAppController/DroneAppController.iml
deleted file mode 100644
index 2a02201..0000000
--- a/DroneAppController/DroneAppController.iml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/DroneAppController/app/app.iml b/DroneAppController/app/app.iml
index 313241b..418c6aa 100644
--- a/DroneAppController/app/app.iml
+++ b/DroneAppController/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -84,9 +84,9 @@
-
-
+
+
diff --git a/DroneAppController/app/build.gradle b/DroneAppController/app/build.gradle
index 22dbafc..587bf0b 100644
--- a/DroneAppController/app/build.gradle
+++ b/DroneAppController/app/build.gradle
@@ -3,9 +3,10 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
+
defaultConfig {
applicationId "pt.isep.mei.simov.droneappcontroller"
- minSdkVersion 16
+ minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
@@ -16,11 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- productFlavors {
- }
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
+ compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
diff --git a/DroneAppController/app/src/main/AndroidManifest.xml b/DroneAppController/app/src/main/AndroidManifest.xml
index 108209a..7b2c6f9 100644
--- a/DroneAppController/app/src/main/AndroidManifest.xml
+++ b/DroneAppController/app/src/main/AndroidManifest.xml
@@ -25,20 +25,13 @@
-
-
-
-
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/CalibrationActivity.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/CalibrationActivity.java
deleted file mode 100644
index 00bd58a..0000000
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/CalibrationActivity.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package pt.isep.mei.simov.droneappcontroller;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-/**
- * Created by almeida on 23-12-2014.
- */
-
-public class CalibrationActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_calibration);
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_calibration, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
-
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
-
- return super.onOptionsItemSelected(item);
- }
-}
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/Connection.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/Connection.java
index e9f72b8..ed0203c 100644
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/Connection.java
+++ b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/Connection.java
@@ -21,6 +21,11 @@ public class Connection {
String HOST = "aalmeid.ddns.net";
int PORT = 5222;
String SERVICE = "xmppserver";
+
+ /*String HOST = "sibacsimovisep2014.noip.me";
+ int PORT = 5222;
+ String SERVICE = "sibacsimovisep2014";*/
+
String USERNAME = "";
String PASSWORD = "";
@@ -99,6 +104,11 @@ public class Connection {
}
}
+ private boolean closeConnection(){
+ connection.disconnect();
+ return true;
+ }
+
public boolean createAccount (String username, String password){
try {
AccountManager accountManager = connection.getAccountManager();
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ControllerActivity.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ControllerActivity.java
index b9172ec..dee9a3c 100644
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ControllerActivity.java
+++ b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ControllerActivity.java
@@ -2,15 +2,22 @@ package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+import android.widget.TextView;
import android.widget.Toast;
import org.jivesoftware.smack.PacketListener;
@@ -21,31 +28,68 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;
-import java.util.ArrayList;
-
/**
* Created by almeida on 18-12-2014.
*/
-public class ControllerActivity extends Activity {
+public class ControllerActivity extends Activity implements SensorEventListener {
+ private SensorManager sensorManager;
private String to;
private XMPPConnection connection = Connection.getConnection();
- private ArrayList messages = new ArrayList();
+ private int speed;
+ private TextView tv;
+ private Switch onOff;
+ private Switch expertmode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_controller);
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Button left = (Button) findViewById(R.id.buttonLeft);
Button right = (Button) findViewById(R.id.buttonRight);
Button up = (Button) findViewById(R.id.buttonUp);
Button down = (Button) findViewById(R.id.buttonDown);
Button acelerate = (Button) findViewById(R.id.buttonAcelerate);
- Button breake = (Button) findViewById(R.id.buttonBreak);
- Button on_off = (Button) findViewById(R.id.buttonOnOff);
- Button calibration = (Button) findViewById(R.id.buttonCallibration);
+ Button desacelarate = (Button) findViewById(R.id.buttonBreak);
+
+ sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
+
+ sensorManager.registerListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
+ SensorManager.SENSOR_DELAY_GAME);
+
+ tv = (TextView) findViewById(R.id.tv);
+
+ onOff = (Switch) findViewById(R.id.onOff);
+
+
+
+ onOff.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ senMessage("v-"+100);
+ senMessage("v-"+30);
+ speed = 30;
+ } else {
+ senMessage("v-" + 0);
+ speed = 0;
+ }
+ }
+ });
+
+ expertmode = (Switch) findViewById(R.id.expertmode);
+
+ expertmode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!onOff.isChecked()) {
+ expertmode.setChecked(false);
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ });
Bundle b = getIntent().getExtras();
to = b.getString("to");
@@ -55,128 +99,136 @@ public class ControllerActivity extends Activity {
left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "left pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("left");
+ if(onOff.isChecked()) {
+ senMessage("e");
+ }else{
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
}
});
right.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "right pressed!",
- Toast.LENGTH_LONG).show();
+ if (onOff.isChecked()) {
+ senMessage("d");
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ });
- senMessage("rigth");
+ /*acelerate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (onOff.isChecked()) {
+ if (speed < 91) {
+ speed = speed + 10;
+ senMessage("v-" + speed);
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ });*/
+
+ acelerate.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (onOff.isChecked()) {
+ if (speed < 100) {
+ speed = speed + 1;
+ senMessage("v-" + speed);
+ tv.setText(speed+"/100");
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ return true;
+ }
+ });
+
+ /*desacelarate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if(onOff.isChecked()) {
+ if(speed > 9) {
+ speed = speed - 10;
+ senMessage("v-" + speed);
+ }
+ }else{
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ });*/
+
+ desacelarate.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (onOff.isChecked()) {
+ if (speed > 0) {
+ speed = speed - 1;
+ senMessage("v-" + speed);
+ tv.setText(speed+"/100");
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
+ return true;
}
});
up.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "up pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("up");
+ if (onOff.isChecked()) {
+ senMessage("up");
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
}
});
down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "down pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("down");
- }
- });
-
- acelerate.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "acelerate pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("acelerate");
- }
- });
-
- breake.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "break pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("break");
- }
- });
-
- on_off.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(getApplicationContext(), "on_off pressed!",
- Toast.LENGTH_LONG).show();
-
- senMessage("On/Off");
- }
- });
-
- calibration.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(v.getContext());
-
- // set title
- alertDialogBuilder.setTitle("Expert Mode");
-
- // set dialog message
- alertDialogBuilder
- .setMessage("Atention: Expert Mode")
- .setCancelable(false)
- .setPositiveButton("Yes",new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,int id) {
- // if this button is clicked, close
- // current activity
- Intent i = new Intent(getApplicationContext(), ExpertMode.class);
- startActivity(i);
- }
- })
- .setNegativeButton("No",new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,int id) {
- // if this button is clicked, just close
- // the dialog box and do nothing
- dialog.cancel();
- }
- });
-
- // create alert dialog
- AlertDialog alertDialog = alertDialogBuilder.create();
-
- // show it
- alertDialog.show();
-
+ if (onOff.isChecked()) {
+ senMessage("down");
+ } else {
+ Toast.makeText(getApplicationContext(), R.string.turnOn,
+ Toast.LENGTH_LONG).show();
+ }
}
});
}
public void senMessage(String message) {
Message msg = new Message(to, Message.Type.chat);
+ ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
msg.setBody(message);
if (connection != null) {
- connection.sendPacket(msg);
- messages.add(connection.getUser() + ":");
- messages.add(message);
+ if (!(networkInfo != null && networkInfo.isConnected())) {
+ Toast.makeText(getApplicationContext(), R.string.droneConnection, Toast.LENGTH_SHORT).show();
+ finish();
+ }else{
+ connection.sendPacket(msg);
+ }
}
}
public void setConnection(XMPPConnection connection) {
this.connection = connection;
- System.out.println ("connection"+connection);
if (connection != null) {
- // Add a packet listener to get messages sent to us
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
connection.addPacketListener(new PacketListener() {
@Override
@@ -185,34 +237,41 @@ public class ControllerActivity extends Activity {
if (message.getBody() != null) {
String fromName = StringUtils.parseBareAddress(message.getFrom());
Log.i("XMPPChatDemoActivity ", " Text Recieved " + message.getBody() + " from " + fromName);
- messages.add(fromName + ":");
- messages.add(message.getBody());
}
}
}, filter);
}
}
-
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
+ 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 (expertmode.isChecked() && onOff.isChecked()) {
+ if(x > 8){
+ if (speed > 0) {
+ speed = speed - 1;
+ senMessage("v-" + speed);
+ tv.setText(speed + "/100");
+ }
+ } else if(x < 2) {
+ if (speed < 100) {
+ speed = speed + 1;
+ senMessage("v-" + speed);
+ tv.setText(speed+"/100");
+ }
+ }
+ }
+ }
}
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
+ public void onAccuracyChanged(Sensor sensor, int accuracy) {
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
-
- return super.onOptionsItemSelected(item);
}
}
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ExpertMode.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ExpertMode.java
deleted file mode 100644
index 86db95d..0000000
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ExpertMode.java
+++ /dev/null
@@ -1,85 +0,0 @@
-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) {
-
- }
-}
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ListOfDrones.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ListOfDrones.java
index 7f2e2b4..3c40605 100644
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ListOfDrones.java
+++ b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/ListOfDrones.java
@@ -1,12 +1,17 @@
package pt.isep.mei.simov.droneappcontroller;
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.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
+import android.widget.Toast;
import org.jivesoftware.smack.XMPPConnection;
@@ -34,28 +39,43 @@ public class ListOfDrones extends Activity {
String user = b.getString("id");
String passwd = b.getString("passwd");
- Connection c = new Connection(user,passwd);
- users = c.getUsers();
- connection = c.getConnection();
+ try {
+ Connection c = new Connection(user, passwd);
+ users = c.getUsers();
+ connection = c.getConnection();
- listView = (ListView) findViewById( R.id.listOfDrones );
- listAdapter = new ArrayAdapter(getApplicationContext(), R.layout.simplerow);
- listView.setAdapter( listAdapter );
+ listView = (ListView) findViewById(R.id.listOfDrones);
+ listAdapter = new ArrayAdapter(getApplicationContext(), R.layout.simplerow);
+ listView.setAdapter(listAdapter);
- for (int i = 0; i < users.size(); i++){
- listAdapter.add(users.get(i).toString());
- }
-
- listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- Intent i = new Intent(getApplicationContext(), ControllerActivity.class);
- i.putExtra("to", listAdapter.getItem(position));
- startActivity(i);
+ for (int i = 0; i < users.size(); i++) {
+ listAdapter.add(users.get(i).toString());
}
- });
+
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
+
+ if (connection != null) {
+ if (!(networkInfo != null && networkInfo.isConnected())) {
+ Toast.makeText(getApplicationContext(), R.string.internetConnection, Toast.LENGTH_SHORT).show();
+ finish();
+ }else{
+ Intent i = new Intent(getApplicationContext(), ControllerActivity.class);
+ i.putExtra("to", listAdapter.getItem(position));
+ startActivity(i);
+ }
+ }
+ }
+ });
+ }catch (Exception e){
+ Log.e("Authentication Problem", "Some problem with your account", e);
+ finish();
+ }
}
}
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/LoginActivity.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/LoginActivity.java
index 251f28e..1110987 100644
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/LoginActivity.java
+++ b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/LoginActivity.java
@@ -35,7 +35,7 @@ public class LoginActivity extends Activity {
Log.i("XMPP", "Credencials: " + email + " and " + passwd);
if (email.equals("") || passwd.equals("")) {
- Toast.makeText(this, "Por favor preencha os campos de autenticação",
+ Toast.makeText(this, R.string.autField,
Toast.LENGTH_LONG).show();
} else {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -43,10 +43,9 @@ public class LoginActivity extends Activity {
if (!(networkInfo != null && networkInfo.isConnected()))
{
- Toast.makeText(getApplicationContext(), "Não existe conexão à internet. Por favor, ligue o acesso à internet", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getApplicationContext(), R.string.internetConnection, Toast.LENGTH_SHORT).show();
} else{
-
- Intent i=new Intent(this,ListOfDrones.class);
+ Intent i = new Intent(this, ListOfDrones.class);
i.putExtra("id", email);
i.putExtra("passwd", passwd);
this.startActivity(i);
@@ -54,8 +53,8 @@ public class LoginActivity extends Activity {
}
}
- public void registerData (View vw) {
+ /*public void registerData (View vw) {
Intent i = new Intent(this, RegisterActivity.class);
startActivity(i);
- }
+ }*/
}
\ No newline at end of file
diff --git a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/RegisterActivity.java b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/RegisterActivity.java
index e560648..3072be8 100644
--- a/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/RegisterActivity.java
+++ b/DroneAppController/app/src/main/java/pt/isep/mei/simov/droneappcontroller/RegisterActivity.java
@@ -25,7 +25,7 @@ public class RegisterActivity extends Activity {
buttonReg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Connection c = new Connection("admin","adminpassword"); //este user não existe, o registo não está a funcionar com esta conta.
+ Connection c = new Connection("user","passwd");
if (c.createAccount(username.getText().toString(), passwd.getText().toString())){
Toast.makeText(getApplicationContext(), "Registration completed!",
Toast.LENGTH_LONG).show();
diff --git a/DroneAppController/app/src/main/res/drawable-hdpi/ic_launcher.png b/DroneAppController/app/src/main/res/drawable-hdpi/ic_launcher.png
index 96a442e..7628dd2 100644
Binary files a/DroneAppController/app/src/main/res/drawable-hdpi/ic_launcher.png and b/DroneAppController/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/DroneAppController/app/src/main/res/drawable-mdpi/ic_launcher.png b/DroneAppController/app/src/main/res/drawable-mdpi/ic_launcher.png
index 359047d..7628dd2 100644
Binary files a/DroneAppController/app/src/main/res/drawable-mdpi/ic_launcher.png and b/DroneAppController/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/DroneAppController/app/src/main/res/drawable-xhdpi/ic_launcher.png b/DroneAppController/app/src/main/res/drawable-xhdpi/ic_launcher.png
index 71c6d76..7628dd2 100644
Binary files a/DroneAppController/app/src/main/res/drawable-xhdpi/ic_launcher.png and b/DroneAppController/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/DroneAppController/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/DroneAppController/app/src/main/res/drawable-xxhdpi/ic_launcher.png
index 4df1894..7628dd2 100644
Binary files a/DroneAppController/app/src/main/res/drawable-xxhdpi/ic_launcher.png and b/DroneAppController/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/DroneAppController/app/src/main/res/drawable/back.jpg b/DroneAppController/app/src/main/res/drawable/back.jpg
index 199d9c1..38f437f 100644
Binary files a/DroneAppController/app/src/main/res/drawable/back.jpg and b/DroneAppController/app/src/main/res/drawable/back.jpg differ
diff --git a/DroneAppController/app/src/main/res/layout/activity_calibration.xml b/DroneAppController/app/src/main/res/layout/activity_calibration.xml
deleted file mode 100644
index 52b7142..0000000
--- a/DroneAppController/app/src/main/res/layout/activity_calibration.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/DroneAppController/app/src/main/res/layout/activity_controller.xml b/DroneAppController/app/src/main/res/layout/activity_controller.xml
index 4e8b910..6a44075 100644
--- a/DroneAppController/app/src/main/res/layout/activity_controller.xml
+++ b/DroneAppController/app/src/main/res/layout/activity_controller.xml
@@ -9,23 +9,7 @@
-
-
-
-
+
+
+
+
+
+
diff --git a/DroneAppController/app/src/main/res/layout/activity_expert_mode.xml b/DroneAppController/app/src/main/res/layout/activity_expert_mode.xml
deleted file mode 100644
index 2420da6..0000000
--- a/DroneAppController/app/src/main/res/layout/activity_expert_mode.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/DroneAppController/app/src/main/res/layout/activity_list_of_drone.xml b/DroneAppController/app/src/main/res/layout/activity_list_of_drone.xml
index c9091ae..e5d3d40 100644
--- a/DroneAppController/app/src/main/res/layout/activity_list_of_drone.xml
+++ b/DroneAppController/app/src/main/res/layout/activity_list_of_drone.xml
@@ -2,6 +2,7 @@
-
+
\ No newline at end of file
diff --git a/DroneAppController/app/src/main/res/layout/simplerow.xml b/DroneAppController/app/src/main/res/layout/simplerow.xml
index 664ba2c..5c3ffe6 100644
--- a/DroneAppController/app/src/main/res/layout/simplerow.xml
+++ b/DroneAppController/app/src/main/res/layout/simplerow.xml
@@ -1,8 +1,44 @@
+
+
+
\ No newline at end of file
diff --git a/DroneAppController/app/src/main/res/menu/menu_calibration.xml b/DroneAppController/app/src/main/res/menu/menu_calibration.xml
index 48f6d27..af6e9f1 100644
--- a/DroneAppController/app/src/main/res/menu/menu_calibration.xml
+++ b/DroneAppController/app/src/main/res/menu/menu_calibration.xml
@@ -1,7 +1,7 @@
diff --git a/DroneAppController/app/src/main/res/values-pt/strings.xml b/DroneAppController/app/src/main/res/values-pt/strings.xml
index 7922e44..4d61266 100644
--- a/DroneAppController/app/src/main/res/values-pt/strings.xml
+++ b/DroneAppController/app/src/main/res/values-pt/strings.xml
@@ -8,7 +8,15 @@
Controlo
Calibração
Lista de drones
- X Tilt:
- Y Tilt:
+ Atenção: Activar o modo avançado?
+ Modo avançado
+ Por favor preencha os campos de autenticação
+ Não existe conexão à internet. Por favor, ligue o acesso à internet
+ Não existe conexão ao drone.
+ Início de sessão falhou. Por favor, tente novamente
+ Por favor, ligue o drone
+ Ligar/Desligar
+ Sim
+ Não
\ No newline at end of file
diff --git a/DroneAppController/app/src/main/res/values/strings.xml b/DroneAppController/app/src/main/res/values/strings.xml
index 5f34d2d..57ab1f9 100644
--- a/DroneAppController/app/src/main/res/values/strings.xml
+++ b/DroneAppController/app/src/main/res/values/strings.xml
@@ -5,10 +5,17 @@
Hello world!
Settings
Register
- Controlo
- Calibration Activity
+ Control
List Of Drones
- X Tilt:
- Y Tilt:
+ Attention: You wanto to enable the Expert Mode?
+ Expert Mode
+ Please, use your login credentials
+ Network problem. Please, turn on your access to the Internet
+ Drone connection network problem.
+ Autentication failed. Please, try again
+ Please, turn on the drone!
+ On/Off
+ Yes
+ No