Merge branch 'users-list-last-seen' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
f872b08acc
@ -10,10 +10,11 @@ android {
|
||||
applicationId "com.uam.wmi.findmytutor"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 55
|
||||
versionCode 56
|
||||
versionName "1.0.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resConfigs "en", "pl"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@ -37,10 +38,8 @@ dependencies {
|
||||
implementation "ch.acra:acra-limiter:$acraVersion"
|
||||
|
||||
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
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:design:27.1.1'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
@ -72,6 +71,10 @@ dependencies {
|
||||
// FloatingBarMenu
|
||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||
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'
|
||||
|
||||
// spinner loaders library
|
||||
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
|
||||
implementation 'com.akexorcist:localizationactivity:1.2.2'
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:configChanges="locale"
|
||||
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
|
||||
<activity
|
||||
android:name=".activity.StartupActivity"
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
@ -13,6 +14,8 @@ import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
@ -21,6 +24,11 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
|
@ -4,6 +4,7 @@ import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
@ -35,6 +36,8 @@ 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.FeedbackUtils;
|
||||
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.RxSearchObservable;
|
||||
|
||||
@ -85,6 +88,11 @@ public abstract class BaseActivity
|
||||
public SearchView searchView;
|
||||
public MenuItem infoMenuItem;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -436,4 +444,8 @@ public abstract class BaseActivity
|
||||
|
||||
abstract int getNavigationMenuItemId();
|
||||
abstract int getContentViewId();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
@ -31,6 +32,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
@ -44,6 +46,7 @@ import com.uam.wmi.findmytutor.model.UserResponseModel;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||
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.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||
@ -86,12 +89,20 @@ public class BlackList extends AppCompatActivity {
|
||||
Switch aSwitch;
|
||||
@BindView(R.id.add_to_black_list_fab)
|
||||
FloatingActionButton addToBlackListFab;
|
||||
@BindView(R.id.loader)
|
||||
SpinKitView loader;
|
||||
|
||||
|
||||
private Integer prevSize;
|
||||
private BlackListAdapter mAdapter;
|
||||
private List<User> blacklistedUsers = new ArrayList<>();
|
||||
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -122,6 +133,7 @@ public class BlackList extends AppCompatActivity {
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
|
||||
fetchBlackListedUsers();
|
||||
/**
|
||||
@ -275,15 +287,15 @@ public class BlackList extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void toggleEmptyNotes() {
|
||||
|
||||
if (didFetched && blacklistedUsers.size() == 0) {
|
||||
noNotesView.setText(R.string.list_is_empty);
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
noNotesView.setText(R.string.list_is_empty);
|
||||
loader.setVisibility(View.GONE);
|
||||
}else if (blacklistedUsers.size() > 0) {
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
loader.setVisibility(View.GONE);
|
||||
} else {
|
||||
noNotesView.setText(getString(R.string.loading));
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
loader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.activity;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -27,6 +28,7 @@ import com.uam.wmi.findmytutor.model.ValidateUser;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.LdapService;
|
||||
import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
@ -50,6 +52,11 @@ LoginActivity extends AppCompatActivity {
|
||||
private UserService userService;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -4,6 +4,7 @@ import android.Manifest;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -48,6 +49,7 @@ import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
|
||||
import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||
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.MapMarker;
|
||||
@ -103,6 +105,11 @@ public class MapActivity extends BaseActivity
|
||||
private ApproximatedLocalization approximatedLocalization;
|
||||
private boolean shouldFetchNewCoords = true;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@ -15,12 +16,15 @@ import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
|
||||
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 java.util.Locale;
|
||||
|
||||
|
||||
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
private static final String TAG = SettingsActivity.class.getSimpleName();
|
||||
|
||||
@ -33,9 +37,15 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
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) {
|
||||
Context context = LocaleHelper.setLocale(this, localeName);
|
||||
Resources res = context.getResources();
|
||||
Locale myLocale = new Locale(localeName);
|
||||
Resources res = getResources();
|
||||
DisplayMetrics dm = res.getDisplayMetrics();
|
||||
Configuration conf = res.getConfiguration();
|
||||
conf.locale = myLocale;
|
||||
@ -62,9 +72,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
|
||||
if (!newValue.toString().equals("0")){
|
||||
LocaleHelper.setLocale(getActivity(), "pl");
|
||||
((SettingsActivity)getActivity()).setLocale("pl");
|
||||
PrefUtils.storeLocale(getActivity(),"pl");
|
||||
LocaleHelper.setLocale(getActivity(), "pl");
|
||||
}else{
|
||||
LocaleHelper.setLocale(getActivity(), "en");
|
||||
((SettingsActivity)getActivity()).setLocale("en");
|
||||
PrefUtils.storeLocale(getActivity(),"en");
|
||||
}
|
||||
|
@ -3,41 +3,36 @@ package com.uam.wmi.findmytutor.activity;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.annimon.stream.IntPair;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
||||
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 org.apache.commons.collections4.BidiMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -49,6 +44,7 @@ import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||
|
||||
|
||||
@ -63,9 +59,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
protected RightButtonPreference removeManualStatus;
|
||||
protected Preference manualStatus;
|
||||
protected ListPreference statusList;
|
||||
private HashMap<String,String> locationMap;
|
||||
private ArrayList <String> locationUUIDs;
|
||||
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
|
||||
private HashMap<String, String> locationMap;
|
||||
private ArrayList<String> locationUUIDs;
|
||||
private HashMap<Integer, String> locationLevelMapping;
|
||||
private HashMap<Integer, String> statusMapping;
|
||||
private PredefinedStatusesService statusesService;
|
||||
@ -74,9 +70,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
private AlertDialog.Builder builder;
|
||||
private String[] statusesArray;
|
||||
private boolean statusSwitchFlag;
|
||||
private ArrayList<String> predefinedLocationsList;
|
||||
private ArrayList<String> predefinedLocationsList;
|
||||
|
||||
public static SharingFragment newInstance() {
|
||||
public static SharingFragment newInstance() {
|
||||
return new SharingFragment();
|
||||
}
|
||||
|
||||
@ -88,12 +84,12 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
.subscribeWith(new DisposableSingleObserver<List<String>>() {
|
||||
@Override
|
||||
public void onSuccess(List<String> strings) {
|
||||
statusesArray = strings.toArray(new String[strings.size()]);
|
||||
if(strings.isEmpty()){
|
||||
disableStatusPreferences();
|
||||
}else{
|
||||
enableStatusPreferences();
|
||||
}
|
||||
statusesArray = strings.toArray(new String[strings.size()]);
|
||||
if (strings.isEmpty()) {
|
||||
disableStatusPreferences();
|
||||
} else {
|
||||
enableStatusPreferences();
|
||||
}
|
||||
// Log.d("STATUSES",Integer.toString(statusesArray.length ));
|
||||
setListPreferenceData(statusList, statusesArray, null);
|
||||
}
|
||||
@ -116,35 +112,36 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
public void onSuccess(List<PredefinedCoordViewModel> coords) {
|
||||
|
||||
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||
locationMap = new HashMap<String,String>();
|
||||
locationUUIDs = new ArrayList<String>();
|
||||
for (PredefinedCoordViewModel i : coords) locationMap.put(i.getPredefinedCoordinateId(),i.getName());
|
||||
for (PredefinedCoordViewModel i : coords) locationUUIDs.add(i.getPredefinedCoordinateId());
|
||||
List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
|
||||
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
|
||||
locationMap = new HashMap<String, String>();
|
||||
locationUUIDs = new ArrayList<String>();
|
||||
for (PredefinedCoordViewModel i : coords)
|
||||
locationMap.put(i.getPredefinedCoordinateId(), i.getName());
|
||||
for (PredefinedCoordViewModel i : coords)
|
||||
locationUUIDs.add(i.getPredefinedCoordinateId());
|
||||
List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
|
||||
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
|
||||
predefinedCoordsList.addAll(coords);
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||
preferenceCategory.removePreference(manualLocationList);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
preferenceCategory.removePreference(manualLocationButton);
|
||||
}else{
|
||||
if(!predefinedCoordsList.isEmpty()){
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||
preferenceCategory.removePreference(manualLocationList);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
preferenceCategory.removePreference(manualLocationButton);
|
||||
} else {
|
||||
if (!predefinedCoordsList.isEmpty()) {
|
||||
|
||||
manualLocationList.setEnabled(true);
|
||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
removeManualLocation.setEnabled(true);
|
||||
locationSharing.setEnabled(true);
|
||||
}
|
||||
}
|
||||
manualLocationList.setEnabled(true);
|
||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
removeManualLocation.setEnabled(true);
|
||||
locationSharing.setEnabled(true);
|
||||
}
|
||||
}
|
||||
String[] stringnames = predefinedLocationsNames.toArray(new String[0]);
|
||||
predefinedLocationsList = new ArrayList<>(Arrays.asList(stringnames));
|
||||
predefinedLocationsList = new ArrayList<>(Arrays.asList(stringnames));
|
||||
List<Integer> activesId = Stream.of(coords).indexed()
|
||||
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
|
||||
|
||||
if( activesId.size() == 0){
|
||||
if (activesId.size() == 0) {
|
||||
setListPreferenceData(manualLocationList, stringnames, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
|
||||
}
|
||||
|
||||
@ -175,11 +172,11 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
removeManualStatus = (RightButtonPreference) findPreference("remove_manual_status");
|
||||
manualStatus = findPreference("key_manual_status");
|
||||
statusList = (ListPreference) findPreference("key_status_value");
|
||||
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
||||
locationService = ApiClient.getClient(getApplicationContext()).create(PredefinedCoordinatesService.class);
|
||||
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
||||
locationService = ApiClient.getClient(getApplicationContext()).create(PredefinedCoordinatesService.class);
|
||||
disposable = new CompositeDisposable();
|
||||
statusesArray = new String[0];
|
||||
predefinedLocationsList = new ArrayList<String>();
|
||||
predefinedLocationsList = new ArrayList<String>();
|
||||
getStatuses(disposable);
|
||||
getLocations(disposable);
|
||||
locationLevelMapping = new HashMap<Integer, String>();
|
||||
@ -197,7 +194,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
|
||||
|
||||
|
||||
/** Main sharing switch**/
|
||||
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
||||
@ -209,19 +205,19 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
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)));
|
||||
|
||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||
if (!predefinedCoordsList.isEmpty()) {
|
||||
preferenceCategory.addPreference(manualLocationList);
|
||||
preferenceCategory.addPreference(removeManualLocation);
|
||||
preferenceCategory.addPreference(manualLocationList);
|
||||
preferenceCategory.addPreference(removeManualLocation);
|
||||
}
|
||||
preferenceCategory.addPreference(manualLocationButton);
|
||||
} else {
|
||||
locationSharing.setEnabled(true);
|
||||
locationSharing.setEnabled(true);
|
||||
preferenceCategory.removePreference(manualLocationList);
|
||||
preferenceCategory.removePreference(manualLocationButton);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -251,8 +247,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/** Button 'choose from map' button listener **/
|
||||
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
@ -270,17 +264,16 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
|
||||
return true;
|
||||
});
|
||||
statusList.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
statusList.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
|
||||
if(statusesArray.length == 0)
|
||||
{
|
||||
builder.setTitle("nie ma wody na pustyni");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (statusesArray.length == 0) {
|
||||
builder.setTitle("nie ma wody na pustyni");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
/** Custom status edittext change listener **/
|
||||
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
|
||||
@ -291,39 +284,40 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
return true;
|
||||
});
|
||||
removeManualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
showRemoveDialog(statusList.getEntries(),"status");
|
||||
return true;
|
||||
});
|
||||
removeManualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
showRemoveDialog(statusList.getEntries(), "status");
|
||||
return true;
|
||||
});
|
||||
|
||||
removeManualLocation.setOnPreferenceChangeListener(((preference, newValue) -> {
|
||||
showRemoveDialog(manualLocationList.getEntries(),"location");
|
||||
return true;
|
||||
removeManualLocation.setOnPreferenceChangeListener(((preference, newValue) -> {
|
||||
showRemoveDialog(manualLocationList.getEntries(), "location");
|
||||
return true;
|
||||
|
||||
}));
|
||||
}));
|
||||
}
|
||||
public void showRemoveDialog(CharSequence[] entries, String service){
|
||||
boolean [] checked = new boolean[entries.length];
|
||||
|
||||
public void showRemoveDialog(CharSequence[] entries, String service) {
|
||||
boolean[] checked = new boolean[entries.length];
|
||||
ArrayList<String> tobeDeleted = new ArrayList<String>();
|
||||
// Log.d("sharingDialog", "no to siup");
|
||||
builder.setPositiveButton("DELETE", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
for (int i=0; i< entries.length; i++){
|
||||
if(checked[i] == true) {
|
||||
tobeDeleted.add((String) entries[i]);
|
||||
}
|
||||
}
|
||||
removeEntries(service,tobeDeleted);
|
||||
builder.setPositiveButton("DELETE", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
if (checked[i] == true) {
|
||||
tobeDeleted.add((String) entries[i]);
|
||||
}
|
||||
}
|
||||
removeEntries(service, tobeDeleted);
|
||||
// Log.d("MANAGE-PREF",tobeDeleted.toString());
|
||||
}
|
||||
});
|
||||
builder.setMultiChoiceItems(entries, checked, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||
}
|
||||
});
|
||||
builder.setMultiChoiceItems(entries, checked, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
@ -335,34 +329,34 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
return view;
|
||||
}
|
||||
|
||||
protected void removeEntries(String service, ArrayList<String> toBeDeleted){
|
||||
protected void removeEntries(String service, ArrayList<String> toBeDeleted) {
|
||||
|
||||
// Log.d("MANAGE-PREF", toBeDeleted.toString());
|
||||
if(service.equals("status")){
|
||||
for (String uuid:toBeDeleted) {
|
||||
disposable.add(statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleDeleteStatuses, this::handleError));
|
||||
}
|
||||
}else {
|
||||
ArrayList<String> uuidsToBeDeleted = new ArrayList<String>();
|
||||
for (String name:toBeDeleted) {
|
||||
for (String uuid:locationUUIDs) {
|
||||
if(locationMap.get(uuid).equals(name)){
|
||||
uuidsToBeDeleted.add(uuid);
|
||||
if (service.equals("status")) {
|
||||
for (String uuid : toBeDeleted) {
|
||||
disposable.add(statusesService.deleteUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleDeleteStatuses, this::handleError));
|
||||
}
|
||||
} else {
|
||||
ArrayList<String> uuidsToBeDeleted = new ArrayList<String>();
|
||||
for (String name : toBeDeleted) {
|
||||
for (String uuid : locationUUIDs) {
|
||||
if (locationMap.get(uuid).equals(name)) {
|
||||
uuidsToBeDeleted.add(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String uuid : uuidsToBeDeleted) {
|
||||
}
|
||||
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())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleDeleteLocations, this::handleError));
|
||||
}
|
||||
}
|
||||
predefinedCoordsList.removeAll(Stream.of(predefinedCoordsList).filter(x -> x.getPredefinedCoordinateId().equals(uuid)).toList());
|
||||
disposable.add(locationService.deleteUserPredefinedCoord(PrefUtils.getUserId(getApplicationContext()), uuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleDeleteLocations, this::handleError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setListPreferenceData(ListPreference lp, String[] entries, Integer activeId) {
|
||||
@ -390,13 +384,13 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
;
|
||||
|
||||
private void handleResponse(List<String> resp) {
|
||||
if(resp.size() == 1){
|
||||
enableStatusPreferences();
|
||||
if(PrefUtils.isStatusEnabled(getApplicationContext()) == false){
|
||||
PrefUtils.enableStatus(getApplicationContext());
|
||||
statusSwitch.setChecked(true);
|
||||
}
|
||||
}
|
||||
if (resp.size() == 1) {
|
||||
enableStatusPreferences();
|
||||
if (PrefUtils.isStatusEnabled(getApplicationContext()) == false) {
|
||||
PrefUtils.enableStatus(getApplicationContext());
|
||||
statusSwitch.setChecked(true);
|
||||
}
|
||||
}
|
||||
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
||||
setListPreferenceData(statusList, statusesArray, resp.size() - 1);
|
||||
statusList.setValueIndex(resp.size() - 1);
|
||||
@ -415,79 +409,84 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
private void handleDeleteStatuses(List<String> resp){
|
||||
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{
|
||||
statusList.setValueIndex(0);
|
||||
statusList.setSummary(resp.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void handleDeleteLocations(List<PredefinedCoordViewModel> resp){
|
||||
getLocations(disposable);
|
||||
String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||
if(resp.isEmpty()){
|
||||
disableManualLocationPreferences();
|
||||
}else{
|
||||
if(!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty())
|
||||
{
|
||||
for (PredefinedCoordViewModel location: resp) {
|
||||
if(location.getName().equals(currentEntry)){
|
||||
manualLocationList.setValueIndex(resp.indexOf(location));
|
||||
break;
|
||||
}
|
||||
private void handleDeleteStatuses(List<String> resp) {
|
||||
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 {
|
||||
statusList.setValueIndex(0);
|
||||
statusList.setSummary(resp.get(0));
|
||||
}
|
||||
}else{
|
||||
manualLocationList.setValueIndex(0);
|
||||
manualLocationList.setSummary(resp.get(0).getName());
|
||||
//todo czy na pewno w shared pref sa dobre wartosci
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void disableStatusPreferences(){
|
||||
removeManualStatus.setEnabled(false);
|
||||
statusList.setEnabled(false);
|
||||
statusSwitch.setEnabled(false);
|
||||
statusList.setSummary("");
|
||||
PrefUtils.disableStatus(getApplicationContext());
|
||||
}
|
||||
|
||||
}
|
||||
private void enableStatusPreferences(){
|
||||
removeManualStatus.setEnabled(true);
|
||||
statusList.setEnabled(true);
|
||||
statusSwitch.setEnabled(true);
|
||||
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||
}
|
||||
private void disableManualLocationPreferences(){
|
||||
removeManualLocation.setEnabled(false);
|
||||
manualLocationList.setEnabled(false);
|
||||
manualLocationList.setSummary("");
|
||||
locationSharing.setChecked(false);
|
||||
locationSharing.setEnabled(false);
|
||||
PrefUtils.disableSharing(getApplicationContext());
|
||||
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||
|
||||
}
|
||||
private void enableManualLocationPreferences(){
|
||||
removeManualLocation.setEnabled(true);
|
||||
manualLocationList.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
locationSharing.setChecked(PrefUtils.isEnableSharingLocalization(getApplicationContext()));
|
||||
private void handleDeleteLocations(List<PredefinedCoordViewModel> resp) {
|
||||
getLocations(disposable);
|
||||
String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||
if (resp.isEmpty()) {
|
||||
disableManualLocationPreferences();
|
||||
} else {
|
||||
if (!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty()) {
|
||||
for (PredefinedCoordViewModel location : resp) {
|
||||
if (location.getName().equals(currentEntry)) {
|
||||
manualLocationList.setValueIndex(resp.indexOf(location));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
manualLocationList.setValueIndex(0);
|
||||
manualLocationList.setSummary(resp.get(0).getName());
|
||||
//todo czy na pewno w shared pref sa dobre wartosci
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void disableStatusPreferences() {
|
||||
removeManualStatus.setEnabled(false);
|
||||
statusList.setEnabled(false);
|
||||
statusSwitch.setEnabled(false);
|
||||
statusList.setSummary("");
|
||||
PrefUtils.disableStatus(getApplicationContext());
|
||||
|
||||
}
|
||||
|
||||
private void enableStatusPreferences() {
|
||||
removeManualStatus.setEnabled(true);
|
||||
statusList.setEnabled(true);
|
||||
statusSwitch.setEnabled(true);
|
||||
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||
}
|
||||
|
||||
private void disableManualLocationPreferences() {
|
||||
removeManualLocation.setEnabled(false);
|
||||
manualLocationList.setEnabled(false);
|
||||
manualLocationList.setSummary("");
|
||||
locationSharing.setChecked(false);
|
||||
locationSharing.setEnabled(false);
|
||||
PrefUtils.disableSharing(getApplicationContext());
|
||||
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||
|
||||
}
|
||||
|
||||
private void enableManualLocationPreferences() {
|
||||
removeManualLocation.setEnabled(true);
|
||||
manualLocationList.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
locationSharing.setChecked(PrefUtils.isEnableSharingLocalization(getApplicationContext()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
@ -507,4 +506,5 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
super.onDestroy();
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@ -11,6 +12,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
@ -19,6 +21,11 @@ public class StartupActivity extends AppCompatActivity {
|
||||
private static final int AUTHENTICATION_REQUEST_CODE = 666;
|
||||
String currentLang;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
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.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -29,12 +28,11 @@ import com.uam.wmi.findmytutor.model.User;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
import com.uam.wmi.findmytutor.service.TutorTabApi;
|
||||
import com.uam.wmi.findmytutor.service.UserService;
|
||||
import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
|
||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -42,12 +40,10 @@ import java.util.regex.Pattern;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.observers.DisposableCompletableObserver;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Response;
|
||||
|
||||
import static java.lang.String.valueOf;
|
||||
|
||||
public class TutorTab extends AppCompatActivity {
|
||||
@ -69,6 +65,9 @@ public class TutorTab extends AppCompatActivity {
|
||||
private DutyHoursAdapter dutyHoursAdapter;
|
||||
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
||||
private TutorTabViewModel newTab;
|
||||
|
||||
|
||||
|
||||
public boolean isEmailValid(String email)
|
||||
{
|
||||
String regExpn =
|
||||
@ -94,17 +93,18 @@ public class TutorTab extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
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);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(R.string.profile_activity_title);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
userName = findViewById(R.id.userName);
|
||||
userNote = (TextInputEditText) findViewById(R.id.userNote);
|
||||
userNote = findViewById(R.id.userNote);
|
||||
userRoom = findViewById(R.id.userRoom);
|
||||
userEmail = findViewById(R.id.userEmail);
|
||||
department = findViewById(R.id.userDepartment);
|
||||
saveButon = findViewById(R.id.saveButon);
|
||||
saveButon = findViewById(R.id.saveButton);
|
||||
scrapButton = findViewById(R.id.scrapTutorTab);
|
||||
addDutyButton = findViewById(R.id.addDuty);
|
||||
dutyHoursRecycller = findViewById(R.id.dutyHourView);
|
||||
@ -304,4 +304,10 @@ public class TutorTab extends AppCompatActivity {
|
||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(LocaleHelper.onAttach(base));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
@ -30,6 +31,7 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
|
||||
@ -57,8 +59,12 @@ import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.observers.DisposableObserver;
|
||||
import io.reactivex.observers.DisposableSingleObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
@ -74,6 +80,8 @@ public class UsersListFragment extends Fragment {
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.txt_empty_notes_view)
|
||||
TextView noNotesView;
|
||||
@BindView(R.id.loader)
|
||||
SpinKitView loader;
|
||||
|
||||
private SearchView searchView;
|
||||
private UserService userService;
|
||||
@ -95,7 +103,6 @@ public class UsersListFragment extends Fragment {
|
||||
}
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
mAdapter = new TutorsListAdapter(getActivity().getApplicationContext(), tutorsList, tutorsTimeStamps);
|
||||
View view = inflater.inflate(R.layout.users_list, container, false);
|
||||
view.setBackgroundColor(getResources().getColor(android.R.color.white));
|
||||
@ -119,6 +126,7 @@ public class UsersListFragment extends Fragment {
|
||||
recyclerView.setVerticalScrollBarEnabled(true);
|
||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL, 16));
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
|
||||
fetchAllTutors();
|
||||
fetchTopCords();
|
||||
@ -404,9 +412,10 @@ public class UsersListFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void toggleEmptyNotes() {
|
||||
if (tutorsList.size() > 0) {
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
} else {
|
||||
loader.setVisibility(View.GONE);
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
|
||||
if (tutorsList.size() == 0) {
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
if (fetchOnlyOnlineUsers)
|
||||
noNotesView.setText(R.string.no_online_users);
|
||||
@ -442,28 +451,44 @@ public class UsersListFragment extends Fragment {
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private Observable<List<User>> getListOfActiveUsers() {
|
||||
return userService.getAllActiveTutors()
|
||||
.toObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
private Observable<Coordinate> getCoordinateObservable(User user) {
|
||||
return coordinateService
|
||||
.getTopCoordinateByUserId(user.getId())
|
||||
.toObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
private void fetchTopCords(){
|
||||
disposable.add(
|
||||
coordinateService.getTopCoordinates()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeWith(new DisposableSingleObserver<List<Coordinate>>() {
|
||||
@Override
|
||||
public void onSuccess(List<Coordinate> newCords) {
|
||||
for (Coordinate crd :
|
||||
newCords) {
|
||||
Long ts = crd.getTimeStamp();
|
||||
if (ts != 0){
|
||||
tutorsTimeStamps.put(crd.getUserId(), getDate(ts));
|
||||
}
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
tutorsTimeStamps.clear();
|
||||
disposable.add(getListOfActiveUsers()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap((Function<List<User>, Observable<User>>) Observable::fromIterable)
|
||||
.flatMap((Function<User, ObservableSource<Coordinate>>) this::getCoordinateObservable)
|
||||
.subscribeWith(new DisposableObserver<Coordinate>() {
|
||||
@Override
|
||||
public void onNext(Coordinate coordinate) {
|
||||
Long ts = coordinate.getTimeStamp();
|
||||
tutorsTimeStamps.put(coordinate.getUserId(), getDate(ts));
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {showError(e);}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {showSearchError(e);}
|
||||
}));
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("USERS", String.valueOf(tutorsTimeStamps));
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private String getDate(long time) {
|
||||
@ -472,4 +497,4 @@ public class UsersListFragment extends Fragment {
|
||||
String date = DateFormat.format("HH:mm dd/MM", cal).toString();
|
||||
return date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@ -27,6 +30,7 @@ import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.WhiteListAdapter;
|
||||
@ -35,6 +39,7 @@ import com.uam.wmi.findmytutor.model.StudentIdModel;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||
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.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||
@ -68,6 +73,11 @@ public class WhiteList extends AppCompatActivity {
|
||||
Switch aSwitch;
|
||||
@BindView(R.id.add_to_white_list_fab)
|
||||
FloatingActionButton addToWhiteListFab;
|
||||
|
||||
@BindView(R.id.loader)
|
||||
SpinKitView loader;
|
||||
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private UserService userService;
|
||||
private boolean didFetched = false;
|
||||
@ -77,12 +87,19 @@ public class WhiteList extends AppCompatActivity {
|
||||
private List<User> whitelistedUsers = new ArrayList<>();
|
||||
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
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
setContentView(R.layout.activity_white_list);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
tutorId = PrefUtils.getUserId(getApplicationContext());
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
@ -106,6 +123,7 @@ public class WhiteList extends AppCompatActivity {
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16));
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
|
||||
/**
|
||||
* On long press on RecyclerView item, open alert dialog
|
||||
@ -258,17 +276,20 @@ public class WhiteList extends AppCompatActivity {
|
||||
private void toggleEmptyNotes() {
|
||||
|
||||
if (didFetched && whitelistedUsers.size() == 0) {
|
||||
noNotesView.setText(R.string.list_is_empty);
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
noNotesView.setText(R.string.list_is_empty);
|
||||
loader.setVisibility(View.GONE);
|
||||
} else if (whitelistedUsers.size() > 0) {
|
||||
noNotesView.setVisibility(View.GONE);
|
||||
loader.setVisibility(View.GONE);
|
||||
} else {
|
||||
noNotesView.setText(getString(R.string.loading));
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
loader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
|
@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
|
||||
@ -49,17 +50,22 @@ public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.My
|
||||
if (tutor.isIsOnline()) {
|
||||
image = context.getResources().getDrawable(R.drawable.user_list_online);
|
||||
holder.lastSeen.setText(R.string.available_now);
|
||||
holder.loader.setVisibility(View.GONE);
|
||||
} else {
|
||||
image = context.getResources().getDrawable(R.drawable.user_list_offline);
|
||||
String ts = tutorsTimeStamps.get(tutor.getId());
|
||||
|
||||
if (ts != null){
|
||||
holder.lastSeen.setText(String.format("%s: %s", context.getResources().getString(R.string.last_seen), ts));
|
||||
holder.lastSeen.setText(R.string.last_sign);
|
||||
holder.lastSeen.append(String.format(": %s", ts));
|
||||
holder.loader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!tutor.isIsActive()) {
|
||||
image = context.getResources().getDrawable(R.drawable.user_list_off);
|
||||
holder.lastSeen.setText("");
|
||||
holder.loader.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
|
||||
@ -82,6 +88,9 @@ public class TutorsListAdapter extends RecyclerView.Adapter<TutorsListAdapter.My
|
||||
@BindView(R.id.isOnline)
|
||||
TextView isOnline;
|
||||
|
||||
@BindView(R.id.loader)
|
||||
SpinKitView loader;
|
||||
|
||||
MyViewHolder(View view) {
|
||||
super(view);
|
||||
ButterKnife.bind(this, view);
|
||||
|
@ -25,7 +25,7 @@ public interface CoordinateService {
|
||||
Single<List<Coordinate>> getCoordinatesByUserId(@Path("userId") String userId);
|
||||
|
||||
@GET("api/coordinates/userTop/{userId}")
|
||||
Single<Coordinate> getTopCoordinatesByUserId(@Path("userId") String userId);
|
||||
Single <Coordinate> getTopCoordinateByUserId(@Path("userId") String userId);
|
||||
|
||||
@GET("api/coordinates/top")
|
||||
Single<List<Coordinate>> getTopCoordinates();
|
||||
@ -42,4 +42,6 @@ public interface CoordinateService {
|
||||
@DELETE("api/coordinates/{id}")
|
||||
Completable deleteCoordinatesById(@Path("id") String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
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,10 +1,32 @@
|
||||
package com.uam.wmi.findmytutor.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.support.v4.os.ConfigurationCompat;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class LocaleUtils {
|
||||
public static String getCurrentLocale(){
|
||||
return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()));
|
||||
public static String getCurrentLocale() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,30 +5,29 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fontFamily="@font/lato_regular"
|
||||
android:id="@+id/activity_tutor_tab"
|
||||
tools:context=".activity.TutorTab">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/app_bar_height"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:expandedTitleGravity="top|right"
|
||||
app:toolbarId="@+id/toolbar"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<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>
|
@ -40,7 +40,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/be_visible_for_these_users "
|
||||
android:text="@string/be_visible_for_these_users"
|
||||
android:textSize="15sp"/>
|
||||
|
||||
<Switch
|
||||
|
@ -28,6 +28,21 @@
|
||||
android:textColor="@color/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>
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/activity_whitelist_container"
|
||||
tools:context=".activity.WhiteList">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/activity_tutor_content"
|
||||
tools:context=".activity.TutorTab">
|
||||
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
@ -57,10 +58,4 @@
|
||||
|
||||
<include layout="@layout/content_tutor_tab_layout" />
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- A RecyclerView with some commonly used attributes -->
|
||||
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".activity.TutorTab"
|
||||
tools:showIn="@layout/content_tutor_tab2">
|
||||
android:fontFamily="@font/lato_regular"
|
||||
tools:showIn="@layout/content_tutor_tab">
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@ -113,6 +114,7 @@
|
||||
android:layout_below="@+id/userRoomLayout"
|
||||
android:layout_alignStart="@+id/userRoomLayout"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/dutyTitle"
|
||||
@ -122,7 +124,7 @@
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/dutyHourView"
|
||||
android:layout_width="300dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_below="@+id/addDuty"
|
||||
|
||||
@ -135,7 +137,7 @@
|
||||
<TextView
|
||||
android:id="@+id/userNoteTitle"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/dutyHourView"
|
||||
android:layout_alignStart="@+id/userRoomLayout"
|
||||
@ -143,21 +145,24 @@
|
||||
android:textColor="@color/mapboxRedDark"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Button
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/addDuty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
android:layout_alignBaseline="@+id/dutyTitle"
|
||||
android:layout_toEndOf="@+id/userRoomLayout"
|
||||
android:layout_toEndOf="@+id/dutyTitle"
|
||||
android:text="@string/addDuty" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/userNoteLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/userNoteTitle"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="1000">
|
||||
@ -165,7 +170,7 @@
|
||||
<android.support.design.widget.TextInputEditText
|
||||
|
||||
android:id="@+id/userNote"
|
||||
android:layout_width="300dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignStart="@+id/userNoteLayout"
|
||||
android:hint="@string/tutorTabHint"
|
||||
@ -179,21 +184,24 @@
|
||||
android:textColor="@color/note_list_text" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/scrapTutorTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@+id/personalInfoTitle"
|
||||
android:layout_alignEnd="@+id/userEmailLayout"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
android:text="@string/scrap_tutor_tab" />
|
||||
|
||||
<Button
|
||||
|
||||
android:id="@+id/saveButon"
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/saveButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/userNoteLayout"
|
||||
android:layout_alignEnd="@+id/dutyHourView"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
android:text="@string/saveButton" />
|
||||
|
||||
|
||||
|
@ -28,6 +28,20 @@
|
||||
android:textColor="@color/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>
|
||||
|
||||
|
@ -1,13 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
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:text="@string/preference_manual_location_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/top_user_modal"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -19,9 +19,20 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:textColor="@color/note_list_text"
|
||||
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
|
||||
android:id="@+id/lastSeen"
|
||||
android:layout_width="270dp"
|
||||
@ -35,7 +46,6 @@
|
||||
android:textColor="#979797"
|
||||
android:textSize="13sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isOnline"
|
||||
android:layout_width="50dp"
|
||||
|
@ -27,5 +27,20 @@
|
||||
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>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
<string name="navigation_item_blacklist">Czarna lista</string>
|
||||
<string name="navigation_item_whitelist">Biała lista</string>
|
||||
<string name="navigation_item_settings">Ustawienia</string>
|
||||
<string name="navigation_item_profile">Profil uzytkownika</string>
|
||||
<string name="navigation_item_profile">Profil użytkownika</string>
|
||||
<string name="navigation_item_logout">Wyloguj</string>
|
||||
<!-- Tutors list -->
|
||||
<string name="action_settings">Ustawienia</string>
|
||||
@ -284,10 +284,10 @@
|
||||
<string name="exact_mode">dokładny</string>
|
||||
<string name="approx_mode">przybliżony</string>
|
||||
<string name="other_location">Niezapisana lokalizacja.</string>
|
||||
<string name="last_seen">Ostatnio</string>
|
||||
<string name="available_now">Dostępny teraz</string>
|
||||
<string name="profile_activity_title">Profil</string>
|
||||
<string name="last_sign">Ostatnio</string>
|
||||
|
||||
<string name="available_now">Dostępny teraz</string>
|
||||
<string name="profile_activity_title">Profil użytkownika</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@ -455,5 +455,5 @@
|
||||
<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_seen">Last seen</string>
|
||||
<string name="last_sign">Last seen</string>
|
||||
</resources>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/pref_screen"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fontFamily="@font/lato_regular">
|
||||
@ -58,6 +59,8 @@
|
||||
android:title="@string/title_manual_status" />
|
||||
<com.uam.wmi.findmytutor.utils.RightButtonPreference
|
||||
android:key="remove_manual_status"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/mapboxRedDark"
|
||||
android:text="@string/preference_manual_status_button_remove" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
Loading…
Reference in New Issue
Block a user