Fix tutor tab fixes

This commit is contained in:
Mieszko Wrzeszczyński 2019-01-10 23:36:44 +01:00
commit 20f585509c
23 changed files with 446 additions and 247 deletions

View File

@ -14,6 +14,7 @@ android {
versionName "1.0.0" versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
resConfigs "en", "pl"
} }
buildTypes { buildTypes {
release { release {
@ -37,10 +38,8 @@ dependencies {
implementation "ch.acra:acra-limiter:$acraVersion" implementation "ch.acra:acra-limiter:$acraVersion"
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:preference-v7:27.1.1' implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:support-v4:27.1.1'
@ -72,8 +71,10 @@ dependencies {
// FloatingBarMenu // FloatingBarMenu
implementation 'com.getbase:floatingactionbutton:1.10.1' implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.apache.commons:commons-collections4:4.0' implementation 'org.apache.commons:commons-collections4:4.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:27.1.1'
// spinner loaders library // spinner loaders library
implementation 'com.github.ybq:Android-SpinKit:1.2.0' implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'com.akexorcist:localizationactivity:1.2.2'
} }

View File

@ -24,6 +24,7 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:configChanges="locale"
tools:ignore="AllowBackup,GoogleAppIndexingWarning"> tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity <activity
android:name=".activity.StartupActivity" android:name=".activity.StartupActivity"

View File

@ -1,5 +1,6 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
@ -13,6 +14,8 @@ import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
/** /**
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
* to be used with AppCompat. * to be used with AppCompat.
@ -21,6 +24,11 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
private AppCompatDelegate mDelegate; private AppCompatDelegate mDelegate;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory(); getDelegate().installViewFactory();

View File

@ -4,6 +4,7 @@ import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -35,6 +36,8 @@ import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService; import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
import com.uam.wmi.findmytutor.utils.ActiveFragment; import com.uam.wmi.findmytutor.utils.ActiveFragment;
import com.uam.wmi.findmytutor.utils.FeedbackUtils; import com.uam.wmi.findmytutor.utils.FeedbackUtils;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.LocaleUtils;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RxSearchObservable; import com.uam.wmi.findmytutor.utils.RxSearchObservable;
@ -85,6 +88,11 @@ public abstract class BaseActivity
public SearchView searchView; public SearchView searchView;
public MenuItem infoMenuItem; public MenuItem infoMenuItem;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -436,4 +444,8 @@ public abstract class BaseActivity
abstract int getNavigationMenuItemId(); abstract int getNavigationMenuItemId();
abstract int getContentViewId(); abstract int getContentViewId();
} }

View File

@ -1,6 +1,7 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.CoordinatorLayout;
@ -45,6 +46,7 @@ import com.uam.wmi.findmytutor.model.UserResponseModel;
import com.uam.wmi.findmytutor.network.ApiClient; import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.PredefinedStatusesService; import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
import com.uam.wmi.findmytutor.service.UserService; import com.uam.wmi.findmytutor.service.UserService;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration; import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener; import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
@ -96,6 +98,11 @@ public class BlackList extends AppCompatActivity {
private List<User> blacklistedUsers = new ArrayList<>(); private List<User> blacklistedUsers = new ArrayList<>();
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL")); private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.activity;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; 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.network.ApiClient;
import com.uam.wmi.findmytutor.service.LdapService; import com.uam.wmi.findmytutor.service.LdapService;
import com.uam.wmi.findmytutor.service.UserService; import com.uam.wmi.findmytutor.service.UserService;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper; import com.uam.wmi.findmytutor.utils.RestApiHelper;
@ -50,6 +52,11 @@ LoginActivity extends AppCompatActivity {
private UserService userService; private UserService userService;
private CompositeDisposable disposable = new CompositeDisposable(); private CompositeDisposable disposable = new CompositeDisposable();
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -4,6 +4,7 @@ import android.Manifest;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context;
import android.location.Location; import android.location.Location;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -48,6 +49,7 @@ import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
import com.uam.wmi.findmytutor.service.UserService; import com.uam.wmi.findmytutor.service.UserService;
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization; import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
import com.uam.wmi.findmytutor.utils.EnableSharingDialog; import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.LocaleUtils; import com.uam.wmi.findmytutor.utils.LocaleUtils;
import com.uam.wmi.findmytutor.utils.ManualLocationUtils; import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
import com.uam.wmi.findmytutor.utils.MapMarker; import com.uam.wmi.findmytutor.utils.MapMarker;
@ -103,6 +105,11 @@ public class MapActivity extends BaseActivity
private ApproximatedLocalization approximatedLocalization; private ApproximatedLocalization approximatedLocalization;
private boolean shouldFetchNewCoords = true; private boolean shouldFetchNewCoords = true;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -1,6 +1,7 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@ -15,12 +16,15 @@ import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.LocaleUtils;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import java.util.Locale; import java.util.Locale;
public class SettingsActivity extends AppCompatPreferenceActivity { public class SettingsActivity extends AppCompatPreferenceActivity {
private static final String TAG = SettingsActivity.class.getSimpleName(); private static final String TAG = SettingsActivity.class.getSimpleName();
@ -33,9 +37,15 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit(); getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
} }
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
public void setLocale(String localeName) { public void setLocale(String localeName) {
Context context = LocaleHelper.setLocale(this, localeName);
Resources res = context.getResources();
Locale myLocale = new Locale(localeName); Locale myLocale = new Locale(localeName);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics(); DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration(); Configuration conf = res.getConfiguration();
conf.locale = myLocale; conf.locale = myLocale;
@ -62,9 +72,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
languagesList.setOnPreferenceChangeListener((preference, newValue) -> { languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
if (!newValue.toString().equals("0")){ if (!newValue.toString().equals("0")){
LocaleHelper.setLocale(getActivity(), "pl");
((SettingsActivity)getActivity()).setLocale("pl"); ((SettingsActivity)getActivity()).setLocale("pl");
PrefUtils.storeLocale(getActivity(),"pl"); PrefUtils.storeLocale(getActivity(),"pl");
LocaleHelper.setLocale(getActivity(), "pl");
}else{ }else{
LocaleHelper.setLocale(getActivity(), "en");
((SettingsActivity)getActivity()).setLocale("en"); ((SettingsActivity)getActivity()).setLocale("en");
PrefUtils.storeLocale(getActivity(),"en"); PrefUtils.storeLocale(getActivity(),"en");
} }

View File

@ -3,41 +3,36 @@ package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.app.TimePickerDialog; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.SwitchPreference; import android.preference.SwitchPreference;
import android.support.annotation.NonNull;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TimePicker;
import android.widget.Toast; import android.widget.Toast;
import com.annimon.stream.IntPair; import com.annimon.stream.IntPair;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException; import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.adapters.TutorsListAdapter;
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel; import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
import com.uam.wmi.findmytutor.network.ApiClient; import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService; import com.uam.wmi.findmytutor.service.PredefinedCoordinatesService;
import com.uam.wmi.findmytutor.service.PredefinedStatusesService; import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
import com.uam.wmi.findmytutor.utils.EnableSharingDialog; import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper; import com.uam.wmi.findmytutor.utils.RestApiHelper;
import com.uam.wmi.findmytutor.utils.RightButtonPreference; import com.uam.wmi.findmytutor.utils.RightButtonPreference;
import com.uam.wmi.findmytutor.utils.SharingLevel; import com.uam.wmi.findmytutor.utils.SharingLevel;
import org.apache.commons.collections4.BidiMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -49,6 +44,7 @@ import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableSingleObserver; import io.reactivex.observers.DisposableSingleObserver;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
@ -63,9 +59,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
protected RightButtonPreference removeManualStatus; protected RightButtonPreference removeManualStatus;
protected Preference manualStatus; protected Preference manualStatus;
protected ListPreference statusList; protected ListPreference statusList;
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
private HashMap<String, String> locationMap; private HashMap<String, String> locationMap;
private ArrayList<String> locationUUIDs; private ArrayList<String> locationUUIDs;
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
private HashMap<Integer, String> locationLevelMapping; private HashMap<Integer, String> locationLevelMapping;
private HashMap<Integer, String> statusMapping; private HashMap<Integer, String> statusMapping;
private PredefinedStatusesService statusesService; private PredefinedStatusesService statusesService;
@ -118,8 +114,10 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext()); String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
locationMap = new HashMap<String, String>(); locationMap = new HashMap<String, String>();
locationUUIDs = new ArrayList<String>(); locationUUIDs = new ArrayList<String>();
for (PredefinedCoordViewModel i : coords) locationMap.put(i.getPredefinedCoordinateId(),i.getName()); for (PredefinedCoordViewModel i : coords)
for (PredefinedCoordViewModel i : coords) locationUUIDs.add(i.getPredefinedCoordinateId()); 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> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList(); List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
predefinedCoordsList.addAll(coords); predefinedCoordsList.addAll(coords);
@ -143,8 +141,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
if (activesId.size() == 0) { if (activesId.size() == 0) {
setListPreferenceData(manualLocationList, stringnames, null); setListPreferenceData(manualLocationList, stringnames, null);
} } else {
else {
setListPreferenceData(manualLocationList, stringnames, activesId.get(0)); setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
} }
@ -197,7 +194,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext())); manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
/** Main sharing switch**/ /** Main sharing switch**/
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> { locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue); PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
@ -251,8 +247,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
}); });
/** Button 'choose from map' button listener **/ /** Button 'choose from map' button listener **/
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> { manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
@ -274,8 +268,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
if(statusesArray.length == 0) if (statusesArray.length == 0) {
{
builder.setTitle("nie ma wody na pustyni"); builder.setTitle("nie ma wody na pustyni");
} }
return true; return true;
@ -302,6 +295,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
})); }));
} }
public void showRemoveDialog(CharSequence[] entries, String service) { public void showRemoveDialog(CharSequence[] entries, String service) {
boolean[] checked = new boolean[entries.length]; boolean[] checked = new boolean[entries.length];
ArrayList<String> tobeDeleted = new ArrayList<String>(); ArrayList<String> tobeDeleted = new ArrayList<String>();
@ -415,6 +409,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show(); "Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
} }
} }
private void handleDeleteStatuses(List<String> resp) { private void handleDeleteStatuses(List<String> resp) {
if (resp.isEmpty()) { if (resp.isEmpty()) {
disableStatusPreferences(); disableStatusPreferences();
@ -431,14 +426,14 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
} }
} }
private void handleDeleteLocations(List<PredefinedCoordViewModel> resp) { private void handleDeleteLocations(List<PredefinedCoordViewModel> resp) {
getLocations(disposable); getLocations(disposable);
String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext()); String currentEntry = PrefUtils.getCurrentManualLocation(getApplicationContext());
if (resp.isEmpty()) { if (resp.isEmpty()) {
disableManualLocationPreferences(); disableManualLocationPreferences();
} else { } else {
if(!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty()) if (!Stream.of(resp).filter(x -> x.getName().equals(currentEntry)).toList().isEmpty()) {
{
for (PredefinedCoordViewModel location : resp) { for (PredefinedCoordViewModel location : resp) {
if (location.getName().equals(currentEntry)) { if (location.getName().equals(currentEntry)) {
manualLocationList.setValueIndex(resp.indexOf(location)); manualLocationList.setValueIndex(resp.indexOf(location));
@ -453,6 +448,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
} }
} }
private void disableStatusPreferences() { private void disableStatusPreferences() {
removeManualStatus.setEnabled(false); removeManualStatus.setEnabled(false);
statusList.setEnabled(false); statusList.setEnabled(false);
@ -461,12 +457,14 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
PrefUtils.disableStatus(getApplicationContext()); PrefUtils.disableStatus(getApplicationContext());
} }
private void enableStatusPreferences() { private void enableStatusPreferences() {
removeManualStatus.setEnabled(true); removeManualStatus.setEnabled(true);
statusList.setEnabled(true); statusList.setEnabled(true);
statusSwitch.setEnabled(true); statusSwitch.setEnabled(true);
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext())); statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
} }
private void disableManualLocationPreferences() { private void disableManualLocationPreferences() {
removeManualLocation.setEnabled(false); removeManualLocation.setEnabled(false);
manualLocationList.setEnabled(false); manualLocationList.setEnabled(false);
@ -477,6 +475,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle(); ((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
} }
private void enableManualLocationPreferences() { private void enableManualLocationPreferences() {
removeManualLocation.setEnabled(true); removeManualLocation.setEnabled(true);
manualLocationList.setEnabled(true); manualLocationList.setEnabled(true);
@ -507,4 +506,5 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
super.onDestroy(); super.onDestroy();
disposable.dispose(); disposable.dispose();
} }
} }

View File

@ -1,6 +1,7 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@ -11,6 +12,7 @@ import android.widget.ScrollView;
import android.widget.Toast; import android.widget.Toast;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import java.util.Locale; import java.util.Locale;
@ -19,6 +21,11 @@ public class StartupActivity extends AppCompatActivity {
private static final int AUTHENTICATION_REQUEST_CODE = 666; private static final int AUTHENTICATION_REQUEST_CODE = 666;
String currentLang; String currentLang;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View File

@ -1,10 +1,9 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
@ -29,12 +28,11 @@ import com.uam.wmi.findmytutor.model.User;
import com.uam.wmi.findmytutor.network.ApiClient; import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.TutorTabApi; import com.uam.wmi.findmytutor.service.TutorTabApi;
import com.uam.wmi.findmytutor.service.UserService; import com.uam.wmi.findmytutor.service.UserService;
import com.uam.wmi.findmytutor.utils.InfoHelperUtils; import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper; import com.uam.wmi.findmytutor.utils.RestApiHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -42,12 +40,10 @@ import java.util.regex.Pattern;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableCompletableObserver;
import io.reactivex.observers.DisposableSingleObserver; import io.reactivex.observers.DisposableSingleObserver;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import retrofit2.Response; import retrofit2.Response;
import static java.lang.String.valueOf; import static java.lang.String.valueOf;
public class TutorTab extends AppCompatActivity { public class TutorTab extends AppCompatActivity {
@ -69,6 +65,9 @@ public class TutorTab extends AppCompatActivity {
private DutyHoursAdapter dutyHoursAdapter; private DutyHoursAdapter dutyHoursAdapter;
private RecyclerView.LayoutManager dutyHoursLayoutManager; private RecyclerView.LayoutManager dutyHoursLayoutManager;
private TutorTabViewModel newTab; private TutorTabViewModel newTab;
public boolean isEmailValid(String email) public boolean isEmailValid(String email)
{ {
String regExpn = String regExpn =
@ -94,17 +93,18 @@ public class TutorTab extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
setContentView(R.layout.content_tutor_tab); setContentView(R.layout.content_tutor_tab);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.profile_activity_title));
setSupportActionBar(toolbar);
ButterKnife.bind(this); ButterKnife.bind(this);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(R.string.profile_activity_title);
setSupportActionBar(toolbar);
userName = findViewById(R.id.userName); userName = findViewById(R.id.userName);
userNote = (TextInputEditText) findViewById(R.id.userNote); userNote = findViewById(R.id.userNote);
userRoom = findViewById(R.id.userRoom); userRoom = findViewById(R.id.userRoom);
userEmail = findViewById(R.id.userEmail); userEmail = findViewById(R.id.userEmail);
department = findViewById(R.id.userDepartment); department = findViewById(R.id.userDepartment);
saveButon = findViewById(R.id.saveButon); saveButon = findViewById(R.id.saveButton);
scrapButton = findViewById(R.id.scrapTutorTab); scrapButton = findViewById(R.id.scrapTutorTab);
addDutyButton = findViewById(R.id.addDuty); addDutyButton = findViewById(R.id.addDuty);
dutyHoursRecycller = findViewById(R.id.dutyHourView); dutyHoursRecycller = findViewById(R.id.dutyHourView);
@ -304,4 +304,10 @@ public class TutorTab extends AppCompatActivity {
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
} }
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
} }

View File

@ -460,7 +460,7 @@ public class UsersListFragment extends Fragment {
private Observable<Coordinate> getCoordinateObservable(User user) { private Observable<Coordinate> getCoordinateObservable(User user) {
return coordinateService return coordinateService
.getTopCoordinatesByUserId(user.getId()) .getTopCoordinateByUserId(user.getId())
.toObservable() .toObservable()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());

View File

@ -1,8 +1,11 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
@ -36,6 +39,7 @@ import com.uam.wmi.findmytutor.model.StudentIdModel;
import com.uam.wmi.findmytutor.model.User; import com.uam.wmi.findmytutor.model.User;
import com.uam.wmi.findmytutor.network.ApiClient; import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.UserService; import com.uam.wmi.findmytutor.service.UserService;
import com.uam.wmi.findmytutor.utils.LocaleHelper;
import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration; import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener; import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
@ -69,9 +73,11 @@ public class WhiteList extends AppCompatActivity {
Switch aSwitch; Switch aSwitch;
@BindView(R.id.add_to_white_list_fab) @BindView(R.id.add_to_white_list_fab)
FloatingActionButton addToWhiteListFab; FloatingActionButton addToWhiteListFab;
@BindView(R.id.loader) @BindView(R.id.loader)
SpinKitView loader; SpinKitView loader;
private CompositeDisposable disposable = new CompositeDisposable(); private CompositeDisposable disposable = new CompositeDisposable();
private UserService userService; private UserService userService;
private boolean didFetched = false; private boolean didFetched = false;
@ -81,12 +87,19 @@ public class WhiteList extends AppCompatActivity {
private List<User> whitelistedUsers = new ArrayList<>(); private List<User> whitelistedUsers = new ArrayList<>();
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL")); private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
setContentView(R.layout.activity_white_list); setContentView(R.layout.activity_white_list);
ButterKnife.bind(this); ButterKnife.bind(this);
tutorId = PrefUtils.getUserId(getApplicationContext()); tutorId = PrefUtils.getUserId(getApplicationContext());
userService = ApiClient.getClient(getApplicationContext()) userService = ApiClient.getClient(getApplicationContext())
.create(UserService.class); .create(UserService.class);

View File

@ -25,7 +25,7 @@ public interface CoordinateService {
Single<List<Coordinate>> getCoordinatesByUserId(@Path("userId") String userId); Single<List<Coordinate>> getCoordinatesByUserId(@Path("userId") String userId);
@GET("api/coordinates/userTop/{userId}") @GET("api/coordinates/userTop/{userId}")
Single<Coordinate> getTopCoordinatesByUserId(@Path("userId") String userId); Single <Coordinate> getTopCoordinateByUserId(@Path("userId") String userId);
@GET("api/coordinates/top") @GET("api/coordinates/top")
Single<List<Coordinate>> getTopCoordinates(); Single<List<Coordinate>> getTopCoordinates();
@ -42,4 +42,6 @@ public interface CoordinateService {
@DELETE("api/coordinates/{id}") @DELETE("api/coordinates/{id}")
Completable deleteCoordinatesById(@Path("id") String id); Completable deleteCoordinatesById(@Path("id") String id);
} }

View File

@ -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;
}
}

View File

@ -1,10 +1,32 @@
package com.uam.wmi.findmytutor.utils; package com.uam.wmi.findmytutor.utils;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.support.v4.os.ConfigurationCompat; import android.support.v4.os.ConfigurationCompat;
import java.util.Locale;
public class LocaleUtils { public class LocaleUtils {
public static String getCurrentLocale() { public static String getCurrentLocale() {
return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration())); return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()));
} }
private static Context updateResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources res = context.getResources();
Configuration config = new Configuration(res.getConfiguration());
if (Build.VERSION.SDK_INT >= 22) {
config.setLocale(locale);
context = context.createConfigurationContext(config);
} else {
config.locale = locale;
res.updateConfiguration(config, res.getDisplayMetrics());
} }
return context;
}
}

View File

@ -5,30 +5,29 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fontFamily="@font/lato_regular" android:fontFamily="@font/lato_regular"
android:id="@+id/activity_tutor_tab"
tools:context=".activity.TutorTab"> tools:context=".activity.TutorTab">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar" android:id="@+id/toolbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="match_parent"
android:background="?attr/colorPrimary" android:fitsSystemWindows="true"
app:popupTheme="@style/AppTheme.PopupOverlay" /> app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleGravity="top|right"
app:toolbarId="@+id/toolbar"
/>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<include layout="@layout/content_tutor_tab" /> <include layout="@layout/content_tutor_tab" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -5,8 +5,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:id="@+id/activity_whitelist_container" android:id="@+id/activity_tutor_content"
tools:context=".activity.WhiteList"> tools:context=".activity.TutorTab">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/app_bar" android:id="@+id/app_bar"
@ -57,10 +58,4 @@
<include layout="@layout/content_tutor_tab_layout" /> <include layout="@layout/content_tutor_tab_layout" />
<!-- A RecyclerView with some commonly used attributes -->
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true" android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".activity.TutorTab" tools:context=".activity.TutorTab"
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" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
@ -113,6 +114,7 @@
android:layout_below="@+id/userRoomLayout" android:layout_below="@+id/userRoomLayout"
android:layout_alignStart="@+id/userRoomLayout" android:layout_alignStart="@+id/userRoomLayout"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:text="@string/dutyTitle" android:text="@string/dutyTitle"
@ -122,7 +124,7 @@
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/dutyHourView" android:id="@+id/dutyHourView"
android:layout_width="300dp" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_below="@+id/addDuty" android:layout_below="@+id/addDuty"
@ -135,7 +137,7 @@
<TextView <TextView
android:id="@+id/userNoteTitle" android:id="@+id/userNoteTitle"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/dutyHourView" android:layout_below="@+id/dutyHourView"
android:layout_alignStart="@+id/userRoomLayout" android:layout_alignStart="@+id/userRoomLayout"
@ -143,21 +145,24 @@
android:textColor="@color/mapboxRedDark" android:textColor="@color/mapboxRedDark"
android:textSize="18sp" /> android:textSize="18sp" />
<Button <android.support.v7.widget.AppCompatButton
android:id="@+id/addDuty" android:id="@+id/addDuty"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimary"
android:layout_alignBaseline="@+id/dutyTitle" android:layout_alignBaseline="@+id/dutyTitle"
android:layout_toEndOf="@+id/userRoomLayout" android:layout_toEndOf="@+id/dutyTitle"
android:text="@string/addDuty" /> android:text="@string/addDuty" />
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/userNoteLayout" android:id="@+id/userNoteLayout"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/userNoteTitle" android:layout_below="@+id/userNoteTitle"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
app:counterEnabled="true" app:counterEnabled="true"
app:counterMaxLength="1000"> app:counterMaxLength="1000">
@ -165,7 +170,7 @@
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/userNote" android:id="@+id/userNote"
android:layout_width="300dp" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_alignStart="@+id/userNoteLayout" android:layout_alignStart="@+id/userNoteLayout"
android:hint="@string/tutorTabHint" android:hint="@string/tutorTabHint"
@ -179,21 +184,24 @@
android:textColor="@color/note_list_text" /> android:textColor="@color/note_list_text" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<Button <android.support.v7.widget.AppCompatButton
android:id="@+id/scrapTutorTab" android:id="@+id/scrapTutorTab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/personalInfoTitle" android:layout_alignBaseline="@+id/personalInfoTitle"
android:layout_alignEnd="@+id/userEmailLayout" android:layout_alignEnd="@+id/userEmailLayout"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimary"
android:text="@string/scrap_tutor_tab" /> android:text="@string/scrap_tutor_tab" />
<Button <android.support.v7.widget.AppCompatButton
android:id="@+id/saveButton"
android:id="@+id/saveButon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/userNoteLayout" android:layout_below="@+id/userNoteLayout"
android:layout_alignEnd="@+id/dutyHourView" android:layout_alignEnd="@+id/dutyHourView"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimary"
android:text="@string/saveButton" /> android:text="@string/saveButton" />

View File

@ -1,13 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="right" android:gravity="right"
android:fontFamily="@font/lato_regular"
> >
<Button xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.AppCompatButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/button_choose_from_map" android:id="@+id/button_choose_from_map"
android:text="@string/preference_manual_location_button" android:text="@string/preference_manual_location_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textColor="@color/white"
app:backgroundTint="@color/top_user_modal"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
</LinearLayout> </LinearLayout>

View File

@ -57,7 +57,7 @@
<string name="navigation_item_blacklist">Czarna lista</string> <string name="navigation_item_blacklist">Czarna lista</string>
<string name="navigation_item_whitelist">Biała lista</string> <string name="navigation_item_whitelist">Biała lista</string>
<string name="navigation_item_settings">Ustawienia</string> <string name="navigation_item_settings">Ustawienia</string>
<string name="navigation_item_profile">Profil uzytkownika</string> <string name="navigation_item_profile">Profil użytkownika</string>
<string name="navigation_item_logout">Wyloguj</string> <string name="navigation_item_logout">Wyloguj</string>
<!-- Tutors list --> <!-- Tutors list -->
<string name="action_settings">Ustawienia</string> <string name="action_settings">Ustawienia</string>
@ -287,8 +287,7 @@
<string name="last_sign">Ostatnio</string> <string name="last_sign">Ostatnio</string>
<string name="available_now">Dostępny teraz</string> <string name="available_now">Dostępny teraz</string>
<string name="profile_activity_title">Profil</string> <string name="profile_activity_title">Profil użytkownika</string>
</resources> </resources>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pref_screen" android:id="@+id/pref_screen"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fontFamily="@font/lato_regular"> android:fontFamily="@font/lato_regular">
@ -58,6 +59,8 @@
android:title="@string/title_manual_status" /> android:title="@string/title_manual_status" />
<com.uam.wmi.findmytutor.utils.RightButtonPreference <com.uam.wmi.findmytutor.utils.RightButtonPreference
android:key="remove_manual_status" android:key="remove_manual_status"
android:textColor="@color/white"
app:backgroundTint="@color/mapboxRedDark"
android:text="@string/preference_manual_status_button_remove" /> android:text="@string/preference_manual_status_button_remove" />
</PreferenceCategory> </PreferenceCategory>