Merge pull request #367 from afischerdev/test-and11

Smaller changes for #312
This commit is contained in:
afischerdev 2021-11-18 11:31:46 +01:00 committed by GitHub
commit 43028e0722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 18 deletions

View file

@ -533,14 +533,21 @@ public class BRouterActivity extends Activity implements ActivityCompat.OnReques
dirFreeSizes.add( Long.valueOf( size ) );
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
basedirOptions = new String[items.size()];
} else {
basedirOptions = new String[items.size() + 1];
}
int bdidx = 0;
DecimalFormat df = new DecimalFormat( "###0.00" );
for ( int idx = 0; idx < availableBasedirs.size(); idx++ )
{
basedirOptions[bdidx++] = availableBasedirs.get( idx ) + " (" + df.format( dirFreeSizes.get( idx ) / 1024. / 1024. / 1024. ) + " GB free)";
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
basedirOptions[bdidx] = "Enter path manually";
}
showDialog( DIALOG_SELECTBASEDIR_ID );
}

View file

@ -214,7 +214,7 @@ public class BRouterView extends View
assertDirectoryExists( "modes directory", modesDir, "modes.zip", version );
assertDirectoryExists( "readmes directory", new File (basedir, "brouter/readmes"), "readmes.zip", version );
File inputDir = new File (basedir, "/import");
File inputDir = new File (basedir, "brouter/import");
assertDirectoryExists( "input directory", inputDir, null, version );
// new init is done move old files

View file

@ -132,7 +132,7 @@ public class DownloadService extends Service implements ProgressListener {
public void downloadFiles() {
// first check lookup table and prifles
// first check lookup table and profiles
String result = checkScripts();
if ( result != null) {
if (DEBUG) Log.d("BR", "error: " + result);
@ -192,9 +192,7 @@ public class DownloadService extends Service implements ProgressListener {
{
try
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
TrafficStats.setThreadStatsTag(1);
}
int slidx = surl.lastIndexOf( "segments4/" );
String name = surl.substring( slidx+10 );
@ -397,17 +395,13 @@ public class DownloadService extends Service implements ProgressListener {
{
try
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
TrafficStats.setThreadStatsTag(1);
}
if ( connection == null )
{
URL url = new URL(surl);
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(5000);
connection.connect();
}
// expect HTTP 200 OK, so we don't mistakenly save error report
// instead of the file
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -2,3 +2,9 @@ NOTE:
Please copy a profile before you edit it.
The delivered profiles will be overwritten when the lookups.dat changes.
WARNING:
Since Android Q (29) the storage folder for BRouter is a app specific folder.
It will be removed when BRouter is uninstalled or the data is cleared (system settings/apps).