Black list ready to test

This commit is contained in:
Domagalski 2018-12-30 21:13:23 +01:00
commit 84e6b95675
29 changed files with 838 additions and 255 deletions

View File

@ -29,7 +29,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -21,6 +21,7 @@ import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -34,7 +35,6 @@ import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService; import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
import com.uam.wmi.findmytutor.utils.ActiveFragment; import com.uam.wmi.findmytutor.utils.ActiveFragment;
import com.uam.wmi.findmytutor.utils.FeedbackUtils; import com.uam.wmi.findmytutor.utils.FeedbackUtils;
import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
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;
@ -51,6 +51,7 @@ import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
import static com.uam.wmi.findmytutor.utils.Const.defaultMapZoom; import static com.uam.wmi.findmytutor.utils.Const.defaultMapZoom;
import static com.uam.wmi.findmytutor.utils.Const.searchMapZoom; import static com.uam.wmi.findmytutor.utils.Const.searchMapZoom;
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus; import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
@ -88,9 +89,11 @@ public abstract class BaseActivity
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(getContentViewId()); setContentView(getContentViewId());
drawerNavigationView = findViewById(R.id.nav_view); drawerNavigationView = findViewById(R.id.nav_view);
sideDrawer = findViewById(R.id.activity_container); sideDrawer = findViewById(R.id.activity_container);
feedbackUtils = new FeedbackUtils(BaseActivity.this); feedbackUtils = new FeedbackUtils(BaseActivity.this);
drawerNavigationView.setNavigationItemSelectedListener( drawerNavigationView.setNavigationItemSelectedListener(
item -> { item -> {
String itemName = (String) item.getTitle(); String itemName = (String) item.getTitle();
@ -197,7 +200,10 @@ public abstract class BaseActivity
public void stopBackgroundLocalizationTask() { public void stopBackgroundLocalizationTask() {
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class); Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
stopIntent.putExtra("request_stop", true); stopIntent.putExtra("request_stop", true);
startService(stopIntent); Log.e("Localization", "JEstem w stop BG");
stopService(stopIntent);
} }
public void startBackgroundLocalizationTask() { public void startBackgroundLocalizationTask() {
@ -213,12 +219,17 @@ public abstract class BaseActivity
} }
public void handleBackgroundTaskLifeCycle() { public void handleBackgroundTaskLifeCycle() {
Log.e("Localization", String.valueOf(PrefUtils.isEnableSharingLocalization(getApplicationContext())));
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor; Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor;
Log.e("Localization", String.valueOf(shouldServiceRun));
if (shouldServiceRun) { if (shouldServiceRun) {
startBackgroundLocalizationTask(); startBackgroundLocalizationTask();
Log.e("Localization", "JEstem i odpalam");
} else { } else {
stopBackgroundLocalizationTask(); stopBackgroundLocalizationTask();
Log.e("Localization", "JEstem i nie odpalam");
} }
} }

View File

@ -4,8 +4,6 @@ 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.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.location.Location; import android.location.Location;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -13,14 +11,11 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -52,7 +47,9 @@ import com.uam.wmi.findmytutor.service.CoordinateService;
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.ApproximatedLocalization; import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
import com.uam.wmi.findmytutor.utils.ManualLocationUtils; import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
import com.uam.wmi.findmytutor.utils.MapMarker; import com.uam.wmi.findmytutor.utils.MapMarker;
import com.uam.wmi.findmytutor.utils.MapUtils; import com.uam.wmi.findmytutor.utils.MapUtils;
@ -73,8 +70,6 @@ import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import timber.log.Timber; import timber.log.Timber;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class MapActivity extends BaseActivity public class MapActivity extends BaseActivity
implements PermissionsListener, OnMapReadyCallback { implements PermissionsListener, OnMapReadyCallback {
@ -111,6 +106,7 @@ public class MapActivity extends BaseActivity
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
isTutor = PrefUtils.getIsTutor(this); isTutor = PrefUtils.getIsTutor(this);
myId = PrefUtils.getUserId(getApplicationContext()); myId = PrefUtils.getUserId(getApplicationContext());
@ -131,6 +127,7 @@ public class MapActivity extends BaseActivity
}; };
selectLocationButton = findViewById(R.id.select_location_button); selectLocationButton = findViewById(R.id.select_location_button);
removeLocationButton = findViewById(R.id.remove_location_button); removeLocationButton = findViewById(R.id.remove_location_button);
mapView = findViewById(R.id.mapView); mapView = findViewById(R.id.mapView);
@ -141,7 +138,6 @@ public class MapActivity extends BaseActivity
handleBackgroundTaskLifeCycle(); handleBackgroundTaskLifeCycle();
manualLocationUtils = new ManualLocationUtils(MapActivity.this); manualLocationUtils = new ManualLocationUtils(MapActivity.this);
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson")); approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
} }
@Override @Override
@ -154,7 +150,7 @@ public class MapActivity extends BaseActivity
String id = markerUserHash.get(marker.getId()); String id = markerUserHash.get(marker.getId());
String locationLevel = PrefUtils.getLocationLevel(getApplicationContext()); String locationLevel = PrefUtils.getLocationLevel(getApplicationContext());
if (id.equals(myId) && (locationLevel.equals(SharingLevel.MANUAL.toString()) || locationLevel.equals(SharingLevel.PREDEFINED.toString()))) { /* if (id.equals(myId) && (locationLevel.equals(SharingLevel.MANUAL.toString()) || locationLevel.equals(SharingLevel.PREDEFINED.toString()))) {
selectLocationButton.setVisibility(View.GONE); selectLocationButton.setVisibility(View.GONE);
removeLocationButton.setVisibility(View.VISIBLE); removeLocationButton.setVisibility(View.VISIBLE);
@ -165,9 +161,9 @@ public class MapActivity extends BaseActivity
Toast.makeText(MapActivity.this, R.string.manual_marker_info, Toast.LENGTH_SHORT).show(); Toast.makeText(MapActivity.this, R.string.manual_marker_info, Toast.LENGTH_SHORT).show();
}); });
} else { } else {*/
createMarkerModal(id); createMarkerModal(id);
} /* }*/
return true; return true;
}); });
@ -219,14 +215,19 @@ public class MapActivity extends BaseActivity
TextView sharingLevelView = view.findViewById(R.id.sharing_level); TextView sharingLevelView = view.findViewById(R.id.sharing_level);
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName())); userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
if(cordStatus.equals("")){
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), getString(R.string.lack_of_status)));
}else{
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), cordStatus)); status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), cordStatus));
}
sharingLevelView.setText(String.format("%s: %s", getResources().getString(R.string.settings_location_level), sharingLevel)); sharingLevelView.setText(String.format("%s: %s", getResources().getString(R.string.settings_location_level), sharingLevel));
final AlertDialog alertDialog = alertDialogBuilderUserInput.create(); final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
alertDialog.show(); alertDialog.show();
} }
private void handleError(Throwable error) { private void handleError(Throwable error) {
showError(error); showError(error);
} }
@ -234,8 +235,6 @@ public class MapActivity extends BaseActivity
private void showError(Throwable e) { private void showError(Throwable e) {
String message; String message;
Log.e("ERR", e.toString());
if (e instanceof HttpException) { if (e instanceof HttpException) {
ResponseBody responseBody = ((HttpException) e).response().errorBody(); ResponseBody responseBody = ((HttpException) e).response().errorBody();
message = RestApiHelper.getErrorMessage(responseBody); message = RestApiHelper.getErrorMessage(responseBody);
@ -290,6 +289,11 @@ public class MapActivity extends BaseActivity
PrefUtils.getLocationLevel(getApplicationContext()) PrefUtils.getLocationLevel(getApplicationContext())
); );
if (!PrefUtils.isEnableSharingLocalization(getApplicationContext())) {
EnableSharingDialog sharingDialog = new EnableSharingDialog();
sharingDialog.show(getFragmentManager(), "Sharing");
}
PrefUtils.putManualLocation(this, latLng, approximatedLocation); PrefUtils.putManualLocation(this, latLng, approximatedLocation);
handleBackgroundTaskLifeCycle(); handleBackgroundTaskLifeCycle();
@ -333,10 +337,14 @@ public class MapActivity extends BaseActivity
alertDialog.setOnShowListener(dialogInterface -> { alertDialog.setOnShowListener(dialogInterface -> {
Button sendButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); Button sendButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
Button dismissButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); Button dismissButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
dismissButton.setOnClickListener(view1 -> alertDialog.dismiss()); dismissButton.setOnClickListener(view1 -> {
PrefUtils.putCurrentManualLocationName(getApplicationContext(), "Inne");
PrefUtils.putCurrentManualLocation(getApplicationContext(), "-1");
alertDialog.dismiss();
});
sendButton.setOnClickListener(view1 -> { sendButton.setOnClickListener(view1 -> {
String body = modalUserInput.getText().toString(); String body = modalUserInput.getText().toString();

View File

@ -11,6 +11,7 @@ import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
@ -54,7 +55,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
Preference languagesList = findPreference(getResources().getString(R.string.key_language)); Preference languagesList = findPreference(getResources().getString(R.string.key_language));
languagesList.setDefaultValue(0); languagesList.setDefaultValue(0);
if(PrefUtils.getLocale(getActivity()).equals("pl")){ if(PrefUtils.getLocale(getActivity()).equals("1")){
languagesList.setDefaultValue(1); languagesList.setDefaultValue(1);
} }

View File

@ -2,11 +2,13 @@ package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.SharedPreferences;
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.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -20,6 +22,8 @@ import com.uam.wmi.findmytutor.R;
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.PredefinedStatusesService; import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
import com.uam.wmi.findmytutor.utils.Const;
import com.uam.wmi.findmytutor.utils.EnableSharingDialog;
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;
@ -39,8 +43,8 @@ import okhttp3.ResponseBody;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class SharingFragment extends PreferenceFragment { public class SharingFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
protected Preference locationSharing; protected SwitchPreference locationSharing;
protected Preference locationMode; protected Preference locationMode;
protected ListPreference manualLocationList; protected ListPreference manualLocationList;
protected PreferenceCategory preferenceCategory; protected PreferenceCategory preferenceCategory;
@ -85,25 +89,27 @@ public class SharingFragment extends PreferenceFragment {
@Override @Override
public void onSuccess(List<PredefinedCoordViewModel> coords) { public void onSuccess(List<PredefinedCoordViewModel> coords) {
List<String> names = Stream.of(coords).map(PredefinedCoordViewModel::getName).collect(com.annimon.stream.Collectors.toList());
predefinedCoordsList.addAll(coords);
String[] stringnames = names.toArray(new String[0]);
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext()); String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
List<Integer> activeId = Stream.of(coords).indexed() List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
predefinedCoordsList.addAll(coords);
String[] stringnames = predefinedLocationsNames.toArray(new String[0]);
List<Integer> activesId = Stream.of(coords).indexed()
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList(); .filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
if(activeId.size() > 0) if( activesId.size() == 0){
setListPreferenceData(manualLocationList, stringnames, activeId.get(0));
else{
setListPreferenceData(manualLocationList, stringnames, null); setListPreferenceData(manualLocationList, stringnames, null);
} }
else {
setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
}
} }
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show();
} }
})); }));
} }
@ -113,7 +119,7 @@ public class SharingFragment extends PreferenceFragment {
public void onCreate(final Bundle savedInstanceState) { public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.pref_sharing); addPreferencesFromResource(R.layout.pref_sharing);
locationSharing = findPreference("key_sharing_enabled"); locationSharing = (SwitchPreference) findPreference("key_sharing_enabled");
locationMode = findPreference("key_location_level"); locationMode = findPreference("key_location_level");
preferenceCategory = (PreferenceCategory) findPreference("category_sharing"); preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
manualLocationList = (ListPreference) findPreference("key_manual_location_value"); manualLocationList = (ListPreference) findPreference("key_manual_location_value");
@ -137,7 +143,7 @@ public class SharingFragment extends PreferenceFragment {
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext())); statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext())); manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
// manualLocationList.setSummary(PrefUtils.getManualLocation(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);
@ -149,7 +155,8 @@ public class SharingFragment extends PreferenceFragment {
locationMode.setOnPreferenceChangeListener((preference, newValue) -> { locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue))); PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
if (!predefinedCoordsList.isEmpty()) { if (!predefinedCoordsList.isEmpty()) {
preferenceCategory.addPreference(manualLocationList); preferenceCategory.addPreference(manualLocationList);
} }
@ -167,12 +174,6 @@ public class SharingFragment extends PreferenceFragment {
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) { if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
preferenceCategory.removePreference(manualLocationList); preferenceCategory.removePreference(manualLocationList);
preferenceCategory.removePreference(manualLocationButton); preferenceCategory.removePreference(manualLocationButton);
}else{
// if(predefinedCoordsList.isEmpty()){
//// preferenceCategory.removePreference(manualLocationList);
//
//
// }
} }
/** Custom manual location list change listener **/ /** Custom manual location list change listener **/
@ -180,14 +181,24 @@ public class SharingFragment extends PreferenceFragment {
ListPreference lp = (ListPreference) preference; ListPreference lp = (ListPreference) preference;
CharSequence[] entries = lp.getEntries(); CharSequence[] entries = lp.getEntries();
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).toList().get(0); PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).toList().get(0);
//sharing dialog -> ask for start BG
if (!PrefUtils.isEnableSharingLocalization(getApplicationContext())) {
EnableSharingDialog sharingDialog = new EnableSharingDialog();
sharingDialog.show(getFragmentManager(), "Sharing");
}
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation()); PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation());
PrefUtils.putCurrentManualLocation(getApplicationContext(), temp.getPredefinedCoordinateId()); PrefUtils.putCurrentManualLocation(getApplicationContext(), temp.getPredefinedCoordinateId());
PrefUtils.putCurrentManualLocationName(getApplicationContext(), (String) lp.getEntries()[Integer.parseInt((String) newValue)]); PrefUtils.putCurrentManualLocationName(getApplicationContext(), (String) lp.getEntries()[Integer.parseInt((String) newValue)]);
lp.setSummary(lp.getEntries()[Integer.parseInt((String) newValue)]); lp.setSummary(lp.getEntries()[Integer.parseInt((String) newValue)]);
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
return true; return true;
}); });
/** Button 'choose from map' button listener **/ /** Button 'choose from map' button listener **/
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> { manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
@ -204,6 +215,7 @@ public class SharingFragment extends PreferenceFragment {
lp.setSummary(entries[Integer.parseInt((String) newValue)]); lp.setSummary(entries[Integer.parseInt((String) newValue)]);
return true; return true;
}); });
/** Custom status list change listener **/ /** Custom status list change listener **/
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> { manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
@ -212,11 +224,8 @@ public class SharingFragment extends PreferenceFragment {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError)); .subscribe(this::handleResponse, this::handleError));
return true; return true;
}); });
} }
@Override @Override
@ -228,7 +237,7 @@ public class SharingFragment extends PreferenceFragment {
} }
protected void setListPreferenceData(ListPreference lp, String[] entries, Integer activeId) { protected void setListPreferenceData(ListPreference lp, String[] entries, Integer activeId) {
Log.d("setlistpref",lp.getKey());
try { try {
lp.setEntries(entries); lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence[entries.length]; CharSequence[] entryValues = new CharSequence[entries.length];
@ -247,7 +256,9 @@ public class SharingFragment extends PreferenceFragment {
Log.e("Failed to set listPref", e.getMessage()); Log.e("Failed to set listPref", e.getMessage());
} }
}; }
;
private void handleResponse(List<String> resp) { private void handleResponse(List<String> resp) {
String[] statusesArray = resp.toArray(new String[resp.size()]); String[] statusesArray = resp.toArray(new String[resp.size()]);
@ -257,8 +268,6 @@ public class SharingFragment extends PreferenceFragment {
statusList.setValueIndex(resp.size() - 1); statusList.setValueIndex(resp.size() - 1);
PrefUtils.storeStatus(getApplicationContext(), resp.get(resp.size() - 1)); PrefUtils.storeStatus(getApplicationContext(), resp.get(resp.size() - 1));
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext())); statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
} }
private void handleError(Throwable error) { private void handleError(Throwable error) {
@ -273,4 +282,22 @@ public class SharingFragment extends PreferenceFragment {
} }
} }
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
locationSharing.setChecked(PrefUtils.isEnableSharingLocalization(getApplicationContext()));
}
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
} }

