diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f8e71b7..3a4122d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,6 +8,13 @@
+
+
+
+
+
+
+
= Build.VERSION_CODES.O) {
- startForegroundService(startIntent);
+ if ((ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
+
+ } else {
+ ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION
+
+ },
+ REQUEST_PERMISSIONS);
+ }
} else {
- startService(startIntent);
+
+ Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ startForegroundService(startIntent);
+ } else {
+ startService(startIntent);
+ }
}
}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
index 3af23d8..ecc460a 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
@@ -117,7 +117,7 @@ public class UsersListFragment extends Fragment {
private void showNoteDialog(final User user) {
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity().getApplicationContext());
- View view = layoutInflaterAndroid.inflate(R.layout.note_dialog, null);
+ View view = layoutInflaterAndroid.inflate(R.layout.user_list_modal, null);
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(getActivity());
alertDialogBuilderUserInput.setView(view);
@@ -128,6 +128,7 @@ public class UsersListFragment extends Fragment {
TextView userName = view.findViewById(R.id.userName);
ListView userDutyHours = view.findViewById(R.id.userDutyHours);
+ TextView userDutyHoursTitle = view.findViewById(R.id.userDutyHoursTitle);
TextView userNote = view.findViewById(R.id.userNote);
TextView userRoom = view.findViewById(R.id.userRoom);
TextView userEmail = view.findViewById(R.id.userEmail);
@@ -150,9 +151,10 @@ public class UsersListFragment extends Fragment {
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
userNote.setText(String.format("%s: %s", getString(R.string.userNote), tutorTabViewModel.getNote()));
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
+ userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
final ArrayAdapter arrayAdapter = new ArrayAdapter<>(getActivity(),
- android.R.layout.simple_list_item_activated_1, dutyHoursList);
+ android.R.layout.test_list_item, dutyHoursList);
userDutyHours.setAdapter(arrayAdapter);
alertDialog.show();
@@ -165,6 +167,7 @@ public class UsersListFragment extends Fragment {
}));
}
+
private void fetchAllTutors() {
disposable.add(
userService.apiUsersGet()
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
index 764c99f..2412286 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
@@ -43,14 +43,15 @@ import timber.log.Timber;
public class BackgroundLocalizationService extends Service {
private static final String TAG = "MyLocationService";
- private static final int LOCATION_INTERVAL = 100;
- private static final float LOCATION_DISTANCE = 20f;
+ private static final int LOCATION_INTERVAL = 1000;
+ private static final float LOCATION_DISTANCE = 5f;
public static String str_receiver = "background.location.broadcast";
private static long notify_interval = 10000;
Location mLastLocation;
- Intent intent;
+
ArrayList providers = new ArrayList();
LocationListener[] mLocationListeners;
+
private LocationManager mLocationManager = null;
private Handler mHandler = new Handler();
private HandlerThread mHandlerThread = null;
@@ -59,12 +60,12 @@ public class BackgroundLocalizationService extends Service {
public BackgroundLocalizationService() {
providers.add(LocationManager.GPS_PROVIDER);
providers.add(LocationManager.NETWORK_PROVIDER);
- //providers.add(LocationManager.PASSIVE_PROVIDER);
+ providers.add(LocationManager.PASSIVE_PROVIDER);
mLocationListeners = new LocationListener[]{
new LocationListener(LocationManager.GPS_PROVIDER),
- new LocationListener(LocationManager.NETWORK_PROVIDER)
- //new LocationListener(LocationManager.PASSIVE_PROVIDER)
+ new LocationListener(LocationManager.NETWORK_PROVIDER),
+ new LocationListener(LocationManager.PASSIVE_PROVIDER)
};
}
@@ -175,15 +176,17 @@ public class BackgroundLocalizationService extends Service {
List providers1 = mLocationManager.getProviders(true);
Location bestLocation = null;
+
for (String provider : providers1) {
Location location = mLocationManager.getLastKnownLocation(provider);
- Log.e("Location", String.valueOf(location));
+
if (location == null) {
continue;
}
if (bestLocation == null || location.getAccuracy() < bestLocation.getAccuracy()) {
bestLocation = location;
}
+
}
Log.e("Best localization:", String.valueOf(bestLocation));
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
index 96a4d62..ad8c94d 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
@@ -61,7 +61,7 @@ public class MyDividerItemDecoration extends RecyclerView.ItemDecoration {
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
- mDivider.setBounds(left + dpToPx(margin), top, right - dpToPx(margin), bottom);
+ mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index a3d5a78..0c0e1fe 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -12,13 +12,12 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.LoginActivity">
-
@@ -85,11 +84,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
- android:text="@string/action_sign_in"
+ android:text="@string/action_log_in"
android:textStyle="bold" />
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_listview.xml b/app/src/main/res/layout/item_listview.xml
deleted file mode 100644
index 6a9a4d1..0000000
--- a/app/src/main/res/layout/item_listview.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutor_list_row.xml b/app/src/main/res/layout/tutor_list_row.xml
index d31fb60..fdfa124 100644
--- a/app/src/main/res/layout/tutor_list_row.xml
+++ b/app/src/main/res/layout/tutor_list_row.xml
@@ -4,9 +4,9 @@
android:layout_height="90dp"
android:clickable="true"
android:focusable="true"
- android:paddingLeft="@dimen/activity_margin"
+ android:paddingLeft="10dp"
android:paddingTop="@dimen/dimen_10"
- android:paddingRight="@dimen/activity_margin"
+ android:paddingRight="10dp"
android:paddingBottom="@dimen/dimen_10">
diff --git a/app/src/main/res/layout/note_dialog.xml b/app/src/main/res/layout/user_list_modal.xml
similarity index 77%
rename from app/src/main/res/layout/note_dialog.xml
rename to app/src/main/res/layout/user_list_modal.xml
index f46f130..8355b19 100644
--- a/app/src/main/res/layout/note_dialog.xml
+++ b/app/src/main/res/layout/user_list_modal.xml
@@ -15,7 +15,7 @@
android:fontFamily="sans-serif-medium"
android:lineSpacingExtra="8sp"
android:text="@string/lbl_new_note_title"
- android:textColor="@color/note_list_text"
+ android:textColor="@color/colorAccent"
android:textSize="@dimen/lbl_new_note_title"
android:textStyle="normal" />
@@ -23,6 +23,8 @@
android:id="@+id/userDepartment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
@@ -30,6 +32,8 @@
android:id="@+id/userRoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
@@ -37,13 +41,16 @@
android:id="@+id/userEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text" />
@@ -51,12 +58,17 @@
android:id="@+id/userDutyHours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textColor="@color/note_list_text" />
+ android:paddingTop="0dp"
+ android:paddingBottom="0dp"
+ android:paddingStart="@dimen/activity_margin"
+ android:textColor="@color/colorAccent" />
\ 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 9b4f74b..992d181 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,7 +1,7 @@
FindMyTutor
Sign in
- StartUp Activity
+ Find My Tutor
Map
@@ -26,7 +26,7 @@
Email
- Password (optional)
+ Password
Sign in or register
Sign out
Sign in
@@ -204,13 +204,16 @@ functionality.
There is no users in system
Close
- Pokój
- Email
- Notatka
- Dyżury
- Dyżury
+ Pokój
+ Email
+ Notatka
+ Dyżury
+ Dyżury
Invalid format login. Use s11111 format
Zakład
Loading ...
+ Logo find my tutor
+ Login (sXXXXXX)
+ Log in