Commit ff40f518 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Merge branch 'develop' into 'master'

Develop

See merge request !20
parents dc80b77f e547bc85
......@@ -3,8 +3,10 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/*
/.idea/misc.xml
.DS_Store
/build
/captures
.externalNativeBuild
build.gradle
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Mobile.iml" filepath="$PROJECT_DIR$/Mobile.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "br.ufpr.c3sl.agendador.agendador"
minSdkVersion 19
......@@ -24,12 +24,17 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'com.android.support:recyclerview-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
......@@ -3,14 +3,26 @@
package="br.ufpr.c3sl.agendador.agendador">
<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" />
<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -18,21 +30,59 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" />
<activity android:name=".HomeActivity" />
<activity android:name=".CepActivity" />
<activity android:name=".CepNotFoundActivity" />
<activity android:name=".SignUpActivity" />
<activity android:name=".AccountActivity" />
<activity android:name=".PasswordRetrievalActivity" />
<activity android:name=".DependentsListActivity" />
<activity android:name=".LoginActivity">
</activity>
<activity android:name=".HomeActivity">
</activity>
<activity android:name=".CepActivity">
</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>
<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>
<activity android:name=".CepNotFoundActivity">
</activity>
<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=".SignupActivity">
</activity>
<activity android:name=".TermActivity" />
<activity android:name=".SchedulingActivity" />
<activity android:name=".CitizenListActivity" />
<activity android:name=".SchedulesActivity" />
<activity android:name=".ScheduleConfirmationActivity" />
<activity android:name=".DependentUpdateActivity" />
<activity android:name=".NewDependentActivity" />
<activity android:name=".RetrievalFailureActivity" />
<activity android:name=".RetrievalSuccessActivity" />
<activity android:name=".SchedulesHistoryActivity" />
<activity android:name=".ScheduleInfoActivity" />
<activity android:name=".EmailActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -3,6 +3,7 @@ package br.ufpr.c3sl.agendador.agendador;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
......@@ -11,7 +12,10 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import br.ufpr.c3sl.agendador.agendador.helpers.Mask;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.presenters.CepPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.CepView;
/**
......@@ -24,6 +28,7 @@ public class CepActivity extends AppCompatActivity implements CepView {
private EditText et_cep;
private TextView tv_invalid_cep;
private ProgressBar pb_waiting;
private ConnectionErrorDialog dg_connection;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -32,6 +37,8 @@ public class CepActivity extends AppCompatActivity implements CepView {
presenter = new CepPresenter(this);
} else {
presenter = PresenterManager.getInstance().restorePresenter(savedInstanceState);
if(presenter == null)
presenter = new CepPresenter(this);
}
setContentView(R.layout.activity_cep);
......@@ -41,7 +48,9 @@ public class CepActivity extends AppCompatActivity implements CepView {
pb_waiting = (ProgressBar) findViewById(R.id.pb_cepact);
et_cep = (EditText) findViewById(R.id.et_cepact_cep);
et_cep.addTextChangedListener(Mask.insert("#####-###", et_cep));
et_cep.addTextChangedListener(Mask.insert(Utils.CEP_MASK, et_cep));
et_cep.setFilters(new InputFilter[]{new InputFilter.LengthFilter(Utils.CPF_MASK.length())});
et_cep.addTextChangedListener(new CepChangeListener());
tv_invalid_cep = (TextView) findViewById(R.id.tv_cepact_invalid_cep);
......@@ -82,13 +91,18 @@ public class CepActivity extends AppCompatActivity implements CepView {
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
PresenterManager.getInstance().savePresenter(presenter, outState);
super.onSaveInstanceState(outState);
}
@Override
public void setNoConnection(boolean enable) {
public void setNoConnection(boolean enabled) {
if(enabled){
if(dg_connection == null){
dg_connection = new ConnectionErrorDialog();
}
dg_connection.show(getFragmentManager(), "noConnectionDialog");
}
}
@Override
......
......@@ -8,6 +8,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import br.ufpr.c3sl.agendador.agendador.presenters.CepNotFoundPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.CepNotFoundView;
/**
......@@ -27,6 +28,8 @@ public class CepNotFoundActivity extends AppCompatActivity implements CepNotFoun
presenter = new CepNotFoundPresenter(this);
} else {
presenter = PresenterManager.getInstance().restorePresenter(savedInstanceState);
if(presenter == null)
presenter = new CepNotFoundPresenter(this);
}
setContentView(R.layout.activity_cep_not_found);
......@@ -44,7 +47,7 @@ public class CepNotFoundActivity extends AppCompatActivity implements CepNotFoun
String state_name = intent.getStringExtra("statename_su");
if (city_name.equals("null")) {
error_message.setText("Cep inválido");
error_message.setText(getResources().getString(R.string.invalid_cep));
} else {
error_message.setText(String.format(getString(R.string.cep_not_found_message),
city_name, state_name));
......@@ -65,7 +68,7 @@ public class CepNotFoundActivity extends AppCompatActivity implements CepNotFoun
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
PresenterManager.getInstance().savePresenter(presenter, outState);
super.onSaveInstanceState(outState);
}
}
package br.ufpr.c3sl.agendador.agendador;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ProgressBar;
import java.util.List;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.CitizensArrayAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.RecyclerViewItemListener;
import br.ufpr.c3sl.agendador.agendador.models.CitizenCompact;
import br.ufpr.c3sl.agendador.agendador.presenters.CitizensPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.CitizenView;
/**
* Created by Lucas B. Cunha on 27/06/17.
*/
public class CitizenListActivity extends AppCompatActivity implements CitizenView{
private RecyclerView rv_citizens;
private ProgressBar pb_citizen;
private CitizensPresenter citizensPresenter;
private List<CitizenCompact> citizens;
private ConnectionFailureDialog dg_connection_failure;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_citizen);
if (savedInstanceState == null) {
citizensPresenter = new CitizensPresenter(this);
}
else{
citizensPresenter = PresenterManager.getInstance().restorePresenter(savedInstanceState);
if(citizensPresenter == null){
citizensPresenter = new CitizensPresenter(this);
}
}
pb_citizen = (ProgressBar) findViewById(R.id.pb_citizenact);
rv_citizens = (RecyclerView) findViewById(R.id.rv_citizens_citizens);
RecyclerView.LayoutManager layout = new LinearLayoutManager(this,
LinearLayoutManager.VERTICAL, false);
rv_citizens.setLayoutManager(layout);
rv_citizens.setVisibility(View.INVISIBLE);
rv_citizens.addOnItemTouchListener(new RecyclerViewItemListener(getApplicationContext(), rv_citizens,
new RecyclerViewItemListener.RecyclerTouchListener() {
public void onClickItem(View v, int position) {
Intent intent = new Intent(CitizenListActivity.this, TermActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable(Utils.CITIZEN, citizens.get(position));
intent.putExtra(Utils.CITIZEN_BUNDLE, bundle);
startActivity(intent);
finish();
}
public void onLongClickItem(View v, int position) {
//do nothing.
}
}));
}
@Override
protected void onResume() {
super.onResume();
citizensPresenter.bindView(this);
if(citizens == null)
citizensPresenter.requestCitizens();
}
@Override
protected void onPause() {
super.onPause();
citizensPresenter.unbindView();
}
@Override
public void onSaveInstanceState(Bundle outState) {
PresenterManager.getInstance().savePresenter(citizensPresenter, outState);
super.onSaveInstanceState(outState);
}
public void showLayout(boolean enabled) {
if(enabled){
rv_citizens.setAdapter(new CitizensArrayAdapter(this, citizens));
rv_citizens.setVisibility(View.VISIBLE);
}
}
public void successfulCitizens(List<CitizenCompact> citizens) {
this.citizens = citizens;
}
public void onRequestFailure(){
Bundle bundle = new Bundle();
if(dg_connection_failure == null){
dg_connection_failure = new ConnectionFailureDialog();
}
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);
}
public void setProgressBar(boolean enabled) {
if (enabled) {
pb_citizen.setVisibility(View.VISIBLE);
rv_citizens.setVisibility(View.INVISIBLE);
} else {
pb_citizen.setVisibility(View.INVISIBLE);
}
}
public static class ConnectionFailureDialog extends DialogFragment {
public static final String DIALOG_MESSAGE_KEY = "message";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getArguments().getString(DIALOG_MESSAGE_KEY))
.setTitle(getString(R.string.warningDialog_title))
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Activity activity = getActivity();
activity.onBackPressed();
}
});
return builder.create();
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
Activity activity = getActivity();
if(activity != null)
activity.onBackPressed();
}
}
}
package br.ufpr.c3sl.agendador.agendador;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.IOException;
import java.util.List;
import br.ufpr.c3sl.agendador.agendador.helpers.ConnectionErrorDialog;
import br.ufpr.c3sl.agendador.agendador.helpers.UserImgHelper;
import br.ufpr.c3sl.agendador.agendador.helpers.Utils;
import br.ufpr.c3sl.agendador.agendador.helpers.adapters.DependentsArrayAdapter;
import br.ufpr.c3sl.agendador.agendador.helpers.listeners.RecyclerViewItemListener;
import br.ufpr.c3sl.agendador.agendador.models.Dependent;
import br.ufpr.c3sl.agendador.agendador.models.FullDependent;
import br.ufpr.c3sl.agendador.agendador.presenters.DependentsListPresenter;
import br.ufpr.c3sl.agendador.agendador.presenters.PresenterManager;
import br.ufpr.c3sl.agendador.agendador.views.DependentsListView;
/**
* Created by Lucas B. Cunha on 08/08/17.
*/
public class DependentsListActivity extends AppCompatActivity implements DependentsListView {
private DependentsListPresenter presenter;
private ProgressBar pb_dependents;
private RecyclerView rv_dependents;
private ConnectionFailureDialog dg_connection_failure;
private List<Dependent> dependents;
private boolean updateList;
private static final int DEPENDENT_UPDATE_CODE = 1;
private static final int NEW_DEPENDENT_CODE = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);