Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconsModificados #35

Merged
merged 1 commit into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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());
}
}
Expand All @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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");
Expand All @@ -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"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}