View File

@ -23,6 +23,7 @@ public class StartupActivity extends AppCompatActivity {
if (PrefUtils.isLoggedIn(getApplicationContext())){ if (PrefUtils.isLoggedIn(getApplicationContext())){
Intent startupIntent = new Intent(this, MapActivity.class); Intent startupIntent = new Intent(this, MapActivity.class);
PrefUtils.storeLocale(getApplicationContext(),PrefUtils.getLocale(getApplicationContext()));
startupIntent.putExtra(currentLang, PrefUtils.getLocale(getApplicationContext())); startupIntent.putExtra(currentLang, PrefUtils.getLocale(getApplicationContext()));
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(startupIntent); startActivity(startupIntent);

View File

@ -1,17 +1,25 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Adapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
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.DutyHoursAdapter;
import com.uam.wmi.findmytutor.model.DutyHour;
import com.uam.wmi.findmytutor.model.DutyHourViewModel; import com.uam.wmi.findmytutor.model.DutyHourViewModel;
import com.uam.wmi.findmytutor.model.TutorTabViewModel; import com.uam.wmi.findmytutor.model.TutorTabViewModel;
import com.uam.wmi.findmytutor.model.User; import com.uam.wmi.findmytutor.model.User;
@ -22,6 +30,7 @@ import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper; import com.uam.wmi.findmytutor.utils.RestApiHelper;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -38,32 +47,41 @@ public class TutorTab extends AppCompatActivity {
private CompositeDisposable disposable = new CompositeDisposable(); private CompositeDisposable disposable = new CompositeDisposable();
private TextView userName; private TextView userName;
private TextView userDutyHours; private TextView userDutyHours;
private EditText userNote; private TextInputEditText userNote;
private TextView userRoom; private TextView userRoom;
private TextView userEmail; private TextView userEmail;
private TextView department; private TextView department;
private Button addDutyButton;
private Button saveButon; private Button saveButon;
private Boolean ifTutorTabExists = true;
private List<DutyHourViewModel> dutyHourList;
private RecyclerView dutyHoursRecycller;
private DutyHoursAdapter dutyHoursAdapter;
private RecyclerView.LayoutManager dutyHoursLayoutManager;
private TutorTabViewModel newTab; private TutorTabViewModel newTab;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.content_tutor_tab);
userName = findViewById(R.id.userName);
userNote = (TextInputEditText) findViewById(R.id.userNote);
userRoom = findViewById(R.id.userRoom);
userEmail = findViewById(R.id.userEmail);
department = findViewById(R.id.userDepartment);
saveButon = findViewById(R.id.saveButon);
addDutyButton = findViewById(R.id.addDuty);
dutyHoursRecycller = (RecyclerView) findViewById(R.id.dutyHourView);
dutyHoursLayoutManager = new LinearLayoutManager(this);
dutyHoursRecycller.setLayoutManager(dutyHoursLayoutManager);
tutorTabService = ApiClient.getClient(getApplicationContext()) tutorTabService = ApiClient.getClient(getApplicationContext())
.create(TutorTabApi.class); .create(TutorTabApi.class);
userService = ApiClient.getClient(getApplicationContext()) userService = ApiClient.getClient(getApplicationContext())
.create(UserService.class); .create(UserService.class);
setContentView(R.layout.content_tutor_tab);
TextView userName = findViewById(R.id.userName);
TextView userDutyHours = findViewById(R.id.userDutyHours);
EditText userNote = findViewById(R.id.userNote);
TextView userRoom = findViewById(R.id.userRoom);
TextView userEmail = findViewById(R.id.userEmail);
TextView department = findViewById(R.id.userDepartment);
Button saveButon = findViewById(R.id.saveButon);
findViewById(R.id.contentTutorTabInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_tutor_tab));
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
disposable.add( disposable.add(
tutorTabService.apiUsersTutorTabByTutorIdGet(PrefUtils.getUserId(getApplicationContext())) tutorTabService.apiUsersTutorTabByTutorIdGet(PrefUtils.getUserId(getApplicationContext()))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -72,23 +90,49 @@ public class TutorTab extends AppCompatActivity {
@Override @Override
public void onSuccess(TutorTabViewModel tutorTabViewModel) { public void onSuccess(TutorTabViewModel tutorTabViewModel) {
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours()) dutyHourList = tutorTabViewModel.getDutyHours();
.map(DutyHourViewModel::getSummary).toList(); if(dutyHourList == null){
}else{
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom())); dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),dutyHourList);
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab())); dutyHoursRecycller.setAdapter(dutyHoursAdapter);
addDutyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addEmptyDuty(dutyHoursAdapter);
}
});
}
userRoom.setText(String.format("%s", tutorTabViewModel.getRoom()));
userEmail.setText(String.format("%s", tutorTabViewModel.getEmailTutorTab()));
if (!tutorTabViewModel.getNote().equals("")) { if (!tutorTabViewModel.getNote().equals("")) {
userNote.setText(String.format("%s", tutorTabViewModel.getNote())); userNote.setText(String.format("%s", tutorTabViewModel.getNote()));
} }
userDutyHours.setText(String.format("%s: %s", getString(R.string.userDutyHoursHeader), Arrays.toString(dutyHoursList.toArray())));
} }
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
int code = ((HttpException) e).response().code();
if( code == 404){
ifTutorTabExists = false;
dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),new ArrayList<DutyHourViewModel>());
dutyHoursRecycller.setAdapter(dutyHoursAdapter);
addDutyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addEmptyDuty(dutyHoursAdapter);
}
});
}
showError(e); showError(e);
} }
})); }));
findViewById(R.id.contentTutorTabInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_tutor_tab));
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
disposable.add( disposable.add(
userService.getUserById(PrefUtils.getUserId(getApplicationContext())) userService.getUserById(PrefUtils.getUserId(getApplicationContext()))
@ -104,18 +148,33 @@ public class TutorTab extends AppCompatActivity {
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
showError(e); showError(e);
} }
})); }));
setUpSaveListener(saveButon, userNote); setUpSaveListener(saveButon);
}
private void addEmptyDuty(DutyHoursAdapter adapter){
adapter.addDuty(new DutyHourViewModel());
adapter.notifyItemInserted(adapter.getItemCount());
dutyHoursRecycller.scrollToPosition(adapter.getItemCount()-1);
} }
private void setUpSaveListener(Button button, EditText note) { private void setUpSaveListener(Button button) {
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString()); newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),
userRoom.getText().toString(),
userEmail.getText().toString(),
userNote.getText().toString(),
dutyHoursAdapter.getDutyList());
if(ifTutorTabExists){
putUserTab(newTab); putUserTab(newTab);
}else{
postUserTab(newTab);
ifTutorTabExists=true;
}
} }
}); });
} }
@ -124,11 +183,21 @@ public class TutorTab extends AppCompatActivity {
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel) disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError)); .subscribe(this::handleResponsePut, this::handleError));
}
private void postUserTab(TutorTabViewModel tutorTabViewModel) {
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPost(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponsePost, this::handleError));
} }
private void handleResponse(TutorTabViewModel tutorTabViewModel) { private void handleResponsePut(Response<Void> resp) {
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.updateToast), Toast.LENGTH_SHORT).show();
}
private void handleResponsePost(TutorTabViewModel tutorTabViewModel ) {
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.updateToast), Toast.LENGTH_SHORT).show();
} }
@ -155,9 +224,6 @@ public class TutorTab extends AppCompatActivity {
} else { } else {
message = "Network Error!"; message = "Network Error!";
} }
// Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
// .show();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
} }

