diff --git a/README.md b/README.md index a69c805..eee8535 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,8 @@ All classes and methods are covered by instrumented tests. * Galaxy J5 (API23) * Galaxy S3 (API23 - СyanogenMod 14.1) * Galaxy S7 (API23) - * Nexus 9 (API23) * Xperia Z3 Compact (API23) + * Nexus 9 (API25) * General AVD's (API21 - API25) ### Known issues: diff --git a/app/build.gradle b/app/build.gradle index a8aa15f..47dc11c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,25 +31,20 @@ apply plugin: 'com.android.application' def final int MIN_SDK_MAIN = 19 def final String VERSION_NAME = '0.0.1' -def final int SDK_VER = Integer.parseInt(sdkVer) +def final int TARGET_SDK_VERSION = 25 +def final String BUILD_TOOLS_VERSION = '25.0.2' /*=====================================================*/ android { - compileSdkVersion SDK_VER - buildToolsVersion buildToolsVer + compileSdkVersion TARGET_SDK_VERSION + buildToolsVersion BUILD_TOOLS_VERSION - signingConfigs { - releaseConfig { - storeFile file(sigStoreFile) - storePassword sigStorePassword - keyAlias sigKeyAlias - keyPassword sigKeyPassword - } - } //noinspection GroovyMissingReturnStatement defaultConfig { - versionName VERSION_NAME; minSdkVersion MIN_SDK_MAIN; targetSdkVersion SDK_VER + versionName VERSION_NAME + minSdkVersion MIN_SDK_MAIN + targetSdkVersion TARGET_SDK_VERSION dexOptions { javaMaxHeapSize "12288M" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -59,7 +54,6 @@ android { jackOptions { enabled false } consumerProguardFiles 'proguard-rules.pro' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - //externalNativeBuild {cmake {cppFlags ""}} } buildTypes { @@ -68,23 +62,11 @@ android { debuggable false; useProguard true; shrinkResources true; minifyEnabled true proguardFile 'proguard-rules.pro' //noinspection GroovyAssignabilityCheck - signingConfig signingConfigs.releaseConfig manifestPlaceholders = [exported: true] } } } -configurations.all { - resolutionStrategy { - force 'junit:junit:4.12' - force 'com.android.support:support-annotations:25.2.0' - force 'com.android.support:support-v4:25.2.0' - force 'com.android.support:appcompat-v7:25.2.0' - force 'com.android.support:design:25.2.0' - force 'com.android.support:recyclerview-v7:25.2.0' - } -} - dependencies { /* Proguard rules */ compile 'com.infstory:proguard-annotations:1.0.2' @@ -93,7 +75,7 @@ dependencies { /* App compatibility */ compile 'com.android.support:appcompat-v7:25.3.0' - //compile project(':lib') - compile 'ru.nikitenkogleb:mpegencoder:0.0.1' + compile project(':lib') + //compile 'ru.nikitenkogleb:mpegencoder:0.0.1' } diff --git a/app/src/main/java/ru/nikitenkogleb/mpegencoder/demo/MainActivity.java b/app/src/main/java/ru/nikitenkogleb/mpegencoder/demo/MainActivity.java index 9eb4b05..381f6d6 100644 --- a/app/src/main/java/ru/nikitenkogleb/mpegencoder/demo/MainActivity.java +++ b/app/src/main/java/ru/nikitenkogleb/mpegencoder/demo/MainActivity.java @@ -88,7 +88,6 @@ public final class MainActivity extends AppCompatActivity { private static final int IFRAME_INTERVAL = 1; /** The one seconds of video. */ - @SuppressWarnings("PointlessArithmeticExpression") private static final int NUM_FRAMES = 131; /** The input buffer. */ @@ -101,7 +100,7 @@ public final class MainActivity extends AppCompatActivity { /** The parsing task. */ @Nullable - private ParseTask mParseTask = null; + private EncodeTask mEncodeTask = null; /** Is video playing. */ private boolean mNowPlaying = false; @@ -124,18 +123,14 @@ protected final void onCreate(@Nullable Bundle savedInstanceState) { setContentView(mContentView); - startParseTask(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath()); - - //Total methods in lib-release.aar: 157 (0,24% used) - //Total fields in lib-release.aar: 48 (0,07% used) - // 27762 bytes + startEncode(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath()); } /** {@inheritDoc} */ @Override protected final void onDestroy() { - stopParseTask(); + stopEncodeTask(); stopVideo(); assert mContentView != null; @@ -197,23 +192,23 @@ private void resumeVideo() { } } - /** Start parse task. */ - private void startParseTask(@NonNull String fileName) { - stopParseTask(); - mParseTask = new ParseTask(this, fileName); + /** Start encode task. */ + private void startEncode(@NonNull String fileName) { + stopEncodeTask(); + mEncodeTask = new EncodeTask(this, fileName); } - /** Cancel Parse Task. */ - private void stopParseTask() { - if (mParseTask != null) { - mParseTask.close(); - mParseTask = null; + /** Cancel encode Task. */ + private void stopEncodeTask() { + if (mEncodeTask != null) { + mEncodeTask.close(); + mEncodeTask = null; } } /** The mp4 encoding task. */ - private static final class ParseTask extends AsyncTask implements Closeable { + private static final class EncodeTask extends AsyncTask implements Closeable { /** The main activity weak reference. */ @NonNull @@ -228,12 +223,12 @@ private static final class ParseTask extends AsyncTask impleme private final String mFilePath; /** - * Constructs a new {@link ParseTask} with a {@link MainActivity} reference. + * Constructs a new {@link EncodeTask} with a {@link MainActivity} reference. * * @param activity the {@link MainActivity} instance * @param filePath the output file path */ - ParseTask(@NonNull MainActivity activity, @NonNull String filePath) { + EncodeTask(@NonNull MainActivity activity, @NonNull String filePath) { mMainActivityWeakReference = new WeakReference<>(activity); mFilePath = filePath; mAssetManager = activity.getAssets(); execute(); diff --git a/build.gradle b/build.gradle index 0a665a9..c5275e5 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,6 @@ buildscript { allprojects { repositories { jcenter() - maven { url myMavenRepoReadUrl } } tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" diff --git a/lib/build.gradle b/lib/build.gradle index d834dff..b1ba4b7 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -33,25 +33,19 @@ apply plugin: 'com.getkeepsafe.dexcount' def final int MIN_SDK_MAIN = 19 def final String VERSION_NAME = '0.0.1' -def final int SDK_VER = Integer.parseInt(sdkVer) +def final int TARGET_SDK_VERSION = 25 +def final String BUILD_TOOLS_VERSION = '25.0.2' /*=====================================================*/ android { - compileSdkVersion SDK_VER - buildToolsVersion buildToolsVer - - signingConfigs { - releaseConfig { - storeFile file(sigStoreFile) - storePassword sigStorePassword - keyAlias sigKeyAlias - keyPassword sigKeyPassword - } - } + compileSdkVersion TARGET_SDK_VERSION + buildToolsVersion BUILD_TOOLS_VERSION //noinspection GroovyMissingReturnStatement defaultConfig { - versionName VERSION_NAME; minSdkVersion MIN_SDK_MAIN; targetSdkVersion SDK_VER + versionName VERSION_NAME + minSdkVersion MIN_SDK_MAIN + targetSdkVersion TARGET_SDK_VERSION dexOptions { javaMaxHeapSize "12288M" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -68,7 +62,6 @@ android { debuggable false; useProguard true; shrinkResources true; minifyEnabled true proguardFile 'proguard-rules.pro' //noinspection GroovyAssignabilityCheck - signingConfig signingConfigs.releaseConfig manifestPlaceholders = [exported: true] } } @@ -97,22 +90,11 @@ publishing { repositories { maven { //noinspection GroovyAssignabilityCheck - url myMavenRepoWriteUrl + //url myMavenRepoWriteUrl } } } -/*configurations.all { - resolutionStrategy { - force 'junit:junit:4.12' - force 'com.android.support:support-annotations:25.2.0' - force 'com.android.support:support-v4:25.2.0' - force 'com.android.support:appcompat-v7:25.2.0' - force 'com.android.support:design:25.2.0' - force 'com.android.support:recyclerview-v7:25.2.0' - } -}*/ - dependencies { /* Proguard rules */ compile 'com.infstory:proguard-annotations:1.0.2'