From d322332533547f8b1ac73c3b6c8916d8c74eadaf Mon Sep 17 00:00:00 2001 From: Nikitenko Gleb Date: Wed, 15 Mar 2017 17:37:38 +0300 Subject: [PATCH 1/3] Some source cosmetics fixes --- app/build.gradle | 12 ------- .../mpegencoder/demo/MainActivity.java | 35 ++++++++----------- lib/build.gradle | 11 ------ 3 files changed, 15 insertions(+), 43 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a8aa15f..9e5a9c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,7 +59,6 @@ android { jackOptions { enabled false } consumerProguardFiles 'proguard-rules.pro' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - //externalNativeBuild {cmake {cppFlags ""}} } buildTypes { @@ -74,17 +73,6 @@ android { } } -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' 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/lib/build.gradle b/lib/build.gradle index d834dff..90d13df 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -102,17 +102,6 @@ publishing { } } -/*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' From db31a427d164e45b5e7bb8dd65b12da2bdcf8b9b Mon Sep 17 00:00:00 2001 From: Gleb Nikitenko Date: Wed, 15 Mar 2017 18:43:10 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 6bb022fd4596b00b5994d1b4a042aab57d963b68 Mon Sep 17 00:00:00 2001 From: Andrew Dementiev Date: Mon, 20 Mar 2017 15:24:10 +0800 Subject: [PATCH 3/3] fixed: gradle issues --- app/build.gradle | 24 +++++++++--------------- build.gradle | 1 - lib/build.gradle | 23 ++++++++--------------- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9e5a9c3..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 @@ -67,7 +62,6 @@ android { debuggable false; useProguard true; shrinkResources true; minifyEnabled true proguardFile 'proguard-rules.pro' //noinspection GroovyAssignabilityCheck - signingConfig signingConfigs.releaseConfig manifestPlaceholders = [exported: true] } } @@ -81,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/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 90d13df..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,7 +90,7 @@ publishing { repositories { maven { //noinspection GroovyAssignabilityCheck - url myMavenRepoWriteUrl + //url myMavenRepoWriteUrl } } }