View File

@ -0,0 +1,163 @@
package com.uam.wmi.findmytutor.adapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class DutyHoursAdapter extends RecyclerView.Adapter<DutyHoursAdapter.MyViewHolder> {
private Context context;
private List<DutyHourViewModel> hours;
public DutyHoursAdapter(Context context, List<DutyHourViewModel> hours) {
this.context = context;
this.hours = new ArrayList<DutyHourViewModel>(hours);
}
public List<DutyHourViewModel> getDutyList(){
ArrayList<DutyHourViewModel> notEmpty = Stream.of(hours).filter(DutyHourViewModel::isValid).collect(Collectors.toCollection(ArrayList::new));
return notEmpty;
}
public void addDuty(DutyHourViewModel duty){
hours.add(duty);
}
private void removeDuty(int pos){
hours.remove(pos);
this.notifyItemRemoved(pos);
Log.d("DutyIndex af rm size",Integer.toString(getItemCount()));
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.duty_hour_row, parent, false);
return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
DutyHourViewModel duty = hours.get(position);
holder.dutyDay.setText(duty.getDay());
holder.dutyDay.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
duty.setDay(holder.dutyDay.getText().toString());
}
});
holder.dutyStart.setText(duty.getStart());
holder.dutyStart.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
duty.setStart(holder.dutyStart.getText().toString());
}
});
holder.dutyStop.setText(duty.getEnd());
holder.dutyStop.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
duty.setEnd(holder.dutyStop.getText().toString());
}
});
holder.deleteRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try{
Log.d("DutyIndex bf rm size",Integer.toString(getItemCount()));
Log.d("DutyIndex bf rm pos",Integer.toString(holder.getLayoutPosition()));
removeDuty(holder.getLayoutPosition());
Log.d("DutyIndex af rm pos",Integer.toString(holder.getLayoutPosition()));
}catch(Error e){
Log.e("DutyIndex error",e.getMessage());
Log.e("DutyIndex size",Integer.toString(getItemCount()));
Log.e("DutyIndex pos",Integer.toString(holder.getAdapterPosition()));
}
}
});
}
@Override
public int getItemCount() {
return hours.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.duty_day_value)
TextView dutyDay;
@BindView(R.id.duty_start_value)
TextView dutyStart;
@BindView(R.id.duty_stop_value)
TextView dutyStop;
@BindView(R.id.deleteRow)
ImageButton deleteRow;
MyViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
}
}

