This commit is contained in:
Mieszko Wrzeszczyński 2018-12-09 18:54:18 +01:00
commit 385df14b2f
8 changed files with 39 additions and 15 deletions

View File

@ -52,7 +52,8 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'io.swagger:swagger-annotations:1.5.15'
implementation 'org.threeten:threetenbp:1.3.5'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.5'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.7.2'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.0.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
@ -66,7 +67,6 @@ dependencies {
implementation 'com.auth0.android:jwtdecode:1.1.1'
implementation 'com.annimon:stream:1.2.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.0.0'
// FloatingBarMenu
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.apache.commons:commons-collections4:4.0'

View File

@ -21,6 +21,7 @@ import com.auth0.android.jwt.JWT;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.model.JwtToken;
import com.uam.wmi.findmytutor.model.LdapUser;
import com.uam.wmi.findmytutor.model.User;
import com.uam.wmi.findmytutor.model.ValidateUser;
import com.uam.wmi.findmytutor.network.ApiClient;
@ -148,8 +149,10 @@ public class LoginActivity extends AppCompatActivity {
private void loginProcess(String email, String password) {
ValidateUser user = new ValidateUser(email, password);
disposable.add(ldapService.validate(user)
LdapUser fakeUser = new LdapUser(email, password,"wmi","tutor",email,"Fałszywy",email);
// disposable.add(ldapService.fakeValidate(fakeUser)
// disposable.add(ldapService.validate(user)
disposable.add(ldapService.fakeValidate(fakeUser)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError));

View File

@ -126,7 +126,6 @@ public class MapActivity extends BaseActivity
selectLocationButton = findViewById(R.id.select_location_button);
removeLocationButton = findViewById(R.id.remove_location_button);
Mapbox.getInstance(this, getString(R.string.access_token));
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
@ -637,6 +636,7 @@ public class MapActivity extends BaseActivity
@Override
protected int getContentViewId() {
Mapbox.getInstance(this, getString(R.string.access_token));
return R.layout.activity_map;
}

View File

@ -66,7 +66,7 @@ public class SharingFragment extends PreferenceFragment {
@Override
public void onSuccess(List<String> strings) {
String[] statusesArray = strings.toArray(new String[strings.size()]);
setListPreferenceData(statusList.getKey(), statusesArray,strings.size() -1);
setListPreferenceData(statusList.getKey(), statusesArray,null);
}
@Override
@ -120,7 +120,6 @@ public class SharingFragment extends PreferenceFragment {
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
manualStatus = findPreference("key_manual_status");
statusList = (ListPreference) findPreference("key_status_value");
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
disposable = new CompositeDisposable();
getStatuses(disposable);
@ -128,6 +127,10 @@ public class SharingFragment extends PreferenceFragment {
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
getLocations(disposable);
}
Log.d("SHAR TAB", (String) statusList.getSummary());
Log.d("SHAR TAB",( String) manualLocationList.getSummary());
// Log.d("SHAR TAB","dupa");
locationLevelMapping = new HashMap<Integer, String>();
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
@ -140,6 +143,9 @@ public class SharingFragment extends PreferenceFragment {
statusMapping.put(1, "consultation");
statusMapping.put(2, "busy");
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);
@ -173,11 +179,12 @@ public class SharingFragment extends PreferenceFragment {
/** Custom manual location list change listener **/
manualLocationList.setOnPreferenceChangeListener((preference, newValue) -> {
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)]);
lp.setSummary(lp.getEntries()[Integer.parseInt((String) newValue)]);
return true;
});
@ -195,7 +202,7 @@ public class SharingFragment extends PreferenceFragment {
ListPreference lp = (ListPreference) preference;
CharSequence[] entries = lp.getEntries();
PrefUtils.storeStatus(getApplicationContext(), (String) entries[Integer.parseInt((String) newValue)]);
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
return true;
});
/** Custom status list change listener **/

View File

@ -188,5 +188,13 @@ public class PrefUtils {
public static String getCurrentManualLocation(Context context) {
return getSharedPreferences(context).getString("current_manual_location", null);
}
public static void putCurrentManualLocationName(Context context, String locationName) {
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString("current_manual_location_name", locationName);
editor.apply();
}
public static String getCurrentManualLocationName(Context context) {
return getSharedPreferences(context).getString("current_manual_location_name", null);
}
}

View File

@ -15,5 +15,12 @@
android:summary="%s"
android:title="@string/title_language" />
<SwitchPreference
android:key="acra.disable"
android:title="@string/pref_disable_acra"
android:summaryOn="@string/pref_acra_disabled"
android:summaryOff="@string/pref_acra_enabled"
android:defaultValue="false"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -26,8 +26,6 @@
android:title="@string/title_location_level" />
<ListPreference
android:key="key_manual_location_value"
android:entries="@array/manual_location_entries"
android:entryValues="@array/manual_location_values"
android:summary="%s"
android:title="@string/title_list_manual_location" />
<com.uam.wmi.findmytutor.utils.RightButtonPreference
@ -45,8 +43,6 @@
<ListPreference
android:defaultValue="1"
android:key="@string/key_status_value"
android:entries="@array/status_entries"
android:entryValues="@array/status_values"
android:summary="%s"
android:title="@string/status_list_title" />
<EditTextPreference

View File

@ -234,9 +234,12 @@
<string name="manual_status_error">Error handling status fetch</string>
<string name="error_status_fetch">Error handling status fetch</string>
<string name="pref_acra_disabled" translatable="false">Auto reporting on issue is OFF</string>
<string name="pref_acra_enabled" translatable="false">Auto reporting on issue is ON</string>
<string name="pref_disable_acra" translatable="false">ACRA reporting tool</string>
<string name="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_text">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_title" translatable="false">FMT Crash</string>
<string name="notification_title" translatable="false">FMT Issue</string>
<string name="notification_channel" translatable="false">FMT</string>
<string name="lack_duty_hours">Lack information about duty hours</string>
<string name="lack_note">No note.</string>