Merge branch 'fix-manual-sharing' of s416084/find-my-tutor-android into develop

This commit is contained in:
Mieszko Wrzeszczyński 2018-12-16 22:33:46 +00:00 committed by Gogs
commit fe0115122d
39 changed files with 469 additions and 748 deletions

View File

@ -1,29 +1,29 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>

View File

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

View File

@ -5,6 +5,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import com.uam.wmi.findmytutor.utils.Const;
import static org.acra.ReportField.*;
import org.acra.ACRA;
import org.acra.annotation.AcraLimiter;
@ -50,7 +52,7 @@ public class FindMyTutor extends Application {
builder.getPluginConfigurationBuilder(
HttpSenderConfigurationBuilder.class
// ).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)
.setHttpHeaders(header)
.setEnabled(true);

View File

@ -7,6 +7,7 @@ import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
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.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Toast;
import com.uam.wmi.findmytutor.R;
@ -46,6 +51,7 @@ import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
import static com.uam.wmi.findmytutor.utils.Const.defaultMapZoom;
import static com.uam.wmi.findmytutor.utils.Const.searchMapZoom;
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
@ -76,15 +82,18 @@ public abstract class BaseActivity
private ActiveFragment activeFragment = ActiveFragment.NONE;
private Fragment activeBottomMenu = null;
private SearchView searchView;
public MenuItem infoMenuItem;
@SuppressLint("CheckResult")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentViewId());
drawerNavigationView = findViewById(R.id.nav_view);
sideDrawer = findViewById(R.id.activity_container);
feedbackUtils = new FeedbackUtils(BaseActivity.this);
drawerNavigationView.setNavigationItemSelectedListener(
item -> {
String itemName = (String) item.getTitle();
@ -191,7 +200,10 @@ public abstract class BaseActivity
public void stopBackgroundLocalizationTask() {
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
stopIntent.putExtra("request_stop", true);
startService(stopIntent);
Log.e("Localization", "JEstem w stop BG");
stopService(stopIntent);
}
public void startBackgroundLocalizationTask() {
@ -207,12 +219,17 @@ public abstract class BaseActivity
}
public void handleBackgroundTaskLifeCycle() {
Log.e("Localization", String.valueOf(PrefUtils.isEnableSharingLocalization(getApplicationContext())));
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor;
Log.e("Localization", String.valueOf(shouldServiceRun));
if (shouldServiceRun) {
startBackgroundLocalizationTask();
Log.e("Localization", "JEstem i odpalam");
} else {
stopBackgroundLocalizationTask();
Log.e("Localization", "JEstem i nie odpalam");
}
}
@ -266,6 +283,8 @@ public abstract class BaseActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
infoMenuItem = menu.findItem(R.id.action_info);
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
searchView = (SearchView) myActionMenuItem.getActionView();
@ -313,6 +332,33 @@ public abstract class BaseActivity
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
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);
}
@ -343,7 +389,7 @@ public abstract class BaseActivity
if (itemId == R.id.nav_map) {
removeFragment(sharingFragment);
removeFragment(userListFragment);
activeFragment = ActiveFragment.NONE;
activeFragment = ActiveFragment.NONE;
} else if (itemId == R.id.nav_profile) {
loadUserSettingsFragment();
} else if (itemId == R.id.nav_user_list) {

View File

@ -4,8 +4,6 @@ import android.Manifest;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.location.Location;
import android.os.Bundle;
import android.os.Handler;
@ -13,14 +11,11 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
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.UserService;
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.MapMarker;
import com.uam.wmi.findmytutor.utils.MapUtils;
@ -73,8 +70,6 @@ import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;
import timber.log.Timber;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class MapActivity extends BaseActivity
implements PermissionsListener, OnMapReadyCallback {
@ -111,6 +106,7 @@ public class MapActivity extends BaseActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isTutor = PrefUtils.getIsTutor(this);
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);
removeLocationButton = findViewById(R.id.remove_location_button);
mapView = findViewById(R.id.mapView);
@ -142,7 +138,6 @@ public class MapActivity extends BaseActivity
handleBackgroundTaskLifeCycle();
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
}
@Override
@ -155,7 +150,7 @@ public class MapActivity extends BaseActivity
String id = markerUserHash.get(marker.getId());
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);
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();
});
} else {
} else {*/
createMarkerModal(id);
}
/* }*/
return true;
});
@ -220,14 +215,19 @@ public class MapActivity extends BaseActivity
TextView sharingLevelView = view.findViewById(R.id.sharing_level);
userName.setText(String.format("%s %s", user.getFirstName(), user.getLastName()));
status.setText(String.format("%s: %s", getResources().getString(R.string.status_switch_title), cordStatus));
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));
}
sharingLevelView.setText(String.format("%s: %s", getResources().getString(R.string.settings_location_level), sharingLevel));
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
alertDialog.show();
}
private void handleError(Throwable error) {
showError(error);
}
@ -235,8 +235,6 @@ public class MapActivity extends BaseActivity
private void showError(Throwable e) {
String message;
Log.e("ERR", e.toString());
if (e instanceof HttpException) {
ResponseBody responseBody = ((HttpException) e).response().errorBody();
message = RestApiHelper.getErrorMessage(responseBody);
@ -291,6 +289,11 @@ public class MapActivity extends BaseActivity
PrefUtils.getLocationLevel(getApplicationContext())
);
if (!PrefUtils.isEnableSharingLocalization(getApplicationContext())) {
EnableSharingDialog sharingDialog = new EnableSharingDialog();
sharingDialog.show(getFragmentManager(), "Sharing");
}
PrefUtils.putManualLocation(this, latLng, approximatedLocation);
handleBackgroundTaskLifeCycle();
@ -334,10 +337,14 @@ public class MapActivity extends BaseActivity
alertDialog.setOnShowListener(dialogInterface -> {
Button sendButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
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 -> {
String body = modalUserInput.getText().toString();
@ -347,7 +354,7 @@ public class MapActivity extends BaseActivity
modalUserInput.requestFocus();
} else {
sendLocation(body, latLng);
PrefUtils.putCurrentManualLocationName(getApplicationContext(),body);
PrefUtils.putCurrentManualLocationName(getApplicationContext(), body);
alertDialog.dismiss();
}
});

View File

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

View File

@ -2,6 +2,7 @@ package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint;
import android.app.FragmentTransaction;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
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.network.ApiClient;
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.RestApiHelper;
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
@ -40,7 +43,7 @@ import okhttp3.ResponseBody;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class SharingFragment extends PreferenceFragment {
public class SharingFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
protected SwitchPreference locationSharing;
protected Preference locationMode;
protected ListPreference manualLocationList;
@ -67,7 +70,7 @@ public class SharingFragment extends PreferenceFragment {
@Override
public void onSuccess(List<String> strings) {
String[] statusesArray = strings.toArray(new String[strings.size()]);
setListPreferenceData(statusList, statusesArray,null);
setListPreferenceData(statusList, statusesArray, null);
}
@Override
@ -86,25 +89,27 @@ public class SharingFragment extends PreferenceFragment {
@Override
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());
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();
if(activeId.size() > 0)
setListPreferenceData(manualLocationList, stringnames, activeId.get(0));
else{
setListPreferenceData(manualLocationList, stringnames,null);
if( activesId.size() == 0){
setListPreferenceData(manualLocationList, stringnames, null);
}
else {
setListPreferenceData(manualLocationList, stringnames, activesId.get(0));
}
}
@Override
public void onError(Throwable e) {
Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show();
}
}));
}
@ -117,7 +122,7 @@ public class SharingFragment extends PreferenceFragment {
locationSharing = (SwitchPreference) findPreference("key_sharing_enabled");
locationMode = findPreference("key_location_level");
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
manualStatus = findPreference("key_manual_status");
statusList = (ListPreference) findPreference("key_status_value");
@ -138,7 +143,7 @@ public class SharingFragment extends PreferenceFragment {
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
// manualLocationList.setSummary(PrefUtils.getManualLocation(getApplicationContext()));
/** Main sharing switch**/
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
@ -150,10 +155,11 @@ public class SharingFragment extends PreferenceFragment {
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
if(!predefinedCoordsList.isEmpty()){
preferenceCategory.addPreference(manualLocationList);
}
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
if (!predefinedCoordsList.isEmpty()) {
preferenceCategory.addPreference(manualLocationList);
}
preferenceCategory.addPreference(manualLocationButton);
@ -168,12 +174,6 @@ public class SharingFragment extends PreferenceFragment {
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
preferenceCategory.removePreference(manualLocationList);
preferenceCategory.removePreference(manualLocationButton);
}else{
// if(predefinedCoordsList.isEmpty()){
//// preferenceCategory.removePreference(manualLocationList);
//
//
// }
}
/** Custom manual location list change listener **/
@ -181,14 +181,24 @@ public class SharingFragment extends PreferenceFragment {
ListPreference lp = (ListPreference) preference;
CharSequence[] entries = lp.getEntries();
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).toList().get(0);
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation() );
PrefUtils.putCurrentManualLocation(getApplicationContext(),temp.getPredefinedCoordinateId());
PrefUtils.putCurrentManualLocationName(getApplicationContext(), (String )lp.getEntries()[Integer.parseInt((String) newValue)]);
//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.putCurrentManualLocation(getApplicationContext(), temp.getPredefinedCoordinateId());
PrefUtils.putCurrentManualLocationName(getApplicationContext(), (String) lp.getEntries()[Integer.parseInt((String) newValue)]);
lp.setSummary(lp.getEntries()[Integer.parseInt((String) newValue)]);
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
return true;
});
/** Button 'choose from map' button listener **/
manualLocationButton.setOnPreferenceChangeListener((preference, o) -> {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
@ -205,6 +215,7 @@ public class SharingFragment extends PreferenceFragment {
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
return true;
});
/** Custom status list change listener **/
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
@ -213,11 +224,8 @@ public class SharingFragment extends PreferenceFragment {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError));
return true;
});
}
@Override
@ -229,37 +237,37 @@ public class SharingFragment extends PreferenceFragment {
}
protected void setListPreferenceData(ListPreference lp, String[] entries, Integer activeId) {
Log.d("setlistpref",lp.getKey());
try {
lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence[entries.length];
for (int i = 0; i < entries.length; i++) {
entryValues[i] = Integer.toString(i);
}
try {
lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence[entries.length];
lp.setDefaultValue(0);
lp.setEntryValues(entryValues);
for (int i = 0; i < entries.length; i++) {
entryValues[i] = Integer.toString(i);
}
if(entries.length > 0 && activeId != null)
lp.setValueIndex(activeId);
lp.setDefaultValue(0);
lp.setEntryValues(entryValues);
}catch (Exception e){
Log.e("Failed to set listPref",e.getMessage());
}
if (entries.length > 0 && activeId != null)
lp.setValueIndex(activeId);
};
} catch (Exception e) {
Log.e("Failed to set listPref", e.getMessage());
}
}
;
private void handleResponse(List<String> resp) {
String[] statusesArray = resp.toArray(new String[resp.size()]);
setListPreferenceData(statusList, statusesArray,resp.size() - 1);
setListPreferenceData(statusList, statusesArray, resp.size() - 1);
statusList.setValueIndex(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) {
@ -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())){
Intent startupIntent = new Intent(this, MapActivity.class);
PrefUtils.storeLocale(getApplicationContext(),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);
startActivity(startupIntent);

View File

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

View File

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

View File

@ -1,163 +0,0 @@
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

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

View File

@ -24,20 +24,6 @@ public class DutyHourViewModel {
this.day = day;
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
@ -109,11 +95,9 @@ public class DutyHourViewModel {
}
public String getSummary() {
return this.getDay() + " " + this.getStart() + " " + this.getEnd();
return this.getDay() + ": " + this.getStart() + " - " + this.getEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

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

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import com.uam.wmi.findmytutor.utils.Const;
import com.uam.wmi.findmytutor.utils.PrefUtils;
import java.io.IOException;
@ -26,7 +27,6 @@ public class ApiClient {
private static Retrofit retrofit = null;
private static int REQUEST_TIMEOUT = 60;
private static OkHttpClient okHttpClient;
private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
public static Retrofit getClient(Context context) {
@ -35,7 +35,7 @@ public class ApiClient {
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.baseUrl(Const.BASE_URL)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())

View File

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

View File

@ -1,25 +1,18 @@
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.FeatureCollection;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point;
import com.mapbox.geojson.Polygon;
import com.mapbox.geojson.gson.BoundingBoxDeserializer;
import com.mapbox.geojson.gson.GeoJsonAdapterFactory;
import com.mapbox.geojson.gson.GeometryDeserializer;
import com.mapbox.geojson.gson.PointDeserializer;
import com.mapbox.turf.TurfClassification;
import com.mapbox.turf.TurfJoins;
import com.mapbox.turf.TurfMeasurement;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
;
;import static com.mapbox.geojson.FeatureCollection.fromJson;
public class ApproximatedLocalization {
private FeatureCollection buildingSchema = null;
@ -28,17 +21,6 @@ public class ApproximatedLocalization {
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) {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
@ -56,7 +38,9 @@ public class ApproximatedLocalization {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
String partName = feature.getStringProperty("name");
if (buildingPart != null && buildingPart.equals(partName)) {
Double longitude = feature.getNumberProperty("longitude").doubleValue();
Double latitude = feature.getNumberProperty("latitude").doubleValue();

View File

@ -6,7 +6,8 @@ import java.util.Arrays;
import java.util.List;
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 defaultMapZoom = 17;
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;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
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;
public class InfoHelperUtils {
public static void infoPopUp(View anchorView, int layoutId) {
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,
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);

View File

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

View File

@ -144,7 +144,7 @@ public class PrefUtils {
}
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) {
@ -162,7 +162,7 @@ public class PrefUtils {
editor.putString("key_location_level","3");
editor.putString("location_mode", "manual");
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("latitude_manual_location", Double.doubleToRawLongBits(latLng.getLatitude()));
editor.apply();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#e9ffffff"/>
<stroke android:width="3dp" android:color="#B1BCBE" />
<solid android:color="#ffffff"/>
<stroke android:width="3dp" android:color="#b1bcbe" />
<corners android:radius="10dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

View File

@ -20,12 +20,6 @@
</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
android:id="@+id/linearLayout2"
android:layout_width="match_parent"

View File

@ -1,21 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:fontFamily="@font/lato_regular"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fontFamily="@font/lato_regular"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<ImageButton
android:id="@+id/contentTutorTabInfoImageButton"
android:layout_width="wrap_content"
@ -23,9 +17,7 @@
android:layout_gravity="right"
mapbox:srcCompat="@drawable/outline_info_24"/>
<TextView
android:id="@+id/userName"
<TextView android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10"
@ -35,129 +27,62 @@
android:textSize="@dimen/lbl_new_note_title"
android:textStyle="normal" />
<LinearLayout
<TextView
android:id="@+id/userDepartment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<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:maxLines="1"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_department"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
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">
<android.support.design.widget.TextInputEditText
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_height="wrap_content"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
android:hint="@string/hint_email"
/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
<TextView
android:id="@+id/dutyTitle"
android:textSize="16sp"
android:id="@+id/userRoom"
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"/>
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:paddingTop="5dp"
android:textColor="@color/note_list_text" />
<TextView
android:id="@+id/userDutyHours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
tools:text="@string/dutyHours" />
<TextView
android:textSize="16sp"
android:id="@+id/userNoteTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:textColor="@color/mapboxRedDark"
android:text="@string/userNoteTitle"/>
<android.support.design.widget.TextInputLayout
android:paddingStart="@dimen/activity_margin"
android:textColor="@color/note_list_text" />
<EditText
android:id="@+id/userNote"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/userNote"
android:layout_width="match_parent"
android:layout_height="150dp"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
android:hint="@string/tutorTabHint"
android:inputType="textMultiLine"
android:maxLength="1000"
android:maxLines="7"
android:requiresFadingEdge="vertical"
android:scrollbars="vertical"/>
</android.support.design.widget.TextInputLayout>
android:layout_height="150dp"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
android:hint="@string/tutorTabHint"
android:inputType="textMultiLine"
android:maxLength="1000"
android:maxLines="7"
android:requiresFadingEdge="vertical"
android:scrollbars="vertical"/>
<Button
android:id="@+id/saveButon"
@ -165,8 +90,4 @@
android:layout_height="wrap_content"
android:text="@string/saveButton" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -1,61 +0,0 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:textSize="16sp"
android:textSize="14sp"
android:paddingTop="2dp"
android:fontFamily="@font/lato_regular"
android:textColor="@color/mapboxWhite" />

View File

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

View File

@ -11,7 +11,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP2"
@ -19,7 +20,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP3"
@ -27,16 +29,17 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP3exactlvl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP3approximatelvl"
@ -44,7 +47,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP3manuallvl"
@ -52,7 +56,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP3presencelvl"
@ -60,7 +65,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP4"
@ -68,7 +74,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP5"
@ -76,7 +83,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP6"
@ -84,7 +92,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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
android:id="@+id/textViewP7"
@ -92,7 +101,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
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>

View File

@ -12,7 +12,8 @@
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
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
android:id="@+id/textViewP2"
@ -21,7 +22,8 @@
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
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
android:id="@+id/textViewP3"
@ -30,7 +32,8 @@
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
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
android:id="@+id/textViewP4"
@ -40,6 +43,7 @@
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
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>

View File

@ -11,13 +11,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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
android:id="@+id/userListPopupInfoTextViewP2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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
android:id="@+id/userListPopupInfoTextViewOnline"
@ -27,7 +30,8 @@
android:layout_height="wrap_content"
android:drawablePadding="5dp"
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
android:id="@+id/userListPopupInfoTextVieOffline"
@ -37,7 +41,8 @@
android:layout_height="wrap_content"
android:drawablePadding="5dp"
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
android:id="@+id/userListPopupInfoTextViewInactive"
@ -47,13 +52,24 @@
android:layout_height="wrap_content"
android:drawablePadding="5dp"
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
android:id="@+id/userListPopupInfoTextViewTip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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>

View File

@ -7,7 +7,6 @@
<PreferenceCategory android:title="@string/settings_category_general">
<ListPreference
android:defaultValue="0"
android:dialogTitle="@string/settings_language"
android:entries="@array/language_entries"
android:entryValues="@array/language_values"
@ -16,11 +15,11 @@
android:title="@string/title_language" />
<SwitchPreference
android:key="acra.disable"
android:title="@string/pref_disable_acra"
android:key="acra.enable"
android:title="@string/pref_title_acra"
android:summaryOn="@string/pref_acra_disabled"
android:summaryOff="@string/pref_acra_enabled"
android:defaultValue="false"/>
android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen>

View File

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

View File

@ -147,6 +147,8 @@
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingTop="-10dp"
android:divider="@color/background_user_modal"
android:dividerHeight="1dp"
android:textColor="@color/mapboxWhite"
/>
</LinearLayout>

View File

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

View File

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

View File

@ -8,4 +8,11 @@
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView"
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>

View File

@ -94,7 +94,7 @@
<string name="assembly_c">Skrzydło C</string>
<string name="passage_d">ŁącznikD</string>
<string name="key_language">key_language</string>
<string name="key_language">LOCALE</string>
<string name="title_activity_settings2">Ustawienia</string>
<!-- Example General settings -->
@ -121,7 +121,7 @@
<string name="prompt_login">Login (Ldap)</string>
<string name="action_log_in">Zaloguj!</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="user_location_permission_not_granted">Nie dodano uprawnień do lokalizacji.</string>
<string name="user_location_permission_explanation">Ta aplikacja potrzebuje uprawnień do lokalizacji.</string>
@ -172,9 +172,9 @@
<string name="map_info_text_p1">Na mapie wyświetlane są markery reprezentujące profesorów udostępniających w tej chwili swoją lokalizację.</string>
<string name="map_info_text_p2">Po kliknięciu w marker możemy sprawdzić kto udostępnia lokalizację, oraz status opisowy (jeśli profesor go ustawił).</string>
<string name="map_info_text_p3">W aplikacji dostępne są 3 rodzaje lokalizacji, które reprezentowane są przez markery różnego koloru.</string>
<string name="map_info_text_marker_exact">lokalizacja dokładna (udostępniana z GPS telefonu)</string>
<string name="map_info_text_marker_approximated">lokalizacja przybliżona</string>
<string name="map_info_text_marker_manual"> lokalizacja manualna (wybrana ręcznie)</string>
<string name="map_info_text_marker_exact">- lokalizacja dokładna\n(udostępniana z GPS telefonu)</string>
<string name="map_info_text_marker_approximated">- lokalizacja przybliżona</string>
<string name="map_info_text_marker_manual">- lokalizacja manualna (wybrana ręcznie)</string>
<!--(PL) Blacklist info helper-->
<string name="info_icon_blacklist_p1">W tym panelu możesz dodać użytkowników do swojej czarnej listy. Użytkownicy z czarnej listy nie będą widzieć żadnych danych które udostępniasz - lokalizacji, twojego statusu online, czy informacji o obecności.</string>
@ -211,17 +211,25 @@
<string name="info_icon_userlist_tab_level_status_online">- użytkownik jest obecnie online</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_tip">(nie udostępnił żadnych danych o lokalizacji od conajmniej tygodnia)</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="info_icon_userlist_tab_level_status_inactive_tip">(nie udostępnił żadnych danych o lokalizacji od co najmniej 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>
<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>
<!--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>
</resources>

View File

@ -109,7 +109,7 @@
<string name="lang_eng">English</string>
<string name="lang_pol">Polish</string>
<string name="settings_language">Choose language</string>
<string name="key_language">key_language</string>
<string name="key_language">LOCALE</string>
<string name="pref_header_about">About</string>
@ -233,12 +233,8 @@
<string name="network_error">Network Error!</string>
<string name="manual_status_error">Error handling status fetch</string>
<string name="error_status_fetch">Error handling status fetch</string>
<string name="error_location_fetch">Error handling status fetch</string>
<string name="error_location_fetch" translatable="false">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_title" translatable="false">FMT Issue</string>
<string name="notification_channel" translatable="false">FMT</string>
@ -248,17 +244,18 @@
<string name="mockup_location_string" translatable="false">mock location string</string>
<!--ACRA ON/OFF switch-->
<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_disable_acra" translatable="false">App issues reporting</string>
<string name="pref_acra_disabled" translatable="false">Allow to send report to developers is ON</string>
<string name="pref_acra_enabled" translatable="false">Allow to send report to developers is OFF</string>
<string name="pref_title_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-->
<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_p2">After clicking on a marker, you can check who is sharing it and the descriptive status (if the tutor have set one).</string>
<string name="map_info_text_p3">In the app there are 3 possible types of localization, represented by various colors.</string>
<string name="map_info_text_marker_exact">exact localization (from mobile GPS)</string>
<string name="map_info_text_marker_approximated">approximated localization</string>
<string name="map_info_text_marker_manual">manual localization (manually picked)</string>
<string name="map_info_text_marker_exact">- exact localization (from mobile GPS)</string>
<string name="map_info_text_marker_approximated">- approximated localization</string>
<string name="map_info_text_marker_manual">- manual localization (manually picked)</string>
<!--(ENG) Blacklist info helper-->
<string name="info_icon_blacklist_p1">In this panel you can add users to your blacklist. Users from the blacklist cant see any data that you share - localization, online status, or information about presence.</string>
@ -296,25 +293,14 @@
<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_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>
<!--(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="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>