From 503ef058ad788db49926e34553b5f3403da3e235 Mon Sep 17 00:00:00 2001 From: Ahmed M Bader El-Din Date: Sun, 9 Aug 2020 11:46:46 +0300 Subject: [PATCH] update --- README.md | 52 ++++++++++++++++++- app/build.gradle | 8 +-- .../javaCode/NewPostActivity.java | 16 +++--- app/src/main/res/layout/activity_new_post.xml | 9 ++-- 4 files changed, 63 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f759553..2fa7865 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,50 @@ -# Video-Trimmer-Android -Trim the video by adjusting starting point and ending point in Android. \ No newline at end of file +# Video-Trimmer-Android # +Trim the video by adjusting starting point and ending point in Android. + + +license : MIT +license : MIT + +## Core Features ## + + - Video can be trimmed/shortened and played on the same screen + - Video can be trimmed by selecting the starting point and ending point, and it will display the video size and video duration based on the selected position + - Seekbar moves as per selected video for trimming + - You can specify the length of the video before cut. + +## How it works ## + + - User can record video from camera or select video from gallery + - Set the selected video in the trimming screen + - Trim the video by dragging starting point and end point + - View trimmed video on the trimming screen + - Save video, it will show image from video in next screen. + - You can use the video after that as you like, like upload to server. + +## Purpose of this code ## + + - Whenever it is required to crop thr video, this code can help you + - Whenever you are having a limiation of video recording such as allow users to record video for 1 min, this code can help you + + +## Requirements ## + + - Android 4.1+ + + +## Contact me via e-mail ## +For any inquiries or clarifications, you can contact me via e-mail. Just send an email to [ahmedmbadereldin@gmail.com](mailto:ahmedmbadereldin@gmail.com "ahmedmbadereldin@gmail.com"). + +## Contact me via social media ## + +[Facebook](https://www.facebook.com/AhmedMBaderElDin) | [Twitter](https://twitter.com/AhmedBaderEDin) | [Linkedin](https://www.linkedin.com/in/ahmed-m-bader-el-din-0ba48bb5/) + +## Libraries ## + + - [SDP - a scalable size unit](https://github.com/intuit/sdp) + - [SSP - a scalable size unit for texts](https://github.com/intuit/ssp) + - [Android RunTime Permission](https://github.com/fccaikai/AndroidPermissionX) + - [read, write and create MP4 files](https://github.com/sannies/mp4parser) + - [Pick image or video](https://github.com/iamthevoid/media-picker-android) + - [View images](https://github.com/bumptech/glide) + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 2fe12d2..a82aa7b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,20 +31,20 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.1.0' + 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.12' + testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'com.intuit.sdp:sdp-android:1.0.6' implementation 'com.intuit.ssp:ssp-android:1.0.6' - implementation 'com.googlecode.mp4parser:isoparser:1.1.22' - implementation 'com.github.danylovolokh:video-player-manager:0.2.0' implementation 'com.github.fccaikai:AndroidPermissionX:1.0.0' + implementation 'com.googlecode.mp4parser:isoparser:1.1.22' + implementation 'iam.void.mediapicker:mediapicker:0.2.3' implementation 'io.reactivex:rxjava:1.3.5' implementation 'io.reactivex:rxandroid:1.2.1' diff --git a/app/src/main/java/com/ahmedbadereldin/videotrimmerapplication/javaCode/NewPostActivity.java b/app/src/main/java/com/ahmedbadereldin/videotrimmerapplication/javaCode/NewPostActivity.java index 640aa37..b3224e3 100644 --- a/app/src/main/java/com/ahmedbadereldin/videotrimmerapplication/javaCode/NewPostActivity.java +++ b/app/src/main/java/com/ahmedbadereldin/videotrimmerapplication/javaCode/NewPostActivity.java @@ -22,13 +22,17 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.Toast; + import androidx.appcompat.app.AppCompatActivity; + import com.ahmedbadereldin.videotrimmerapplication.R; import com.bumptech.glide.Glide; import com.kcode.permissionslib.main.OnRequestPermissionsCallBack; import com.kcode.permissionslib.main.PermissionCompat; + import java.io.File; import java.util.Objects; + import iam.thevoid.mediapicker.rxmediapicker.Purpose; import iam.thevoid.mediapicker.rxmediapicker.RxMediaPicker; import rx.functions.Action1; @@ -36,7 +40,6 @@ public class NewPostActivity extends AppCompatActivity { - private EditText contentTxt; private ImageView videoBtn; private FrameLayout postImgLY; private ImageView postImg; @@ -64,7 +67,6 @@ protected void onNewIntent(Intent intent) { } private void initViews() { - contentTxt = findViewById(R.id.contentTxt); videoBtn = findViewById(R.id.videoBtn); postImgLY = findViewById(R.id.postImgLY); postImg = findViewById(R.id.postImg); @@ -80,11 +82,8 @@ private void setSharedInentData(Intent sharedInentData) { if (receivedAction != null && receivedAction.equals(Intent.ACTION_SEND)) { //content is being shared - if (receivedType.startsWith("text/")) { - //handle sent text - String receivedText = sharedInentData.getStringExtra(Intent.EXTRA_TEXT); - contentTxt.setText(receivedText); - } else if (receivedType.startsWith("image/")) { + assert receivedType != null; + if (receivedType.startsWith("image/")) { //handle sent image uriPostImg = sharedInentData.getParcelableExtra(Intent.EXTRA_STREAM); if (uriPostImg != null) { @@ -159,13 +158,10 @@ public void onDenied(String permission) { } private void loadIage(Uri filepath) { - Log.d("loadIage", "loadIage: " + filepath); - // MEDIA GALLERY String path = getPath(filepath); Uri filea = Uri.fromFile(new File(path)); String fileExt = MimeTypeMap.getFileExtensionFromUrl(filea.toString()); - Log.d("onActivityResultaaa", "onActivityResult: " + fileExt); if (fileExt.equalsIgnoreCase("MP4")) { File file = new File(path); diff --git a/app/src/main/res/layout/activity_new_post.xml b/app/src/main/res/layout/activity_new_post.xml index 17584dc..f97a380 100644 --- a/app/src/main/res/layout/activity_new_post.xml +++ b/app/src/main/res/layout/activity_new_post.xml @@ -5,7 +5,6 @@ android:layout_height="match_parent" android:orientation="vertical"> - + android:textColor="@color/app_blue" + android:visibility="invisible" /> @@ -77,9 +77,6 @@ - - - \ No newline at end of file