Browse Source

Refactored and gave ForgotPasswordActivity a makeover. Added loading and error states to it.

Víctor Hernández 3 years ago
parent
commit
4f60b46938

+ 0
- 104
app/src/main/java/uprrp/tania/SendRecoveryEmailToServer.java View File

@@ -1,104 +0,0 @@
1
-/*************************************************************
2
- * By: Coralys Cubero Rivera
3
- * Date: 2019
4
- *************************************************************/
5
-
6
-package uprrp.tania;
7
-
8
-import android.content.Context;
9
-import android.os.AsyncTask;
10
-import android.util.Log;
11
-import android.widget.Toast;
12
-
13
-import java.io.BufferedReader;
14
-import java.io.InputStreamReader;
15
-import java.io.OutputStreamWriter;
16
-import java.io.UnsupportedEncodingException;
17
-import java.net.URL;
18
-import java.net.URLConnection;
19
-import java.net.URLEncoder;
20
-
21
-public class SendRecoveryEmailToServer extends AsyncTask<String, String, String> {
22
-
23
-    private Context context;
24
-
25
-    public SendRecoveryEmailToServer(Context context){
26
-        this.context = context.getApplicationContext();
27
-    }
28
-
29
-    @Override
30
-    protected String doInBackground(String... strings) {
31
-
32
-        String json  = null;
33
-        try {
34
-            json = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(strings[0], "UTF-8");
35
-            Log.d("RESET PASSWORD EMAIL", json);
36
-        } catch (UnsupportedEncodingException e) {
37
-            Log.e("RESET PASSWORD EMAIL ERROR", e.getMessage());
38
-        }
39
-
40
-        String text = "";
41
-        BufferedReader reader = null;
42
-
43
-        // Send data
44
-        try
45
-        {
46
-            // Defined URL  where to send data
47
-            URL url = new URL("https://tania.uprrp.edu/askForEmail.php");
48
-
49
-            // Send POST data request
50
-            URLConnection conn = url.openConnection();
51
-            conn.setDoOutput(true);
52
-            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
53
-            assert json != null;
54
-            wr.write(json);
55
-            wr.flush();
56
-
57
-            // Get the server response
58
-            reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
59
-            StringBuilder sb = new StringBuilder();
60
-            String line;
61
-
62
-            // Read Server Response
63
-            while((line = reader.readLine()) != null)
64
-            {
65
-                // Append server response in string
66
-                sb.append(line).append("\n");
67
-            }
68
-
69
-            text = sb.toString();
70
-        }
71
-        catch(Exception ex) {
72
-            Log.e("RESET PASSWORD EMAIL", ex.getMessage());
73
-        }
74
-        finally
75
-        {
76
-            try
77
-            {
78
-                assert reader != null;
79
-                reader.close();
80
-            }
81
-            catch(Exception ex) {
82
-                Log.e("RESET PASSWORD EMAIL ERROR", ex.getMessage());
83
-            }
84
-        }
85
-
86
-        return text;
87
-
88
-    }
89
-
90
-    @Override
91
-    protected void onPostExecute(String s) {
92
-        Log.d("RESET PASSWORD EMAIL RESPOND", "The server's response is: " + s);
93
-
94
-        String ss = s.substring(0,6);
95
-        String se = s.substring(0,8);
96
-        if (ss.equals("Succes")){
97
-            Toast.makeText(context, "Thanks! We will shortly send an email to reset your password.", Toast.LENGTH_SHORT).show();
98
-
99
-        }
100
-
101
-
102
-    }
103
-
104
-}

+ 1
- 1
app/src/main/java/uprrp/tania/activities/AccountRecoveryActivity.java View File

@@ -70,7 +70,7 @@ public class AccountRecoveryActivity extends AppCompatActivity {
70 70
             // TODO: find substitute for this deprecated dialog box
71 71
             final ProgressDialog progressDialog = ProgressDialog.show(AccountRecoveryActivity.this,
72 72
                     "Recovering Account",
73
-                    "This shouldn't take long");
73
+                    getString(R.string.progressDialogDescriptionText));
74 74
 
75 75
             // Send request to server
