Skip to content

Commit

Permalink
Update to version 4.0.0(beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
Udhayarajan committed May 14, 2022
1 parent 9b44ce5 commit 4cf7aea
Show file tree
Hide file tree
Showing 50 changed files with 1,448 additions and 355 deletions.
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

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.

10 changes: 8 additions & 2 deletions .idea/misc.xml

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

6 changes: 6 additions & 0 deletions .idea/other.xml

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

38 changes: 23 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-android'

}

android {
compileSdkVersion 31
compileSdkVersion 32
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.mugames.vidsnap"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 32
versionCode 9
versionName "3.2.0"
versionName "4.0.0(beta)"
multiDexEnabled true


testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -63,20 +63,23 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics'

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.activity:activity:1.4.0"
implementation "androidx.fragment:fragment:1.4.1"
implementation 'com.google.android.material:material:1.5.0'
implementation "androidx.activity:activity-ktx:1.4.0"
implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'

implementation files('libs/java-json.jar')
implementation 'androidx.core:core-ktx:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.firebase:firebase-config:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.3'
// implementation files('libs/java-json.jar')

implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'com.google.firebase:firebase-config:21.0.2'
implementation 'com.google.firebase:firebase-database:20.0.4'

//Fetch
implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.6"
Expand All @@ -102,7 +105,7 @@ dependencies {


//Room
def room_version = "2.4.1"
def room_version = "2.4.2"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - RxJava2 support for Room
Expand All @@ -117,5 +120,10 @@ dependencies {
//LeakCanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'

//VidSnapKit
// implementation 'com.github.Udhayarajan:VidSnapKit:0.0.1'

implementation 'com.github.Udhayarajan:VidSnapKit:0.0.5-alpha'


}
Binary file removed app/libs/java-json.jar
Binary file not shown.
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<receiver
android:name=".utility.VideoSharedBroadcast"
android:enabled="true"
android:exported="false"></receiver>
android:exported="false"/>

<activity
android:name=".ui.activities.ContactActivity"
Expand All @@ -52,6 +52,13 @@

<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>

<category android:name="android.intent.category.DEFAULT"/>

<data android:mimeType="video/*"/>
</intent-filter>
</activity>
<activity
android:name=".ui.activities.MainActivity"
Expand Down
24 changes: 21 additions & 3 deletions app/src/main/java/com/mugames/vidsnap/database/History.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.mugames.vidsnap.utility.UtilityClass;

import java.util.Date;
import java.util.Objects;

@Entity(tableName = "HISTORY")
@TypeConverters(DateConverter.class)
Expand All @@ -45,25 +46,42 @@ public class History {
public String image;
@ColumnInfo(name = "source_url")
public String sourceUrl;
public History() {}

public History() {
}


public History(DownloadDetails details, Uri uri) {
this.fileName = details.fileName;
this.fileType = details.fileType;
this.source = details.src;
this.date = DateConverter.toDate( new Date().getTime());
this.date = DateConverter.toDate(new Date().getTime());
this.size = String.valueOf(details.videoSize);
this.uriString = uri.toString();
sourceUrl = details.srcUrl;
image = UtilityClass.bitmapToString(details.getThumbNail());
}

public Uri getUri(){
public Uri getUri() {
return Uri.parse(uriString);
}

public String getDate() {
return (String) DateFormat.format("dd-MM-yyyy", date);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
History history = (History) o;
return Objects.equals(fileName, history.fileName) &&
Objects.equals(fileType, history.fileType) &&
Objects.equals(source, history.source) &&
Objects.equals(date, history.date) &&
Objects.equals(size, history.size) &&
Objects.equals(uriString, history.uriString) &&
Objects.equals(image, history.image) &&
Objects.equals(sourceUrl, history.sourceUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

Expand All @@ -38,4 +39,7 @@ public interface HistoryDao {

@Query("SELECT COUNT(1) FROM HISTORY")
LiveData<Boolean> isEntryAvailable();

@Delete
void removeItem(History history);
}
12 changes: 4 additions & 8 deletions app/src/main/java/com/mugames/vidsnap/extractor/Extractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

import com.mugames.vidsnap.R;
import com.mugames.vidsnap.network.MiniExecute;
import com.mugames.vidsnap.ui.activities.MainActivity;
import com.mugames.vidsnap.utility.UtilityClass;
import com.mugames.vidsnap.utility.bundles.Formats;
import com.mugames.vidsnap.utility.Statics;
Expand All @@ -59,7 +58,6 @@
import com.mugames.vidsnap.utility.UtilityInterface.DialogueInterface;
import com.mugames.vidsnap.utility.UtilityInterface.LoginHelper;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;

Expand Down Expand Up @@ -196,8 +194,7 @@ private void getSizeForManifest() {
long oldSize = formats.videoSizes.get(chunkIndex);
long size = oldSize + miniExecute.getSize();
formats.videoSizes.set(chunkIndex, size);
DecimalFormat decimalFormat = new DecimalFormat("#.##");
formats.videoSizeInString.set(chunkIndex, decimalFormat.format(size / Math.pow(10, 6)));
formats.videoSizeInString.set(chunkIndex, UtilityClass.formatFileSize(size, false));
}
isManifestReady = true;
checkForManifestCompletion();
Expand Down Expand Up @@ -230,8 +227,7 @@ private void getSizeForVideos() {
int index = miniExecute.getBundle().getInt(EXTRA_INDEX);
long size = miniExecute.getSize();
formats.videoSizes.set(index, size);
DecimalFormat decimalFormat = new DecimalFormat("#.##");
formats.videoSizeInString.set(index, decimalFormat.format(size / Math.pow(10, 6)));
formats.videoSizeInString.set(index, UtilityClass.formatFileSize(size, false));
formats.mainFileURLs.set(index, filterURLs(formats.mainFileURLs.get(index)));
}
isVideoSizeReady = true;
Expand Down Expand Up @@ -355,10 +351,10 @@ public void show(String text) {
}

@Override
public void error(String message, Exception e) {
public void error(String reason, Throwable e) {
new Handler(applicationContext.getMainLooper()).post(() -> {
if (dialogueInterface != null)
dialogueInterface.error(message, e);
dialogueInterface.error(reason, e);
});
}

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/mugames/vidsnap/extractor/YouTube.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public class YouTube extends Extractor {
static String[] FUNCTION_REGEX = new String[]{
"\\b[cs]\\s*&&\\s*[adf]\\.set\\([^,]+\\s*,\\s*encodeURIComponent\\s*\\(\\s*([a-zA-Z0-9$]+)\\(",
"\\b[a-zA-Z0-9]+\\s*&&\\s*[a-zA-Z0-9]+\\.set\\([^,]+\\s*,\\s*encodeURIComponent\\s*\\(\\s*([a-zA-Z0-9$]+)\\(",
"\\bm=([a-zA-Z0-9$]{2,})\\(decodeURIComponent\\(h\\.s\\)\\)",
"\\bc&&\\(c=([a-zA-Z0-9$]{2,})\\(decodeURIComponent\\(c\\)\\)",
"(?:\\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\\s*=\\s*function\\(\\s*a\\s*\\)\\s*{\\s*a\\s*=\\s*a\\.split\\(\\s*\\\"\\\"\\s*\\);[a-zA-Z0-9$]{2}\\.[a-zA-Z0-9$]{2}\\(a,\\d+\\)",
"(?:\\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\\s*=\\s*function\\(\\s*a\\s*\\)\\s*{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)",
/*Obsolete patterns*/
"(?:\\b|[^a-zA-Z0-9$])([a-zA-Z0-9$]{2})\\s*=\\s*function\\(\\s*a\\s*\\)\\s*\\{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)",
"([a-zA-Z0-9$]+)\\s*=\\s*function\\(\\s*a\\s*\\)\\s*\\{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)",
"([\"\\'])signature\\1\\s*,\\s*([a-zA-Z0-9$]+)\\(",
Expand Down
Loading

0 comments on commit 4cf7aea

Please sign in to comment.