diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ce37ffb..c5863db 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -38,6 +38,10 @@
android:launchMode="singleTask"
android:noHistory="true" />
+
+
= Build.VERSION_CODES.O) {
+ startForegroundService(intent);
+ } else {
+ startService(intent);
+ }
+
+ } else {
+ Toast.makeText(getApplicationContext(), "Please enable the gps", Toast.LENGTH_SHORT).show();
+ }
+ }
}
@Override
@@ -90,15 +180,15 @@ public abstract class BaseActivity
}
@Override
- public boolean onCreateOptionsMenu( Menu menu) {
- getMenuInflater().inflate( R.menu.menu_main, menu);
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_main, menu);
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
final SearchView searchView = (SearchView) myActionMenuItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String input) {
- if(activeFragment.equals(ActiveFragment.USER_LIST)){
+ if (activeFragment.equals(ActiveFragment.USER_LIST)) {
executeUserListSearch(input);
}
@@ -106,20 +196,22 @@ public abstract class BaseActivity
}
@Override
+
public boolean onQueryTextChange(String input) {
- if(activeFragment.equals(ActiveFragment.USER_LIST)){
+ if (activeFragment.equals(ActiveFragment.USER_LIST)) {
executeUserListSearch(input);
}
return true;
}
+
});
return true;
}
- private void executeUserListSearch(String input){
- ((UsersListActivity) userListFragment).searchUser(input);
+ private void executeUserListSearch(String input) {
+ ((UsersListFragment) userListFragment).searchUser(input);
}
@Override
@@ -130,6 +222,21 @@ public abstract class BaseActivity
return super.onOptionsItemSelected(item);
}
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+
+ switch (requestCode) {
+ case REQUEST_PERMISSIONS: {
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ boolean_permission = true;
+ } else {
+ Toast.makeText(getApplicationContext(), "Please allow the permission", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+ }
+
@Override
protected void onStart() {
super.onStart();
@@ -139,7 +246,7 @@ public abstract class BaseActivity
@Override
public void onPause() {
super.onPause();
- overridePendingTransition(0,0);
+ overridePendingTransition(0, 0);
}
private void removeFragment(Fragment fragment) {
@@ -179,7 +286,7 @@ public abstract class BaseActivity
private void loadUserListFragment() {
activeFragment = ActiveFragment.USER_LIST;
- userListFragment = UsersListActivity.newInstance();
+ userListFragment = UsersListFragment.newInstance();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.activity_content, userListFragment);
ft.commit();
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 ef96d14..748c8fb 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
@@ -10,12 +10,13 @@ import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
+
+import android.util.Log;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
-import android.widget.ProgressBar;
import android.widget.Switch;
import com.auth0.android.jwt.Claim;
@@ -25,6 +26,7 @@ import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.model.JwtToken;
import com.uam.wmi.findmytutor.model.LdapUser;
import com.uam.wmi.findmytutor.model.User;
+import com.uam.wmi.findmytutor.model.ValidateUser;
import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.LdapService;
import com.uam.wmi.findmytutor.service.UserService;
@@ -142,6 +144,7 @@ public class LoginActivity extends AppCompatActivity {
private void showProgress(final boolean show) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
+
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
@@ -159,12 +162,20 @@ public class LoginActivity extends AppCompatActivity {
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
+
}
private void loginProcess(String email, String password) {
+
+ //Fake validate
LdapUser user = new LdapUser(email, password, "admin", (isTutor) ? "Tutor" : "Student", "string", "string", email);
+ // ValidateUser user = new ValidateUser(email, password);
+
+ // LDAP logging
+ // disposable.add(ldapService.validate(user)
+
disposable.add(ldapService.fakeValidate(user)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -172,9 +183,8 @@ public class LoginActivity extends AppCompatActivity {
}
private void getUserProfile(String userId) {
- disposable.add(
- userService
- .getUserByID(userId)
+
+ disposable.add(userService.getUserByID(userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::saveUserProfileToSharedPreferences, this::handleError));
@@ -192,6 +202,7 @@ public class LoginActivity extends AppCompatActivity {
JWT jwt = new JWT(token);
Claim role = jwt.getClaim("nameid");
+
PrefUtils.storeIsLoggedIn(getApplicationContext(), true);
PrefUtils.storeApiKey(getApplicationContext(), token);
PrefUtils.storeUserId(getApplicationContext(), role.asString());
@@ -223,5 +234,6 @@ public class LoginActivity extends AppCompatActivity {
PrefUtils.storeUserLastName(getApplicationContext(), user.getLastName());
PrefUtils.storeUserName(getApplicationContext(), user.getUserName());
}
+
}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
index 67dfc45..6483fba 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
@@ -1,35 +1,197 @@
package com.uam.wmi.findmytutor.activity;
+import android.animation.ObjectAnimator;
+import android.animation.TypeEvaluator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.Build;
import android.os.Bundle;
-
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.widget.Toast;
+import android.os.Handler;
+import android.util.Log;
import com.mapbox.mapboxsdk.Mapbox;
+import com.mapbox.mapboxsdk.annotations.Marker;
+import com.mapbox.mapboxsdk.annotations.MarkerOptions;
+import com.mapbox.mapboxsdk.annotations.MarkerViewOptions;
+import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.uam.wmi.findmytutor.R;
+import com.uam.wmi.findmytutor.model.Coordinate;
+import com.uam.wmi.findmytutor.network.ApiClient;
+import com.uam.wmi.findmytutor.network.RetrofitClientInstance;
+import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
+import com.uam.wmi.findmytutor.service.CoordinateService;
+import com.uam.wmi.findmytutor.utils.PrefUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.annotations.NonNull;
+import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.observers.DisposableSingleObserver;
+import io.reactivex.schedulers.Schedulers;
+
+
+public class MapActivity extends BaseActivity
+ implements OnMapReadyCallback {
-public class MapActivity extends BaseActivity {
- private MapView mapView;
String tag = "LifeCycleEvents";
+
+ private MapView mapView;
+ private MapboxMap mapboxMap;
+ private int mInterval = 10000;
+ private Handler mHandler;
+
+ private Map coordsMap = new HashMap<>();
+
+ private CoordinateService coordinateService;
+ private CompositeDisposable disposable = new CompositeDisposable();
+
+ private Runnable mStatusChecker;
+
+
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Mapbox.getInstance(this, getString(R.string.access_token));
- mapView = findViewById(R.id.mapView);
- mapView.onCreate(savedInstanceState);
- mapView.getMapAsync(new OnMapReadyCallback() {
+ final SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE);
+ final String authToken = sharedPref.getString("authToken",null);
+
+ mStatusChecker = new Runnable() {
@Override
- public void onMapReady(MapboxMap mapboxMap) {
+ public void run() {
+ try{
+ fetchTopCoords();
+ } finally {
+ mHandler.postDelayed(mStatusChecker, mInterval);
+ }
+ }
+ };
- // Customize map with markers, polylines, etc.
+ // fetching coords service
+ coordinateService = ApiClient.getClient(getApplicationContext())
+ .create(CoordinateService.class);
+ mHandler = new Handler();
+ Bundle extras = getIntent().getExtras();
+ Mapbox.getInstance(this, getString(R.string.access_token));
+
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(this);
+ }
+
+ @Override
+ public void onMapReady(MapboxMap map) {
+ mapboxMap = map;
+ final Marker marker = mapboxMap.addMarker(new MarkerViewOptions()
+ .position(new LatLng(52.466782,16.927549)));
+ mStatusChecker.run();
+
+ mapboxMap.addOnMapClickListener(new MapboxMap.OnMapClickListener() {
+ @Override
+ public void onMapClick(@NonNull LatLng point) {
+
+ // When the user clicks on the map, we want to animate the marker to that
+ // location.
+ ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
+ new LatLngEvaluator(), marker.getPosition(), point);
+ markerAnimator.setDuration(2000);
+ markerAnimator.start();
}
});
}
+ private static class LatLngEvaluator implements TypeEvaluator {
+ // Method is used to interpolate the marker animation.
+
+ private LatLng latLng = new LatLng();
+
+ @Override
+ public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {
+ latLng.setLatitude(startValue.getLatitude()
+ + ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
+ latLng.setLongitude(startValue.getLongitude()
+ + ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
+ return latLng;
+ }
+ }
+
+ private void fetchTopCoords() {
+ disposable.add(
+ // coordinateService.getTopCoordinates()
+ coordinateService.getOnlineCoordinates()
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribeWith(new DisposableSingleObserver>() {
+ @Override
+ public void onSuccess(List coordsList) {
+
+
+ for (Coordinate element : coordsList) {
+ String id = element.getUserId();
+ Coordinate cord = coordsMap.get(id);
+
+
+ Log.d("mapper", "a " + mapboxMap.getMarkerViewManager());
+ Log.d("mapper", "b " + coordsMap.size());
+ if (cord != null) {
+ if (!cord.getLongitude().equals(element.getLongitude())
+ ) {
+ Log.d("mapper", " cos sie zienilo ");
+ Marker marker = mapboxMap.addMarker(new MarkerViewOptions()
+ .title(cord.getUserId())
+ .position(new LatLng(cord.getLatitude(),cord.getLongitude())));
+
+ ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
+ new LatLngEvaluator(), marker.getPosition(), new LatLng(element.getLatitude(),element.getLongitude()));
+ markerAnimator.setDuration(2000);
+ markerAnimator.start();
+
+
+// coordsMap.replace(id,element);
+ coordsMap.remove(id);
+ coordsMap.put(id,element);
+ } else if (!cord.getTimeStamp().equals(element.getTimeStamp())){
+ Log.d("mapper", "update");
+ Log.d("mapper", " "+cord.getTimeStamp());
+ Log.d("mapper", " " + element.getTimeStamp());
+// coordsMap.replace(id,element);
+ coordsMap.remove(id);
+ coordsMap.put(id,element);
+ }
+ } else {
+ coordsMap.put(id,element);
+ mapboxMap.addMarker(new MarkerOptions().position(new LatLng(element.getLatitude(), element.getLongitude())));
+ }
+ }
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ Log.e("Error",e.toString());
+ }
+ })
+ );
+
+ }
+
+
+
// Add the mapView lifecycle to the activity's lifecycle methods
@@ -67,6 +229,8 @@ public class MapActivity extends BaseActivity {
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
+ mHandler.removeCallbacks(mStatusChecker);
+ disposable.dispose();
}
@Override
@@ -75,6 +239,34 @@ public class MapActivity extends BaseActivity {
mapView.onSaveInstanceState(outState);
}
+ private void fn_permission() {
+ if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
+
+ if ((ActivityCompat.shouldShowRequestPermissionRationale(MapActivity.this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
+
+ } else {
+ ActivityCompat.requestPermissions(MapActivity.this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION
+
+ },
+ REQUEST_PERMISSIONS);
+ }
+ } else {
+
+ if (isTutor) {
+ Intent intent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ startForegroundService(intent);
+ } else {
+ startService(intent);
+ }
+
+ } else {
+ Toast.makeText(getApplicationContext(), "Please enable the gps", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+
@Override
protected int getContentViewId() {
return R.layout.activity_map;
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/NotificationFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/NotificationFragment.java
deleted file mode 100644
index 431777b..0000000
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/NotificationFragment.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.uam.wmi.findmytutor.activity;
-
-
-import android.os.Bundle;
-import android.app.Fragment;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.uam.wmi.findmytutor.R;
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class NotificationFragment extends Fragment {
-
-
- public NotificationFragment() {
- // Required empty public constructor
- }
-
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_notification, container, false);
- }
-
-}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/ProfileFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/ProfileFragment.java
deleted file mode 100644
index d994bfd..0000000
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/ProfileFragment.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.uam.wmi.findmytutor.activity;
-
-
-import android.os.Bundle;
-import android.app.Fragment;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.uam.wmi.findmytutor.R;
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class ProfileFragment extends Fragment {
-
-
- public ProfileFragment() {
- // Required empty public constructor
- }
-
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_profile, container, false);
- }
-
-}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java
new file mode 100644
index 0000000..42551a9
--- /dev/null
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/SettingsActivity.java
@@ -0,0 +1,110 @@
+package com.uam.wmi.findmytutor.activity;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.EditTextPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.view.MenuItem;
+import com.uam.wmi.findmytutor.R;
+
+
+public class SettingsActivity extends AppCompatPreferenceActivity {
+ private static final String TAG = SettingsActivity.class.getSimpleName();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ // load settings fragment
+ getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
+ }
+
+ public static class MainPreferenceFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.layout.pref_main);
+ }
+
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private static void bindPreferenceSummaryToValue(Preference preference) {
+ preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
+
+ sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
+ PreferenceManager
+ .getDefaultSharedPreferences(preference.getContext())
+ .getString(preference.getKey(), ""));
+ }
+
+ /**
+ * A preference value change listener that updates the preference's summary
+ * to reflect its new value.
+ */
+ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ String stringValue = newValue.toString();
+
+ if (preference instanceof ListPreference) {
+ // For list preferences, look up the correct display value in
+ // the preference's 'entries' list.
+ ListPreference listPreference = (ListPreference) preference;
+ int index = listPreference.findIndexOfValue(stringValue);
+
+ // Set the summary to reflect the new value.
+ preference.setSummary(
+ index >= 0
+ ? listPreference.getEntries()[index]
+ : null);
+
+ } else if (preference instanceof EditTextPreference) {
+ if (preference.getKey().equals("key_gallery_name")) {
+ // update the changed gallery name to summary filed
+ preference.setSummary(stringValue);
+ }
+ } else {
+ preference.setSummary(stringValue);
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Email client intent to send support mail
+ * Appends the necessary device information to email body
+ * useful when providing support
+ */
+ public static void sendFeedback(Context context) {
+ String body = null;
+ try {
+ body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
+ body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
+ Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
+ "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
+ } catch (PackageManager.NameNotFoundException e) {
+ }
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("message/rfc822");
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"});
+ intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app");
+ intent.putExtra(Intent.EXTRA_TEXT, body);
+ context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
+ }
+}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
similarity index 95%
rename from app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListActivity.java
rename to app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
index caf83e4..3af23d8 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
@@ -19,7 +19,8 @@ import android.widget.TextView;
import com.annimon.stream.Stream;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.R;
-import com.uam.wmi.findmytutor.adapters.TutorsAdapter;
+import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
+
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
import com.uam.wmi.findmytutor.model.User;
@@ -44,8 +45,8 @@ import okhttp3.ResponseBody;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
-public class UsersListActivity extends Fragment {
- private static final String TAG = UsersListActivity.class.getSimpleName();
+public class UsersListFragment extends Fragment {
+ private static final String TAG = UsersListFragment.class.getSimpleName();
@BindView(R.id.coordinator_layout)
CoordinatorLayout coordinatorLayout;
@@ -57,19 +58,19 @@ public class UsersListActivity extends Fragment {
private UserService userService;
private TutorTabApi tutorTabService;
private CompositeDisposable disposable = new CompositeDisposable();
- private TutorsAdapter mAdapter;
+ private TutorsListAdapter mAdapter;
private List tutorsList = new ArrayList<>();
private List tutorsFiltered = new ArrayList<>();
- public UsersListActivity() {
+ public UsersListFragment() {
}
- public static UsersListActivity newInstance() {
- return new UsersListActivity();
+ public static UsersListFragment newInstance() {
+ return new UsersListFragment();
}
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- mAdapter = new TutorsAdapter(getActivity().getApplicationContext(), tutorsFiltered);
+ mAdapter = new TutorsListAdapter(getActivity().getApplicationContext(), tutorsFiltered);
View view = inflater.inflate(R.layout.users_list, container, false);
view.setBackgroundColor(getResources().getColor(android.R.color.white));
return view;
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsAdapter.java b/app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsListAdapter.java
similarity index 54%
rename from app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsAdapter.java
rename to app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsListAdapter.java
index 070d4af..36c7f00 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsAdapter.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/adapters/TutorsListAdapter.java
@@ -2,6 +2,7 @@ package com.uam.wmi.findmytutor.adapters;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
@@ -18,21 +19,18 @@ import butterknife.BindView;
import butterknife.ButterKnife;
-public class TutorsAdapter extends RecyclerView.Adapter {
+public class TutorsListAdapter extends RecyclerView.Adapter {
private Context context;
private List tutorsList;
- public TutorsAdapter(Context context, List tutors) {
+ public TutorsListAdapter(Context context, List tutors) {
this.context = context;
this.tutorsList = tutors;
-
- Log.e("USERS", String.valueOf(tutors));
}
-
- public class MyViewHolder extends RecyclerView.ViewHolder {
+ class MyViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.firstName)
TextView firstName;
@@ -43,16 +41,15 @@ public class TutorsAdapter extends RecyclerView.Adapter fakeValidate(@Body LdapUser user);
@POST("api/ldap/validate")
- Single validate(@Body LdapUser user);
+ Single validate(@Body ValidateUser user);
@GET("api/ldap/getUserData/{login}")
Single getUserDataByLogin(@Path("login") String userLogin);
diff --git a/app/src/main/res/drawable/logo_design_black2.xml b/app/src/main/res/drawable/logo_design_black2.xml
new file mode 100644
index 0000000..61baafc
--- /dev/null
+++ b/app/src/main/res/drawable/logo_design_black2.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index f4cbc1b..a3d5a78 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -1,5 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_notifications.xml b/app/src/main/res/layout/activity_notifications.xml
deleted file mode 100644
index be82ea7..0000000
--- a/app/src/main/res/layout/activity_notifications.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
deleted file mode 100644
index 49b6e9b..0000000
--- a/app/src/main/res/layout/activity_profile.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/base_activity.xml b/app/src/main/res/layout/base_activity.xml
index 044f938..df8e7f8 100644
--- a/app/src/main/res/layout/base_activity.xml
+++ b/app/src/main/res/layout/base_activity.xml
@@ -13,6 +13,7 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_notification.xml b/app/src/main/res/layout/fragment_notification.xml
deleted file mode 100644
index 2cd9409..0000000
--- a/app/src/main/res/layout/fragment_notification.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml
deleted file mode 100644
index f98dfe6..0000000
--- a/app/src/main/res/layout/fragment_profile.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml
index 2ef0844..338b7ff 100644
--- a/app/src/main/res/layout/nav_header_main.xml
+++ b/app/src/main/res/layout/nav_header_main.xml
@@ -1,5 +1,7 @@
-
-
+ android:layout_height="match_parent"
+
+ android:visibility="visible"
+ app:srcCompat="@drawable/logo_design_black2" />
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/layout/pref_main.xml
similarity index 100%
rename from app/src/main/res/xml/pref_main.xml
rename to app/src/main/res/layout/pref_main.xml
diff --git a/app/src/main/res/layout/users_list.xml b/app/src/main/res/layout/users_list.xml
index 5cc4880..18f41e8 100644
--- a/app/src/main/res/layout/users_list.xml
+++ b/app/src/main/res/layout/users_list.xml
@@ -4,7 +4,7 @@
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".activity.UsersListActivity">
+ tools:context=".activity.UsersListFragment">
diff --git a/app/src/main/res/layout/users_list_main.xml b/app/src/main/res/layout/users_list_main.xml
index 6e6b891..541ff95 100644
--- a/app/src/main/res/layout/users_list_main.xml
+++ b/app/src/main/res/layout/users_list_main.xml
@@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
- tools:context=".activity.UsersListActivity"
+ tools:context=".activity.UsersListFragment"
tools:showIn="@layout/users_list_main">
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
index 7d0e267..d9c6b19 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -1,34 +1,27 @@
\ 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 7885e42..9b4f74b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -11,7 +11,11 @@
Drawer Open
Drawer Closed
-
+ Blacklist
+ Whitelist
+ Settings
+ Profile
+ Log out
Settings
Notes
@@ -197,6 +201,7 @@ functionality.
Main2Activity
+
There is no users in system
Close
Pokój
@@ -204,7 +209,8 @@ functionality.
Notatka
Dyżury
Dyżury
- Invalid format of login. Use s11111 format
+ Invalid format login. Use s11111 format
Zakład
Loading ...
+
diff --git a/build.gradle b/build.gradle
index 4e8009d..8d3ef8e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.0'
+ classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong