Compare commits
No commits in common. "master" and "sharingTabFixes" have entirely different histories.
master
...
sharingTab
@ -10,11 +10,10 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 66
|
versionCode 40
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
resConfigs "en", "pl"
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@ -38,8 +37,10 @@ dependencies {
|
|||||||
implementation "ch.acra:acra-limiter:$acraVersion"
|
implementation "ch.acra:acra-limiter:$acraVersion"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.android.support:preference-v7:27.1.1'
|
implementation 'com.android.support:preference-v7:27.1.1'
|
||||||
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||||
implementation 'com.android.support:design:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
implementation 'com.android.support:support-v4:27.1.1'
|
implementation 'com.android.support:support-v4:27.1.1'
|
||||||
@ -71,10 +72,6 @@ dependencies {
|
|||||||
// FloatingBarMenu
|
// FloatingBarMenu
|
||||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||||
implementation 'org.apache.commons:commons-collections4:4.0'
|
implementation 'org.apache.commons:commons-collections4:4.0'
|
||||||
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:design:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
|
|
||||||
// spinner loaders library
|
|
||||||
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
|
|
||||||
// rx binding
|
|
||||||
implementation 'com.jakewharton.rxbinding:rxbinding:0.3.0'
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
package="com.uam.wmi.findmytutor">
|
package="com.uam.wmi.findmytutor">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<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_COARSE_UPDATES" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
@ -24,7 +24,6 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:configChanges="locale"
|
|
||||||
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
|
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.StartupActivity"
|
android:name=".activity.StartupActivity"
|
||||||
|
@ -6,9 +6,8 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.utils.Const;
|
import com.uam.wmi.findmytutor.utils.Const;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
|
||||||
|
|
||||||
|
import static org.acra.ReportField.*;
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
import org.acra.annotation.AcraLimiter;
|
import org.acra.annotation.AcraLimiter;
|
||||||
import org.acra.annotation.AcraNotification;
|
import org.acra.annotation.AcraNotification;
|
||||||
@ -17,32 +16,18 @@ import org.acra.config.HttpSenderConfigurationBuilder;
|
|||||||
import org.acra.config.ToastConfigurationBuilder;
|
import org.acra.config.ToastConfigurationBuilder;
|
||||||
import org.acra.data.StringFormat;
|
import org.acra.data.StringFormat;
|
||||||
import org.acra.sender.HttpSender;
|
import org.acra.sender.HttpSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.acra.ReportField.ANDROID_VERSION;
|
|
||||||
import static org.acra.ReportField.BUILD_CONFIG;
|
|
||||||
import static org.acra.ReportField.CUSTOM_DATA;
|
|
||||||
import static org.acra.ReportField.LOGCAT;
|
|
||||||
import static org.acra.ReportField.PHONE_MODEL;
|
|
||||||
import static org.acra.ReportField.REPORT_ID;
|
|
||||||
import static org.acra.ReportField.SHARED_PREFERENCES;
|
|
||||||
import static org.acra.ReportField.STACK_TRACE;
|
|
||||||
import static org.acra.ReportField.USER_APP_START_DATE;
|
|
||||||
import static org.acra.ReportField.USER_CRASH_DATE;
|
|
||||||
|
|
||||||
|
|
||||||
@AcraNotification(resText = R.string.notification_text,
|
@AcraNotification(resText = R.string.notification_text,
|
||||||
resTitle = R.string.notification_title,
|
resTitle = R.string.notification_title,
|
||||||
resChannelName = R.string.notification_channel)
|
resChannelName = R.string.notification_channel)
|
||||||
@AcraLimiter(failedReportLimit = 2)
|
@AcraLimiter(failedReportLimit = 2)
|
||||||
public class FindMyTutor extends Application {
|
public class FindMyTutor extends Application {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
//super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
|
|
||||||
// ACRA core
|
// ACRA core
|
||||||
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
|
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
|
||||||
@ -58,17 +43,16 @@ public class FindMyTutor extends Application {
|
|||||||
ToastConfigurationBuilder.class
|
ToastConfigurationBuilder.class
|
||||||
).setResText(R.string.acra_toast_text);
|
).setResText(R.string.acra_toast_text);
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = base.getSharedPreferences("com.uam.wmi.findmytutor_preferences", Context.MODE_PRIVATE);
|
SharedPreferences sharedPreferences = base.getSharedPreferences("com.uam.wmi.findmytutor_preferences", Context.MODE_PRIVATE);
|
||||||
Map header = new HashMap();
|
Map header = new HashMap();
|
||||||
String token = sharedPreferences.getString("API_KEY", "KEY_EMPTY");
|
String token = sharedPreferences.getString("API_KEY", "KEY_EMPTY");
|
||||||
header.put("Authorization", "Bearer " + token);
|
header.put("Authorization","Bearer " + token);
|
||||||
|
|
||||||
// Api POST
|
// Api POST
|
||||||
builder.getPluginConfigurationBuilder(
|
builder.getPluginConfigurationBuilder(
|
||||||
HttpSenderConfigurationBuilder.class
|
HttpSenderConfigurationBuilder.class
|
||||||
// ).setUri("http://192.168.0.15:3000/api/acra")
|
// ).setUri("http://192.168.0.15:3000/api/acra")
|
||||||
).setUri(Const.BASE_URL + "api/Feedback/autoFeedback")
|
).setUri(Const.BASE_URL +"api/Feedback/autoFeedback")
|
||||||
.setHttpMethod(HttpSender.Method.POST)
|
.setHttpMethod(HttpSender.Method.POST)
|
||||||
.setHttpHeaders(header)
|
.setHttpHeaders(header)
|
||||||
.setEnabled(true);
|
.setEnabled(true);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -14,8 +13,6 @@ import android.view.MenuInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||||
* to be used with AppCompat.
|
* to be used with AppCompat.
|
||||||
|
@ -4,7 +4,6 @@ import android.Manifest;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -36,9 +35,6 @@ import com.uam.wmi.findmytutor.R;
|
|||||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||||
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
||||||
|
|
||||||
@ -84,16 +80,11 @@ public abstract class BaseActivity
|
|||||||
private SharingFragment sharingFragment;
|
private SharingFragment sharingFragment;
|
||||||
|
|
||||||
private Fragment userListFragment;
|
private Fragment userListFragment;
|
||||||
public ActiveFragment activeFragment = ActiveFragment.NONE;
|
private ActiveFragment activeFragment = ActiveFragment.NONE;
|
||||||
private Fragment activeBottomMenu = null;
|
private Fragment activeBottomMenu = null;
|
||||||
public SearchView searchView;
|
private SearchView searchView;
|
||||||
public MenuItem infoMenuItem;
|
public MenuItem infoMenuItem;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -127,9 +118,17 @@ public abstract class BaseActivity
|
|||||||
if(PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
if(PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
||||||
stopBackgroundLocalizationTask();
|
stopBackgroundLocalizationTask();
|
||||||
}
|
}
|
||||||
logout();
|
|
||||||
|
|
||||||
|
storeBackgroundLocationStatus(getApplication(), false);
|
||||||
|
PrefUtils.storeIsLoggedIn(getApplicationContext(), false);
|
||||||
|
|
||||||
|
Intent i = getBaseContext().getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||||
|
if (i != null) {
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
}
|
||||||
|
startActivity(i);
|
||||||
|
finish();
|
||||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_feedback))) {
|
} else if (itemName.equals(getResources().getString(R.string.navigation_item_feedback))) {
|
||||||
feedbackUtils.showNoteDialog("FEEDBACK");
|
feedbackUtils.showNoteDialog("FEEDBACK");
|
||||||
|
|
||||||
@ -158,21 +157,6 @@ public abstract class BaseActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void logout(){
|
|
||||||
storeBackgroundLocationStatus(getApplication(), false);
|
|
||||||
PrefUtils.storeIsLoggedIn(getApplicationContext(), false);
|
|
||||||
PrefUtils.setBatteryExlusionInfoStatus(getApplicationContext(), true);
|
|
||||||
|
|
||||||
Intent i = getBaseContext().getPackageManager()
|
|
||||||
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
|
||||||
if (i != null) {
|
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
}
|
|
||||||
startActivity(i);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkPermissions() {
|
protected void checkPermissions() {
|
||||||
final List<String> missingPermissions = new ArrayList<String>();
|
final List<String> missingPermissions = new ArrayList<String>();
|
||||||
|
|
||||||
@ -215,8 +199,6 @@ public abstract class BaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stopBackgroundLocalizationTask() {
|
public void stopBackgroundLocalizationTask() {
|
||||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), false);
|
|
||||||
|
|
||||||
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||||
stopIntent.putExtra("request_stop", true);
|
stopIntent.putExtra("request_stop", true);
|
||||||
|
|
||||||
@ -226,12 +208,11 @@ public abstract class BaseActivity
|
|||||||
|
|
||||||
public void startBackgroundLocalizationTask() {
|
public void startBackgroundLocalizationTask() {
|
||||||
checkPermissions();
|
checkPermissions();
|
||||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
|
||||||
|
|
||||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||||
startIntent.putExtra("notify_interval", onlineBackgroundLocationInterval);
|
startIntent.putExtra("notify_interval", onlineBackgroundLocationInterval);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||||||
startForegroundService(startIntent);
|
startForegroundService(startIntent);
|
||||||
} else {
|
} else {
|
||||||
startService(startIntent);
|
startService(startIntent);
|
||||||
@ -427,8 +408,8 @@ public abstract class BaseActivity
|
|||||||
sharingFragment = SharingFragment.newInstance();
|
sharingFragment = SharingFragment.newInstance();
|
||||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
ft.replace(R.id.activity_content, sharingFragment);
|
ft.replace(R.id.activity_content, sharingFragment);
|
||||||
//ft.addToBackStack(null);
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadUserListFragment() {
|
private void loadUserListFragment() {
|
||||||
@ -437,7 +418,6 @@ public abstract class BaseActivity
|
|||||||
userListFragment = UsersListFragment.newInstance();
|
userListFragment = UsersListFragment.newInstance();
|
||||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
ft.replace(R.id.activity_content, userListFragment);
|
ft.replace(R.id.activity_content, userListFragment);
|
||||||
//ft.addToBackStack(null);
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -454,8 +434,4 @@ public abstract class BaseActivity
|
|||||||
|
|
||||||
abstract int getNavigationMenuItemId();
|
abstract int getNavigationMenuItemId();
|
||||||
abstract int getContentViewId();
|
abstract int getContentViewId();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.CoordinatorLayout;
|
import android.support.design.widget.CoordinatorLayout;
|
||||||
@ -32,7 +31,6 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import com.github.ybq.android.spinkit.SpinKitView;
|
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.geojson.Point;
|
import com.mapbox.geojson.Point;
|
||||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||||
@ -46,7 +44,6 @@ import com.uam.wmi.findmytutor.model.UserResponseModel;
|
|||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||||
@ -68,7 +65,6 @@ import io.reactivex.Observable;
|
|||||||
import io.reactivex.ObservableSource;
|
import io.reactivex.ObservableSource;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.functions.Function;
|
import io.reactivex.functions.Function;
|
||||||
import io.reactivex.observers.DisposableObserver;
|
import io.reactivex.observers.DisposableObserver;
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
@ -90,20 +86,12 @@ public class BlackList extends AppCompatActivity {
|
|||||||
Switch aSwitch;
|
Switch aSwitch;
|
||||||
@BindView(R.id.add_to_black_list_fab)
|
@BindView(R.id.add_to_black_list_fab)
|
||||||
FloatingActionButton addToBlackListFab;
|
FloatingActionButton addToBlackListFab;
|
||||||
@BindView(R.id.loader)
|
|
||||||
SpinKitView loader;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer prevSize;
|
private Integer prevSize;
|
||||||
private BlackListAdapter mAdapter;
|
private BlackListAdapter mAdapter;
|
||||||
private List<User> blacklistedUsers = new ArrayList<>();
|
private List<User> blacklistedUsers = new ArrayList<>();
|
||||||
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -116,11 +104,11 @@ public class BlackList extends AppCompatActivity {
|
|||||||
.create(UserService.class);
|
.create(UserService.class);
|
||||||
|
|
||||||
if (PrefUtils.isBlackListing(this)){
|
if (PrefUtils.isBlackListing(this)){
|
||||||
aSwitch.setText(getString(R.string.action_black_list) + " " +getString(R.string.on));
|
aSwitch.setText(getString(R.string.action_black_list) +" ON");
|
||||||
aSwitch.setChecked(true);
|
aSwitch.setChecked(true);
|
||||||
handleChangeRequest(true);
|
handleChangeRequest(true);
|
||||||
}else{
|
}else{
|
||||||
aSwitch.setText(getString(R.string.action_black_list) + " " +getString(R.string.off) );
|
aSwitch.setText(getString(R.string.action_black_list) +" OFF");
|
||||||
aSwitch.setChecked(false);
|
aSwitch.setChecked(false);
|
||||||
handleChangeRequest(false);
|
handleChangeRequest(false);
|
||||||
}
|
}
|
||||||
@ -134,7 +122,6 @@ public class BlackList extends AppCompatActivity {
|
|||||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
noNotesView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
fetchBlackListedUsers();
|
fetchBlackListedUsers();
|
||||||
/**
|
/**
|
||||||
@ -154,6 +141,7 @@ public class BlackList extends AppCompatActivity {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
addToBlackListFab.setOnClickListener(this::showFabDialog);
|
addToBlackListFab.setOnClickListener(this::showFabDialog);
|
||||||
|
|
||||||
handleSwitch();
|
handleSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,29 +161,32 @@ public class BlackList extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchBlackListedUsers() {
|
private void fetchBlackListedUsers() {
|
||||||
|
prevSize = blacklistedUsers.size();
|
||||||
|
|
||||||
|
blacklistedUsers.clear();
|
||||||
|
|
||||||
disposable.add(getListOfBlacklistedUsers(tutorId)
|
disposable.add(getListOfBlacklistedUsers(tutorId)
|
||||||
.doOnSubscribe(this::handleDoOnSubscribe)
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.flatMap(Observable::fromIterable)
|
.flatMap((Function<List<String>, Observable<String>>) Observable::fromIterable)
|
||||||
.flatMap(this::getUserObservable)
|
.flatMap((Function<String, ObservableSource<User>>) this::getUserObservable)
|
||||||
.subscribe(user -> blacklistedUsers.add(user), this::handleError,this::handleComplete));
|
.subscribeWith(new DisposableObserver<User>() {
|
||||||
|
@Override
|
||||||
|
public void onNext(User user) {
|
||||||
|
blacklistedUsers.add(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDoOnSubscribe(Disposable disposable) {
|
@Override
|
||||||
prevSize = blacklistedUsers.size();
|
public void onError(Throwable e) {
|
||||||
blacklistedUsers.clear();
|
showError(e);
|
||||||
didFetched = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleComplete() {
|
@Override
|
||||||
Collections.sort(blacklistedUsers, this::sortByUserName);
|
public void onComplete() {
|
||||||
didFetched = true;
|
Collections.sort(blacklistedUsers, (a, b) -> sortByUserName(a,b));
|
||||||
refreshUI();
|
refreshUI();
|
||||||
}
|
}
|
||||||
private void handleError(Throwable e){
|
}));
|
||||||
showError(e);
|
|
||||||
didFetched = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshUI(){
|
private void refreshUI(){
|
||||||
@ -257,8 +248,10 @@ public class BlackList extends AppCompatActivity {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handleAddUser(User user) {
|
private void handleAddUser(User user) {
|
||||||
Toast.makeText(this, R.string.add_user_to_list, Snackbar.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.add_user_to_list, Snackbar.LENGTH_LONG).show();
|
||||||
|
|
||||||
blacklistedUsers.clear();
|
blacklistedUsers.clear();
|
||||||
fetchBlackListedUsers();
|
fetchBlackListedUsers();
|
||||||
}
|
}
|
||||||
@ -280,15 +273,15 @@ public class BlackList extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toggleEmptyNotes() {
|
private void toggleEmptyNotes() {
|
||||||
|
|
||||||
if (didFetched && blacklistedUsers.size() == 0) {
|
if (didFetched && blacklistedUsers.size() == 0) {
|
||||||
noNotesView.setVisibility(View.VISIBLE);
|
|
||||||
noNotesView.setText(R.string.list_is_empty);
|
noNotesView.setText(R.string.list_is_empty);
|
||||||
loader.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
}else if (blacklistedUsers.size() > 0) {
|
}else if (blacklistedUsers.size() > 0) {
|
||||||
noNotesView.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.GONE);
|
||||||
loader.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
loader.setVisibility(View.VISIBLE);
|
noNotesView.setText(getString(R.string.loading));
|
||||||
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ import com.uam.wmi.findmytutor.model.ValidateUser;
|
|||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.LdapService;
|
import com.uam.wmi.findmytutor.service.LdapService;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
|
|
||||||
@ -40,7 +39,8 @@ import io.reactivex.disposables.CompositeDisposable;
|
|||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class
|
||||||
|
LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private AutoCompleteTextView mLoginNameView;
|
private AutoCompleteTextView mLoginNameView;
|
||||||
private EditText mPasswordView;
|
private EditText mPasswordView;
|
||||||
@ -191,7 +191,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
getUserProfile(userId.asString());
|
getUserProfile(userId.asString());
|
||||||
|
|
||||||
|
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
String txt = "Main Activity";
|
String txt = "Main Activity";
|
||||||
data.setData(Uri.parse(txt));
|
data.setData(Uri.parse(txt));
|
||||||
|
@ -4,11 +4,9 @@ import android.Manifest;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -47,11 +45,12 @@ import com.uam.wmi.findmytutor.model.User;
|
|||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.CoordinateService;
|
import com.uam.wmi.findmytutor.service.CoordinateService;
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
||||||
|
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
|
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.MapMarker;
|
import com.uam.wmi.findmytutor.utils.MapMarker;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
@ -77,12 +76,12 @@ import static com.uam.wmi.findmytutor.utils.Const.mapRefreshInterval;
|
|||||||
public class MapActivity extends BaseActivity
|
public class MapActivity extends BaseActivity
|
||||||
implements PermissionsListener, OnMapReadyCallback {
|
implements PermissionsListener, OnMapReadyCallback {
|
||||||
|
|
||||||
private HashMap<Long, String> markerUserHash = new HashMap<>();
|
|
||||||
private String tag = getClass().getName();
|
private String tag = getClass().getName();
|
||||||
private PermissionsManager permissionsManager;
|
private PermissionsManager permissionsManager;
|
||||||
private LocationComponent locationComponent;
|
private LocationComponent locationComponent;
|
||||||
private CoordinateService coordinateService;
|
private CoordinateService coordinateService;
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
private int mInterval = mapRefreshInterval;
|
private int mInterval = mapRefreshInterval;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
@ -93,8 +92,9 @@ public class MapActivity extends BaseActivity
|
|||||||
private Button removeLocationButton;
|
private Button removeLocationButton;
|
||||||
private Marker tmpLocalMarker;
|
private Marker tmpLocalMarker;
|
||||||
private Coordinate droppedMarkercoordinate;
|
private Coordinate droppedMarkercoordinate;
|
||||||
public HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
private HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
||||||
private HashMap<String, MapMarker> markerHash = new HashMap<>();
|
private HashMap<String, MapMarker> markerHash = new HashMap<>();
|
||||||
|
public HashMap<Long, String> markerUserHash = new HashMap<>();
|
||||||
private Set<String> previousCoordsIds = new HashSet<>();
|
private Set<String> previousCoordsIds = new HashSet<>();
|
||||||
private ManualLocationUtils manualLocationUtils;
|
private ManualLocationUtils manualLocationUtils;
|
||||||
// Camera Animation params
|
// Camera Animation params
|
||||||
@ -106,11 +106,6 @@ public class MapActivity extends BaseActivity
|
|||||||
private ApproximatedLocalization approximatedLocalization;
|
private ApproximatedLocalization approximatedLocalization;
|
||||||
private boolean shouldFetchNewCoords = true;
|
private boolean shouldFetchNewCoords = true;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -127,7 +122,6 @@ public class MapActivity extends BaseActivity
|
|||||||
mStatusChecker = () -> {
|
mStatusChecker = () -> {
|
||||||
try {
|
try {
|
||||||
if (shouldFetchNewCoords) {
|
if (shouldFetchNewCoords) {
|
||||||
checkIfUsesCanBeTutor();
|
|
||||||
fetchTopCoords();
|
fetchTopCoords();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -136,6 +130,7 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
selectLocationButton = findViewById(R.id.select_location_button);
|
selectLocationButton = findViewById(R.id.select_location_button);
|
||||||
removeLocationButton = findViewById(R.id.remove_location_button);
|
removeLocationButton = findViewById(R.id.remove_location_button);
|
||||||
mapView = findViewById(R.id.mapView);
|
mapView = findViewById(R.id.mapView);
|
||||||
@ -146,11 +141,6 @@ public class MapActivity extends BaseActivity
|
|||||||
handleBackgroundTaskLifeCycle();
|
handleBackgroundTaskLifeCycle();
|
||||||
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
|
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
|
||||||
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
||||||
|
|
||||||
if(isTutor){
|
|
||||||
MapUtils.BatteryOptimizationsExceptionCheck(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -214,28 +204,13 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
||||||
|
|
||||||
if (cordStatus.equals("")) {
|
if(cordStatus.equals("")){
|
||||||
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), getString(R.string.lack_of_status)));
|
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), getString(R.string.lack_of_status)));
|
||||||
} else {
|
}else{
|
||||||
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), cordStatus));
|
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), cordStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
String sharingLevelToRender = sharingLevel;
|
sharingLevelView.setText(String.format("%s: %s", getResources().getString(R.string.settings_location_level), sharingLevel));
|
||||||
Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|
||||||
|
|
||||||
if (PrefUtils.getLocale(getApplicationContext()).equals("pl") ||
|
|
||||||
PrefUtils.getLocale(getApplicationContext()).equals("pl-PL") ||
|
|
||||||
PrefUtils.getLocale(getApplicationContext()).equals("[pl-PL]")) {
|
|
||||||
if (sharingLevel.equals(SharingLevel.MANUAL.toString())) {
|
|
||||||
sharingLevelToRender = getString(R.string.manual_mode);
|
|
||||||
} else if (sharingLevel.equals(SharingLevel.EXACT.toString())) {
|
|
||||||
sharingLevelToRender = getString(R.string.exact_mode);
|
|
||||||
} else if (sharingLevel.equals(SharingLevel.APPROXIMATED.toString())) {
|
|
||||||
sharingLevelToRender = getString(R.string.approx_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sharingLevelView.setText(String.format("%s: %s", getResources().getString(R.string.settings_location_level), sharingLevelToRender));
|
|
||||||
|
|
||||||
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
@ -263,7 +238,6 @@ Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|||||||
mapboxMap.addOnMapClickListener(e -> {
|
mapboxMap.addOnMapClickListener(e -> {
|
||||||
removeLocationButton.setVisibility(View.GONE);
|
removeLocationButton.setVisibility(View.GONE);
|
||||||
selectLocationButton.setVisibility(View.GONE);
|
selectLocationButton.setVisibility(View.GONE);
|
||||||
restoreMapMarkers();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +332,7 @@ Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|||||||
Button dismissButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
Button dismissButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||||
|
|
||||||
dismissButton.setOnClickListener(view1 -> {
|
dismissButton.setOnClickListener(view1 -> {
|
||||||
PrefUtils.putCurrentManualLocationName(getApplicationContext(), getString(R.string.other_location));
|
PrefUtils.putCurrentManualLocationName(getApplicationContext(), "Inne");
|
||||||
PrefUtils.putCurrentManualLocation(getApplicationContext(), "-1");
|
PrefUtils.putCurrentManualLocation(getApplicationContext(), "-1");
|
||||||
|
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
@ -409,30 +383,6 @@ Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|||||||
PrefUtils.putCurrentManualLocation(getApplicationContext(), resp.getPredefinedCoordinateId());
|
PrefUtils.putCurrentManualLocation(getApplicationContext(), resp.getPredefinedCoordinateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkIfUsesCanBeTutor(){
|
|
||||||
disposable.add(
|
|
||||||
userService.getSelf(myId)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeWith(new DisposableSingleObserver<User>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(User user) {
|
|
||||||
boolean tutorFromBackend = user.getTitle().equals("tutor");
|
|
||||||
|
|
||||||
if(tutorFromBackend != PrefUtils.getIsTutor(getApplicationContext())){
|
|
||||||
logout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
showError(e);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fetchTopCoords() {
|
private void fetchTopCoords() {
|
||||||
|
|
||||||
disposable.add(
|
disposable.add(
|
||||||
@ -645,113 +595,6 @@ Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
mapView.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getContentViewId() {
|
|
||||||
Mapbox.getInstance(this, getString(R.string.access_token));
|
|
||||||
return R.layout.activity_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getNavigationMenuItemId() {
|
|
||||||
return R.id.nav_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode, @android.support.annotation.NonNull String[] permissions, @android.support.annotation.NonNull int[] grantResults) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onExplanationNeeded(List<String> permissionsToExplain) {
|
|
||||||
Toast.makeText(this, R.string.user_location_permission_explanation, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPermissionResult(boolean granted) {
|
|
||||||
// if (granted) {
|
|
||||||
// enableLocationPlugin();
|
|
||||||
// } else {
|
|
||||||
// Toast.makeText(this, R.string.user_location_permission_not_granted, Toast.LENGTH_LONG).show();
|
|
||||||
// finish();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void searchUser(String textToSearch) {
|
|
||||||
getUserFromApi(textToSearch);
|
|
||||||
|
|
||||||
Log.e("LOCALE", LocaleUtils.getCurrentLocale());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getUserFromApi(String userNameToSearch) {
|
|
||||||
disposable.add(
|
|
||||||
userService.getAllOnlineTutors()
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.map(tutors -> Stream.of(tutors).filter(t ->
|
|
||||||
t.toSearchAbleUserName().toLowerCase().contains(userNameToSearch.toLowerCase())).toList())
|
|
||||||
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<User> users) {
|
|
||||||
Log.e("USERS", String.valueOf(users));
|
|
||||||
filterMarkers(users);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
showError(e);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void filterMarkers(List<User> users) {
|
|
||||||
restoreMapMarkers();
|
|
||||||
|
|
||||||
Icon markedMarker = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.search_marker);
|
|
||||||
List<MapMarker> markersToSet = Stream.of(mapboxMap.getMarkers())
|
|
||||||
.filter(m -> Stream.of(users).anyMatch(u -> u.getId().equals(markerUserHash.get(m.getId()))))
|
|
||||||
.map(m -> markerUserHash.get(m.getId()))
|
|
||||||
.map(m -> markerHash.get(m))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
for (MapMarker marker : markersToSet) {
|
|
||||||
marker.getMarker().setIcon(markedMarker);
|
|
||||||
|
|
||||||
if (markersToSet.size() == 1)
|
|
||||||
mapboxMap.selectMarker(marker.getMarker());
|
|
||||||
}
|
|
||||||
|
|
||||||
mapboxMap.getMarkerViewManager().update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restoreMapMarkers() {
|
|
||||||
try {
|
|
||||||
for (Marker marker : mapboxMap.getMarkers()) {
|
|
||||||
MapMarker markerMap = markerHash.get(markerUserHash.get(marker.getId()));
|
|
||||||
|
|
||||||
markerMap.restoreDefaultIcon();
|
|
||||||
mapboxMap.deselectMarker(marker);
|
|
||||||
}
|
|
||||||
|
|
||||||
mapboxMap.getMarkerViewManager().update();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("MAP", String.valueOf(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void adjustMapToSearch(Integer zoom) {
|
|
||||||
MapUtils.setZoom(mapboxMap, zoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@ -794,4 +637,103 @@ Log.e("LOCALE",PrefUtils.getLocale(getApplicationContext()));
|
|||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
mapView.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getContentViewId() {
|
||||||
|
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||||
|
return R.layout.activity_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getNavigationMenuItemId() {
|
||||||
|
return R.id.nav_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @android.support.annotation.NonNull String[] permissions, @android.support.annotation.NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExplanationNeeded(List<String> permissionsToExplain) {
|
||||||
|
Toast.makeText(this, R.string.user_location_permission_explanation, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPermissionResult(boolean granted) {
|
||||||
|
// if (granted) {
|
||||||
|
// enableLocationPlugin();
|
||||||
|
// } else {
|
||||||
|
// Toast.makeText(this, R.string.user_location_permission_not_granted, Toast.LENGTH_LONG).show();
|
||||||
|
// finish();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void searchUser(String textToSearch) {
|
||||||
|
getUserFromApi(textToSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getUserFromApi(String userNameToSearch) {
|
||||||
|
disposable.add(
|
||||||
|
userService.getAllTutors()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.map(tutors -> Stream.of(tutors).filter(t ->
|
||||||
|
t.toSearchAbleUserName().toLowerCase().contains(userNameToSearch.toLowerCase())).toList())
|
||||||
|
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<User> users) {
|
||||||
|
filterMarkers(users);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
showError(e);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void filterMarkers(List<User> users) {
|
||||||
|
restoreMapMarkers();
|
||||||
|
|
||||||
|
Icon markedMarker = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.search_marker);
|
||||||
|
List<MapMarker> markersToSet = Stream.of(mapboxMap.getMarkers())
|
||||||
|
.filter(m -> Stream.of(users).anyMatch(u -> u.getId().equals(markerUserHash.get(m.getId()))))
|
||||||
|
.map(m -> markerUserHash.get(m.getId()))
|
||||||
|
.map(m -> markerHash.get(m))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (MapMarker marker : markersToSet) {
|
||||||
|
marker.getMarker().setIcon(markedMarker);
|
||||||
|
|
||||||
|
if (markersToSet.size() == 1)
|
||||||
|
mapboxMap.selectMarker(marker.getMarker());
|
||||||
|
}
|
||||||
|
|
||||||
|
mapboxMap.getMarkerViewManager().update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreMapMarkers() {
|
||||||
|
|
||||||
|
for (Marker marker : mapboxMap.getMarkers()) {
|
||||||
|
MapMarker markerMap = markerHash.get(markerUserHash.get(marker.getId()));
|
||||||
|
|
||||||
|
markerMap.restoreDefaultIcon();
|
||||||
|
mapboxMap.deselectMarker(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
mapboxMap.getMarkerViewManager().update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void adjustMapToSearch(Integer zoom) {
|
||||||
|
MapUtils.setZoom(mapboxMap, zoom);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@ -16,15 +15,12 @@ import android.util.Log;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
private static final String TAG = SettingsActivity.class.getSimpleName();
|
private static final String TAG = SettingsActivity.class.getSimpleName();
|
||||||
|
|
||||||
@ -37,15 +33,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
|
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocale(String localeName) {
|
public void setLocale(String localeName) {
|
||||||
Context context = LocaleHelper.setLocale(this, localeName);
|
|
||||||
Resources res = context.getResources();
|
|
||||||
Locale myLocale = new Locale(localeName);
|
Locale myLocale = new Locale(localeName);
|
||||||
|
Resources res = getResources();
|
||||||
DisplayMetrics dm = res.getDisplayMetrics();
|
DisplayMetrics dm = res.getDisplayMetrics();
|
||||||
Configuration conf = res.getConfiguration();
|
Configuration conf = res.getConfiguration();
|
||||||
conf.locale = myLocale;
|
conf.locale = myLocale;
|
||||||
@ -72,12 +62,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
|
||||||
if (!newValue.toString().equals("0")){
|
if (!newValue.toString().equals("0")){
|
||||||
LocaleHelper.setLocale(getActivity(), "pl");
|
|
||||||
((SettingsActivity)getActivity()).setLocale("pl");
|
((SettingsActivity)getActivity()).setLocale("pl");
|
||||||
PrefUtils.storeLocale(getActivity(),"pl");
|
PrefUtils.storeLocale(getActivity(),"pl");
|
||||||
LocaleHelper.setLocale(getActivity(), "pl");
|
|
||||||
}else{
|
}else{
|
||||||
LocaleHelper.setLocale(getActivity(), "en");
|
|
||||||
((SettingsActivity)getActivity()).setLocale("en");
|
((SettingsActivity)getActivity()).setLocale("en");
|
||||||
PrefUtils.storeLocale(getActivity(),"en");
|
PrefUtils.storeLocale(getActivity(),"en");
|
||||||
}
|
}
|
||||||
|
@ -3,36 +3,41 @@ package com.uam.wmi.findmytutor.activity;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
import android.app.TimePickerDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TimePicker;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.annimon.stream.IntPair;
|
import com.annimon.stream.IntPair;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
|
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||||
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||||
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
|
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
|
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.BidiMap;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -44,7 +49,6 @@ import io.reactivex.disposables.CompositeDisposable;
|
|||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||||
|
|
||||||
|
|
||||||
@ -59,9 +63,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
protected RightButtonPreference removeManualStatus;
|
protected RightButtonPreference removeManualStatus;
|
||||||
protected Preference manualStatus;
|
protected Preference manualStatus;
|
||||||
protected ListPreference statusList;
|
protected ListPreference statusList;
|
||||||
|
private HashMap<String,String> locationMap;
|
||||||
|
private ArrayList <String> locationUUIDs;
|
||||||
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
|
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
|
||||||
private HashMap<String, String> locationMap;
|
|
||||||
private ArrayList<String> locationUUIDs;
|
|
||||||
private HashMap<Integer, String> locationLevelMapping;
|
private HashMap<Integer, String> locationLevelMapping;
|
||||||
private HashMap<Integer, String> statusMapping;
|
private HashMap<Integer, String> statusMapping;
|
||||||
private PredefinedStatusesService statusesService;
|
private PredefinedStatusesService statusesService;
|
||||||
@ -85,9 +89,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> strings) {
|
public void onSuccess(List<String> strings) {
|
||||||
statusesArray = strings.toArray(new String[strings.size()]);
|
statusesArray = strings.toArray(new String[strings.size()]);
|
||||||
if (strings.isEmpty()) {
|
if(strings.isEmpty()){
|
||||||
disableStatusPreferences();
|
disableStatusPreferences();
|
||||||
} else {
|
}else{
|
||||||
enableStatusPreferences();
|
enableStatusPreferences();
|
||||||
}
|
}
|
||||||
// Log.d("STATUSES",Integer.toString(statusesArray.length ));
|
// Log.d("STATUSES",Integer.toString(statusesArray.length ));
|
||||||
@ -112,12 +116,10 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
public void onSuccess(List<PredefinedCoordViewModel> coords) {
|
public void onSuccess(List<PredefinedCoordViewModel> coords) {
|
||||||
|
|
||||||
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||||
locationMap = new HashMap<String, String>();
|
locationMap = new HashMap<String,String>();
|
||||||
locationUUIDs = new ArrayList<String>();
|
locationUUIDs = new ArrayList<String>();
|
||||||
for (PredefinedCoordViewModel i : coords)
|
for (PredefinedCoordViewModel i : coords) locationMap.put(i.getPredefinedCoordinateId(),i.getName());
|
||||||
locationMap.put(i.getPredefinedCoordinateId(), i.getName());
|
for (PredefinedCoordViewModel i : coords) locationUUIDs.add(i.getPredefinedCoordinateId());
|
||||||
for (PredefinedCoordViewModel i : coords)
|
|
||||||
locationUUIDs.add(i.getPredefinedCoordinateId());
|
|
||||||
List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
|
List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
|
||||||
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
|
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
|
||||||
predefinedCoordsList.addAll(coords);
|
predefinedCoordsList.addAll(coords);
|
||||||
@ -125,9 +127,16 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
preferenceCategory.removePreference(manualLocationList);
|
preferenceCategory.removePreference(manualLocationList);
|
||||||
preferenceCategory.removePreference(removeManualLocation);
|
preferenceCategory.removePreference(removeManualLocation);
|
||||||
preferenceCategory.removePreference(manualLocationButton);
|
preferenceCategory.removePreference(manualLocationButton);
|
||||||
} else {
|
}else{
|
||||||
if (!predefinedCoordsList.isEmpty()) {
|
if(predefinedCoordsList.isEmpty()){
|
||||||
|
locationSharing.setEnabled(false);
|
||||||
|
locationSharing.setChecked(false);
|
||||||
|
PrefUtils.disableSharing(getApplicationContext());
|
||||||
|
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||||
|
removeManualLocation.setEnabled(false);
|
||||||
|
manualLocationList.setEnabled(false);
|
||||||
|
manualLocationList.setSummary("");
|
||||||
|
}else{
|
||||||
manualLocationList.setEnabled(true);
|
manualLocationList.setEnabled(true);
|
||||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||||
removeManualLocation.setEnabled(true);
|
removeManualLocation.setEnabled(true);
|
||||||
@ -139,9 +148,10 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
List<Integer> activesId = Stream.of(coords).indexed()
|
List<Integer> activesId = Stream.of(coords).indexed()
|
||||||
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
|
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
|
||||||
|
|
||||||
if (activesId.size() == 0) {
|
if( activesId.size() == 0){
|
||||||
setListPreferenceData(manualLocationList, stringnames, null);
|
setListPreferenceData(manualLocationList, stringnames, null);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
|
setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +161,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +204,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Main sharing switch**/
|
/** Main sharing switch**/
|
||||||
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
||||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
||||||
@ -202,14 +214,20 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
|
|
||||||
/** Sharing level list **/
|
/** Sharing level list **/
|
||||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
|
||||||
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
|
||||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||||
|
|
||||||
|
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
||||||
|
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
||||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||||
if (!predefinedCoordsList.isEmpty()) {
|
if (!predefinedCoordsList.isEmpty()) {
|
||||||
preferenceCategory.addPreference(manualLocationList);
|
preferenceCategory.addPreference(manualLocationList);
|
||||||
preferenceCategory.addPreference(removeManualLocation);
|
preferenceCategory.addPreference(removeManualLocation);
|
||||||
|
}else{
|
||||||
|
locationSharing.setEnabled(false);
|
||||||
|
locationSharing.setChecked(false);
|
||||||
|
PrefUtils.disableSharing(getApplicationContext());
|
||||||
|
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||||
|
|
||||||
}
|
}
|
||||||
preferenceCategory.addPreference(manualLocationButton);
|
preferenceCategory.addPreference(manualLocationButton);
|
||||||
} else {
|
} else {
|
||||||
@ -245,6 +263,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Button 'choose from map' button listener **/
|
/** Button 'choose from map' button listener **/
|
||||||
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
|
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
|
||||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||||
@ -266,7 +287,8 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
|
||||||
if (statusesArray.length == 0) {
|
if(statusesArray.length == 0)
|
||||||
|
{
|
||||||
builder.setTitle("nie ma wody na pustyni");
|
builder.setTitle("nie ma wody na pustyni");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -283,30 +305,29 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
removeManualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
removeManualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
showRemoveDialog(statusList.getEntries(), "status");
|
showRemoveDialog(statusList.getEntries(),"status");
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
removeManualLocation.setOnPreferenceChangeListener(((preference, newValue) -> {
|
removeManualLocation.setOnPreferenceChangeListener(((preference, newValue) -> {
|
||||||
showRemoveDialog(manualLocationList.getEntries(), "location");
|
showRemoveDialog(manualLocationList.getEntries(),"location");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
public void showRemoveDialog(CharSequence[] entries, String service){
|
||||||
public void showRemoveDialog(CharSequence[] entries, String service) {
|
boolean [] checked = new boolean[entries.length];
|
||||||
boolean[] checked = new boolean[entries.length];
|
|
||||||
ArrayList<String> tobeDeleted = new ArrayList<String>();
|
ArrayList<String> tobeDeleted = new ArrayList<String>();
|
||||||
// Log.d("sharingDialog", "no to siup");
|
// Log.d("sharingDialog", "no to siup");
|
||||||
builder.setPositiveButton("DELETE", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("DELETE", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i=0; i< entries.length; i++){
|
||||||
if (checked[i] == true) {
|
if(checked[i] == true) {
|
||||||
tobeDeleted.add((String) entries[i]);
|
tobeDeleted.add((String) entries[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeEntries(service, tobeDeleted);
|
removeEntries(service,tobeDeleted);
|
||||||
// Log.d("MANAGE-PREF",tobeDeleted.toString());
|
// Log.d("MANAGE-PREF",tobeDeleted.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -327,21 +348,21 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeEntries(String service, ArrayList<String> toBeDeleted) {
|
protected void removeEntries(String service, ArrayList<String> toBeDeleted){
|
||||||
|
|
||||||
// Log.d("MANAGE-PREF", toBeDeleted.toString());
|
// Log.d("MANAGE-PREF", toBeDeleted.toString());
|
||||||
if (service.equals("status")) {
|
if(service.equals("status")){
|
||||||
for (String uuid : toBeDeleted) {
|
for (String uuid:toBeDeleted) {
|
||||||
disposable.add(statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), uuid)
|
disposable.add(statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleDeleteStatuses, this::handleError));
|
.subscribe(this::handleDeleteStatuses, this::handleError));
|
||||||
}
|
}
|
||||||
} else {
|
}else {
|
||||||
ArrayList<String> uuidsToBeDeleted = new ArrayList<String>();
|
ArrayList<String> uuidsToBeDeleted = new ArrayList<String>();
|
||||||
for (String name : toBeDeleted) {
|
for (String name:toBeDeleted) {
|
||||||
for (String uuid : locationUUIDs) {
|
for (String uuid:locationUUIDs) {
|
||||||
if (locationMap.get(uuid).equals(name)) {
|
if(locationMap.get(uuid).equals(name)){
|
||||||
uuidsToBeDeleted.add(uuid);
|
uuidsToBeDeleted.add(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,9 +403,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
;
|
;
|
||||||
|
|
||||||
private void handleResponse(List<String> resp) {
|
private void handleResponse(List<String> resp) {
|
||||||
if (resp.size() == 1) {
|
if(resp.size() == 1){
|
||||||
enableStatusPreferences();
|
enableStatusPreferences();
|
||||||
if (PrefUtils.isStatusEnabled(getApplicationContext()) == false) {
|
if(PrefUtils.isStatusEnabled(getApplicationContext()) == false){
|
||||||
PrefUtils.enableStatus(getApplicationContext());
|
PrefUtils.enableStatus(getApplicationContext());
|
||||||
statusSwitch.setChecked(true);
|
statusSwitch.setChecked(true);
|
||||||
}
|
}
|
||||||
@ -407,38 +428,37 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void handleDeleteStatuses(List<String> resp){
|
||||||
private void handleDeleteStatuses(List<String> resp) {
|
if(resp.isEmpty()){
|
||||||
if (resp.isEmpty()) {
|
|
||||||
disableStatusPreferences();
|
disableStatusPreferences();
|
||||||
} else {
|
}else{
|
||||||
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
||||||
setListPreferenceData(statusList, statusesArray, null);
|
setListPreferenceData(statusList, statusesArray, null);
|
||||||
String currentEntry = PrefUtils.getUserStatus(getApplicationContext());
|
String currentEntry = PrefUtils.getUserStatus(getApplicationContext());
|
||||||
if (resp.contains(currentEntry)) {
|
if(resp.contains(currentEntry)){
|
||||||
statusList.setValueIndex(resp.indexOf(currentEntry));
|
statusList.setValueIndex(resp.indexOf(currentEntry));
|
||||||
} else {
|
}else{
|
||||||
statusList.setValueIndex(0);
|
statusList.setValueIndex(0);
|
||||||
statusList.setSummary(resp.get(0));
|
statusList.setSummary(resp.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void handleDeleteLocations(List<PredefinedCoordViewModel> resp){
|
||||||
private void handleDeleteLocations(List<PredefinedCoordViewModel> resp) {
|
|
||||||
getLocations(disposable);
|
getLocations(disposable);
|
||||||
String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||||
if (resp.isEmpty()) {
|
if(resp.isEmpty()){
|
||||||
disableManualLocationPreferences();
|
disableManualLocationPreferences();
|
||||||
} else {
|
}else{
|
||||||
if (!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty()) {
|
if(!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty())
|
||||||
for (PredefinedCoordViewModel location : resp) {
|
{
|
||||||
if (location.getName().equals(currentEntry)) {
|
for (PredefinedCoordViewModel location: resp) {
|
||||||
|
if(location.getName().equals(currentEntry)){
|
||||||
manualLocationList.setValueIndex(resp.indexOf(location));
|
manualLocationList.setValueIndex(resp.indexOf(location));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
manualLocationList.setValueIndex(0);
|
manualLocationList.setValueIndex(0);
|
||||||
manualLocationList.setSummary(resp.get(0).getName());
|
manualLocationList.setSummary(resp.get(0).getName());
|
||||||
//todo czy na pewno w shared pref sa dobre wartosci
|
//todo czy na pewno w shared pref sa dobre wartosci
|
||||||
@ -446,8 +466,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void disableStatusPreferences(){
|
||||||
private void disableStatusPreferences() {
|
|
||||||
removeManualStatus.setEnabled(false);
|
removeManualStatus.setEnabled(false);
|
||||||
statusList.setEnabled(false);
|
statusList.setEnabled(false);
|
||||||
statusSwitch.setEnabled(false);
|
statusSwitch.setEnabled(false);
|
||||||
@ -455,15 +474,13 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
PrefUtils.disableStatus(getApplicationContext());
|
PrefUtils.disableStatus(getApplicationContext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void enableStatusPreferences(){
|
||||||
private void enableStatusPreferences() {
|
|
||||||
removeManualStatus.setEnabled(true);
|
removeManualStatus.setEnabled(true);
|
||||||
statusList.setEnabled(true);
|
statusList.setEnabled(true);
|
||||||
statusSwitch.setEnabled(true);
|
statusSwitch.setEnabled(true);
|
||||||
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||||
}
|
}
|
||||||
|
private void disableManualLocationPreferences(){
|
||||||
private void disableManualLocationPreferences() {
|
|
||||||
removeManualLocation.setEnabled(false);
|
removeManualLocation.setEnabled(false);
|
||||||
manualLocationList.setEnabled(false);
|
manualLocationList.setEnabled(false);
|
||||||
manualLocationList.setSummary("");
|
manualLocationList.setSummary("");
|
||||||
@ -473,8 +490,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void enableManualLocationPreferences(){
|
||||||
private void enableManualLocationPreferences() {
|
|
||||||
removeManualLocation.setEnabled(true);
|
removeManualLocation.setEnabled(true);
|
||||||
manualLocationList.setEnabled(true);
|
manualLocationList.setEnabled(true);
|
||||||
|
|
||||||
@ -504,5 +520,4 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,16 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.R;
|
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -32,11 +19,6 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
private static final int AUTHENTICATION_REQUEST_CODE = 666;
|
private static final int AUTHENTICATION_REQUEST_CODE = 666;
|
||||||
String currentLang;
|
String currentLang;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -49,11 +31,12 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
Intent loginIntent = new Intent(this, LoginActivity.class);
|
Intent loginIntent = new Intent(this, LoginActivity.class);
|
||||||
|
// Intent loginIntent = new Intent(this, ScrollingActivity.class);
|
||||||
startActivityForResult(loginIntent, AUTHENTICATION_REQUEST_CODE);
|
startActivityForResult(loginIntent, AUTHENTICATION_REQUEST_CODE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,8 +49,4 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.DialogFragment;
|
import android.app.DialogFragment;
|
||||||
import android.app.TimePickerDialog;
|
import android.app.TimePickerDialog;
|
||||||
@ -12,13 +11,11 @@ import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
|||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
@SuppressLint("ValidFragment")
|
|
||||||
public class TimePickerFragment extends DialogFragment
|
public class TimePickerFragment extends DialogFragment
|
||||||
implements TimePickerDialog.OnTimeSetListener {
|
implements TimePickerDialog.OnTimeSetListener {
|
||||||
private TextView textView;
|
private TextView textView;
|
||||||
private String field;
|
private String field;
|
||||||
private DutyHourViewModel duty;
|
private DutyHourViewModel duty;
|
||||||
@SuppressLint("ValidFragment")
|
|
||||||
public TimePickerFragment(TextView view, DutyHourViewModel duty, String field){
|
public TimePickerFragment(TextView view, DutyHourViewModel duty, String field){
|
||||||
this.textView = view;
|
this.textView = view;
|
||||||
this.duty=duty;
|
this.duty=duty;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.TextInputEditText;
|
import android.support.design.widget.TextInputEditText;
|
||||||
|
import android.support.design.widget.TextInputLayout;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
@ -28,11 +29,12 @@ import com.uam.wmi.findmytutor.model.User;
|
|||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -40,10 +42,12 @@ import java.util.regex.Pattern;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
import io.reactivex.observers.DisposableCompletableObserver;
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
import static java.lang.String.valueOf;
|
import static java.lang.String.valueOf;
|
||||||
|
|
||||||
public class TutorTab extends AppCompatActivity {
|
public class TutorTab extends AppCompatActivity {
|
||||||
@ -65,24 +69,42 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
private DutyHoursAdapter dutyHoursAdapter;
|
private DutyHoursAdapter dutyHoursAdapter;
|
||||||
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
||||||
private TutorTabViewModel newTab;
|
private TutorTabViewModel newTab;
|
||||||
|
public boolean isEmailValid(String email)
|
||||||
|
{
|
||||||
|
String regExpn =
|
||||||
|
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
|
||||||
|
+"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
|
||||||
|
+"[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
|
||||||
|
+"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
|
||||||
|
+"[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
|
||||||
|
+"([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$";
|
||||||
|
|
||||||
|
CharSequence inputStr = email;
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regExpn,Pattern.CASE_INSENSITIVE);
|
||||||
|
Matcher matcher = pattern.matcher(inputStr);
|
||||||
|
|
||||||
|
if(matcher.matches())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
setContentView(R.layout.content_tutor_tab);
|
setContentView(R.layout.content_tutor_tab);
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
toolbar.setTitle(getString(R.string.profile_activity_title));
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
|
||||||
toolbar.setTitle(R.string.profile_activity_title);
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
userName = findViewById(R.id.userName);
|
userName = findViewById(R.id.userName);
|
||||||
userNote = findViewById(R.id.userNote);
|
userNote = (TextInputEditText) findViewById(R.id.userNote);
|
||||||
userRoom = findViewById(R.id.userRoom);
|
userRoom = findViewById(R.id.userRoom);
|
||||||
userEmail = findViewById(R.id.userEmail);
|
userEmail = findViewById(R.id.userEmail);
|
||||||
department = findViewById(R.id.userDepartment);
|
department = findViewById(R.id.userDepartment);
|
||||||
saveButon = findViewById(R.id.saveButton);
|
saveButon = findViewById(R.id.saveButon);
|
||||||
scrapButton = findViewById(R.id.scrapTutorTab);
|
scrapButton = findViewById(R.id.scrapTutorTab);
|
||||||
addDutyButton = findViewById(R.id.addDuty);
|
addDutyButton = findViewById(R.id.addDuty);
|
||||||
dutyHoursRecycller = findViewById(R.id.dutyHourView);
|
dutyHoursRecycller = findViewById(R.id.dutyHourView);
|
||||||
@ -96,6 +118,8 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
|
|
||||||
getTutorTab();
|
getTutorTab();
|
||||||
|
|
||||||
|
// findViewById(R.id.contentTutorTabInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_tutor_tab));
|
||||||
|
|
||||||
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
|
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
|
||||||
|
|
||||||
disposable.add(
|
disposable.add(
|
||||||
@ -212,6 +236,7 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
}else{
|
}else{
|
||||||
userEmail.setError(getString(R.string.error_invalid_email));
|
userEmail.setError(getString(R.string.error_invalid_email));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +286,7 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
Toast.makeText(getApplicationContext(),
|
Toast.makeText(getApplicationContext(),
|
||||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
|
||||||
Log.e("WMI SUCC", String.valueOf(error));
|
Log.e("WMI SUCC", String.valueOf(error));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -278,26 +304,4 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmailValid(String email)
|
|
||||||
{
|
|
||||||
String regExpn =
|
|
||||||
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
|
|
||||||
+"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
|
|
||||||
+"[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
|
|
||||||
+"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
|
|
||||||
+"[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
|
|
||||||
+"([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$";
|
|
||||||
|
|
||||||
CharSequence inputStr = email;
|
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(regExpn,Pattern.CASE_INSENSITIVE);
|
|
||||||
Matcher matcher = pattern.matcher(inputStr);
|
|
||||||
|
|
||||||
return matcher.matches();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import android.app.Fragment;
|
|||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.CoordinatorLayout;
|
import android.support.design.widget.CoordinatorLayout;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
@ -15,7 +14,6 @@ import android.support.v7.widget.RecyclerView;
|
|||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.format.DateFormat;
|
|
||||||
import android.text.style.ImageSpan;
|
import android.text.style.ImageSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@ -26,24 +24,21 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.github.ybq.android.spinkit.SpinKitView;
|
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
|
||||||
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
||||||
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
import com.uam.wmi.findmytutor.model.User;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.CoordinateService;
|
|
||||||
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||||
@ -51,21 +46,14 @@ import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
|||||||
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.ObservableSource;
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.functions.Function;
|
|
||||||
import io.reactivex.observers.DisposableObserver;
|
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
@ -81,18 +69,13 @@ public class UsersListFragment extends Fragment {
|
|||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
@BindView(R.id.txt_empty_notes_view)
|
@BindView(R.id.txt_empty_notes_view)
|
||||||
TextView noNotesView;
|
TextView noNotesView;
|
||||||
@BindView(R.id.loader)
|
|
||||||
SpinKitView loader;
|
|
||||||
|
|
||||||
private SearchView searchView;
|
private SearchView searchView;
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
private TutorTabApi tutorTabService;
|
private TutorTabApi tutorTabService;
|
||||||
private CoordinateService coordinateService;
|
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
private TutorsListAdapter mAdapter;
|
private TutorsListAdapter mAdapter;
|
||||||
private List<User> tutorsList = new ArrayList<>();
|
private List<User> tutorsList = new ArrayList<>();
|
||||||
private HashMap<String, String> tutorsTimeStamps = new HashMap<>();
|
|
||||||
|
|
||||||
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
||||||
private Boolean fetchOnlyOnlineUsers = PrefUtils.getShowOnlyOnlineUsers(getApplicationContext());
|
private Boolean fetchOnlyOnlineUsers = PrefUtils.getShowOnlyOnlineUsers(getApplicationContext());
|
||||||
|
|
||||||
@ -104,7 +87,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
mAdapter = new TutorsListAdapter(getActivity().getApplicationContext(), tutorsList, tutorsTimeStamps);
|
mAdapter = new TutorsListAdapter(getActivity().getApplicationContext(), tutorsList);
|
||||||
View view = inflater.inflate(R.layout.users_list, container, false);
|
View view = inflater.inflate(R.layout.users_list, container, false);
|
||||||
view.setBackgroundColor(getResources().getColor(android.R.color.white));
|
view.setBackgroundColor(getResources().getColor(android.R.color.white));
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
@ -116,10 +99,9 @@ public class UsersListFragment extends Fragment {
|
|||||||
|
|
||||||
userService = ApiClient.getClient(getApplicationContext())
|
userService = ApiClient.getClient(getApplicationContext())
|
||||||
.create(UserService.class);
|
.create(UserService.class);
|
||||||
|
|
||||||
tutorTabService = ApiClient.getClient(getActivity().getApplicationContext())
|
tutorTabService = ApiClient.getClient(getActivity().getApplicationContext())
|
||||||
.create(TutorTabApi.class);
|
.create(TutorTabApi.class);
|
||||||
coordinateService = ApiClient.getClient(getApplicationContext())
|
|
||||||
.create(CoordinateService.class);
|
|
||||||
|
|
||||||
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
|
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
|
||||||
recyclerView.setLayoutManager(mLayoutManager);
|
recyclerView.setLayoutManager(mLayoutManager);
|
||||||
@ -127,10 +109,8 @@ public class UsersListFragment extends Fragment {
|
|||||||
recyclerView.setVerticalScrollBarEnabled(true);
|
recyclerView.setVerticalScrollBarEnabled(true);
|
||||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL, 16));
|
recyclerView.addItemDecoration(new MyDividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL, 16));
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
noNotesView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
fetchAllTutors();
|
fetchAllTutors();
|
||||||
fetchTopCords();
|
|
||||||
|
|
||||||
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getActivity().getApplicationContext(),
|
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getActivity().getApplicationContext(),
|
||||||
recyclerView, new RecyclerTouchListener.ClickListener() {
|
recyclerView, new RecyclerTouchListener.ClickListener() {
|
||||||
@ -213,9 +193,6 @@ public class UsersListFragment extends Fragment {
|
|||||||
TextView userRoom = view.findViewById(R.id.userRoom);
|
TextView userRoom = view.findViewById(R.id.userRoom);
|
||||||
TextView userEmail = view.findViewById(R.id.userEmail);
|
TextView userEmail = view.findViewById(R.id.userEmail);
|
||||||
TextView department = view.findViewById(R.id.userDepartment);
|
TextView department = view.findViewById(R.id.userDepartment);
|
||||||
TextView userStatusLabel = view.findViewById(R.id.user_status_label);
|
|
||||||
LinearLayout userStatusLabelLL = view.findViewById(R.id.user_status_label_linearLayout);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
|
||||||
@ -245,15 +222,15 @@ public class UsersListFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||||
final AlertDialog alertDialog;
|
final AlertDialog alertDialog;
|
||||||
if (((MapActivity) getActivity()).coordsMap.containsKey(user.getId())) {
|
if (((MapActivity) getActivity()).markerUserHash.containsValue(user.getId())) {
|
||||||
|
|
||||||
alertDialogBuilderUserInput.setPositiveButton(R.string.show_on_map, (dialog, id) -> {
|
alertDialogBuilderUserInput.setPositiveButton(R.string.show_on_map, (dialog, id) -> {
|
||||||
// User cancelled the dialog
|
// User cancelled the dialog
|
||||||
((MapActivity) getActivity()).activeFragment = ActiveFragment.NONE;
|
|
||||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||||
fragmentTransaction.hide(usersListFragment);
|
fragmentTransaction.hide(usersListFragment);
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
((MapActivity) getActivity()).searchUser(user.getFirstName());
|
List<User> list = new ArrayList<User>();
|
||||||
|
list.add(user);
|
||||||
|
((MapActivity) getActivity()).filterMarkers(list);
|
||||||
((MapActivity) getActivity()).updateNavigationBarState();
|
((MapActivity) getActivity()).updateNavigationBarState();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -277,16 +254,6 @@ public class UsersListFragment extends Fragment {
|
|||||||
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
|
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
|
||||||
userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
|
userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
|
||||||
|
|
||||||
Coordinate coordinate = ((MapActivity) getActivity()).coordsMap.get(user.getId());
|
|
||||||
if (coordinate != null){
|
|
||||||
String label = coordinate.getLabel();
|
|
||||||
if (!label.isEmpty()) {
|
|
||||||
userStatusLabelLL.setVisibility(View.VISIBLE);
|
|
||||||
userStatusLabel.setText(String.format("%s: %s", getString(R.string.user_status_label),label));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(),
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(),
|
||||||
R.layout.duty_hours_item, dutyHoursList);
|
R.layout.duty_hours_item, dutyHoursList);
|
||||||
|
|
||||||
@ -306,28 +273,10 @@ public class UsersListFragment extends Fragment {
|
|||||||
disposable.add(
|
disposable.add(
|
||||||
(fetchOnlyOnlineUsers ?
|
(fetchOnlyOnlineUsers ?
|
||||||
userService.getAllActiveTutors() :
|
userService.getAllActiveTutors() :
|
||||||
userService.getAllTutors())
|
userService.getAllOfflineTutors())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.map(this::mapUsersToSortedList)
|
.map(tutors -> {
|
||||||
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<User> users) {
|
|
||||||
tutorsList.clear();
|
|
||||||
tutorsList.addAll(users);
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
toggleEmptyNotes();
|
|
||||||
fetchTopCords();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
showError(e);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<User> mapUsersToSortedList(List<User> tutors) {
|
|
||||||
List<User> tutorsList = new ArrayList<>(tutors);
|
List<User> tutorsList = new ArrayList<>(tutors);
|
||||||
List<User> onlineTutors = Stream.of(tutorsList).filter(User::isIsOnline).toList();
|
List<User> onlineTutors = Stream.of(tutorsList).filter(User::isIsOnline).toList();
|
||||||
List<User> activeNotOnlineTutors = Stream.of(tutorsList)
|
List<User> activeNotOnlineTutors = Stream.of(tutorsList)
|
||||||
@ -344,8 +293,24 @@ public class UsersListFragment extends Fragment {
|
|||||||
sortedUserList.addAll(notActiveTutors);
|
sortedUserList.addAll(notActiveTutors);
|
||||||
|
|
||||||
return sortedUserList;
|
return sortedUserList;
|
||||||
|
})
|
||||||
|
.subscribeWith(new DisposableSingleObserver<List<User>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<User> users) {
|
||||||
|
tutorsList.clear();
|
||||||
|
tutorsList.addAll(users);
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
toggleEmptyNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
showError(e);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void searchTutorInBackend(String searchString) {
|
private void searchTutorInBackend(String searchString) {
|
||||||
disposable.add(
|
disposable.add(
|
||||||
userService.searchUser(searchString)
|
userService.searchUser(searchString)
|
||||||
@ -369,7 +334,6 @@ public class UsersListFragment extends Fragment {
|
|||||||
|
|
||||||
public void restoreUsersList() {
|
public void restoreUsersList() {
|
||||||
fetchAllTutors();
|
fetchAllTutors();
|
||||||
fetchTopCords();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int sortByUserName(User t1, User t2) {
|
private int sortByUserName(User t1, User t2) {
|
||||||
@ -414,10 +378,9 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toggleEmptyNotes() {
|
private void toggleEmptyNotes() {
|
||||||
loader.setVisibility(View.GONE);
|
if (tutorsList.size() > 0) {
|
||||||
noNotesView.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
if (tutorsList.size() == 0) {
|
|
||||||
noNotesView.setVisibility(View.VISIBLE);
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
if (fetchOnlyOnlineUsers)
|
if (fetchOnlyOnlineUsers)
|
||||||
noNotesView.setText(R.string.no_online_users);
|
noNotesView.setText(R.string.no_online_users);
|
||||||
@ -427,35 +390,6 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fetchTopCords(){
|
|
||||||
disposable.add(
|
|
||||||
coordinateService.getTopCoordinates()
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(this::addTimestamps,this::showError));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addTimestamps(List<Coordinate> coordinates) {
|
|
||||||
for (Coordinate crd :
|
|
||||||
coordinates) {
|
|
||||||
Long ts = crd.getTimeStamp();
|
|
||||||
tutorsTimeStamps.put(crd.getUserId(), getDate(ts));
|
|
||||||
}
|
|
||||||
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDate(long time) {
|
|
||||||
Calendar cal = Calendar.getInstance(Locale.ENGLISH);
|
|
||||||
cal.setTimeInMillis(time);
|
|
||||||
return DateFormat.format("HH:mm dd/MM", cal).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -478,4 +412,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,11 +1,8 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.RequiresApi;
|
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
@ -30,7 +27,6 @@ import android.widget.Switch;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.github.ybq.android.spinkit.SpinKitView;
|
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.adapters.WhiteListAdapter;
|
import com.uam.wmi.findmytutor.adapters.WhiteListAdapter;
|
||||||
@ -39,7 +35,6 @@ import com.uam.wmi.findmytutor.model.StudentIdModel;
|
|||||||
import com.uam.wmi.findmytutor.model.User;
|
import com.uam.wmi.findmytutor.model.User;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||||
@ -49,6 +44,7 @@ import com.uam.wmi.findmytutor.utils.WrapContentLinearLayoutManager;
|
|||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -58,7 +54,6 @@ import io.reactivex.Observable;
|
|||||||
import io.reactivex.ObservableSource;
|
import io.reactivex.ObservableSource;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.functions.Function;
|
import io.reactivex.functions.Function;
|
||||||
import io.reactivex.observers.DisposableObserver;
|
import io.reactivex.observers.DisposableObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
@ -66,6 +61,11 @@ import okhttp3.ResponseBody;
|
|||||||
|
|
||||||
public class WhiteList extends AppCompatActivity {
|
public class WhiteList extends AppCompatActivity {
|
||||||
|
|
||||||
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
private UserService userService;
|
||||||
|
private boolean didFetched = false;
|
||||||
|
private String tutorId;
|
||||||
|
|
||||||
@BindView(R.id.recycler_view_whitelist)
|
@BindView(R.id.recycler_view_whitelist)
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
@BindView(R.id.white_list_empty_text_view)
|
@BindView(R.id.white_list_empty_text_view)
|
||||||
@ -75,42 +75,27 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
@BindView(R.id.add_to_white_list_fab)
|
@BindView(R.id.add_to_white_list_fab)
|
||||||
FloatingActionButton addToWhiteListFab;
|
FloatingActionButton addToWhiteListFab;
|
||||||
|
|
||||||
@BindView(R.id.loader)
|
|
||||||
SpinKitView loader;
|
|
||||||
|
|
||||||
|
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
|
||||||
private UserService userService;
|
|
||||||
private boolean didFetched = false;
|
|
||||||
private String tutorId;
|
|
||||||
private WhiteListAdapter mAdapter;
|
private WhiteListAdapter mAdapter;
|
||||||
private Integer prevSize;
|
private Integer prevSize;
|
||||||
private List<User> whitelistedUsers = new ArrayList<>();
|
private List<User> whitelistedUsers = new ArrayList<>();
|
||||||
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
setContentView(R.layout.activity_white_list);
|
setContentView(R.layout.activity_white_list);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
tutorId = PrefUtils.getUserId(getApplicationContext());
|
tutorId = PrefUtils.getUserId(getApplicationContext());
|
||||||
userService = ApiClient.getClient(getApplicationContext())
|
userService = ApiClient.getClient(getApplicationContext())
|
||||||
.create(UserService.class);
|
.create(UserService.class);
|
||||||
|
|
||||||
if (PrefUtils.isWhiteListing(this)) {
|
if (PrefUtils.isWhiteListing(this)){
|
||||||
aSwitch.setText(getString(R.string.action_white_list) +" "+getString(R.string.on) );
|
aSwitch.setText(getString(R.string.action_white_list) +" ON");
|
||||||
aSwitch.setChecked(true);
|
aSwitch.setChecked(true);
|
||||||
handleChangeRequest(true);
|
handleChangeRequest(true);
|
||||||
} else {
|
}else{
|
||||||
aSwitch.setText(getString(R.string.action_white_list) +" "+getString(R.string.off) );
|
aSwitch.setText(getString(R.string.action_white_list) +" OFF");
|
||||||
aSwitch.setChecked(false);
|
aSwitch.setChecked(false);
|
||||||
handleChangeRequest(false);
|
handleChangeRequest(false);
|
||||||
}
|
}
|
||||||
@ -124,7 +109,6 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
noNotesView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On long press on RecyclerView item, open alert dialog
|
* On long press on RecyclerView item, open alert dialog
|
||||||
@ -163,32 +147,34 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchWhiteListedUsers() {
|
private void fetchWhiteListedUsers() {
|
||||||
disposable.add(getListOfWhitelistedUsers(tutorId)
|
|
||||||
.doOnSubscribe(this::handleDoOnSubscribe)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.flatMap(Observable::fromIterable)
|
|
||||||
.flatMap(this::getUserObservable)
|
|
||||||
.subscribe(user -> whitelistedUsers.add(user), this::handleError,this::handleComplete));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleDoOnSubscribe(Disposable disposable) {
|
|
||||||
prevSize = whitelistedUsers.size();
|
prevSize = whitelistedUsers.size();
|
||||||
whitelistedUsers.clear();
|
whitelistedUsers.clear();
|
||||||
didFetched = false;
|
|
||||||
|
disposable.add(getListOfWhitelistedUsers(tutorId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.flatMap((Function<List<String>, Observable<String>>) Observable::fromIterable)
|
||||||
|
.flatMap((Function<String, ObservableSource<User>>) this::getUserObservable)
|
||||||
|
.subscribeWith(new DisposableObserver<User>() {
|
||||||
|
@Override
|
||||||
|
public void onNext(User user) {
|
||||||
|
whitelistedUsers.add(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleComplete() {
|
@Override
|
||||||
Collections.sort(whitelistedUsers, this::sortByUserName);
|
public void onError(Throwable e) {
|
||||||
didFetched = true;
|
showError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Collections.sort(whitelistedUsers, (a, b) -> sortByUserName(a,b));
|
||||||
refreshUI();
|
refreshUI();
|
||||||
}
|
}
|
||||||
private void handleError(Throwable e){
|
}));
|
||||||
showError(e);
|
|
||||||
didFetched = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshUI() {
|
private void refreshUI(){
|
||||||
toggleEmptyNotes();
|
toggleEmptyNotes();
|
||||||
mAdapter.notifyItemRangeInserted(prevSize, whitelistedUsers.size() - prevSize);
|
mAdapter.notifyItemRangeInserted(prevSize, whitelistedUsers.size() - prevSize);
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
@ -198,7 +184,7 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
return plCollator.compare(t1.getLastName(), t2.getLastName());
|
return plCollator.compare(t1.getLastName(), t2.getLastName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFabDialog(View v) {
|
private void showFabDialog(View v){
|
||||||
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getApplicationContext());
|
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getApplicationContext());
|
||||||
@SuppressLint("InflateParams") View view = layoutInflaterAndroid.inflate(R.layout.white_list_fab_modal, null);
|
@SuppressLint("InflateParams") View view = layoutInflaterAndroid.inflate(R.layout.white_list_fab_modal, null);
|
||||||
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(this);
|
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(this);
|
||||||
@ -244,7 +230,7 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
userService.addStudentToWhitelist(tutorId, studentIdModel)
|
userService.addStudentToWhitelist(tutorId, studentIdModel)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleAddUser, this::showError)
|
.subscribe(this::handleAddUser,this::showError)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,34 +251,30 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
message = "Network Error !";
|
message = "Network Error !";
|
||||||
}
|
}
|
||||||
Log.e("ERR", message);
|
Log.e("ERR",message);
|
||||||
Toast.makeText(this, message, Snackbar.LENGTH_LONG).show();
|
Toast.makeText(this, message, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleEmptyNotes() {
|
private void toggleEmptyNotes() {
|
||||||
|
|
||||||
if (didFetched && whitelistedUsers.size() == 0) {
|
if (didFetched && whitelistedUsers.size() == 0) {
|
||||||
noNotesView.setVisibility(View.VISIBLE);
|
|
||||||
noNotesView.setText(R.string.list_is_empty);
|
noNotesView.setText(R.string.list_is_empty);
|
||||||
loader.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
} else if (whitelistedUsers.size() > 0) {
|
}else if (whitelistedUsers.size() > 0) {
|
||||||
noNotesView.setVisibility(View.GONE);
|
noNotesView.setVisibility(View.GONE);
|
||||||
loader.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
loader.setVisibility(View.VISIBLE);
|
noNotesView.setText(getString(R.string.loading));
|
||||||
|
noNotesView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
if (item.getItemId() == R.id.action_whitelist_info_popup) {
|
if (item.getItemId()==R.id.action_whitelist_info_popup){
|
||||||
int layoutID = R.layout.info_popup_whitelist;
|
int layoutID = R.layout.info_popup_whitelist;
|
||||||
|
|
||||||
View popupView = getLayoutInflater().inflate(layoutID, null);
|
View popupView = getLayoutInflater().inflate(layoutID,null);
|
||||||
|
|
||||||
PopupWindow popupWindow = new PopupWindow(popupView,
|
PopupWindow popupWindow = new PopupWindow(popupView,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
@ -301,36 +283,36 @@ public class WhiteList extends AppCompatActivity {
|
|||||||
// If you need the PopupWindow to dismiss when when touched outside
|
// If you need the PopupWindow to dismiss when when touched outside
|
||||||
popupWindow.setBackgroundDrawable(new ColorDrawable());
|
popupWindow.setBackgroundDrawable(new ColorDrawable());
|
||||||
// Get the View's(the one that was clicked in the Fragment) location
|
// Get the View's(the one that was clicked in the Fragment) location
|
||||||
View anchorView = getWindow().getDecorView().findViewById(android.R.id.content);
|
View anchorView= getWindow().getDecorView().findViewById(android.R.id.content);
|
||||||
popupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.END, 0, 0);
|
popupWindow.showAtLocation(anchorView,Gravity.TOP|Gravity.END, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSwitch() {
|
private void handleSwitch(){
|
||||||
aSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
aSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
if (isChecked) {
|
if (isChecked){
|
||||||
aSwitch.setText(getString(R.string.action_white_list) + " " + getString(R.string.on));
|
aSwitch.setText(getString(R.string.action_white_list) + " "+ getString(R.string.on));
|
||||||
handleChangeRequest(true);
|
handleChangeRequest(true);
|
||||||
PrefUtils.useWhitelist(this, true);
|
PrefUtils.useWhitelist(this, true);
|
||||||
} else {
|
}else {
|
||||||
aSwitch.setText(getString(R.string.action_white_list) + " " + getString(R.string.off));
|
aSwitch.setText(getString(R.string.action_white_list) + " "+getString(R.string.off));
|
||||||
handleChangeRequest(false);
|
handleChangeRequest(false);
|
||||||
PrefUtils.useWhitelist(this, false);
|
PrefUtils.useWhitelist(this, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleChangeRequest(boolean value) {
|
private void handleChangeRequest(boolean value){
|
||||||
IsUsingListBool isUsingListBool = new IsUsingListBool();
|
IsUsingListBool isUsingListBool = new IsUsingListBool();
|
||||||
isUsingListBool.setIsUsing(value);
|
isUsingListBool.setIsUsing(value);
|
||||||
disposable.add(
|
disposable.add(
|
||||||
userService.setTutorWhitelist(tutorId, isUsingListBool)
|
userService.setTutorWhitelist(tutorId, isUsingListBool)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(() -> {
|
.subscribe(()->{
|
||||||
}, this::showError)
|
},this::showError)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/*
|
|
||||||
package com.uam.wmi.findmytutor.adapters;
|
package com.uam.wmi.findmytutor.adapters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -10,11 +9,9 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.github.ybq.android.spinkit.SpinKitView;
|
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
import com.uam.wmi.findmytutor.model.User;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
@ -25,12 +22,10 @@ public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.My
|
|||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private List<User> tutorsList;
|
private List<User> tutorsList;
|
||||||
private HashMap<String, String> tutorsTimeStamps;
|
|
||||||
|
|
||||||
public TutorsListAdapter(Context context, List<User> tutors, HashMap<String,String> tutorsTimeStamps) {
|
public TutorsListAdapter(Context context, List<User> tutors) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.tutorsList = tutors;
|
this.tutorsList = tutors;
|
||||||
this.tutorsTimeStamps = tutorsTimeStamps;
|
|
||||||
}
|
}
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@ -46,32 +41,17 @@ public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.My
|
|||||||
Drawable image = null;
|
Drawable image = null;
|
||||||
User tutor = tutorsList.get(position);
|
User tutor = tutorsList.get(position);
|
||||||
|
|
||||||
holder.firstName.setText(String.format("%s %s", tutor.getFirstName(), tutor.getLastName()));
|
holder.firstName.setText(tutor.getFirstName());
|
||||||
String ts = tutorsTimeStamps.get(tutor.getId());
|
holder.lastName.setText(tutor.getLastName());
|
||||||
|
|
||||||
if (tutor.isIsOnline()) {
|
if (tutor.isIsOnline()) {
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_online);
|
image = context.getResources().getDrawable(R.drawable.user_list_online);
|
||||||
holder.lastSeen.setText(R.string.available_now);
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_offline);
|
image = context.getResources().getDrawable(R.drawable.user_list_offline);
|
||||||
|
|
||||||
if (ts != null){
|
|
||||||
holder.lastSeen.setText(R.string.last_sign);
|
|
||||||
holder.lastSeen.append(String.format(": %s", ts));
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tutor.isIsActive()) {
|
if (!tutor.isIsActive()) {
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_off);
|
image = context.getResources().getDrawable(R.drawable.user_list_off);
|
||||||
if(ts != null){
|
|
||||||
holder.lastSeen.setText(R.string.last_sign);
|
|
||||||
holder.lastSeen.append(String.format(": %s", ts));
|
|
||||||
}else{
|
|
||||||
holder.lastSeen.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
||||||
@ -88,132 +68,17 @@ public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.My
|
|||||||
@BindView(R.id.firstName)
|
@BindView(R.id.firstName)
|
||||||
TextView firstName;
|
TextView firstName;
|
||||||
|
|
||||||
@BindView(R.id.lastSeen)
|
@BindView(R.id.lastName)
|
||||||
TextView lastSeen;
|
TextView lastName;
|
||||||
|
|
||||||
@BindView(R.id.isOnline)
|
@BindView(R.id.isOnline)
|
||||||
TextView isOnline;
|
TextView isOnline;
|
||||||
|
|
||||||
@BindView(R.id.loader)
|
|
||||||
SpinKitView loader;
|
|
||||||
|
|
||||||
MyViewHolder(View view) {
|
MyViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
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.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.github.ybq.android.spinkit.SpinKitView;
|
|
||||||
import com.uam.wmi.findmytutor.R;
|
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
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;
|
|
||||||
private HashMap<String, String> tutorsTimeStamps;
|
|
||||||
|
|
||||||
public TutorsListAdapter(Context context, List<User> tutors, HashMap<String,String> tutorsTimeStamps) {
|
|
||||||
this.context = context;
|
|
||||||
this.tutorsList = tutors;
|
|
||||||
this.tutorsTimeStamps = tutorsTimeStamps;
|
|
||||||
}
|
|
||||||
@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(String.format("%s %s", tutor.getFirstName(), tutor.getLastName()));
|
|
||||||
String ts = tutorsTimeStamps.get(tutor.getId());
|
|
||||||
|
|
||||||
if (tutor.isIsOnline()) {
|
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_online);
|
|
||||||
holder.lastSeen.setText(R.string.available_now);
|
|
||||||
holder.lastSeen.setVisibility(View.VISIBLE);
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
} else if(tutor.isIsActive()){
|
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_offline);
|
|
||||||
|
|
||||||
if (ts != null){
|
|
||||||
holder.lastSeen.setText(R.string.last_sign);
|
|
||||||
holder.lastSeen.append(String.format(": %s", ts));
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
image = context.getResources().getDrawable(R.drawable.user_list_off);
|
|
||||||
|
|
||||||
if(ts == null){
|
|
||||||
holder.lastSeen.setText(R.string.never_logged_in);
|
|
||||||
}else{
|
|
||||||
holder.lastSeen.setText(R.string.last_sign);
|
|
||||||
holder.lastSeen.append(String.format(": %s", ts));
|
|
||||||
}
|
|
||||||
holder.loader.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
|
||||||
holder.isOnline.setCompoundDrawables(image, null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return tutorsList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
|
|
||||||
@BindView(R.id.firstName)
|
|
||||||
TextView firstName;
|
|
||||||
|
|
||||||
@BindView(R.id.lastSeen)
|
|
||||||
TextView lastSeen;
|
|
||||||
|
|
||||||
@BindView(R.id.isOnline)
|
|
||||||
TextView isOnline;
|
|
||||||
|
|
||||||
@BindView(R.id.loader)
|
|
||||||
SpinKitView loader;
|
|
||||||
|
|
||||||
MyViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,11 +34,9 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
|
|||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.Const;
|
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
import com.uam.wmi.findmytutor.utils.WifiUtils;
|
|
||||||
|
|
||||||
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
||||||
|
|
||||||
@ -124,12 +122,6 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
mCurrentLocation = locationResult.getLastLocation();
|
mCurrentLocation = locationResult.getLastLocation();
|
||||||
sendCoordinateToBackend(mCurrentLocation);
|
sendCoordinateToBackend(mCurrentLocation);
|
||||||
changeBackgroundMode();
|
changeBackgroundMode();
|
||||||
|
|
||||||
//Restart service when a user started using presence in GPS mode and wmi is currently available
|
|
||||||
if (WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
|
|
||||||
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())) {
|
|
||||||
restartService();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -148,34 +140,10 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
startForeground(1001, notification);
|
startForeground(1001, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stopService) {
|
if (!stopService && !PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())) {
|
|
||||||
if (WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())) {
|
|
||||||
Location presenceFakeLoc = new Location("");
|
|
||||||
|
|
||||||
presenceFakeLoc.setLatitude(Const.presenceLatitude);
|
|
||||||
presenceFakeLoc.setLongitude(Const.presenceLongitude);
|
|
||||||
presenceFakeLoc.setAltitude(0);
|
|
||||||
createPresenceLooper(presenceFakeLoc);
|
|
||||||
} else {
|
|
||||||
createFusedLocationClient();
|
createFusedLocationClient();
|
||||||
}
|
} else if (!stopService &&
|
||||||
} else if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.EXACT.toString())
|
PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||||
|| PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.APPROXIMATED.toString())
|
|
||||||
) {
|
|
||||||
createFusedLocationClient();
|
|
||||||
} else if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
|
||||||
Location manualFakeLoc = new Location("");
|
|
||||||
|
|
||||||
manualFakeLoc.setLatitude(0);
|
|
||||||
manualFakeLoc.setLongitude(0);
|
|
||||||
manualFakeLoc.setAltitude(0);
|
|
||||||
createLowBatteryLooper(manualFakeLoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createLowBatteryLooper(Location fakeLoc) {
|
|
||||||
mStatusChecker = () -> {
|
mStatusChecker = () -> {
|
||||||
try {
|
try {
|
||||||
sendCoordinateToBackend(fakeLoc);
|
sendCoordinateToBackend(fakeLoc);
|
||||||
@ -183,24 +151,10 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
mHandler.postDelayed(mStatusChecker, notify_interval);
|
mHandler.postDelayed(mStatusChecker, notify_interval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AsyncTask.execute(mStatusChecker);
|
AsyncTask.execute(mStatusChecker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPresenceLooper(Location fakeLoc) {
|
|
||||||
mStatusChecker = () -> {
|
|
||||||
try {
|
|
||||||
if (WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())) {
|
|
||||||
sendCoordinateToBackend(fakeLoc);
|
|
||||||
} else {
|
|
||||||
restartService();
|
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
mHandler.postDelayed(mStatusChecker, notify_interval);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
AsyncTask.execute(mStatusChecker);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void createFusedLocationClient() {
|
private void createFusedLocationClient() {
|
||||||
Integer saveMode = Long.valueOf(notify_interval).compareTo(Long.valueOf(offlineBackgroundLocationInterval));
|
Integer saveMode = Long.valueOf(notify_interval).compareTo(Long.valueOf(offlineBackgroundLocationInterval));
|
||||||
@ -214,7 +168,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
if (saveMode != 0) {
|
if (saveMode != 0) {
|
||||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||||
} else {
|
} else {
|
||||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_LOW_POWER);
|
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLocationRequest.setFastestInterval(notify_interval);
|
mLocationRequest.setFastestInterval(notify_interval);
|
||||||
@ -232,19 +186,18 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
private void changeBackgroundMode() {
|
private void changeBackgroundMode() {
|
||||||
Integer prevInterval = notify_interval;
|
Integer prevInterval = notify_interval;
|
||||||
Boolean shouldExtendTimeInterval = Stream.of(coordinatesHistory)
|
Boolean shouldExtendTimeInterval = Stream.of(coordinatesHistory)
|
||||||
.map(MapUtils::checkIfCoordinateIsValid).takeWhile(s -> !s).toList().size() == coordinatesHistoryLength;
|
.map(MapUtils::checkIfCoordinateIsValid).takeWhile(s -> !s).toList().size() == coordinatesHistory.size();
|
||||||
|
|
||||||
Boolean shouldAbbreviateTimeInterval = Stream.of(coordinatesHistory).
|
Boolean shouldAbbreviateTimeInterval = Stream.of(coordinatesHistory).
|
||||||
map(MapUtils::checkIfCoordinateIsValid).filter(x -> x).toList().size() > 0;
|
map(MapUtils::checkIfCoordinateIsValid).filter(x -> x).toList().size() > 0;
|
||||||
|
|
||||||
if (shouldExtendTimeInterval) {
|
|
||||||
notify_interval = notify_interval_outside_building;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldAbbreviateTimeInterval) {
|
if (shouldAbbreviateTimeInterval) {
|
||||||
notify_interval = notify_interval_inside_building;
|
notify_interval = notify_interval_inside_building;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (coordinatesHistory.size() > coordinatesHistoryLength && shouldExtendTimeInterval) {
|
||||||
|
notify_interval = notify_interval_outside_building;
|
||||||
|
}
|
||||||
|
|
||||||
Integer changedMode = Long.valueOf(prevInterval).compareTo(Long.valueOf(notify_interval));
|
Integer changedMode = Long.valueOf(prevInterval).compareTo(Long.valueOf(notify_interval));
|
||||||
if (changedMode != 0) {
|
if (changedMode != 0) {
|
||||||
@ -340,7 +293,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
latitude = location.getLatitude();
|
latitude = location.getLatitude();
|
||||||
longitude = location.getLongitude();
|
longitude = location.getLongitude();
|
||||||
altitude = location.getAltitude();
|
altitude = location.getAltitude();
|
||||||
Log.e(TAG, "TASK" + latitude + " " + longitude);
|
|
||||||
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
||||||
approximatedBuildingPart = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(longitude, latitude));
|
approximatedBuildingPart = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(longitude, latitude));
|
||||||
}
|
}
|
||||||
@ -353,7 +306,6 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
||||||
if (!MapUtils.checkIfCoordinateIsValid(latitude, longitude)) {
|
if (!MapUtils.checkIfCoordinateIsValid(latitude, longitude)) {
|
||||||
coordinatesHistory.add(fakeLoc);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public interface CoordinateService {
|
|||||||
Single<List<Coordinate>> getCoordinatesByUserId(@Path("userId") String userId);
|
Single<List<Coordinate>> getCoordinatesByUserId(@Path("userId") String userId);
|
||||||
|
|
||||||
@GET("api/coordinates/userTop/{userId}")
|
@GET("api/coordinates/userTop/{userId}")
|
||||||
Single <Coordinate> getTopCoordinateByUserId(@Path("userId") String userId);
|
Single<List<Coordinate>> getTopCoordinatesByUserId(@Path("userId") String userId);
|
||||||
|
|
||||||
@GET("api/coordinates/top")
|
@GET("api/coordinates/top")
|
||||||
Single<List<Coordinate>> getTopCoordinates();
|
Single<List<Coordinate>> getTopCoordinates();
|
||||||
@ -42,6 +42,4 @@ public interface CoordinateService {
|
|||||||
@DELETE("api/coordinates/{id}")
|
@DELETE("api/coordinates/{id}")
|
||||||
Completable deleteCoordinatesById(@Path("id") String id);
|
Completable deleteCoordinatesById(@Path("id") String id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,6 @@ public interface UserService {
|
|||||||
@GET("api/users/tutors/active")
|
@GET("api/users/tutors/active")
|
||||||
Single <List<User>> getAllActiveTutors();
|
Single <List<User>> getAllActiveTutors();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GET("api/users/tutors/offline")
|
@GET("api/users/tutors/offline")
|
||||||
Single <List<User>> getAllOfflineTutors();
|
Single <List<User>> getAllOfflineTutors();
|
||||||
|
|
||||||
@ -63,9 +60,6 @@ public interface UserService {
|
|||||||
@GET("api/users/{id}")
|
@GET("api/users/{id}")
|
||||||
Single <User> getUserById(@Path("id") String userID);
|
Single <User> getUserById(@Path("id") String userID);
|
||||||
|
|
||||||
@GET("api/users/self/{id}")
|
|
||||||
Single <User> getSelf(@Path("id") String userID);
|
|
||||||
|
|
||||||
@PUT("api/users/{id}")
|
@PUT("api/users/{id}")
|
||||||
Completable updateUserByID(@Path("id") String userID, @Body User user);
|
Completable updateUserByID(@Path("id") String userID, @Body User user);
|
||||||
|
|
||||||
|
@ -17,10 +17,8 @@ public class Const {
|
|||||||
public final static String presenceApproximatedName = "Unknown";
|
public final static String presenceApproximatedName = "Unknown";
|
||||||
public final static Range<Double> buildingLatitudeRange = Range.create(52.466092, 52.467529);
|
public final static Range<Double> buildingLatitudeRange = Range.create(52.466092, 52.467529);
|
||||||
public final static Range<Double> buildingLongitudeRange = Range.create(16.926159, 16.927759);
|
public final static Range<Double> buildingLongitudeRange = Range.create(16.926159, 16.927759);
|
||||||
public final static Range<Double> outsideLatitudeRange = Range.create(52.4651, 52.468837);
|
public final static Range<Double> outsideLatitudeRange = Range.create(52.463512, 52.468837);
|
||||||
public final static Range<Double> outsideLongitudeRange = Range.create(16.9186, 16.936004);
|
public final static Range<Double> outsideLongitudeRange = Range.create(16.922372, 16.936004);
|
||||||
public final static List<String> validApproximatedLocations = Arrays.asList("Skrzydło B", "Skrzydło A", "Aule", "Łącznik", "Biblioteka", "Hol", "Unknown");
|
public final static List<String> validApproximatedLocations = Arrays.asList("Skrzydło B", "Skrzydło A", "Aule", "Łącznik", "Biblioteka", "Hol", "Unknown");
|
||||||
public final static String WMI_SSID_NAME = "wmi";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class LocaleHelper {
|
|
||||||
|
|
||||||
private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language";
|
|
||||||
|
|
||||||
public static Context onAttach(Context context) {
|
|
||||||
String lang = getPersistedData(context, Locale.getDefault().getLanguage());
|
|
||||||
return setLocale(context, lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context onAttach(Context context, String defaultLanguage) {
|
|
||||||
String lang = getPersistedData(context, defaultLanguage);
|
|
||||||
return setLocale(context, lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getLanguage(Context context) {
|
|
||||||
return getPersistedData(context, Locale.getDefault().getLanguage());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context setLocale(Context context, String language) {
|
|
||||||
persist(context, language);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
return updateResources(context, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
return updateResourcesLegacy(context, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getPersistedData(Context context, String defaultLanguage) {
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
return preferences.getString(SELECTED_LANGUAGE, defaultLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void persist(Context context, String language) {
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
|
|
||||||
editor.putString(SELECTED_LANGUAGE, language);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
|
||||||
private static Context updateResources(Context context, String language) {
|
|
||||||
Locale locale = new Locale(language);
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
Configuration configuration = context.getResources().getConfiguration();
|
|
||||||
configuration.setLocale(locale);
|
|
||||||
|
|
||||||
return context.createConfigurationContext(configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private static Context updateResourcesLegacy(Context context, String language) {
|
|
||||||
Locale locale = new Locale(language);
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
Resources resources = context.getResources();
|
|
||||||
|
|
||||||
Configuration configuration = resources.getConfiguration();
|
|
||||||
configuration.locale = locale;
|
|
||||||
|
|
||||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +1,10 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
package com.uam.wmi.findmytutor.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
|
||||||
import android.support.v4.os.ConfigurationCompat;
|
import android.support.v4.os.ConfigurationCompat;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class LocaleUtils {
|
public class LocaleUtils {
|
||||||
public static String getCurrentLocale() {
|
public static String getCurrentLocale(){
|
||||||
return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()));
|
return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Context updateResources(Context context, String language) {
|
|
||||||
Locale locale = new Locale(language);
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
Resources res = context.getResources();
|
|
||||||
Configuration config = new Configuration(res.getConfiguration());
|
|
||||||
if (Build.VERSION.SDK_INT >= 22) {
|
|
||||||
config.setLocale(locale);
|
|
||||||
context = context.createConfigurationContext(config);
|
|
||||||
} else {
|
|
||||||
config.locale = locale;
|
|
||||||
res.updateConfiguration(config, res.getDisplayMetrics());
|
|
||||||
}
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
package com.uam.wmi.findmytutor.utils;
|
||||||
|
|
||||||
import android.animation.TypeEvaluator;
|
import android.animation.TypeEvaluator;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.net.Uri;
|
|
||||||
import android.provider.Settings;
|
|
||||||
|
|
||||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||||
@ -14,15 +10,12 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
|
|||||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||||
import com.mapbox.mapboxsdk.maps.MapView;
|
import com.mapbox.mapboxsdk.maps.MapView;
|
||||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||||
import com.uam.wmi.findmytutor.R;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.outsideLatitudeRange;
|
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.outsideLongitudeRange;
|
import static com.uam.wmi.findmytutor.utils.Const.outsideLongitudeRange;
|
||||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.shouldBatteryExclusionBeShown;
|
import static com.uam.wmi.findmytutor.utils.Const.outsideLatitudeRange;
|
||||||
|
|
||||||
public class MapUtils {
|
public class MapUtils {
|
||||||
|
|
||||||
@ -80,34 +73,14 @@ public class MapUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean checkIfCoordinateIsValid(Location coordinate) {
|
public static Boolean checkIfCoordinateIsValid(Location coordinate){
|
||||||
return outsideLatitudeRange.contains(coordinate.getLatitude()) && outsideLongitudeRange.contains(coordinate.getLongitude());
|
return outsideLatitudeRange.contains(coordinate.getLatitude()) && outsideLongitudeRange.contains(coordinate.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean checkIfCoordinateIsValid(Double latitude, Double longitude) {
|
public static Boolean checkIfCoordinateIsValid(Double latitude, Double longitude){
|
||||||
return Const.buildingLatitudeRange.contains(latitude) && Const.buildingLongitudeRange.contains(longitude);
|
return Const.buildingLatitudeRange.contains(latitude) && Const.buildingLongitudeRange.contains(longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BatteryOptimizationsExceptionCheck(Context context) {
|
|
||||||
if (shouldBatteryExclusionBeShown(getApplicationContext())) {
|
|
||||||
PrefUtils.setBatteryExlusionInfoStatus(getApplicationContext(), false);
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
|
||||||
builder.setTitle(R.string.batter_exclusions_title);
|
|
||||||
builder.setMessage(R.string.batter_exclusions_message)
|
|
||||||
.setPositiveButton(R.string.ok, (dialog, id) -> {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
||||||
Uri uri = Uri.fromParts("package", getApplicationContext().getPackageName(), null);
|
|
||||||
intent.setData(uri);
|
|
||||||
context.startActivity(intent);
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.cancel, (dialog, id) -> {
|
|
||||||
|
|
||||||
}).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function for marker animation
|
// Function for marker animation
|
||||||
public static class LatLngEvaluator implements TypeEvaluator<LatLng> {
|
public static class LatLngEvaluator implements TypeEvaluator<LatLng> {
|
||||||
// Method is used to interpolate the marker animation.
|
// Method is used to interpolate the marker animation.
|
||||||
|
@ -243,13 +243,4 @@ public class PrefUtils {
|
|||||||
return getSharedPreferences(context).getBoolean("whitelisting", false);
|
return getSharedPreferences(context).getBoolean("whitelisting", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean shouldBatteryExclusionBeShown(Context context) {
|
|
||||||
return getSharedPreferences(context).getBoolean("show_battery_exclusion", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBatteryExlusionInfoStatus(Context context, Boolean flag) {
|
|
||||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
|
||||||
editor.putBoolean("show_battery_exclusion", flag);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,13 +1,16 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
package com.uam.wmi.findmytutor.utils;
|
||||||
|
|
||||||
|
|
||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.subjects.PublishSubject;
|
import io.reactivex.subjects.PublishSubject;
|
||||||
|
|
||||||
|
|
||||||
public class RxSearchObservable {
|
public class RxSearchObservable {
|
||||||
|
|
||||||
private RxSearchObservable() {
|
private RxSearchObservable() {
|
||||||
|
// no instance
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Observable<String> fromView(SearchView searchView) {
|
public static Observable<String> fromView(SearchView searchView) {
|
||||||
@ -27,8 +30,13 @@ public class RxSearchObservable {
|
|||||||
subject.onNext(text);
|
subject.onNext(text);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.net.wifi.WifiInfo;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class WifiUtils {
|
|
||||||
|
|
||||||
public static String getWifiName(Context context) {
|
|
||||||
WifiManager manager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
|
||||||
if (Objects.requireNonNull(manager).isWifiEnabled()) {
|
|
||||||
WifiInfo wifiInfo = manager.getConnectionInfo();
|
|
||||||
if (wifiInfo != null) {
|
|
||||||
NetworkInfo.DetailedState state = WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState());
|
|
||||||
if (state == NetworkInfo.DetailedState.CONNECTED || state == NetworkInfo.DetailedState.OBTAINING_IPADDR) {
|
|
||||||
return wifiInfo.getSSID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Boolean checkIfUserIsInRangeOfWmiWifi(Context context) {
|
|
||||||
return Objects.equals(getWifiName(context), Const.WMI_SSID_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24">
|
|
||||||
|
|
||||||
<path
|
|
||||||
android:fillColor="#ffffff"
|
|
||||||
android:pathData="M22 10l-6-6H4c-1.1 0-2 0.9-2 2v12.01c0 1.1 0.9 1.99 2 1.99l16-0.01c1.1 0 2-0.89 2-1.99v-8zm-7-4.5l5.5 5.5H15V5.5z" />
|
|
||||||
<path
|
|
||||||
android:pathData="M0 0h24v24H0V0z" />
|
|
||||||
</vector>
|
|
@ -40,7 +40,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:text="@string/block_the_users"
|
android:text="Block the users"
|
||||||
android:textSize="15sp"/>
|
android:textSize="15sp"/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fontFamily="@font/lato_regular"
|
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:fontFamily="@font/lato_regular"
|
||||||
tools:context=".activity.LoginActivity">
|
tools:context=".activity.LoginActivity">
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
app:passwordToggleEnabled="true"
|
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@ -75,6 +74,7 @@
|
|||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/email_sign_in_button"
|
android:id="@+id/email_sign_in_button"
|
||||||
style="?android:textAppearanceSmall"
|
style="?android:textAppearanceSmall"
|
||||||
@ -84,6 +84,7 @@
|
|||||||
android:text="@string/action_log_in"
|
android:text="@string/action_log_in"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -5,29 +5,30 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fontFamily="@font/lato_regular"
|
android:fontFamily="@font/lato_regular"
|
||||||
android:id="@+id/activity_tutor_tab"
|
|
||||||
tools:context=".activity.TutorTab">
|
tools:context=".activity.TutorTab">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/app_bar"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/app_bar_height"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<android.support.design.widget.CollapsingToolbarLayout
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar_layout"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:fitsSystemWindows="true"
|
android:background="?attr/colorPrimary"
|
||||||
app:contentScrim="?attr/colorPrimary"
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
|
||||||
app:expandedTitleGravity="top|right"
|
|
||||||
app:toolbarId="@+id/toolbar"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<include layout="@layout/content_tutor_tab" />
|
<include layout="@layout/content_tutor_tab" />
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
|
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
@ -40,7 +40,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:text="@string/be_visible_for_these_users"
|
android:text="Be visible for these users"
|
||||||
android:textSize="15sp"/>
|
android:textSize="15sp"/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
|
@ -28,21 +28,6 @@
|
|||||||
android:textColor="@color/msg_no_notes"
|
android:textColor="@color/msg_no_notes"
|
||||||
android:textSize="@dimen/msg_no_notes" />
|
android:textSize="@dimen/msg_no_notes" />
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/loader"
|
|
||||||
style="@style/SpinKitView.Large.Wave"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
app:SpinKit_Color="@color/msg_no_notes"
|
|
||||||
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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:id="@+id/activity_tutor_content"
|
android:id="@+id/activity_whitelist_container"
|
||||||
tools:context=".activity.TutorTab">
|
tools:context=".activity.WhiteList">
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/app_bar"
|
android:id="@+id/app_bar"
|
||||||
@ -58,4 +57,10 @@
|
|||||||
|
|
||||||
<include layout="@layout/content_tutor_tab_layout" />
|
<include layout="@layout/content_tutor_tab_layout" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- A RecyclerView with some commonly used attributes -->
|
||||||
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
@ -1,15 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".activity.TutorTab"
|
tools:context=".activity.TutorTab"
|
||||||
android:fontFamily="@font/lato_regular"
|
tools:showIn="@layout/content_tutor_tab2">
|
||||||
tools:showIn="@layout/content_tutor_tab">
|
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
@ -24,10 +23,10 @@
|
|||||||
android:id="@+id/userDepartmentLayout"
|
android:id="@+id/userDepartmentLayout"
|
||||||
android:layout_width="189dp"
|
android:layout_width="189dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/userEmailLayout"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginStart="25dp"
|
android:layout_marginStart="25dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="95dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:layout_toEndOf="@+id/userRoomLayout">
|
android:layout_toEndOf="@+id/userRoomLayout">
|
||||||
|
|
||||||
@ -35,8 +34,6 @@
|
|||||||
android:id="@+id/userDepartment"
|
android:id="@+id/userDepartment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/userDepartmentLayout"
|
|
||||||
android:layout_alignStart="@+id/userDepartmentLayout"
|
|
||||||
android:layout_alignTop="@+id/userDepartmentLayout"
|
android:layout_alignTop="@+id/userDepartmentLayout"
|
||||||
android:hint="@string/hint_department"
|
android:hint="@string/hint_department"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
@ -50,10 +47,10 @@
|
|||||||
android:id="@+id/userRoomLayout"
|
android:id="@+id/userRoomLayout"
|
||||||
android:layout_width="115dp"
|
android:layout_width="115dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/userEmailLayout"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginTop="10dp">
|
android:layout_marginTop="95dp">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/userRoom"
|
android:id="@+id/userRoom"
|
||||||
@ -76,12 +73,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignStart="@+id/userRoomLayout"
|
android:layout_alignStart="@+id/userRoomLayout"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:text="@string/personalInfoTitle"
|
android:text="@string/personalInfoTitle"
|
||||||
android:textColor="@color/mapboxRedDark"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp" />
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/userEmailLayout"
|
android:id="@+id/userEmailLayout"
|
||||||
@ -91,7 +86,7 @@
|
|||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginTop="70dp"
|
android:layout_marginTop="50dp"
|
||||||
android:layout_marginEnd="30dp">
|
android:layout_marginEnd="30dp">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
@ -99,7 +94,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignStart="@+id/userEmailLayout"
|
android:layout_alignStart="@+id/userEmailLayout"
|
||||||
android:layout_alignTop="@+id/userEmailLayout"
|
|
||||||
android:hint="@string/hint_email"
|
android:hint="@string/hint_email"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
@ -111,34 +105,31 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dutyTitle"
|
android:id="@+id/dutyTitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_below="@+id/userRoomLayout"
|
|
||||||
android:layout_alignStart="@+id/userRoomLayout"
|
android:layout_alignStart="@+id/userRoomLayout"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_centerVertical="false"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginStart="-1dp"
|
||||||
|
android:layout_marginTop="141dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/dutyTitle"
|
android:text="@string/dutyTitle"
|
||||||
android:textColor="@color/mapboxRedDark"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp" />
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/dutyHourView"
|
android:id="@+id/dutyHourView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="300dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="100dp"
|
||||||
android:layout_below="@+id/addDuty"
|
android:layout_below="@+id/dutyTitle"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:layout_marginEnd="50dp"
|
|
||||||
android:scrollbars="vertical" />
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userNoteTitle"
|
android:id="@+id/userNoteTitle"
|
||||||
android:textStyle="bold"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/dutyHourView"
|
android:layout_below="@+id/dutyHourView"
|
||||||
android:layout_alignStart="@+id/userRoomLayout"
|
android:layout_alignStart="@+id/userRoomLayout"
|
||||||
@ -146,33 +137,31 @@
|
|||||||
android:textColor="@color/mapboxRedDark"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/addDuty"
|
android:id="@+id/addDuty"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/white"
|
android:layout_alignBottom="@+id/dutyTitle"
|
||||||
app:backgroundTint="@color/colorPrimary"
|
android:layout_marginStart="-1dp"
|
||||||
android:layout_alignBaseline="@+id/dutyTitle"
|
android:layout_marginBottom="0dp"
|
||||||
android:layout_toEndOf="@+id/dutyTitle"
|
android:layout_toEndOf="@+id/personalInfoTitle"
|
||||||
android:stateListAnimator="@null"
|
|
||||||
|
|
||||||
android:text="@string/addDuty" />
|
android:text="@string/addDuty" />
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/userNoteLayout"
|
android:id="@+id/userNoteLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/userNoteTitle"
|
android:layout_below="@+id/userNoteTitle"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
app:counterEnabled="true"
|
app:counterEnabled="true"
|
||||||
app:counterMaxLength="1000">
|
app:counterMaxLength="1000">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
|
|
||||||
android:id="@+id/userNote"
|
android:id="@+id/userNote"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="300dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_alignStart="@+id/userNoteLayout"
|
android:layout_alignStart="@+id/userNoteLayout"
|
||||||
android:hint="@string/tutorTabHint"
|
android:hint="@string/tutorTabHint"
|
||||||
@ -180,36 +169,31 @@
|
|||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
android:maxLength="1000"
|
android:maxLength="1000"
|
||||||
android:maxLines="7"
|
android:maxLines="7"
|
||||||
android:paddingTop="15dp"
|
android:paddingTop="5dp"
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
android:textColor="@color/note_list_text" />
|
android:textColor="@color/note_list_text" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/scrapTutorTab"
|
android:id="@+id/scrapTutorTab"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBaseline="@+id/personalInfoTitle"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignEnd="@+id/userEmailLayout"
|
android:layout_alignParentEnd="true"
|
||||||
android:textColor="@color/white"
|
android:layout_marginTop="0dp"
|
||||||
app:backgroundTint="@color/colorPrimary"
|
android:layout_marginEnd="30dp"
|
||||||
android:stateListAnimator="@null"
|
|
||||||
android:text="@string/scrap_tutor_tab" />
|
android:text="@string/scrap_tutor_tab" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatButton
|
<Button
|
||||||
android:id="@+id/saveButton"
|
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/saveButon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="30dp"
|
|
||||||
android:layout_marginEnd="-20dp"
|
|
||||||
android:layout_below="@+id/userNoteLayout"
|
android:layout_below="@+id/userNoteLayout"
|
||||||
android:layout_alignEnd="@+id/dutyHourView"
|
android:layout_alignEnd="@+id/dutyHourView"
|
||||||
android:textColor="@color/white"
|
|
||||||
app:backgroundTint="@color/colorPrimary"
|
|
||||||
android:stateListAnimator="@null"
|
|
||||||
|
|
||||||
android:text="@string/saveButton" />
|
android:text="@string/saveButton" />
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</android.support.v4.widget.NestedScrollView>
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
@ -28,20 +28,6 @@
|
|||||||
android:textColor="@color/msg_no_notes"
|
android:textColor="@color/msg_no_notes"
|
||||||
android:textSize="@dimen/msg_no_notes" />
|
android:textSize="@dimen/msg_no_notes" />
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/loader"
|
|
||||||
style="@style/SpinKitView.Large.Wave"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
app:SpinKit_Color="@color/msg_no_notes"
|
|
||||||
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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -1,23 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
android:fontFamily="@font/lato_regular"
|
|
||||||
>
|
>
|
||||||
|
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<android.support.v7.widget.AppCompatButton
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/button_choose_from_map"
|
android:id="@+id/button_choose_from_map"
|
||||||
android:text="@string/preference_manual_location_button"
|
android:text="@string/preference_manual_location_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:textColor="@color/white"
|
|
||||||
app:backgroundTint="@color/top_user_modal"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:stateListAnimator="@null"
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -19,22 +19,11 @@
|
|||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/note_list_text"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/loader"
|
|
||||||
style="@style/SpinKitView.Large.Wave"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginTop="35dp"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
app:SpinKit_Color="@color/colorAccent" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lastSeen"
|
android:id="@+id/lastName"
|
||||||
android:layout_width="270dp"
|
android:layout_width="270dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
@ -43,8 +32,9 @@
|
|||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:textColor="#979797"
|
android:textColor="@color/note_list_text"
|
||||||
android:textSize="13sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/isOnline"
|
android:id="@+id/isOnline"
|
||||||
|
@ -27,20 +27,19 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userName"
|
android:id="@+id/userName"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="Name Surname"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/lbl_new_note_title"
|
android:textSize="@dimen/lbl_new_note_title"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
|
android:drawablePadding="10dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"/>
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -51,28 +50,6 @@
|
|||||||
android:layout_marginTop="25dp"
|
android:layout_marginTop="25dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/user_status_label_linearLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:paddingLeft="20dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="25dp"
|
|
||||||
android:layout_height="25dp"
|
|
||||||
android:src="@drawable/user_modal_title" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/user_status_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:textColor="@color/mapboxWhite" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -82,15 +59,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_department" />
|
android:src="@drawable/user_modal_department"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userDepartment"
|
android:id="@+id/userDepartment"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -103,15 +80,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_room" />
|
android:src="@drawable/user_modal_room"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userRoom"
|
android:id="@+id/userRoom"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -124,15 +101,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_email" />
|
android:src="@drawable/user_modal_email"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userEmail"
|
android:id="@+id/userEmail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
@ -146,14 +123,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_duty" />
|
android:src="@drawable/user_modal_duty"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userDutyHoursTitle"
|
android:id="@+id/userDutyHoursTitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -173,11 +151,12 @@
|
|||||||
android:id="@+id/userDutyHours"
|
android:id="@+id/userDutyHours"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:divider="@color/background_user_modal"
|
|
||||||
android:dividerHeight="1dp"
|
|
||||||
android:paddingLeft="25dp"
|
android:paddingLeft="25dp"
|
||||||
android:paddingTop="-10dp"
|
android:paddingTop="-10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
android:divider="@color/background_user_modal"
|
||||||
|
android:dividerHeight="1dp"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -190,15 +169,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:src="@drawable/user_modal_note" />
|
android:src="@drawable/user_modal_note"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userNote"
|
android:id="@+id/userNote"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="@color/mapboxWhite"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textColor="@color/mapboxWhite" />
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,20 +27,5 @@
|
|||||||
android:textSize="@dimen/msg_no_notes" />
|
android:textSize="@dimen/msg_no_notes" />
|
||||||
|
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/loader"
|
|
||||||
style="@style/SpinKitView.Large.Wave"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
app:SpinKit_Color="@color/msg_no_notes"
|
|
||||||
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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<string name="navigation_item_blacklist">Czarna lista</string>
|
<string name="navigation_item_blacklist">Czarna lista</string>
|
||||||
<string name="navigation_item_whitelist">Biała lista</string>
|
<string name="navigation_item_whitelist">Biała lista</string>
|
||||||
<string name="navigation_item_settings">Ustawienia</string>
|
<string name="navigation_item_settings">Ustawienia</string>
|
||||||
<string name="navigation_item_profile">Profil użytkownika</string>
|
<string name="navigation_item_profile">Profil uzytkownika</string>
|
||||||
<string name="navigation_item_logout">Wyloguj</string>
|
<string name="navigation_item_logout">Wyloguj</string>
|
||||||
<!-- Tutors list -->
|
<!-- Tutors list -->
|
||||||
<string name="action_settings">Ustawienia</string>
|
<string name="action_settings">Ustawienia</string>
|
||||||
@ -276,23 +276,6 @@
|
|||||||
<!--(ENG) Blacked/Whited users -->
|
<!--(ENG) Blacked/Whited users -->
|
||||||
<string name="add_user_to_list">Użytkownik został dodany!</string>
|
<string name="add_user_to_list">Użytkownik został dodany!</string>
|
||||||
<string name="user_removed">Użytkownik usunięty!</string>
|
<string name="user_removed">Użytkownik usunięty!</string>
|
||||||
<string name="floor">Piętro</string>
|
|
||||||
<string name="block_the_users">Zablokuj użytkowników</string>
|
|
||||||
<string name="be_visible_for_these_users">Bądź dostępny dla użytkowników</string>
|
|
||||||
|
|
||||||
<string name="manual_mode">manualny</string>
|
|
||||||
<string name="exact_mode">dokładny</string>
|
|
||||||
<string name="approx_mode">przybliżony</string>
|
|
||||||
<string name="other_location">Niezapisana lokalizacja.</string>
|
|
||||||
<string name="last_sign">Ostatnio</string>
|
|
||||||
|
|
||||||
<string name="available_now">Dostępny teraz</string>
|
|
||||||
<string name="profile_activity_title">Profil użytkownika</string>
|
|
||||||
<string name="batter_exclusions_title">Uwaga</string>
|
|
||||||
<string name="batter_exclusions_message">Aby aplikacja była w pełni funkcjonalna, dodaj FMT do wyjątków w oszczędzaniu baterii. Po wciśnięciu przycisku \"ok\" zostaniesz przeniesiony do opcji zarządzania baterią. W panelu \"Bateria\" upewnij się, że opcja optymalizacji jest wyłączona.</string>
|
|
||||||
|
|
||||||
<string name="never_logged_in">Nigdy</string>
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@ -222,9 +222,9 @@
|
|||||||
<string name="nav_profile">User profile</string>
|
<string name="nav_profile">User profile</string>
|
||||||
<string name="remove_manual_location">Remove Manual location</string>
|
<string name="remove_manual_location">Remove Manual location</string>
|
||||||
<string name="title_activity_tutor_tab">TutorTab</string>
|
<string name="title_activity_tutor_tab">TutorTab</string>
|
||||||
<string name="manual_modal_title">Manual localization</string>
|
<string name="manual_modal_title">Do you want to save this localization?</string>
|
||||||
<string name="lbl_ok">Save</string>
|
<string name="lbl_ok">Save!</string>
|
||||||
<string name="lbl_cancel">Cancel</string>
|
<string name="lbl_cancel">Cancel!</string>
|
||||||
<string name="manual_marker_info">Your marker will disappear in next couple minutes</string>
|
<string name="manual_marker_info">Your marker will disappear in next couple minutes</string>
|
||||||
<string name="manual_location_selected">Manual Locations selected!</string>
|
<string name="manual_location_selected">Manual Locations selected!</string>
|
||||||
<string name="location_saved">Location saved!</string>
|
<string name="location_saved">Location saved!</string>
|
||||||
@ -337,12 +337,12 @@
|
|||||||
<!--(ENG) Checkbox online users list -->
|
<!--(ENG) Checkbox online users list -->
|
||||||
<string name="no_online_users">Currently, there are no\nactive users.</string>
|
<string name="no_online_users">Currently, there are no\nactive users.</string>
|
||||||
<string name="no_offline_users">Currently, there are no\noffline users.</string>
|
<string name="no_offline_users">Currently, there are no\noffline users.</string>
|
||||||
<string name="only_online_users">Only active users</string>
|
<string name="only_online_users">Only online users</string>
|
||||||
<string name="no_such_a_user">No such a user</string>
|
<string name="no_such_a_user">No such a user</string>
|
||||||
|
|
||||||
<string name="network_err">Network Error !</string>
|
<string name="network_err">Network Error !</string>
|
||||||
<string name="search_null">Search response is empty!</string>
|
<string name="search_null">Search response is empty!</string>
|
||||||
<string name="modal_manual_hint">Name the localization</string>
|
<string name="modal_manual_hint">Insert a name for this localization.</string>
|
||||||
<string name="online">Online</string>
|
<string name="online">Online</string>
|
||||||
<string name="offline">Offline</string>
|
<string name="offline">Offline</string>
|
||||||
<string name="inactive">Inactive</string>
|
<string name="inactive">Inactive</string>
|
||||||
@ -351,9 +351,6 @@
|
|||||||
<!--(ENG) Blacked/Whited users -->
|
<!--(ENG) Blacked/Whited users -->
|
||||||
<string name="add_user_to_list">User has been added!</string>
|
<string name="add_user_to_list">User has been added!</string>
|
||||||
<string name="user_removed">User removed!</string>
|
<string name="user_removed">User removed!</string>
|
||||||
<string name="floor">Floor</string>
|
|
||||||
<string name="block_the_users">Block the users</string>
|
|
||||||
<string name="be_visible_for_these_users">Be visible for these users</string>
|
|
||||||
<string name="title_activity_scrolling">ScrollingActivity</string>
|
<string name="title_activity_scrolling">ScrollingActivity</string>
|
||||||
<string name="large_text">
|
<string name="large_text">
|
||||||
"Material is the metaphor.\n\n"
|
"Material is the metaphor.\n\n"
|
||||||
@ -446,17 +443,4 @@
|
|||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
|
||||||
<!--(ENG) Sharing Modes -->
|
|
||||||
<string name="manual_mode">manual</string>
|
|
||||||
<string name="exact_mode">exact</string>
|
|
||||||
<string name="approx_mode">approximate</string>
|
|
||||||
|
|
||||||
<!--(ENG) Undefined manual -->
|
|
||||||
<string name="other_location">Not saved location.</string>
|
|
||||||
<string name="user_status_label" translatable="false">Status</string>
|
|
||||||
<string name="available_now">Available now</string>
|
|
||||||
<string name="last_sign">Last seen</string>
|
|
||||||
<string name="batter_exclusions_message">To make app fully functional add FMT to battery saving exclusions. You can change battery options in \"Optimise battery usage\". Unfortunately, you have to do it manually. Click \"ok\" to open battery settings and make sure that the application is not optimised.</string>
|
|
||||||
<string name="batter_exclusions_title">Please note</string>
|
|
||||||
<string name="never_logged_in">Never</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:id="@+id/pref_screen"
|
android:id="@+id/pref_screen"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fontFamily="@font/lato_regular">
|
android:fontFamily="@font/lato_regular">
|
||||||
@ -59,8 +58,6 @@
|
|||||||
android:title="@string/title_manual_status" />
|
android:title="@string/title_manual_status" />
|
||||||
<com.uam.wmi.findmytutor.utils.RightButtonPreference
|
<com.uam.wmi.findmytutor.utils.RightButtonPreference
|
||||||
android:key="remove_manual_status"
|
android:key="remove_manual_status"
|
||||||
android:textColor="@color/white"
|
|
||||||
app:backgroundTint="@color/mapboxRedDark"
|
|
||||||
android:text="@string/preference_manual_status_button_remove" />
|
android:text="@string/preference_manual_status_button_remove" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
@ -9,6 +9,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user