Skip to content

Commit

Permalink
Revamp Playlist as Library
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhPatange committed Nov 30, 2019
1 parent 3ebaa86 commit 8aaafd4
Show file tree
Hide file tree
Showing 441 changed files with 1,961 additions and 526 deletions.
Empty file modified .circleci/config.yml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.iml
.gradle
AppSettings.java
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
Expand Down
Empty file modified .gradle/4.6/fileChanges/last-build.bin
100644 → 100755
Empty file.
Empty file modified .gradle/4.6/fileContent/annotation-processors.bin
100644 → 100755
Empty file.
Binary file modified .gradle/4.6/fileContent/fileContent.lock
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/fileHashes/fileHashes.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/fileHashes/fileHashes.lock
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/fileHashes/resourceHashesCache.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/javaCompile/classAnalysis.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/javaCompile/jarAnalysis.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/javaCompile/javaCompile.lock
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/javaCompile/taskHistory.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/javaCompile/taskJars.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/taskHistory/taskHistory.bin
100644 → 100755
Binary file not shown.
Binary file modified .gradle/4.6/taskHistory/taskHistory.lock
100644 → 100755
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
100644 → 100755
Binary file not shown.
Empty file modified .gradle/buildOutputCleanup/cache.properties
100644 → 100755
Empty file.
Empty file modified .gradle/buildOutputCleanup/outputFiles.bin
100644 → 100755
Empty file.
Empty file modified .gradle/vcsWorkingDirs/gc.properties
100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions .idea/assetWizardSettings.xml
100644 → 100755

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

Binary file modified .idea/caches/build_file_checksums.ser
100644 → 100755
Binary file not shown.
Empty file modified .idea/codeStyles/Project.xml
100644 → 100755
Empty file.
Empty file modified .idea/gradle.xml
100644 → 100755
Empty file.
Empty file modified .idea/misc.xml
100644 → 100755
Empty file.
Empty file modified .idea/modules.xml
100644 → 100755
Empty file.
Empty file modified .idea/render.experimental.xml
100644 → 100755
Empty file.
Empty file modified .idea/runConfigurations.xml
100644 → 100755
Empty file.
Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
708 changes: 362 additions & 346 deletions .idea/workspace.xml
100644 → 100755

Large diffs are not rendered by default.

Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified MyID3_for_Android/MyID3_for_Android.jar
100644 → 100755
Empty file.
Empty file modified MyID3_for_Android/build.gradle
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified YTApp.iml
100644 → 100755
Empty file.
Empty file modified YTPlayer.iml
100644 → 100755
Empty file.
Empty file modified app/.gitignore
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions app/app.iml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:process-phoenix:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.karumi:dexter:5.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.exoplayer:exoplayer:2.9.6@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-ads:17.1.2@aar" level="project" />
<orderEntry type="library" name="Gradle: com.github.spyhunter99:super-tooltip-aar:4.0.2@aar" level="project" />
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation 'com.karumi:dexter:5.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.mozilla:rhino:1.7R4'
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0'
implementation 'com.google.android.exoplayer:exoplayer:2.9.6'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.github.spyhunter99:super-tooltip-aar:4.0.2'
Expand Down
Empty file modified app/proguard-rules.pro
100644 → 100755
Empty file.
Empty file.
5 changes: 1 addition & 4 deletions app/src/main/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@
android:theme="@style/AppTheme.NoActionBar1">
<intent-filter>
<action android:name="android.intent.action.SEND" />

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

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

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

<data
android:host="youtube.com"
android:scheme="http" />
Expand Down
Empty file modified app/src/main/assets/armeabi-v7a/ffmpeg
100644 → 100755
Empty file.
Empty file modified app/src/main/assets/x86/ffmpeg
100644 → 100755
Empty file.
Binary file modified app/src/main/ic_launcher-web.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/ic_launcher-web.png~
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified app/src/main/java/com/github/hiteshsondhi88/libffmpeg/Log.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified app/src/main/java/com/github/hiteshsondhi88/libffmpeg/Util.java
100644 → 100755
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion app/src/main/java/com/kpstv/youtube/AppNotify.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private void createNotificationChannel() {
NotificationChannel serviceChannel = new NotificationChannel(
CHANNEL_ID,
"Download Service",
NotificationManager.IMPORTANCE_DEFAULT
NotificationManager.IMPORTANCE_LOW
);

appnotification = getSystemService(NotificationManager.class);
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/kpstv/youtube/AppSettings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.kpstv.youtube;

public interface AppSettings {

String[] API_KEYS = new String[] {"AIzaSyBKUnDjZNxv6IBhYFyBu1cljknxWGUp8G4", "AIzaSyBYunDr6xBmBAgyQx7IW2qc770aoYBidLw",
"AIzaSyD08d2HpnaI-rmG2tPCNe47pmWy8JO4nLE", "AIzaSyDXyxER9FUQl_-u3FP9UmWZZiUAIKJHmds", "AIzaSyDbI1ytysYuJ5BW1CQD-LHx73IkZP7Dw0M",
"AIzaSyBH8szUCt1ctKQabVeQuvWgowaKxHVjn8E", "AIzaSyC-EThrmAJkdULIwp73BpnwsQKr1T4mvrM"};

}

Empty file modified app/src/main/java/com/kpstv/youtube/Backup.java
100644 → 100755
Empty file.
Empty file modified app/src/main/java/com/kpstv/youtube/CPlaylistActivity.java
100644 → 100755
Empty file.
Empty file modified app/src/main/java/com/kpstv/youtube/Dialogs/FileSaveDialog.java
100644 → 100755
Empty file.
115 changes: 105 additions & 10 deletions app/src/main/java/com/kpstv/youtube/DownloadActivity.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
package com.kpstv.youtube;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.constraint.ConstraintLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.TextView;

import com.github.hiteshsondhi88.libffmpeg.Util;
import com.kpstv.youtube.adapters.DownloadAdapter;
import com.kpstv.youtube.receivers.SongBroadCast;
import com.kpstv.youtube.services.DownloadService;
import com.kpstv.youtube.utils.YTutils;
import com.mikhaellopez.circularprogressbar.CircularProgressBar;

import static com.kpstv.youtube.services.DownloadService.downloadTask;
import static com.kpstv.youtube.services.DownloadService.process;

public class DownloadActivity extends AppCompatActivity {

private static final String TAG = "DownloadActivity";
RecyclerView recyclerView;
LinearLayoutManager manager;
CircularProgressBar currentProgress;
ImageView currentImageView, moreButton;
TextView txtTitle, txtSize, txtPercent,pendingText;
DownloadAdapter adapter; int total;
Context context;

TextView txtTitle, txtSize, txtPercent,pendingText,currentText;
DownloadAdapter adapter; ConstraintLayout itemConstraint;
LinearLayout emptyLayout;
Context context; int lastJobUpdate;
Handler mHandler = new Handler();

@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -43,6 +59,9 @@ protected void onCreate(Bundle savedInstanceState) {

context = DownloadActivity.this;

currentText = findViewById(R.id.currentText);
itemConstraint = findViewById(R.id.item_constraint);
emptyLayout = findViewById(R.id.emptyLayout);
recyclerView = findViewById(R.id.recyclerView);
manager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(manager);
Expand All @@ -56,15 +75,82 @@ protected void onCreate(Bundle savedInstanceState) {
txtSize = findViewById(R.id.DSizeText);

if (DownloadService.currentModel !=null) {

int accentColor = ContextCompat.getColor(this,R.color.colorAccent);

PopupMenu popupMenu = new PopupMenu(context,moreButton);
popupMenu.inflate(R.menu.service_menu);
popupMenu.setOnMenuItemClickListener(menuItem -> {
switch (menuItem.getItemId()) {
case R.id.cancel_action:
if (DownloadService.pendingJobs.size()<=0)
{
Intent newintent = new Intent(context, SongBroadCast.class);
newintent.setAction("com.kpstv.youtube.STOP_SERVICE");

PendingIntent stopservicePending =
PendingIntent.getBroadcast(context, 5, newintent, 0);

try {
stopservicePending.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}

return true;
}
if (downloadTask.getStatus()== AsyncTask.Status.RUNNING)
{
Log.e(TAG, "onCreate: Cancelling current task");
downloadTask.cancel(true);
}
if (!Util.isProcessCompleted(DownloadService.process))
{
Log.e(TAG, "onCreate: Destroying process" );
process.destroy();
}
DownloadService.currentsize=0;
DownloadService.totalsize=0;
DownloadService.progress=0;
break;
}
return true;
});

moreButton.setOnTouchListener((v, motionEvent) -> {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
ImageView view = (ImageView ) v;
view.setColorFilter(accentColor);
v.invalidate();
break;
}
case MotionEvent.ACTION_UP:

if (DownloadService.currentModel==null)
return false;

popupMenu.show();

case MotionEvent.ACTION_CANCEL: {
ImageView view = (ImageView) v;
view.clearColorFilter();
view.invalidate();
break;
}
}
return true;
});

runTask();
lastJobUpdate = DownloadService.pendingJobs.size();
adapter = new DownloadAdapter(DownloadService.pendingJobs,this);
recyclerView.setAdapter(adapter);
mHandler.postDelayed(mUpdateTimeTask, 1000);
}else finish();
}

void runTask() {
total = DownloadService.pendingJobs.size();
if (DownloadService.currentModel !=null) {
txtTitle.setText(DownloadService.currentModel.getTitle()+" - "+DownloadService.currentModel.getChannelTitle());
switch (DownloadService.currentModel.getTaskExtra()) {
Expand Down Expand Up @@ -92,7 +178,7 @@ void runTask() {

txtSize.setText(String.format("%s / %s", currentSize, totalSIze));

if (DownloadService.pendingJobs.size()<=0)
if (DownloadService.pendingJobs.size() <= 0)
{
recyclerView.setVisibility(View.GONE);
pendingText.setVisibility(View.GONE);
Expand All @@ -103,20 +189,29 @@ void runTask() {
pendingText.setText("Pending");
}

if (total != DownloadService.pendingJobs.size()) {
if(adapter!=null && (DownloadService.pendingJobs.size() != lastJobUpdate))
{
adapter.notifyDataSetChanged();
lastJobUpdate = DownloadService.pendingJobs.size();
}
/*if (adapter!=null && (DownloadService.pendingJobs.size() != adapter.getItemCount())) {
Log.e(TAG, "runTask: Need to change the data");
adapter.notifyDataSetChanged();
}*/
}
}

public Runnable mUpdateTimeTask = new Runnable() {
public void run() {
total = DownloadService.pendingJobs.size();
if (DownloadService.currentModel !=null) {
runTask();
mHandler.postDelayed(this,1000);
}else {
finish();
emptyLayout.setVisibility(View.VISIBLE);
itemConstraint.setVisibility(View.GONE);
pendingText.setVisibility(View.GONE);
recyclerView.setVisibility(View.GONE);
currentText.setVisibility(View.GONE);
}
}
};
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/kpstv/youtube/ErrorActivity.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -72,6 +73,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
if (!editText.getText().toString().isEmpty()) {
message = editText.getText().toString()+"\n\n";
}
message += "------ Device Info ------\nModel: "+ Build.MODEL+"\nProduct: "+ Build.PRODUCT+"\nHardware: "+Build.HARDWARE+"\n" +
"Android SDK: "+Build.VERSION.SDK_INT+"\n\n";
if (sendLogs.isChecked())
message += "------ StackTrace ------\n"+"<pre>"+crashDetails+"</pre>";
try {
Expand Down
Empty file modified app/src/main/java/com/kpstv/youtube/HistoryBottomSheet.java
100644 → 100755
Empty file.
Empty file modified app/src/main/java/com/kpstv/youtube/IntroActivity.java
100644 → 100755
Empty file.
Loading

0 comments on commit 8aaafd4

Please sign in to comment.