76 76
             SendAccountRecovery accountRecoveryTask = new SendAccountRecovery(new URLEventListener() {

+ 2
- 3
app/src/main/java/uprrp/tania/activities/ExperienceRegistrationActivity.java View File

@@ -3,7 +3,6 @@ package uprrp.tania.activities;
3 3
 import android.app.ProgressDialog;
4 4
 import android.content.Context;
5 5
 import android.content.Intent;
6
-import android.content.SharedPreferences;
7 6
 import android.net.Uri;
8 7
 import android.os.Bundle;
9 8
 import android.util.Log;
@@ -20,8 +19,8 @@ import java.util.Observer;
20 19
 
21 20
 import uprrp.tania.GlobalValues;
22 21
 import uprrp.tania.R;
23
-import uprrp.tania.utils.URLEventListener;
24 22
 import uprrp.tania.networking.SendExperienceRegistration;
23
+import uprrp.tania.utils.URLEventListener;
25 24
 
26 25
 public class ExperienceRegistrationActivity  extends AppCompatActivity implements Observer {
27 26
 
@@ -124,7 +123,7 @@ public class ExperienceRegistrationActivity  extends AppCompatActivity implement
124 123
         // TODO: find substitute for this deprecated dialog box
125 124
         final ProgressDialog progressDialog = ProgressDialog.show(ExperienceRegistrationActivity.this,
126 125
                 "Registering in Experience",
127
-                "This shouldn't take long");
126
+                getString(R.string.progressDialogDescriptionText));
128 127
 
129 128
         // Send registration request to server
130 129
         SendExperienceRegistration experienceRegistrationTask = new SendExperienceRegistration(new URLEventListener() {

+ 54
- 34
app/src/main/java/uprrp/tania/activities/ForgotPasswordActivity.java View File

@@ -1,11 +1,9 @@
1
-/*************************************************************
2
- * By: Coralys Cubero Rivera
3
- * Date: 2019
4
- *************************************************************/
5
-
6 1
 package uprrp.tania.activities;
7 2
 
3
+import android.app.ProgressDialog;
4
+import android.content.Intent;
8 5
 import android.os.Bundle;
6
+import android.util.Log;
9 7
 import android.view.View;
10 8
 import android.widget.Button;
11 9
 import android.widget.EditText;
@@ -14,51 +12,73 @@ import android.widget.Toast;
14 12
 import androidx.annotation.Nullable;
15 13
 import androidx.appcompat.app.AppCompatActivity;
16 14
 
17
-import org.json.JSONException;
18
-import org.json.JSONObject;
19
-
20 15
 import uprrp.tania.R;
21
-import uprrp.tania.SendRecoveryEmailToServer;
16
+import uprrp.tania.networking.SendRecoveryEmail;
17
+import uprrp.tania.utils.URLEventListener;
22 18
 
23 19
 public class ForgotPasswordActivity extends AppCompatActivity {
24 20
 
25
-    private String recovery_email;
21
+    private static final String TAG = "ForgotPasswordActivity";
22
+
26 23
     @Override
27 24
     protected void onCreate(@Nullable Bundle savedInstanceState) {
25
+
26
+        // Constructor stuff
28 27
         super.onCreate(savedInstanceState);
29 28
         setContentView(R.layout.activity_forgot_password);
30 29
 
31
-        //Let's get the email provided by the user so we can help them reset their password
32
-        final EditText emailRecoveryEditText = findViewById(R.id.editTextEmailResetPassword);
33
-        recovery_email = emailRecoveryEditText.getText().toString();
34
-
35
-        final JSONObject recoveryEmailJSON = new JSONObject();
36
-
37
-        //Let's send the provided email to the server
38
-        Button sendEmailRecoveryButton = findViewById(R.id.buttonSendEmail);
30
+        // Change all caps text to normal capitalization and add onClick listeners
31
+        final Button sendEmailRecoveryButton = findViewById(R.id.buttonSendEmail);
32
+        sendEmailRecoveryButton.setTransformationMethod(null); // TODO: this is a workaround I found, any other acceptable solution is welcome
39 33
         sendEmailRecoveryButton.setOnClickListener(new View.OnClickListener() {
40 34
             @Override
41 35
             public void onClick(View v) {
42
-                try {
43
-                    recovery_email = emailRecoveryEditText.getText().toString();
44
-                    //If we have an email, then we send it. Otherwise, the user needs to provide an email.
45
-                    if (!recovery_email.equals("")) {
46
-                        recoveryEmailJSON.put("email", recovery_email);
47
-                        SendRecoveryEmailToServer sendRecoveryEmailToServer = new SendRecoveryEmailToServer(getApplicationContext());
48
-                        sendRecoveryEmailToServer.execute(recoveryEmailJSON.toString());
49
-                    }
50
-                    else{
51
-                        Toast.makeText(getApplicationContext(), "Please enter your email to reset your password.", Toast.LENGTH_LONG);
52
-                    }
53
-                }
54
-                catch(JSONException e){
55
-                    e.getMessage();
56
-                }
57
-
36
+                sendRecoveryEmail();
58 37
             }
59 38
         });
60 39
 
40
+    }
41
+
42
+    private void sendRecoveryEmail() {
43
+
44
+        final EditText emailRecoveryEditText = findViewById(R.id.editTextEmailRecovery);
45
+        String email = emailRecoveryEditText.getText().toString();
46
+
47
+        // Email and password are needed (make sure user knows); else, proceed
48
+        if(email.equals("")) {
49
+            Toast.makeText(getApplicationContext(), "Please enter your email to reset your password.", Toast.LENGTH_LONG).show();
50
+        } else {
51
+
52
+            // Initiate progress dialog
53
+            // TODO: find substitute for this deprecated dialog box
54
+            final ProgressDialog progressDialog = ProgressDialog.show(ForgotPasswordActivity.this,
55
+                    "Verifying Email",
56
+                    getString(R.string.progressDialogDescriptionText));
57
+
58
+            // Define task
59
+            SendRecoveryEmail sendRecoveryEmailTask = new SendRecoveryEmail(new URLEventListener() {
60
+                @Override
61
+                public void onSuccess() {
62
+                    progressDialog.dismiss();
63
+                    Toast.makeText(getApplicationContext(), "Thanks!\nWe'll send you an email to reset your password.", Toast.LENGTH_SHORT).show();
64
+                    Intent intent = new Intent(ForgotPasswordActivity.this, GettingStartedActivity.class);
65
+                    startActivity(intent);
66
+                }
67
+
68
+                @Override
69
+                public void onFailure(Exception e) {
70
+                    progressDialog.dismiss();
71
+                    Toast.makeText(getApplicationContext(), "Error!\nPlease try again (make sure to write your email correctly)", Toast.LENGTH_SHORT).show();
72
+                    Log.e(TAG, "Couldn't send recovery email to server!");
73
+                    e.printStackTrace();
74
+                }
75
+            });
61 76
 
77
+            // Start task
78
+            sendRecoveryEmailTask.execute(email);
79
+
80
+        }
62 81
 
63 82
     }
83
+
64 84
 }

+ 3
- 3
app/src/main/java/uprrp/tania/activities/GettingStartedActivity.java View File

@@ -96,8 +96,8 @@ public class GettingStartedActivity extends AppCompatActivity {
96 96
         loginAccountButton.setOnClickListener(new View.OnClickListener() {
97 97
             @Override
98 98
             public void onClick(View v) {
99
-                Intent loginAccountIntent = new Intent(GettingStartedActivity.this, AccountRecoveryActivity.class);
100
-                startActivity(loginAccountIntent);
99
+                Intent intent = new Intent(GettingStartedActivity.this, AccountRecoveryActivity.class);
100
+                startActivity(intent);
101 101
             }
102 102
         });
103 103
 
@@ -142,7 +142,7 @@ public class GettingStartedActivity extends AppCompatActivity {
142 142
 
143 143
             // Use signature to get encoded consent form
144 144
             byte[] signatureBytes = Base64.decode(signatureBase64, Base64.DEFAULT);
145
-            String consentFormBase64 = createPdf(signatureBytes, signatureDate);
145
+            String consentFormBase64 = this.createPdf(signatureBytes, signatureDate);
146 146
 
147 147
             // Send JSON with consent form, signature date, and token
148 148
             String deviceToken = GlobalValues.getInstance().getDeviceToken();

+ 2
- 2
app/src/main/java/uprrp/tania/fragments/AssessmentsFragment.java View File

@@ -255,7 +255,7 @@ public class AssessmentsFragment extends Fragment implements Observer {
255 255
         // TODO: find substitute for this deprecated dialog box
256 256
         final ProgressDialog progressDialog = ProgressDialog.show(getContext(),
257 257
                 "Looking for Survey",
258
-                "This shouldn't take long");
258
+                getString(R.string.progressDialogDescriptionText));
259 259
 
260 260
         // Fetch the assessment to be taken (if there is at least one available),
261 261
         // and launch the assessment (if the button is pressed)
@@ -324,7 +324,7 @@ public class AssessmentsFragment extends Fragment implements Observer {
324 324
         // TODO: find substitute for this deprecated dialog box
325 325
         final ProgressDialog progressDialog = ProgressDialog.show(getContext(),
326 326
                 "Sending Answers",
327
-                "This shouldn't take long");
327
+                getString(R.string.progressDialogDescriptionText));
328 328
 
329 329
         // Send answers and prompt user if he wants to retry sending them if an error occurs
330 330
         SendAnswers sendAnswersTask = new SendAnswers(new URLEventListener() {

+ 1
- 1
app/src/main/java/uprrp/tania/fragments/WithdrawFragment.java View File

@@ -138,7 +138,7 @@ public class WithdrawFragment extends Fragment implements Observer {
138 138
         // TODO: find substitute for this deprecated dialog box
139 139
         final ProgressDialog progressDialog = ProgressDialog.show(getContext(),
140 140
                 "Withdrawing",
141
-                "This shouldn't take long");
141
+                getString(R.string.progressDialogDescriptionText));
142 142
 
143 143
         // Send withdrawal request to server
144 144
         SendWithdrawal sendWithdrawalTask = new SendWithdrawal(new URLEventListener() {

+ 5
- 2
app/src/main/java/uprrp/tania/networking/FetchAssessment.java View File

@@ -64,11 +64,14 @@ public class FetchAssessment extends AsyncTask<String, Void, JSONObject> {
64 64
 
65 65
         try {
66 66
 
67
+            // Send GET data request
67 68
             URL url = new URL(assessmentBaseURL + deviceToken);
68 69
             Log.d(TAG, "token:" + deviceToken); // log
69 70
             Log.d(TAG, "url:" + url.toString()); // log
70
-            HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
71
-            InputStream inputStream = httpsURLConnection.getInputStream();
71
+            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
72
+            InputStream inputStream = conn.getInputStream();
73
+
74
+            // Get the server response
72 75
             BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
73 76
             StringBuilder serverResponse =  new StringBuilder();
74 77
 

+ 5
- 2
app/src/main/java/uprrp/tania/networking/FetchUserStatus.java View File

@@ -65,11 +65,14 @@ public class FetchUserStatus extends AsyncTask<String, Void, JSONArray> {
65 65
 
66 66
         try {
67 67
 
68
+            // Send GET data request
68 69
             URL url = new URL(userStatusBaseURL + deviceToken);
69 70
             Log.d(TAG, "token:" + deviceToken); // log
70 71
             Log.d(TAG, "url:" + url.toString()); // log
71
-            HttpsURLConnection httpURLConnection = (HttpsURLConnection) url.openConnection();
72
-            InputStream inputStream = httpURLConnection.getInputStream();
72
+            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
73
+            InputStream inputStream = conn.getInputStream();
74
+
75
+            // Get the server response
73 76
             BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
74 77
             StringBuilder serverResponse =  new StringBuilder();
75 78
 

+ 3
- 2
app/src/main/java/uprrp/tania/networking/SendAccountRecovery.java View File

@@ -11,9 +11,10 @@ import java.io.InputStreamReader;
11 11
 import java.io.OutputStreamWriter;
12 12
 import java.io.UnsupportedEncodingException;
13 13
 import java.net.URL;
14
-import java.net.URLConnection;
15 14
 import java.net.URLEncoder;
16 15
 
16
+import javax.net.ssl.HttpsURLConnection;
17
+
17 18
 import uprrp.tania.utils.URLEventListener;
18 19
 
19 20
 public class SendAccountRecovery extends AsyncTask<String, Void, String> {
@@ -91,7 +92,7 @@ public class SendAccountRecovery extends AsyncTask<String, Void, String> {
91 92
 
92 93
             // Send POST data request
93 94
             URL url = new URL(loginBaseURL);
94
-            URLConnection conn = url.openConnection();
95
+            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
95 96
             conn.setDoOutput(true);
96 97
             OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
97 98
             wr.write(encodedRequestBody);

+ 2
- 2
app/src/main/java/uprrp/tania/networking/SendConsentForm.java View File

@@ -90,14 +90,14 @@ public class SendConsentForm extends AsyncTask <String, Void, String> {
90 90
             Log.d(TAG, "ConsentFormJSON is " + consentFormJSON.toString()); // log
91 91
 
92 92
             // Encode data
93
-            String jsonConsentSignature = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(strings[0], "UTF-8");
93
+            String encodedRequestBody = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(strings[0], "UTF-8");
94 94
 
95 95
             // Send POST data request
96 96
             URL url = new URL(consentFormBaseURL);
97 97
             URLConnection conn = url.openConnection();
98 98
             conn.setDoOutput(true);
99 99
             Writer writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8));
100
-            writer.write(jsonConsentSignature);
100
+            writer.write(encodedRequestBody);
101 101
             writer.close();
102 102
 
103 103
             // Get the server response

+ 129
- 0
app/src/main/java/uprrp/tania/networking/SendRecoveryEmail.java View File

@@ -0,0 +1,129 @@
1
+package uprrp.tania.networking;
2
+
3
+import android.os.AsyncTask;
4
+import android.util.Log;
5
+
6
+import org.json.JSONException;
7
+import org.json.JSONObject;
8
+
9
+import java.io.BufferedReader;
10
+import java.io.InputStreamReader;
11
+import java.io.OutputStreamWriter;
12
+import java.io.UnsupportedEncodingException;
13
+import java.net.URL;
14
+import java.net.URLEncoder;
15
+
16
+import javax.net.ssl.HttpsURLConnection;
17
+
18
+import uprrp.tania.utils.URLEventListener;
19
+
20
+public class SendRecoveryEmail extends AsyncTask<String, String, String> {
21
+
22
+    private static final String TAG = "SendRecoveryEmail";
23
+    private static final String emailRecoveryBaseURL = "https://tania.uprrp.edu/askForEmail.php";
24
+    private final URLEventListener myCallback;
25
+
26
+    public SendRecoveryEmail(URLEventListener callback){
27
+        this.myCallback = callback;
28
+    }
29
+
30
+    private boolean validInputs(String... strings) {
31
+
32
+        if(strings.length != 1) {
33
+            Log.e(TAG, "Invalid string array length!");
34
+            return false;
35
+        }
36
+
37
+        String email = strings[0];
38
+
39
+        if(email == null) {
40
+            Log.e(TAG, "Encountered null email!");
41
+            return false;
42
+        }
43
+
44
+        return true;
45
+
46
+    }
47
+
48
+    @Override
49
+    protected String doInBackground(String... strings) {
50
+
51
+        // Validation
52
+        if(!validInputs(strings)) {
53
+            Log.e(TAG, "Invalid inputs given!");
54
+            return null;
55
+        }
56
+
57
+        // Extract variables
58
+        String email = strings[0];
59
+
60
+        try {
61
+
62
+            // Create JSON
63
+            JSONObject recoveryEmailJSON = new JSONObject();
64
+            recoveryEmailJSON.put("email", email);
65
+            Log.d(TAG, "recoveryEmailJSON is " + recoveryEmailJSON.toString());
66
+
67
+            // Encode data
68
+            String encodedRequestBody = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(recoveryEmailJSON.toString(), "UTF-8");
69
+
70
+            // Send POST data request
71
+            URL url = new URL(emailRecoveryBaseURL);
72
+            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
73
+            conn.setDoOutput(true);
74
+            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
75
+            wr.write(encodedRequestBody);
76
+            wr.flush();
77
+
78
+            // Get the server response
79
+            BufferedReader serverReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
80
+            StringBuilder serverResponse = new StringBuilder();
81
+
82
+            String line = "";
83
+            while(line != null) {
84
+                serverResponse.append(line);
85
+                line = serverReader.readLine();
86
+            }
87
+
88
+            String response = serverResponse.toString();
89
+            Log.d(TAG, "The server's response is " + response);
90
+            if(response.contains("Success")) {
91
+                return response;
92
+            } else {
93
+                return null;
94
+            }
95
+
96
+        } catch(JSONException e) {
97
+            Log.e(TAG, "Couldn't prepare recoveryEmailJSON!");
98
+            e.printStackTrace();
99
+            return null;
100
+        } catch (UnsupportedEncodingException e) {
101
+            Log.e(TAG, "Couldn't encode recoveryEmailJSON!");
102
+            e.printStackTrace();
103
+            return null;
104
+        } catch(Exception e) {
105
+            Log.e(TAG, "Couldn't communicate with server while sending recovery email!");
106
+            e.printStackTrace();
107
+            return null;
108
+        }
109
+
110
+    }
111
+
112
+    @Override
113
+    protected void onPostExecute(String response) {
114
+
115
+        if(this.myCallback == null) {
116
+            Log.e(TAG, "Callback wasn't initialized first!");
117
+            return;
118
+        }
119
+
120
+        if(response == null) {
121
+            this.myCallback.onFailure(new Exception("Error occurred during transaction!"));
122
+            return;
123
+        }
124
+
125
+        this.myCallback.onSuccess();
126
+
127
+    }
128
+
129
+}

+ 0
- 1
app/src/main/res/layout/activity_account_recovery.xml View File

@@ -90,7 +90,6 @@
90 90
         android:layout_marginEnd="@dimen/horizontalMargin"
91 91
         android:autofillHints="AUTOFILL_HINT_EMAIL_ADDRESS"
92 92
         android:backgroundTint="@color/colorPrimary"
93
-        android:ems="10"
94 93
         android:hint="@string/rsb_email"
95 94
         android:inputType="textEmailAddress"
96 95
         android:textColor="@color/textColor2"

+ 29
- 28
app/src/main/res/layout/activity_forgot_password.xml View File

@@ -1,6 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2
-<androidx.constraintlayout.widget.ConstraintLayout
3
-    xmlns:android="http://schemas.android.com/apk/res/android"
2
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
4 3
     xmlns:app="http://schemas.android.com/apk/res-auto"
5 4
     xmlns:tools="http://schemas.android.com/tools"
6 5
     android:layout_width="match_parent"
@@ -8,49 +7,51 @@
8 7
 
9 8
     <TextView
10 9
         android:id="@+id/textViewEmailResetPassword"
11
-        android:layout_width="307dp"
12
-        android:layout_height="71dp"
13
-        android:fontFamily="@font/acme"
14
-        android:text="Please provide the email associated to your account so you can reset your password:"
10
+        android:layout_width="0dp"
11
+        android:layout_height="wrap_content"
12
+        android:layout_marginStart="@dimen/horizontalMargin"
13
+        android:layout_marginEnd="@dimen/horizontalMargin"
14
+        android:fontFamily="@font/cabin"
15
+        android:text="@string/forgotPasswordDescriptionText"
15 16
         android:textAlignment="center"
16 17
         android:textSize="18sp"
17
-        app:layout_constraintBottom_toTopOf="@+id/editTextEmailResetPassword"
18
+        app:layout_constraintBottom_toTopOf="@+id/buttonSendEmail"
18 19
         app:layout_constraintEnd_toEndOf="parent"
19 20
         app:layout_constraintStart_toStartOf="parent"
20
-        app:layout_constraintTop_toTopOf="parent"
21
-        app:layout_constraintVertical_bias="1.0" />
21
+        app:layout_constraintTop_toTopOf="parent" />
22 22
 
23 23
     <EditText
24
-        android:id="@+id/editTextEmailResetPassword"
25
-        android:layout_width="wrap_content"
24
+        android:id="@+id/editTextEmailRecovery"
25
+        android:layout_width="0dp"
26 26
         android:layout_height="wrap_content"
27
-        android:ems="10"
28
-        android:fontFamily="@font/acme"
27
+        android:layout_marginStart="@dimen/horizontalMargin"
28
+        android:layout_marginTop="24dp"
29
+        android:layout_marginEnd="@dimen/horizontalMargin"
30
+        android:autofillHints="AUTOFILL_HINT_EMAIL_ADDRESS"
31
+        android:backgroundTint="@color/colorPrimary"
32
+        android:hint="@string/rsb_email"
29 33
         android:inputType="textEmailAddress"
30 34
         android:textAlignment="center"
31
-        android:textColor="#BEBEBE"
32
-        android:textStyle="bold"
33
-        app:layout_constraintBottom_toTopOf="@+id/buttonSendEmail"
35
+        android:textColor="@color/textColor2"
34 36
         app:layout_constraintEnd_toEndOf="parent"
35 37
         app:layout_constraintStart_toStartOf="parent"
36
-        app:layout_constraintTop_toTopOf="parent"
37
-        app:layout_constraintVertical_bias="0.935"
38
-        tools:text="email for password recovery" />
38
+        app:layout_constraintTop_toBottomOf="@+id/textViewEmailResetPassword" />
39 39
 
40 40
     <Button
41 41
         android:id="@+id/buttonSendEmail"
42
-        android:layout_width="272dp"
43
-        android:layout_height="47dp"
44
-        android:background="@color/colorPrimaryDark"
45
-        android:fontFamily="@font/acme"
46
-        android:text="SEND EMAIL"
47
-        android:textColor="@color/textColor1"
42
+        android:layout_width="0dp"
43
+        android:layout_height="wrap_content"
44
+        android:layout_marginStart="@dimen/horizontalMargin"
45
+        android:layout_marginEnd="@dimen/horizontalMargin"
46
+        android:layout_marginBottom="@dimen/verticalMargin"
47
+        android:background="@drawable/button_background"
48
+        android:fontFamily="sans-serif-black"
49
+        android:text="@string/sendEmailButtonText"
50
+        android:textColor="@android:color/white"
48 51
         android:textSize="18sp"
49 52
         android:textStyle="bold"
50 53
         app:layout_constraintBottom_toBottomOf="parent"
51 54
         app:layout_constraintEnd_toEndOf="parent"
52
-        app:layout_constraintHorizontal_bias="0.496"
53 55
         app:layout_constraintStart_toStartOf="parent"
54
-        app:layout_constraintTop_toTopOf="parent"
55
-        app:layout_constraintVertical_bias="0.559" />
56
+        app:layout_constraintTop_toBottomOf="@+id/textViewEmailResetPassword" />
56 57
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 25
- 18
app/src/main/res/values/strings.xml View File

@@ -1,26 +1,28 @@
1 1
 <resources>
2
-    <string name="menu_data_cleared">La información ha sido borrada</string>
3
-    <string name="user_name">Nombre de usuario:</string>
4
-    <string name="date_consented">Fecha de consentimiento:</string>
5
-    <string name="msg_token_fmt" translatable="false">InstanceID Token: %s</string>
6
-    <string name="log_token">Log Token</string>
7
-    <string name="msg_subscribed">Subscribed to weather topic</string>
8
-    <string name="default_notification_channel_id" translatable="false">fcm_default_channel</string>
2
+
9 3
     <!--
10 4
         This is the name that users will see when interacting with this channel.
11 5
         It should describe the category of notifications that will be sent through this channel
12 6
      -->
13
-    <string name="default_notification_channel_name" translatable="true">Weather</string>
14
-    <string name="msg_subscribe_failed">Failed to subscribe to weather topic</string>
15
-    <string name="fcm_message">FCM Message</string>
16
-    <string name="title_encuestamarle">Encuesta MARLE</string>
17
-    <string name="title_activity_main2">MainActivity2</string>
7
+<!--    <string name="default_notification_channel_name" translatable="true">Weather</string>-->
8
+<!--    <string name="msg_subscribe_failed">Failed to subscribe to weather topic</string>-->
9
+<!--    <string name="fcm_message">FCM Message</string>-->
10
+<!--    <string name="title_encuestamarle">Encuesta MARLE</string>-->
11
+<!--    <string name="title_activity_main2">MainActivity2</string>-->
12
+<!--    <string name="menu_data_cleared">La información ha sido borrada</string>-->
13
+<!--    <string name="user_name">Nombre de usuario:</string>-->
14
+<!--    <string name="date_consented">Fecha de consentimiento:</string>-->
15
+<!--    <string name="msg_token_fmt" translatable="false">InstanceID Token: %s</string>-->
16
+<!--    <string name="log_token">Log Token</string>-->
17
+<!--    <string name="msg_subscribed">Subscribed to weather topic</string>-->
18
+
19
+    <!--  IDK???  -->
18 20
     <string name="title_home">Home</string>
19 21
     <string name="title_dashboard">Dashboard</string>
20 22
     <string name="title_notifications">Notifications</string>
21
-    <string name="title_activity_consent_pdf_viewer">Consent TANIA</string>
23
+    <string name="title_activity_consent_pdf_viewer">Consent TANIA</string> <!--might not be necessary-->
24
+    <string name="default_notification_channel_id" translatable="false">fcm_default_channel</string>
22 25
 
23
-    <!-- !!!!! POST-Víctor !!!!! -->
24 26
     <!--  AmazonCognito Details  -->
25 27
     <string name="identityPoolID">us-east-1:574094cd-0784-4e26-bd14-4fa72ae63579</string>
26 28
     <!--  API Endpoints  -->
@@ -35,6 +37,7 @@
35 37
     <string name="appNameLong">Timely And Non-Intrusive Assessments</string>
36 38
     <string name="surveyToolbarText">Assessment</string>
37 39
     <string name="tokenErrorText">There was an error…\nPlease come back later!</string>
40
+    <string name="progressDialogDescriptionText">This shouldn\'t take long</string>
38 41
     <!--  Assessment Fragment  -->
39 42
     <string name="mainGreetingText">Hello! 👋</string>
40 43
     <string name="loadingText">Please wait a moment…</string>
@@ -52,12 +55,12 @@
52 55
     <!--  Consent Document Information  -->
53 56
     <string name="consentFileName">/consent-tania-app.pdf</string>
54 57
     <string name="consentOverview">You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (TANIA) to collect perception data of students participating in research experiences and (2) to use TANIA to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students. This study is been carried out under the supervision of Dr. Juan S. Ramírez Lugo, Department of Biology and Dr. Carlos Corrada Bravo, Department of Computer Sciences at the University of Puerto Rico, Río Piedras Campus. You were selected to participate in this study because you are enrolled in a course that offers a research experience or you voluntarily participate in research with a professor affiliated to the Río Piedras Campus.</string>
55
-    <string name="consentTimeCommitment">In the study you will be asked to answer a questionnaire, about your perception of self-efficacy in research, scientific identity and decision-making about your professional career at the beginning and end of your research experience. It will take you between 10-20 minutes to answer this questionnaire. You are also expected to respond to short questionnaires between 1-3 times per week while you are participating in the research. You will receive notifications at random times during your research experience and answer questions adapted from survey instruments that have been previously validated. It will take you between 1-3 minutes to answer these questionnaires. It is expected that 25 students will participate in this phase of the study.</string>
58
+    <string name="consentTimeCommitment">In the study you will be asked to answer a questionnaire, about your perception of self–efficacy in research, scientific identity and decision–making about your professional career at the beginning and end of your research experience. It will take you between 1020 minutes to answer this questionnaire. You are also expected to respond to short questionnaires between 13 times per week while you are participating in the research. You will receive notifications at random times during your research experience and answer questions adapted from survey instruments that have been previously validated. It will take you between 13 minutes to answer these questionnaires. It is expected that 25 students will participate in this phase of the study.</string>
56 59
     <string name="consentDataGathering">While answering the questions, you may feel uncomfortable because the questions are about your general opinion about science and research and your career. If you feel uncomfortable with the questions, you can stop and choose not to answer the question. When you download the application, it will occupy space in the memory of your mobile device and also consume your data plan in the transmission of information when you answer the questionnaires. It is estimated that the application will have a size of 40 Mb (As reference the WhatsApp application is 88.9 Mb). Although at the moment we cannot say exactly how much memory or data you will consume, we understand that both will be minimal. The risks of this study are minimal.</string>
57 60
     <string name="consentPrivacy">Your identity will be protected throughout the study. Your identifiable information will be handled confidentially and when presenting the results of the investigation you will not be identified. The information you issue through the application will be through access credentials (username and password) that only you will know. These access credentials will be encrypted and any subsequent association between you and your data will be made by reference to the encrypted information, not your personal identity. The data collected through the questionnaires will be stored digitally on a secure hard drive in the researcher\'s office. These data will also be stored virtually in the cloud, with access limited only to researchers.</string>
58 61
     <string name="consentDataUse">The data obtained will be used to improve academic offerings and research experiences. The results of this study may be part of a scientific publication on science education strategies and will serve as a basis to improve the teaching curriculum. It may be used to develop proposals for obtaining external funds for research. The officials of the Río Piedras Campus of the University of Puerto Rico and / or federal agencies responsible for ensuring the integrity of the research may require the researcher to prove the data obtained in this study, including this informed consent.</string>
59 62
     <string name="consentGeneral">If you decide to participate in this study, understand that your participation is completely voluntary and that you have the right to abstain from participating or even withdraw at any time of the study without incurring in any penalty. In the application you will find the instructions to withdraw from the study and stop receiving notifications if you wish. You also have the right not to answer any question if you wish. Your participation in this study will not affect in any way your academic evaluation in the courses in which you are carrying out this research. Finally, you have the right to receive a copy of this document.</string>
60
-    <string name="consentConclusion">If you have any questions or would like more information about this study, please contact Prof. Ramírez Lugo at 787-764-0000 Ext. 88068, at 787-918-5330 or by email at juan.ramirez3@upr.edu at any moment. If you have any questions about your rights as a participant or claim or complaint related to your participation in this study, you may contact the Compliance Officer of the Río Piedras Campus of the University of Puerto Rico, at telephone 764-0000, extension 86773 or cipshi. degi@upr.edu. Your signature on this document means that you have decided to participate voluntarily, that the information presented on this Consent Sheet has been discussed and that you have received a copy of this document. This printed sheet will be stored under lock and key for a period of 5 years after completion of the investigation and will then be shredded and discarded.</string>
63
+    <string name="consentConclusion">If you have any questions or would like more information about this study, please contact Prof. Ramírez Lugo at 787–764–0000 Ext. 88068, at 787–918–5330 or by email at juan.ramirez3@upr.edu at any moment. If you have any questions about your rights as a participant or claim or complaint related to your participation in this study, you may contact the Compliance Officer of the Río Piedras Campus of the University of Puerto Rico, at telephone 787–764–0000, extension 86773 or cipshi. degi@upr.edu. Your signature on this document means that you have decided to participate voluntarily, that the information presented on this Consent Sheet has been discussed and that you have received a copy of this document. This printed sheet will be stored under lock and key for a period of 5 years after completion of the investigation and will then be shredded and discarded.</string>
61 64
     <!--  Getting Started Activity  -->
62 65
     <string name="createAccountButtonText">Join the Study</string>
63 66
     <string name="recoverAccountButtonText">Login</string>
@@ -66,8 +69,8 @@
66 69
     <string name="overviewConsentSectionSummaryText">You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (TANIA) to collect perception data of students participating in research experiences and (2) to use TANIA to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students.</string>
67 70
     <string name="overviewConsentSectionContentText">This study is been carried out under the supervision of Dr. Juan S. Ramírez Lugo, Department of Biology and Dr. Carlos Corrada Bravo, Department of Computer Sciences at the University of Puerto Rico, Río Piedras Campus. You were selected to participate in this study because you are enrolled in a course that offers a research experience or you voluntarily participate in research with a professor affiliated to the Río Piedras Campus.</string>
68 71
     <string name="timeCommitmentTitleText">Time Commitment</string>
69
-    <string name="timeCommitmentConsentSectionContentText">You are also expected to respond to short questionnaires between 1-3 times per week while you are participating in the research. You will receive notifications at random times during your research experience and answer questions adapted from survey instruments that have been previously validated. It will take you between 1-3 minutes to answer these questionnaires. It is expected that 25 students will participate in this phase of the study.</string>
70
-    <string name="timeCommitmentConsentSectionSummaryText">In the study you will be asked to answer a questionnaire, about your perception of self-efficacy in research, scientific identity and decision-making about your professional career at the beginning and end of your research experience. It will take you between 10-20 minutes to answer this questionnaire.</string>
72
+    <string name="timeCommitmentConsentSectionContentText">You are also expected to respond to short questionnaires between 13 times per week while you are participating in the research. You will receive notifications at random times during your research experience and answer questions adapted from survey instruments that have been previously validated. It will take you between 13 minutes to answer these questionnaires. It is expected that 25 students will participate in this phase of the study.</string>
73
+    <string name="timeCommitmentConsentSectionSummaryText">In the study you will be asked to answer a questionnaire, about your perception of self–efficacy in research, scientific identity and decision–making about your professional career at the beginning and end of your research experience. It will take you between 1020 minutes to answer this questionnaire.</string>
71 74
     <string name="dataGatheringTitleText">Data Gathering</string>
72 75
     <string name="dataGatheringConsentSectionSummaryText">While answering the questions, you may feel uncomfortable because the questions are about your general opinion about science and research and your career. If you feel uncomfortable with the questions, you can stop and choose not to answer the question.</string>
73 76
     <string name="dataGatheringConsentSectionContentText">In addition, when you download the application, it will occupy space in the memory of your mobile device and also consume your data plan in the transmission of information when you answer the questionnaires. It is estimated that the application will have a size of 40 Mb (As reference the WhatsApp application is 88.9 Mb). Although at the moment we cannot say exactly how much memory or data you will consume, we understand that both will be minimal. The risks of this study are minimal.</string>
@@ -78,8 +81,12 @@
78 81
     <string name="dataUseConsentSectionSummaryText">The data obtained will be used to improve academic offerings and research experiences. The results of this study may be part of a scientific publication on science education strategies and will serve as a basis to improve the teaching curriculum.</string>
79 82
     <string name="dataUseConsentSectionContentText">It may be used to develop proposals for obtaining external funds for research. The officials of the Río Piedras Campus of the University of Puerto Rico and / or federal agencies responsible for ensuring the integrity of the research may require the researcher to prove the data obtained in this study, including this informed consent. The information handled by your device can be intervened or revised by third parties. These people can be people with legitimate or illegitimate access to the device and its content such as a family member, employer, hackers, intruders, etc. In addition, the device that you use may keep track of the information you access or send over the Internet.</string>
80 83
     <string name="generalTitleText">General</string>
84
+    <!--  Account Recovery Account  -->
81 85
     <string name="accountRecoveryTitleText">LOG IN TO ACCOUNT</string>
82 86
     <string name="forgotPasswordButtonText">Forgot Password</string>
83 87
     <string name="emailInputLabelText">Email:</string>
84 88
     <string name="passwordInputLabelText">Password:</string>
89
+    <!--  Forgot Password Activity  -->
90
+    <string name="sendEmailButtonText">Send Email</string>
91
+    <string name="forgotPasswordDescriptionText">Please provide the email associated to your account so you can reset your password:</string>
85 92
 </resources>