Drone app with XMPP communication.
This commit is contained in:
parent
2280b6651a
commit
425444a196
@ -84,6 +84,7 @@
|
||||
<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" />
|
||||
</component>
|
||||
|
||||
BIN
DroneAppController/app/libs/asmack-2010.05.07.jar
Normal file
BIN
DroneAppController/app/libs/asmack-2010.05.07.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -24,13 +24,17 @@
|
||||
android:label="@string/title_activity_register" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".ControllerActivity"
|
||||
android:label="@string/title_activity_main" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".CalibrationActivity"
|
||||
android:label="@string/title_activity_calibration" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ListOfDrones"
|
||||
android:label="@string/title_activity_list_of_drones" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@ -6,6 +6,9 @@ import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
/**
|
||||
* Created by almeida on 23-12-2014.
|
||||
*/
|
||||
|
||||
public class CalibrationActivity extends Activity {
|
||||
|
||||
|
||||
@ -1,128 +0,0 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
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 19-12-2014.
|
||||
*/
|
||||
public class ClientXMPP {
|
||||
|
||||
public class XMPPClient extends Activity {
|
||||
|
||||
private ArrayList<String> messages = new ArrayList();
|
||||
private Handler mHandler = new Handler();
|
||||
private SettingsDialog mDialog;
|
||||
private EditText mRecipient;
|
||||
private EditText mSendText;
|
||||
private ListView mList;
|
||||
private XMPPConnection connection;
|
||||
|
||||
/**
|
||||
* Called with the activity is first created.
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
Log.i("XMPPClient", "onCreate called");
|
||||
setContentView(R.layout.main);
|
||||
|
||||
mRecipient = (EditText) this.findViewById(R.id.recipient);
|
||||
Log.i("XMPPClient", "mRecipient = " + mRecipient);
|
||||
mSendText = (EditText) this.findViewById(R.id.sendText);
|
||||
Log.i("XMPPClient", "mSendText = " + mSendText);
|
||||
mList = (ListView) this.findViewById(R.id.listMessages);
|
||||
Log.i("XMPPClient", "mList = " + mList);
|
||||
setListAdapter();
|
||||
|
||||
// Dialog for getting the xmpp settings
|
||||
mDialog = new SettingsDialog(this);
|
||||
|
||||
// Set a listener to show the settings dialog
|
||||
Button setup = (Button) this.findViewById(R.id.setup);
|
||||
setup.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
mDialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Set a listener to send a chat text message
|
||||
Button send = (Button) this.findViewById(R.id.send);
|
||||
send.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
String to = mRecipient.getText().toString();
|
||||
String text = mSendText.getText().toString();
|
||||
|
||||
Log.i("XMPPClient", "Sending text [" + text + "] to [" + to + "]");
|
||||
Message msg = new Message(to, Message.Type.chat);
|
||||
msg.setBody(text);
|
||||
connection.sendPacket(msg);
|
||||
messages.add(connection.getUser() + ":");
|
||||
messages.add(text);
|
||||
setListAdapter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by Settings dialog when a connection is establised with the XMPP server
|
||||
*
|
||||
* @param connection
|
||||
*/
|
||||
public void setConnection
|
||||
(XMPPConnection
|
||||
connection) {
|
||||
this.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() {
|
||||
public void processPacket(Packet packet) {
|
||||
Message message = (Message) packet;
|
||||
if (message.getBody() != null) {
|
||||
String fromName = StringUtils.parseBareAddress(message.getFrom());
|
||||
Log.i("XMPPClient", "Got text [" + message.getBody() + "] from [" + fromName + "]");
|
||||
messages.add(fromName + ":");
|
||||
messages.add(message.getBody());
|
||||
// Add the incoming message to the list view
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
setListAdapter();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, filter);
|
||||
}
|
||||
}
|
||||
|
||||
private void setListAdapter
|
||||
() {
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||
R.layout.multi_line_list_item,
|
||||
messages);
|
||||
mList.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.jivesoftware.smack.AccountManager;
|
||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.Roster;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by almeida on 23-12-2014.
|
||||
*/
|
||||
public class Connection {
|
||||
String HOST = "aalmeid.ddns.net";
|
||||
int PORT = 5222;
|
||||
String SERVICE = "xmppserver";
|
||||
String USERNAME = "";
|
||||
String PASSWORD = "";
|
||||
|
||||
static XMPPConnection connection;
|
||||
final ArrayList <String> usersList = new ArrayList<>();
|
||||
|
||||
public Connection(String user, String password) {
|
||||
this.USERNAME = user;
|
||||
this.PASSWORD = password;
|
||||
setConnection();
|
||||
}
|
||||
|
||||
private void setConnection() {
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Create a connection
|
||||
ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
|
||||
connection = new XMPPConnection(connConfig);
|
||||
try {
|
||||
connection.connect();
|
||||
Log.i("XMPP", "[SettingsDialog] Connected to " + connection.getHost());
|
||||
} catch (XMPPException ex) {
|
||||
Log.e("XMPP", "[SettingsDialog] Failed to connect to " + connection.getHost());
|
||||
Log.e("XMPP", ex.toString());
|
||||
}
|
||||
try {
|
||||
connection.login(USERNAME, PASSWORD);
|
||||
Log.i("XMPP", "Logged in as " + connection.getUser());
|
||||
|
||||
// Set the status to available
|
||||
Presence presence = new Presence(Presence.Type.available);
|
||||
connection.sendPacket(presence);
|
||||
|
||||
Roster roster = connection.getRoster();
|
||||
Collection<RosterEntry> entries = roster.getEntries();
|
||||
|
||||
for (final RosterEntry entry : entries) {
|
||||
|
||||
Log.d("XMPP", "--------------------------------------");
|
||||
Log.d("XMPP", "RosterEntry " + entry);
|
||||
Log.d("XMPP", "User: " + entry.getUser());
|
||||
|
||||
Log.d("XMPP", "Name: " + entry.getName());
|
||||
Log.d("XMPP", "Status: " + entry.getStatus());
|
||||
Log.d("XMPP", "Type: " + entry.getType());
|
||||
Presence entryPresence = roster.getPresence(entry.getUser());
|
||||
Log.d("XMPP", "Presence Status: " + entryPresence.getStatus());
|
||||
Log.d("XMPP", "Presence Type: " + entryPresence.getType());
|
||||
|
||||
Presence.Type type = entryPresence.getType();
|
||||
if (type == Presence.Type.available)
|
||||
Log.d("XMPP", "Presence AVIALABLE");
|
||||
Log.d("XMPP", "Presence : " + entryPresence);
|
||||
|
||||
usersList.add(entry.getUser());
|
||||
}
|
||||
|
||||
latch.countDown();
|
||||
|
||||
} catch (XMPPException ex) {
|
||||
Log.e("XMPP", "Failed to log in as " + USERNAME);
|
||||
Log.e("XMPP", ex.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
|
||||
try{
|
||||
latch.await();
|
||||
}catch(InterruptedException e){
|
||||
Log.e("Error","got interrupted!",e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean createAccount (String username, String password){
|
||||
try {
|
||||
AccountManager accountManager = connection.getAccountManager();
|
||||
accountManager.createAccount(username, password);
|
||||
connection.disconnect();
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
Log.e("Error","problem with create account", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList getUsers(){
|
||||
return usersList;
|
||||
}
|
||||
|
||||
public static XMPPConnection getConnection(){
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
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 {
|
||||
private String to;
|
||||
private XMPPConnection connection = Connection.getConnection();
|
||||
private ArrayList<String> messages = new ArrayList<String>();
|
||||
|
||||
@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);
|
||||
|
||||
Bundle b = getIntent().getExtras();
|
||||
to = b.getString("to");
|
||||
|
||||
setConnection(connection);
|
||||
|
||||
left.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "left pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
senMessage("left");
|
||||
}
|
||||
});
|
||||
|
||||
right.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "right pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
senMessage("rigth");
|
||||
}
|
||||
});
|
||||
|
||||
up.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "up pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
senMessage("up");
|
||||
}
|
||||
});
|
||||
|
||||
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(), CalibrationActivity.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();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
public void processPacket(Packet packet) {
|
||||
Message message = (Message) packet;
|
||||
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;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
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;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by almeida on 18-12-2014.
|
||||
*/
|
||||
|
||||
|
||||
public class ListOfDrones extends Activity {
|
||||
|
||||
private XMPPConnection connection;
|
||||
|
||||
private ListView listView ;
|
||||
private ArrayAdapter<String> listAdapter ;
|
||||
private ArrayList users;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_list_of_drone);
|
||||
|
||||
Bundle b = getIntent().getExtras();
|
||||
String user = b.getString("id");
|
||||
String passwd = b.getString("passwd");
|
||||
|
||||
Connection c = new Connection(user,passwd);
|
||||
users = c.getUsers();
|
||||
connection = c.getConnection();
|
||||
|
||||
|
||||
listView = (ListView) findViewById( R.id.listOfDrones );
|
||||
listAdapter = new ArrayAdapter<String>(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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,41 +1,23 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.os.Bundle;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by almeida on 18-12-2014.
|
||||
*/
|
||||
|
||||
public class LoginActivity extends Activity {
|
||||
private static final String SERVICE_URL = "link aqui";
|
||||
String email;
|
||||
String passwd;
|
||||
|
||||
@ -43,15 +25,6 @@ public class LoginActivity extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
Button register = (Button) findViewById(R.id.btnRegister);
|
||||
register.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getApplicationContext(), RegisterActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void postData(View vw) {
|
||||
@ -61,6 +34,8 @@ public class LoginActivity extends Activity {
|
||||
email = edEmail.getText().toString();
|
||||
passwd = edPasswd.getText().toString();
|
||||
|
||||
Log.i("XMPP", "Credencials: " + email + " and " + passwd);
|
||||
|
||||
if (email.equals("") || passwd.equals("")) {
|
||||
Toast.makeText(this, "Por favor preencha os campos de autenticação",
|
||||
Toast.LENGTH_LONG).show();
|
||||
@ -70,210 +45,19 @@ public class LoginActivity extends Activity {
|
||||
|
||||
if (!(networkInfo != null && networkInfo.isConnected()))
|
||||
{
|
||||
Toast.makeText(getApplicationContext(), "Não existe conexão à internet. Por favor ligue o wireless", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplicationContext(), "Não existe conexão à internet. Por favor, ligue o acesso à internet", Toast.LENGTH_SHORT).show();
|
||||
} else{
|
||||
WebServiceTask wst = new WebServiceTask(WebServiceTask.POST_TASK, this, "Validando as credênciais...");
|
||||
|
||||
wst.addNameValuePair("email", email);
|
||||
wst.addNameValuePair("passwd", passwd);
|
||||
|
||||
// the passed String is the URL we will POST to
|
||||
wst.execute(new String[] { SERVICE_URL+"/loginMobile" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void retrieveSampleData(View vw) {
|
||||
|
||||
String sampleURL = SERVICE_URL + "/loginMobile";
|
||||
|
||||
WebServiceTask wst = new WebServiceTask(WebServiceTask.GET_TASK, this, "Validando as credênciais");
|
||||
|
||||
wst.execute(new String[] { sampleURL });
|
||||
}
|
||||
|
||||
public void handleResponse(String response) {
|
||||
//System.out.println ("resposta login: "+response);
|
||||
try {
|
||||
|
||||
if (response.toString().compareToIgnoreCase("-1") != 0 ){
|
||||
Intent i = new Intent(this, MainActivity.class);
|
||||
i.putExtra("events",response);
|
||||
i.putExtra("email", email);
|
||||
Intent i=new Intent(this,ListOfDrones.class);
|
||||
i.putExtra("id", email);
|
||||
i.putExtra("passwd", passwd);
|
||||
startActivity(i);
|
||||
} else {
|
||||
Toast.makeText(this, "Utilizador ou password errados",
|
||||
Toast.LENGTH_LONG).show();
|
||||
this.startActivity(i);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("TAG", e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
|
||||
InputMethodManager inputManager = (InputMethodManager) LoginActivity.this
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
inputManager.hideSoftInputFromWindow(
|
||||
LoginActivity.this.getCurrentFocus()
|
||||
.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
|
||||
private class WebServiceTask extends AsyncTask<String, Integer, String> {
|
||||
|
||||
public static final int POST_TASK = 1;
|
||||
public static final int GET_TASK = 2;
|
||||
|
||||
private static final String TAG = "WebServiceTask";
|
||||
|
||||
// connection timeout, in milliseconds (waiting to connect)
|
||||
private static final int CONN_TIMEOUT = 3000;
|
||||
|
||||
// socket timeout, in milliseconds (waiting for data)
|
||||
private static final int SOCKET_TIMEOUT = 5000;
|
||||
|
||||
private int taskType = GET_TASK;
|
||||
private Context mContext = null;
|
||||
private String processMessage = "Processing...";
|
||||
|
||||
private ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
|
||||
|
||||
private ProgressDialog pDlg = null;
|
||||
|
||||
public WebServiceTask(int taskType, Context mContext, String processMessage) {
|
||||
|
||||
this.taskType = taskType;
|
||||
this.mContext = mContext;
|
||||
this.processMessage = processMessage;
|
||||
}
|
||||
|
||||
public void addNameValuePair(String name, String value) {
|
||||
|
||||
params.add(new BasicNameValuePair(name, value));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void showProgressDialog() {
|
||||
|
||||
pDlg = new ProgressDialog(mContext);
|
||||
pDlg.setMessage(processMessage);
|
||||
pDlg.setProgressDrawable(mContext.getWallpaper());
|
||||
pDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
pDlg.setCancelable(false);
|
||||
pDlg.show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
|
||||
hideKeyboard();
|
||||
showProgressDialog();
|
||||
|
||||
}
|
||||
|
||||
protected String doInBackground(String... urls) {
|
||||
|
||||
String url = urls[0];
|
||||
String result = "";
|
||||
|
||||
HttpResponse response = doResponse(url);
|
||||
|
||||
if (response == null) {
|
||||
return result;
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
result = inputStreamToString(response.getEntity().getContent());
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(TAG, e.getLocalizedMessage(), e);
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String response) {
|
||||
|
||||
handleResponse(response);
|
||||
pDlg.dismiss();
|
||||
|
||||
}
|
||||
|
||||
// Establish connection and socket (data retrieval) timeouts
|
||||
private HttpParams getHttpParams() {
|
||||
|
||||
HttpParams htpp = new BasicHttpParams();
|
||||
|
||||
HttpConnectionParams.setConnectionTimeout(htpp, CONN_TIMEOUT);
|
||||
HttpConnectionParams.setSoTimeout(htpp, SOCKET_TIMEOUT);
|
||||
|
||||
return htpp;
|
||||
}
|
||||
|
||||
private HttpResponse doResponse(String url) {
|
||||
|
||||
// Use our connection and data timeouts as parameters for our
|
||||
// DefaultHttpClient
|
||||
HttpClient httpclient = new DefaultHttpClient(getHttpParams());
|
||||
|
||||
HttpResponse response = null;
|
||||
|
||||
try {
|
||||
switch (taskType) {
|
||||
|
||||
case POST_TASK:
|
||||
HttpPost httppost = new HttpPost(url);
|
||||
// Add parameters
|
||||
httppost.setEntity(new UrlEncodedFormEntity(params));
|
||||
|
||||
response = httpclient.execute(httppost);
|
||||
break;
|
||||
case GET_TASK:
|
||||
HttpGet httpget = new HttpGet(url);
|
||||
response = httpclient.execute(httpget);
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Log.e(TAG, e.getLocalizedMessage(), e);
|
||||
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private String inputStreamToString(InputStream is) {
|
||||
|
||||
String line = "";
|
||||
StringBuilder total = new StringBuilder();
|
||||
|
||||
// Wrap a BufferedReader around the InputStream
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
try {
|
||||
// Read response until the end
|
||||
while ((line = rd.readLine()) != null) {
|
||||
total.append(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
// Return full string
|
||||
return total.toString();
|
||||
}
|
||||
|
||||
public void registerData (View vw) {
|
||||
Intent i = new Intent(this, RegisterActivity.class);
|
||||
startActivity(i);
|
||||
}
|
||||
}
|
||||
@ -1,122 +0,0 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
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);
|
||||
|
||||
left.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "left pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
right.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "right pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
up.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "up pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
down.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "down pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
acelerate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "acelerate pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
breake.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "break pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
on_off.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "on_off pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
calibration.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(getApplicationContext(), "calibration pressed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
Intent i = new Intent(getApplicationContext(), CalibrationActivity.class);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,14 @@ 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.
|
||||
*/
|
||||
|
||||
public class RegisterActivity extends Activity {
|
||||
|
||||
@ -16,6 +23,24 @@ public class RegisterActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
final EditText username = (EditText)findViewById(R.id.editName);
|
||||
final EditText passwd = (EditText)findViewById(R.id.passwd);
|
||||
|
||||
Button buttonReg = (Button) findViewById(R.id.btnReg);
|
||||
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.
|
||||
if (c.createAccount(username.getText().toString(), passwd.getText().toString())){
|
||||
Toast.makeText(getApplicationContext(), "Registration completed!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}else {
|
||||
Toast.makeText(getApplicationContext(), "Problem with registration!",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
Button cancel = (Button)findViewById(R.id.buttonCancel);
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -24,27 +49,4 @@ public class RegisterActivity extends Activity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@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_register, 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,73 +0,0 @@
|
||||
package pt.isep.mei.simov.droneappcontroller;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
/**
|
||||
* Gather the xmpp settings and create an XMPPConnection
|
||||
*/
|
||||
public class SettingsDialog extends Dialog implements View.OnClickListener {
|
||||
private XMPPClient xmppClient;
|
||||
|
||||
public SettingsDialog(XMPPClient xmppClient) {
|
||||
super(xmppClient);
|
||||
this.xmppClient = xmppClient;
|
||||
}
|
||||
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
setContentView(R.layout.settings);
|
||||
getWindow().setFlags(4, 4);
|
||||
setTitle("XMPP Settings");
|
||||
Button ok = (Button) findViewById(R.id.ok);
|
||||
ok.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
String host = getText(R.id.host);
|
||||
String port = getText(R.id.port);
|
||||
String service = getText(R.id.service);
|
||||
String username = getText(R.id.userid);
|
||||
String password = getText(R.id.password);
|
||||
|
||||
// Create a connection
|
||||
ConnectionConfiguration connConfig =
|
||||
new ConnectionConfiguration(host, Integer.parseInt(port), service);
|
||||
XMPPConnection connection = new XMPPConnection(connConfig);
|
||||
|
||||
try {
|
||||
connection.connect();
|
||||
Log.i("XMPPClient", "[SettingsDialog] Connected to " + connection.getHost());
|
||||
} catch (XMPPException ex) {
|
||||
Log.e("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost());
|
||||
Log.e("XMPPClient", ex.toString());
|
||||
xmppClient.setConnection(null);
|
||||
}
|
||||
try {
|
||||
connection.login(username, password);
|
||||
Log.i("XMPPClient", "Logged in as " + connection.getUser());
|
||||
|
||||
// Set the status to available
|
||||
Presence presence = new Presence(Presence.Type.available);
|
||||
connection.sendPacket(presence);
|
||||
xmppClient.setConnection(connection);
|
||||
} catch (XMPPException ex) {
|
||||
Log.e("XMPPClient", "[SettingsDialog] Failed to log in as " + username);
|
||||
Log.e("XMPPClient", ex.toString());
|
||||
xmppClient.setConnection(null);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
private String getText(int id) {
|
||||
EditText widget = (EditText) this.findViewById(id);
|
||||
return widget.getText().toString();
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,7 @@
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Callibration"
|
||||
android:text="Expert Mode"
|
||||
android:id="@+id/buttonCallibration"
|
||||
android:layout_below="@+id/buttonOnOff"
|
||||
android:layout_centerHorizontal="true" />
|
||||
@ -0,0 +1,12 @@
|
||||
<?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">
|
||||
|
||||
<ListView android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/listOfDrones">
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
@ -4,9 +4,8 @@
|
||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/back"
|
||||
tools:context="simov.dei.isep.pt.droneappcontrol.RegisterActivity">
|
||||
android:paddingBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
<!-- Header Starts -->
|
||||
|
||||
@ -41,7 +40,7 @@
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Email"
|
||||
android:text="JabberID"
|
||||
android:textColor="#372c24" />
|
||||
|
||||
<EditText
|
||||
@ -87,7 +86,8 @@
|
||||
android:id="@+id/btnRegister"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Register"
|
||||
android:onClick="registerData"
|
||||
android:text="@string/title_activity_register"
|
||||
android:layout_below="@+id/btnLogin"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Name"
|
||||
android:text="User JabberID"
|
||||
android:textColor="#372c24" />
|
||||
|
||||
<EditText
|
||||
@ -31,20 +31,6 @@
|
||||
android:layout_marginTop="5dip"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Email"
|
||||
android:textColor="#372c24" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editEmail"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dip"
|
||||
android:layout_marginTop="5dip"
|
||||
android:singleLine="true" />
|
||||
|
||||
<!-- Password Label -->
|
||||
|
||||
<TextView
|
||||
|
||||
8
DroneAppController/app/src/main/res/layout/simplerow.xml
Normal file
8
DroneAppController/app/src/main/res/layout/simplerow.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rowTextView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textSize="20sp" >
|
||||
</TextView>
|
||||
@ -0,0 +1,7 @@
|
||||
<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="pt.isep.mei.simov.droneappcontroller.ListOfDrones">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
||||
@ -1,7 +1,7 @@
|
||||
<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="pt.isep.mei.simov.droneappcontroller.MainActivity">
|
||||
tools:context="pt.isep.mei.simov.droneappcontroller.ControllerActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">DroneAppControl</string>
|
||||
<string name="app_name">Drone App Controller</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="action_settings">Definições</string>
|
||||
<string name="title_activity_register">Registo</string>
|
||||
<string name="Register">Formulário de Registo</string>
|
||||
<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>
|
||||
|
||||
</resources>
|
||||
@ -1,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">DroneController</string>
|
||||
<string name="app_name">Drone App Controller</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="title_activity_register">Register</string>
|
||||
<string name="title_activity_main">MainActivity</string>
|
||||
<string name="title_activity_calibration">CalibrationActivity</string>
|
||||
<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>
|
||||
|
||||
</resources>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user