Commit 36e02d4f authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Merge branch 'schedule_confirmation' into 'develop'

Schedule confirmation

See merge request !12
parents 52a1c3f4 af76e648
......@@ -4,19 +4,20 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
......@@ -28,46 +29,30 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity">
</activity>
<activity android:name=".HomeActivity">
</activity>
<activity android:name=".CepActivity">
</activity>
<activity android:name=".CepNotFoundActivity">
</activity>
<activity android:name=".SignupActivity">
</activity>
<activity android:name=".AccountActivity">
</activity>
<activity android:name=".ForgotPasswordActivity">
</activity>
<service android:name=".services.ImageUpdateService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false">
<activity android:name=".LoginActivity"></activity>
<activity android:name=".HomeActivity"></activity>
<activity android:name=".CepActivity"></activity>
<activity android:name=".CepNotFoundActivity"></activity>
<activity android:name=".SignupActivity"></activity>
<activity android:name=".AccountActivity"></activity>
<activity android:name=".ForgotPasswordActivity"></activity>
<service
android:name=".services.ImageUpdateService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE">
<intent-filter>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
</intent-filter>
</service>
<activity android:name=".TermActivity" />
<activity android:name=".SchedulingActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name=".CitizenActivity"/>
<activity android:name=".TermActivity" />
<activity
android:name=".SchedulingActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" />
<activity android:name=".CitizenActivity" />
<activity android:name=".ScheduleConfirmationActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -58,8 +58,6 @@ import br.ufpr.c3sl.agendador.agendador.views.AccountView;
* Created by Horstmann on 02/03/17.
*/
// TODO: 23/05/17 test "connection failure" dialogs
public class AccountActivity extends AppCompatActivity implements AccountView {
private EditText et_name, et_cpf, et_rg, et_sus_number, et_birthdate,
......@@ -96,7 +94,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
private final int REQUEST_PERMISSIONS = 1;
private final int LOAD_IMAGE_INTENT = 1;
private static final int DEVELOPER_MODE = 1;
//private static final int DEVELOPER_MODE = 1;
......@@ -257,7 +255,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
}
else{
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_cep_connection_error));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_cep_connection_error));
if(connectionErrorDialog == null){
connectionErrorDialog = new ConnectionErrorDialog();
}
......@@ -287,7 +285,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_no_connection_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_no_connection_message));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
scrollUp();
......@@ -396,10 +394,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
else
imv_profile.setImageBitmap(null);
} else {
Intent intent = new Intent(AccountActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
super.onBackPressed();
}
}
......@@ -437,10 +432,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
else
imv_profile.setImageBitmap(null);
} else {
Intent intent = new Intent(AccountActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
onBackPressed();
}
return true;
case R.id.btn_edit_account:
......@@ -780,7 +772,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.signup_warningDialog_message) + "\n" +
getString(R.string.signup_warningDialog_message2))
.setTitle(getString(R.string.signup_warningDialog_title))
.setTitle(getString(R.string.warningDialog_title))
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dismiss();
......@@ -799,7 +791,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.dialog_cep_warning_message) +
getString(R.string.signup_warningDialog_message2))
.setTitle(getString(R.string.signup_warningDialog_title))
.setTitle(getString(R.string.warningDialog_title))
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
......@@ -899,7 +891,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_connection_error_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_connection_error_message));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
......@@ -913,7 +905,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_cep_connection_error));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_cep_connection_error));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
......@@ -927,7 +919,7 @@ public class AccountActivity extends AppCompatActivity implements AccountView {
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_no_connection_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_no_connection_message));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
......
......@@ -68,12 +68,12 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
rv_citizens.addOnItemTouchListener(new CitizensItemListener(getApplicationContext(), rv_citizens,
new CitizensItemListener.RecyclerTouchListener() {
public void onClickItem(View v, int position) {
Intent intent = new Intent(CitizenActivity.this, SchedulingActivity.class);
Bundle bundle = getIntent().getBundleExtra(Utils.SECTORS_BUNDLE);
Intent intent = new Intent(CitizenActivity.this, TermActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable(Utils.CITIZEN, citizens.get(position));
intent.putExtra(Utils.SECTORS_CITIZENS_BUNDLE, bundle);
intent.putExtra(Utils.CITIZEN_BUNDLE, bundle);
startActivity(intent);
finish();
}
public void onLongClickItem(View v, int position) {
......@@ -81,8 +81,6 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
}
}));
citizensPresenter.bindView(this);
citizensPresenter.requestCitizens();
}
......@@ -91,7 +89,7 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
protected void onResume() {
super.onResume();
citizensPresenter.bindView(this);
citizensPresenter.requestCitizens();
}
@Override
......@@ -100,6 +98,13 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
citizensPresenter.unbindView();
}
@Override
protected void onStart() {
super.onStart();
}
public void showLayout(boolean enabled) {
rv_citizens.setAdapter(new CitizensArrayAdapter(this, citizens));
......@@ -115,7 +120,7 @@ public class CitizenActivity extends AppCompatActivity implements CitizenView{
if(dg_connection_failure == null){
dg_connection_failure = new ConnectionFailureDialog();
}
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_term_error));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_term_error));
dg_connection_failure.setArguments(bundle);
dg_connection_failure.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
......
package br.ufpr.c3sl.agendador.agendador;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
......@@ -12,6 +11,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
......@@ -21,7 +21,6 @@ import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
......@@ -29,15 +28,11 @@ import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import android.widget.Toast;
import br.ufpr.c3sl.agendador.agendador.helpers.ObscuredSharedPreferences;
import br.ufpr.c3sl.agendador.agendador.helpers.UserPhotoHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.HomePresenter;
import br.ufpr.c3sl.agendador.agendador.services.ImageUpdateService;
import br.ufpr.c3sl.agendador.agendador.views.HomeView;
/**
......@@ -45,27 +40,19 @@ import br.ufpr.c3sl.agendador.agendador.views.HomeView;
*/
// TODO: 03/07/17 Sugestão: após agendamento perguntar se usuário quer visualizar sua lista de agendamentos.
public class HomeActivity extends AppCompatActivity implements HomeView,
NavigationView.OnNavigationItemSelectedListener {
private HomePresenter presenter;
private ObscuredSharedPreferences osb;
private MenuBuilder menuBuilder;
private ActionMenuView actionMenuView;
private ImageView drawerHamburger, drawerProfilePicture;
private DrawerLayout drawer;
private NavigationView navigationView;
private TextView drawerCitizenName, drawerCityName, homeCitizenWelcome, tv_presentation;
private UserPhotoHelper userPhotoHelper;
private TextView tv_presentation;
private ConfirmationDialog confirmationDialog;
private Button btn_schedule;
private Snackbar snackbar;
public static String SHOW_SCHEDULE_SNACKBAR = "snack_bar";
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -82,11 +69,11 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
toolbar.setTitle(null);
setSupportActionBar(toolbar);
osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
ObscuredSharedPreferences osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
String citizenName = osb.getString("name", null);
String citizenCity = osb.getString("city.name", null);
actionMenuView = (ActionMenuView) toolbar.findViewById(R.id.agendador_toolbar_menu);
ActionMenuView actionMenuView = (ActionMenuView) toolbar.findViewById(R.id.agendador_toolbar_menu);
menuBuilder = (MenuBuilder) actionMenuView.getMenu();
//noinspection RestrictedApi
menuBuilder.setCallback(new Callback() {
......@@ -103,8 +90,8 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
confirmationDialog = new ConfirmationDialog();
drawerHamburger = (ImageView) toolbar.findViewById(R.id.img_toolbar_hamburger);
homeCitizenWelcome = (TextView) findViewById(R.id.tv_homeact_welcome);
ImageView drawerHamburger = (ImageView) toolbar.findViewById(R.id.img_toolbar_hamburger);
TextView homeCitizenWelcome = (TextView) findViewById(R.id.tv_homeact_welcome);
homeCitizenWelcome.setText(String.format(getString(R.string.welcome), citizenName));
tv_presentation = (TextView) findViewById(R.id.tv_homeact_moreinfo);
......@@ -114,13 +101,13 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
View headerView = navigationView.getHeaderView(0);
drawerProfilePicture = (ImageView) headerView.findViewById(R.id.img_drawerheader_citizen_photo);
ImageView drawerProfilePicture = (ImageView) headerView.findViewById(R.id.img_drawerheader_citizen_photo);
userPhotoHelper = new UserPhotoHelper(getBaseContext());
UserPhotoHelper userPhotoHelper = new UserPhotoHelper(getBaseContext());
drawerCitizenName = (TextView) headerView.findViewById(R.id.tv_drawerheader_citizen_name);
TextView drawerCitizenName = (TextView) headerView.findViewById(R.id.tv_drawerheader_citizen_name);
drawerCityName = (TextView) headerView.findViewById(R.id.tv_drawerheader_city_name);
TextView drawerCityName = (TextView) headerView.findViewById(R.id.tv_drawerheader_city_name);
drawerCitizenName.setText(citizenName);
drawerCityName.setText(citizenCity);
......@@ -133,24 +120,32 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
drawerHamburger.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
drawer.openDrawer(Gravity.LEFT);
drawer.openDrawer(Gravity.START);
}
});
navigationView.setNavigationItemSelectedListener(this);
btn_schedule = (Button) findViewById(R.id.btn_homeact_schedule);
Button btn_schedule = (Button) findViewById(R.id.btn_homeact_schedule);
btn_schedule.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(HomeActivity.this, TermActivity.class);
Intent intent = new Intent(HomeActivity.this, CitizenActivity.class);
startActivity(intent);
}
});
snackbar = Snackbar.make(findViewById(R.id.coordinator_home), R.string.snackbar_home_description,Snackbar.LENGTH_LONG)
.setAction(R.string.snackbar_home_action, new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "Abrir a tela de agendamentos", Toast.LENGTH_SHORT).show();
}
});
changeTextColor();
showSnackBar(getIntent());
}
@TargetApi(23)
......@@ -224,15 +219,35 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
case R.id.nav_my_info:
intent = new Intent(this, AccountActivity.class);
startActivity(intent);
return true;
break;
case R.id.nav_schedule:
intent = new Intent(this, TermActivity.class);
item.setChecked(false);
intent = new Intent(this, CitizenActivity.class);
startActivity(intent);
break;
default:
break;
}
return true;
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
showSnackBar(intent);
}
private void showSnackBar(Intent intent){
if(intent != null){
Bundle extras = intent.getBundleExtra(SHOW_SCHEDULE_SNACKBAR);
if (extras != null) {
int b = extras.getInt(SHOW_SCHEDULE_SNACKBAR, 0);
if(b != 0){
snackbar.show();
}
}
}
return false;
}
......
......@@ -102,7 +102,7 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
if (dg_connection_error == null)
dg_connection_error = new ConnectionErrorDialog();
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_no_connection_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_no_connection_message));
dg_connection_error.setArguments(bundle);
dg_connection_error.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
setWrongPassword(false);
......@@ -189,7 +189,7 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
if(dg_connection_error == null){
dg_connection_error = new ConnectionErrorDialog();
}
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_connection_error_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_connection_error_message));
dg_connection_error.setArguments(bundle);
dg_connection_error.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
......
......@@ -105,7 +105,7 @@ public class SignupActivity extends AppCompatActivity implements SignupView {
Bundle bundle = new Bundle();
if(dg_connection_error == null)
dg_connection_error = new ConnectionErrorDialog();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_no_connection_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_no_connection_message));
dg_connection_error.setArguments(bundle);
dg_connection_error.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
......@@ -363,7 +363,7 @@ public class SignupActivity extends AppCompatActivity implements SignupView {
dg_connection_error = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_connection_error_message));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_connection_error_message));
dg_connection_error.setArguments(bundle);
dg_connection_error.show(getFragmentManager(), "noConnectionDialog");
}
......
......@@ -26,6 +26,7 @@ import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.SectorArrayAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.models.SectorInput;
import br.ufpr.c3sl.agendador.agendador.models.UserOutput;
import br.ufpr.c3sl.agendador.agendador.presenters.TermPresenter;
import br.ufpr.c3sl.agendador.agendador.views.TermView;
......@@ -43,7 +44,7 @@ public class TermActivity extends AppCompatActivity implements TermView {
private ConnectionFailureDialog dg_connection_failure;
private UserOutput citizen;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -55,6 +56,10 @@ public class TermActivity extends AppCompatActivity implements TermView {
}
setContentView(R.layout.activity_term);
Bundle bundle = getIntent().getBundleExtra(Utils.CITIZEN_BUNDLE);
citizen = bundle.getParcelable(Utils.CITIZEN);
Button refusal = (Button) findViewById(R.id.btn_term_refusal);
Button accept = (Button) findViewById(R.id.btn_term_accept);
......@@ -65,16 +70,16 @@ public class TermActivity extends AppCompatActivity implements TermView {
Intent intent = new Intent(TermActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
accept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(TermActivity.this, CitizenActivity.class);
Intent intent = new Intent(TermActivity.this, SchedulingActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable(Utils.CITIZEN, citizen);
bundle.putParcelableArrayList(Utils.SECTORS_LIST, (ArrayList<? extends Parcelable>) sectors);
intent.putExtra(Utils.SECTORS_BUNDLE, bundle);
intent.putExtra(Utils.SECTORS_CITIZENS_BUNDLE, bundle);
startActivity(intent);
finish();
}
......@@ -98,9 +103,8 @@ public class TermActivity extends AppCompatActivity implements TermView {
R.drawable.item_divider)));
termPresenter.bindView(this);
termPresenter.requestSectors();
termPresenter.requestSectors(citizen);
}
@Override
......@@ -116,9 +120,7 @@ public class TermActivity extends AppCompatActivity implements TermView {
termPresenter.unbindView();
}
@Override
@Override
public void showLayout(boolean enabled) {
rv_sectors.setAdapter(new SectorArrayAdapter(this, sectors));
......@@ -140,12 +142,12 @@ public class TermActivity extends AppCompatActivity implements TermView {
this.sectors = sectors;
}
public void onRequestFailure(){
public void onRequestFailure() {
Bundle bundle = new Bundle();
if(dg_connection_failure == null){
if (dg_connection_failure == null) {
dg_connection_failure = new ConnectionFailureDialog();
}
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE_KEY, getString(R.string.dialog_term_error));
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_term_error));
dg_connection_failure.setArguments(bundle);
dg_connection_failure.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
......@@ -180,13 +182,12 @@ public class TermActivity extends AppCompatActivity implements TermView {
/**
* Based on: https://www.survivingwithandroid.com/2016/09/android-recyclerview-tutorial.html
*
*/
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private class DividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider;
public DividerItemDecoration(Drawable divider) {
DividerItemDecoration(Drawable divider) {
this.mDivider = divider;
}
......
......@@ -16,14 +16,18 @@ public class ConnectionErrorDialog extends DialogFragment {
public static final String DIALOG_CONNECTION_ERROR = "connection_error";
public static final String DIALOG_MESSAGE_KEY = "message";
public static final String DIALOG_MESSAGE = "message";
public static final String DIALOG_TITLE = "title";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String title = getArguments().getString(DIALOG_TITLE);
if(title == null)
title = getResources().getString(R.string.warningDialog_title);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getArguments().getString(DIALOG_MESSAGE_KEY))
.setTitle(getString(R.string.warningDialog_title))
builder.setMessage(getArguments().getString(DIALOG_MESSAGE))
.setTitle(title)
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
......
......@@ -31,16 +31,20 @@ public class Utils {
public static final String SECTORS_LIST = "sectors_list";
public static final String SECTORS_BUNDLE = "br.ufpr.c3sl.agendador.agendador.sectors_bundle";
public static final String SECTORS_CITIZENS_BUNDLE = "br.ufpr.c3sl.agendador.agendador.sectors_citizens_bundle";
public static final String SCHEDULE_BUNDLE = "br.ufpr.c3sl.agendador.agendador.schedule_confirmation";
public static final String DIR_PICTRS = "pictures";
public static final String USR_PICT_FILE_NAME = "usr_prof_pic";
public static final String SCHEDULE_CONFIRMATION = "selected_schedule";
public static final String CITIZEN = "citizen_object";
public static final String CITIZEN_BUNDLE = "br.ufpr.c3sl.agendador.agendador.citizen_bundle";
public static int getPixelValue(int dp, Context context) {
Resources resources = context.getResources();
......
......@@ -2,8 +2,6 @@ package br.ufpr.c3sl.agendador.agendador.helpers.adapters;
import android.content.Context;
import android.graphics.Color;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
......@@ -19,17 +17,20 @@ import android.widget.TextView;
public class HintEnableAdapter extends ArrayAdapter<String> {
boolean[] enableView;
private boolean[] paintView;
public HintEnableAdapter(Context context, int resource, String[] objects, boolean[] enableView) {
private int color;
public HintEnableAdapter(Context context, int resource, String[] objects, boolean[] paintView, int color) {
super(context, resource, objects);
this.enableView = enableView;
this.paintView = paintView;
this.color = color;
}
@Override
public boolean isEnabled(int position) {
return enableView[position];
return !paintView[position];
}
......@@ -43,8 +44,8 @@ public class HintEnableAdapter extends ArrayAdapter<String> {
ViewGroup parent) {
View mView = super.getDropDownView(position, convertView, parent);
TextView mTextView = (TextView) mView;
if (!enableView[position])
mTextView.setTextColor(Color.GRAY);
if (paintView[position])
mTextView.setTextColor(color);
else
mTextView.setTextColor(Color.BLACK);
return mView;
......
package br.ufpr.c3sl.agendador.agendador.helpers.adapters;
import android.content.Context;
import android.graphics.Color;