View File

@ -24,6 +24,20 @@ public class DutyHourViewModel {
this.day = day; this.day = day;
return this; return this;
} }
public Boolean isValid(){
if(this.day.isEmpty()){
return false;
}else if( !this.start.isEmpty() && this.end.isEmpty() ){
return false;
}else{
return true;
}
}
public DutyHourViewModel(){
day="";
start="";
end="";
}
/** /**
* Get day * Get day
@ -94,12 +108,11 @@ public class DutyHourViewModel {
return Objects.hash(day, start, end); return Objects.hash(day, start, end);
} }
public String getSummary() { public String getSummary() {
return this.getDay() + " " + this.getStart() + " " + this.getEnd(); return this.getDay() + ": " + this.getStart() + " - " + this.getEnd();
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@ -33,11 +33,12 @@ public class TutorTabViewModel {
@SerializedName("dutyHours") @SerializedName("dutyHours")
private List<DutyHourViewModel> dutyHours = null; private List<DutyHourViewModel> dutyHours = null;
public TutorTabViewModel(String userId, String note){ public TutorTabViewModel(String userId, String room, String email, String note, List<DutyHourViewModel> dutyHours){
this.userId=userId; this.userId=userId;
// this.room=room; this.room=room;
// this.emailTutorTab=emailTutorTab; this.emailTutorTab=email;
this.note=note; this.note=note;
this.dutyHours = new ArrayList<DutyHourViewModel>(dutyHours);
} }
public TutorTabViewModel tutorTabId(UUID tutorTabId) { public TutorTabViewModel tutorTabId(UUID tutorTabId) {

View File

@ -27,7 +27,6 @@ public class ApiClient {
private static Retrofit retrofit = null; private static Retrofit retrofit = null;
private static int REQUEST_TIMEOUT = 60; private static int REQUEST_TIMEOUT = 60;
private static OkHttpClient okHttpClient; private static OkHttpClient okHttpClient;
// private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
public static Retrofit getClient(Context context) { public static Retrofit getClient(Context context) {

View File

@ -5,6 +5,7 @@ import com.uam.wmi.findmytutor.model.TutorTabViewModel;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.Single; import io.reactivex.Single;
import retrofit2.Response;
import retrofit2.http.*; import retrofit2.http.*;
@ -40,6 +41,10 @@ public interface TutorTabApi {
@retrofit2.http.Path("tutorId") String tutorId @retrofit2.http.Path("tutorId") String tutorId
); );
@POST("api/users/tutorTab/{tutorId}")
Single<TutorTabViewModel> apiUsersTutorTabByTutorIdPost(
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
);
/** /**
* *
* *
@ -51,7 +56,7 @@ public interface TutorTabApi {
"Content-Type:application/json" "Content-Type:application/json"
}) })
@PUT("api/users/tutorTab/{tutorId}") @PUT("api/users/tutorTab/{tutorId}")
Observable<TutorTabViewModel> apiUsersTutorTabByTutorIdPut( Observable<Response<Void>> apiUsersTutorTabByTutorIdPut(
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab @retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
); );

View File

@ -1,25 +1,18 @@
package com.uam.wmi.findmytutor.utils; package com.uam.wmi.findmytutor.utils;
import android.support.annotation.NonNull;
import com.google.gson.GsonBuilder;
import com.mapbox.geojson.BoundingBox;
import com.mapbox.geojson.Feature; import com.mapbox.geojson.Feature;
import com.mapbox.geojson.FeatureCollection; import com.mapbox.geojson.FeatureCollection;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point; import com.mapbox.geojson.Point;
import com.mapbox.geojson.Polygon; import com.mapbox.geojson.Polygon;
import com.mapbox.geojson.gson.BoundingBoxDeserializer; import com.mapbox.turf.TurfClassification;
import com.mapbox.geojson.gson.GeoJsonAdapterFactory;
import com.mapbox.geojson.gson.GeometryDeserializer;
import com.mapbox.geojson.gson.PointDeserializer;
import com.mapbox.turf.TurfJoins; import com.mapbox.turf.TurfJoins;
import com.mapbox.turf.TurfMeasurement;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
; ;import static com.mapbox.geojson.FeatureCollection.fromJson;
public class ApproximatedLocalization { public class ApproximatedLocalization {
private FeatureCollection buildingSchema = null; private FeatureCollection buildingSchema = null;
@ -28,17 +21,6 @@ public class ApproximatedLocalization {
buildingSchema = fromJson(buildingObject); buildingSchema = fromJson(buildingObject);
} }
private FeatureCollection fromJson(@NonNull String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointDeserializer());
gson.registerTypeAdapter(Geometry.class, new GeometryDeserializer());
gson.registerTypeAdapter(BoundingBox.class, new BoundingBoxDeserializer());
return gson.create().fromJson(json, FeatureCollection.class);
}
public String getNameOfBuildingPart(Point point) { public String getNameOfBuildingPart(Point point) {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) { for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
@ -56,7 +38,9 @@ public class ApproximatedLocalization {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) { for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
String partName = feature.getStringProperty("name"); String partName = feature.getStringProperty("name");
if (buildingPart != null && buildingPart.equals(partName)) { if (buildingPart != null && buildingPart.equals(partName)) {
Double longitude = feature.getNumberProperty("longitude").doubleValue(); Double longitude = feature.getNumberProperty("longitude").doubleValue();
Double latitude = feature.getNumberProperty("latitude").doubleValue(); Double latitude = feature.getNumberProperty("latitude").doubleValue();

View File

@ -7,7 +7,7 @@ import java.util.List;
public class Const { public class Const {
public final static String BASE_URL = "https://s416084.projektstudencki.pl/master/"; public final static String BASE_URL = "https://s416084.projektstudencki.pl/master/";
public final static Integer onlineBackgroundLocationInterval = 15000; public final static Integer onlineBackgroundLocationInterval = 7000;
public final static Integer offlineBackgroundLocationInterval = 36000; public final static Integer offlineBackgroundLocationInterval = 36000;
public final static Integer defaultMapZoom = 17; public final static Integer defaultMapZoom = 17;
public final static Integer searchMapZoom = 13; public final static Integer searchMapZoom = 13;

View File

@ -0,0 +1,31 @@
package com.uam.wmi.findmytutor.utils;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.widget.Toast;
import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.activity.MapActivity;
public class EnableSharingDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.sharing_modal_title)
.setMessage(R.string.enable_sharing_question)
.setPositiveButton(R.string.possitive_dialog_button, (dialog, which) ->
dialogPositiveAnswer(getActivity())
)
.setNegativeButton(R.string.negative_dialog_button, (dialog, which) -> dialog.cancel()).create();
}
private void dialogPositiveAnswer(Context context) {
PrefUtils.storeEnableSharingLocalization(context, true);
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
}
}

View File

@ -1,30 +1,23 @@
package com.uam.wmi.findmytutor.utils; package com.uam.wmi.findmytutor.utils;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AlertDialog;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.Toast;
import com.uam.wmi.findmytutor.R; import java.util.Objects;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class InfoHelperUtils { public class InfoHelperUtils {
public static void infoPopUp(View anchorView, int layoutId) { public static void infoPopUp(View anchorView, int layoutId) {
LayoutInflater layoutInflater = (LayoutInflater)getApplicationContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE ); LayoutInflater layoutInflater = (LayoutInflater)getApplicationContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View popupView = layoutInflater.inflate(layoutId, null); View popupView = Objects.requireNonNull(layoutInflater).inflate(layoutId, null);
PopupWindow popupWindow = new PopupWindow(popupView, PopupWindow popupWindow = new PopupWindow(popupView,
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);

View File

@ -1,15 +1,10 @@
package com.uam.wmi.findmytutor.utils; package com.uam.wmi.findmytutor.utils;
import android.content.Context; import android.content.res.Resources;
import android.os.Build; import android.support.v4.os.ConfigurationCompat;
public class LocaleUtils { public class LocaleUtils {
public static String getCurrentLocale(Context context){ public static String getCurrentLocale(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ return String.valueOf(ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()));
return String.valueOf(context.getResources().getConfiguration().getLocales().get(0));
} else{
//noinspection deprecation
return String.valueOf(context.getResources().getConfiguration().locale);
}
} }
} }

View File

@ -144,7 +144,7 @@ public class PrefUtils {
} }
public static String getLocale(Context context) { public static String getLocale(Context context) {
return getSharedPreferences(context).getString("LOCALE", LocaleUtils.getCurrentLocale(context)); return getSharedPreferences(context).getString("LOCALE", LocaleUtils.getCurrentLocale());
} }
public static Boolean isBackgroundLocationServiceRunning(Context context) { public static Boolean isBackgroundLocationServiceRunning(Context context) {
@ -162,7 +162,7 @@ public class PrefUtils {
editor.putString("key_location_level","3"); editor.putString("key_location_level","3");
editor.putString("location_mode", "manual"); editor.putString("location_mode", "manual");
editor.putString("approx_manual_loc", approximatedLocation); editor.putString("approx_manual_loc", approximatedLocation);
editor.putBoolean("key_sharing_enabled", true); /*editor.putBoolean("key_sharing_enabled", true);*/
editor.putLong("longitude_manual_location", Double.doubleToRawLongBits(latLng.getLongitude())); editor.putLong("longitude_manual_location", Double.doubleToRawLongBits(latLng.getLongitude()));
editor.putLong("latitude_manual_location", Double.doubleToRawLongBits(latLng.getLatitude())); editor.putLong("latitude_manual_location", Double.doubleToRawLongBits(latLng.getLatitude()));
editor.apply(); editor.apply();

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto" xmlns:mapbox="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -9,7 +16,6 @@
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"> android:paddingTop="@dimen/activity_margin">
<ImageButton <ImageButton
android:id="@+id/contentTutorTabInfoImageButton" android:id="@+id/contentTutorTabInfoImageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -17,7 +23,9 @@
android:layout_gravity="right" android:layout_gravity="right"
mapbox:srcCompat="@drawable/outline_info_24"/> mapbox:srcCompat="@drawable/outline_info_24"/>
<TextView android:id="@+id/userName"
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10" android:layout_marginBottom="@dimen/dimen_10"
@ -27,50 +35,116 @@
android:textSize="@dimen/lbl_new_note_title" android:textSize="@dimen/lbl_new_note_title"
android:textStyle="normal" /> android:textStyle="normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView <TextView
android:id="@+id/personalInfoTitle"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:textColor="@color/mapboxRedDark"
android:text="@string/personalInfoTitle"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7">
<android.support.design.widget.TextInputEditText
android:id="@+id/userDepartment" android:id="@+id/userDepartment"
android:maxLines="1"
android:inputType="text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:lineSpacingExtra="8sp" android:hint="@string/hint_department"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
<TextView
android:id="@+id/userRoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
<TextView
android:id="@+id/userEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8sp" android:lineSpacingExtra="8sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/note_list_text" /> android:textColor="@color/note_list_text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3">
<TextView <android.support.design.widget.TextInputEditText
android:id="@+id/userDutyHours" android:id="@+id/userRoom"
android:maxLines="1"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_room"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/userEmail"
android:maxLines="1"
android:inputType="text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:lineSpacingExtra="8sp" android:lineSpacingExtra="8sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/note_list_text" android:textColor="@color/note_list_text"
tools:text="@string/dutyHours" /> android:hint="@string/hint_email"
/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<TextView <TextView
android:id="@+id/dutyTitle"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:textColor="@color/mapboxRedDark"
android:text="@string/dutyTitle"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/dutyHourView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:scrollbars="vertical" />
<Button
android:id="@+id/addDuty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/addDuty"
android:layout_gravity="end"/>
<TextView
android:textSize="16sp"
android:id="@+id/userNoteTitle" android:id="@+id/userNoteTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="0dp" android:paddingTop="0dp"
android:paddingBottom="0dp" android:paddingBottom="0dp"
android:paddingStart="@dimen/activity_margin" android:textColor="@color/mapboxRedDark"
android:textColor="@color/note_list_text" /> android:text="@string/userNoteTitle"/>
<EditText <android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/userNote" android:id="@+id/userNote"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp" android:layout_height="150dp"
@ -83,11 +157,15 @@
android:maxLines="7" android:maxLines="7"
android:requiresFadingEdge="vertical" android:requiresFadingEdge="vertical"
android:scrollbars="vertical"/> android:scrollbars="vertical"/>
</android.support.design.widget.TextInputLayout>
<Button <Button
android:id="@+id/saveButon" android:id="@+id/saveButon"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/saveButton" /> android:text="@string/saveButton" />
</LinearLayout> </LinearLayout>
</ScrollView>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:id="@+id/duty_day"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:hint="@string/hint_duty_day">
<android.support.design.widget.TextInputEditText
android:id="@+id/duty_day_value"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="text"
android:maxLines="1"
tools:text="@tools:sample/date/day_of_week" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/duty_start"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/hint_duty_start">
<android.support.design.widget.TextInputEditText
android:id="@+id/duty_start_value"
android:maxLines="1"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:text="@tools:sample/date/hhmm" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/duty_stop"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/hint_duty_end">
<android.support.design.widget.TextInputEditText
android:id="@+id/duty_stop_value"
android:maxLines="1"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:text="@tools:sample/date/hhmm" />
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/deleteRow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleX="0.7"
android:scaleY="0.7"
app:srcCompat="@android:drawable/ic_delete" />
</LinearLayout>

