Merge from develop

This commit is contained in:
Mieszko Wrzeszczyński 2018-12-17 10:34:25 +01:00
commit 48ce4c76c8
36 changed files with 732 additions and 602 deletions

View File

@ -28,7 +28,9 @@
<activity <activity
android:name=".activity.StartupActivity" android:name=".activity.StartupActivity"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -37,14 +39,20 @@
</activity> </activity>
<activity <activity
android:name=".activity.MapActivity" android:name=".activity.MapActivity"
android:launchMode="singleTop" /> android:launchMode="singleTop"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity <activity
android:name=".activity.LoginActivity" android:name=".activity.LoginActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:noHistory="true" /> android:noHistory="true"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity <activity
android:name=".activity.SettingsActivity" /> android:name=".activity.SettingsActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<service <service
android:name=".service.BackgroundLocalizationService" android:name=".service.BackgroundLocalizationService"
@ -54,7 +62,9 @@
<activity <activity
android:name=".activity.TutorTab" android:name=".activity.TutorTab"
android:theme="@style/AppTheme"/> android:theme="@style/AppTheme"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"/>
</application> </application>
</manifest> </manifest>

View File

@ -5,6 +5,8 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import com.uam.wmi.findmytutor.utils.Const;
import static org.acra.ReportField.*; import static org.acra.ReportField.*;
import org.acra.ACRA; import org.acra.ACRA;
import org.acra.annotation.AcraLimiter; import org.acra.annotation.AcraLimiter;
@ -50,7 +52,7 @@ public class FindMyTutor extends Application {
builder.getPluginConfigurationBuilder( builder.getPluginConfigurationBuilder(
HttpSenderConfigurationBuilder.class HttpSenderConfigurationBuilder.class
// ).setUri("http://192.168.0.15:3000/api/acra") // ).setUri("http://192.168.0.15:3000/api/acra")
).setUri("https://s416084.projektstudencki.pl/develop/api/Feedback/autoFeedback") ).setUri(Const.BASE_URL +"api/Feedback/autoFeedback")
.setHttpMethod(HttpSender.Method.POST) .setHttpMethod(HttpSender.Method.POST)
.setHttpHeaders(header) .setHttpHeaders(header)
.setEnabled(true); .setEnabled(true);

View File

@ -7,6 +7,7 @@ import android.app.FragmentTransaction;
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;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -20,10 +21,14 @@ 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.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Toast; import android.widget.Toast;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
@ -46,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;
@ -76,15 +82,18 @@ public abstract class BaseActivity
private ActiveFragment activeFragment = ActiveFragment.NONE; private ActiveFragment activeFragment = ActiveFragment.NONE;
private Fragment activeBottomMenu = null; private Fragment activeBottomMenu = null;
private SearchView searchView; private SearchView searchView;
public MenuItem infoMenuItem;
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
@Override @Override
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();
@ -191,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() {
@ -207,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");
} }
} }
@ -266,6 +283,8 @@ public abstract class BaseActivity
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu); getMenuInflater().inflate(R.menu.menu_main, menu);
infoMenuItem = menu.findItem(R.id.action_info);
MenuItem myActionMenuItem = menu.findItem(R.id.action_search); MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
searchView = (SearchView) myActionMenuItem.getActionView(); searchView = (SearchView) myActionMenuItem.getActionView();
@ -313,6 +332,33 @@ public abstract class BaseActivity
if (actionBarDrawerToggle.onOptionsItemSelected(item)) { if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
return true; return true;
} }
if (item.getItemId()==R.id.action_info){
int layoutID;
switch (activeFragment){
case SHARED_PREFERENCES:
layoutID = R.layout.info_popup_sharing_tab;
break;
case USER_LIST:
layoutID = R.layout.info_popup_userlist;
break;
default:
layoutID = R.layout.info_popup_map;
}
View popupView = getLayoutInflater().inflate(layoutID,null);
PopupWindow popupWindow = new PopupWindow(popupView,
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
// If the PopupWindow should be focusable
popupWindow.setFocusable(true);
// If you need the PopupWindow to dismiss when when touched outside
popupWindow.setBackgroundDrawable(new ColorDrawable());
// Get the View's(the one that was clicked in the Fragment) location
View anchorView= getWindow().getDecorView().findViewById(android.R.id.content);
popupWindow.showAtLocation(anchorView,Gravity.TOP|Gravity.END, 0, 0);
}
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

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,7 +127,7 @@ public class MapActivity extends BaseActivity
}; };
findViewById(R.id.mapInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v, R.layout.info_popup_map));
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);
@ -142,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
@ -155,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);
@ -166,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;
}); });
@ -220,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);
} }
@ -235,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);
@ -291,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();
@ -334,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,6 +2,7 @@ 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;
@ -21,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;
@ -40,7 +43,7 @@ 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 SwitchPreference locationSharing; protected SwitchPreference locationSharing;
protected Preference locationMode; protected Preference locationMode;
protected ListPreference manualLocationList; protected ListPreference manualLocationList;
@ -86,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();
} }
})); }));
} }
@ -138,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);
@ -150,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);
} }
@ -168,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 **/
@ -181,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();
@ -205,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) -> {
@ -213,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
@ -229,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];
@ -248,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()]);
@ -258,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) {
@ -274,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

@ -84,7 +84,6 @@ public class UsersListFragment extends Fragment {
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
view.findViewById(R.id.userListInfoImageButton).setOnClickListener(v -> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_userlist));
userService = ApiClient.getClient(getApplicationContext()) userService = ApiClient.getClient(getApplicationContext())
.create(UserService.class); .create(UserService.class);

View File

@ -33,9 +33,6 @@ public class DutyHour extends BaseResponse {
public DutyHour dutyHourId(UUID dutyHourId) { public DutyHour dutyHourId(UUID dutyHourId) {
this.dutyHourId = dutyHourId; this.dutyHourId = dutyHourId;
return this; return this;
}
public DutyHour(){
} }
/** /**

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import com.uam.wmi.findmytutor.utils.Const;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import java.io.IOException; import java.io.IOException;
@ -26,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) {
@ -35,7 +35,7 @@ public class ApiClient {
if (retrofit == null) { if (retrofit == null) {
retrofit = new Retrofit.Builder() retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL) .baseUrl(Const.BASE_URL)
.client(okHttpClient) .client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create())

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

@ -6,7 +6,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class Const { public class Const {
public final static Integer onlineBackgroundLocationInterval = 15000; public final static String BASE_URL = "https://s416084.projektstudencki.pl/master/";
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,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#e9ffffff"/> <solid android:color="#ffffff"/>
<stroke android:width="3dp" android:color="#B1BCBE" /> <stroke android:width="3dp" android:color="#b1bcbe" />
<corners android:radius="10dp"/> <corners android:radius="10dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape> </shape>

View File

@ -20,12 +20,6 @@
</com.mapbox.mapboxsdk.maps.MapView> </com.mapbox.mapboxsdk.maps.MapView>
<ImageButton
android:id="@+id/mapInfoImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
mapbox:srcCompat="@drawable/outline_info_24"/>
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -165,8 +165,6 @@
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> </ScrollView>

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

@ -1,74 +1,77 @@
<?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"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@drawable/layout_bg"
android:orientation="vertical"
android:padding="10dp" android:padding="10dp"
android:background="@drawable/layout_bg"> android:textColor="@color/half_black">
<TextView <TextView
android:id="@+id/textViewP1" android:id="@+id/textViewP1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="@string/map_info_text_p1" /> android:layout_weight="1"
android:text="@string/map_info_text_p1"
android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/textViewP2" android:id="@+id/textViewP2"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/map_info_text_p2" /> android:text="@string/map_info_text_p2"
android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/textViewP3" android:id="@+id/textViewP3"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/map_info_text_p3" /> android:text="@string/map_info_text_p3"
android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/exactMarkerTextView" android:id="@+id/exactMarkerTextView"
android:gravity="center"
android:drawableLeft="@drawable/exact_localization_marker"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
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:drawableLeft="@drawable/exact_localization_marker"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_weight="1" android:layout_marginBottom="5dp"
android:text="@string/map_info_text_marker_exact" /> android:gravity="center"
android:text="@string/map_info_text_marker_exact"
android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/approximateTextView" android:id="@+id/approximateTextView"
android:drawableLeft="@drawable/approximate_localization_marker"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/approximate_localization_marker"
android:drawablePadding="5dp"
android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:layout_weight="1" android:text="@string/map_info_text_marker_approximated"
android:text="@string/map_info_text_marker_approximated" /> android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/manualMarkerTextView" android:id="@+id/manualMarkerTextView"
android:drawableLeft="@drawable/manual_localization_marker"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
android:drawableLeft="@drawable/manual_localization_marker"
android:drawablePadding="0dp"
android:gravity="center" android:gravity="center"
android:layout_weight="1" android:text="@string/map_info_text_marker_manual"
android:text="@string/map_info_text_marker_manual" /> android:textColor="@color/half_black" />
</LinearLayout> </LinearLayout>

View File

@ -11,7 +11,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p1" /> android:text="@string/info_icon_sharing_tab_p1"
android:textColor="@color/half_black" />
<TextView <TextView
android:id="@+id/textViewP2" android:id="@+id/textViewP2"
@ -19,7 +20,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p2" /> android:text="@string/info_icon_sharing_tab_p2"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3" android:id="@+id/textViewP3"
@ -27,16 +29,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p3" /> android:text="@string/info_icon_sharing_tab_p3"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3exactlvl" android:id="@+id/textViewP3exactlvl"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p3_level_exact" /> android:text="@string/info_icon_sharing_tab_p3_level_exact"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3approximatelvl" android:id="@+id/textViewP3approximatelvl"
@ -44,7 +47,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p3_level_approximate" /> android:text="@string/info_icon_sharing_tab_p3_level_approximate"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3manuallvl" android:id="@+id/textViewP3manuallvl"
@ -52,7 +56,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p3_level_manual" /> android:text="@string/info_icon_sharing_tab_p3_level_manual"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3presencelvl" android:id="@+id/textViewP3presencelvl"
@ -60,7 +65,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p3_level_presence" /> android:text="@string/info_icon_sharing_tab_p3_level_presence"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP4" android:id="@+id/textViewP4"
@ -68,7 +74,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p4" /> android:text="@string/info_icon_sharing_tab_p4"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP5" android:id="@+id/textViewP5"
@ -76,7 +83,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p5" /> android:text="@string/info_icon_sharing_tab_p5"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP6" android:id="@+id/textViewP6"
@ -84,7 +92,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p6" /> android:text="@string/info_icon_sharing_tab_p6"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP7" android:id="@+id/textViewP7"
@ -92,7 +101,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_sharing_tab_p7" /> android:text="@string/info_icon_sharing_tab_p7"
android:textColor="@color/half_black"/>
</LinearLayout> </LinearLayout>

View File

@ -12,7 +12,8 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_tutor_tab_p1" /> android:text="@string/info_icon_tutor_tab_p1"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP2" android:id="@+id/textViewP2"
@ -21,7 +22,8 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_tutor_tab_p2" /> android:text="@string/info_icon_tutor_tab_p2"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP3" android:id="@+id/textViewP3"
@ -30,7 +32,8 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_tutor_tab_p3" /> android:text="@string/info_icon_tutor_tab_p3"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/textViewP4" android:id="@+id/textViewP4"
@ -40,6 +43,7 @@
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginBottom="15dp" android:layout_marginBottom="15dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_tutor_tab_p4" /> android:text="@string/info_icon_tutor_tab_p4"
android:textColor="@color/half_black"/>
</LinearLayout> </LinearLayout>

View File

@ -11,13 +11,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_userlist_tab_p1" /> android:text="@string/info_icon_userlist_tab_p1"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/userListPopupInfoTextViewP2" android:id="@+id/userListPopupInfoTextViewP2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_userlist_tab_p2" /> android:text="@string/info_icon_userlist_tab_p2"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/userListPopupInfoTextViewOnline" android:id="@+id/userListPopupInfoTextViewOnline"
@ -27,7 +30,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_userlist_tab_level_status_online" /> android:text="@string/info_icon_userlist_tab_level_status_online"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/userListPopupInfoTextVieOffline" android:id="@+id/userListPopupInfoTextVieOffline"
@ -37,7 +41,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_userlist_tab_level_status_offline" /> android:text="@string/info_icon_userlist_tab_level_status_offline"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/userListPopupInfoTextViewInactive" android:id="@+id/userListPopupInfoTextViewInactive"
@ -47,13 +52,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/info_icon_userlist_tab_level_status_inactive" /> android:text="@string/info_icon_userlist_tab_level_status_inactive"
android:textColor="@color/half_black"/>
<TextView <TextView
android:id="@+id/userListPopupInfoTextViewTip" android:id="@+id/userListPopupInfoTextViewTip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
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"/>
<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"
@ -16,11 +15,11 @@
android:title="@string/title_language" /> android:title="@string/title_language" />
<SwitchPreference <SwitchPreference
android:key="acra.disable" android:key="acra.enable"
android:title="@string/pref_disable_acra" android:title="@string/pref_title_acra"
android:summaryOn="@string/pref_acra_disabled" android:summaryOn="@string/pref_acra_disabled"
android:summaryOff="@string/pref_acra_enabled" android:summaryOff="@string/pref_acra_enabled"
android:defaultValue="false"/> android:defaultValue="true"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -6,8 +6,6 @@
android:fontFamily="@font/lato_regular" android:fontFamily="@font/lato_regular"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.uam.wmi.findmytutor.utils.SharingInfoPopupButtonPreference/>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_category_location" android:title="@string/settings_category_location"
android:key="category_sharing"> android:key="category_sharing">

View File

@ -147,6 +147,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>

View File

@ -10,13 +10,6 @@
<include layout="@layout/users_list_main" /> <include layout="@layout/users_list_main" />
<ImageButton
android:id="@+id/userListInfoImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
mapbox:srcCompat="@drawable/outline_info_24"/>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

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

@ -8,4 +8,11 @@
app:showAsAction="always" app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView" app:actionViewClass="android.support.v7.widget.SearchView"
android:title="@string/search"/> android:title="@string/search"/>
<item
android:id="@+id/action_info"
app:showAsAction="ifRoom|collapseActionView"
android:icon="@drawable/outline_info_24"
android:titleCondensed="@string/access_token"
android:actionLayout="@layout/info_popup_map"
android:title="Info" />
</menu> </menu>

View File

@ -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ę listę profesorów.</string> <string name="info_icon_userlist_tab_p1">W tym panelu znajduje się listę 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,6 +211,17 @@
<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>
<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_day">Dzień</string>
<string name="hint_duty_start">Start</string> <string name="hint_duty_start">Start</string>
<string name="hint_duty_end">Koniec</string> <string name="hint_duty_end">Koniec</string>
@ -223,6 +233,11 @@
<string name="userNoteTitle">Twoja notka</string> <string name="userNoteTitle">Twoja notka</string>
<string name="updateToast">Dziękujemy za aktualizację profilu</string> <string name="updateToast">Dziękujemy za aktualizację profilu</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>
</resources> </resources>

View File

@ -297,6 +297,10 @@
<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>
<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="pref_title_acra" translatable="false">App issues reporting</string>
<!--(ENG) Profile Activity strings--> <!--(ENG) Profile Activity strings-->
<string name="hint_duty_day">Day</string> <string name="hint_duty_day">Day</string>
@ -310,12 +314,9 @@
<string name="personalInfoTitle">Personal info</string> <string name="personalInfoTitle">Personal info</string>
<string name="userNoteTitle">Your note</string> <string name="userNoteTitle">Your note</string>
<string name="updateToast">Thank you for updating your profile.</string> <string name="updateToast">Thank you for updating your profile.</string>
<string name="possitive_dialog_button">yes</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>