Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmedbadereldin committed Aug 11, 2020
1 parent 91b308f commit 0211790
Show file tree
Hide file tree
Showing 29 changed files with 426 additions and 1,998 deletions.
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

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

2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ dependencies {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

implementation project(':videotrimmer')
}
10 changes: 9 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@
</activity>

<activity
android:name=".javaCode.VideoTrimmerActivity"
android:name=".VideoTrimmerActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.SlidrActivityTheme"
android:windowSoftInputMode="adjustPan" />

<activity
android:name=".kotlinCode.VideoTrimmerKotlinActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.ahmedbadereldin.videotrimmerapplication.javaCode.VideoTrimmerActivity;
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;


public class NewPostActivity extends AppCompatActivity {
Expand All @@ -43,10 +37,11 @@ public class NewPostActivity extends AppCompatActivity {
private FrameLayout postImgLY;
private ImageView postImg;
private ImageView cancelImgBtn;
Uri uriPostImg;
String pathPostImg;
private Uri uriPostImg;
private String pathPostImg;
private static final int REQUEST_TAKE_GALLERY_VIDEO = 100;
private static final int VIDEO_TRIM = 101;
private String TAG = NewPostActivity.class.getSimpleName();

@Override
protected void onCreate(final Bundle savedInstanceState) {
Expand All @@ -61,7 +56,6 @@ protected void onCreate(final Bundle savedInstanceState) {
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);

setSharedInentData(intent);
}

Expand Down Expand Up @@ -133,12 +127,7 @@ public void onGrant() {
.pick(Purpose.Pick.VIDEO)
.take(Purpose.Take.VIDEO)
.build()
.subscribe(new Action1<Uri>() {
@Override
public void call(Uri uri) {
loadIage(uri);
}
});
.subscribe(uri -> loadImage(uri));
}

@Override
Expand All @@ -156,7 +145,7 @@ public void onDenied(String permission) {
});
}

private void loadIage(Uri filepath) {
private void loadImage(Uri filepath) {
// MEDIA GALLERY
String path = getPath(filepath);
Uri filea = Uri.fromFile(new File(path));
Expand Down Expand Up @@ -184,14 +173,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_TAKE_GALLERY_VIDEO) {
if (resultCode == RESULT_OK) {
Uri selectedImageUri = data.getData();

// MEDIA GALLERY
String path = getPath(selectedImageUri);
Uri filea = Uri.fromFile(new File(path));
String fileExt = MimeTypeMap.getFileExtensionFromUrl(filea.toString());
Log.d("onActivityResultaaa", "onActivityResult: " + fileExt);
Uri uriFile = Uri.fromFile(new File(path));
String fileExtension = MimeTypeMap.getFileExtensionFromUrl(uriFile.toString());
Log.d(TAG, "onActivityResult: " + fileExtension);

if (fileExt.equalsIgnoreCase("MP4")) {
if (fileExtension.equalsIgnoreCase("MP4")) {
File file = new File(path);
if (file.exists()) {
startActivityForResult(new Intent(NewPostActivity.this, VideoTrimmerActivity.class).putExtra("EXTRA_PATH", path), VIDEO_TRIM);
Expand All @@ -200,15 +188,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast.makeText(NewPostActivity.this, "Please select proper video", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(this, getString(R.string.file_format) + " ," + fileExt, Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.file_format) + " ," + fileExtension, Toast.LENGTH_SHORT).show();
}
}
} else if (requestCode == VIDEO_TRIM) {
if (resultCode == RESULT_OK) {
if (data != null) {
String videoPath = data.getExtras().getString("INTENT_VIDEO_FILE");
File file = new File(videoPath);
Log.d("onActivityResultAA", "onActivityResult: " + file.length());
Log.d(TAG, "onActivityResult: " + file.length());

pathPostImg = videoPath;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmedbadereldin.videotrimmer;
package com.ahmedbadereldin.videotrimmerapplication;

import android.app.ProgressDialog;
import android.content.Intent;
Expand All @@ -16,18 +16,16 @@
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.ahmedbadereldin.videotrimmer.Utility;
import com.ahmedbadereldin.videotrimmer.customVideoViews.BackgroundTask;
import com.ahmedbadereldin.videotrimmer.customVideoViews.BarThumb;
import com.ahmedbadereldin.videotrimmer.customVideoViews.CustomRangeSeekBar;
import com.ahmedbadereldin.videotrimmer.customVideoViews.OnRangeSeekBarChangeListener;
import com.ahmedbadereldin.videotrimmer.customVideoViews.OnVideoTrimListener;
import com.ahmedbadereldin.videotrimmer.customVideoViews.TileView;

import java.io.File;
import java.util.Date;
import java.util.Locale;
Expand Down

This file was deleted.

Loading

0 comments on commit 0211790

Please sign in to comment.