Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
- Supported to android 11
- solved some issues in android 10 and the last version.
- upgrade library and SDK to last version.
  • Loading branch information
Ahmedbadereldin committed Oct 4, 2021
1 parent 3bda8f3 commit f5f4d39
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 55 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

39 changes: 24 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
compileSdkVersion 31
buildToolsVersion "30.0.3"
// 0123456789
defaultConfig {
applicationId "com.ahmedbadereldin.videotrimmerapplication"
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -24,10 +24,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// debuggable true
// minifyEnabled true
// shrinkResources true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Expand All @@ -40,12 +40,12 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
Expand All @@ -56,9 +56,18 @@ dependencies {
implementation 'io.reactivex:rxjava:1.3.5'
implementation 'io.reactivex:rxandroid:1.2.1'

implementation('com.github.bumptech.glide:glide:4.11.0') {
implementation('com.github.bumptech.glide:glide:4.12.0') {
exclude group: "com.android.support"
}

//CameraX Dependencies
implementation "androidx.camera:camera-core:1.1.0-alpha09"
implementation "androidx.camera:camera-camera2:1.1.0-alpha09"
implementation "androidx.camera:camera-lifecycle:1.1.0-alpha09"
implementation "androidx.camera:camera-view:1.0.0-alpha29"
implementation "androidx.camera:camera-extensions:1.0.0-alpha29"
implementation 'com.sangcomz:FishBun:1.0.0-alpha05'

annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation project(':videotrimmer')
}
32 changes: 29 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<queries>
<intent>
<action android:name="android.intent.action.PICK" />
<data android:mimeType="vnd.android.cursor.dir/image" />
</intent>
</queries>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>

<application
android:requestLegacyExternalStorage="true"
Expand All @@ -18,7 +31,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name="com.ahmedbadereldin.videotrimmerapplication.MainActivity">
<activity android:name="com.ahmedbadereldin.videotrimmerapplication.MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -30,6 +43,7 @@
android:name=".NewPostActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter android:label="@string/app_name">
Expand All @@ -47,6 +61,7 @@
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:exported="true"
android:theme="@style/AppTheme.SlidrActivityTheme"
android:windowSoftInputMode="adjustPan" />

Expand All @@ -55,9 +70,20 @@
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:exported="true"
android:theme="@style/AppTheme.SlidrActivityTheme"
android:windowSoftInputMode="adjustPan" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ private void loadImage(Uri filepath) {

if (fileExt.equalsIgnoreCase("MP4")) {
File file = new File(path);
Log.d(TAG, "loadImageloadImageloadImageloadImage: " + path);
Log.d(TAG, "loadImageloadImageloadImageloadImage: " + file.length());
if (file.exists()) {
startActivityForResult(new Intent(NewPostActivity.this, VideoTrimmerActivity.class).putExtra("EXTRA_PATH", path), VIDEO_TRIM);
overridePendingTransition(0, 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.ahmedbadereldin.videotrimmerapplication;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
Expand All @@ -20,6 +24,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.ahmedbadereldin.videotrimmer.Utility;
import com.ahmedbadereldin.videotrimmer.customVideoViews.BackgroundTask;
Expand All @@ -28,8 +33,12 @@
import com.ahmedbadereldin.videotrimmer.customVideoViews.OnRangeSeekBarChangeListener;
import com.ahmedbadereldin.videotrimmer.customVideoViews.OnVideoTrimListener;
import com.ahmedbadereldin.videotrimmer.customVideoViews.TileView;
import com.sangcomz.fishbun.FishBun;
import com.sangcomz.fishbun.adapter.image.impl.GlideAdapter;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
Expand Down Expand Up @@ -117,9 +126,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

if (getIntent().getExtras() != null) {
srcFile = getIntent().getExtras().getString("EXTRA_PATH");

}
dstFile = Environment.getExternalStorageDirectory() + "/" + getString(R.string.app_name) + new Date().getTime()
+ Utility.VIDEO_FORMAT;
// dstFile = Environment.getExternalStorageDirectory() + "/" + getString(R.string.app_name) + new Date().getTime()
// + Utility.VIDEO_FORMAT;

Log.d("srcFile", "loadImageloadImageloadImageloadImage: " + dstFile);

tileView.post(() -> {
setBitmap(Uri.parse(srcFile));
Expand Down Expand Up @@ -205,7 +219,10 @@ public void onClick(View view) {
mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(VideoTrimmerActivity.this, Uri.parse(srcFile));
final File file = new File(srcFile);

Log.d(
"executeAAAA",
"execute: " + "Aaaa" + file.length() + " " + dstFile + " " + mStartPosition + " " + mEndPosition + " " + mOnVideoTrimListener
);
//notify that video trimming started
if (mOnVideoTrimListener != null)
mOnVideoTrimListener.onTrimStarted();
Expand All @@ -214,7 +231,11 @@ public void onClick(View view) {
@Override
public void execute() {
try {
Utility.startTrim(file, dstFile, mStartPosition * 1000, mEndPosition * 1000, mOnVideoTrimListener);
Log.d(
"executeAAAA",
"execute: " + "Aaaa" + file.length() + " " + dstFile + " " + mStartPosition + " " + mEndPosition + " " + mOnVideoTrimListener
);
Utility.startTrim(VideoTrimmerActivity.this,file, dstFile, mStartPosition * 1000, mEndPosition * 1000, mOnVideoTrimListener);
} catch (final Throwable e) {
Objects.requireNonNull(Thread.getDefaultUncaughtExceptionHandler()).uncaughtException(Thread.currentThread(), e);
}
Expand Down Expand Up @@ -421,4 +442,6 @@ public String milliSecondsToTimer(long milliseconds) {
// return timer string
return finalTimerString;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class VideoTrimmerKotlinActivity : AppCompatActivity(),
"executeAAAA",
"execute: " + "Aaaa" + file.length() + " " + dstFile + " " + mStartPosition + " " + mEndPosition + " " + mOnVideoTrimListener
)
Utility.startTrim(
Utility.startTrim(this@VideoTrimmerKotlinActivity,
file,
dstFile!!,
mStartPosition * 1000.toLong(),
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/provider_paths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="stuff"
path="/" />
</paths>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.72"
ext.kotlin_version = "1.5.31"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
2 changes: 0 additions & 2 deletions videotrimmer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand Down
Loading

0 comments on commit f5f4d39

Please sign in to comment.