Skip to content

Commit

Permalink
Merge pull request #35 from GabrielSirtoriCorrea/ModificandoIconsDosB…
Browse files Browse the repository at this point in the history
…otoes

iconsModificados
GabrielSirtoriCorrea authored Jul 9, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 176bff4 + 4242732 commit 715dceb
Showing 6 changed files with 166 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -23,6 +24,11 @@ public class ViewDevicesFragment extends Fragment {
private Button btnEditSend;
private Button btnDeleteCancel;

private Drawable cancelIcon;
private Drawable saveIcon;

private Drawable editIcon;
private Drawable removeIcon;

@Nullable
@Override
@@ -51,6 +57,13 @@ public void onClick(View view) {

btnDeleteCancel.setText("Cancelar");
btnEditSend.setText("Salvar");

cancelIcon = getResources().getDrawable(R.drawable.ic_clear_black_24dp);
saveIcon = getResources().getDrawable(R.drawable.ic_save_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(saveIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);

}else{
//connection = new ServerConnection();
System.out.println("ENVIAR");
@@ -73,6 +86,12 @@ public void onClick(View view) {
btnDeleteCancel.setText("Remover");
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);

txtDevice.setText(intent.getStringExtra("Device"));
txtDescription.setText(intent.getStringExtra("Description"));

Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@

import com.gazeboindustries.sextafeiramobile.R;
import com.gazeboindustries.sextafeiramobile.ServerConnection;
import com.google.android.material.drawable.DrawableUtils;

public class ViewInteractionFragment extends Fragment {
private Intent intent;
@@ -40,6 +41,12 @@ public class ViewInteractionFragment extends Fragment {
private AlertDialog.Builder removeAlert;
private AlertDialog removeDialog;

private Drawable cancelIcon;
private Drawable saveIcon;

private Drawable editIcon;
private Drawable removeIcon;


@Nullable
@Override
@@ -102,9 +109,11 @@ public void onClick(View view) {
btnDeleteCancel.setText("Cancelar");
btnEditSend.setText("Salvar");

//Drawable icon = new Drawable();
cancelIcon = getResources().getDrawable(R.drawable.ic_clear_black_24dp);
saveIcon = getResources().getDrawable(R.drawable.ic_save_black_24dp);

btnDeleteCancel.setCompoundDrawables(null, null, null, null);
btnEditSend.setCompoundDrawablesWithIntrinsicBounds(saveIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);

}else{
//connection = new ServerConnection();
@@ -137,6 +146,12 @@ public void onClick(View view) {
btnDeleteCancel.setText("Remover");
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);

keyWord1.setText(intent.getStringExtra("Keyword1"));
keyWord2.setText(intent.getStringExtra("Keyword2"));
keyWord3.setText(intent.getStringExtra("Keyword3"));
Original file line number Diff line number Diff line change
@@ -15,6 +15,15 @@ public class AddHomeWorkFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
/*checa se é uma data:
try {
sdf.parse(txtDelivery.getText().toString());
} catch (ParseException e) {
Toast.makeText(view.getContext(), "Insira um formato válido", Toast.LENGTH_SHORT).show();
}*/

return inflater.inflate(R.layout.fragment_addhomework, container, false);

}
}
Original file line number Diff line number Diff line change
@@ -2,19 +2,25 @@

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.gazeboindustries.sextafeiramobile.R;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ViewHomeWorkFragment extends Fragment {
private Intent intent;
private EditText txtType;
@@ -26,11 +32,22 @@ public class ViewHomeWorkFragment extends Fragment {
private Button btnEditSend;
private Button btnDeleteCancel;

private Drawable saveIcon;
private Drawable cancelIcon;

private Drawable editIcon;
private Drawable removeIcon;

private SimpleDateFormat sdf;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_viewhomework, container, false);

sdf = new SimpleDateFormat("dd/MM/yyyy");


txtType = view.findViewById(R.id.txtViewHomeWorkType);
txtSubject = view.findViewById(R.id.txtViewHomeWorkSubject);
txtHomeWork = view.findViewById(R.id.txtViewHomeWork);
@@ -62,9 +79,22 @@ public void onClick(View view) {

btnDeleteCancel.setText("Cancelar");
btnEditSend.setText("Salvar");

cancelIcon = getResources().getDrawable(R.drawable.ic_clear_black_24dp);
saveIcon = getResources().getDrawable(R.drawable.ic_save_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(saveIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);

}else{
try {
sdf.parse(txtDelivery.getText().toString());

} catch (ParseException e) {
Toast.makeText(view.getContext(), "Insira um formato válido", Toast.LENGTH_SHORT).show();
}

//connection = new ServerConnection();
System.out.println("ENVIAR");
//connection.sendRequest(connection.prepareRequest());
}
}
@@ -87,6 +117,12 @@ public void onClick(View view) {
btnDeleteCancel.setText("Remover");
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);

txtType.setText(intent.getStringExtra("Type"));
txtSubject.setText(intent.getStringExtra("Subject"));
txtHomeWork.setText(intent.getStringExtra("HomeWork"));
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -23,6 +24,12 @@ public class ViewProjectsFragment extends Fragment {
private Button btnEditSend;
private Button btnDeleteCancel;

private Drawable saveIcon;
private Drawable cancelIcon;

private Drawable editIcon;
private Drawable removeIcon;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -50,6 +57,13 @@ public void onClick(View view) {

btnDeleteCancel.setText("Cancelar");
btnEditSend.setText("Salvar");

cancelIcon = getResources().getDrawable(R.drawable.ic_clear_black_24dp);
saveIcon = getResources().getDrawable(R.drawable.ic_save_black_24dp);

btnEditSend.setCompoundDrawablesWithIntrinsicBounds(saveIcon, null, null, null);
btnDeleteCancel.setCompoundDrawablesWithIntrinsicBounds(cancelIcon, null, null, null);

}else{
//connection = new ServerConnection();
System.out.println("ENVIAR");
@@ -69,10 +83,15 @@ public void onClick(View view) {
txtProject.setEnabled(false);
txtRepository.setEnabled(false);


btnDeleteCancel.setText("Remover");
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);

txtProject.setText(intent.getStringExtra("Project"));
txtRepository.setText(intent.getStringExtra("Repository"));

Original file line number Diff line number Diff line change
@@ -77,16 +77,79 @@ protected ArrayList<JSONArray> doInBackground(JSONObject... params) {
return null;
}

public JSONObject prepareRequest(String request){
public JSONObject prepareInteraction(String request, String key1, String key2, String key3, String res1, String res2, String res3, String command){
try {
this.jsonRequest = new JSONObject();
this.jsonRequest.put("header", "gazeboindustries09082004");
this.jsonRequest.put("request", request);
this.jsonRequest.put("key1", key1);
this.jsonRequest.put("key2", key2);
this.jsonRequest.put("key3", key3);
this.jsonRequest.put("res1", res1);
this.jsonRequest.put("res2", res2);
this.jsonRequest.put("res3", res3);
this.jsonRequest.put("command", command);

} catch (JSONException e) {
e.printStackTrace();
}
return jsonRequest;
}

public JSONObject prepareDevice(String request, String device, String desc){
try {
this.jsonRequest = new JSONObject();
this.jsonRequest.put("header", "gazeboindustries09082004");
this.jsonRequest.put("request", request);
this.jsonRequest.put("device", device);
this.jsonRequest.put("description", desc);

} catch (JSONException e) {
e.printStackTrace();
}
return jsonRequest;
}

public JSONObject prepareHomework(String request, String type, String subject, String homework, String delivery, String desc){
try {
this.jsonRequest = new JSONObject();
this.jsonRequest.put("header", "gazeboindustries09082004");
this.jsonRequest.put("request", request);
this.jsonRequest.put("type", type);
this.jsonRequest.put("subject", subject);
this.jsonRequest.put("homeWork", homework);
this.jsonRequest.put("delivery", delivery);
this.jsonRequest.put("description", desc);

} catch (JSONException e) {
e.printStackTrace();
}
return jsonRequest;
}

public JSONObject prepareProject(String request, String project, String desc){
try {
this.jsonRequest = new JSONObject();
this.jsonRequest.put("header", "gazeboindustries09082004");
this.jsonRequest.put("request", request);
this.jsonRequest.put("project", project);
this.jsonRequest.put("description", desc);

} catch (JSONException e) {
e.printStackTrace();
}
return jsonRequest;
}

public JSONObject prepareRequest(String request){
try {
this.jsonRequest = new JSONObject();
this.jsonRequest.put("header", "gazeboindustries09082004");
this.jsonRequest.put("request", request);
} catch (JSONException e) {
e.printStackTrace();
}
return jsonRequest;
}

}

0 comments on commit 715dceb

Please sign in to comment.