diff --git a/.gitignore b/.gitignore index 5edb4ee..0c1fdca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,67 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ *.iml -.gradle -/local.properties -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -.DS_Store -/build -/captures +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/caches +.idea/vcs.xml +.idea/workspace.xml +.idea/modules.xml +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later .externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml new file mode 100644 index 0000000..2a9c5e0 --- /dev/null +++ b/.idea/assetWizardSettings.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser deleted file mode 100644 index 0349eb7..0000000 Binary files a/.idea/caches/build_file_checksums.ser and /dev/null differ diff --git a/app/.gitignore b/app/.gitignore index 796b96d..25f9fc7 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,66 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/caches + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md /build diff --git a/app/build.gradle b/app/build.gradle index 402e9f8..a333d4f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' android { compileSdkVersion 27 + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } defaultConfig { applicationId "com.uam.wmi.findmytutor" minSdkVersion 19 @@ -26,7 +30,19 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'com.google.code.gson:gson:2.8.2' - implementation 'com.squareup.retrofit2:retrofit:2.3.0' - implementation 'com.squareup.retrofit2:converter-gson:2.3.0' + implementation 'com.google.code.gson:gson:2.8.5' + implementation 'com.squareup.retrofit2:retrofit:2.4.0' + implementation 'com.squareup.retrofit2:converter-gson:2.4.0' + implementation "io.swagger:swagger-annotations:1.5.15" + implementation "org.threeten:threetenbp:1.3.5" + implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.4.0' + implementation 'io.reactivex.rxjava2:rxjava:2.2.0' + implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' + implementation "com.jakewharton:butterknife:8.8.1" + annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1" + implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0" + implementation "com.squareup.okhttp3:okhttp:3.11.0" + implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0" + implementation "com.squareup.okhttp3:logging-interceptor:3.11.0" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da59066..55a5adf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,10 @@ + + + + () { + @Override + public void onSuccess(JwtToken jwtToken) { + PrefUtils.storeApiKey(getApplicationContext(), jwtToken.getToken()); + onPostExecute(true); + } - LdapUser user = new LdapUser("string",mPassword,"string","string","string","string",mEmail); + @Override + public void onError(Throwable e) { + Log.e("LoginError", "onError: " + e.getMessage()); + } + })); + return true; - try { - Response loginResponse = service.fakeValidate(user).execute(); - if (loginResponse.isSuccessful()) { - String authToken = loginResponse.body().getToken(); - Log.e("Login", "jwt token: " + authToken); - - SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE); - sharedPref.edit().putString("authToken", authToken).putBoolean("loggedIn", true).apply(); - - return true; - } - - } catch (IOException e) { - Log.e("Login error", "nie udalo sie kurde..."); - return false; - } - - //To jest async i nie da sie zwrocic :( -// Call call = service.fakeValidate(user); -// -// call.enqueue(new Callback() { -// @Override -// public void onResponse(Call call, Response response) { -// Log.e("jwt", response.body().getToken()); -// } -// -// @Override -// public void onFailure(Call call, Throwable t) { -// Toast.makeText(LoginActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show(); -// return false; -// } -// }); - - - - // TODO: attempt authentication against a network service. - -// try { -// // Simulate network access. -// Thread.sleep(2000); -// } catch (InterruptedException e) { -// return false; -// } -// -// for (String credential : DUMMY_CREDENTIALS) { -// String[] pieces = credential.split(":"); -// if (pieces[0].equals(mEmail)) { -// // Account exists, return true if the password matches. -// return pieces[1].equals(mPassword); -// } -// } - - // TODO: register the new account here. - return false; } @Override @@ -390,17 +368,9 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< showProgress(false); if (success) { - - // TODO: Ustawiam localstora kluczyk jakis - SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedPref.edit(); - editor.putString("test", "jakieś gówno"); - editor.commit(); - Log.e("okurwa", "eealslasla"); - // TODO: Ma zwracac 666 i cos jeszcze, do tego wpisywac jwt to shared prefs... kurwa Intent data = new Intent(); - String txt = "siema eee"; + String txt = "test text to Startup compo"; data.setData(Uri.parse(txt)); setResult(RESULT_OK, data); finish(); @@ -408,6 +378,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< mPasswordView.setError(getString(R.string.error_incorrect_password)); mPasswordView.requestFocus(); } + } @Override diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MainActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MainActivity.java index 3341ffc..a443ed2 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/MainActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MainActivity.java @@ -1,26 +1,121 @@ package com.uam.wmi.findmytutor.activity; +import android.app.Fragment; +import android.app.FragmentTransaction; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.design.widget.BottomNavigationView; 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.util.Log; +import android.view.MenuItem; import android.view.View; +import android.widget.FrameLayout; +import com.mapbox.mapboxsdk.Mapbox; +import com.mapbox.mapboxsdk.maps.MapView; 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.service.CoordinateService; + +import java.util.List; + public class MainActivity extends AppCompatActivity { + private BottomNavigationView mMainNav; + private FrameLayout mMainFrame; + + private MapFragment mapFragment; + private NotificationFragment notificationFragment; + private ProfileFragment profileFragment; + + + + private MapView mapView; + + public List getCoordinates() { + return this.coordinates; + } + + public void setCoordinates(List coordinates) { + this.coordinates = coordinates; + } + + public List coordinates; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_main); - SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE); - String text = sharedPref.getString("test",null); - Log.e("Mainactivity", text); + + + mMainFrame = (FrameLayout) findViewById(R.id.main_frame); + mMainNav = (BottomNavigationView) findViewById(R.id.main_nav); + + mapFragment = new MapFragment(); + notificationFragment = new NotificationFragment(); + profileFragment = new ProfileFragment(); + + // Default frag here + setFragment(mapFragment); + mMainNav.setSelectedItemId(R.id.nav_map); + + mMainNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + + switch (item.getItemId()) { + case R.id.nav_map: + mMainNav.setItemBackgroundResource(R.color.colorPrimary); + setFragment(mapFragment); + return true; + case R.id.nav_notif: + mMainNav.setItemBackgroundResource(R.color.colorAccent); + setFragment(notificationFragment); + return true; + case R.id.nav_profile: + mMainNav.setItemBackgroundResource(R.color.colorPrimaryDark); + setFragment(profileFragment); + return true; + default: + return false; + } + } + }); + + + // Logout button + final FloatingActionButton button = findViewById(R.id.logoutButton); + button.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View view) { + SharedPreferences preferences = getSharedPreferences("fmtPrefs",Context.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.clear().commit(); + + Intent i = getBaseContext().getPackageManager() + .getLaunchIntentForPackage( getBaseContext().getPackageName() ); + i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(i); + finish(); + } + }); + +// CoordinateService service = ApiClient.getClient(getApplicationContext()) +// .create(CoordinateService.class); + + + } + + private void setFragment(Fragment fragment) { + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.main_frame, fragment); + fragmentTransaction.commit(); + } } -} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapFragment.java new file mode 100644 index 0000000..d8c1e36 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapFragment.java @@ -0,0 +1,98 @@ +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.mapbox.mapboxsdk.maps.MapView; +import com.uam.wmi.findmytutor.R; +import com.uam.wmi.findmytutor.network.ApiClient; +import com.uam.wmi.findmytutor.service.CoordinateService; + +import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; + +/** + * A simple {@link Fragment} subclass. + */ +public class MapFragment extends Fragment { + private MapView mapView; + + + public MapFragment() { + // 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_map, container, false); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + mapView = (MapView) view.findViewById(R.id.mapView); + mapView.onCreate(savedInstanceState); + CoordinateService service = ApiClient.getClient(getApplicationContext()) + .create(CoordinateService.class); + } + + @Override + public void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + public void onResume() { + super.onResume(); + mapView.onResume(); + + } + + @Override + public void onPause() { + super.onPause(); + mapView.onPause(); + } + + @Override + public void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override + public void onLowMemory() { + super.onLowMemory(); + mapView.onLowMemory(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + mapView.onDestroy(); + } + +// @Override +// public void onDestroy() { +// super.onDestroy(); +// mapView.onDestroy(); +// } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + mapView.onSaveInstanceState(outState); + } + + + +} 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 new file mode 100644 index 0000000..431777b --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/NotificationFragment.java @@ -0,0 +1,31 @@ +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 new file mode 100644 index 0000000..d994bfd --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/ProfileFragment.java @@ -0,0 +1,31 @@ +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/StartupActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java index 17ec17b..4c7a441 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/StartupActivity.java @@ -5,17 +5,7 @@ import android.content.Context; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; -import android.util.Log; -import android.widget.Toast; -import com.uam.wmi.findmytutor.model.JwtToken; -import com.uam.wmi.findmytutor.model.LdapUser; -import com.uam.wmi.findmytutor.network.RetrofitClientInstance; -import com.uam.wmi.findmytutor.service.LdapService; - -import retrofit2.Call; -import retrofit2.Callback; -import retrofit2.Response; public class StartupActivity extends AppCompatActivity { private static final int AUTHENTICATION_REQUEST_CODE = 666; diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/BaseResponse.java b/app/src/main/java/com/uam/wmi/findmytutor/model/BaseResponse.java new file mode 100644 index 0000000..21b73c1 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/BaseResponse.java @@ -0,0 +1,9 @@ +package com.uam.wmi.findmytutor.model; + +public class BaseResponse { + String error; + + public String getError() { + return error; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/Coordinate.java b/app/src/main/java/com/uam/wmi/findmytutor/model/Coordinate.java new file mode 100644 index 0000000..95e9b59 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/Coordinate.java @@ -0,0 +1,260 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; +import java.util.UUID; + +import io.swagger.annotations.ApiModelProperty; + +/** + * Coordinate + */ + +public class Coordinate extends BaseResponse{ + @SerializedName("coordinateId") + private UUID coordinateId = null; + + @SerializedName("latitude") + private Float latitude = null; + + @SerializedName("longitude") + private Float longitude = null; + + @SerializedName("altitude") + private Float altitude = null; + + @SerializedName("userId") + private String userId = null; + + @SerializedName("approximatedLocation") + private String approximatedLocation = null; + + @SerializedName("displayMode") + private String displayMode = "exact"; + + @SerializedName("timeStamp") + private Long timeStamp = null; + + @SerializedName("label") + private String label = null; + + public Coordinate coordinateId(UUID coordinateId) { + this.coordinateId = coordinateId; + return this; + } + + /** + * Get coordinateId + * @return coordinateId + **/ + @ApiModelProperty(required = true, value = "") + public UUID getCoordinateId() { + return coordinateId; + } + + public void setCoordinateId(UUID coordinateId) { + this.coordinateId = coordinateId; + } + + public Coordinate latitude(Float latitude) { + this.latitude = latitude; + return this; + } + + /** + * Get latitude + * @return latitude + **/ + @ApiModelProperty(required = true, value = "") + public Float getLatitude() { + return latitude; + } + + public void setLatitude(Float latitude) { + this.latitude = latitude; + } + + public Coordinate longitude(Float longitude) { + this.longitude = longitude; + return this; + } + + /** + * Get longitude + * @return longitude + **/ + @ApiModelProperty(required = true, value = "") + public Float getLongitude() { + return longitude; + } + + public void setLongitude(Float longitude) { + this.longitude = longitude; + } + + public Coordinate altitude(Float altitude) { + this.altitude = altitude; + return this; + } + + /** + * Get altitude + * @return altitude + **/ + @ApiModelProperty(required = true, value = "") + public Float getAltitude() { + return altitude; + } + + public void setAltitude(Float altitude) { + this.altitude = altitude; + } + + public Coordinate userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get userId + * @return userId + **/ + @ApiModelProperty(required = true, value = "") + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Coordinate approximatedLocation(String approximatedLocation) { + this.approximatedLocation = approximatedLocation; + return this; + } + + /** + * Get approximatedLocation + * @return approximatedLocation + **/ + @ApiModelProperty(value = "") + public String getApproximatedLocation() { + return approximatedLocation; + } + + public void setApproximatedLocation(String approximatedLocation) { + this.approximatedLocation = approximatedLocation; + } + + public Coordinate displayMode(String displayMode) { + this.displayMode = displayMode; + return this; + } + + /** + * Get displayMode + * @return displayMode + **/ + @ApiModelProperty(required = true, value = "") + public String getDisplayMode() { + return displayMode; + } + + public void setDisplayMode(String displayMode) { + this.displayMode = displayMode; + } + + public Coordinate timeStamp(Long timeStamp) { + this.timeStamp = timeStamp; + return this; + } + + /** + * Get timeStamp + * @return timeStamp + **/ + @ApiModelProperty(value = "") + public Long getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(Long timeStamp) { + this.timeStamp = timeStamp; + } + + public Coordinate label(String label) { + this.label = label; + return this; + } + + /** + * Get label + * @return label + **/ + @ApiModelProperty(value = "") + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Coordinate coordinate = (Coordinate) o; + return Objects.equals(this.coordinateId, coordinate.coordinateId) && + Objects.equals(this.latitude, coordinate.latitude) && + Objects.equals(this.longitude, coordinate.longitude) && + Objects.equals(this.altitude, coordinate.altitude) && + Objects.equals(this.userId, coordinate.userId) && + Objects.equals(this.approximatedLocation, coordinate.approximatedLocation) && + Objects.equals(this.displayMode, coordinate.displayMode) && + Objects.equals(this.timeStamp, coordinate.timeStamp) && + Objects.equals(this.label, coordinate.label); + } + + @Override + public int hashCode() { + return Objects.hash(coordinateId, latitude, longitude, altitude, userId, approximatedLocation, displayMode, timeStamp, label); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Coordinate {\n"); + + sb.append(" coordinateId: ").append(toIndentedString(coordinateId)).append("\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n"); + sb.append(" altitude: ").append(toIndentedString(altitude)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" approximatedLocation: ").append(toIndentedString(approximatedLocation)).append("\n"); + sb.append(" displayMode: ").append(toIndentedString(displayMode)).append("\n"); + sb.append(" timeStamp: ").append(toIndentedString(timeStamp)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/DutyHour.java b/app/src/main/java/com/uam/wmi/findmytutor/model/DutyHour.java new file mode 100644 index 0000000..46cbdb3 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/DutyHour.java @@ -0,0 +1,192 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; +import java.util.UUID; + +import io.swagger.annotations.ApiModelProperty; + +/** + * DutyHour + */ + +public class DutyHour extends BaseResponse { + @SerializedName("dutyHourId") + private UUID dutyHourId = null; + + @SerializedName("tutorTabId") + private UUID tutorTabId = null; + + @SerializedName("day") + private String day = null; + + @SerializedName("start") + private String start = null; + + @SerializedName("end") + private String end = null; + + @SerializedName("tutorTab") + private TutorTab tutorTab = null; + + public DutyHour dutyHourId(UUID dutyHourId) { + this.dutyHourId = dutyHourId; + return this; + } + + /** + * Get dutyHourId + * @return dutyHourId + **/ + @ApiModelProperty(value = "") + public UUID getDutyHourId() { + return dutyHourId; + } + + public void setDutyHourId(UUID dutyHourId) { + this.dutyHourId = dutyHourId; + } + + public DutyHour tutorTabId(UUID tutorTabId) { + this.tutorTabId = tutorTabId; + return this; + } + + /** + * Get tutorTabId + * @return tutorTabId + **/ + @ApiModelProperty(required = true, value = "") + public UUID getTutorTabId() { + return tutorTabId; + } + + public void setTutorTabId(UUID tutorTabId) { + this.tutorTabId = tutorTabId; + } + + public DutyHour day(String day) { + this.day = day; + return this; + } + + /** + * Get day + * @return day + **/ + @ApiModelProperty(value = "") + public String getDay() { + return day; + } + + public void setDay(String day) { + this.day = day; + } + + public DutyHour start(String start) { + this.start = start; + return this; + } + + /** + * Get start + * @return start + **/ + @ApiModelProperty(value = "") + public String getStart() { + return start; + } + + public void setStart(String start) { + this.start = start; + } + + public DutyHour end(String end) { + this.end = end; + return this; + } + + /** + * Get end + * @return end + **/ + @ApiModelProperty(value = "") + public String getEnd() { + return end; + } + + public void setEnd(String end) { + this.end = end; + } + + public DutyHour tutorTab(TutorTab tutorTab) { + this.tutorTab = tutorTab; + return this; + } + + /** + * Get tutorTab + * @return tutorTab + **/ + @ApiModelProperty(value = "") + public TutorTab getTutorTab() { + return tutorTab; + } + + public void setTutorTab(TutorTab tutorTab) { + this.tutorTab = tutorTab; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DutyHour dutyHour = (DutyHour) o; + return Objects.equals(this.dutyHourId, dutyHour.dutyHourId) && + Objects.equals(this.tutorTabId, dutyHour.tutorTabId) && + Objects.equals(this.day, dutyHour.day) && + Objects.equals(this.start, dutyHour.start) && + Objects.equals(this.end, dutyHour.end) && + Objects.equals(this.tutorTab, dutyHour.tutorTab); + } + + @Override + public int hashCode() { + return Objects.hash(dutyHourId, tutorTabId, day, start, end, tutorTab); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DutyHour {\n"); + + sb.append(" dutyHourId: ").append(toIndentedString(dutyHourId)).append("\n"); + sb.append(" tutorTabId: ").append(toIndentedString(tutorTabId)).append("\n"); + sb.append(" day: ").append(toIndentedString(day)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" tutorTab: ").append(toIndentedString(tutorTab)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java new file mode 100644 index 0000000..36e0345 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java @@ -0,0 +1,20 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class IsUsingListBool extends BaseResponse{ + + @SerializedName("isUsing") + @Expose + private Boolean isUsing; + + public Boolean getIsUsing() { + return isUsing; + } + + public void setIsUsing(Boolean isUsing) { + this.isUsing = isUsing; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBoolModel.java b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBoolModel.java new file mode 100644 index 0000000..fd29619 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBoolModel.java @@ -0,0 +1,76 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; + +import io.swagger.annotations.ApiModelProperty; + +/** + * IsUsingListBoolModel + */ + +public class IsUsingListBoolModel extends BaseResponse { + @SerializedName("isUsing") + private Boolean isUsing = null; + + public IsUsingListBoolModel isUsing(Boolean isUsing) { + this.isUsing = isUsing; + return this; + } + + /** + * Get isUsing + * @return isUsing + **/ + @ApiModelProperty(value = "") + public Boolean isIsUsing() { + return isUsing; + } + + public void setIsUsing(Boolean isUsing) { + this.isUsing = isUsing; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IsUsingListBoolModel isUsingListBoolModel = (IsUsingListBoolModel) o; + return Objects.equals(this.isUsing, isUsingListBoolModel.isUsing); + } + + @Override + public int hashCode() { + return Objects.hash(isUsing); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IsUsingListBoolModel {\n"); + + sb.append(" isUsing: ").append(toIndentedString(isUsing)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/LdapUser.java b/app/src/main/java/com/uam/wmi/findmytutor/model/LdapUser.java index 5bf06eb..b57c702 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/model/LdapUser.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/LdapUser.java @@ -1,96 +1,225 @@ package com.uam.wmi.findmytutor.model; -import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; -public class LdapUser { +import java.util.Objects; - @SerializedName("login") - @Expose - private String login; - @SerializedName("password") - @Expose - private String password; - @SerializedName("department") - @Expose - private String department; - @SerializedName("title") - @Expose - private String title; - @SerializedName("firstName") - @Expose - private String firstName; - @SerializedName("lastName") - @Expose - private String lastName; - @SerializedName("email") - @Expose - private String email; +import io.swagger.annotations.ApiModelProperty; - public LdapUser(String login, String password, String department, String title, String firstName, String lastName, String email) { - this.login = login; - this.password = password; - this.department = department; - this.title = title; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; + +/** + * LdapUser + */ + +public class LdapUser extends BaseResponse{ + @SerializedName("login") + private String login = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("department") + private String department = null; + + @SerializedName("title") + private String title = null; + + @SerializedName("firstName") + private String firstName = null; + + @SerializedName("lastName") + private String lastName = null; + + @SerializedName("email") + private String email = null; + + public LdapUser(String login, String password, String department, String title, String firstName, String lastName, String email) { + this.login = login; + this.password = password; + this.department = department; + this.title = title; + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + } + + public LdapUser login(String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + **/ + @ApiModelProperty(required = true, value = "") + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public LdapUser password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public LdapUser department(String department) { + this.department = department; + return this; + } + + /** + * Get department + * @return department + **/ + @ApiModelProperty(value = "") + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public LdapUser title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @ApiModelProperty(value = "") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public LdapUser firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public LdapUser lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public LdapUser email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; } - - public String getLogin() { - return login; + if (o == null || getClass() != o.getClass()) { + return false; } + LdapUser ldapUser = (LdapUser) o; + return Objects.equals(this.login, ldapUser.login) && + Objects.equals(this.password, ldapUser.password) && + Objects.equals(this.department, ldapUser.department) && + Objects.equals(this.title, ldapUser.title) && + Objects.equals(this.firstName, ldapUser.firstName) && + Objects.equals(this.lastName, ldapUser.lastName) && + Objects.equals(this.email, ldapUser.email); + } - public void setLogin(String login) { - this.login = login; + @Override + public int hashCode() { + return Objects.hash(login, password, department, title, firstName, lastName, email); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LdapUser {\n"); + + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" department: ").append(toIndentedString(department)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public String getPassword() { - return password; - } +} - public void setPassword(String password) { - this.password = password; - } - - public String getDepartment() { - return department; - } - - public void setDepartment(String department) { - this.department = department; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/Model.java b/app/src/main/java/com/uam/wmi/findmytutor/model/Model.java new file mode 100644 index 0000000..3b5ee47 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/Model.java @@ -0,0 +1,16 @@ +package com.uam.wmi.findmytutor.model; + + +import com.google.gson.annotations.SerializedName; + +public class Model +{ + @SerializedName("data") + private PagedResult data; + + public PagedResult getData () + { + return data; + } + +} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java new file mode 100644 index 0000000..db05386 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java @@ -0,0 +1,88 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class PagedResult { + + @SerializedName("results") + @Expose + private List results = null; + @SerializedName("currentPage") + @Expose + private Integer currentPage; + @SerializedName("pageCount") + @Expose + private Integer pageCount; + @SerializedName("pageSize") + @Expose + private Integer pageSize; + @SerializedName("rowCount") + @Expose + private Integer rowCount; + @SerializedName("firstRowOnPage") + @Expose + private Integer firstRowOnPage; + @SerializedName("lastRowOnPage") + @Expose + private Integer lastRowOnPage; + + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + public Integer getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(Integer currentPage) { + this.currentPage = currentPage; + } + + public Integer getPageCount() { + return pageCount; + } + + public void setPageCount(Integer pageCount) { + this.pageCount = pageCount; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Integer getRowCount() { + return rowCount; + } + + public void setRowCount(Integer rowCount) { + this.rowCount = rowCount; + } + + public Integer getFirstRowOnPage() { + return firstRowOnPage; + } + + public void setFirstRowOnPage(Integer firstRowOnPage) { + this.firstRowOnPage = firstRowOnPage; + } + + public Integer getLastRowOnPage() { + return lastRowOnPage; + } + + public void setLastRowOnPage(Integer lastRowOnPage) { + this.lastRowOnPage = lastRowOnPage; + } + +} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResultUserResponseModel.java b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResultUserResponseModel.java new file mode 100644 index 0000000..0e16bb2 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResultUserResponseModel.java @@ -0,0 +1,206 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import io.swagger.annotations.ApiModelProperty; + +/** + * PagedResultUserResponseModel + */ + +public class PagedResultUserResponseModel extends BaseResponse { + @SerializedName("results") + private List results = null; + + @SerializedName("currentPage") + private Integer currentPage = null; + + @SerializedName("pageCount") + private Integer pageCount = null; + + @SerializedName("pageSize") + private Integer pageSize = null; + + @SerializedName("rowCount") + private Integer rowCount = null; + + @SerializedName("firstRowOnPage") + private Integer firstRowOnPage = null; + + @SerializedName("lastRowOnPage") + private Integer lastRowOnPage = null; + + public PagedResultUserResponseModel results(List results) { + this.results = results; + return this; + } + + public PagedResultUserResponseModel addResultsItem(UserResponseModel resultsItem) { + if (this.results == null) { + this.results = new ArrayList(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + **/ + @ApiModelProperty(value = "") + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + public PagedResultUserResponseModel currentPage(Integer currentPage) { + this.currentPage = currentPage; + return this; + } + + /** + * Get currentPage + * @return currentPage + **/ + @ApiModelProperty(value = "") + public Integer getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(Integer currentPage) { + this.currentPage = currentPage; + } + + public PagedResultUserResponseModel pageCount(Integer pageCount) { + this.pageCount = pageCount; + return this; + } + + /** + * Get pageCount + * @return pageCount + **/ + @ApiModelProperty(value = "") + public Integer getPageCount() { + return pageCount; + } + + public void setPageCount(Integer pageCount) { + this.pageCount = pageCount; + } + + public PagedResultUserResponseModel pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + **/ + @ApiModelProperty(value = "") + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public PagedResultUserResponseModel rowCount(Integer rowCount) { + this.rowCount = rowCount; + return this; + } + + /** + * Get rowCount + * @return rowCount + **/ + @ApiModelProperty(value = "") + public Integer getRowCount() { + return rowCount; + } + + public void setRowCount(Integer rowCount) { + this.rowCount = rowCount; + } + + /** + * Get firstRowOnPage + * @return firstRowOnPage + **/ + @ApiModelProperty(value = "") + public Integer getFirstRowOnPage() { + return firstRowOnPage; + } + + /** + * Get lastRowOnPage + * @return lastRowOnPage + **/ + @ApiModelProperty(value = "") + public Integer getLastRowOnPage() { + return lastRowOnPage; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PagedResultUserResponseModel pagedResultUserResponseModel = (PagedResultUserResponseModel) o; + return Objects.equals(this.results, pagedResultUserResponseModel.results) && + Objects.equals(this.currentPage, pagedResultUserResponseModel.currentPage) && + Objects.equals(this.pageCount, pagedResultUserResponseModel.pageCount) && + Objects.equals(this.pageSize, pagedResultUserResponseModel.pageSize) && + Objects.equals(this.rowCount, pagedResultUserResponseModel.rowCount) && + Objects.equals(this.firstRowOnPage, pagedResultUserResponseModel.firstRowOnPage) && + Objects.equals(this.lastRowOnPage, pagedResultUserResponseModel.lastRowOnPage); + } + + @Override + public int hashCode() { + return Objects.hash(results, currentPage, pageCount, pageSize, rowCount, firstRowOnPage, lastRowOnPage); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PagedResultUserResponseModel {\n"); + + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" currentPage: ").append(toIndentedString(currentPage)).append("\n"); + sb.append(" pageCount: ").append(toIndentedString(pageCount)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" rowCount: ").append(toIndentedString(rowCount)).append("\n"); + sb.append(" firstRowOnPage: ").append(toIndentedString(firstRowOnPage)).append("\n"); + sb.append(" lastRowOnPage: ").append(toIndentedString(lastRowOnPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java b/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java new file mode 100644 index 0000000..1e4f111 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java @@ -0,0 +1,164 @@ +package com.uam.wmi.findmytutor.model; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class Result extends BaseResponse { + + @SerializedName("id") + @Expose + private String id; + @SerializedName("isOnline") + @Expose + private Boolean isOnline; + @SerializedName("isUsingBlacklist") + @Expose + private Boolean isUsingBlacklist; + @SerializedName("isUsingWhitelist") + @Expose + private Boolean isUsingWhitelist; + @SerializedName("blacklist") + @Expose + private List blacklist = null; + @SerializedName("whitelist") + @Expose + private List whitelist = null; + @SerializedName("ldapLogin") + @Expose + private String ldapLogin; + @SerializedName("title") + @Expose + private String title; + @SerializedName("firstName") + @Expose + private String firstName; + @SerializedName("lastName") + @Expose + private String lastName; + @SerializedName("department") + @Expose + private String department; + @SerializedName("userName") + @Expose + private String userName; + @SerializedName("email") + @Expose + private String email; + @SerializedName("isActive") + @Expose + private Boolean isActive; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Boolean getIsOnline() { + return isOnline; + } + + public void setIsOnline(Boolean isOnline) { + this.isOnline = isOnline; + } + + public Boolean getIsUsingBlacklist() { + return isUsingBlacklist; + } + + public void setIsUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + } + + public Boolean getIsUsingWhitelist() { + return isUsingWhitelist; + } + + public void setIsUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + } + + public List getBlacklist() { + return blacklist; + } + + public void setBlacklist(List blacklist) { + this.blacklist = blacklist; + } + + public List getWhitelist() { + return whitelist; + } + + public void setWhitelist(List whitelist) { + this.whitelist = whitelist; + } + + public String getLdapLogin() { + return ldapLogin; + } + + public void setLdapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Boolean getIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/StudentIdModel.java b/app/src/main/java/com/uam/wmi/findmytutor/model/StudentIdModel.java new file mode 100644 index 0000000..3eea407 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/StudentIdModel.java @@ -0,0 +1,100 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; + +import io.swagger.annotations.ApiModelProperty; + + +/** + * StudentIdModel + */ + +public class StudentIdModel extends BaseResponse{ + @SerializedName("studentId") + private String studentId = null; + + @SerializedName("ldapLogin") + private String ldapLogin = null; + + public StudentIdModel studentId(String studentId) { + this.studentId = studentId; + return this; + } + + /** + * Get studentId + * @return studentId + **/ + @ApiModelProperty(value = "") + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + + public StudentIdModel ldapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + return this; + } + + /** + * Get ldapLogin + * @return ldapLogin + **/ + @ApiModelProperty(value = "") + public String getLdapLogin() { + return ldapLogin; + } + + public void setLdapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StudentIdModel studentIdModel = (StudentIdModel) o; + return Objects.equals(this.studentId, studentIdModel.studentId) && + Objects.equals(this.ldapLogin, studentIdModel.ldapLogin); + } + + @Override + public int hashCode() { + return Objects.hash(studentId, ldapLogin); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StudentIdModel {\n"); + + sb.append(" studentId: ").append(toIndentedString(studentId)).append("\n"); + sb.append(" ldapLogin: ").append(toIndentedString(ldapLogin)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/TutorTab.java b/app/src/main/java/com/uam/wmi/findmytutor/model/TutorTab.java new file mode 100644 index 0000000..62916f1 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/TutorTab.java @@ -0,0 +1,204 @@ +package com.uam.wmi.findmytutor.model; + + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import io.swagger.annotations.ApiModelProperty; + + +/** + * TutorTab + */ + +public class TutorTab extends BaseResponse{ + @SerializedName("tutorTabId") + private UUID tutorTabId = null; + + @SerializedName("userId") + private String userId = null; + + @SerializedName("room") + private String room = null; + + @SerializedName("emailTutorTab") + private String emailTutorTab = null; + + @SerializedName("dutyHours") + private List dutyHours = null; + + @SerializedName("user") + private User user = null; + + public TutorTab tutorTabId(UUID tutorTabId) { + this.tutorTabId = tutorTabId; + return this; + } + + /** + * Get tutorTabId + * @return tutorTabId + **/ + @ApiModelProperty(value = "") + public UUID getTutorTabId() { + return tutorTabId; + } + + public void setTutorTabId(UUID tutorTabId) { + this.tutorTabId = tutorTabId; + } + + public TutorTab userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get userId + * @return userId + **/ + @ApiModelProperty(required = true, value = "") + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public TutorTab room(String room) { + this.room = room; + return this; + } + + /** + * Get room + * @return room + **/ + @ApiModelProperty(value = "") + public String getRoom() { + return room; + } + + public void setRoom(String room) { + this.room = room; + } + + public TutorTab emailTutorTab(String emailTutorTab) { + this.emailTutorTab = emailTutorTab; + return this; + } + + /** + * Get emailTutorTab + * @return emailTutorTab + **/ + @ApiModelProperty(value = "") + public String getEmailTutorTab() { + return emailTutorTab; + } + + public void setEmailTutorTab(String emailTutorTab) { + this.emailTutorTab = emailTutorTab; + } + + public TutorTab dutyHours(List dutyHours) { + this.dutyHours = dutyHours; + return this; + } + + public TutorTab addDutyHoursItem(DutyHour dutyHoursItem) { + if (this.dutyHours == null) { + this.dutyHours = new ArrayList(); + } + this.dutyHours.add(dutyHoursItem); + return this; + } + + /** + * Get dutyHours + * @return dutyHours + **/ + @ApiModelProperty(value = "") + public List getDutyHours() { + return dutyHours; + } + + public void setDutyHours(List dutyHours) { + this.dutyHours = dutyHours; + } + + public TutorTab user(User user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + **/ + @ApiModelProperty(value = "") + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TutorTab tutorTab = (TutorTab) o; + return Objects.equals(this.tutorTabId, tutorTab.tutorTabId) && + Objects.equals(this.userId, tutorTab.userId) && + Objects.equals(this.room, tutorTab.room) && + Objects.equals(this.emailTutorTab, tutorTab.emailTutorTab) && + Objects.equals(this.dutyHours, tutorTab.dutyHours) && + Objects.equals(this.user, tutorTab.user); + } + + @Override + public int hashCode() { + return Objects.hash(tutorTabId, userId, room, emailTutorTab, dutyHours, user); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TutorTab {\n"); + + sb.append(" tutorTabId: ").append(toIndentedString(tutorTabId)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" room: ").append(toIndentedString(room)).append("\n"); + sb.append(" emailTutorTab: ").append(toIndentedString(emailTutorTab)).append("\n"); + sb.append(" dutyHours: ").append(toIndentedString(dutyHours)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/User.java b/app/src/main/java/com/uam/wmi/findmytutor/model/User.java new file mode 100644 index 0000000..f16add4 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/User.java @@ -0,0 +1,726 @@ +package com.uam.wmi.findmytutor.model; + + +import com.google.gson.annotations.SerializedName; + +import org.threeten.bp.OffsetDateTime; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import io.swagger.annotations.ApiModelProperty; + +/** + * User + */ + +public class User extends BaseResponse{ + @SerializedName("isOnline") + private Boolean isOnline = null; + + @SerializedName("isUsingBlacklist") + private Boolean isUsingBlacklist = null; + + @SerializedName("isUsingWhitelist") + private Boolean isUsingWhitelist = null; + + @SerializedName("blacklist") + private List blacklist = null; + + @SerializedName("whitelist") + private List whitelist = null; + + @SerializedName("department") + private String department = null; + + @SerializedName("ldapLogin") + private String ldapLogin = null; + + @SerializedName("title") + private String title = null; + + @SerializedName("firstName") + private String firstName = null; + + @SerializedName("lastName") + private String lastName = null; + + @SerializedName("isActive") + private Boolean isActive = null; + + @SerializedName("tutorTab") + private TutorTab tutorTab = null; + + @SerializedName("coordinates") + private List coordinates = null; + + @SerializedName("id") + private String id = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("normalizedUserName") + private String normalizedUserName = null; + + @SerializedName("email") + private String email = null; + + @SerializedName("normalizedEmail") + private String normalizedEmail = null; + + @SerializedName("emailConfirmed") + private Boolean emailConfirmed = null; + + @SerializedName("passwordHash") + private String passwordHash = null; + + @SerializedName("securityStamp") + private String securityStamp = null; + + @SerializedName("concurrencyStamp") + private String concurrencyStamp = null; + + @SerializedName("phoneNumber") + private String phoneNumber = null; + + @SerializedName("phoneNumberConfirmed") + private Boolean phoneNumberConfirmed = null; + + @SerializedName("twoFactorEnabled") + private Boolean twoFactorEnabled = null; + + @SerializedName("lockoutEnd") + private OffsetDateTime lockoutEnd = null; + + @SerializedName("lockoutEnabled") + private Boolean lockoutEnabled = null; + + @SerializedName("accessFailedCount") + private Integer accessFailedCount = null; + + public User isOnline(Boolean isOnline) { + this.isOnline = isOnline; + return this; + } + + /** + * Get isOnline + * @return isOnline + **/ + @ApiModelProperty(value = "") + public Boolean isIsOnline() { + return isOnline; + } + + public void setIsOnline(Boolean isOnline) { + this.isOnline = isOnline; + } + + public User isUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + return this; + } + + /** + * Get isUsingBlacklist + * @return isUsingBlacklist + **/ + @ApiModelProperty(value = "") + public Boolean isIsUsingBlacklist() { + return isUsingBlacklist; + } + + public void setIsUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + } + + public User isUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + return this; + } + + /** + * Get isUsingWhitelist + * @return isUsingWhitelist + **/ + @ApiModelProperty(value = "") + public Boolean isIsUsingWhitelist() { + return isUsingWhitelist; + } + + public void setIsUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + } + + public User blacklist(List blacklist) { + this.blacklist = blacklist; + return this; + } + + public User addBlacklistItem(String blacklistItem) { + if (this.blacklist == null) { + this.blacklist = new ArrayList(); + } + this.blacklist.add(blacklistItem); + return this; + } + + /** + * Get blacklist + * @return blacklist + **/ + @ApiModelProperty(value = "") + public List getBlacklist() { + return blacklist; + } + + public void setBlacklist(List blacklist) { + this.blacklist = blacklist; + } + + public User whitelist(List whitelist) { + this.whitelist = whitelist; + return this; + } + + public User addWhitelistItem(String whitelistItem) { + if (this.whitelist == null) { + this.whitelist = new ArrayList(); + } + this.whitelist.add(whitelistItem); + return this; + } + + /** + * Get whitelist + * @return whitelist + **/ + @ApiModelProperty(value = "") + public List getWhitelist() { + return whitelist; + } + + public void setWhitelist(List whitelist) { + this.whitelist = whitelist; + } + + public User department(String department) { + this.department = department; + return this; + } + + /** + * Get department + * @return department + **/ + @ApiModelProperty(required = true, value = "") + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public User ldapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + return this; + } + + /** + * Get ldapLogin + * @return ldapLogin + **/ + @ApiModelProperty(required = true, value = "") + public String getLdapLogin() { + return ldapLogin; + } + + public void setLdapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + } + + public User title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @ApiModelProperty(required = true, value = "") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(required = true, value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(required = true, value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User isActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get isActive + * @return isActive + **/ + @ApiModelProperty(required = true, value = "") + public Boolean isIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + + public User tutorTab(TutorTab tutorTab) { + this.tutorTab = tutorTab; + return this; + } + + /** + * Get tutorTab + * @return tutorTab + **/ + @ApiModelProperty(value = "") + public TutorTab getTutorTab() { + return tutorTab; + } + + public void setTutorTab(TutorTab tutorTab) { + this.tutorTab = tutorTab; + } + + public User coordinates(List coordinates) { + this.coordinates = coordinates; + return this; + } + + public User addCoordinatesItem(Coordinate coordinatesItem) { + if (this.coordinates == null) { + this.coordinates = new ArrayList(); + } + this.coordinates.add(coordinatesItem); + return this; + } + + /** + * Get coordinates + * @return coordinates + **/ + @ApiModelProperty(value = "") + public List getCoordinates() { + return coordinates; + } + + public void setCoordinates(List coordinates) { + this.coordinates = coordinates; + } + + public User id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public User userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + **/ + @ApiModelProperty(value = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public User normalizedUserName(String normalizedUserName) { + this.normalizedUserName = normalizedUserName; + return this; + } + + /** + * Get normalizedUserName + * @return normalizedUserName + **/ + @ApiModelProperty(value = "") + public String getNormalizedUserName() { + return normalizedUserName; + } + + public void setNormalizedUserName(String normalizedUserName) { + this.normalizedUserName = normalizedUserName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User normalizedEmail(String normalizedEmail) { + this.normalizedEmail = normalizedEmail; + return this; + } + + /** + * Get normalizedEmail + * @return normalizedEmail + **/ + @ApiModelProperty(value = "") + public String getNormalizedEmail() { + return normalizedEmail; + } + + public void setNormalizedEmail(String normalizedEmail) { + this.normalizedEmail = normalizedEmail; + } + + public User emailConfirmed(Boolean emailConfirmed) { + this.emailConfirmed = emailConfirmed; + return this; + } + + /** + * Get emailConfirmed + * @return emailConfirmed + **/ + @ApiModelProperty(value = "") + public Boolean isEmailConfirmed() { + return emailConfirmed; + } + + public void setEmailConfirmed(Boolean emailConfirmed) { + this.emailConfirmed = emailConfirmed; + } + + public User passwordHash(String passwordHash) { + this.passwordHash = passwordHash; + return this; + } + + /** + * Get passwordHash + * @return passwordHash + **/ + @ApiModelProperty(value = "") + public String getPasswordHash() { + return passwordHash; + } + + public void setPasswordHash(String passwordHash) { + this.passwordHash = passwordHash; + } + + public User securityStamp(String securityStamp) { + this.securityStamp = securityStamp; + return this; + } + + /** + * Get securityStamp + * @return securityStamp + **/ + @ApiModelProperty(value = "") + public String getSecurityStamp() { + return securityStamp; + } + + public void setSecurityStamp(String securityStamp) { + this.securityStamp = securityStamp; + } + + public User concurrencyStamp(String concurrencyStamp) { + this.concurrencyStamp = concurrencyStamp; + return this; + } + + /** + * Get concurrencyStamp + * @return concurrencyStamp + **/ + @ApiModelProperty(value = "") + public String getConcurrencyStamp() { + return concurrencyStamp; + } + + public void setConcurrencyStamp(String concurrencyStamp) { + this.concurrencyStamp = concurrencyStamp; + } + + public User phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + **/ + @ApiModelProperty(value = "") + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public User phoneNumberConfirmed(Boolean phoneNumberConfirmed) { + this.phoneNumberConfirmed = phoneNumberConfirmed; + return this; + } + + /** + * Get phoneNumberConfirmed + * @return phoneNumberConfirmed + **/ + @ApiModelProperty(value = "") + public Boolean isPhoneNumberConfirmed() { + return phoneNumberConfirmed; + } + + public void setPhoneNumberConfirmed(Boolean phoneNumberConfirmed) { + this.phoneNumberConfirmed = phoneNumberConfirmed; + } + + public User twoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + return this; + } + + /** + * Get twoFactorEnabled + * @return twoFactorEnabled + **/ + @ApiModelProperty(value = "") + public Boolean isTwoFactorEnabled() { + return twoFactorEnabled; + } + + public void setTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + } + + public User lockoutEnd(OffsetDateTime lockoutEnd) { + this.lockoutEnd = lockoutEnd; + return this; + } + + /** + * Get lockoutEnd + * @return lockoutEnd + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getLockoutEnd() { + return lockoutEnd; + } + + public void setLockoutEnd(OffsetDateTime lockoutEnd) { + this.lockoutEnd = lockoutEnd; + } + + public User lockoutEnabled(Boolean lockoutEnabled) { + this.lockoutEnabled = lockoutEnabled; + return this; + } + + /** + * Get lockoutEnabled + * @return lockoutEnabled + **/ + @ApiModelProperty(value = "") + public Boolean isLockoutEnabled() { + return lockoutEnabled; + } + + public void setLockoutEnabled(Boolean lockoutEnabled) { + this.lockoutEnabled = lockoutEnabled; + } + + public User accessFailedCount(Integer accessFailedCount) { + this.accessFailedCount = accessFailedCount; + return this; + } + + /** + * Get accessFailedCount + * @return accessFailedCount + **/ + @ApiModelProperty(value = "") + public Integer getAccessFailedCount() { + return accessFailedCount; + } + + public void setAccessFailedCount(Integer accessFailedCount) { + this.accessFailedCount = accessFailedCount; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.isOnline, user.isOnline) && + Objects.equals(this.isUsingBlacklist, user.isUsingBlacklist) && + Objects.equals(this.isUsingWhitelist, user.isUsingWhitelist) && + Objects.equals(this.blacklist, user.blacklist) && + Objects.equals(this.whitelist, user.whitelist) && + Objects.equals(this.department, user.department) && + Objects.equals(this.ldapLogin, user.ldapLogin) && + Objects.equals(this.title, user.title) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.isActive, user.isActive) && + Objects.equals(this.tutorTab, user.tutorTab) && + Objects.equals(this.coordinates, user.coordinates) && + Objects.equals(this.id, user.id) && + Objects.equals(this.userName, user.userName) && + Objects.equals(this.normalizedUserName, user.normalizedUserName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.normalizedEmail, user.normalizedEmail) && + Objects.equals(this.emailConfirmed, user.emailConfirmed) && + Objects.equals(this.passwordHash, user.passwordHash) && + Objects.equals(this.securityStamp, user.securityStamp) && + Objects.equals(this.concurrencyStamp, user.concurrencyStamp) && + Objects.equals(this.phoneNumber, user.phoneNumber) && + Objects.equals(this.phoneNumberConfirmed, user.phoneNumberConfirmed) && + Objects.equals(this.twoFactorEnabled, user.twoFactorEnabled) && + Objects.equals(this.lockoutEnd, user.lockoutEnd) && + Objects.equals(this.lockoutEnabled, user.lockoutEnabled) && + Objects.equals(this.accessFailedCount, user.accessFailedCount); + } + + @Override + public int hashCode() { + return Objects.hash(isOnline, isUsingBlacklist, isUsingWhitelist, blacklist, whitelist, department, ldapLogin, title, firstName, lastName, isActive, tutorTab, coordinates, id, userName, normalizedUserName, email, normalizedEmail, emailConfirmed, passwordHash, securityStamp, concurrencyStamp, phoneNumber, phoneNumberConfirmed, twoFactorEnabled, lockoutEnd, lockoutEnabled, accessFailedCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" isOnline: ").append(toIndentedString(isOnline)).append("\n"); + sb.append(" isUsingBlacklist: ").append(toIndentedString(isUsingBlacklist)).append("\n"); + sb.append(" isUsingWhitelist: ").append(toIndentedString(isUsingWhitelist)).append("\n"); + sb.append(" blacklist: ").append(toIndentedString(blacklist)).append("\n"); + sb.append(" whitelist: ").append(toIndentedString(whitelist)).append("\n"); + sb.append(" department: ").append(toIndentedString(department)).append("\n"); + sb.append(" ldapLogin: ").append(toIndentedString(ldapLogin)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" isActive: ").append(toIndentedString(isActive)).append("\n"); + sb.append(" tutorTab: ").append(toIndentedString(tutorTab)).append("\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" normalizedUserName: ").append(toIndentedString(normalizedUserName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" normalizedEmail: ").append(toIndentedString(normalizedEmail)).append("\n"); + sb.append(" emailConfirmed: ").append(toIndentedString(emailConfirmed)).append("\n"); + sb.append(" passwordHash: ").append(toIndentedString(passwordHash)).append("\n"); + sb.append(" securityStamp: ").append(toIndentedString(securityStamp)).append("\n"); + sb.append(" concurrencyStamp: ").append(toIndentedString(concurrencyStamp)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" phoneNumberConfirmed: ").append(toIndentedString(phoneNumberConfirmed)).append("\n"); + sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); + sb.append(" lockoutEnd: ").append(toIndentedString(lockoutEnd)).append("\n"); + sb.append(" lockoutEnabled: ").append(toIndentedString(lockoutEnabled)).append("\n"); + sb.append(" accessFailedCount: ").append(toIndentedString(accessFailedCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/UserResponseModel.java b/app/src/main/java/com/uam/wmi/findmytutor/model/UserResponseModel.java new file mode 100644 index 0000000..c927500 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/UserResponseModel.java @@ -0,0 +1,393 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; +import java.util.List; +import java.util.ArrayList; +import io.swagger.annotations.ApiModelProperty; + + +/** + * UserResponseModel + */ + +public class UserResponseModel extends BaseResponse{ + @SerializedName("id") + private String id = null; + + @SerializedName("isOnline") + private Boolean isOnline = null; + + @SerializedName("isUsingBlacklist") + private Boolean isUsingBlacklist = null; + + @SerializedName("isUsingWhitelist") + private Boolean isUsingWhitelist = null; + + @SerializedName("blacklist") + private List blacklist = null; + + @SerializedName("whitelist") + private List whitelist = null; + + @SerializedName("ldapLogin") + private String ldapLogin = null; + + @SerializedName("title") + private String title = null; + + @SerializedName("firstName") + private String firstName = null; + + @SerializedName("lastName") + private String lastName = null; + + @SerializedName("department") + private String department = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("email") + private String email = null; + + @SerializedName("isActive") + private Boolean isActive = null; + + public UserResponseModel id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public UserResponseModel isOnline(Boolean isOnline) { + this.isOnline = isOnline; + return this; + } + + /** + * Get isOnline + * @return isOnline + **/ + @ApiModelProperty(value = "") + public Boolean isIsOnline() { + return isOnline; + } + + public void setIsOnline(Boolean isOnline) { + this.isOnline = isOnline; + } + + public UserResponseModel isUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + return this; + } + + /** + * Get isUsingBlacklist + * @return isUsingBlacklist + **/ + @ApiModelProperty(value = "") + public Boolean isIsUsingBlacklist() { + return isUsingBlacklist; + } + + public void setIsUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + } + + public UserResponseModel isUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + return this; + } + + /** + * Get isUsingWhitelist + * @return isUsingWhitelist + **/ + @ApiModelProperty(value = "") + public Boolean isIsUsingWhitelist() { + return isUsingWhitelist; + } + + public void setIsUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + } + + public UserResponseModel blacklist(List blacklist) { + this.blacklist = blacklist; + return this; + } + + public UserResponseModel addBlacklistItem(String blacklistItem) { + if (this.blacklist == null) { + this.blacklist = new ArrayList(); + } + this.blacklist.add(blacklistItem); + return this; + } + + /** + * Get blacklist + * @return blacklist + **/ + @ApiModelProperty(value = "") + public List getBlacklist() { + return blacklist; + } + + public void setBlacklist(List blacklist) { + this.blacklist = blacklist; + } + + public UserResponseModel whitelist(List whitelist) { + this.whitelist = whitelist; + return this; + } + + public UserResponseModel addWhitelistItem(String whitelistItem) { + if (this.whitelist == null) { + this.whitelist = new ArrayList(); + } + this.whitelist.add(whitelistItem); + return this; + } + + /** + * Get whitelist + * @return whitelist + **/ + @ApiModelProperty(value = "") + public List getWhitelist() { + return whitelist; + } + + public void setWhitelist(List whitelist) { + this.whitelist = whitelist; + } + + public UserResponseModel ldapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + return this; + } + + /** + * Get ldapLogin + * @return ldapLogin + **/ + @ApiModelProperty(value = "") + public String getLdapLogin() { + return ldapLogin; + } + + public void setLdapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + } + + public UserResponseModel title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @ApiModelProperty(value = "") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public UserResponseModel firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public UserResponseModel lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public UserResponseModel department(String department) { + this.department = department; + return this; + } + + /** + * Get department + * @return department + **/ + @ApiModelProperty(value = "") + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public UserResponseModel userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + **/ + @ApiModelProperty(value = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public UserResponseModel email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public UserResponseModel isActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get isActive + * @return isActive + **/ + @ApiModelProperty(value = "") + public Boolean isIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserResponseModel userResponseModel = (UserResponseModel) o; + return Objects.equals(this.id, userResponseModel.id) && + Objects.equals(this.isOnline, userResponseModel.isOnline) && + Objects.equals(this.isUsingBlacklist, userResponseModel.isUsingBlacklist) && + Objects.equals(this.isUsingWhitelist, userResponseModel.isUsingWhitelist) && + Objects.equals(this.blacklist, userResponseModel.blacklist) && + Objects.equals(this.whitelist, userResponseModel.whitelist) && + Objects.equals(this.ldapLogin, userResponseModel.ldapLogin) && + Objects.equals(this.title, userResponseModel.title) && + Objects.equals(this.firstName, userResponseModel.firstName) && + Objects.equals(this.lastName, userResponseModel.lastName) && + Objects.equals(this.department, userResponseModel.department) && + Objects.equals(this.userName, userResponseModel.userName) && + Objects.equals(this.email, userResponseModel.email) && + Objects.equals(this.isActive, userResponseModel.isActive); + } + + @Override + public int hashCode() { + return Objects.hash(id, isOnline, isUsingBlacklist, isUsingWhitelist, blacklist, whitelist, ldapLogin, title, firstName, lastName, department, userName, email, isActive); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserResponseModel {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" isOnline: ").append(toIndentedString(isOnline)).append("\n"); + sb.append(" isUsingBlacklist: ").append(toIndentedString(isUsingBlacklist)).append("\n"); + sb.append(" isUsingWhitelist: ").append(toIndentedString(isUsingWhitelist)).append("\n"); + sb.append(" blacklist: ").append(toIndentedString(blacklist)).append("\n"); + sb.append(" whitelist: ").append(toIndentedString(whitelist)).append("\n"); + sb.append(" ldapLogin: ").append(toIndentedString(ldapLogin)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" department: ").append(toIndentedString(department)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" isActive: ").append(toIndentedString(isActive)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java b/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java new file mode 100644 index 0000000..008a6cc --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java @@ -0,0 +1,75 @@ +package com.uam.wmi.findmytutor.network; + +import android.content.Context; +import android.text.TextUtils; + +import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +import com.uam.wmi.findmytutor.utils.PrefUtils; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.logging.HttpLoggingInterceptor; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + + +public class ApiClient { + private static Retrofit retrofit = null; + private static int REQUEST_TIMEOUT = 60; + private static OkHttpClient okHttpClient; + private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/"; + + public static Retrofit getClient(Context context) { + + if (okHttpClient == null) + initOkHttp(context); + + if (retrofit == null) { + retrofit = new Retrofit.Builder() + .baseUrl(BASE_URL) + .client(okHttpClient) + .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + } + return retrofit; + } + + private static void initOkHttp(final Context context) { + OkHttpClient.Builder httpClient = new OkHttpClient().newBuilder() + .connectTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS) + .readTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS) + .writeTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS); + + HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); + interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + + httpClient.addInterceptor(interceptor); + + httpClient.addInterceptor(new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + Request original = chain.request(); + Request.Builder requestBuilder = original.newBuilder() + .addHeader("Accept", "application/json") + .addHeader("Content-Type", "application/json"); + + // Adding Authorization token (API Key) + // Requests will be denied without API key + if (!TextUtils.isEmpty(PrefUtils.getApiKey(context))) { + requestBuilder.addHeader("Authorization", PrefUtils.getApiKey(context)); + } + + Request request = requestBuilder.build(); + return chain.proceed(request); + } + }); + + okHttpClient = httpClient.build(); + } + }; diff --git a/app/src/main/java/com/uam/wmi/findmytutor/network/NetworkConnectionInterceptor.java b/app/src/main/java/com/uam/wmi/findmytutor/network/NetworkConnectionInterceptor.java deleted file mode 100644 index f5732e3..0000000 --- a/app/src/main/java/com/uam/wmi/findmytutor/network/NetworkConnectionInterceptor.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.uam.wmi.findmytutor.network; - -import java.io.IOException; - -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; - -public abstract class NetworkConnectionInterceptor implements Interceptor { - - public abstract boolean isInternetAvailable(); - - public abstract void onInternetUnavailable(); - - public abstract void onCacheUnavailable(); - - @Override - public Response intercept(Chain chain) throws IOException { - Request request = chain.request(); - if (!isInternetAvailable()) { - onInternetUnavailable(); - request = request.newBuilder().header("Cache-Control", - "public, only-if-cached, max-stale=" + 60 * 60 * 24).build(); - Response response = chain.proceed(request); - if (response.cacheResponse() == null) { - onCacheUnavailable(); - } - return response; - } - return chain.proceed(request); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java b/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java deleted file mode 100644 index d537f97..0000000 --- a/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.uam.wmi.findmytutor.network; - -import java.util.concurrent.TimeUnit; - -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; -import retrofit2.converter.gson.GsonConverterFactory; - -public class RetrofitClientInstance { - private static Retrofit retrofit; - private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/"; - - - public static Retrofit getRetrofitLoginInstance() { - if (retrofit == null) { - retrofit = new retrofit2.Retrofit.Builder() - .baseUrl(BASE_URL) - .addConverterFactory(GsonConverterFactory.create()) - .build(); - } - return retrofit; - } - - public static Retrofit getRetrofitInstance() { - if (retrofit == null) { - retrofit = new retrofit2.Retrofit.Builder() - .baseUrl(BASE_URL) - .client(provideOkHttpClient()) - .addConverterFactory(GsonConverterFactory.create()) - .build(); - } - return retrofit; - } - - private static OkHttpClient provideOkHttpClient() { - OkHttpClient.Builder okhttpClientBuilder = new OkHttpClient.Builder(); - okhttpClientBuilder.connectTimeout(30, TimeUnit.SECONDS); - okhttpClientBuilder.readTimeout(30, TimeUnit.SECONDS); - okhttpClientBuilder.writeTimeout(30, TimeUnit.SECONDS); - return okhttpClientBuilder.build(); - } - -// -// private OkHttpClient provideokHttpClient() { -// OkHttpClient.Builder okhttpClientBuilder = new OkHttpClient.Builder(); -// okhttpClientBuilder.connectTimeout(30, TimeUnit.SECONDS); -// okhttpClientBuilder.readTimeout(30, TimeUnit.SECONDS); -// okhttpClientBuilder.writeTimeout(30, TimeUnit.SECONDS); -// -// okhttpClientBuilder.addInterceptor(new NetworkConnectionInterceptor() { -// @Override -// public boolean isInternetAvailable() { -// return this.isInternetAvailable(); -// } -// -// @Override -// public void onInternetUnavailable() { -// if (mInternetConnectionListener != null) { -// mInternetConnectionListener.onInternetUnavailable(); -// } -// } -// -// @Override -// public void onCacheUnavailable() { -// if (mInternetConnectionListener != null) { -// mInternetConnectionListener.onCacheUnavailable(); -// } -// } -// }); -// } -} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/CoordinateService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/CoordinateService.java new file mode 100644 index 0000000..877bec2 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/CoordinateService.java @@ -0,0 +1,46 @@ +package com.uam.wmi.findmytutor.service; + +import com.uam.wmi.findmytutor.model.Coordinate; + +import java.util.List; + +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; + +public interface CoordinateService { + + @GET("api/coordinates") + Call> getAllCoordinates(); + + @GET("api/coordinates/{id}") + Call getCoordinatesById(@Path("id") String id); + + @GET("api/coordinates/user/{userId}") + Call> getCoordinatesByUserId(@Path("userId") String userId); + + @GET("api/coordinates/userTop/{userId}") + Call> getTopCoordinatesByUserId(@Path("userId") String userId); + + @GET("api/coordinates/top") + Call> getTopCoordinates(); + + @GET("api/coordinates/top/online") + Call> getOnlineCoordinates(); + + @POST("api/coordinates") + Call postCoordinate(@Body Coordinate coordinate); + + @PUT("api/coordinates/{id}") + Call putCoordinatesById(@Path("id") String id); + + @DELETE("api/coordinates/{id}") + Call deleteCoordinatesById(@Path("id") String id); + +} + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/LdapService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/LdapService.java index 3583d2a..bb262f5 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/service/LdapService.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/LdapService.java @@ -3,7 +3,7 @@ package com.uam.wmi.findmytutor.service; import com.uam.wmi.findmytutor.model.JwtToken; import com.uam.wmi.findmytutor.model.LdapUser; -import retrofit2.Call; +import io.reactivex.Single; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; @@ -12,15 +12,15 @@ import retrofit2.http.Path; public interface LdapService { @POST("api/ldap/fakeValidate") - Call fakeValidate(@Body LdapUser user); + Single fakeValidate(@Body LdapUser user); @POST("api/ldap/validate") - Call validate(@Body LdapUser user); + Single validate(@Body LdapUser user); @GET("api/ldap/getUserData/{login}") - Call getUserDataByLogin(@Path("login") String userLogin); + Single getUserDataByLogin(@Path("login") String userLogin); @GET("api/ldap/getUserData/email/{email}") - Call getUserDataByMail(@Path("email") String userMail); + Single getUserDataByMail(@Path("email") String userMail); } diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/Session.java b/app/src/main/java/com/uam/wmi/findmytutor/service/Session.java deleted file mode 100644 index 20a6a58..0000000 --- a/app/src/main/java/com/uam/wmi/findmytutor/service/Session.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.uam.wmi.findmytutor.service; - -public interface Session { -} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java new file mode 100644 index 0000000..a0dbea3 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java @@ -0,0 +1,77 @@ +package com.uam.wmi.findmytutor.service; + +import com.uam.wmi.findmytutor.model.IsUsingListBool; +import com.uam.wmi.findmytutor.model.PagedResult; +import com.uam.wmi.findmytutor.model.StudentIdModel; +import com.uam.wmi.findmytutor.model.User; + +import java.util.List; + +import io.reactivex.Completable; +import io.reactivex.Single; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; + + +public interface UserService { + @GET("api/users") + Single > getAllUsers(); + + @POST("api/users") + Completable createUser(@Body User user); + + @GET("api/users/page/{pageNum}") + Single getPagedUsers(@Path("pageNum") String pageNum ); + + @GET("api/users/tutors/page/{pageNum}") + Single getPagedTutors(@Path("pageNum") String pageNum); + + @GET("api/users/students/page/{pageNum}") + Single getPagedStudents(@Path("pageNum") String pageNum); + + @GET("api/users/{id}") + Single getUserByID(@Path("id") String userID); + + @PUT("api/users/{id}") + Completable updateUserByID(@Path("id") String userID, @Body User user); + + @DELETE("api/users/{id}") + Completable deleteUserByID(@Path("id") String userID); + + @GET("api/users/userLogin/{ldapLogin}") + Single getUserLdapLogin(@Path("ldapLogin") String ldapLogin); + + @PUT("api/users/setActive/{userID}") + Completable setUserActive(@Path("userID") String userID); + + @PUT("api/users/setInActive/{userID}") + Completable setUserInActive(@Path("userID") String userID); + + @GET("api/users/blacklist/{tutorID}") + Single> getTutorBlacklistedByID(@Path("tutorID") String tutorID); + + @PUT("api/users/blacklist/{tutorID}") + Completable setTutorBlacklist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing); + + @POST("api/users/blacklist/{tutorID}") + Completable addStudentToBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @DELETE("api/users/blacklist/{tutorID}") + Completable removeStudentFromBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @GET("api/users/whitelist/{tutorID}") + Single> getTutorwhitelistedByID(@Path("tutorID") String tutorID); + + @PUT("api/users/whitelist/{tutorID}") + Completable setTutorWhitelist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing); + + @POST("api/users/whitelist/{tutorID}") + Completable addStudentTowhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @DELETE("api/users/whitelist/{tutorID}") + Completable removeStudentFromWhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student); +} 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 new file mode 100644 index 0000000..96a4d62 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java @@ -0,0 +1,98 @@ +package com.uam.wmi.findmytutor.utils; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.TypedValue; +import android.view.View; + +public class MyDividerItemDecoration extends RecyclerView.ItemDecoration { + + private static final int[] ATTRS = new int[]{ + android.R.attr.listDivider + }; + + public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL; + public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL; + + private Drawable mDivider; + private int mOrientation; + private Context context; + private int margin; + + public MyDividerItemDecoration(Context context, int orientation, int margin) { + this.context = context; + this.margin = margin; + final TypedArray a = context.obtainStyledAttributes(ATTRS); + mDivider = a.getDrawable(0); + a.recycle(); + setOrientation(orientation); + } + + public void setOrientation(int orientation) { + if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) { + throw new IllegalArgumentException("invalid orientation"); + } + mOrientation = orientation; + } + + @Override + public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { + if (mOrientation == VERTICAL_LIST) { + drawVertical(c, parent); + } else { + drawHorizontal(c, parent); + } + } + + public void drawVertical(Canvas c, RecyclerView parent) { + final int left = parent.getPaddingLeft(); + final int right = parent.getWidth() - parent.getPaddingRight(); + + final int childCount = parent.getChildCount(); + for (int i = 0; i < childCount; i++) { + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .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.draw(c); + } + } + + public void drawHorizontal(Canvas c, RecyclerView parent) { + final int top = parent.getPaddingTop(); + final int bottom = parent.getHeight() - parent.getPaddingBottom(); + + final int childCount = parent.getChildCount(); + for (int i = 0; i < childCount; i++) { + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + final int left = child.getRight() + params.rightMargin; + final int right = left + mDivider.getIntrinsicHeight(); + mDivider.setBounds(left, top + dpToPx(margin), right, bottom - dpToPx(margin)); + mDivider.draw(c); + } + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + if (mOrientation == VERTICAL_LIST) { + outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); + } else { + outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); + } + } + + private int dpToPx(int dp) { + Resources r = context.getResources(); + return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics())); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java new file mode 100644 index 0000000..8613c34 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java @@ -0,0 +1,27 @@ +package com.uam.wmi.findmytutor.utils; + +import android.content.Context; +import android.content.SharedPreferences; + +public class PrefUtils { + /** + * Storing API Key in shared preferences to + * add it in header part of every retrofit request + */ + public PrefUtils() { + } + + private static SharedPreferences getSharedPreferences(Context context) { + return context.getSharedPreferences("APP_PREF", Context.MODE_PRIVATE); + } + + public static void storeApiKey(Context context, String apiKey) { + SharedPreferences.Editor editor = getSharedPreferences(context).edit(); + editor.putString("API_KEY", apiKey); + editor.commit(); + } + + public static String getApiKey(Context context) { + return getSharedPreferences(context).getString("API_KEY", null); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/RecyclerTouchListener.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/RecyclerTouchListener.java new file mode 100644 index 0000000..28aef5d --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/RecyclerTouchListener.java @@ -0,0 +1,54 @@ +package com.uam.wmi.findmytutor.utils; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.View; + +public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { + + private ClickListener clicklistener; + private GestureDetector gestureDetector; + + public RecyclerTouchListener(Context context, final RecyclerView recycleView, final ClickListener clicklistener) { + + this.clicklistener = clicklistener; + gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onSingleTapUp(MotionEvent e) { + return true; + } + + @Override + public void onLongPress(MotionEvent e) { + View child = recycleView.findChildViewUnder(e.getX(), e.getY()); + if (child != null && clicklistener != null) { + clicklistener.onLongClick(child, recycleView.getChildAdapterPosition(child)); + } + } + }); + } + + @Override + public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { + View child = rv.findChildViewUnder(e.getX(), e.getY()); + if (child != null && clicklistener != null && gestureDetector.onTouchEvent(e)) { + clicklistener.onClick(child, rv.getChildAdapterPosition(child)); + } + return false; + } + + @Override + public void onTouchEvent(RecyclerView rv, MotionEvent e) { + } + + @Override + public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { + } + + public interface ClickListener { + void onClick(View view, int position); + void onLongClick(View view, int position); + } +} \ No newline at end of file diff --git a/app/src/main/res/color/nav_item_colors.xml b/app/src/main/res/color/nav_item_colors.xml new file mode 100644 index 0000000..721a035 --- /dev/null +++ b/app/src/main/res/color/nav_item_colors.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/outline_map_white_24dp.png b/app/src/main/res/drawable-hdpi/outline_map_white_24dp.png new file mode 100644 index 0000000..579a6e7 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_map_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_notifications_white_24dp.png b/app/src/main/res/drawable-hdpi/outline_notifications_white_24dp.png new file mode 100644 index 0000000..17da39c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_notifications_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_person_white_24dp.png b/app/src/main/res/drawable-hdpi/outline_person_white_24dp.png new file mode 100644 index 0000000..54eef90 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_person_white_24dp.png differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 6784ef7..c2c77b7 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -64,6 +64,12 @@ + +