View File

@ -3,8 +3,8 @@
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textSize="16sp" android:textSize="14sp"
android:paddingTop="2dp"
android:fontFamily="@font/lato_regular" android:fontFamily="@font/lato_regular"
android:textColor="@color/mapboxWhite" /> android:textColor="@color/mapboxWhite" />

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@drawable/layout_bg"
android:orientation="vertical"
android:padding="10dp"
android:textColor="@color/half_black">
<TextView
android:id="@+id/textViewP1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="@string/map_info_text_p1"
android:textColor="@color/half_black" />
<TextView
android:id="@+id/textViewP2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="@string/map_info_text_p2"
android:textColor="@color/half_black" />
<TextView
android:id="@+id/textViewP3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="@string/map_info_text_p3"
android:textColor="@color/half_black" />
<TextView
android:id="@+id/exactMarkerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/exact_localization_marker"
android:drawablePadding="5dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:text="@string/map_info_text_marker_exact"
android:textColor="@color/half_black" />
<TextView
android:id="@+id/approximateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/approximate_localization_marker"
android:drawablePadding="5dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:text="@string/map_info_text_marker_approximated"
android:textColor="@color/half_black" />
<TextView
android:id="@+id/manualMarkerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
android:drawableLeft="@drawable/manual_localization_marker"
android:drawablePadding="0dp"
android:gravity="center"
android:text="@string/map_info_text_marker_manual"
android:textColor="@color/half_black" />
</LinearLayout>

