Compare commits
5 Commits
fix-enable
...
master
Author | SHA1 | Date | |
---|---|---|---|
faed9e05b7 | |||
4473834218 | |||
2ca95e0ba0 | |||
a4c0881300 | |||
7e043c9826 |
@ -10,7 +10,7 @@ android {
|
||||
applicationId "com.uam.wmi.findmytutor"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 71
|
||||
versionCode 66
|
||||
versionName "1.0.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
Binary file not shown.
BIN
app/release/release/fmtBeta0.9.5v18.aab
Normal file
BIN
app/release/release/fmtBeta0.9.5v18.aab
Normal file
Binary file not shown.
@ -14,7 +14,6 @@ import org.acra.annotation.AcraLimiter;
|
||||
import org.acra.annotation.AcraNotification;
|
||||
import org.acra.config.CoreConfigurationBuilder;
|
||||
import org.acra.config.HttpSenderConfigurationBuilder;
|
||||
import org.acra.config.LimiterConfigurationBuilder;
|
||||
import org.acra.config.ToastConfigurationBuilder;
|
||||
import org.acra.data.StringFormat;
|
||||
import org.acra.sender.HttpSender;
|
||||
@ -37,13 +36,13 @@ import static org.acra.ReportField.USER_CRASH_DATE;
|
||||
@AcraNotification(resText = R.string.notification_text,
|
||||
resTitle = R.string.notification_title,
|
||||
resChannelName = R.string.notification_channel)
|
||||
//@AcraLimiter(failedReportLimit = 2)
|
||||
@AcraLimiter(failedReportLimit = 2)
|
||||
public class FindMyTutor extends Application {
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
//super.attachBaseConteattachBaseContextxt(LocaleHelper.onAttach(base));
|
||||
//super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
|
||||
// ACRA core
|
||||
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
|
||||
@ -74,10 +73,6 @@ public class FindMyTutor extends Application {
|
||||
.setHttpHeaders(header)
|
||||
.setEnabled(true);
|
||||
|
||||
// builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class)
|
||||
// .setFailedReportLimit(2)
|
||||
// .setEnabled(true);
|
||||
|
||||
ACRA.init(this, builder);
|
||||
//Shared preferences
|
||||
ACRA.getErrorReporter().putCustomData("USER_ID", sharedPreferences.getString("USER_ID", "no user id"));
|
||||
|
@ -9,7 +9,6 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -36,18 +35,17 @@ import android.widget.Toast;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||
import com.uam.wmi.findmytutor.utils.EnableLocalization;
|
||||
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.RxSearchObservable;
|
||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||
import com.uam.wmi.findmytutor.utils.WifiUtils;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
@ -56,6 +54,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||
import static com.uam.wmi.findmytutor.utils.Const.defaultMapZoom;
|
||||
import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval;
|
||||
import static com.uam.wmi.findmytutor.utils.Const.searchMapZoom;
|
||||
@ -70,20 +70,24 @@ public abstract class BaseActivity
|
||||
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS};
|
||||
public DrawerLayout drawerLayout;
|
||||
public ActiveFragment activeFragment = ActiveFragment.NONE;
|
||||
public SearchView searchView;
|
||||
public MenuItem infoMenuItem;
|
||||
protected BottomNavigationView navigationView;
|
||||
protected NavigationView drawerNavigationView;
|
||||
protected DrawerLayout sideDrawer;
|
||||
protected Toolbar toolbar;
|
||||
protected boolean isTutor;
|
||||
protected FeedbackUtils feedbackUtils;
|
||||
|
||||
String tag = getClass().getName();
|
||||
|
||||
protected FeedbackUtils feedbackUtils;
|
||||
|
||||
private ActionBarDrawerToggle actionBarDrawerToggle;
|
||||
private SharingFragment sharingFragment;
|
||||
|
||||
private Fragment userListFragment;
|
||||
public ActiveFragment activeFragment = ActiveFragment.NONE;
|
||||
private Fragment activeBottomMenu = null;
|
||||
public SearchView searchView;
|
||||
public MenuItem infoMenuItem;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
@ -108,7 +112,7 @@ public abstract class BaseActivity
|
||||
launchIntent = new Intent(getApplicationContext(), WhiteList.class);
|
||||
startActivity(launchIntent);
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_blacklist))) {
|
||||
launchIntent = new Intent(getApplicationContext(), BlackList.class);
|
||||
launchIntent = new Intent(getApplicationContext(),BlackList.class);
|
||||
startActivity(launchIntent);
|
||||
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_profile))) {
|
||||
@ -120,7 +124,7 @@ public abstract class BaseActivity
|
||||
startActivity(launchIntent);
|
||||
|
||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_logout))) {
|
||||
if (PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
||||
if(PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
||||
stopBackgroundLocalizationTask();
|
||||
}
|
||||
logout();
|
||||
@ -155,7 +159,7 @@ public abstract class BaseActivity
|
||||
}
|
||||
|
||||
|
||||
protected void logout() {
|
||||
protected void logout(){
|
||||
storeBackgroundLocationStatus(getApplication(), false);
|
||||
PrefUtils.storeIsLoggedIn(getApplicationContext(), false);
|
||||
PrefUtils.setBatteryExlusionInfoStatus(getApplicationContext(), true);
|
||||
@ -189,23 +193,6 @@ public abstract class BaseActivity
|
||||
onRequestPermissionsResult(REQUEST_CODE_ASK_PERMISSIONS, REQUIRED_SDK_PERMISSIONS,
|
||||
grantResults);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void statusCheck() {
|
||||
final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
if (!Objects.requireNonNull(manager).isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
buildAlertMessageNoGps();
|
||||
}
|
||||
}
|
||||
|
||||
private void buildAlertMessageNoGps() {
|
||||
EnableLocalization sharingDialog = new EnableLocalization();
|
||||
sharingDialog.show(getFragmentManager(), "Sharing");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -234,22 +221,11 @@ public abstract class BaseActivity
|
||||
stopIntent.putExtra("request_stop", true);
|
||||
|
||||
stopService(stopIntent);
|
||||
|
||||
}
|
||||
|
||||
public void startBackgroundLocalizationTask() {
|
||||
checkPermissions();
|
||||
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())
|
||||
&& !PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())
|
||||
) {
|
||||
statusCheck();
|
||||
}
|
||||
|
||||
if (!WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
|
||||
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())){
|
||||
statusCheck();
|
||||
}
|
||||
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
||||
|
||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
@ -336,7 +312,7 @@ public abstract class BaseActivity
|
||||
((UsersListFragment) userListFragment).restoreUsersList();
|
||||
}
|
||||
|
||||
if (hasFocus && activeFragment.equals(ActiveFragment.NONE)) {
|
||||
if(hasFocus && activeFragment.equals(ActiveFragment.NONE)){
|
||||
adjustMapToSearch(searchMapZoom);
|
||||
}
|
||||
});
|
||||
@ -375,9 +351,9 @@ public abstract class BaseActivity
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId() == R.id.action_info) {
|
||||
if (item.getItemId()==R.id.action_info){
|
||||
int layoutID;
|
||||
switch (activeFragment) {
|
||||
switch (activeFragment){
|
||||
case SHARED_PREFERENCES:
|
||||
layoutID = R.layout.info_popup_sharing_tab;
|
||||
break;
|
||||
@ -388,7 +364,7 @@ public abstract class BaseActivity
|
||||
layoutID = R.layout.info_popup_map;
|
||||
}
|
||||
|
||||
View popupView = getLayoutInflater().inflate(layoutID, null);
|
||||
View popupView = getLayoutInflater().inflate(layoutID,null);
|
||||
|
||||
PopupWindow popupWindow = new PopupWindow(popupView,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
@ -397,8 +373,8 @@ public abstract class BaseActivity
|
||||
// If you need the PopupWindow to dismiss when when touched outside
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable());
|
||||
// Get the View's(the one that was clicked in the Fragment) location
|
||||
View anchorView = getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
popupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.END, 0, 0);
|
||||
View anchorView= getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
popupWindow.showAtLocation(anchorView,Gravity.TOP|Gravity.END, 0, 0);
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
@ -477,8 +453,9 @@ public abstract class BaseActivity
|
||||
}
|
||||
|
||||
abstract int getNavigationMenuItemId();
|
||||
|
||||
abstract int getContentViewId();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.activity;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
@ -11,7 +12,6 @@ import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -23,24 +23,22 @@ import com.annimon.stream.Stream;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
||||
import com.uam.wmi.findmytutor.model.StatusesListModel;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||
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.RestApiHelper;
|
||||
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
|
||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
@ -73,8 +71,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
private String[] statusesArray;
|
||||
private boolean statusSwitchFlag;
|
||||
private ArrayList<String> predefinedLocationsList;
|
||||
private List<String> afterDeleted = new ArrayList<>();
|
||||
|
||||
|
||||
public static SharingFragment newInstance() {
|
||||
return new SharingFragment();
|
||||
@ -116,8 +112,8 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
public void onSuccess(List<PredefinedCoordViewModel> coords) {
|
||||
|
||||
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||
locationMap = new HashMap<>();
|
||||
locationUUIDs = new ArrayList<>();
|
||||
locationMap = new HashMap<String, String>();
|
||||
locationUUIDs = new ArrayList<String>();
|
||||
for (PredefinedCoordViewModel i : coords)
|
||||
locationMap.put(i.getPredefinedCoordinateId(), i.getName());
|
||||
for (PredefinedCoordViewModel i : coords)
|
||||
@ -179,16 +175,16 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
locationService = ApiClient.getClient(getApplicationContext()).create(PredefinedCoordinatesService.class);
|
||||
disposable = new CompositeDisposable();
|
||||
statusesArray = new String[0];
|
||||
predefinedLocationsList = new ArrayList<>();
|
||||
predefinedLocationsList = new ArrayList<String>();
|
||||
getStatuses(disposable);
|
||||
getLocations(disposable);
|
||||
locationLevelMapping = new HashMap<>();
|
||||
locationLevelMapping = new HashMap<Integer, String>();
|
||||
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
|
||||
locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString());
|
||||
locationLevelMapping.put(2, SharingLevel.EXACT.toString());
|
||||
locationLevelMapping.put(3, SharingLevel.MANUAL.toString());
|
||||
|
||||
statusMapping = new HashMap<>();
|
||||
statusMapping = new HashMap<Integer, String>();
|
||||
statusMapping.put(0, "available");
|
||||
statusMapping.put(1, "consultation");
|
||||
statusMapping.put(2, "busy");
|
||||
@ -206,10 +202,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
/** Sharing level list **/
|
||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
|
||||
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
||||
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
|
||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||
if (!predefinedCoordsList.isEmpty()) {
|
||||
@ -267,11 +262,15 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
|
||||
return true;
|
||||
});
|
||||
statusList.setOnPreferenceClickListener(preference -> {
|
||||
statusList.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
|
||||
if (statusesArray.length == 0) {
|
||||
builder.setTitle("Status");
|
||||
builder.setTitle("nie ma wody na pustyni");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
/** Custom status edittext change listener **/
|
||||
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
@ -330,13 +329,14 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
protected void removeEntries(String service, ArrayList<String> toBeDeleted) {
|
||||
|
||||
// Log.d("MANAGE-PREF", toBeDeleted.toString());
|
||||
if (service.equals("status")) {
|
||||
disposable.add(
|
||||
statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), new StatusesListModel(toBeDeleted))
|
||||
for (String uuid : toBeDeleted) {
|
||||
disposable.add(statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleDeleteStatuses, this::handleError)
|
||||
);
|
||||
.subscribe(this::handleDeleteStatuses, this::handleError));
|
||||
}
|
||||
} else {
|
||||
ArrayList<String> uuidsToBeDeleted = new ArrayList<String>();
|
||||
for (String name : toBeDeleted) {
|
||||
@ -347,6 +347,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
}
|
||||
}
|
||||
for (String uuid : uuidsToBeDeleted) {
|
||||
// predefinedCoordsList.removeIf(x -> x.getPredefinedCoordinateId().equals(uuid));
|
||||
predefinedCoordsList.removeAll(Stream.of(predefinedCoordsList).filter(x -> x.getPredefinedCoordinateId().equals(uuid)).toList());
|
||||
disposable.add(locationService.deleteUserPredefinedCoord(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -408,13 +409,12 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
}
|
||||
|
||||
private void handleDeleteStatuses(List<String> resp) {
|
||||
// getStatuses(disposable);
|
||||
String currentEntry = PrefUtils.getUserStatus(getApplicationContext());
|
||||
if (resp.isEmpty()) {
|
||||
disableStatusPreferences();
|
||||
} else {
|
||||
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
||||
setListPreferenceData(statusList, statusesArray, null);
|
||||
String currentEntry = PrefUtils.getUserStatus(getApplicationContext());
|
||||
if (resp.contains(currentEntry)) {
|
||||
statusList.setValueIndex(resp.indexOf(currentEntry));
|
||||
} else {
|
||||
@ -505,20 +505,4 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
private void showError(Throwable e) {
|
||||
String message;
|
||||
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
message = RestApiHelper.getErrorMessage(responseBody);
|
||||
if (((HttpException) e).response().code() == 404) {
|
||||
message = getString(R.string.no_such_a_user);
|
||||
}
|
||||
} else {
|
||||
message = "Network Error !";
|
||||
}
|
||||
Log.e("ERR", message);
|
||||
Toast.makeText(getApplicationContext(), message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,11 +13,9 @@ import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@ -31,7 +29,6 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
@ -275,9 +272,7 @@ public class UsersListFragment extends Fragment {
|
||||
}
|
||||
|
||||
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
|
||||
userEmail.setText(Html.fromHtml("Email: <a href=\""+tutorTabViewModel.getEmailTutorTab()+"\">"+tutorTabViewModel.getEmailTutorTab() +"</a>"));
|
||||
userEmail.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
|
||||
userNote.setText(String.format("%s: %s", getString(R.string.userNote), userNoteText));
|
||||
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
|
||||
userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
|
||||
@ -388,14 +383,6 @@ public class UsersListFragment extends Fragment {
|
||||
if (e instanceof HttpException) {
|
||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||
message = RestApiHelper.getErrorMessage(responseBody);
|
||||
if(((HttpException) e).response().code() == 404){
|
||||
if (PrefUtils.getLocale(getApplicationContext()).equals("pl") ||
|
||||
PrefUtils.getLocale(getApplicationContext()).equals("pl-PL") ||
|
||||
PrefUtils.getLocale(getApplicationContext()).equals("[pl-PL]")) {
|
||||
message = getString(R.string.no_tutor_tab);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
message = getString(R.string.network_err);
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package com.uam.wmi.findmytutor.model;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StatusesListModel
|
||||
{
|
||||
@SerializedName("statusesList")
|
||||
@Expose
|
||||
public List<String> statusesList;
|
||||
|
||||
public StatusesListModel(){}
|
||||
|
||||
public StatusesListModel(List<String> _statusesList){
|
||||
this.statusesList = _statusesList;
|
||||
}
|
||||
|
||||
public List<String> getStatusesList() {
|
||||
return statusesList;
|
||||
}
|
||||
|
||||
public void setStatusesList(List<String> statusesList) {
|
||||
this.statusesList = statusesList;
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
@ -22,7 +21,6 @@ import android.os.Looper;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
@ -37,7 +35,6 @@ import com.uam.wmi.findmytutor.model.Coordinate;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||
import com.uam.wmi.findmytutor.utils.Const;
|
||||
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
|
||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||
@ -47,7 +44,6 @@ import org.apache.commons.collections4.queue.CircularFifoQueue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.uam.wmi.findmytutor.service;
|
||||
import com.uam.wmi.findmytutor.model.StatusesListModel;
|
||||
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
||||
import java.util.List;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.DELETE;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.HTTP;
|
||||
import retrofit2.http.POST;
|
||||
@ -15,8 +16,9 @@ public interface PredefinedStatusesService {
|
||||
@POST("api/users/predefined/status/{tutorId}")
|
||||
Single<List<String>> postUserPredefinedStatus(@Path("tutorId") String tutorId, @Body String status);
|
||||
|
||||
// @DELETE("api/users/predefined/status/{tutorId}")
|
||||
@HTTP(method = "DELETE", path = "api/users/predefined/status/{tutorId}", hasBody = true)
|
||||
Single<List<String>> deleteUserPredefinedStatus(@Path("tutorId") String tutorId, @Body StatusesListModel statusesLis);
|
||||
Single<List<String>> deleteUserPredefinedStatus(@Path("tutorId") String tutorId, @Body String status);
|
||||
|
||||
/* @GET("api/users/predefined/coordinate/{tutorId}")
|
||||
Single<List<PredefinedCoordViewModel>> getUserPredefinedCoords(@Path("tutorId") String tutorId);
|
||||
|
@ -1,37 +0,0 @@
|
||||
package com.uam.wmi.findmytutor.utils;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.activity.MapActivity;
|
||||
|
||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||
|
||||
public class EnableLocalization extends DialogFragment {
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.enable_sharing)
|
||||
.setMessage(R.string.use_gps)
|
||||
.setPositiveButton(R.string.possitive_dialog_button, (dialog, which) ->
|
||||
dialogPositiveAnswer(getActivity())
|
||||
)
|
||||
.setNegativeButton(R.string.negative_dialog_button, (dialog, which) -> {
|
||||
PrefUtils.storeEnableSharingLocalization(getActivity(), false);
|
||||
dialog.cancel();
|
||||
}).create();
|
||||
}
|
||||
|
||||
private void dialogPositiveAnswer(Context context) {
|
||||
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ public class WifiUtils {
|
||||
if (wifiInfo != null) {
|
||||
NetworkInfo.DetailedState state = WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState());
|
||||
if (state == NetworkInfo.DetailedState.CONNECTED || state == NetworkInfo.DetailedState.OBTAINING_IPADDR) {
|
||||
return wifiInfo.getSSID().replace("\"", "");
|
||||
return wifiInfo.getSSID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:autoLink="web|email"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="@color/mapboxWhite" />
|
||||
</LinearLayout>
|
||||
|
@ -289,12 +289,10 @@
|
||||
<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="no_tutor_tab">Zakładka użytkownika nie istnieje</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>
|
||||
|
||||
<!--(ENG) ask for gps -->
|
||||
<string name="enable_sharing">Włącz lokalizację</string>
|
||||
<string name="use_gps">Aby użyć tej funkcji musisz włączyć lokalizowanie urządzenia.</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@ -458,10 +458,5 @@
|
||||
<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="no_tutor_tab">Tutor tab not found for this user</string>
|
||||
<string name="never_logged_in">Never</string>
|
||||
|
||||
<!--(ENG) ask for gps -->
|
||||
<string name="enable_sharing">Enable localization</string>
|
||||
<string name="use_gps">In order to use this function you have to enable localization.</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user