Skip to content

Commit

Permalink
Merge pull request #39 from GabrielSirtoriCorrea/FinalizandoViewsDados
Browse files Browse the repository at this point in the history
FinalizandoViews
  • Loading branch information
GabrielSirtoriCorrea authored Jul 14, 2020
2 parents e7a6870 + 7b3c7f3 commit df06583
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,25 @@ public void onClick(View view) {
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);

}else{

connection.sendRequest(connection.prepareUpdateDevice("updateDevice", ID, txtDevice.getText().toString(), txtDescription.getText().toString(),
"json"));

txtDevice.setEnabled(false);
txtDescription.setEnabled(false);

btnDeleteCancel.setText("Excluir");
btnEditSend.setText("Editar");

editIcon = getResources().getDrawable(R.drawable.ic_edit_black_24dp);
removeIcon = getResources().getDrawable(R.drawable.ic_delete_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(editIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(removeIcon, null, null, null);

intent.putExtra("ID", ID);
intent.putExtra("Device", txtDevice.getText().toString());
intent.putExtra("Description", txtDescription.getText().toString());

if(connection.getMsgStatus()){
Toast.makeText(getContext(), "Salvo", Toast.LENGTH_SHORT).show();
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,39 @@ public void onClick(View view) {
btnEditSend.setCompoundDrawablesWithIntrinsicBounds(saveIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);


}else{

connection.sendRequest(connection.prepareUpdateInteraction("updateInteraction", ID, keyWord1.getText().toString(), keyWord2.getText().toString(),
keyWord3.getText().toString(), response1.getText().toString(), response2.getText().toString(), response3.getText().toString(),
command.getText().toString()));

keyWord1.setEnabled(false);
keyWord2.setEnabled(false);
keyWord3.setEnabled(false);
response1.setEnabled(false);
response2.setEnabled(false);
response3.setEnabled(false);
command.setEnabled(false);

btnDeleteCancel.setText("Excluir");
btnEditSend.setText("Editar");

editIcon = getResources().getDrawable(R.drawable.ic_edit_black_24dp);
removeIcon = getResources().getDrawable(R.drawable.ic_delete_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(editIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(removeIcon, null, null, null);

intent.putExtra("ID", ID);
intent.putExtra("Keyword1", keyWord1.getText().toString());
intent.putExtra("Keyword2", keyWord2.getText().toString());
intent.putExtra("Keyword3", keyWord3.getText().toString());
intent.putExtra("Response1", response1.getText().toString());
intent.putExtra("Response2", response2.getText().toString());
intent.putExtra("Response3", response3.getText().toString());
intent.putExtra("Command", command.getText().toString());

if(connection.getMsgStatus()){
Toast.makeText(getContext(), "Salvo", Toast.LENGTH_SHORT).show();
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ public void onClick(View view) {

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(editIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(removeIcon, null, null, null);
intent.putExtra("ID", ID);
intent.putExtra("Type", txtType.getText().toString());
intent.putExtra("Subject", txtSubject.getText().toString());
intent.putExtra("HomeWork", txtHomeWork.getText().toString());
intent.putExtra("Delivery", txtDelivery.getText().toString());
intent.putExtra("Description", txtDescription.getText().toString());

} catch (ParseException e ) {
Toast.makeText(view.getContext(), "Insira um formato válido", Toast.LENGTH_SHORT).show();
Expand Down Expand Up @@ -176,6 +182,17 @@ public void onClick(View view) {
txtDelivery.setText(intent.getStringExtra("Delivery"));
txtDescription.setText(intent.getStringExtra("Description"));

txtType.setEnabled(false);
txtSubject.setEnabled(false);
txtHomeWork.setEnabled(false);
txtDelivery.setEnabled(false);
txtDescription.setEnabled(false);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(editIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(removeIcon, null, null, null);

btnDeleteCancel.setText("Excluir");
btnEditSend.setText("Editar");
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ public void onClick(View view) {
}else{
connection.sendRequest(connection.prepareUpdateProject("updateProject", ID, txtProject.getText().toString(), txtRepository.getText().toString()));

txtProject.setEnabled(false);
txtRepository.setEnabled(false);

btnDeleteCancel.setText("Excluir");
btnEditSend.setText("Editar");

editIcon = getResources().getDrawable(R.drawable.ic_edit_black_24dp);
removeIcon = getResources().getDrawable(R.drawable.ic_delete_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(editIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(removeIcon, null, null, null);

intent.putExtra("ID", ID);
intent.putExtra("Project", txtProject.getText().toString());
intent.putExtra("Repository", txtRepository.getText().toString());

if(connection.getMsgStatus()){
Toast.makeText(getContext(), "Salvo", Toast.LENGTH_SHORT).show();
}else{
Expand Down Expand Up @@ -136,6 +152,7 @@ public void onClick(View view) {
txtProject.setText(intent.getStringExtra("Project"));
txtRepository.setText(intent.getStringExtra("Repository"));


}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import static java.lang.Thread.sleep;

public class ServerConnection extends AsyncTask<JSONObject, Integer, ArrayList<JSONArray>> {
private String IP = "192.168.0.5";
private String IP = "gazeboindustries.hopto.org";
//private String IP = "192.168.0.5";
private int port = 5000;
private Socket socket;
private PrintWriter out;
Expand Down

0 comments on commit df06583

Please sign in to comment.