online indicator and show on map button in tutor modal #124
@ -390,10 +390,13 @@ public abstract class BaseActivity
|
|||||||
removeFragment(sharingFragment);
|
removeFragment(sharingFragment);
|
||||||
removeFragment(userListFragment);
|
removeFragment(userListFragment);
|
||||||
activeFragment = ActiveFragment.NONE;
|
activeFragment = ActiveFragment.NONE;
|
||||||
|
findViewById(R.id.action_search).setVisibility(View.VISIBLE);
|
||||||
} else if (itemId == R.id.nav_profile) {
|
} else if (itemId == R.id.nav_profile) {
|
||||||
loadUserSettingsFragment();
|
loadUserSettingsFragment();
|
||||||
|
findViewById(R.id.action_search).setVisibility(View.GONE);
|
||||||
} else if (itemId == R.id.nav_user_list) {
|
} else if (itemId == R.id.nav_user_list) {
|
||||||
loadUserListFragment();
|
loadUserListFragment();
|
||||||
|
findViewById(R.id.action_search).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
selectBottomNavigationBarItem(itemId);
|
selectBottomNavigationBarItem(itemId);
|
||||||
}, 300);
|
}, 300);
|
||||||
|
@ -91,7 +91,7 @@ public class MapActivity extends BaseActivity
|
|||||||
private Coordinate droppedMarkercoordinate;
|
private Coordinate droppedMarkercoordinate;
|
||||||
private HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
private HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
||||||
private HashMap<String, MapMarker> markerHash = new HashMap<>();
|
private HashMap<String, MapMarker> markerHash = new HashMap<>();
|
||||||
private HashMap<Long, String> markerUserHash = new HashMap<>();
|
public HashMap<Long, String> markerUserHash = new HashMap<>();
|
||||||
private Set<String> previousCoordsIds = new HashSet<>();
|
private Set<String> previousCoordsIds = new HashSet<>();
|
||||||
private ManualLocationUtils manualLocationUtils;
|
private ManualLocationUtils manualLocationUtils;
|
||||||
// Camera Animation params
|
// Camera Animation params
|
||||||
@ -708,7 +708,7 @@ public class MapActivity extends BaseActivity
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filterMarkers(List<User> users) {
|
public void filterMarkers(List<User> users) {
|
||||||
restoreMapMarkers();
|
restoreMapMarkers();
|
||||||
|
|
||||||
Icon markedMarker = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.search_marker);
|
Icon markedMarker = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.search_marker);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.CoordinatorLayout;
|
import android.support.design.widget.CoordinatorLayout;
|
||||||
@ -9,6 +11,10 @@ import android.support.v7.app.AlertDialog;
|
|||||||
import android.support.v7.widget.DefaultItemAnimator;
|
import android.support.v7.widget.DefaultItemAnimator;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.support.v7.widget.SearchView;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.style.ImageSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -18,6 +24,8 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -25,7 +33,6 @@ import com.annimon.stream.Stream;
|
|||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
||||||
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
import com.uam.wmi.findmytutor.model.User;
|
||||||
@ -63,6 +70,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
@BindView(R.id.txt_empty_notes_view)
|
@BindView(R.id.txt_empty_notes_view)
|
||||||
TextView noNotesView;
|
TextView noNotesView;
|
||||||
|
|
||||||
|
private SearchView searchView;
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
private TutorTabApi tutorTabService;
|
private TutorTabApi tutorTabService;
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
@ -120,14 +128,12 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareOptionsMenu(Menu menu) {
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
super.onPrepareOptionsMenu(menu);
|
super.onPrepareOptionsMenu(menu);
|
||||||
try {
|
try {
|
||||||
menu.findItem(R.id.showOnlineUsersOnly).setChecked(fetchOnlyOnlineUsers);
|
menu.findItem(R.id.showOnlineUsersOnly).setChecked(fetchOnlyOnlineUsers);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e) {
|
|
||||||
Log.e(TAG, "onPrepareOptionsMenu error");
|
Log.e(TAG, "onPrepareOptionsMenu error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,13 +141,13 @@ public class UsersListFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
//item.setChecked(fetchOnlyOnlineUsers);
|
//item.setChecked(fetchOnlyOnlineUsers);
|
||||||
switch (item.getItemId()){
|
switch (item.getItemId()) {
|
||||||
case R.id.showOnlineUsersOnly:
|
case R.id.showOnlineUsersOnly:
|
||||||
|
|
||||||
if(item.isChecked()) {
|
if (item.isChecked()) {
|
||||||
fetchOnlyOnlineUsers = false;
|
fetchOnlyOnlineUsers = false;
|
||||||
item.setChecked(false);
|
item.setChecked(false);
|
||||||
}else{
|
} else {
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
fetchOnlyOnlineUsers = true;
|
fetchOnlyOnlineUsers = true;
|
||||||
}
|
}
|
||||||
@ -158,7 +164,11 @@ public class UsersListFragment extends Fragment {
|
|||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.users_list_menu, menu);
|
inflater.inflate(R.menu.users_list_menu, menu);
|
||||||
menu.getItem(0).setChecked(fetchOnlyOnlineUsers);
|
menu.getItem(0).setChecked(fetchOnlyOnlineUsers);
|
||||||
super.onCreateOptionsMenu(menu,inflater);
|
|
||||||
|
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
|
||||||
|
searchView = (SearchView) myActionMenuItem.getActionView();
|
||||||
|
|
||||||
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchUser(String textToSearch) {
|
public void searchUser(String textToSearch) {
|
||||||
@ -176,6 +186,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
// User cancelled the dialog
|
// User cancelled the dialog
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
TextView userName = view.findViewById(R.id.userName);
|
TextView userName = view.findViewById(R.id.userName);
|
||||||
ListView userDutyHours = view.findViewById(R.id.userDutyHours);
|
ListView userDutyHours = view.findViewById(R.id.userDutyHours);
|
||||||
TextView userDutyHoursTitle = view.findViewById(R.id.userDutyHoursTitle);
|
TextView userDutyHoursTitle = view.findViewById(R.id.userDutyHoursTitle);
|
||||||
@ -184,8 +195,26 @@ public class UsersListFragment extends Fragment {
|
|||||||
TextView userEmail = view.findViewById(R.id.userEmail);
|
TextView userEmail = view.findViewById(R.id.userEmail);
|
||||||
TextView department = view.findViewById(R.id.userDepartment);
|
TextView department = view.findViewById(R.id.userDepartment);
|
||||||
|
|
||||||
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
|
||||||
|
|
||||||
|
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
||||||
|
Drawable image;
|
||||||
|
if (user.isIsOnline()) {
|
||||||
|
image = this.getResources().getDrawable(R.drawable.user_list_online);
|
||||||
|
} else {
|
||||||
|
image = this.getResources().getDrawable(R.drawable.user_list_offline);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.isIsActive()) {
|
||||||
|
image = this.getResources().getDrawable(R.drawable.user_list_off);
|
||||||
|
}
|
||||||
|
|
||||||
|
Spannable span = new SpannableString(" " + userName.getText()); // or set your text manually
|
||||||
|
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
||||||
|
ImageSpan imageSpan = new ImageSpan(image);
|
||||||
|
span.setSpan(imageSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
userName.setText(span);
|
||||||
|
|
||||||
|
UsersListFragment usersListFragment = this;
|
||||||
disposable.add(
|
disposable.add(
|
||||||
tutorTabService.apiUsersTutorTabByTutorIdGet(user.getId())
|
tutorTabService.apiUsersTutorTabByTutorIdGet(user.getId())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -193,7 +222,20 @@ public class UsersListFragment extends Fragment {
|
|||||||
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||||
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
final AlertDialog alertDialog;
|
||||||
|
if (((MapActivity) getActivity()).markerUserHash.containsValue(user.getId())) {
|
||||||
|
alertDialogBuilderUserInput.setPositiveButton(R.string.show_on_map, (dialog, id) -> {
|
||||||
|
// User cancelled the dialog
|
||||||
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||||
|
fragmentTransaction.hide(usersListFragment);
|
||||||
|
fragmentTransaction.commit();
|
||||||
|
List<User> list = new ArrayList<User>();
|
||||||
|
list.add(user);
|
||||||
|
((MapActivity) getActivity()).filterMarkers(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
alertDialog = alertDialogBuilderUserInput.create();
|
||||||
|
|
||||||
String userNoteText = tutorTabViewModel.getNote();
|
String userNoteText = tutorTabViewModel.getNote();
|
||||||
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
||||||
.map(DutyHourViewModel::getSummary).toList();
|
.map(DutyHourViewModel::getSummary).toList();
|
||||||
@ -276,7 +318,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
|
|
||||||
private void searchTutorInBackend(String searchString) {
|
private void searchTutorInBackend(String searchString) {
|
||||||
disposable.add(
|
disposable.add(
|
||||||
userService.searchUser(searchString)
|
userService.searchUser(searchString)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
||||||
@ -295,7 +337,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void restoreUsersList(){
|
public void restoreUsersList() {
|
||||||
fetchAllTutors();
|
fetchAllTutors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,10 +373,10 @@ public class UsersListFragment extends Fragment {
|
|||||||
createSnackbar(message);
|
createSnackbar(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSnackbar(String msg){
|
private void createSnackbar(String msg) {
|
||||||
Snackbar snackbar = Snackbar.make(coordinatorLayout, msg, Snackbar.LENGTH_LONG);
|
Snackbar snackbar = Snackbar.make(coordinatorLayout, msg, Snackbar.LENGTH_LONG);
|
||||||
View view = snackbar.getView();
|
View view = snackbar.getView();
|
||||||
CoordinatorLayout.LayoutParams params=(CoordinatorLayout.LayoutParams)view.getLayoutParams();
|
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
|
||||||
params.gravity = Gravity.TOP;
|
params.gravity = Gravity.TOP;
|
||||||
view.setLayoutParams(params);
|
view.setLayoutParams(params);
|
||||||
snackbar.show();
|
snackbar.show();
|
||||||
@ -345,9 +387,9 @@ public class UsersListFragment extends Fragment {
|
|||||||
noNotesView.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
noNotesView.setVisibility(View.VISIBLE);
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
if(fetchOnlyOnlineUsers)
|
if (fetchOnlyOnlineUsers)
|
||||||
noNotesView.setText(R.string.no_online_users);
|
noNotesView.setText(R.string.no_online_users);
|
||||||
else{
|
else {
|
||||||
noNotesView.setText(R.string.no_offline_users);
|
noNotesView.setText(R.string.no_offline_users);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
app/src/main/res/drawable/trip_orgin.xml
Normal file
15
app/src/main/res/drawable/trip_orgin.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:pathData="M0 0h24v24H0z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFF"
|
||||||
|
android:pathData="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z" />
|
||||||
|
<path
|
||||||
|
android:pathData="M0 0h24v24H0z" />
|
||||||
|
</vector>
|
@ -27,17 +27,19 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/userName"
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/userName"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginBottom="15dp"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:layout_marginBottom="15dp"
|
||||||
android:textColor="@color/white"
|
android:gravity="center_horizontal"
|
||||||
android:textSize="@dimen/lbl_new_note_title"
|
android:textColor="@color/white"
|
||||||
android:textStyle="normal"
|
android:textSize="@dimen/lbl_new_note_title"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:textStyle="normal"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
android:drawablePadding="10dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"/>
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -158,25 +160,25 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="20dp">
|
android:paddingLeft="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_note"/>
|
android:src="@drawable/user_modal_note"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userNote"
|
android:id="@+id/userNote"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textColor="@color/mapboxWhite"
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -265,6 +265,10 @@
|
|||||||
<string name="network_err">Błąd sieci!</string>
|
<string name="network_err">Błąd sieci!</string>
|
||||||
<string name="search_null">Brak wyników!</string>
|
<string name="search_null">Brak wyników!</string>
|
||||||
<string name="modal_manual_hint">Nadaj nazwę tej lokalizacji.</string>
|
<string name="modal_manual_hint">Nadaj nazwę tej lokalizacji.</string>
|
||||||
|
<string name="online">Dostępny</string>
|
||||||
|
<string name="offline">Niedostępny</string>
|
||||||
|
<string name="inactive">Nieaktywny</string>
|
||||||
|
<string name="show_on_map">POKAŻ NA MAPIE</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@ -436,5 +436,9 @@
|
|||||||
<string name="network_err">Network Error !</string>
|
<string name="network_err">Network Error !</string>
|
||||||
<string name="search_null">Search response is empty!</string>
|
<string name="search_null">Search response is empty!</string>
|
||||||
<string name="modal_manual_hint">Insert a name for this localization.</string>
|
<string name="modal_manual_hint">Insert a name for this localization.</string>
|
||||||
|
<string name="online">Online</string>
|
||||||
|
<string name="offline">Offline</string>
|
||||||
|
<string name="inactive">Inactive</string>
|
||||||
|
<string name="show_on_map">SHOW ON MAP</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user