Merge branch 'develop' into developToMapPravilnie
This commit is contained in:
commit
1e40b77205
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
@ -56,6 +56,7 @@ dependencies {
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:3.11.0"
|
||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
implementation 'com.auth0.android:jwtdecode:1.1.1'
|
||||
implementation 'com.annimon:stream:1.2.1'
|
||||
|
||||
// FloatingBarMenu
|
||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||
|
@ -8,6 +8,14 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@ -37,12 +45,10 @@
|
||||
android:label="@string/title_activity_login"
|
||||
android:launchMode="singleTask"
|
||||
android:noHistory="true" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:label="@string/title_activity_settings" />
|
||||
<activity
|
||||
android:name=".activity.SharingActivity"
|
||||
android:label="@string/title_activity_sharing" />
|
||||
|
||||
<service
|
||||
android:name=".service.BackgroundLocalizationService"
|
||||
@ -51,7 +57,6 @@
|
||||
android:enabled="true"
|
||||
/>
|
||||
|
||||
<!--<activity android:name=".activity.MapActivity" />-->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -1,36 +1,39 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public abstract class BaseActivity
|
||||
extends AppCompatActivity
|
||||
@ -38,43 +41,167 @@ public abstract class BaseActivity
|
||||
|
||||
String tag = getClass().getName();
|
||||
|
||||
protected static final int REQUEST_PERMISSIONS = 100;
|
||||
private final static int REQUEST_CODE_ASK_PERMISSIONS = 1;
|
||||
|
||||
protected BottomNavigationView navigationView;
|
||||
|
||||
protected Toolbar toolbar;
|
||||
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[] {
|
||||
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS };
|
||||
|
||||
public DrawerLayout drawerLayout;
|
||||
protected BottomNavigationView navigationView;
|
||||
protected NavigationView drawerNavigationView;
|
||||
protected DrawerLayout sideDrawer;
|
||||
protected Toolbar toolbar;
|
||||
protected boolean isTutor;
|
||||
|
||||
private ActionBarDrawerToggle actionBarDrawerToggle;
|
||||
// 4 search
|
||||
private ListView listView;
|
||||
private ArrayList<String> stringArrayList;
|
||||
private SharingFragment sharingFragment;
|
||||
|
||||
private static final int REQUEST_PERMISSIONS = 100;
|
||||
boolean boolean_permission;
|
||||
private boolean isTutor;
|
||||
|
||||
private Fragment userListFragment;
|
||||
private ActiveFragment activeFragment = ActiveFragment.NONE;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getContentViewId());
|
||||
drawerNavigationView = findViewById(R.id.nav_view);
|
||||
sideDrawer = findViewById(R.id.activity_container);
|
||||
|
||||
drawerNavigationView.setNavigationItemSelectedListener(
|
||||
item -> {
|
||||
String itemName = (String) item.getTitle();
|
||||
Intent launchIntent;
|
||||
if (itemName.equals(getResources().getString(R.string.navigation_item_whitelist))) {
|
||||
/* launchIntent = new Intent(getApplicationContext(), WhitelistActivity.class);
|
||||
startActivity(launchIntent);*/
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_blacklist))) {
|
||||
/* launchIntent = new Intent(getApplicationContext(), BlacklistActivity.class);
|
||||
startActivity(launchIntent);*/
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_profile))) {
|
||||
/* launchIntent = new Intent(getApplicationContext(), ProfileActivity.class);
|
||||
startActivity(launchIntent);*/
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_settings))) {
|
||||
launchIntent = new Intent(getApplicationContext(), SettingsActivity.class);
|
||||
startActivity(launchIntent);
|
||||
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_logout))) {
|
||||
stopBackgroundLocalizationTask();
|
||||
|
||||
PrefUtils.cleanUserLocalStorage(getApplicationContext());
|
||||
Intent i = getBaseContext().getPackageManager()
|
||||
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||
if (i != null) {
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
}
|
||||
startActivity(i);
|
||||
finish();
|
||||
|
||||
}
|
||||
|
||||
sideDrawer.closeDrawers();
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
navigationView = findViewById(R.id.navigation);
|
||||
navigationView.setOnNavigationItemSelectedListener(this);
|
||||
sharingFragment = new SharingFragment();
|
||||
userListFragment = new UsersListFragment();
|
||||
|
||||
|
||||
isTutor = PrefUtils.getIsTutor(getApplicationContext());
|
||||
if (!isTutor) {
|
||||
navigationView.findViewById(R.id.nav_profile).setVisibility(View.GONE);
|
||||
}
|
||||
checkPermissions();
|
||||
}
|
||||
|
||||
|
||||
protected void checkPermissions() {
|
||||
final List<String> missingPermissions = new ArrayList<String>();
|
||||
|
||||
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
|
||||
final int result = ContextCompat.checkSelfPermission(this, permission);
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
missingPermissions.add(permission);
|
||||
}
|
||||
}
|
||||
if (!missingPermissions.isEmpty()) {
|
||||
// request all missing permissions
|
||||
final String[] permissions = missingPermissions
|
||||
.toArray(new String[missingPermissions.size()]);
|
||||
ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE_ASK_PERMISSIONS);
|
||||
} else {
|
||||
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
|
||||
Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED);
|
||||
onRequestPermissionsResult(REQUEST_CODE_ASK_PERMISSIONS, REQUIRED_SDK_PERMISSIONS,
|
||||
grantResults);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
|
||||
@NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_ASK_PERMISSIONS:
|
||||
for (int index = permissions.length - 1; index >= 0; --index) {
|
||||
if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
|
||||
// exit the app if one permission is not granted
|
||||
Toast.makeText(this, "Required permission '" + permissions[index]
|
||||
+ "' not granted, exiting", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopBackgroundLocalizationTask() {
|
||||
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
stopIntent.putExtra("request_stop", true);
|
||||
startService(stopIntent);
|
||||
}
|
||||
|
||||
public void startBackgroundLocalizationTask() {
|
||||
if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
|
||||
|
||||
if ((ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
|
||||
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||
|
||||
},
|
||||
REQUEST_PERMISSIONS);
|
||||
}
|
||||
} else {
|
||||
|
||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(startIntent);
|
||||
} else {
|
||||
startService(startIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleBackgroundTaskLifeCycle() {
|
||||
if (PrefUtils.isEnableSharingLocalization(getApplicationContext())) {
|
||||
startBackgroundLocalizationTask();
|
||||
} else {
|
||||
stopBackgroundLocalizationTask();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(int layoutResID) {
|
||||
DrawerLayout fullView = (DrawerLayout) getLayoutInflater().inflate(R.layout.base_activity, null);
|
||||
FrameLayout activityContainer = (FrameLayout) fullView.findViewById(R.id.activity_content);
|
||||
FrameLayout activityContainer = fullView.findViewById(R.id.activity_content);
|
||||
getLayoutInflater().inflate(layoutResID, activityContainer, true);
|
||||
super.setContentView(fullView);
|
||||
|
||||
@ -82,14 +209,13 @@ public abstract class BaseActivity
|
||||
}
|
||||
|
||||
private void initToolbar() {
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
|
||||
private void setUpNav() {
|
||||
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.activity_container);
|
||||
drawerLayout = findViewById(R.id.activity_container);
|
||||
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawerLayout.addDrawerListener(actionBarDrawerToggle);
|
||||
|
||||
@ -110,39 +236,6 @@ public abstract class BaseActivity
|
||||
|
||||
actionBarDrawerToggle.syncState();
|
||||
|
||||
// if (isTutor && getContentViewId() == R.layout.activity_map) {
|
||||
if (isTutor) {
|
||||
Log.e("erororr", "taaaaaak!");
|
||||
fn_permission();
|
||||
}
|
||||
}
|
||||
|
||||
private void fn_permission() {
|
||||
if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
|
||||
|
||||
if ((ActivityCompat.shouldShowRequestPermissionRationale(BaseActivity.this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
|
||||
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(BaseActivity.this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||
|
||||
},
|
||||
REQUEST_PERMISSIONS);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isTutor) {
|
||||
Intent intent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent);
|
||||
} else {
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), "Please enable the gps", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -159,25 +252,33 @@ public abstract class BaseActivity
|
||||
final SearchView searchView = (SearchView) myActionMenuItem.getActionView();
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
public boolean onQueryTextSubmit(String input) {
|
||||
if (activeFragment.equals(ActiveFragment.USER_LIST)) {
|
||||
executeUserListSearch(input);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if (TextUtils.isEmpty(newText)) {
|
||||
//adapter.filter("");
|
||||
//listView.clearTextFilter();
|
||||
} else {
|
||||
//adapter.filter(newText);
|
||||
|
||||
public boolean onQueryTextChange(String input) {
|
||||
if (activeFragment.equals(ActiveFragment.USER_LIST)) {
|
||||
executeUserListSearch(input);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void executeUserListSearch(String input) {
|
||||
((UsersListFragment) userListFragment).searchUser(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
|
||||
@ -186,20 +287,6 @@ public abstract class BaseActivity
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
switch (requestCode) {
|
||||
case REQUEST_PERMISSIONS: {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
boolean_permission = true;
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), "Please allow the permission", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
@ -221,7 +308,7 @@ public abstract class BaseActivity
|
||||
|
||||
private void removeFragment(Fragment fragment) {
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
fragmentTransaction.remove(fragment);
|
||||
fragmentTransaction.hide(fragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
@ -231,24 +318,39 @@ public abstract class BaseActivity
|
||||
|
||||
navigationView.postDelayed(() -> {
|
||||
int itemId = item.getItemId();
|
||||
|
||||
if (itemId == R.id.nav_map) {
|
||||
removeFragment(sharingFragment);
|
||||
|
||||
// startActivity(new Intent(this, MapActivity.class));
|
||||
removeFragment(userListFragment);
|
||||
} else if (itemId == R.id.nav_profile) {
|
||||
// startActivity(new Intent(this, ProfileActivity.class));
|
||||
setFragment(sharingFragment);
|
||||
|
||||
} else if (itemId == R.id.nav_notif) {
|
||||
//startActivity(new Intent(this, NotificationsActivity.class));
|
||||
setFragment(sharingFragment);
|
||||
loadUserSettingsFragment();
|
||||
} else if (itemId == R.id.nav_user_list) {
|
||||
loadUserListFragment();
|
||||
}
|
||||
//finish();
|
||||
|
||||
}, 300);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadUserSettingsFragment() {
|
||||
activeFragment = ActiveFragment.SHARED_PREFERENCES;
|
||||
sharingFragment = SharingFragment.newInstance();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.activity_content, sharingFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
private void loadUserListFragment() {
|
||||
activeFragment = ActiveFragment.USER_LIST;
|
||||
|
||||
userListFragment = UsersListFragment.newInstance();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.activity_content, userListFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
|
||||
private void updateNavigationBarState() {
|
||||
int actionId = getNavigationMenuItemId();
|
||||
selectBottomNavigationBarItem(actionId);
|
||||
|
@ -3,33 +3,21 @@ package com.uam.wmi.findmytutor.activity;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.content.CursorLoader;
|
||||
import android.content.Intent;
|
||||
import android.content.Loader;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.auth0.android.jwt.Claim;
|
||||
import com.auth0.android.jwt.JWT;
|
||||
@ -38,407 +26,205 @@ import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.JwtToken;
|
||||
import com.uam.wmi.findmytutor.model.LdapUser;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
import com.uam.wmi.findmytutor.model.ValidateUser;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.LdapService;
|
||||
import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static android.Manifest.permission.READ_CONTACTS;
|
||||
|
||||
/**
|
||||
* A login screen that offers login via email/password.
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {
|
||||
|
||||
/**
|
||||
* Id to identity READ_CONTACTS permission request.
|
||||
*/
|
||||
private static final int REQUEST_READ_CONTACTS = 0;
|
||||
|
||||
/**
|
||||
* A dummy authentication store containing known user names and passwords.
|
||||
* TODO: remove after connecting to a real authentication system.
|
||||
*/
|
||||
private static final String[] DUMMY_CREDENTIALS = new String[]{
|
||||
"adam@o2.pl:adamadam", "foo@example.com:hello", "bar@example.com:world"
|
||||
};
|
||||
/**
|
||||
* Keep track of the login task to ensure we can cancel it if requested.
|
||||
*/
|
||||
private UserLoginTask mAuthTask = null;
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
// UI references.
|
||||
private AutoCompleteTextView mEmailView;
|
||||
private AutoCompleteTextView mLoginNameView;
|
||||
private EditText mPasswordView;
|
||||
private View mProgressView;
|
||||
private View mLoginFormView;
|
||||
private boolean loginOption;
|
||||
private LdapService ldapService;
|
||||
private UserService userService;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
// Set up the login form.
|
||||
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
|
||||
populateAutoComplete();
|
||||
mLoginNameView = findViewById(R.id.email);
|
||||
|
||||
mPasswordView = (EditText) findViewById(R.id.password);
|
||||
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
|
||||
if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) {
|
||||
attemptLogin();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
ldapService = ApiClient.getClient(getApplicationContext())
|
||||
.create(LdapService.class);
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
|
||||
Switch tutorLogin = (Switch) findViewById(R.id.tutor_login_switch);
|
||||
tutorLogin.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
loginOption = tutorLogin.isChecked();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
|
||||
mEmailSignInButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mPasswordView = findViewById(R.id.password);
|
||||
mPasswordView.setOnEditorActionListener((textView, id, keyEvent) -> {
|
||||
if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) {
|
||||
attemptLogin();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Switch tutorLogin = findViewById(R.id.tutor_login_switch);
|
||||
|
||||
tutorLogin.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
PrefUtils.storeIsTutor(getApplicationContext(), isChecked);
|
||||
});
|
||||
|
||||
Button mEmailSignInButton = findViewById(R.id.email_sign_in_button);
|
||||
mEmailSignInButton.setOnClickListener(view -> attemptLogin());
|
||||
|
||||
mLoginFormView = findViewById(R.id.login_form);
|
||||
mProgressView = findViewById(R.id.login_progress);
|
||||
}
|
||||
|
||||
private void populateAutoComplete() {
|
||||
if (!mayRequestContacts()) {
|
||||
return;
|
||||
}
|
||||
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
private boolean mayRequestContacts() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
return true;
|
||||
}
|
||||
if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
}
|
||||
if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
|
||||
Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
public void onClick(View v) {
|
||||
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback received when a permissions request has been completed.
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
if (requestCode == REQUEST_READ_CONTACTS) {
|
||||
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
populateAutoComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to sign in or register the account specified by the login form.
|
||||
* If there are form errors (invalid email, missing fields, etc.), the
|
||||
* errors are presented and no actual login attempt is made.
|
||||
*/
|
||||
private void attemptLogin() {
|
||||
if (mAuthTask != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset errors.
|
||||
mEmailView.setError(null);
|
||||
mLoginNameView.setError(null);
|
||||
mPasswordView.setError(null);
|
||||
|
||||
// Store values at the time of the login attempt.
|
||||
String email = mEmailView.getText().toString();
|
||||
String loginName = mLoginNameView.getText().toString();
|
||||
String password = mPasswordView.getText().toString();
|
||||
|
||||
boolean cancel = false;
|
||||
View focusView = null;
|
||||
|
||||
// Check for a valid password, if the user entered one.
|
||||
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
|
||||
mPasswordView.setError(getString(R.string.error_invalid_password));
|
||||
// Check for a valid email address.
|
||||
if (TextUtils.isEmpty(loginName)) {
|
||||
mLoginNameView.setError(getString(R.string.error_field_required));
|
||||
focusView = mLoginNameView;
|
||||
cancel = true;
|
||||
} else if (!isEmailValid(loginName)) {
|
||||
mLoginNameView.setError(getString(R.string.error_invalid_login_name));
|
||||
focusView = mLoginNameView;
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
// Check for a valid password address.
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
mPasswordView.setError(getString(R.string.error_field_required));
|
||||
focusView = mPasswordView;
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
// Check for a valid email address.
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
mEmailView.setError(getString(R.string.error_field_required));
|
||||
focusView = mEmailView;
|
||||
cancel = true;
|
||||
} else if (!isEmailValid(email)) {
|
||||
mEmailView.setError(getString(R.string.error_invalid_email));
|
||||
focusView = mEmailView;
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
if (cancel) {
|
||||
// There was an error; don't attempt login and focus the first
|
||||
// form field with an error.
|
||||
focusView.requestFocus();
|
||||
} else {
|
||||
// Show a progress spinner, and kick off a background task to
|
||||
// perform the user login attempt.
|
||||
showProgress(true);
|
||||
mAuthTask = new UserLoginTask(email, password, loginOption);
|
||||
mAuthTask.execute((Void) null);
|
||||
loginProcess(loginName, password);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmailValid(String email) {
|
||||
//TODO: Replace this with your own logic
|
||||
return email.contains("@");
|
||||
private boolean isEmailValid(String loginName) {
|
||||
Pattern pattern = Pattern.compile("\\s");
|
||||
Matcher matcher = pattern.matcher(loginName);
|
||||
return !matcher.find();
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
//TODO: Replace this with your own logic
|
||||
return password.length() > 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the progress UI and hides the login form.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
private void showProgress(final boolean show) {
|
||||
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
||||
// for very easy animations. If available, use these APIs to fade-in
|
||||
// the progress spinner.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
||||
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
mProgressView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The ViewPropertyAnimator APIs are not available, so simply show
|
||||
// and hide the relevant UI components.
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
return new CursorLoader(this,
|
||||
// Retrieve data rows for the device user's 'profile' contact.
|
||||
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
|
||||
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
|
||||
|
||||
// Select only email addresses.
|
||||
ContactsContract.Contacts.Data.MIMETYPE +
|
||||
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
|
||||
.CONTENT_ITEM_TYPE},
|
||||
|
||||
// Show primary email addresses first. Note that there won't be
|
||||
// a primary email address if the user hasn't specified one.
|
||||
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
|
||||
List<String> emails = new ArrayList<>();
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
emails.add(cursor.getString(ProfileQuery.ADDRESS));
|
||||
cursor.moveToNext();
|
||||
}
|
||||
|
||||
addEmailsToAutoComplete(emails);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> cursorLoader) {
|
||||
|
||||
}
|
||||
|
||||
private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
|
||||
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<>(LoginActivity.this,
|
||||
android.R.layout.simple_dropdown_item_1line, emailAddressCollection);
|
||||
|
||||
mEmailView.setAdapter(adapter);
|
||||
}
|
||||
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
|
||||
private interface ProfileQuery {
|
||||
String[] PROJECTION = {
|
||||
ContactsContract.CommonDataKinds.Email.ADDRESS,
|
||||
ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
|
||||
};
|
||||
|
||||
int ADDRESS = 0;
|
||||
int IS_PRIMARY = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an asynchronous login/registration task used to authenticate
|
||||
* the user.
|
||||
*/
|
||||
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private final String mEmail;
|
||||
private final String mPassword;
|
||||
private boolean isTutor;
|
||||
private LdapService ldapService;
|
||||
private UserService userService;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private Boolean isAuthorizate;
|
||||
|
||||
// Constructor
|
||||
UserLoginTask(String email, String password, Boolean loginOption) {
|
||||
mEmail = email;
|
||||
mPassword = password;
|
||||
isTutor = loginOption;
|
||||
isAuthorizate = false;
|
||||
ldapService = ApiClient.getClient(getApplicationContext())
|
||||
.create(LdapService.class);
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
|
||||
PrefUtils.storeIsTutor(getApplicationContext(), this.isTutor);
|
||||
}
|
||||
|
||||
private void saveUserProfileToSharedPreferences(User user){
|
||||
PrefUtils.storeUserFirstName(getApplicationContext(), user.getFirstName());
|
||||
PrefUtils.storeUserLastName(getApplicationContext(), user.getLastName());
|
||||
PrefUtils.storeUserName(getApplicationContext(), user.getUserName());
|
||||
}
|
||||
|
||||
private void getUserProfile(String userId) {
|
||||
disposable.add(
|
||||
userService
|
||||
.getUserByID(userId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeWith(new DisposableSingleObserver<User>() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
Log.e("USER", String.valueOf(user));
|
||||
saveUserProfileToSharedPreferences(user);
|
||||
|
||||
onPostExecute(true);
|
||||
}
|
||||
|
||||
public void onError(Throwable e) {
|
||||
((HttpException) e).code();
|
||||
Log.e("Login onError", e.getMessage());
|
||||
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
Log.e("Login onError", RestApiHelper.getErrorMessage(responseBody));
|
||||
}
|
||||
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
LdapUser user = new LdapUser(mEmail, mPassword, "admin", (isTutor) ? "Tutor" : "Student", "string", "string", mEmail);
|
||||
|
||||
disposable.add(
|
||||
ldapService
|
||||
.fakeValidate(user)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeWith(new DisposableSingleObserver<JwtToken>() {
|
||||
@Override
|
||||
public void onSuccess(JwtToken jwtToken) {
|
||||
String token = jwtToken.getToken();
|
||||
|
||||
JWT jwt = new JWT(token);
|
||||
Claim role = jwt.getClaim("nameid");
|
||||
|
||||
PrefUtils.storeIsLoggedIn(getApplicationContext(), true);
|
||||
PrefUtils.storeApiKey(getApplicationContext(), token);
|
||||
PrefUtils.storeUserId(getApplicationContext(), role.asString());
|
||||
|
||||
getUserProfile(role.asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("LoginError", "onError: " + e.getMessage());
|
||||
}
|
||||
}));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(final Boolean success) {
|
||||
mAuthTask = null;
|
||||
showProgress(false);
|
||||
|
||||
if (success) {
|
||||
Intent data = new Intent();
|
||||
String txt = "Main Activity";
|
||||
data.setData(Uri.parse(txt));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
} else {
|
||||
mPasswordView.setError(getString(R.string.error_incorrect_password));
|
||||
mPasswordView.requestFocus();
|
||||
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
mProgressView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
mAuthTask = null;
|
||||
showProgress(false);
|
||||
}
|
||||
|
||||
|
||||
private void loginProcess(String email, String password) {
|
||||
Log.e("LOGIN", String.valueOf(PrefUtils.getIsTutor(getApplicationContext())));
|
||||
|
||||
//Fake validate
|
||||
LdapUser user = new LdapUser(email, password, "admin", (PrefUtils.getIsTutor(getApplicationContext())) ? "Tutor" : "Student", "string", "string", email);
|
||||
|
||||
// ValidateUser user = new ValidateUser(email, password);
|
||||
|
||||
// LDAP logging
|
||||
// disposable.add(ldapService.validate(user)
|
||||
|
||||
disposable.add(ldapService.fakeValidate(user)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleResponse, this::handleError));
|
||||
}
|
||||
|
||||
private void getUserProfile(String userId) {
|
||||
|
||||
disposable.add(userService.getUserByID(userId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::saveUserProfileToSharedPreferences, this::handleError));
|
||||
}
|
||||
|
||||
private void showSnackBarMessage(String message) {
|
||||
Snackbar.make(findViewById(R.id.login_form), message, Snackbar.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void handleResponse(JwtToken jwtToken) {
|
||||
showProgress(false);
|
||||
|
||||
String token = jwtToken.getToken();
|
||||
JWT jwt = new JWT(token);
|
||||
Claim role = jwt.getClaim("nameid");
|
||||
|
||||
PrefUtils.storeIsLoggedIn(getApplicationContext(), true);
|
||||
PrefUtils.storeApiKey(getApplicationContext(), token);
|
||||
PrefUtils.storeUserId(getApplicationContext(), role.asString());
|
||||
|
||||
getUserProfile(role.asString());
|
||||
|
||||
Intent data = new Intent();
|
||||
String txt = "Main Activity";
|
||||
data.setData(Uri.parse(txt));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void handleError(Throwable error) {
|
||||
showProgress(false);
|
||||
|
||||
if (error instanceof HttpException) {
|
||||
|
||||
ResponseBody responseBody = ((HttpException) error).response().errorBody();
|
||||
showSnackBarMessage(RestApiHelper.getErrorMessage(responseBody));
|
||||
|
||||
} else {
|
||||
showSnackBarMessage("Network Error !");
|
||||
}
|
||||
}
|
||||
|
||||
private void saveUserProfileToSharedPreferences(User user) {
|
||||
PrefUtils.storeUserFirstName(getApplicationContext(), user.getFirstName());
|
||||
PrefUtils.storeUserLastName(getApplicationContext(), user.getLastName());
|
||||
PrefUtils.storeUserName(getApplicationContext(), user.getUserName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,14 @@ import android.os.Handler;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
@ -57,6 +64,7 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.service.CoordinateService;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
@ -71,6 +79,7 @@ import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
import timber.log.Timber;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class MapActivity extends BaseActivity
|
||||
@ -99,11 +108,12 @@ public class MapActivity extends BaseActivity
|
||||
private int bearingParam = 180;
|
||||
private int tiltParam = 30;
|
||||
|
||||
Locale myLocale;
|
||||
String currentLanguage = "pl", currentLang;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
configureLogoutButton();
|
||||
|
||||
final SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE);
|
||||
final String authToken = sharedPref.getString("authToken", null);
|
||||
@ -121,13 +131,23 @@ public class MapActivity extends BaseActivity
|
||||
}
|
||||
};
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
|
||||
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||
mapView = findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(this);
|
||||
|
||||
//start background task
|
||||
startBackgroundLocalizationTask();
|
||||
|
||||
currentLanguage = getIntent().getStringExtra(currentLang);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onMapReady(MapboxMap mapboxMap) {
|
||||
MapActivity.this.mapboxMap = mapboxMap;
|
||||
@ -395,22 +415,6 @@ public class MapActivity extends BaseActivity
|
||||
);
|
||||
}
|
||||
|
||||
private void configureLogoutButton() {
|
||||
// Logout button
|
||||
final FloatingActionButton button = findViewById(R.id.logoutButton);
|
||||
|
||||
button.setOnClickListener(view -> {
|
||||
PrefUtils.cleanUserLocalStorage(getApplicationContext());
|
||||
|
||||
Intent i = getBaseContext().getPackageManager()
|
||||
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||
if (i != null) {
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
}
|
||||
startActivity(i);
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
// Add the mapView lifecycle to the activity's lifecycle methods
|
||||
@Override
|
||||
@ -525,7 +529,7 @@ public class MapActivity extends BaseActivity
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @android.support.annotation.NonNull String[] permissions, @android.support.annotation.NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
// permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,52 +1,75 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
private static final String TAG = SettingsActivity.class.getSimpleName();
|
||||
|
||||
String currentLang;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// load settings fragment
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
|
||||
}
|
||||
|
||||
public void setLocale(String localeName) {
|
||||
Locale myLocale = new Locale(localeName);
|
||||
Resources res = getResources();
|
||||
DisplayMetrics dm = res.getDisplayMetrics();
|
||||
Configuration conf = res.getConfiguration();
|
||||
conf.locale = myLocale;
|
||||
res.updateConfiguration(conf, dm);
|
||||
Intent refresh = new Intent(this, MapActivity.class);
|
||||
refresh.putExtra(currentLang, localeName);
|
||||
startActivity(refresh);
|
||||
}
|
||||
|
||||
public static class MainPreferenceFragment extends PreferenceFragment {
|
||||
@SuppressLint("ResourceType")
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.layout.pref_main);
|
||||
|
||||
//TODO add on change listeners for preferences
|
||||
Preference languagesList = findPreference(getResources().getString(R.string.key_language));
|
||||
|
||||
// feedback preference click listener
|
||||
Preference myPref = findPreference(getString(R.string.key_send_feedback));
|
||||
myPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
sendFeedback(getActivity());
|
||||
return true;
|
||||
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
|
||||
if (!newValue.toString().equals("0")){
|
||||
((SettingsActivity)getActivity()).setLocale("pl");
|
||||
PrefUtils.storeLocale(getActivity(),"pl");
|
||||
}else{
|
||||
((SettingsActivity)getActivity()).setLocale("en");
|
||||
PrefUtils.storeLocale(getActivity(),"en");
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
@ -96,26 +119,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Email client intent to send support mail
|
||||
* Appends the necessary device information to email body
|
||||
* useful when providing support
|
||||
*/
|
||||
public static void sendFeedback(Context context) {
|
||||
String body = null;
|
||||
try {
|
||||
body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
|
||||
Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
|
||||
"\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("message/rfc822");
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"});
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, body);
|
||||
context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,122 +0,0 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
|
||||
public class SharingActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
|
||||
}
|
||||
|
||||
public static class MainPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.layout.pref_sharing);
|
||||
|
||||
Preference manualStatus = findPreference("key_manual_status");
|
||||
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ListPreference lp = (ListPreference) findPreference("key_status_value");
|
||||
updateListPreference(lp, newValue, "manual_statuses");
|
||||
return true;
|
||||
});
|
||||
|
||||
/* Preference manualLocation = findPreference("key_sharing_enabled");
|
||||
manualLocation.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ListPreference lp = (ListPreference) findPreference("key_sharing_enabled");
|
||||
updateListPreference(lp, newValue, "sharing_enabled");
|
||||
return true;
|
||||
});*/
|
||||
|
||||
Preference sharingLocation = findPreference("key_sharing_enabled");
|
||||
sharingLocation.setOnPreferenceChangeListener((preference, o) -> {
|
||||
Log.e("change", "1");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void updateListPreference(ListPreference lp,Object newValue,String storageKey){
|
||||
CharSequence [] entries = lp.getEntries();
|
||||
Set <String> defaultEntries = new HashSet(Arrays.asList(entries));
|
||||
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
|
||||
Set <String> manualStatusSet = sharedPref.getStringSet(storageKey,defaultEntries);
|
||||
manualStatusSet.add((String) newValue);
|
||||
String [] manualStatusArr = manualStatusSet.toArray(new String[0]);
|
||||
Arrays.sort(manualStatusArr);
|
||||
setListPreferenceData(lp.getKey(),manualStatusArr);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putStringSet(storageKey,manualStatusSet);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
protected ListPreference setListPreferenceData(String lp_name, String [] entries) {
|
||||
ListPreference lp = (ListPreference) findPreference(lp_name);
|
||||
lp.setEntries(entries);
|
||||
CharSequence[] entryValues = new CharSequence [entries.length];
|
||||
|
||||
for (int i = 0; i < entries.length; i++){
|
||||
entryValues[i] = Integer.toString(i+1);
|
||||
}
|
||||
|
||||
lp.setDefaultValue("1");
|
||||
lp.setEntryValues(entryValues);
|
||||
|
||||
return lp;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email client intent to send support mail
|
||||
* Appends the necessary device information to email body
|
||||
* useful when providing support
|
||||
*/
|
||||
/* public static void sendFeedback(Context context) {
|
||||
String body = null;
|
||||
try {
|
||||
body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
|
||||
Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
|
||||
"\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("message/rfc822");
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"});
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, body);
|
||||
context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
|
||||
}*/
|
||||
}
|
@ -1,7 +1,11 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
@ -12,44 +16,50 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
//public class SharingFragment {
|
||||
//}
|
||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||
|
||||
|
||||
public class SharingFragment extends PreferenceFragment {
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.layout.pref_sharing);
|
||||
Preference manualStatus = findPreference("key_manual_status");
|
||||
Preference locationSharing = findPreference("key_sharing_enabled");
|
||||
|
||||
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ListPreference lp = (ListPreference) findPreference("key_status_value");
|
||||
updateListPreference(lp, newValue, "manual_statuses");
|
||||
return true;
|
||||
});
|
||||
|
||||
/* Preference manualLocation = findPreference("key_sharing_enabled");
|
||||
manualLocation.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ListPreference lp = (ListPreference) findPreference("key_sharing_enabled");
|
||||
updateListPreference(lp, newValue, "sharing_enabled");
|
||||
return true;
|
||||
});*/
|
||||
locationSharing.setOnPreferenceChangeListener((buttonView, isChecked) -> {
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) isChecked);
|
||||
((MapActivity)getActivity()).handleBackgroundTaskLifeCycle();
|
||||
|
||||
Preference sharingLocation = findPreference("key_sharing_enabled");
|
||||
sharingLocation.setOnPreferenceChangeListener((preference, o) -> {
|
||||
Log.e("change", "1");
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
public static SharingFragment newInstance() {
|
||||
return new SharingFragment();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
view.setBackgroundColor(getResources().getColor(android.R.color.white));
|
||||
Objects.requireNonNull(view).setBackgroundColor(getResources().getColor(android.R.color.white));
|
||||
|
||||
return view;
|
||||
}
|
||||
@ -65,10 +75,10 @@ public class SharingFragment extends PreferenceFragment {
|
||||
setListPreferenceData(lp.getKey(),manualStatusArr);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putStringSet(storageKey,manualStatusSet);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
protected ListPreference setListPreferenceData(String lp_name, String [] entries) {
|
||||
protected void setListPreferenceData(String lp_name, String [] entries) {
|
||||
ListPreference lp = (ListPreference) findPreference(lp_name);
|
||||
lp.setEntries(entries);
|
||||
CharSequence[] entryValues = new CharSequence [entries.length];
|
||||
@ -79,7 +89,5 @@ public class SharingFragment extends PreferenceFragment {
|
||||
|
||||
lp.setDefaultValue("1");
|
||||
lp.setEntryValues(entryValues);
|
||||
|
||||
return lp;
|
||||
}
|
||||
}
|
||||
|
@ -2,20 +2,28 @@ package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class StartupActivity extends AppCompatActivity {
|
||||
private static final int AUTHENTICATION_REQUEST_CODE = 666;
|
||||
String currentLang;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
if (PrefUtils.isLoggedIn(getApplicationContext())){
|
||||
Intent startupIntent = new Intent(this, MapActivity.class);
|
||||
startupIntent.putExtra(currentLang, PrefUtils.getLocale(getApplicationContext()));
|
||||
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(startupIntent);
|
||||
finish();
|
||||
@ -38,4 +46,8 @@ public class StartupActivity extends AppCompatActivity {
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,264 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||
|
||||
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
||||
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
||||
import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||
|
||||
public class UsersListFragment extends Fragment {
|
||||
private static final String TAG = UsersListFragment.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.coordinator_layout)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.txt_empty_notes_view)
|
||||
TextView noNotesView;
|
||||
|
||||
private UserService userService;
|
||||
private TutorTabApi tutorTabService;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private TutorsListAdapter mAdapter;
|
||||
private List<User> tutorsList = new ArrayList<>();
|
||||
private List<User> tutorsFiltered = new ArrayList<>();
|
||||
|
||||
public UsersListFragment() {
|
||||
}
|
||||
|
||||
public static UsersListFragment newInstance() {
|
||||
return new UsersListFragment();
|
||||
}
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
mAdapter = new TutorsListAdapter(getActivity().getApplicationContext(), tutorsFiltered);
|
||||
View view = inflater.inflate(R.layout.users_list, container, false);
|
||||
view.setBackgroundColor(getResources().getColor(android.R.color.white));
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
|
||||
tutorTabService = ApiClient.getClient(getActivity().getApplicationContext())
|
||||
.create(TutorTabApi.class);
|
||||
|
||||
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
|
||||
recyclerView.setLayoutManager(mLayoutManager);
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL, 16));
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
fetchAllTutors();
|
||||
|
||||
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getActivity().getApplicationContext(),
|
||||
recyclerView, new RecyclerTouchListener.ClickListener() {
|
||||
@Override
|
||||
public void onClick(View view, final int position) {
|
||||
showNoteDialog(tutorsFiltered.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongClick(View view, int position) {
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void searchUser(String textToSearch) {
|
||||
tutorsFiltered.clear();
|
||||
tutorsFiltered.addAll(Stream.of(tutorsList).filter(t ->
|
||||
t.toSearchAbleString().toLowerCase().contains(textToSearch.toLowerCase())).toList());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void showNoteDialog(final User user) {
|
||||
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity().getApplicationContext());
|
||||
View view = layoutInflaterAndroid.inflate(R.layout.user_list_modal, null);
|
||||
|
||||
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(getActivity());
|
||||
alertDialogBuilderUserInput.setView(view);
|
||||
|
||||
alertDialogBuilderUserInput.setNegativeButton(R.string.cancel, (dialog, id) -> {
|
||||
// User cancelled the dialog
|
||||
});
|
||||
|
||||
TextView userName = view.findViewById(R.id.userName);
|
||||
ListView userDutyHours = view.findViewById(R.id.userDutyHours);
|
||||
TextView userDutyHoursTitle = view.findViewById(R.id.userDutyHoursTitle);
|
||||
TextView userNote = view.findViewById(R.id.userNote);
|
||||
TextView userRoom = view.findViewById(R.id.userRoom);
|
||||
TextView userEmail = view.findViewById(R.id.userEmail);
|
||||
TextView department = view.findViewById(R.id.userDepartment);
|
||||
|
||||
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
||||
|
||||
disposable.add(
|
||||
tutorTabService.apiUsersTutorTabByTutorIdGet(user.getId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
||||
@Override
|
||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
||||
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
||||
.map(DutyHourViewModel::getSummary).toList();
|
||||
|
||||
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
|
||||
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
|
||||
userNote.setText(String.format("%s: %s", getString(R.string.userNote), tutorTabViewModel.getNote()));
|
||||
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
|
||||
userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
|
||||
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(),
|
||||
android.R.layout.test_list_item, dutyHoursList);
|
||||
|
||||
userDutyHours.setAdapter(arrayAdapter);
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
showError(e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private void fetchAllTutors() {
|
||||
disposable.add(
|
||||
userService.apiUsersGet()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map(tutors -> {
|
||||
List<User> tutorsList = new ArrayList<>(tutors);
|
||||
|
||||
List<User> onlineTutors = Stream.of(tutorsList).filter(User::isIsOnline).toList();
|
||||
|
||||
List<User> activeNotOnlineTutors = Stream.of(tutorsList)
|
||||
.filter(t -> t.isIsActive() && !onlineTutors.contains(t)).toList();
|
||||
|
||||
List<User> notActiveTutors = Stream.of(tutorsList)
|
||||
.filterNot(User::isIsActive).toList();
|
||||
|
||||
Collections.sort(onlineTutors, this::sortByUserName);
|
||||
Collections.sort(activeNotOnlineTutors, this::sortByUserName);
|
||||
Collections.sort(notActiveTutors, this::sortByUserName);
|
||||
|
||||
List<User> sortedUserList = new ArrayList<>(onlineTutors);
|
||||
sortedUserList.addAll(activeNotOnlineTutors);
|
||||
sortedUserList.addAll(notActiveTutors);
|
||||
|
||||
return sortedUserList;
|
||||
})
|
||||
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
||||
@Override
|
||||
public void onSuccess(List<User> users) {
|
||||
tutorsList.clear();
|
||||
tutorsList.addAll(users);
|
||||
tutorsFiltered.addAll(users);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
toggleEmptyNotes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
showError(e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private int sortByUserName(User t1, User t2) {
|
||||
return t1.getFirstName().compareTo(t2.getFirstName());
|
||||
}
|
||||
|
||||
private void showError(Throwable e) {
|
||||
String message = e.toString();
|
||||
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
message = RestApiHelper.getErrorMessage(responseBody);
|
||||
}
|
||||
|
||||
Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void toggleEmptyNotes() {
|
||||
if (tutorsList.size() > 0) {
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
} else {
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
fetchAllTutors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.uam.wmi.findmytutor.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
|
||||
public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.MyViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private List<User> tutorsList;
|
||||
|
||||
public TutorsListAdapter(Context context, List<User> tutors) {
|
||||
this.context = context;
|
||||
this.tutorsList = tutors;
|
||||
}
|
||||
|
||||
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.firstName)
|
||||
TextView firstName;
|
||||
|
||||
@BindView(R.id.lastName)
|
||||
TextView lastName;
|
||||
|
||||
@BindView(R.id.isOnline)
|
||||
TextView isOnline;
|
||||
|
||||
MyViewHolder(View view) {
|
||||
super(view);
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.tutor_list_row, parent, false);
|
||||
|
||||
return new MyViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
Drawable image = null;
|
||||
User tutor = tutorsList.get(position);
|
||||
|
||||
holder.firstName.setText(tutor.getFirstName());
|
||||
holder.lastName.setText(tutor.getLastName());
|
||||
|
||||
if(tutor.isIsOnline()) {
|
||||
image = context.getResources().getDrawable(R.drawable.online_user);
|
||||
} else {
|
||||
image = context.getResources().getDrawable(R.drawable.not_online);
|
||||
}
|
||||
|
||||
if(!tutor.isIsActive()){
|
||||
image = context.getResources().getDrawable(R.drawable.not_active_user);
|
||||
}
|
||||
|
||||
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
||||
holder.isOnline.setCompoundDrawables(image, null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return tutorsList.size();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
* DutyHourViewModel
|
||||
*/
|
||||
|
||||
public class DutyHourViewModel {
|
||||
@SerializedName("day")
|
||||
private String day = null;
|
||||
|
||||
@SerializedName("start")
|
||||
private String start = null;
|
||||
|
||||
@SerializedName("end")
|
||||
private String end = null;
|
||||
|
||||
public DutyHourViewModel 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 DutyHourViewModel 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 DutyHourViewModel 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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DutyHourViewModel dutyHourViewModel = (DutyHourViewModel) o;
|
||||
return Objects.equals(this.day, dutyHourViewModel.day) &&
|
||||
Objects.equals(this.start, dutyHourViewModel.start) &&
|
||||
Objects.equals(this.end, dutyHourViewModel.end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(day, start, end);
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return this.getDay() + " " + this.getStart() + " " + this.getEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class DutyHourViewModel {\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("}");
|
||||
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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
* LdapUser
|
||||
*/
|
||||
|
||||
public class LdapUser extends BaseResponse{
|
||||
public class LdapUser extends BaseResponse {
|
||||
@SerializedName("login")
|
||||
private String login = null;
|
||||
|
||||
@ -198,7 +198,7 @@ public class LdapUser extends BaseResponse{
|
||||
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");
|
||||
|
@ -1,3 +1,4 @@
|
||||
/*
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
|
||||
@ -14,3 +15,4 @@ public class Model
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
@ -9,7 +10,7 @@ public class PagedResult {
|
||||
|
||||
@SerializedName("results")
|
||||
@Expose
|
||||
private List<User> results = null;
|
||||
private List<ReturnedTutors> results = null;
|
||||
@SerializedName("currentPage")
|
||||
@Expose
|
||||
private Integer currentPage;
|
||||
@ -29,11 +30,11 @@ public class PagedResult {
|
||||
@Expose
|
||||
private Integer lastRowOnPage;
|
||||
|
||||
public List<User> getResults() {
|
||||
public List<ReturnedTutors> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<User> results) {
|
||||
public void setResults(List<ReturnedTutors> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
@ -86,3 +87,15 @@ public class PagedResult {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.uam.wmi.findmytutor.model.Results;
|
||||
|
||||
public class PagedResultReturnedTutors extends BaseResponse{
|
||||
|
||||
@SerializedName("results")
|
||||
@Expose
|
||||
private Results results;
|
||||
@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 Results getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(Results 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -14,24 +15,31 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class PagedResultUserResponseModel extends BaseResponse {
|
||||
@SerializedName("results")
|
||||
@Expose
|
||||
private List<UserResponseModel> results = null;
|
||||
|
||||
@SerializedName("currentPage")
|
||||
@Expose
|
||||
private Integer currentPage = null;
|
||||
|
||||
@SerializedName("pageCount")
|
||||
@Expose
|
||||
private Integer pageCount = null;
|
||||
|
||||
@SerializedName("pageSize")
|
||||
@Expose
|
||||
private Integer pageSize = null;
|
||||
|
||||
@SerializedName("rowCount")
|
||||
@Expose
|
||||
private Integer rowCount = null;
|
||||
|
||||
@SerializedName("firstRowOnPage")
|
||||
@Expose
|
||||
private Integer firstRowOnPage = null;
|
||||
|
||||
@SerializedName("lastRowOnPage")
|
||||
@Expose
|
||||
private Integer lastRowOnPage = null;
|
||||
|
||||
public PagedResultUserResponseModel results(List<UserResponseModel> results) {
|
||||
|
33
app/src/main/java/com/uam/wmi/findmytutor/model/Results.java
Normal file
33
app/src/main/java/com/uam/wmi/findmytutor/model/Results.java
Normal file
@ -0,0 +1,33 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Results extends BaseResponse {
|
||||
|
||||
@SerializedName("tutors")
|
||||
@Expose
|
||||
private List<Tutor> tutors = null;
|
||||
@SerializedName("blacklistersTutors")
|
||||
@Expose
|
||||
private List<Object> blacklistersTutors = null;
|
||||
|
||||
public List<Tutor> getTutors() {
|
||||
return tutors;
|
||||
}
|
||||
|
||||
public void setTutors(List<Tutor> tutors) {
|
||||
this.tutors = tutors;
|
||||
}
|
||||
|
||||
public List<Object> getBlacklistersTutors() {
|
||||
return blacklistersTutors;
|
||||
}
|
||||
|
||||
public void setBlacklistersTutors(List<Object> blacklistersTutors) {
|
||||
this.blacklistersTutors = blacklistersTutors;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class ReturnedTutors {
|
||||
|
||||
@SerializedName("id")
|
||||
@Expose
|
||||
private String id;
|
||||
@SerializedName("isOnline")
|
||||
@Expose
|
||||
private Boolean isOnline;
|
||||
@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 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;
|
||||
}
|
||||
|
||||
}
|
109
app/src/main/java/com/uam/wmi/findmytutor/model/Tutor.java
Normal file
109
app/src/main/java/com/uam/wmi/findmytutor/model/Tutor.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Tutor {
|
||||
|
||||
@SerializedName("id")
|
||||
@Expose
|
||||
private String id;
|
||||
@SerializedName("isOnline")
|
||||
@Expose
|
||||
private Boolean isOnline;
|
||||
@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 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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* TutorTabViewModel
|
||||
*/
|
||||
|
||||
public class TutorTabViewModel {
|
||||
@SerializedName("tutorTabId")
|
||||
private UUID tutorTabId = null;
|
||||
|
||||
@SerializedName("userId")
|
||||
private String userId = null;
|
||||
|
||||
@SerializedName("room")
|
||||
private String room = "";
|
||||
|
||||
@SerializedName("emailTutorTab")
|
||||
private String emailTutorTab = "";
|
||||
|
||||
@SerializedName("note")
|
||||
private String note = "";
|
||||
|
||||
@SerializedName("dutyHours")
|
||||
private List<DutyHourViewModel> dutyHours = null;
|
||||
|
||||
public TutorTabViewModel 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 TutorTabViewModel userId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userId
|
||||
* @return userId
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public TutorTabViewModel 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 TutorTabViewModel 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 TutorTabViewModel note(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getNote() {
|
||||
if(note == null)
|
||||
return "";
|
||||
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public TutorTabViewModel dutyHours(List<DutyHourViewModel> dutyHours) {
|
||||
this.dutyHours = dutyHours;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TutorTabViewModel addDutyHoursItem(DutyHourViewModel dutyHoursItem) {
|
||||
if (this.dutyHours == null) {
|
||||
this.dutyHours = new ArrayList<DutyHourViewModel>();
|
||||
}
|
||||
this.dutyHours.add(dutyHoursItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dutyHours
|
||||
* @return dutyHours
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<DutyHourViewModel> getDutyHours() {
|
||||
return dutyHours;
|
||||
}
|
||||
|
||||
public void setDutyHours(List<DutyHourViewModel> dutyHours) {
|
||||
this.dutyHours = dutyHours;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TutorTabViewModel tutorTabViewModel = (TutorTabViewModel) o;
|
||||
return Objects.equals(this.tutorTabId, tutorTabViewModel.tutorTabId) &&
|
||||
Objects.equals(this.userId, tutorTabViewModel.userId) &&
|
||||
Objects.equals(this.room, tutorTabViewModel.room) &&
|
||||
Objects.equals(this.emailTutorTab, tutorTabViewModel.emailTutorTab) &&
|
||||
Objects.equals(this.note, tutorTabViewModel.note) &&
|
||||
Objects.equals(this.dutyHours, tutorTabViewModel.dutyHours);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(tutorTabId, userId, room, emailTutorTab, note, dutyHours);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TutorTabViewModel {\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(" note: ").append(toIndentedString(note)).append("\n");
|
||||
sb.append(" dutyHours: ").append(toIndentedString(dutyHours)).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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,94 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
* ValidateUser
|
||||
*/
|
||||
|
||||
public class ValidateUser extends BaseResponse {
|
||||
@SerializedName("login")
|
||||
private String login = null;
|
||||
|
||||
@SerializedName("password")
|
||||
private String password = null;;
|
||||
|
||||
public ValidateUser(String login, String password) {
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public ValidateUser 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 ValidateUser password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ValidateUser ValidateUser = (ValidateUser) o;
|
||||
return Objects.equals(this.login, ValidateUser.login) &&
|
||||
Objects.equals(this.password, ValidateUser.password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(login, password);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ValidateUser {\n");
|
||||
|
||||
sb.append(" login: ").append(toIndentedString(login)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public class ApiClient {
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.client(okHttpClient)
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
return retrofit;
|
||||
@ -59,6 +59,7 @@ public class ApiClient {
|
||||
.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))) {
|
||||
|
@ -51,4 +51,5 @@ public class RetrofitClientInstance {
|
||||
}
|
||||
return retrofit.create(serviceClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,21 +6,23 @@ import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.content.Context;
|
||||
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||
@ -28,16 +30,8 @@ import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
@ -48,64 +42,22 @@ import timber.log.Timber;
|
||||
|
||||
public class BackgroundLocalizationService extends Service {
|
||||
|
||||
public static String str_receiver = "background.location.broadcast";
|
||||
private static final String TAG = "MyLocationService";
|
||||
private LocationManager mLocationManager = null;
|
||||
private static final int LOCATION_INTERVAL = 1000;
|
||||
private static final float LOCATION_DISTANCE = 10f;
|
||||
private static final float LOCATION_DISTANCE = 5f;
|
||||
public static String str_receiver = "background.location.broadcast";
|
||||
private static long notify_interval = 10000;
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
Location mLastLocation;
|
||||
Intent intent;
|
||||
|
||||
ArrayList<String> providers = new ArrayList<String>();
|
||||
LocationListener[] mLocationListeners ;
|
||||
LocationListener[] mLocationListeners;
|
||||
|
||||
private class LocationListener implements android.location.LocationListener {
|
||||
private LocationManager mLocationManager = null;
|
||||
private Handler mHandler = new Handler();
|
||||
private HandlerThread mHandlerThread = null;
|
||||
private Runnable mStatusChecker;
|
||||
|
||||
public LocationListener(String provider) {
|
||||
Log.e(TAG, "LocationListener " + provider);
|
||||
mLastLocation = new Location(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
Log.e(TAG, "onLocationChanged: " + location);
|
||||
mLastLocation.set(location);
|
||||
fn_update(mLastLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
Log.e(TAG, "onProviderDisabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
Log.e(TAG, "onProviderEnabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
Log.e(TAG, "onStatusChanged: " + provider);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand");
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
public BackgroundLocalizationService(){
|
||||
public BackgroundLocalizationService() {
|
||||
providers.add(LocationManager.GPS_PROVIDER);
|
||||
providers.add(LocationManager.NETWORK_PROVIDER);
|
||||
providers.add(LocationManager.PASSIVE_PROVIDER);
|
||||
@ -117,10 +69,36 @@ public class BackgroundLocalizationService extends Service {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand");
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
//call startForeground first
|
||||
boolean stopService = false;
|
||||
|
||||
if (intent != null) {
|
||||
stopService = intent.getBooleanExtra("request_stop", false);
|
||||
}
|
||||
if (stopService) {
|
||||
stopForeground(true);
|
||||
stopSelf();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.e(TAG, "onCreate");
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
startMyOwnForeground();
|
||||
else {
|
||||
@ -141,6 +119,7 @@ public class BackgroundLocalizationService extends Service {
|
||||
LOCATION_DISTANCE,
|
||||
listener
|
||||
);
|
||||
|
||||
} catch (java.lang.SecurityException ex) {
|
||||
Log.i(TAG, "fail to request location update, ignore", ex);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
@ -150,11 +129,15 @@ public class BackgroundLocalizationService extends Service {
|
||||
providerIndex++;
|
||||
}
|
||||
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new TimerTaskToGetLocation(), 5, notify_interval);
|
||||
intent = new Intent(str_receiver);
|
||||
mStatusChecker = () -> {
|
||||
try {
|
||||
fn_getlocation();
|
||||
} finally {
|
||||
mHandler.postDelayed(mStatusChecker, notify_interval);
|
||||
}
|
||||
};
|
||||
|
||||
fn_getlocation();
|
||||
AsyncTask.execute(mStatusChecker);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@ -178,7 +161,6 @@ public class BackgroundLocalizationService extends Service {
|
||||
startForeground(2, notification);
|
||||
}
|
||||
|
||||
|
||||
private void fn_getlocation() {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
@ -194,14 +176,17 @@ public class BackgroundLocalizationService extends Service {
|
||||
List<String> providers1 = mLocationManager.getProviders(true);
|
||||
Location bestLocation = null;
|
||||
|
||||
|
||||
for (String provider : providers1) {
|
||||
Location location = mLocationManager.getLastKnownLocation(provider);
|
||||
|
||||
if (location == null) {
|
||||
continue;
|
||||
}
|
||||
if (bestLocation == null || location.getAccuracy() < bestLocation.getAccuracy()) {
|
||||
bestLocation = location;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Log.e("Best localization:", String.valueOf(bestLocation));
|
||||
@ -210,13 +195,6 @@ public class BackgroundLocalizationService extends Service {
|
||||
fn_update(bestLocation);
|
||||
}
|
||||
|
||||
private class TimerTaskToGetLocation extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
mHandler.post(BackgroundLocalizationService.this::fn_getlocation);
|
||||
}
|
||||
}
|
||||
|
||||
private void fn_update(Location location) {
|
||||
new Task(location).execute();
|
||||
}
|
||||
@ -226,6 +204,9 @@ public class BackgroundLocalizationService extends Service {
|
||||
Log.e(TAG, "onDestroy");
|
||||
|
||||
super.onDestroy();
|
||||
mHandler.removeCallbacks(mStatusChecker);
|
||||
|
||||
|
||||
if (mLocationManager != null) {
|
||||
for (LocationListener listener : mLocationListeners) {
|
||||
try {
|
||||
@ -233,6 +214,8 @@ public class BackgroundLocalizationService extends Service {
|
||||
return;
|
||||
}
|
||||
mLocationManager.removeUpdates(listener);
|
||||
Log.i(TAG, "Removed");
|
||||
|
||||
} catch (Exception ex) {
|
||||
Log.i(TAG, "fail to remove location listener, ignore", ex);
|
||||
}
|
||||
@ -248,6 +231,35 @@ public class BackgroundLocalizationService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private class LocationListener implements android.location.LocationListener {
|
||||
|
||||
public LocationListener(String provider) {
|
||||
Log.e(TAG, "LocationListener " + provider);
|
||||
mLastLocation = new Location(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
Log.e(TAG, "onLocationChanged: " + location);
|
||||
mLastLocation.set(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
Log.e(TAG, "onProviderDisabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
Log.e(TAG, "onProviderEnabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
Log.e(TAG, "onStatusChanged: " + provider);
|
||||
}
|
||||
}
|
||||
|
||||
private class Task extends AsyncTask {
|
||||
private Double latitude;
|
||||
private Double longitude;
|
||||
|
@ -2,6 +2,7 @@ package com.uam.wmi.findmytutor.service;
|
||||
|
||||
import com.uam.wmi.findmytutor.model.JwtToken;
|
||||
import com.uam.wmi.findmytutor.model.LdapUser;
|
||||
import com.uam.wmi.findmytutor.model.ValidateUser;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Body;
|
||||
@ -15,7 +16,7 @@ public interface LdapService {
|
||||
Single<JwtToken> fakeValidate(@Body LdapUser user);
|
||||
|
||||
@POST("api/ldap/validate")
|
||||
Single<JwtToken> validate(@Body LdapUser user);
|
||||
Single<JwtToken> validate(@Body ValidateUser user);
|
||||
|
||||
@GET("api/ldap/getUserData/{login}")
|
||||
Single<LdapUser> getUserDataByLogin(@Path("login") String userLogin);
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.uam.wmi.findmytutor.service;
|
||||
|
||||
|
||||
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.*;
|
||||
|
||||
|
||||
public interface TutorTabApi {
|
||||
/**
|
||||
* Scrap all tutor tabs
|
||||
* With this method, you can initialize tutor tabs scrapper. The effect will be: - all tutor tabs will be overwritten with data from the WMI source
|
||||
* @param tutorId (required)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@POST("api/users/scrapTutorTab/{tutorId}")
|
||||
Observable<Void> apiUsersScrapTutorTabByTutorIdPost(
|
||||
@retrofit2.http.Path("tutorId") String tutorId
|
||||
);
|
||||
|
||||
/**
|
||||
* Scrap all tutor tabs
|
||||
* With this method, you can initialize tutor tabs scrapper. The effect will be: - all tutor tabs will be overwritten with data from the WMI source
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@POST("api/users/scrapTutorTab")
|
||||
Observable<Void> apiUsersScrapTutorTabPost();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param tutorId (required)
|
||||
* @return Call<TutorTabViewModel>
|
||||
*/
|
||||
@GET("api/users/tutorTab/{tutorId}")
|
||||
Single<TutorTabViewModel> apiUsersTutorTabByTutorIdGet(
|
||||
@retrofit2.http.Path("tutorId") String tutorId
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param tutorId (required)
|
||||
* @param tutorTab (optional)
|
||||
* @return Call<Void>
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type:application/json"
|
||||
})
|
||||
@PUT("api/users/tutorTab/{tutorId}")
|
||||
Observable<Void> apiUsersTutorTabByTutorIdPut(
|
||||
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
|
||||
);
|
||||
|
||||
}
|
@ -1,14 +1,17 @@
|
||||
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.PagedResultReturnedTutors;
|
||||
import com.uam.wmi.findmytutor.model.ReturnedTutors;
|
||||
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.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.DELETE;
|
||||
import retrofit2.http.GET;
|
||||
@ -21,17 +24,20 @@ public interface UserService {
|
||||
@GET("api/users")
|
||||
Single <List<User>> getAllUsers();
|
||||
|
||||
@GET("api/users")
|
||||
Single <List<User>> apiUsersGet();
|
||||
|
||||
@POST("api/users")
|
||||
Completable createUser(@Body User user);
|
||||
|
||||
@GET("api/users/page/{pageNum}")
|
||||
Single <PagedResult> getPagedUsers(@Path("pageNum") String pageNum );
|
||||
Single <PagedResultReturnedTutors> getPagedUsers(@Path("pageNum") String pageNum );
|
||||
|
||||
@GET("api/users/tutors/page/{pageNum}")
|
||||
Single <PagedResult> getPagedTutors(@Path("pageNum") String pageNum);
|
||||
Single <PagedResultReturnedTutors> getPagedTutors(@Path("pageNum") Integer pageNum );
|
||||
|
||||
@GET("api/users/students/page/{pageNum}")
|
||||
Single<PagedResult> getPagedStudents(@Path("pageNum") String pageNum);
|
||||
Single<PagedResultReturnedTutors> getPagedStudents(@Path("pageNum") String pageNum);
|
||||
|
||||
@GET("api/users/{id}")
|
||||
Single<User> getUserByID(@Path("id") String userID);
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.uam.wmi.findmytutor.utils;
|
||||
|
||||
public enum ActiveFragment {
|
||||
USER_LIST,
|
||||
SHARED_PREFERENCES,
|
||||
NONE
|
||||
}
|
||||
|
@ -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, top, right, 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()));
|
||||
}
|
||||
}
|
@ -7,15 +7,26 @@ import android.util.Log;
|
||||
import com.auth0.android.jwt.Claim;
|
||||
import com.auth0.android.jwt.JWT;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PrefUtils {
|
||||
|
||||
public PrefUtils() {
|
||||
}
|
||||
|
||||
private static SharedPreferences getSharedPreferences(Context context) {
|
||||
public static SharedPreferences getSharedPreferences(Context context) {
|
||||
return context.getSharedPreferences("APP_PREF", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
|
||||
public static void getAllKeys(Context context){
|
||||
Map<String,?> keys = getSharedPreferences(context).getAll();
|
||||
|
||||
for(Map.Entry<String,?> entry : keys.entrySet()){
|
||||
Log.d("map values",entry.getKey() + ": " + entry.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void cleanUserLocalStorage(Context context) {
|
||||
SharedPreferences preferences = getSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
@ -67,14 +78,14 @@ public class PrefUtils {
|
||||
return getSharedPreferences(context).getBoolean("IS_LOGGED_IN", false);
|
||||
}
|
||||
|
||||
public static void storeIsServiceRunning(Context context, Boolean flag) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||
editor.putBoolean("IS_SERVIS_RUNNING", flag);
|
||||
editor.apply();
|
||||
public static boolean isEnableSharingLocalization(Context context) {
|
||||
return getSharedPreferences(context).getBoolean("IS_ENABLE_SHARING_LOCALIZATION", false);
|
||||
}
|
||||
|
||||
public static boolean getIsServiceRunning(Context context) {
|
||||
return getSharedPreferences(context).getBoolean("IS_SERVIS_RUNNING", false);
|
||||
public static void storeEnableSharingLocalization(Context context,Boolean isChecked) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||
editor.putBoolean("IS_ENABLE_SHARING_LOCALIZATION", isChecked);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static void storeUserFirstName(Context context, String userName) {
|
||||
@ -103,8 +114,15 @@ public class PrefUtils {
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static String getUserName(Context context) {
|
||||
return getSharedPreferences(context).getString("USER_NAME", null);
|
||||
public static void storeLocale(Context context, String locale) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||
editor.putString("LOCALE", locale);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static String getLocale(Context context) {
|
||||
return getSharedPreferences(context).getString("LOCALE", "pl");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by ravi on 21/02/18.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,10 +1,19 @@
|
||||
package com.uam.wmi.findmytutor.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public class RestApiHelper {
|
||||
public class RestApiHelper extends Activity {
|
||||
|
||||
public RestApiHelper() {
|
||||
}
|
||||
@ -17,4 +26,20 @@ public class RestApiHelper {
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showError(Throwable e) {
|
||||
String message = e.toString();
|
||||
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
message = RestApiHelper.getErrorMessage(responseBody);
|
||||
}
|
||||
|
||||
Snackbar snackbar = Snackbar.make(findViewById(R.id.activity_content), message, Snackbar.LENGTH_LONG);
|
||||
View sbView = snackbar.getView();
|
||||
TextView textView = sbView.findViewById(android.support.design.R.id.snackbar_text);
|
||||
textView.setTextColor(Color.BLUE);
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
|
49
app/src/main/res/drawable/logo_design_black2.xml
Normal file
49
app/src/main/res/drawable/logo_design_black2.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="68dp"
|
||||
android:height="68dp"
|
||||
android:viewportWidth="68"
|
||||
android:viewportHeight="68">
|
||||
<path
|
||||
android:pathData="M56.3,44.2c-2.1,2.2 -4.6,3.9 -7.3,5.2c-1.5,0.7 -29,8.5 -40.7,11.8c-1,0.3 -1.9,0.5 -2.6,0.7c0.2,-0.7 0.4,-1.6 0.7,-2.6c2.9,-11.6 9.9,-38.9 10.5,-40.4c1.2,-2.7 2.9,-5.1 5,-7.3c9.1,-9.3 23.8,-10.2 33.7,-2.5c0.4,0.3 0.7,0.6 1.1,0.9c0.3,0.3 0.6,0.6 0.9,1C65.8,20.5 65.4,34.9 56.3,44.2z"
|
||||
android:strokeWidth="3"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M46.7,48.1"
|
||||
android:strokeWidth="3"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#000000"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M24.8,29.7l1,1.8l3.5,-2l1.5,2.7l-3.5,2l2.2,3.9l-3.1,1.7l-6.2,-11l7,-4l1.6,2.7L24.8,29.7z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M28,22.9l1.4,2.5l2.9,-1.6l-1.4,-2.5L28,22.9zM30,26.5l4.8,8.5l1.2,-4.8l-3,-5.4L30,26.5z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M45,22.4l2.9,5.2L45,29.2l-2.7,-4.8c-0.6,-1 -1.2,-1.3 -1.9,-0.9c-0.9,0.5 -1.1,1.5 -0.5,2.5l2.6,4.5l-2.9,1.7l-4.8,-8.5l2.1,-1.2l0.9,0.6c0.2,-1.1 0.9,-2 2,-2.6C41.7,19.5 43.8,20.2 45,22.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M52.1,9.9l6.6,11.6l-2.2,1.2l-0.6,-0.5c-0.4,1 -1.1,1.8 -2,2.4c-2.6,1.5 -5.5,0.6 -7,-2c-1.5,-2.6 -0.7,-5.6 1.9,-7.1c0.8,-0.4 1.6,-0.6 2.4,-0.6l-1.9,-3.4L52.1,9.9zM53.6,18.8c-0.6,-1.1 -1.9,-1.5 -3,-0.9c-1.1,0.6 -1.4,1.9 -0.8,3c0.6,1.1 1.9,1.5 3,0.9S54.2,19.9 53.6,18.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M24.1,42.1l-3,1.7l4.7,8.3l-3,1.7L18,45.5l-3,1.7l-1.5,-2.7l9,-5.1L24.1,42.1z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M27.2,46.4l-2.7,-4.8l2.9,-1.7l2.7,4.7c0.5,0.9 1.3,1.2 2.1,0.7c0.8,-0.4 1,-1.2 0.4,-2.1l-2.7,-4.7l2.9,-1.7l2.7,4.8c1.3,2.4 0.6,4.9 -2,6.3C31.1,49.4 28.6,48.8 27.2,46.4z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M43.7,38.5l1.5,2.6l-2,1.1c-1.9,1.1 -3.7,0.6 -4.7,-1.3l-1.8,-3.2L35,38.6l-0.4,-0.7l1.5,-6.2l0.6,-0.3l1.4,2.5l2.1,-1.2l1.3,2.3l-2.1,1.2l1.5,2.7c0.3,0.6 0.9,0.8 1.5,0.4L43.7,38.5z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M43.6,36.4c-1.5,-2.6 -0.6,-5.7 2.2,-7.2c2.8,-1.6 5.8,-0.8 7.3,1.8c1.5,2.6 0.6,5.7 -2.2,7.2C48.1,39.8 45,39 43.6,36.4zM49.4,35.6c1.1,-0.6 1.4,-1.8 0.8,-2.9c-0.6,-1.1 -1.8,-1.5 -2.9,-0.9s-1.4,1.8 -0.8,2.9C47.1,35.8 48.3,36.2 49.4,35.6L49.4,35.6z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M57.5,22.8l1.5,2.7l-1.1,0.6c-1,0.6 -1.2,1.3 -0.6,2.4l2.4,4.3l-2.9,1.7L52,26l2,-1.1l1,0.7c0.2,-1 0.8,-1.7 1.8,-2.3L57.5,22.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20.8,37.8l0.9,1.7L20.8,40L20,38.5c-0.2,-0.3 -0.3,-0.4 -0.5,-0.2c-0.3,0.1 -0.3,0.4 -0.1,0.7l0.8,1.5l-0.9,0.5l-0.9,-1.6c-0.2,-0.3 -0.3,-0.4 -0.5,-0.2c-0.2,0.1 -0.3,0.4 -0.1,0.7l0.8,1.5l-0.9,0.5l-1.5,-2.7l0.6,-0.4l0.3,0.2c0.1,-0.3 0.3,-0.6 0.6,-0.8c0.3,-0.2 0.7,-0.2 1,0c0.1,-0.3 0.3,-0.7 0.6,-0.9C19.8,37 20.5,37.2 20.8,37.8z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M22.3,35.7l0.3,1.8l-1.4,-1.1l-1,0.6l2.5,1.8c0,0.2 0,0.4 -0.1,0.5l0.5,0.8c0.5,-0.4 0.6,-0.8 0.5,-1.7l-0.3,-3.2L22.3,35.7z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/not_active_user.xml
Normal file
5
app/src/main/res/drawable/not_active_user.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#252525"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#010101" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/not_online.xml
Normal file
5
app/src/main/res/drawable/not_online.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#BD120A"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#010101" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/not_online_user.xml
Normal file
5
app/src/main/res/drawable/not_online_user.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#0ABD48"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#010101" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/online_user.xml
Normal file
5
app/src/main/res/drawable/online_user.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#0ABD48"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#010101" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
|
||||
</vector>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -11,7 +12,13 @@
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".activity.LoginActivity">
|
||||
|
||||
<!-- Login progress -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:contentDescription="@string/logo_find_my_tutor"
|
||||
app:srcCompat="@drawable/logo_design_black2" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/login_progress"
|
||||
@ -40,7 +47,7 @@
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_email"
|
||||
android:hint="@string/prompt_login"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
@ -77,11 +84,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_sign_in"
|
||||
android:text="@string/action_log_in"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
@ -82,6 +82,7 @@
|
||||
app:layout_anchorGravity="bottom|center"
|
||||
app:menu="@menu/nav_items" />
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/app_bar_main"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -13,6 +13,7 @@
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_weight="30"
|
||||
android:contentDescription="@string/app_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="70"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nav_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp"
|
||||
@ -9,20 +11,15 @@
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:padding="4dp"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_header_imageView"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nav_header_textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:text="Chike Mgbemena"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:visibility="visible"
|
||||
app:srcCompat="@drawable/logo_design_black2" />
|
||||
|
||||
</LinearLayout>
|
@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_category_general">
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_notifications_enabled"
|
||||
android:title="@string/title_notification" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="0"
|
||||
android:dialogTitle="@string/settings_language"
|
||||
@ -17,6 +19,4 @@
|
||||
android:title="@string/title_language" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
</PreferenceScreen>
|
@ -1,40 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_height="90dp"
|
||||
android:clickable="true"
|
||||
android:paddingBottom="@dimen/dimen_10"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/dimen_10">
|
||||
android:focusable="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="@dimen/dimen_10"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="@dimen/dimen_10">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/firstName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:layout_width="271dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:textSize="@dimen/note_list_text" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_below="@+id/firstName"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignEnd="@+id/firstName"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:textSize="@dimen/note_list_text" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isOnline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:layout_below="@+id/lastName"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_below="@+id/firstName"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginTop="-10dp"
|
||||
android:layout_toEndOf="@+id/firstName"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:textSize="@dimen/note_list_text" />
|
||||
|
||||
|
73
app/src/main/res/layout/user_list_modal.xml
Normal file
73
app/src/main/res/layout/user_list_modal.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<TextView android:id="@+id/userName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen_10"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="@dimen/lbl_new_note_title"
|
||||
android:textStyle="normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userDepartment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userRoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userDutyHoursTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
tools:text="@string/dutyHours" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/userDutyHours"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:textColor="@color/colorAccent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userNote"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text" />
|
||||
|
||||
</LinearLayout>
|
15
app/src/main/res/layout/users_list.xml
Normal file
15
app/src/main/res/layout/users_list.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.UsersListFragment">
|
||||
|
||||
|
||||
<include layout="@layout/users_list_main" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
|
32
app/src/main/res/layout/users_list_main.xml
Normal file
32
app/src/main/res/layout/users_list_main.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".activity.UsersListFragment"
|
||||
tools:showIn="@layout/users_list_main">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_empty_notes_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_top_no_notes"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:text="@string/loading"
|
||||
android:textColor="@color/msg_no_notes"
|
||||
android:textSize="@dimen/msg_no_notes" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,34 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group>
|
||||
<item android:id="@+id/nav_item_one"
|
||||
android:icon="@drawable/ic_menu_camera"
|
||||
android:title="Item 1" />
|
||||
<item android:id="@+id/nav_item_two"
|
||||
android:icon="@drawable/ic_menu_gallery"
|
||||
android:title="Item 2" />
|
||||
<item android:id="@+id/nav_item_three"
|
||||
android:icon="@drawable/ic_menu_share"
|
||||
android:title="Item 3" />
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group_menu">
|
||||
<item android:id="@+id/nav_item_four"
|
||||
<item
|
||||
android:id="@+id/nav_item_one"
|
||||
android:icon="@drawable/ic_people_white"
|
||||
android:title="@string/action_white_list" />
|
||||
<item android:id="@+id/nav_item_five"
|
||||
android:title="@string/navigation_item_whitelist" />
|
||||
<item
|
||||
android:id="@+id/nav_item_two"
|
||||
android:icon="@drawable/ic_people_black"
|
||||
android:title="@string/action_black_list" />
|
||||
android:title="@string/navigation_item_blacklist" />
|
||||
<item
|
||||
android:id="@+id/nav_item_three"
|
||||
android:icon="@drawable/outline_person_white_24dp"
|
||||
android:title="@string/navigation_item_profile" />
|
||||
</group>
|
||||
<group android:id="@+id/group_menu">
|
||||
<item
|
||||
android:id="@+id/nav_item_four"
|
||||
android:icon="@drawable/ic_menu_settings_key"
|
||||
android:title="@string/navigation_item_settings" />
|
||||
<item
|
||||
android:id="@+id/nav_item_five"
|
||||
android:icon="@android:drawable/ic_lock_power_off"
|
||||
android:title="@string/navigation_item_logout" />
|
||||
</group>
|
||||
|
||||
<item android:title="Title 1">
|
||||
<menu>
|
||||
<item android:id="@+id/nav_item_six"
|
||||
android:icon="@drawable/ic_menu_settings_gear"
|
||||
android:title="@string/action_settings" />
|
||||
<item android:id="@+id/nav_item_sign_out"
|
||||
android:icon="@drawable/ic_menu_sign_out2"
|
||||
android:title="@string/action_sign_out" />
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
@ -5,13 +5,13 @@
|
||||
<item
|
||||
android:id="@+id/nav_profile"
|
||||
android:icon="@drawable/outline_person_white_24dp"
|
||||
android:title="@string/nav_profile" />
|
||||
android:title="@string/title_sharing" />
|
||||
<item
|
||||
android:id="@+id/nav_map"
|
||||
android:icon="@drawable/outline_map_white_24dp"
|
||||
android:title="@string/nav_map" />
|
||||
<item
|
||||
android:id="@+id/nav_notif"
|
||||
android:id="@+id/nav_user_list"
|
||||
android:icon="@drawable/mapbox_info_icon_default"
|
||||
android:title="Active" />
|
||||
android:title="@string/user_list_nav" />
|
||||
</menu>
|
@ -1,16 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="title_activity_login">Zaloguj</string>
|
||||
<string name="prompt_password">Hasło (opcjonalne)</string>
|
||||
<string name="action_sign_in_short">Zaloguj</string>
|
||||
<string name="error_incorrect_password">Nieprawidłowe hasło</string>
|
||||
<string name="error_invalid_password">Hasło jest zbyt krótkie</string>
|
||||
<string name="error_invalid_email">Nieprawidłowy mail</string>
|
||||
<string name="error_field_required">To pole jest wymagane</string>
|
||||
<string name="prompt_password">Hasło</string>
|
||||
|
||||
|
||||
|
||||
<!--Ustawienia-->
|
||||
<string name="title_sharing">Udostępnianie</string>
|
||||
<string name="settings_category_location">Udostępnianie lokalizacji</string>
|
||||
<string name="title_location_level">Poziom udostępniania</string>
|
||||
@ -19,11 +16,6 @@
|
||||
<string name="location_level_precise">Dokładna</string>
|
||||
<string name="settings_location_level">Sczegółowość udostępniania</string>
|
||||
<string name="key_location_level">key_location_level</string>
|
||||
|
||||
<string name="title_description">Status</string>
|
||||
<string name="description_notdisturb">Nie przeszkadzać</string>
|
||||
<string name="description_awaiting">Czekam na studentów</string>
|
||||
<string name="description_onholidays">Na wakacjach</string>
|
||||
<string name="settings_description">Opis</string>
|
||||
<string name="key_description">key_description</string>
|
||||
|
||||
@ -36,7 +28,8 @@
|
||||
<string name="settings_language">Wybierz język</string>
|
||||
|
||||
<string name="pref_header_about">O aplikacji</string>
|
||||
<string name="summary_about">We are just like you :)\nA group of people trying to shape our everyday life into something useful. We hope to bring you the best product and quality of service.\nThank you for using our app !</string>
|
||||
<string name="summary_about">
|
||||
Jesteśmy grupą studentów, która chce pomoć w rozwoju naszego wydziału.\nDziękujemy za używanie naszej aplikacji.\nZespół FMT.!</string>
|
||||
<string name="app_version">0.1.0</string>
|
||||
<string name="summary_support">Masz jakieś pytania? Uwagi? Chętnie odpiszemy!</string>
|
||||
<string name="title_send_feedback">Skontaktuj się z nami</string>
|
||||
@ -51,4 +44,85 @@
|
||||
<string name="fab_title_hotels">Hotele</string>
|
||||
<string name="fab_title_parks">Parkingi</string>
|
||||
<string name="fab_title_attractions">Atrakcje</string>
|
||||
</resources>
|
||||
<string name="app_name">FindMyTutor</string>
|
||||
<string name="title_activity_startup">Find My Tutor</string>
|
||||
|
||||
<!-- Menu -->
|
||||
<string name="nav_map">Mapa </string>
|
||||
<string name="nav_notif">Notyfikacje</string>
|
||||
<string name="nav_profile">Profil użytkownika</string>
|
||||
|
||||
<!--Side Menu-->
|
||||
<string name="navigation_drawer_open">Otwórz menu</string>
|
||||
<string name="navigation_drawer_close">Zamknij menu</string>
|
||||
<string name="navigation_item_blacklist">Czarna lista</string>
|
||||
<string name="navigation_item_whitelist">Biała lista</string>
|
||||
<string name="navigation_item_settings">Ustawienia</string>
|
||||
<string name="navigation_item_profile">Profil uzytkownika</string>
|
||||
<string name="navigation_item_logout">Wyloguj</string>
|
||||
<!-- Tutors list -->
|
||||
<string name="action_settings">Ustawienia</string>
|
||||
<string name="activity_title_home">Mapa</string>
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="action_sign_in">Zaloguj!</string>
|
||||
<string name="action_sign_out">Wyloguj!</string>
|
||||
<string name="title_activity_main">MainActivity</string>
|
||||
<string name="access_token" translatable="false">pk.eyJ1IjoiZG9tYWdhbHNreSIsImEiOiJjamd4am4zazYwNXo1MzBxeDZtYjA4d2s4In0.KzNdhc9V_-SYe14AZ-q3Ew</string>
|
||||
|
||||
<string name="action_black_list">Czarna lista</string>
|
||||
<string name="action_white_list">Biała lista</string>
|
||||
<string name="title_activity_settings">Ustawienia</string>
|
||||
|
||||
<!-- Strings related to SharingActivity -->
|
||||
<string name="title_activity_sharing">Udostępnianie</string>
|
||||
|
||||
|
||||
<!-- Strings related to settings -->
|
||||
|
||||
<string name="status_list_title">Wybierz status</string>
|
||||
<string name="status_switch_title">Status</string>
|
||||
<string name="description_busy">Zajęty</string>
|
||||
<string name="description_available">Dostępny</string>
|
||||
<string name="description_consultation">Konsultacje</string>
|
||||
<string name="title_manual_status">Dodaj własny status</string>
|
||||
|
||||
|
||||
<string name="manual_location">Ręczna lokalizacja</string>
|
||||
<string name="title_list_manual_location">Wybierz ręczną lokalizacje</string>
|
||||
<string name="title_manual_location">Dodaj ręczną lokalizacje</string>
|
||||
<string name="assembly_a">Skrzydło A</string>
|
||||
<string name="assembly_c">Skrzydło C</string>
|
||||
<string name="passage_d">ŁącznikD</string>
|
||||
|
||||
<string name="key_language">key_language</string>
|
||||
<string name="title_activity_settings2">Ustawienia</string>
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">Ogólne ustawienia</string>
|
||||
|
||||
<!-- Example settings for Data & Sync -->
|
||||
<string name="pref_header_data_sync">Data & sync</string>
|
||||
<string-array name="multi_select_list_preference_default_value" />
|
||||
|
||||
|
||||
<!-- Example settings for Notifications -->
|
||||
<string name="settings">Ustawienia</string>
|
||||
<string name="ok">OK</string>
|
||||
|
||||
<string name="cancel">Zamknij</string>
|
||||
<string name="userRoom"><b>Pokój</b></string>
|
||||
<string name="userEmail"><b>Email</b></string>
|
||||
<string name="userNote"><b>Notatka</b></string>
|
||||
<string name="userDutyHoursHeader"><b>Dyżury</b></string>
|
||||
<string name="dutyHours"> <b>Dyżury</b></string>
|
||||
<string name="userDepartment">Zakład</string>
|
||||
<string name="loading">Loading …</string>
|
||||
<string name="logo_find_my_tutor">Logo find my tutor</string>
|
||||
<string name="prompt_login">Login (Ldap)</string>
|
||||
<string name="action_log_in">Zaloguj!</string>
|
||||
<string name="error_invalid_login_name">Niepoprawny format loginu.</string>
|
||||
<string name="user_list_nav">Lista użytkowników</string>
|
||||
</resources>
|
||||
|
||||
|
||||
|
@ -1,28 +1,24 @@
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">FindMyTutor</string>
|
||||
<string name="title_activity_login">Sign in</string>
|
||||
<string name="title_activity_startup" translatable="false">StartUp Activity</string>
|
||||
<string name="app_name" translatable="true">FindMyTutor</string>
|
||||
<string name="title_activity_login">Log in</string>
|
||||
<string name="title_activity_startup" translatable="false">Find My Tutor</string>
|
||||
|
||||
<!-- Menu -->
|
||||
<string name="nav_map">Map</string>
|
||||
<string name="nav_notif">Notification</string>
|
||||
<string name="nav_profile">Profile</string>
|
||||
|
||||
<!--Side Menu-->
|
||||
<string name="navigation_drawer_open">Drawer Open</string>
|
||||
<string name="navigation_drawer_close">Drawer Closed</string>
|
||||
|
||||
<string name="navigation_item_blacklist">Blacklist</string>
|
||||
<string name="navigation_item_whitelist">Whitelist</string>
|
||||
<string name="navigation_item_settings">Settings</string>
|
||||
<string name="navigation_item_profile">Profile</string>
|
||||
<string name="navigation_item_logout">Log out</string>
|
||||
<!-- Tutors list -->
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="activity_title_home">Notes</string>
|
||||
<string name="msg_no_notes">No notes found!</string>
|
||||
<string name="lbl_new_note_title">New Note</string>
|
||||
<string name="hint_enter_note">Enter your note!</string>
|
||||
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="prompt_email" translatable="false">Email</string>
|
||||
<string name="prompt_password">Password (optional)</string>
|
||||
<string name="prompt_password">Password</string>
|
||||
<string name="action_sign_in">Sign in or register</string>
|
||||
<string name="action_sign_out">Sign out</string>
|
||||
<string name="action_sign_in_short">Sign in</string>
|
||||
@ -30,11 +26,7 @@
|
||||
<string name="error_invalid_password">This password is too short</string>
|
||||
<string name="error_incorrect_password">This password is incorrect</string>
|
||||
<string name="error_field_required">This field is required</string>
|
||||
<string name="permission_rationale">"Contacts permissions are needed for providing email
|
||||
completions."
|
||||
</string>
|
||||
<string name="permission_denied_explanation">Permission was denied, but is needed for core
|
||||
functionality.</string>
|
||||
|
||||
<string name="title_activity_main" translatable="false">MainActivity</string>
|
||||
<string name="access_token" translatable="false">pk.eyJ1IjoiZG9tYWdhbHNreSIsImEiOiJjamd4am4zazYwNXo1MzBxeDZtYjA4d2s4In0.KzNdhc9V_-SYe14AZ-q3Ew</string>
|
||||
|
||||
@ -99,7 +91,7 @@ functionality.</string>
|
||||
<string name="app_version">0.1.0</string>
|
||||
<string name="summary_support">Got any queries? We are happy to help!</string>
|
||||
<string name="title_send_feedback">Send Feedback</string>
|
||||
<string name="key_send_feedback">key_send_feedback</string>
|
||||
<string name="key_send_feedback" translatable="false">key_send_feedback</string>
|
||||
<string name="privacy_policy">Privacy Policy</string>
|
||||
<string name="url_privacy">http://findmytutor.projektstudencki.pl/privacy-policy/</string>
|
||||
<string name="title_terms">Terms & Conditions</string>
|
||||
@ -112,16 +104,6 @@ functionality.</string>
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">General</string>
|
||||
|
||||
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||
<string name="pref_description_social_recommendations">Recommendations for people to contact
|
||||
based on your message history
|
||||
</string>
|
||||
|
||||
<string name="pref_title_display_name">Display name</string>
|
||||
<string name="pref_default_display_name">John Smith</string>
|
||||
|
||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||
<string-array name="pref_example_list_titles">
|
||||
<item>Always</item>
|
||||
<item>When possible</item>
|
||||
@ -136,7 +118,6 @@ functionality.</string>
|
||||
<!-- Example settings for Data & Sync -->
|
||||
<string name="pref_header_data_sync">Data & sync</string>
|
||||
|
||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
<string-array name="pref_sync_frequency_titles">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
@ -168,27 +149,13 @@ functionality.</string>
|
||||
|
||||
<string-array name="multi_select_list_preference_default_value" />
|
||||
|
||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||
|
||||
<!-- Example settings for Notifications -->
|
||||
<string name="pref_header_notifications">Notifications</string>
|
||||
|
||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
<string name="pref_ringtone_silent">Silent</string>
|
||||
|
||||
<string name="pref_title_vibrate">Vibrate</string>
|
||||
|
||||
|
||||
<string name="settings">Settings</string>
|
||||
<string name="ok">OK</string>
|
||||
|
||||
<string name="request_updates">Request updates</string>
|
||||
<string name="remove_updates">Remove updates</string>
|
||||
<string name="unknown_location">Unknown location</string>
|
||||
|
||||
<string name="batched_location_updates">Batched location updates</string>
|
||||
|
||||
<plurals name="num_locations_reported">
|
||||
<item quantity="zero">No location reported</item>
|
||||
@ -206,4 +173,19 @@ functionality.</string>
|
||||
<string name="user_location_permission_explanation">This app needs location permissions in order to show its functionality.</string>
|
||||
<string name="user_location_permission_not_granted">You didn\'t grant location permissions.</string>
|
||||
|
||||
<string name="cancel">Close</string>
|
||||
<string name="userRoom"><b>Room</b></string>
|
||||
<string name="userEmail"><b>Email</b></string>
|
||||
<string name="userNote"><b>Note</b></string>
|
||||
<string name="userDutyHoursHeader"><b>Duty Hours</b></string>
|
||||
<string name="dutyHours"> <b>Duty Hours</b></string>
|
||||
|
||||
<string name="userDepartment">Department</string>
|
||||
<string name="loading">Loading …</string>
|
||||
<string name="logo_find_my_tutor">Logo find my tutor</string>
|
||||
<string name="prompt_login">Login (Ldap)</string>
|
||||
<string name="action_log_in">Log in </string>
|
||||
<string name="user_list_nav">Users list</string>
|
||||
<string name="error_invalid_login_name">Invalid login format.</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user