Add dialog during enabling location #169
@ -29,7 +29,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</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" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 69
|
versionCode 70
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
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.PrefUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
|
import com.uam.wmi.findmytutor.utils.WifiUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -233,17 +234,22 @@ public abstract class BaseActivity
|
|||||||
stopIntent.putExtra("request_stop", true);
|
stopIntent.putExtra("request_stop", true);
|
||||||
|
|
||||||
stopService(stopIntent);
|
stopService(stopIntent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startBackgroundLocalizationTask() {
|
public void startBackgroundLocalizationTask() {
|
||||||
checkPermissions();
|
checkPermissions();
|
||||||
Log.e("MODE_TRYB",PrefUtils.getLocationLevel(getApplicationContext()));
|
|
||||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())
|
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())
|
||||||
&& !PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())
|
&& !PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())
|
||||||
) {
|
) {
|
||||||
statusCheck();
|
statusCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WifiUtils.checkIfUserIsInRangeOfWmiWifi(getApplicationContext())
|
||||||
|
&& PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.PRESENCE.toString())){
|
||||||
|
statusCheck();
|
||||||
|
}
|
||||||
|
|
||||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
||||||
|
|
||||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
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.R;
|
||||||
import com.uam.wmi.findmytutor.activity.MapActivity;
|
import com.uam.wmi.findmytutor.activity.MapActivity;
|
||||||
|
|
||||||
|
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||||
|
|
||||||
public class EnableLocalization extends DialogFragment {
|
public class EnableLocalization extends DialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -19,11 +21,14 @@ public class EnableLocalization extends DialogFragment {
|
|||||||
|
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setTitle(R.string.enable_sharing)
|
.setTitle(R.string.enable_sharing)
|
||||||
.setMessage("Can I enable localization sharing?")
|
.setMessage(R.string.use_gps)
|
||||||
.setPositiveButton(R.string.possitive_dialog_button, (dialog, which) ->
|
.setPositiveButton(R.string.possitive_dialog_button, (dialog, which) ->
|
||||||
dialogPositiveAnswer(getActivity())
|
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) {
|
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="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>
|
<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>
|
</resources>
|
||||||
|
|
||||||
|
@ -460,5 +460,8 @@
|
|||||||
<string name="batter_exclusions_title">Please note</string>
|
<string name="batter_exclusions_title">Please note</string>
|
||||||
<string name="no_tutor_tab">Tutor tab not found for this user</string>
|
<string name="no_tutor_tab">Tutor tab not found for this user</string>
|
||||||
<string name="never_logged_in">Never</string>
|
<string name="never_logged_in">Never</string>
|
||||||
|
|
||||||
|
<!--(ENG) ask for gps -->
|
||||||
<string name="enable_sharing">Enable localization</string>
|
<string name="enable_sharing">Enable localization</string>
|
||||||
|
<string name="use_gps">In order to use this function you have to enable localization.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user