Merge branch 'fix-manula-bg' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
7a41dcbb1f
@ -4,10 +4,10 @@
|
||||
package="com.uam.wmi.findmytutor">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
|
@ -212,7 +212,7 @@ public abstract class BaseActivity
|
||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
startIntent.putExtra("notify_interval", onlineBackgroundLocationInterval);
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(startIntent);
|
||||
} else {
|
||||
startService(startIntent);
|
||||
|
@ -162,10 +162,10 @@ public class BlackList extends AppCompatActivity {
|
||||
|
||||
private void fetchBlackListedUsers() {
|
||||
prevSize = blacklistedUsers.size();
|
||||
|
||||
blacklistedUsers.clear();
|
||||
|
||||
disposable.add(getListOfBlacklistedUsers(tutorId)
|
||||
.doOnSubscribe(t -> didFetched = false)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap((Function<List<String>, Observable<String>>) Observable::fromIterable)
|
||||
@ -179,11 +179,13 @@ public class BlackList extends AppCompatActivity {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
showError(e);
|
||||
didFetched = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Collections.sort(blacklistedUsers, (a, b) -> sortByUserName(a,b));
|
||||
didFetched = true;
|
||||
refreshUI();
|
||||
}
|
||||
}));
|
||||
|
@ -214,10 +214,9 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
/** Sharing level list **/
|
||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
|
||||
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
||||
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||
if (!predefinedCoordsList.isEmpty()) {
|
||||
preferenceCategory.addPreference(manualLocationList);
|
||||
|
@ -44,7 +44,6 @@ import com.uam.wmi.findmytutor.utils.WrapContentLinearLayoutManager;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -61,11 +60,6 @@ import okhttp3.ResponseBody;
|
||||
|
||||
public class WhiteList extends AppCompatActivity {
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private UserService userService;
|
||||
private boolean didFetched = false;
|
||||
private String tutorId;
|
||||
|
||||
@BindView(R.id.recycler_view_whitelist)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.white_list_empty_text_view)
|
||||
@ -74,7 +68,10 @@ public class WhiteList extends AppCompatActivity {
|
||||
Switch aSwitch;
|
||||
@BindView(R.id.add_to_white_list_fab)
|
||||
FloatingActionButton addToWhiteListFab;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
private UserService userService;
|
||||
private boolean didFetched = false;
|
||||
private String tutorId;
|
||||
private WhiteListAdapter mAdapter;
|
||||
private Integer prevSize;
|
||||
private List<User> whitelistedUsers = new ArrayList<>();
|
||||
@ -151,6 +148,7 @@ public class WhiteList extends AppCompatActivity {
|
||||
whitelistedUsers.clear();
|
||||
|
||||
disposable.add(getListOfWhitelistedUsers(tutorId)
|
||||
.doOnSubscribe(t -> didFetched = false)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap((Function<List<String>, Observable<String>>) Observable::fromIterable)
|
||||
@ -164,11 +162,13 @@ public class WhiteList extends AppCompatActivity {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
showError(e);
|
||||
didFetched = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Collections.sort(whitelistedUsers, (a, b) -> sortByUserName(a, b));
|
||||
didFetched = true;
|
||||
refreshUI();
|
||||
}
|
||||
}));
|
||||
@ -256,6 +256,7 @@ public class WhiteList extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void toggleEmptyNotes() {
|
||||
|
||||
if (didFetched && whitelistedUsers.size() == 0) {
|
||||
noNotesView.setText(R.string.list_is_empty);
|
||||
noNotesView.setVisibility(View.VISIBLE);
|
||||
|
Loading…
Reference in New Issue
Block a user