Commit ce7aa72c authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Merge branch 'notification' into 'develop'

Added Notifications

See merge request !18
parents 58306e25 da5258bb
......@@ -16,6 +16,8 @@
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
......@@ -47,6 +49,34 @@
</intent-filter>
</service>
<service
android:name=".services.notification.NotificationReadService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE">
<intent-filter>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
</intent-filter>
</service>
<service
android:name=".services.notification.NotificationsListService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE">
<intent-filter>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
</intent-filter>
</service>
<receiver android:name=".services.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name=".services.notification.NotificationReceiver">
</receiver>
<activity android:name=".TermActivity" />
<activity android:name=".SchedulingActivity"/>
<activity android:name=".CitizenListActivity" />
......@@ -57,7 +87,11 @@
<activity android:name=".RetrievalFailureActivity" />
<activity android:name=".RetrievalSuccessActivity" />
<activity android:name=".SchedulesHistoryActivity" />
<activity android:name=".ScheduleInfoActivity"></activity>
<activity android:name=".ScheduleInfoActivity" />
</application>
</manifest>
\ No newline at end of file
......@@ -167,7 +167,9 @@ public class CitizenListActivity extends AppCompatActivity implements CitizenVie
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
getActivity().onBackPressed();
Activity activity = getActivity();
if(activity != null)
activity.onBackPressed();
}
}
......
......@@ -21,6 +21,7 @@ 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,11 +30,18 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
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.models.Notification;
import br.ufpr.c3sl.agendador.agendador.presenters.HomePresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.services.notification.LocalNotificationManager;
import br.ufpr.c3sl.agendador.agendador.views.HomeView;
/**
......@@ -171,6 +179,14 @@ public class HomeActivity extends AppCompatActivity implements HomeView,
});
changeTextColor();
showSnackBar(getIntent());
/*
Notification notification = new Notification(1, "2017-12-18T10:10:00.000-0200", false, "Alo Alo", "a@a.c", false);
Log.d("Agendador", "Criando notificação");
LocalNotificationManager.createLocalNotification(this, notification, osb, new Gson());
*/
}
@TargetApi(23)
......
......@@ -12,6 +12,7 @@ import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextWatcher;
import android.text.style.StyleSpan;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
......@@ -19,6 +20,14 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.RetryStrategy;
import com.firebase.jobdispatcher.Trigger;
import java.io.IOException;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionChecker;
......@@ -28,6 +37,7 @@ import br.ufpr.c3sl.agendador.agendador.helpers.UserImgHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.LoginPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.services.notification.NotificationsListService;
import br.ufpr.c3sl.agendador.agendador.views.LoginView;
/**
......@@ -205,6 +215,8 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
@Override
public void afterSuccessfulLogin() {
presenter.createServiceLocalNotificationsList();
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
finish();
......
......@@ -20,6 +20,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.w3c.dom.Text;
......@@ -28,12 +29,17 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
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.models.CheckSchedules;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.presenters.ScheduleConfirmationPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.ScheduleInfoPresenter;
import br.ufpr.c3sl.agendador.agendador.views.ScheduleInfoView;
public class ScheduleInfoActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
public class ScheduleInfoActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, ScheduleInfoView{
private MenuBuilder menuBuilder;
......@@ -43,12 +49,22 @@ public class ScheduleInfoActivity extends AppCompatActivity implements Navigatio
private long id;
private CheckSchedules.Schedule schedule;
private static final String EXIT_CONFIRMATION_DIALOG_TAG = "exit_dialog";
private int caller;
private TextView tv_name, tv_sector, tv_location, tv_type,
tv_date, tv_address, tv_situation, tv_situation_content;
private ScheduleInfoPresenter presenter;
private ConnectionErrorDialog connectionErrorDialog;
private Button bt_back;
private ProgressBar pb_scheduleInfo;
private boolean hasToRequest;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -114,29 +130,47 @@ public class ScheduleInfoActivity extends AppCompatActivity implements Navigatio
}
});
tv_name = (TextView) findViewById(R.id.tv_schedule_citizen_content);
tv_sector = (TextView) findViewById(R.id.tv_schedule_sector_content);
tv_location = (TextView) findViewById(R.id.tv_schedule_location_content);
tv_type = (TextView) findViewById(R.id.tv_schedule_type_content);
tv_date = (TextView) findViewById(R.id.tv_schedule_date_content);
tv_address = (TextView) findViewById(R.id.tv_schedule_street_content);
tv_situation = (TextView) findViewById(R.id.tv_schedule_situation);
tv_situation_content = (TextView) findViewById(R.id.tv_schedule_situation_content);
pb_scheduleInfo = (ProgressBar) findViewById(R.id.pb_schedule_info);
bt_back = (Button) findViewById(R.id.btn_schedule_info_back);
bt_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
id = getIntent().getIntExtra(Utils.ID, 0);
if(savedInstanceState == null){
presenter = new ScheduleInfoPresenter(this);
}else{
presenter = PresenterManager.getInstance().restorePresenter(savedInstanceState);
if(presenter == null) {
presenter = new ScheduleInfoPresenter(this);
}
}
Bundle bundle = getIntent().getBundleExtra(Utils.SCHEDULE_BUNDLE);
if(bundle != null){
DateFormat df = new SimpleDateFormat("dd/MM/yyyy - HH:mm", Locale.getDefault());
CheckSchedules.Schedule schedule = null;
hasToRequest = true;
if(bundle != null && bundle.getParcelable(Utils.SCHEDULE) != null){
String name = bundle.getString(Utils.NAME);
id = bundle.getLong(Utils.ID);
schedule = bundle.getParcelable(Utils.SCHEDULE);
TextView tv_name = (TextView) findViewById(R.id.tv_schedule_citizen_content);
TextView tv_sector = (TextView) findViewById(R.id.tv_schedule_sector_content);
TextView tv_location = (TextView) findViewById(R.id.tv_schedule_location_content);
TextView tv_type = (TextView) findViewById(R.id.tv_schedule_type_content);
TextView tv_date = (TextView) findViewById(R.id.tv_schedule_date_content);
TextView tv_address = (TextView) findViewById(R.id.tv_schedule_street_content);
TextView tv_situation = (TextView) findViewById(R.id.tv_schedule_situation);
TextView tv_situation_content = (TextView) findViewById(R.id.tv_schedule_situation_content);
tv_name.setText(name);
tv_sector.setText(schedule.getSectorName());
tv_location.setText(schedule.getLocationName());
tv_type.setText(schedule.getServiceTypeName());
tv_date.setText(df.format(schedule.getStartTime()));
String address = schedule.getAddressStreet() + ", " + schedule.getAddressNumber();
tv_address.setText(address);
showScheduleContent(schedule, null);
caller = bundle.getInt(Utils.CALLER_ACTIVITY);
if(caller == Utils.SCHEDULES_ACTIVITY){
......@@ -147,22 +181,45 @@ public class ScheduleInfoActivity extends AppCompatActivity implements Navigatio
navigationView.setCheckedItem(R.id.nav_schedules_history);
tv_situation_content.setText(schedule.getSituation());
}
hasToRequest = false;
}
navigationView.setNavigationItemSelectedListener(this);
Button bt_back = (Button) findViewById(R.id.btn_schedule_info_back);
bt_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
@Override
protected void onPause() {
super.onPause();
presenter.unbindView();
}
@Override
protected void onResume() {
super.onResume();
presenter.bindView(this);
if(hasToRequest && id != 0 ){
presenter.requestScheduleInfo(id);
}
}
// TODO: 16/01/18 extract date pattern to utils class
public void showScheduleContent(CheckSchedules.Schedule schedule, String citizenName){
DateFormat df = new SimpleDateFormat("dd/MM/yyyy - HH:mm", Locale.getDefault());
tv_sector.setText(schedule.getSectorName());
tv_location.setText(schedule.getLocationName());
tv_type.setText(schedule.getServiceTypeName());
tv_date.setText(df.format(schedule.getStartTime()));
String address = schedule.getAddressStreet() + ", " + schedule.getAddressNumber();
tv_address.setText(address);
tv_situation_content.setText(schedule.getSituation());
if(citizenName != null && !citizenName.equals("")){
tv_name.setText(citizenName);
}
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Intent intent;
......@@ -219,6 +276,42 @@ public class ScheduleInfoActivity extends AppCompatActivity implements Navigatio
}
}
@Override
public void setProgressBar(boolean enabled) {
if (enabled) {
pb_scheduleInfo.setVisibility(View.VISIBLE);
} else {
pb_scheduleInfo.setVisibility(View.INVISIBLE);
}
bt_back.setEnabled(!enabled);
}
@Override
public void setConnectionError(boolean enabled) {
if(enabled){
if(connectionErrorDialog == null){
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_connection_error_message));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
}
@Override
public void setNoConnection(boolean enabled) {
if(enabled){
if(connectionErrorDialog == null){
connectionErrorDialog = new ConnectionErrorDialog();
}
Bundle bundle = new Bundle();
bundle.putString(ConnectionErrorDialog.DIALOG_MESSAGE, getString(R.string.dialog_connection_error_message));
connectionErrorDialog.setArguments(bundle);
connectionErrorDialog.show(getFragmentManager(), ConnectionErrorDialog.DIALOG_CONNECTION_ERROR);
}
}
public static class ConfirmationDialogFragment extends DialogFragment {
@NonNull
@Override
......@@ -229,9 +322,8 @@ public class ScheduleInfoActivity extends AppCompatActivity implements Navigatio
builder.setMessage(R.string.signout_confirmation)
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SchedulesActivity activity = (SchedulesActivity) getActivity();
// TODO: 05/10/17 fix here
//activity.presenter.onSignOutClicked();
ScheduleInfoActivity activity = (ScheduleInfoActivity) getActivity();
activity.presenter.onSignOutClicked();
}
})
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
......
......@@ -117,7 +117,17 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
final DrawerLayout drawer;
ActionMenuView actionMenuView = (ActionMenuView) toolbar.findViewById(R.id.agendador_toolbar_menu);
menuBuilder = (MenuBuilder) actionMenuView.getMenu();
menuBuilder.setCallback(new MenuBuilder.Callback() {
@Override
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
public void onMenuModeChange(MenuBuilder menu) {
}
});
ImageView drawerHamburger = (ImageView) toolbar.findViewById(R.id.img_toolbar_hamburger);
......@@ -153,6 +163,7 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
});
navigationView.setCheckedItem(R.id.nav_check_schedules);
navigationView.setNavigationItemSelectedListener(this);
......@@ -239,9 +250,9 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
maxDate = new Date();
String date;
if(schedules.getSchedulesList() != null) {
if(schedules.getSchedulesModel().getSchedulesList() != null) {
for (CheckSchedules.Schedule schedule : schedules.getSchedulesList()) {
for (CheckSchedules.Schedule schedule : schedules.getSchedulesModel().getSchedulesList()) {
date = dateFormat.format(schedule.getStartTime());
if(schedule.getStartTime().after(maxDate)){
maxDate = schedule.getStartTime();
......@@ -261,7 +272,7 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
for (CheckSchedules.DependentSchedules dependentSchedules : schedules.getDependentSchedulesList()) {
for (CheckSchedules.Schedule schedule : dependentSchedules.getSchedulesList()){
for (CheckSchedules.Schedule schedule : dependentSchedules.getScheduleListModel().getSchedulesList()){
date = dateFormat.format(schedule.getStartTime());
if(schedule.getStartTime().after(maxDate)){
maxDate = schedule.getStartTime();
......@@ -403,8 +414,8 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
long id = 0;
//searching if this schedule belongs to the citizen or the dependents.
for(int i = 0; i < schedules.getSchedulesList().size() && id == 0; ++i){
if(schedules.getSchedulesList().get(i).getId() == selectedSchedule.getId())
for(int i = 0; i < schedules.getSchedulesModel().getSchedulesList().size() && id == 0; ++i){
if(schedules.getSchedulesModel().getSchedulesList().get(i).getId() == selectedSchedule.getId())
{
id = schedules.getId();
name = schedules.getName();
......@@ -412,8 +423,8 @@ public class SchedulesActivity extends AppCompatActivity implements NavigationVi
}
for (int i = 0; i < schedules.getDependentSchedulesList().size() && id == 0; ++i){
for(int j = 0; j < schedules.getDependentSchedulesList().get(i).getSchedulesList().size() && id == 0; ++j){
if(schedules.getDependentSchedulesList().get(i).getSchedulesList().get(j).getId() == selectedSchedule.getId())
for(int j = 0; j < schedules.getDependentSchedulesList().get(i).getScheduleListModel().getSchedulesList().size() && id == 0; ++j){
if(schedules.getDependentSchedulesList().get(i).getScheduleListModel().getSchedulesList().get(j).getId() == selectedSchedule.getId())
{
id = schedules.getDependentSchedulesList().get(i).getId();
name = schedules.getDependentSchedulesList().get(i).getName();
......
......@@ -39,7 +39,7 @@ import br.ufpr.c3sl.agendador.agendador.helpers.UserImgHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.HintAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.SchedulesExpandableListAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.schedulesHistory.FilterListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.SpinnerListener;
import br.ufpr.c3sl.agendador.agendador.models.CheckSchedules;
import br.ufpr.c3sl.agendador.agendador.models.FormFilters;
import br.ufpr.c3sl.agendador.agendador.models.ServicePlace;
......@@ -47,10 +47,10 @@ import br.ufpr.c3sl.agendador.agendador.models.ServiceType;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.presenters.SchedulesHistoryPresenter;
import br.ufpr.c3sl.agendador.agendador.views.SchedulesHistoryView;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.SpinnerActivity;
public class SchedulesHistoryActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, SchedulesHistoryView {
public class SchedulesHistoryActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, SchedulesHistoryView, SpinnerActivity {
private NavigationView navigationView;
private MenuBuilder menuBuilder;
......@@ -65,7 +65,6 @@ public class SchedulesHistoryActivity extends AppCompatActivity implements Navig
private FormFilters filters;
private long[] sectorsIdArray, serviceTypesIdArray, servicePlacesIdArray, situationIdArray;
private Button bt_search, bt_clear;
private FilterListener filterListener;
private static final String EXIT_CONFIRMATION_DIALOG_TAG = "exit_dialog";
private static final String SPINNER_SECTOR = "spinner_setor";
private static final String SPINNER_TYPE = "spinner_type";
......@@ -242,7 +241,7 @@ public class SchedulesHistoryActivity extends AppCompatActivity implements Navig
}
});
filterListener = new FilterListener(this);
SpinnerListener filterListener = new SpinnerListener(this);
sp_sector.setOnItemSelectedListener(filterListener);
sp_sector.setOnTouchListener(filterListener);
......@@ -757,11 +756,11 @@ public class SchedulesHistoryActivity extends AppCompatActivity implements Navig
expandableListTitle = new ArrayList<>();
expandableListTitle.add(new Pair<>(schedules.getName(), schedules.getId()));
expandableListDetail.put(schedules.getName(), schedules.getSchedulesList());
expandableListDetail.put(schedules.getName(), schedules.getSchedulesModel().getSchedulesList());
for (CheckSchedules.DependentSchedules dependentSchedules : schedules.getDependentSchedulesList()) {
expandableListTitle.add(new Pair<>(dependentSchedules.getName(), dependentSchedules.getId()));
expandableListDetail.put(dependentSchedules.getName(), dependentSchedules.getSchedulesList());
expandableListDetail.put(dependentSchedules.getName(), dependentSchedules.getScheduleListModel().getSchedulesList());
}
......
......@@ -49,9 +49,9 @@ import br.ufpr.c3sl.agendador.agendador.helpers.adapters.HintAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.HintEnableAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.decorators.NotAvailableDecorator;
import br.ufpr.c3sl.agendador.agendador.helpers.decorators.SchedulesDecorator;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.SectorSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.ServicePlaceSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.ServiceTypeSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.scheduling.SectorSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.scheduling.ServicePlaceSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.scheduling.ServiceTypeSpinnerListener;
import br.ufpr.c3sl.agendador.agendador.models.CitizenCompact;
import br.ufpr.c3sl.agendador.agendador.models.ScheduleConfirmation;
import br.ufpr.c3sl.agendador.agendador.models.SectorInput;
......@@ -328,6 +328,7 @@ public class SchedulingActivity extends AppCompatActivity implements SchedulingV
mcv.setSelectionMode(MaterialCalendarView.SELECTION_MODE_NONE);
// TODO: 12/12/17 check here
dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
hourFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
......
......@@ -34,6 +34,14 @@ import br.ufpr.c3sl.agendador.agendador.models.UserOutput;
public abstract class Utils {
public static final String DATE_HOUR_FORMAT = "dd/MM/yyyy - HH:mm";
public static final String HOUR_FORMAT = "HH:mm";
public static final String DATE_FORMAT = "dd/MM/yyyy";
public static final String SERVER_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
public final static String SERVICE_UPDATE_IMAGE = "br.c3sl.ufpr.image_update";
public static final String SECTORS_LIST = "sectors_list";
......@@ -50,10 +58,10 @@ public abstract class Utils {
public static final String SCHEDULE_CONFIRMATION = "selected_schedule";
public static final String CITIZEN = "citizen_object";
public static final String SIZE_LARGE = "large";
public static final String CITIZEN = "citizen_object";
public static final String CITIZEN_BUNDLE = "br.ufpr.c3sl.agendador.agendador.citizen_bundle";
public static final String JOB_FILE_NAME = "fileName_tag";
public static final String ADDRESS_NEIGHBORHOOD = "address.neighborhood";
public static final String ADDRESS_NUMBER = "address_number";
......@@ -99,15 +107,29 @@ public abstract class Utils {
public static final String CPF_MASK = "###.###.###-##";
public static final String BIRTH_DAY_MASK = "##/##/####";
public static final String SCHEDULE = "schedule";
public static final String DATE_FORMAT = "MM/dd/yyyy HH:mm";
public static final String CALLER_ACTIVITY = "from_activity";
public static final int HISTORY_ACTIVITY = 1;
public static final int SCHEDULES_ACTIVITY = 0;
public static final String REQUEST_FILTER_SECTOR = "q[sector_id]";
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 final String NOTIFICATION = "notification";
public static final String NOTIFICATION_SERVICE = "br.c3sl.ufpr.notification_service";
public static final String NOTIFICATION_UPDATE_LIST_SERVICE = "br.c3sl.ufpr.notification_update_service";
public static final String NOTIFICATION_READ_SERVICE = "br.c3sl.ufpr.notification_read_service";
public static final String NOTIFICATION_LIST = "notification_list";
public static final String ACTION_SHOW_NOTIFICATION = "br.ufpr.c3sl.agendador.SHOW_NOTIFICATION";
public static final int SHOW_SCHEDULE_INFO_ACTION = 0x11;
public static int getPixelValue(int dp, Context context) {
Resources resources = context.getResources();
......@@ -170,9 +192,9 @@ public abstract class Utils {
String s = calendar.get(Calendar.YEAR) + "";
tv_calendarHeaderYear.setText(s);
tv_calendarHeaderDayHour.setText(days_short[calendar.get(Calendar.DAY_OF_WEEK) - 1] + ", " +
months_short[calendar.get(Calendar.MONTH)] + " " + calendar.get(Calendar.DAY_OF_MONTH));
String text = days_short[calendar.get(Calendar.DAY_OF_WEEK) - 1] + ", " +
months_short[calendar.get(Calendar.MONTH)] + " " + calendar.get(Calendar.DAY_OF_MONTH);
tv_calendarHeaderDayHour.setText(text);
}
......
......@@ -37,7 +37,7 @@ public class SchedulesExpandableListAdapter extends BaseExpandableListAdapter {
this.context = context;
this.expandableListTitle = expandableListTitle;
this.expandableListDetail = expandableListDetail;
dateFormat = new SimpleDateFormat(Utils.DATE_FORMAT, Locale.getDefault());
dateFormat = new SimpleDateFormat(Utils.DATE_HOUR_FORMAT, Locale.getDefault());
}
@Override
......
package br.ufpr.c3sl.agendador.agendador.helpers.listeners;
/**
* Created by Lucas Braz Cunha on 22/11/17.
*/
public interface SpinnerActivity {
void updateSpinners(int id);
}
package br.ufpr.c3sl.agendador.agendador.helpers.listeners.schedulesHistory;
package br.ufpr.c3sl.agendador.agendador.helpers.listeners;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import br.ufpr.c3sl.agendador.agendador.views.SchedulesHistoryView;
/**
* Created by Lucas B. Cunha on 30/10/17.
* Created by Lucas Braz Cunha on 22/11/17.
*/
public class FilterListener implements AdapterView.OnItemSelectedListener, View.OnTouchListener {
public class SpinnerListener implements AdapterView.OnItemSelectedListener, View.OnTouchListener {
private boolean userSelect;
private SchedulesHistoryView activity;
private SpinnerActivity activity;
public FilterListener(SchedulesHistoryView activity) {
public SpinnerListener(SpinnerActivity activity) {
this.activity = activity;
this.userSelect = false;
}
......@@ -23,6 +21,7 @@ public class FilterListener implements AdapterView.OnItemSelectedListener, View.
@Override
public boolean onTouch(View v, MotionEvent event) {
userSelect = true;
v.performClick();
return false;
}
......
package br.ufpr.c3sl.agendador.agendador.helpers.listeners;
package br.ufpr.c3sl.agendador.agendador.helpers.listeners.scheduling;
import android.view.MotionEvent;
import android.view.View;
......@@ -53,6 +53,7 @@ public class SectorSpinnerListener implements AdapterView.OnItemSelectedListener
@Override
public boolean onTouch(View v, MotionEvent event) {
userSelect = true;
v.performClick();
return false;
}
......