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