Commit d2df5971 authored by Bastien Zigmann's avatar Bastien Zigmann

Version publiée

parent 1e64809e
......@@ -24,7 +24,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" 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">
......
......@@ -6,7 +6,7 @@ android {
applicationId "geocropping.com.geocroppingapp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionCode 6
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
......@@ -25,4 +25,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
def appCenterSdkVersion = '1.2.0'
compile "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
compile "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"geocropping.com.geocroppingapp","split":"","minSdkVersion":"15"}}]
\ No newline at end of file
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":6},"path":"app-release.apk","properties":{"packageId":"geocropping.com.geocroppingapp","split":"","minSdkVersion":"15"}}]
\ No newline at end of file
......@@ -10,7 +10,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="Geocropping"
android:label="GeoCropping"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
......
......@@ -10,7 +10,7 @@ public class DebugPerso {
AlertDialog alert;
public DebugPerso(){
this.build = new AlertDialog.Builder(MainActivity.getAppContext());
this.build = new AlertDialog.Builder(MainActivity.getAppContext(),R.style.MyDialogTheme);
}
public void afficherMessage(String str) {
......
......@@ -21,6 +21,9 @@ import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;
public class MainActivity extends AppCompatActivity {
......@@ -30,6 +33,10 @@ public class MainActivity extends AppCompatActivity {
private static WebView wv;
private static Context context;
// Gestion du GPS
private LocationManager locationManager;
private LocationListener locationListener;
// Quand on fait retour, si on l'a autorisé fait un retour sur la webview
@Override
public void onBackPressed() {
......@@ -41,7 +48,7 @@ public class MainActivity extends AppCompatActivity {
}
private void buildAlertMessageNoGps() {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyDialogTheme);
builder.setMessage("Le GPS semble être désactivé, l'activer?")
.setCancelable(false)
.setPositiveButton("Oui", new DialogInterface.OnClickListener() {
......@@ -102,21 +109,9 @@ public class MainActivity extends AppCompatActivity {
}
}
// TODO : quand le popup est ouvert pour demander si on active le gps, si on l'active puis qu'on met "non" ça reste en posclick
private void configureGPS() {
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
// Détection du on/off du GPS
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, new LocationListener() {
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
}
......@@ -134,8 +129,49 @@ public class MainActivity extends AppCompatActivity {
public void onProviderDisabled(String s) {
callJS("geocropping.MobileSetGPSPosition(false);");
}
});
};
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
// Détection du on/off du GPS
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, locationListener);
}
@Override
protected void onStop() {
super.onStop();
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.removeUpdates(locationListener);
}
@Override
protected void onRestart(){
super.onRestart();
configureGPS();
}
@Override
protected void onResume(){
super.onResume();
}
@Override
protected void onPause(){
super.onPause();
}
@Override
protected void onDestroy(){
super.onDestroy();
}
@Override
......@@ -151,6 +187,7 @@ public class MainActivity extends AppCompatActivity {
}else{
configureGPS();
}
// De même avec le wifi
if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_NETWORK_STATE}, REQUEST_WIFI);
......@@ -213,10 +250,13 @@ public class MainActivity extends AppCompatActivity {
}
});
// Permet de récupérer les rapports d'erreur : https://appcenter.ms/orgs/Xsalto/apps/GeoCropping-1/crashes/groups
AppCenter.start(getApplication(), "136e9a5d-b497-4a82-9169-008ef2a8830f", Analytics.class, Crashes.class);
// Pour pouvoir débug sur chrome (chrome://inspect)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
//if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
// WebView.setWebContentsDebuggingEnabled(true);
//}
}
......
......@@ -9,7 +9,7 @@ import android.content.Intent;
public class NetworkChangeReceiver extends BroadcastReceiver {
public static void buildAlertMessageNoConnection(){
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.getAppContext());
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.getAppContext(), R.style.MyDialogTheme);
builder.setMessage("Connexion perdue").setCancelable(false).setPositiveButton("Recharger", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
......
......@@ -7,5 +7,7 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/colorPrimaryDark</item>
</style>
</resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment