diff --git a/android/.gitignore b/android/.gitignore index 6e42311a..297d122f 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -12,7 +12,5 @@ local.properties build.sh android.iml build -gradle -gradlew -gradlew.bat + diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 4d26dbbb..2ae14711 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -4,11 +4,11 @@ android:installLocation="auto"> - + - - + + - diff --git a/android/build.gradle b/android/build.gradle index 187690f4..b2382329 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,9 +2,10 @@ buildscript { repositories { mavenCentral() jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.3.2' } } @@ -18,12 +19,12 @@ repositories { } dependencies { - compile 'com.android.support:support-compat:28.0.0' + implementation 'com.android.support:support-compat:28.0.0' } android { compileSdkVersion 28 - buildToolsVersion "28.0.1" + buildToolsVersion "28.0.3" defaultConfig { applicationId "org.purplei2p.i2pd" targetSdkVersion 28 diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..f6b961fd Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0e4283d9 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Mar 14 18:21:08 MSK 2019 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/android/gradlew.bat b/android/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/android/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml index c3d1a24f..d5dc58e8 100755 --- a/android/res/values-ru/strings.xml +++ b/android/res/values-ru/strings.xml @@ -16,4 +16,5 @@ Приложение было остановлено осталось Запрос + Права для записи на SD карту отклонены, вам необходимо предоставить их для продолжения diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index b7f556c8..3a5cf4fe 100755 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -16,4 +16,5 @@ Application stopped remaining Prompt + SD card write permission denied, you need to allow this to continue diff --git a/android/src/org/purplei2p/i2pd/DaemonSingleton.java b/android/src/org/purplei2p/i2pd/DaemonSingleton.java index bfcd4152..fa487b67 100644 --- a/android/src/org/purplei2p/i2pd/DaemonSingleton.java +++ b/android/src/org/purplei2p/i2pd/DaemonSingleton.java @@ -6,14 +6,12 @@ import android.util.Log; import org.purplei2p.i2pd.R; public class DaemonSingleton { - private static final String TAG="i2pd"; + private static final String TAG = "i2pd"; private static final DaemonSingleton instance = new DaemonSingleton(); public interface StateUpdateListener { void daemonStateUpdate(); } private final Set stateUpdateListeners = new HashSet<>(); - public static DaemonSingleton getInstance() { - return instance; - } + public static DaemonSingleton getInstance() { return instance; } public synchronized void addStateChangeListener(StateUpdateListener listener) { stateUpdateListeners.add(listener); } public synchronized void removeStateChangeListener(StateUpdateListener listener) { stateUpdateListeners.remove(listener); } @@ -91,7 +89,6 @@ public class DaemonSingleton { } catch (Throwable tr) { lastThrowable=tr; setState(State.startFailed); - return; } } diff --git a/android/src/org/purplei2p/i2pd/ForegroundService.java b/android/src/org/purplei2p/i2pd/ForegroundService.java index 2ba30c8a..5c10e138 100644 --- a/android/src/org/purplei2p/i2pd/ForegroundService.java +++ b/android/src/org/purplei2p/i2pd/ForegroundService.java @@ -1,5 +1,6 @@ package org.purplei2p.i2pd; +import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; diff --git a/android/src/org/purplei2p/i2pd/I2PDPermsAskerActivity.java b/android/src/org/purplei2p/i2pd/I2PDPermsAskerActivity.java index aa2ff301..149a3aa2 100644 --- a/android/src/org/purplei2p/i2pd/I2PDPermsAskerActivity.java +++ b/android/src/org/purplei2p/i2pd/I2PDPermsAskerActivity.java @@ -119,11 +119,10 @@ public class I2PDPermsAskerActivity extends Activity { // permission denied, boo! Disable the // functionality that depends on this permission. - textview_retry.setText("SD card write permission denied, you need to allow this to continue"); + textview_retry.setText(R.string.permDenied); textview_retry.setVisibility(TextView.VISIBLE); button_request_write_ext_storage_perms.setVisibility(Button.VISIBLE); } - return; } // other 'case' lines to check for other