Merge pull request #382 from afischerdev/update-version
Add file check for A10 #379
This commit is contained in:
commit
15e84c81ea
2 changed files with 20 additions and 9 deletions
|
@ -596,7 +596,7 @@ public class BRouterActivity extends Activity implements ActivityCompat.OnReques
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R
|
||||||
&& checkExternalStorageWritable()) {
|
&& checkExternalStorageWritable()) {
|
||||||
res.add(Environment.getExternalStorageDirectory());
|
res.add(Environment.getExternalStorageDirectory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,15 @@ public class BRouterView extends View {
|
||||||
if (brd.isDirectory()) {
|
if (brd.isDirectory()) {
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q &&
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q &&
|
||||||
!brd.getAbsolutePath().contains("/Android/media/btools.routingapp")) {
|
!brd.getAbsolutePath().contains("/Android/media/btools.routingapp")) {
|
||||||
|
|
||||||
|
// don't ask twice
|
||||||
|
String version = "v" + getContext().getString(R.string.app_version);
|
||||||
|
File vFile = new File(brd, "profiles2/"+version );
|
||||||
|
if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.Q
|
||||||
|
&& vFile.exists()) {
|
||||||
|
startSetup(baseDir, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
String message = "(previous basedir " + baseDir + " has to migrate )";
|
String message = "(previous basedir " + baseDir + " has to migrate )";
|
||||||
|
|
||||||
((BRouterActivity) getContext()).selectBasedir(((BRouterActivity) getContext()).getStorageDirectories(), guessBaseDir(), message);
|
((BRouterActivity) getContext()).selectBasedir(((BRouterActivity) getContext()).getStorageDirectories(), guessBaseDir(), message);
|
||||||
|
@ -608,16 +617,18 @@ public class BRouterView extends View {
|
||||||
break;
|
break;
|
||||||
String name = ze.getName();
|
String name = ze.getName();
|
||||||
File outfile = new File(path, name);
|
File outfile = new File(path, name);
|
||||||
outfile.getParentFile().mkdirs();
|
if (!outfile.exists()) {
|
||||||
FileOutputStream fos = new FileOutputStream(outfile);
|
outfile.getParentFile().mkdirs();
|
||||||
|
FileOutputStream fos = new FileOutputStream(outfile);
|
||||||
|
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
int len = zis.read(data, 0, 1024);
|
int len = zis.read(data, 0, 1024);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
break;
|
break;
|
||||||
fos.write(data, 0, len);
|
fos.write(data, 0, len);
|
||||||
|
}
|
||||||
|
fos.close();
|
||||||
}
|
}
|
||||||
fos.close();
|
|
||||||
}
|
}
|
||||||
is.close();
|
is.close();
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue