Fix BG & UI
This commit is contained in:
parent
ab74f0b7e1
commit
c452e5dbf5
@ -100,7 +100,6 @@ public abstract class BaseActivity
|
|||||||
|
|
||||||
} else if (itemName.equals(getResources().getString(R.string.navigation_item_logout))) {
|
} else if (itemName.equals(getResources().getString(R.string.navigation_item_logout))) {
|
||||||
if(PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
if(PrefUtils.isBackgroundLocationServiceRunning(getApplicationContext())) {
|
||||||
|
|
||||||
stopBackgroundLocalizationTask();
|
stopBackgroundLocalizationTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ public abstract class BaseActivity
|
|||||||
|
|
||||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||||||
startForegroundService(startIntent);
|
startForegroundService(startIntent);
|
||||||
} else {
|
} else {
|
||||||
startService(startIntent);
|
startService(startIntent);
|
||||||
|
@ -154,7 +154,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void loginProcess(String email, String password) {
|
private void loginProcess(String email, String password) {
|
||||||
ValidateUser user = new ValidateUser(email, password);
|
ValidateUser user = new ValidateUser(email, password);
|
||||||
LdapUser fuser = new LdapUser(email,password,"wmi","tutor","marek","nocny","szmare@wmi.pl");
|
LdapUser fuser = new LdapUser(email,password,"tutor","tutor","mieszko","nocny","szmsdsdsdsdare@wmi.pl");
|
||||||
// disposable.add(ldapService.validate(user)
|
// disposable.add(ldapService.validate(user)
|
||||||
disposable.add(ldapService.fakeValidate(fuser)
|
disposable.add(ldapService.fakeValidate(fuser)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
@ -16,52 +11,34 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.annimon.stream.Collector;
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.model.Feedback;
|
|
||||||
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
|
||||||
import com.uam.wmi.findmytutor.service.FeedbackService;
|
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
|
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||||
|
|
||||||
|
|
||||||
public class SharingFragment extends PreferenceFragment {
|
public class SharingFragment extends PreferenceFragment {
|
||||||
private HashMap<Integer, String> locationLevelMapping;
|
|
||||||
private HashMap<Integer, String> statusMapping;
|
|
||||||
private PredefinedStatusesService statusesService;
|
|
||||||
private CompositeDisposable disposable;
|
|
||||||
protected Preference locationSharing;
|
protected Preference locationSharing;
|
||||||
protected Preference locationMode;
|
protected Preference locationMode;
|
||||||
protected Preference manualLocationList;
|
protected Preference manualLocationList;
|
||||||
@ -70,6 +47,14 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
protected Preference manualStatus;
|
protected Preference manualStatus;
|
||||||
protected ListPreference statusList;
|
protected ListPreference statusList;
|
||||||
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
|
protected List<PredefinedCoordViewModel> predefinedCoordsList = new ArrayList<>();
|
||||||
|
private HashMap<Integer, String> locationLevelMapping;
|
||||||
|
private HashMap<Integer, String> statusMapping;
|
||||||
|
private PredefinedStatusesService statusesService;
|
||||||
|
private CompositeDisposable disposable;
|
||||||
|
|
||||||
|
public static SharingFragment newInstance() {
|
||||||
|
return new SharingFragment();
|
||||||
|
}
|
||||||
|
|
||||||
void getStatuses(CompositeDisposable disposable) {
|
void getStatuses(CompositeDisposable disposable) {
|
||||||
|
|
||||||
@ -183,7 +168,6 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).single();
|
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).single();
|
||||||
|
|
||||||
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData());
|
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData());
|
||||||
// ((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -218,11 +202,6 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SharingFragment newInstance() {
|
|
||||||
return new SharingFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
@ -263,7 +242,6 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(),
|
Toast.makeText(getApplicationContext(),
|
||||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
Log.d("FEEDBACK", error.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,14 +25,12 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
import com.google.android.gms.location.LocationServices;
|
import com.google.android.gms.location.LocationServices;
|
||||||
import com.google.android.gms.tasks.OnSuccessListener;
|
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.geojson.Point;
|
import com.mapbox.geojson.Point;
|
||||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.Consts;
|
|
||||||
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.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
@ -40,6 +38,8 @@ import com.uam.wmi.findmytutor.utils.mapUtils;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
@ -61,7 +61,8 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
private static long notify_interval = 10000;
|
private static long notify_interval = 10000;
|
||||||
Location mLastLocation;
|
Location mLastLocation;
|
||||||
Boolean stopService = false;
|
Boolean stopService = false;
|
||||||
|
Intent intent;
|
||||||
|
public static String str_receiver = "background.location.broadcast";
|
||||||
ArrayList<String> providers = new ArrayList<String>();
|
ArrayList<String> providers = new ArrayList<String>();
|
||||||
LocationListener[] mLocationListeners;
|
LocationListener[] mLocationListeners;
|
||||||
|
|
||||||
@ -146,17 +147,22 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!stopService) {
|
if (!stopService) {
|
||||||
mStatusChecker = () -> {
|
|
||||||
try {
|
Timer mTimer = new Timer();
|
||||||
|
mTimer.schedule(new TimerTaskToGetLocation(), 20, notify_interval);
|
||||||
|
intent = new Intent(str_receiver);
|
||||||
|
|
||||||
fn_getlocation();
|
fn_getlocation();
|
||||||
} finally {
|
|
||||||
mHandler.postDelayed(mStatusChecker, notify_interval);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AsyncTask.execute(mStatusChecker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TimerTaskToGetLocation extends TimerTask {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mHandler.post(BackgroundLocalizationService.this::fn_getlocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
|
@ -15,21 +15,30 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignStart="@+id/feedback_input"
|
android:layout_alignStart="@+id/feedback_input"
|
||||||
android:layout_marginBottom="@dimen/dimen_10"
|
android:layout_marginBottom="15dp"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="10sp"
|
||||||
android:text="placeholder"
|
android:text="placeholder"
|
||||||
android:textColor="@color/colorAccent"
|
android:textColor="@color/colorAccent"
|
||||||
android:textSize="@dimen/lbl_new_note_title"
|
android:textSize="@dimen/lbl_new_note_title"
|
||||||
android:textStyle="normal" />
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/feedback_modal_subtitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:text="placeholder"
|
||||||
|
android:textColor="@color/note_list_text"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/feedback_input"
|
android:id="@+id/feedback_input"
|
||||||
android:layout_width="315dp"
|
android:layout_width="315dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="150dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="70dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="@string/modal_feedback_hint"
|
android:hint="@string/modal_feedback_hint"
|
||||||
android:inputType="textMultiLine"
|
android:inputType="textMultiLine"
|
||||||
@ -55,13 +64,5 @@
|
|||||||
android:layout_alignEnd="@+id/feedback_input"
|
android:layout_alignEnd="@+id/feedback_input"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/feedback_modal_subtitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_above="@+id/feedback_input"
|
|
||||||
android:layout_alignEnd="@+id/feedback_input"
|
|
||||||
android:layout_marginEnd="0dp"
|
|
||||||
android:layout_marginBottom="-50dp"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<group android:id="@+id/drawer_group_tutor">
|
<group android:id="@+id/drawer_group_tutor">
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/nav_item_one"
|
android:id="@+id/nav_item_one"
|
||||||
android:icon="@drawable/ic_people_white"
|
android:icon="@drawable/ic_people_white"
|
||||||
android:title="@string/navigation_item_whitelist" />
|
android:title="@string/navigation_item_whitelist" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_item_two"
|
android:id="@+id/nav_item_two"
|
||||||
android:icon="@drawable/ic_people_black"
|
android:icon="@drawable/ic_people_black"
|
||||||
android:title="@string/navigation_item_blacklist" />
|
android:title="@string/navigation_item_blacklist" />-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_item_three"
|
android:id="@+id/nav_item_three"
|
||||||
android:icon="@drawable/outline_person_white_24dp"
|
android:icon="@drawable/outline_person_white_24dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user