mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-10 20:15:54 +00:00
Move StrictMode handling into SyncthingApp class
This commit is contained in:
parent
3ddf526679
commit
f4e1b077d3
2 changed files with 9 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.nutomic.syncthingandroid;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.StrictMode;
|
||||
|
||||
import com.nutomic.syncthingandroid.util.Languages;
|
||||
|
||||
|
@ -10,5 +11,12 @@ public class SyncthingApp extends Application {
|
|||
public void onCreate() {
|
||||
super.onCreate();
|
||||
new Languages(this).setLanguage(this);
|
||||
|
||||
// Set VM policy to avoid crash when sending folder URI to file manager.
|
||||
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.build();
|
||||
StrictMode.setVmPolicy(policy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.StrictMode;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
|
@ -14,6 +13,7 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
|
||||
public class FirstStartActivity extends Activity implements Button.OnClickListener {
|
||||
|
@ -34,13 +34,6 @@ public class FirstStartActivity extends Activity implements Button.OnClickListen
|
|||
Button cont = (Button) findViewById(R.id.cont);
|
||||
cont.setOnClickListener(this);
|
||||
|
||||
// Set VM policy to avoid crash when sending folder URI to file manager.
|
||||
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.build();
|
||||
StrictMode.setVmPolicy(policy);
|
||||
|
||||
if (!isFirstStart()) {
|
||||
if (haveStoragePermission()) {
|
||||
startApp();
|
||||
|
|
Loading…
Reference in a new issue