View File

@ -42,10 +42,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:drawableLeft="@drawable/exact_localization_marker" android:drawableLeft="@drawable/exact_localization_marker"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:text="@string/map_info_text_marker_exact" android:text="@string/map_info_text_marker_exact"
android:textColor="@color/half_black" /> android:textColor="@color/half_black" />
@ -56,9 +55,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_weight="1"
android:drawableLeft="@drawable/approximate_localization_marker" android:drawableLeft="@drawable/approximate_localization_marker"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:text="@string/map_info_text_marker_approximated" android:text="@string/map_info_text_marker_approximated"
android:textColor="@color/half_black" /> android:textColor="@color/half_black" />
@ -68,9 +67,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_weight="1" android:layout_marginBottom="5dp"
android:drawableLeft="@drawable/manual_localization_marker" android:drawableLeft="@drawable/manual_localization_marker"
android:drawablePadding="5dp" android:drawablePadding="0dp"
android:gravity="center" android:gravity="center"
android:text="@string/map_info_text_marker_manual" android:text="@string/map_info_text_marker_manual"
android:textColor="@color/half_black" /> android:textColor="@color/half_black" />

View File

@ -63,4 +63,13 @@
android:text="@string/info_icon_userlist_tab_level_status_inactive_tip" android:text="@string/info_icon_userlist_tab_level_status_inactive_tip"
android:textColor="@color/half_black"/> android:textColor="@color/half_black"/>
<TextView
android:id="@+id/userListPopupInfoTextViewSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:text="@string/info_icon_userlist_summary"
android:textColor="@color/half_black"/>
</LinearLayout> </LinearLayout>

