Disable sharing when user dismiss sharing
This commit is contained in:
parent
f433aa26d5
commit
f1dbe33eec
@ -29,7 +29,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -10,7 +10,7 @@ android {
|
||||
applicationId "com.uam.wmi.findmytutor"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 69
|
||||
versionCode 70
|
||||
versionName "1.0.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
@ -42,6 +42,7 @@ import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||
import com.uam.wmi.findmytutor.utils.WifiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -233,17 +234,22 @@ public abstract class BaseActivity
|
||||
stopIntent.putExtra("request_stop", true);
|
||||
|
||||
stopService(stopIntent);
|
||||
|
||||
}
|
||||
|
||||
public void startBackgroundLocalizationTask() {
|
||||
checkPermissions();
|
||||
Log.e("MODE_TRYB",PrefUtils.getLocationLevel(getApplicationContext()));
|
||||
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())
|
||||
&& !PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())
|
||||
) {
|
||||
statusCheck();
|
||||
}
|
||||
|
||||
if (!WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
|
||||
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())){
|
||||
statusCheck();
|
||||
}
|
||||
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
||||
|
||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
|
@ -12,6 +12,8 @@ import android.widget.Toast;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.activity.MapActivity;
|
||||
|
||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||
|
||||
public class EnableLocalization extends DialogFragment {
|
||||
|
||||
@Override
|
||||
@ -19,11 +21,14 @@ public class EnableLocalization extends DialogFragment {
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.enable_sharing)
|
||||
.setMessage("Can I enable localization sharing?")
|
||||
.setMessage(R.string.use_gps)
|
||||
.setPositiveButton(R.string.possitive_dialog_button, (dialog, which) ->
|
||||
dialogPositiveAnswer(getActivity())
|
||||
)
|
||||
.setNegativeButton(R.string.negative_dialog_button, (dialog, which) -> dialog.cancel()).create();
|
||||
.setNegativeButton(R.string.negative_dialog_button, (dialog, which) -> {
|
||||
PrefUtils.storeEnableSharingLocalization(getActivity(), false);
|
||||
dialog.cancel();
|
||||
}).create();
|
||||
}
|
||||
|
||||
private void dialogPositiveAnswer(Context context) {
|
||||
|
@ -293,6 +293,8 @@
|
||||
<string name="batter_exclusions_message">Aby aplikacja była w pełni funkcjonalna, dodaj FMT do wyjątków w oszczędzaniu baterii. Po wciśnięciu przycisku \"ok\" zostaniesz przeniesiony do opcji zarządzania baterią. W panelu \"Bateria\" upewnij się, że opcja optymalizacji jest wyłączona.</string>
|
||||
<string name="never_logged_in">Nigdy</string>
|
||||
|
||||
|
||||
<!--(ENG) ask for gps -->
|
||||
<string name="enable_sharing">Włącz lokalizację</string>
|
||||
<string name="use_gps">Aby użyć tej funkcji musisz włączyć lokalizowanie urządzenia.</string>
|
||||
</resources>
|
||||
|
||||
|
@ -460,5 +460,8 @@
|
||||
<string name="batter_exclusions_title">Please note</string>
|
||||
<string name="no_tutor_tab">Tutor tab not found for this user</string>
|
||||
<string name="never_logged_in">Never</string>
|
||||
|
||||
<!--(ENG) ask for gps -->
|
||||
<string name="enable_sharing">Enable localization</string>
|
||||
<string name="use_gps">In order to use this function you have to enable localization.</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user