From 6f6c1704d482276e1e96c4bdac228af242a19dec Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Tue, 24 May 2016 14:06:49 +0200 Subject: [PATCH] add downloads menu item --- .../main/java/org/schabi/newpipe/VideoItemListActivity.java | 5 +++++ .../java/org/schabi/newpipe/download/DownloadDialog.java | 1 + .../main/java/org/schabi/newpipe/download/MainActivity.java | 2 -- app/src/main/res/menu/videoitem_list.xml | 4 ++++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index 66b19d114..054376d69 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -18,6 +18,7 @@ import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Toast; +import org.schabi.newpipe.download.MainActivity; import org.schabi.newpipe.extractor.ExtractionException; import org.schabi.newpipe.extractor.SearchEngine; import org.schabi.newpipe.extractor.ServiceList; @@ -366,6 +367,10 @@ public class VideoItemListActivity extends AppCompatActivity "user_report", R.string.user_report)); return true; } + case R.id.action_show_downloads: { + //todo: implement this + return true; + } default: return videoFragment.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 526eaba6f..b9c5a7439 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -217,6 +217,7 @@ public class DownloadDialog extends DialogFragment { String fName = name.getText().toString().trim(); + // todo: add timeout? would be bad if the thread gets locked dueto this. while (mBinder == null); if(audio.isChecked()){ diff --git a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java index e7e025701..52da105e5 100644 --- a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java @@ -58,7 +58,6 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte private static final String TAG = MainActivity.class.toString(); - private Menu menu = null; private MissionsFragment mFragment; private DownloadManager mManager; @@ -242,7 +241,6 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); - this.menu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.download_menu, menu); diff --git a/app/src/main/res/menu/videoitem_list.xml b/app/src/main/res/menu/videoitem_list.xml index 8091e8c46..8be1c5a4c 100644 --- a/app/src/main/res/menu/videoitem_list.xml +++ b/app/src/main/res/menu/videoitem_list.xml @@ -11,6 +11,10 @@ app:showAsAction="never" android:title="@string/settings"/> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c3e0fc12f..8eddb14e1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -79,6 +79,7 @@ Show age restricted content Video is Age restricted. Enable age restricted videos in the settings first. live + Downloads Error