View File

@ -7,7 +7,6 @@
<PreferenceCategory android:title="@string/settings_category_general"> <PreferenceCategory android:title="@string/settings_category_general">
<ListPreference <ListPreference
android:defaultValue="0"
android:dialogTitle="@string/settings_language" android:dialogTitle="@string/settings_language"
android:entries="@array/language_entries" android:entries="@array/language_entries"
android:entryValues="@array/language_values" android:entryValues="@array/language_values"

View File

@ -63,6 +63,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/mapboxWhite"
android:paddingLeft="10dp" android:paddingLeft="10dp"
/> />
</LinearLayout> </LinearLayout>
@ -83,6 +84,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/mapboxWhite"
android:paddingLeft="10dp" android:paddingLeft="10dp"
/> />
</LinearLayout> </LinearLayout>
@ -103,6 +105,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/mapboxWhite"
android:paddingLeft="10dp" android:paddingLeft="10dp"
/> />
</LinearLayout> </LinearLayout>
@ -124,6 +127,7 @@
android:id="@+id/userDutyHoursTitle" android:id="@+id/userDutyHoursTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/mapboxWhite"
android:paddingLeft="10dp" android:paddingLeft="10dp"
/> />
</LinearLayout> </LinearLayout>
@ -147,6 +151,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="25dp" android:paddingLeft="25dp"
android:paddingTop="-10dp" android:paddingTop="-10dp"
android:divider="@color/background_user_modal"
android:dividerHeight="1dp"
android:textColor="@color/mapboxWhite" android:textColor="@color/mapboxWhite"
/> />
</LinearLayout> </LinearLayout>
@ -167,6 +173,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/mapboxWhite"
android:paddingLeft="10dp" android:paddingLeft="10dp"
/> />
</LinearLayout> </LinearLayout>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -11,7 +9,6 @@
android:fontFamily="@font/lato_regular" android:fontFamily="@font/lato_regular"
tools:showIn="@layout/users_list_main"> tools:showIn="@layout/users_list_main">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -121,7 +121,7 @@
<string name="prompt_login">Login (Ldap)</string> <string name="prompt_login">Login (Ldap)</string>
<string name="action_log_in">Zaloguj!</string> <string name="action_log_in">Zaloguj!</string>
<string name="error_invalid_login_name">Niepoprawny format loginu.</string> <string name="error_invalid_login_name">Niepoprawny format loginu.</string>
<string name="user_list_nav">Lista użytkowników</string> <string name="user_list_nav">Kadra</string>
<string name="select_a_location">Wybierz lokalizacje</string> <string name="select_a_location">Wybierz lokalizacje</string>
<string name="user_location_permission_not_granted">Nie dodano uprawnień do lokalizacji.</string> <string name="user_location_permission_not_granted">Nie dodano uprawnień do lokalizacji.</string>
<string name="user_location_permission_explanation">Ta aplikacja potrzebuje uprawnień do lokalizacji.</string> <string name="user_location_permission_explanation">Ta aplikacja potrzebuje uprawnień do lokalizacji.</string>
@ -147,7 +147,7 @@
<string name="remove_manual_location">Usuń manualną lokację</string> <string name="remove_manual_location">Usuń manualną lokację</string>
<string name="title_activity_tutor_tab">Profil</string> <string name="title_activity_tutor_tab">Profil</string>
<string name="saveButton">Zapisz!</string> <string name="saveButton">Zapisz!</string>
<string name="tutorTabHint">Tutaj możesz dodać swoją notatkę. Będzie widoczna dla innych użytkowników.</string> <string name="tutorTabHint">Edytuj swoją notatkę. Będzie widoczna dla innych.</string>
<string name="modal_location_send">WYŚLIJ</string> <string name="modal_location_send">WYŚLIJ</string>
<string name="modal_location_hint">Proszę nazwać wybraną lokację.</string> <string name="modal_location_hint">Proszę nazwać wybraną lokację.</string>
<string name="manual_modal_title">Czy chcesz zapisać tę lokalizację?</string> <string name="manual_modal_title">Czy chcesz zapisać tę lokalizację?</string>
@ -204,7 +204,6 @@
<string name="info_icon_sharing_tab_p5">Udostępnianie w dowolnym momencie można wyłączyć za pomocą przełącznika.</string> <string name="info_icon_sharing_tab_p5">Udostępnianie w dowolnym momencie można wyłączyć za pomocą przełącznika.</string>
<string name="info_icon_sharing_tab_p6">Dodatkowo, do Twojej lokalizacji możesz dodać status opisowy (będzie on widoczny dla użytkowników po kliknięciu w marker).</string> <string name="info_icon_sharing_tab_p6">Dodatkowo, do Twojej lokalizacji możesz dodać status opisowy (będzie on widoczny dla użytkowników po kliknięciu w marker).</string>
<string name="info_icon_sharing_tab_p7">Zarówno manualne lokalizacje jak i statusy możesz dodać do listy, które potem możesz wybrać w wygodny sposób.</string> <string name="info_icon_sharing_tab_p7">Zarówno manualne lokalizacje jak i statusy możesz dodać do listy, które potem możesz wybrać w wygodny sposób.</string>
<!--(PL) Userlist Tab info helper--> <!--(PL) Userlist Tab info helper-->
<string name="info_icon_userlist_tab_p1">W tym panelu znajduje się lista profesorów.</string> <string name="info_icon_userlist_tab_p1">W tym panelu znajduje się lista profesorów.</string>
<string name="info_icon_userlist_tab_p2">Ich status symbolizowany jest przez kolorowe kropki:</string> <string name="info_icon_userlist_tab_p2">Ich status symbolizowany jest przez kolorowe kropki:</string>
@ -212,10 +211,41 @@
<string name="info_icon_userlist_tab_level_status_offline">- użytkownik jest obecnie offline</string> <string name="info_icon_userlist_tab_level_status_offline">- użytkownik jest obecnie offline</string>
<string name="info_icon_userlist_tab_level_status_inactive">- użytkownik jest nieaktywny</string> <string name="info_icon_userlist_tab_level_status_inactive">- użytkownik jest nieaktywny</string>
<string name="info_icon_userlist_tab_level_status_inactive_tip">(nie udostępnił żadnych danych o lokalizacji od conajmniej tygodnia)</string> <string name="info_icon_userlist_tab_level_status_inactive_tip">(nie udostępnił żadnych danych o lokalizacji od conajmniej tygodnia)</string>
<<<<<<< HEAD
<string name="add">Dodaj</string> <string name="add">Dodaj</string>
<string name="index_user">Index użytkownika</string> <string name="index_user">Index użytkownika</string>
<string name="black_list_title">Dodaj użytkownika do Blacklsi</string> <string name="black_list_title">Dodaj użytkownika do Blacklsi</string>
=======
<string name="info_icon_userlist_summary">Po kliknięciu w imię i nazwisko, wyświetli się karta zawierająca dokładne informacje o profesorze.</string>
<!--ACRA ON/OFF switch-->
<string name="pref_acra_disabled" translatable="false">Pozwól na wysyłanie raportów o błędach.</string>
<string name="pref_acra_enabled" translatable="false">Pozwól na wysyłanie raportów o błędach.</string>
<string name="pref_title_acra" translatable="false">Raportowanie błędów.</string>
<string name="acra_toast_text" translatable="false">Błąd aplikacji. Informacje o błędzie zostanie wysłana do twórców.</string>
<string name="hint_duty_day">Dzień</string>
<string name="hint_duty_start">Start</string>
<string name="hint_duty_end">Koniec</string>
<string name="hint_department">Zakład</string>
<string name="hint_room">Pokój</string>
<string name="addDuty">DODAJ DYŻUR</string>
<string name="dutyTitle">Godziny dyżurów</string>
<string name="personalInfoTitle">Dane kontaktowe</string>
<string name="userNoteTitle">Twoja notka</string>
<string name="updateToast">Dziękujemy za aktualizację profilu</string>
<string name="error_location_fetch">Błąd podczas pobierania lokalizacji.</string>
<string name="lack_of_status">Użytkownik nie zdefiniował statusu.</string>
<string name="possitive_dialog_button">Tak</string>
<string name="negative_dialog_button">Nie</string>
<string name="enable_sharing_question">Aby skorzystać z tej funkcji musisz pozwolić na udostępnianie lokalizacji. Zgadzasz sie?</string>
<string name="sharing_modal_title">Udostępnianie</string>
>>>>>>> develop
</resources> </resources>

