Commit 91c2a01b authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

AGILE#245: [Bug fix] For Medium and Large screens the text fits & small layout fix

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent df0da51f
......@@ -116,21 +116,6 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
presenter = new AccountPresenter(this);
}
/*TODO: Check performance of acvitity
if (DEVELOPER_MODE == 1) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
}*/
setContentView(R.layout.activity_account_view);
......
......@@ -202,6 +202,8 @@ public class SchedulingActivity extends AppCompatActivity implements SchedulingV
spnr_place = (Spinner) findViewById(R.id.spnr_scheduling_place);
days_short = getResources().getStringArray(R.array.days_pt);
ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
......@@ -579,7 +581,7 @@ public class SchedulingActivity extends AppCompatActivity implements SchedulingV
//always update calendar header to today, because when a click is fired on a "useful" date
// the header is updated by 'onScheduleTimeSelected'
Utils.updateCalendarHeaderDate(mcv,tv_year, tv_day_month, days_short, months_short, null);
Utils.updateCalendarHeaderDate(mcv,tv_year, tv_day_month, days_short, months_short, mcv.getSelectedDate());
}
......@@ -669,11 +671,6 @@ public class SchedulingActivity extends AppCompatActivity implements SchedulingV
paintViewLocation = new boolean[servicePlaces.size() + 1];
for (i = 0; i < servicePlaces.size(); i++) {
name = servicePlaces.get(i).getName();
if(name.length() > 33) {
name = name.substring(0, 33);
name = name.trim();
name = name + "...";
}
if(servicePlaces.get(i).getSchedules() == null) {
places[i] = name + " (0)";
paintViewLocation[i] = true;
......
......@@ -107,6 +107,7 @@ public abstract class Utils {
public static final String REQUEST_FILTER_TYPE = "q[service_type_id]";
public static final String REQUEST_FILTER_PLACE = "q[service_place_id]";
public static final String REQUEST_FILTER_SITUATION = "q[situation_id]";
public static final String SIZE_LARGE = "large";
public static int getPixelValue(int dp, Context context) {
Resources resources = context.getResources();
......
......@@ -54,8 +54,8 @@ public interface ApiEndpoints {
@GET("accounts/self?permission=citizen")
Call<AccountOutput> requestSelf();
@GET("citizens/{citizen_id}/schedule_options?permission=citizen")
Call<List<CitizenCompact>> requestScheduleOptions(@Path("citizen_id") long citizenId);
@GET("citizens/schedule_options?permission=citizen")
Call<List<CitizenCompact>> requestScheduleOptions(@Query("cpf") long citizenId);
@GET("sectors?permission=citizen&schedule=true")
Call<List<SectorInput>> requestSectorsInScheduling(@Query("citizen_id") long citizenId);
......
......@@ -64,7 +64,7 @@ public abstract class BasePresenter<V> {
if(headers.get(Utils.UID) != null)
osb.edit().putString(Utils.UID, headers.get(Utils.UID)).apply();
if(headers.get(Utils.EXPIRY) != null)
osb.edit().putString(Utils.EXPIRY, headers.get(Utils.EXPIRY)).apply();;
osb.edit().putString(Utils.EXPIRY, headers.get(Utils.EXPIRY)).apply();
}
......
......@@ -46,7 +46,7 @@ public class CitizensPresenter extends BasePresenter<CitizenListActivity> {
header.put(Utils.UID, osb.getString(Utils.UID, null));
final ApiEndpoints service = ApiUtils.request(header);
Call<List<CitizenCompact>> listCall = service.requestScheduleOptions(osb.getLong("id", 0));
Call<List<CitizenCompact>> listCall = service.requestScheduleOptions(osb.getLong(Utils.CPF, 0));
citizensPresenter.view().setProgressBar(true);
listCall.enqueue(new Callback<List<CitizenCompact>>() {
......
......@@ -157,7 +157,7 @@ public class DependentsListPresenter extends BasePresenter<DependentsListActivit
}
private void requestImage(final FullDependent dependent) {
Map<String, String> header = new HashMap<>();
final Map<String, String> header = new HashMap<>();
final String uid = osb.getString(Utils.UID, null);
header.put("Content-Type", "application/json");
header.put(Utils.ACCESS_TOKEN, osb.getString(Utils.ACCESS_TOKEN, null));
......@@ -175,6 +175,7 @@ public class DependentsListPresenter extends BasePresenter<DependentsListActivit
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
int status = response.code();
updateHeaders(response.headers());
Log.d("Server response", this.getClass().getName() + ": Retorno da request de imagem: " + status);
Locale locale = new Locale("pt", "BR");
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", locale);
......
......@@ -130,7 +130,7 @@ public class LoginPresenter extends BasePresenter<LoginView> {
ApiEndpoints service = ApiUtils.request(header);
Call<ResponseBody> listCall = service.requestPhoto(osb.getLong("id", 0), "large");
Call<ResponseBody> listCall = service.requestPhoto(osb.getLong(Utils.ID, 0), Utils.SIZE_LARGE);
loginPresenter.view().setProgressBar(true);
listCall.enqueue(new Callback<ResponseBody>() {
......@@ -145,7 +145,7 @@ public class LoginPresenter extends BasePresenter<LoginView> {
loginPresenter.view().afterSuccessfulLogin();
break;
case 200:
loginPresenter.view().afterSuccessfulPhoto(BitmapFactory.decodeStream(response.body().byteStream()), osb.getLong("id", 0));
loginPresenter.view().afterSuccessfulPhoto(BitmapFactory.decodeStream(response.body().byteStream()), osb.getLong(Utils.ID, 0));
loginPresenter.view().setProgressBar(false);
break;
case 404:
......@@ -161,14 +161,6 @@ public class LoginPresenter extends BasePresenter<LoginView> {
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Bundle extras = new Bundle();
// TODO: 11/09/17 Correct job take updated access-token!
extras.putString("access-token", osb.getString(Utils.ACCESS_TOKEN, null));
extras.putString("uid",osb.getString(Utils.UID, null));
extras.putString("client",osb.getString(Utils.CLIENT, null));
extras.putLong("id",osb.getLong(Utils.ID, 0));
extras.putString(Utils.JOB_FILE_NAME, Utils.USR_PICT_FILE_NAME);
......
......@@ -78,7 +78,7 @@ public class ScheduleConfirmationPresenter extends BasePresenter<ScheduleConfirm
}
@Override
public void onFailure(Call<ScheduleConfirmation> call, Throwable t) {
Log.e("Server response", "REQUEST FAIL");
Log.e("Server response", this.getClass().getName() + ": Request Failed");
scheduleConfirmationPresenter.view().setNoConnection(true);
scheduleConfirmationPresenter.view().setProgressBar(false);
}
......
......@@ -105,7 +105,6 @@ public class SchedulesHistoryPresenter extends BasePresenter<SchedulesHistoryAct
switch (status) {
case 200:
Log.d("Server response", getClass().getName() + ": 200 - Sucesso!");
// TODO: 17/10/17 handle conversion here?
presenter.view().onSuccessfulRequestSchedules(schedules);
break;
default:
......
......@@ -49,7 +49,7 @@ public class SchedulesPresenter extends BasePresenter<SchedulesActivity> {
presenter.view().setProgressBar(true);
presenter.view().blockCalendar(true);
// TODO: 06/10/17 Change to request "active" schedules
// TODO: 06/10/17 Change to request "active" schedules1
Call<CheckSchedules> listCall = service.requestSchedulesHistory(new HashMap<String, String>());
......
package br.ufpr.c3sl.agendador.agendador.services;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
......@@ -11,10 +12,12 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import br.ufpr.c3sl.agendador.agendador.helpers.ObscuredSharedPreferences;
import br.ufpr.c3sl.agendador.agendador.helpers.UserImgHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.network.ApiEndpoints;
import br.ufpr.c3sl.agendador.agendador.network.ApiUtils;
import okhttp3.Headers;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
......@@ -25,6 +28,9 @@ import retrofit2.Response;
*/
public class ImageUpdateService extends JobService {
/**
* The entry point to your Job. Implementations should offload work to another thread of
* execution as soon as possible.
......@@ -35,28 +41,38 @@ public class ImageUpdateService extends JobService {
@Override
public boolean onStartJob(final JobParameters job) {
Log.d("AGNDDR-ImgService", "Rodando " + ImageUpdateService.class.getName());
ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(getBaseContext(), "Agendador", Context.MODE_PRIVATE);
final Bundle extras = job.getExtras();
Map<String, String> header = new HashMap<>();
// TODO: 29/08/17 Trocar id para long no local de int
final String uid = extras.getString("uid", null);
final String uid = osb.getString(Utils.UID, null);
header.put("Content-Type", "application/json");
header.put("access-token", extras.getString("access-token", null));
header.put("client", extras.getString("client", null));
header.put("uid", uid);
header.put(Utils.ACCESS_TOKEN, osb.getString(Utils.ACCESS_TOKEN, null));
header.put(Utils.CLIENT, osb.getString(Utils.CLIENT, null));
header.put(Utils.ID, uid);
final long id = extras.getLong("id", 0);
final long id = osb.getLong(Utils.ID, 0);
ApiEndpoints service = ApiUtils.request(header);
Call<ResponseBody> listCall = service.requestPhoto(id, "large");
Call<ResponseBody> listCall = service.requestPhoto(id, Utils.SIZE_LARGE);
listCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
int status = response.code();
Headers headers = response.headers();
ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(getBaseContext(), "Agendador", Context.MODE_PRIVATE);
if(headers.get(Utils.ACCESS_TOKEN) != null)
osb.edit().putString(Utils.ACCESS_TOKEN, headers.get(Utils.ACCESS_TOKEN)).apply();
if(headers.get(Utils.CLIENT) != null)
osb.edit().putString(Utils.CLIENT, headers.get(Utils.CLIENT)).apply();
if(headers.get(Utils.UID) != null)
osb.edit().putString(Utils.UID, headers.get(Utils.UID)).apply();
if(headers.get(Utils.EXPIRY) != null)
osb.edit().putString(Utils.EXPIRY, headers.get(Utils.EXPIRY)).apply();
switch (status) {
case 200:
......@@ -64,14 +80,15 @@ public class ImageUpdateService extends JobService {
try {
userImgHelper.saveBitmap(BitmapFactory.decodeStream(response.body().byteStream()), extras.getString(Utils.JOB_FILE_NAME), id);
} catch (IOException e) {
Log.d("AGNDDR-ImgService", "Ocorreu um problema ao atualizar sua foto de perfil");
Log.d("AGNDDR-ImgService", "Ocorreu um problema ao atualizar a foto de perfil");
e.printStackTrace();
}
Log.d("AGNDDR-ImgService", "Job teve sucesso!!111!");
Log.d("AGNDDR-ImgService", "Job teve sucesso!");
jobFinished(job, false);
break;
case 404:
//user has no picture on back-end side
//user has no picture on back-end
Log.d("AGNDDR-ImgService", "Job Foi executado e usuário não possui foto");
jobFinished(job, false);
default:
Log.d("AGNDDR-ImgService", "Job Foi executado mas recebeu retorno " + status);
......@@ -84,7 +101,7 @@ public class ImageUpdateService extends JobService {
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d("AGNDDR-ImgService", "Job fahlou e será remarcado!!");
Log.d("AGNDDR-ImgService", "Job falhou e será remarcado!!");
jobFinished(job, true);
}
});
......
......@@ -783,10 +783,10 @@
android:id="@+id/tv_account_change_password_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/ll_accountact_name_container"
android:layout_alignStart="@id/ll_accountact_name_container"
android:layout_below="@+id/ll_accountact_email_container"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="@string/change_password"
android:textAllCaps="true"
android:textColor="@color/colorGreen"
......@@ -797,9 +797,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_accountact_email_container"
android:layout_marginEnd="8dp"
android:layout_marginTop="10dp"
android:layout_toStartOf="@+id/btn_account_update"
android:layout_toEndOf="@+id/tv_account_change_password_title"
android:text="@string/optional"
android:textColor="@color/colorBlack" />
......@@ -907,6 +906,9 @@
android:id="@+id/et_account_password_confirm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBaseline="@+id/tv_account_change_password_title"
android:layout_alignBottom="@+id/tv_account_change_password_title"
android:layout_alignEnd="@+id/ll_accountact_email_container"
android:layout_gravity="center"
android:inputType="textPassword"
android:textSize="16sp" />
......
......@@ -8,13 +8,13 @@
android:id="@+id/sv_termact"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorGray"
android:fillViewport="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorGray"
android:weightSum="1">
<ImageView
......@@ -48,14 +48,14 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="39dp"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
android:text="@string/terms_limits"
android:textAlignment="center"
android:textSize="16sp"
android:layout_marginBottom="10dp"/>
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:id="@+id/coordinator_home"
android:layout_width="match_parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment