diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ed85fed..3f3dd4d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -25,7 +25,6 @@
android:theme="@style/AppTheme">
@@ -36,17 +35,14 @@
+ android:name=".activity.SettingsActivity" />
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..25b1968
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
index c347afc..b8d5ea3 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
@@ -92,8 +92,8 @@ public abstract class BaseActivity
} else if (itemName.equals(getResources().getString(R.string.navigation_item_profile))) {
- /* launchIntent = new Intent(getApplicationContext(), ProfileActivity.class);
- startActivity(launchIntent);*/
+ launchIntent = new Intent(getApplicationContext(), TutorTab.class);
+ startActivity(launchIntent);
} else if (itemName.equals(getResources().getString(R.string.navigation_item_settings))) {
launchIntent = new Intent(getApplicationContext(), SettingsActivity.class);
startActivity(launchIntent);
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
index 06f1c5f..b1ebc98 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
@@ -154,8 +154,9 @@ public class LoginActivity extends AppCompatActivity {
private void loginProcess(String email, String password) {
ValidateUser user = new ValidateUser(email, password);
-
- disposable.add(ldapService.validate(user)
+ LdapUser fuser = new LdapUser(email,password,"wmi","tutor","marek","nocny","szmare@wmi.pl");
+// disposable.add(ldapService.validate(user)
+ disposable.add(ldapService.fakeValidate(fuser)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError));
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/TutorTab.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/TutorTab.java
index 566a4a8..f2fba1c 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/TutorTab.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/TutorTab.java
@@ -1,31 +1,163 @@
-package com.uam.wmi.findmytutor.activity;
-
-import android.os.Bundle;
-import android.support.design.widget.FloatingActionButton;
-import android.support.design.widget.Snackbar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import android.view.View;
-
-import com.uam.wmi.findmytutor.R;
-
-public class TutorTab extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_tutor_tab);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
-
- FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
- fab.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
- .setAction("Action", null).show();
- }
- });
- }
-
-}
+package com.uam.wmi.findmytutor.activity;
+
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.annimon.stream.Stream;
+import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
+import com.uam.wmi.findmytutor.R;
+import com.uam.wmi.findmytutor.model.DutyHourViewModel;
+import com.uam.wmi.findmytutor.model.TutorTabViewModel;
+import com.uam.wmi.findmytutor.model.User;
+import com.uam.wmi.findmytutor.network.ApiClient;
+import com.uam.wmi.findmytutor.service.TutorTabApi;
+import com.uam.wmi.findmytutor.service.UserService;
+import com.uam.wmi.findmytutor.utils.PrefUtils;
+import com.uam.wmi.findmytutor.utils.RestApiHelper;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.observers.DisposableSingleObserver;
+import io.reactivex.schedulers.Schedulers;
+import okhttp3.ResponseBody;
+import retrofit2.Response;
+
+public class TutorTab extends AppCompatActivity {
+ private TutorTabApi tutorTabService;
+ private UserService userService;
+ private CompositeDisposable disposable = new CompositeDisposable();
+ private TextView userName;
+ private TextView userDutyHours;
+ private EditText userNote;
+ private TextView userRoom;
+ private TextView userEmail;
+ private TextView department;
+ private Button saveButon;
+ private TutorTabViewModel newTab;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ tutorTabService = ApiClient.getClient(getApplicationContext())
+ .create(TutorTabApi.class);
+ userService = ApiClient.getClient(getApplicationContext())
+ .create(UserService.class);
+ setContentView(R.layout.content_tutor_tab);
+ TextView userName = findViewById(R.id.userName);
+ TextView userDutyHours = findViewById(R.id.userDutyHours);
+ EditText userNote = findViewById(R.id.userNote);
+ TextView userRoom = findViewById(R.id.userRoom);
+ TextView userEmail = findViewById(R.id.userEmail);
+ TextView department = findViewById(R.id.userDepartment);
+ Button saveButon = findViewById(R.id.saveButon);
+ userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
+ disposable.add(
+ tutorTabService.apiUsersTutorTabByTutorIdGet(PrefUtils.getUserId(getApplicationContext()))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribeWith(new DisposableSingleObserver() {
+ @Override
+ public void onSuccess(TutorTabViewModel tutorTabViewModel) {
+ newTab = tutorTabViewModel;
+ List dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
+ .map(DutyHourViewModel::getSummary).toList();
+ Log.d("TUTORTAB", Arrays.toString(dutyHoursList.toArray()));
+ userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
+ userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
+ if (!tutorTabViewModel.getNote().equals("")) {
+ userNote.setText(String.format("%s", tutorTabViewModel.getNote()));
+ }
+ userDutyHours.setText(String.format("%s: %s", getString(R.string.userDutyHoursHeader), Arrays.toString(dutyHoursList.toArray())));
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ showError(e);
+ }
+ }));
+ disposable.add(
+
+ userService.getUserById(PrefUtils.getUserId(getApplicationContext()))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribeWith(new DisposableSingleObserver() {
+ @Override
+ public void onSuccess(User user) {
+ department.setText(user.getDepartment());
+ Log.d("TUTORTAB", (user.getDepartment()));
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ showError(e);
+ }
+ }));
+ setUpSaveListener(saveButon, userNote);
+ }
+
+ private void setUpSaveListener(Button button, EditText note) {
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ TutorTabViewModel toPost = newTab;
+ toPost.setNote(note.getText().toString());
+ putUserTab(toPost);
+ }
+ });
+ }
+
+ private void putUserTab(TutorTabViewModel tutorTabViewModel) {
+ disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(this::handleResponse, this::handleError));
+ }
+
+ private void handleResponse(TutorTabViewModel tutorTabViewModel) {
+ Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
+
+ }
+
+
+ private void handleError(Throwable error) {
+ if (error instanceof HttpException) {
+
+ ResponseBody responseBody = ((HttpException) error).response().errorBody();
+ Toast.makeText(getApplicationContext(),
+ RestApiHelper.getErrorMessage(responseBody), Toast.LENGTH_SHORT).show();
+
+ } else {
+ Toast.makeText(getApplicationContext(),
+ "Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
+ Log.d("FEEDBACK", error.getMessage());
+ }
+ }
+
+ private void showError(Throwable e) {
+ String message;
+
+ if (e instanceof HttpException) {
+ ResponseBody responseBody = ((HttpException) e).response().errorBody();
+ message = RestApiHelper.getErrorMessage(responseBody);
+ } else {
+ message = "Network Error !";
+ }
+
+// Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
+// .show();
+ Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
+ }
+
+}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/TutorTabApi.java b/app/src/main/java/com/uam/wmi/findmytutor/service/TutorTabApi.java
index e2f6d9a..e5ba6b1 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/service/TutorTabApi.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/service/TutorTabApi.java
@@ -51,7 +51,7 @@ public interface TutorTabApi {
"Content-Type:application/json"
})
@PUT("api/users/tutorTab/{tutorId}")
- Observable apiUsersTutorTabByTutorIdPut(
+ Observable apiUsersTutorTabByTutorIdPut(
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
);
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java
index b78eaa0..e88f7d7 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java
@@ -47,7 +47,7 @@ public class ManualLocationUtils {
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activityContext);
View view = layoutInflaterAndroid.inflate(R.layout.location_modal, null);
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activityContext);
- alertDialogBuilderUserInput.setView(view).setPositiveButton(activityContext.getString(R.string.modal_feedback_send), null);
+ alertDialogBuilderUserInput.setView(view).setPositiveButton(activityContext.getString(R.string.modal_location_send), null);
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
EditText modalUserInput = view.findViewById(R.id.feedback_input);
@@ -62,7 +62,7 @@ public class ManualLocationUtils {
public void onClick(View view) {
String body = modalUserInput.getText().toString();
if (TextUtils.isEmpty(body)) {
- Toast.makeText(activityContext, activityContext.getString(R.string.modal_feedback_hint), Toast.LENGTH_SHORT).show();
+ Toast.makeText(activityContext, activityContext.getString(R.string.modal_location_hint), Toast.LENGTH_SHORT).show();
modalUserInput.requestFocus();
} else {
PrefUtils.putManualLocation(activityContext, latLng);
diff --git a/app/src/main/res/drawable/ic_info_black_24dp.xml b/app/src/main/res/drawable/ic_info_black_24dp.xml
new file mode 100644
index 0000000..34b8202
--- /dev/null
+++ b/app/src/main/res/drawable/ic_info_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
new file mode 100644
index 0000000..e3400cf
--- /dev/null
+++ b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_sync_black_24dp.xml b/app/src/main/res/drawable/ic_sync_black_24dp.xml
new file mode 100644
index 0000000..5a283aa
--- /dev/null
+++ b/app/src/main/res/drawable/ic_sync_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logo_black.xml b/app/src/main/res/drawable/logo_black.xml
new file mode 100644
index 0000000..e55f258
--- /dev/null
+++ b/app/src/main/res/drawable/logo_black.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_tutor_tab.xml b/app/src/main/res/layout/activity_tutor_tab.xml
index 72feb63..5c5d96f 100644
--- a/app/src/main/res/layout/activity_tutor_tab.xml
+++ b/app/src/main/res/layout/activity_tutor_tab.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_tutor_tab.xml b/app/src/main/res/layout/content_tutor_tab.xml
index e83904e..8bfd4bf 100644
--- a/app/src/main/res/layout/content_tutor_tab.xml
+++ b/app/src/main/res/layout/content_tutor_tab.xml
@@ -1,11 +1,84 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index eca70cf..67820c5 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index eca70cf..67820c5 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index a2f5908..5a0db4f 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..fc1f7ee
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
index 1b52399..45664dd 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index ff10afd..98fd076 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..44c2c4b
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
index 115a4c7..5e680a3 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index dcd3cd8..13e7bab 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..9dd0531
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index 459ca60..ad283e8 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 8ca12fe..df81e90 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..54969c0
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index 8e19b41..37acc64 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index b824ebd..a30db0e 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..08bccd9
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index 4c19a13..1f3a67b 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 4d7cbf0..e80eac9 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -144,6 +144,12 @@
FEEDBACK
WYŚLIJ
Dziękujemy za przesłanie feedbacku.
+ Usuń manualną lokację
+ Profil
+ Zapisz
+ Tutaj możesz dodać swoją notatkę.\\nBędzie widoczna dla innych użytkowników.
+ WYŚLIJ
+ Proszę nazwać wybraną lokację.
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..1f5cf2a
--- /dev/null
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #A62613
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 612fd3f..fe1b0b8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -82,6 +82,9 @@
Descrition
+ Save
+ Here you can add your note.\nIt will be visible to the other users.
+
key_description
@@ -117,7 +120,9 @@
Version
Choose email client
Settings
-
+ SEND
+ Please name choosen location.
+ modal_feedback_send
@@ -213,6 +218,7 @@
MapActivity
User profile
Remove Manual location
+ TutorTab