View File

@ -88,7 +88,8 @@
<string name="settings_description">Descrition</string> <string name="settings_description">Descrition</string>
<string name="saveButton">Save</string> <string name="saveButton">Save</string>
<string name="tutorTabHint">Here you can add your note. It will be visible to the other users.</string> <string name="tutorTabHint">Edit your note. It will be shown in the users list.</string>
<string name="key_description">key_description</string> <string name="key_description">key_description</string>
@ -233,8 +234,12 @@
<string name="network_error">Network Error!</string> <string name="network_error">Network Error!</string>
<string name="manual_status_error">Error handling status fetch</string> <string name="manual_status_error">Error handling status fetch</string>
<string name="error_status_fetch">Error handling status fetch</string> <string name="error_status_fetch">Error handling status fetch</string>
<string name="error_location_fetch" translatable="false">Error handling status fetch</string> <string name="error_location_fetch">Error handling status fetch</string>
<!--<string name="pref_acra_disabled" translatable="false">Auto reporting on issue is OFF</string>-->
<!--<string name="pref_acra_enabled" translatable="false">Auto reporting on issue is ON</string>-->
<!--<string name="pref_disable_acra" translatable="false">ACRA reporting tool</string>-->
<string name="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_text">Sorry, the application crashed. A report will be sent to the developers</string> <string name="notification_text">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_title" translatable="false">FMT Issue</string> <string name="notification_title" translatable="false">FMT Issue</string>
<string name="notification_channel" translatable="false">FMT</string> <string name="notification_channel" translatable="false">FMT</string>
@ -246,8 +251,7 @@
<!--ACRA ON/OFF switch--> <!--ACRA ON/OFF switch-->
<string name="pref_acra_disabled" translatable="false">Allow to send raport to developers is ON</string> <string name="pref_acra_disabled" translatable="false">Allow to send raport to developers is ON</string>
<string name="pref_acra_enabled" translatable="false">Allow to send raport to developers is OFF</string> <string name="pref_acra_enabled" translatable="false">Allow to send raport to developers is OFF</string>
<string name="pref_title_acra" translatable="false">App issues reporting</string> <string name="pref_disable_acra" translatable="false">App issues reporting</string>
<string name="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</string>
<!--(ENG) Map Activity info helper--> <!--(ENG) Map Activity info helper-->
<string name="map_info_text_p1">On the map there are markers which represents tutors sharing their location right now.</string> <string name="map_info_text_p1">On the map there are markers which represents tutors sharing their location right now.</string>
@ -293,6 +297,7 @@
<string name="info_icon_userlist_tab_level_status_offline">- user is currently offline</string> <string name="info_icon_userlist_tab_level_status_offline">- user is currently offline</string>
<string name="info_icon_userlist_tab_level_status_inactive">- user is inactive </string> <string name="info_icon_userlist_tab_level_status_inactive">- user is inactive </string>
<string name="info_icon_userlist_tab_level_status_inactive_tip">(didnt share any localization data since 7 days)</string> <string name="info_icon_userlist_tab_level_status_inactive_tip">(didnt share any localization data since 7 days)</string>
<<<<<<< HEAD
<string name="title_activity_black_list">BlackList</string> <string name="title_activity_black_list">BlackList</string>
<string name="index_user">User index</string> <string name="index_user">User index</string>
<string name="black_list_title">Add user to Blacklist</string> <string name="black_list_title">Add user to Blacklist</string>
@ -386,5 +391,28 @@
"when a user tries to pick up one of cards.\n\n" "when a user tries to pick up one of cards.\n\n"
</string> </string>
<string name="add">Add</string> <string name="add">Add</string>
=======
<string name="info_icon_userlist_summary">After clicking on a name, the tutor tab will pop up, containing details about selected tutor.</string>
<string name="possitive_dialog_button">Yes</string>
<string name="pref_title_acra" translatable="false">App issues reporting</string>
>>>>>>> develop
<!--(ENG) Profile Activity strings-->
<string name="hint_duty_day">Day</string>
<string name="hint_duty_start">Start</string>
<string name="hint_duty_end">End</string>
<string name="hint_department">Department</string>
<string name="hint_room">Room</string>
<string name="hint_email" translatable="false">Email</string>
<string name="addDuty">ADD DUTY</string>
<string name="dutyTitle">Duty hours</string>
<string name="personalInfoTitle">Personal info</string>
<string name="userNoteTitle">Your note</string>
<string name="updateToast">Thank you for updating your profile.</string>
<string name="negative_dialog_button">No</string>
<string name="enable_sharing_question">In order to use this function, you have to enable localization sharing. May I do it for you?</string>
<string name="sharing_modal_title">Sharing</string>
<string name="lack_of_status">The user hasn\'t defined a status.</string>
</resources> </resources>