diff --git a/.travis.yml b/.travis.yml index 528b5edd3..fef282d77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,15 @@ language: android android: components: # The BuildTools version used by NewPipe - - build-tools-23.0.1 + - build-tools-23.0.2 # The SDK version used to compile NewPipe - android-23 - + # Additional components - extra-android-support - extra-android-m2repository - + # Emulators - sys-img-armeabi-v7a-android-21 - sys-img-armeabi-v7a-android-19 diff --git a/README.md b/README.md index 987cd4b29..e24c686ca 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,12 @@ Project status: ## Screenshots -[](assets/screenshot_1.png) -[](assets/screenshot_2.png) +[](screenshots/screenshot_1.png) +[](screenshots/screenshot_2.png) +[](screenshots/screenshot_3.png) +[](screenshots/screenshot_4.png) +[](screenshots/screenshot_5.png) +[](screenshots/screenshot_6.png) ## Description diff --git a/app/build.gradle b/app/build.gradle index 324224856..7cede827a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,14 +2,14 @@ apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { applicationId "org.schabi.newpipe" minSdkVersion 15 targetSdkVersion 23 - versionCode 6 - versionName "0.6.0" + versionCode 8 + versionName "0.6.2" } buildTypes { release { @@ -31,6 +31,8 @@ dependencies { compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:design:23.1.1' + compile 'com.android.support:cardview-v7:23.1.1' + compile 'com.android.support:recyclerview-v7:23.1.1' compile 'org.jsoup:jsoup:1.8.3' compile 'org.mozilla:rhino:1.7.7' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9102e261d..5f8db3ab3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ - + git merge @@ -16,7 +16,7 @@ tools:ignore="AllowBackup"> + android:label="@string/app_name"> @@ -25,7 +25,8 @@ + android:label="@string/title_videoitem_detail" + android:theme="@style/AppTheme"> diff --git a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java index 825f69949..d5fea8c3e 100644 --- a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java +++ b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java @@ -56,7 +56,6 @@ public class PlayVideoActivity extends AppCompatActivity { public static final String START_POSITION = "start_position"; private static final long HIDING_DELAY = 3000; - private static final long TAB_HIDING_DELAY = 100; private String videoUrl = ""; diff --git a/app/src/main/java/org/schabi/newpipe/VideoInfo.java b/app/src/main/java/org/schabi/newpipe/VideoInfo.java index c7c051945..89e576aae 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoInfo.java +++ b/app/src/main/java/org/schabi/newpipe/VideoInfo.java @@ -1,7 +1,5 @@ package org.schabi.newpipe; -import android.graphics.Bitmap; - import org.schabi.newpipe.services.AbstractVideoInfo; import java.util.List; @@ -27,11 +25,10 @@ import java.util.List; */ /**Info object for opened videos, ie the video ready to play.*/ +@SuppressWarnings("ALL") public class VideoInfo extends AbstractVideoInfo { - private static final String TAG = VideoInfo.class.toString(); public String uploader_thumbnail_url = ""; - public Bitmap uploader_thumbnail = null; public String description = ""; public VideoStream[] videoStreams = null; public AudioStream[] audioStreams = null; @@ -89,6 +86,7 @@ public class VideoInfo extends AbstractVideoInfo { } } + @SuppressWarnings("unused") public static class AudioStream { public String url = ""; public int format = -1; diff --git a/app/src/main/java/org/schabi/newpipe/VideoInfoItemViewCreator.java b/app/src/main/java/org/schabi/newpipe/VideoInfoItemViewCreator.java index efd752788..c925a40d3 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoInfoItemViewCreator.java +++ b/app/src/main/java/org/schabi/newpipe/VideoInfoItemViewCreator.java @@ -27,8 +27,6 @@ import android.widget.TextView; */ class VideoInfoItemViewCreator { - private static final String TAG = VideoInfoItemViewCreator.class.toString(); - private final LayoutInflater inflater; public VideoInfoItemViewCreator(LayoutInflater inflater) { diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index 84009069a..4290e5c9c 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -7,6 +7,8 @@ import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Point; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; @@ -27,7 +29,6 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; -import android.widget.ScrollView; import android.widget.TextView; import android.view.MenuItem; @@ -84,6 +85,10 @@ public class VideoItemDetailFragment extends Fragment { private VideoInfo currentVideoInfo = null; private boolean showNextVideoItem = false; + private View thumbnailWindowLayout; + private FloatingActionButton playVideoButton; + private final Point initialThumbnailPos = new Point(0, 0); + public interface OnInvokeCreateOptionsMenuListener { void createOptionsMenu(); } @@ -202,7 +207,7 @@ public class VideoItemDetailFragment extends Fragment { VideoInfoItemViewCreator videoItemViewCreator = new VideoInfoItemViewCreator(LayoutInflater.from(getActivity())); - ScrollView contentMainView = (ScrollView) activity.findViewById(R.id.detailMainContent); + RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detailTextContentLayout); ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.detailProgressBar); TextView videoTitleView = (TextView) activity.findViewById(R.id.detailVideoTitleView); TextView uploaderView = (TextView) activity.findViewById(R.id.detailUploaderView); @@ -221,7 +226,8 @@ public class VideoItemDetailFragment extends Fragment { Button nextVideoButton = (Button) activity.findViewById(R.id.detailNextVideoButton); Button similarVideosButton = (Button) activity.findViewById(R.id.detailShowSimilarButton); - contentMainView.setVisibility(View.VISIBLE); + textContentLayout.setVisibility(View.VISIBLE); + playVideoButton.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); if(!showNextVideoItem) { nextVideoRootFrame.setVisibility(View.GONE); @@ -239,9 +245,6 @@ public class VideoItemDetailFragment extends Fragment { viewCountView.setText( String.format( res.getString(R.string.viewCountText), localisedViewCount)); - /*viewCountView.setText(localisedViewCount - + " " + activity.getString(R.string.viewSufix)); */ - thumbsUpView.setText(nf.format(info.like_count)); thumbsDownView.setText(nf.format(info.dislike_count)); @@ -336,6 +339,7 @@ public class VideoItemDetailFragment extends Fragment { activity = (AppCompatActivity) getActivity(); showNextVideoItem = PreferenceManager.getDefaultSharedPreferences(getActivity()) .getBoolean(activity.getString(R.string.showNextVideo), true); + } @Override @@ -354,8 +358,11 @@ public class VideoItemDetailFragment extends Fragment { @Override public void onActivityCreated(Bundle savedInstanceBundle) { super.onActivityCreated(savedInstanceBundle); - FloatingActionButton playVideoButton = - (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton); + Activity a = getActivity(); + playVideoButton = (FloatingActionButton) a.findViewById(R.id.playVideoButton); + thumbnailWindowLayout = a.findViewById(R.id.detailVideoThumbnailWindowLayout); + Button backgroundButton = (Button) + a.findViewById(R.id.detailVideoThumbnailWindowBackgroundButton); // Sometimes when this fragment is not visible it still gets initiated // then we must not try to access objects of this fragment. @@ -373,20 +380,6 @@ public class VideoItemDetailFragment extends Fragment { e.printStackTrace(); } - if (PreferenceManager.getDefaultSharedPreferences(getActivity()) - .getBoolean(getString(R.string.leftHandLayout), false) && checkIfLandscape()) { - RelativeLayout.LayoutParams oldLayout = - (RelativeLayout.LayoutParams) playVideoButton.getLayoutParams(); - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - layoutParams.setMargins(oldLayout.leftMargin, oldLayout.topMargin, - oldLayout.rightMargin, oldLayout.bottomMargin); - playVideoButton.setLayoutParams(layoutParams); - } - playVideoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -394,6 +387,13 @@ public class VideoItemDetailFragment extends Fragment { } }); + backgroundButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + actionBarHandler.playVideo(); + } + }); + Button similarVideosButton = (Button) activity.findViewById(R.id.detailShowSimilarButton); similarVideosButton.setOnClickListener(new View.OnClickListener() { @Override @@ -408,9 +408,32 @@ public class VideoItemDetailFragment extends Fragment { activity.startActivity(intent); } }); + + // todo: Fix this workaround (probably with a better design), so that older android + // versions don't have problems rendering the thumbnail right. + if(Build.VERSION.SDK_INT >= 18) { + ImageView thumbnailView = (ImageView) activity.findViewById(R.id.detailThumbnailView); + thumbnailView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + // This is used to synchronize the thumbnailWindowButton and the playVideoButton + // inside the ScrollView with the actual size of the thumbnail. + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { + RelativeLayout.LayoutParams newWindowLayoutParams = + (RelativeLayout.LayoutParams) thumbnailWindowLayout.getLayoutParams(); + newWindowLayoutParams.height = bottom - top; + thumbnailWindowLayout.setLayoutParams(newWindowLayoutParams); + + //noinspection SuspiciousNameCombination + initialThumbnailPos.set(top, left); + + } + }); + } } } + + /**Returns the java.util.Locale object which corresponds to the locale set in NewPipe's preferences. * Currently not affected by the device's locale.*/ private Locale getPreferredLocale() { @@ -418,7 +441,8 @@ public class VideoItemDetailFragment extends Fragment { String languageKey = getContext().getString(R.string.searchLanguage); //i know the following line defaults languageCode to "en", but java is picky about uninitialised values // Schabi: well lint tels me the value is redundant. I'll suppress it for now. - @SuppressWarnings("UnusedAssignment") String languageCode = "en"; + @SuppressWarnings("UnusedAssignment") + String languageCode = "en"; languageCode = sp.getString(languageKey, "en"); if(languageCode.length() == 2) { diff --git a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java index 6f06430d3..4e35a5a20 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java @@ -33,8 +33,6 @@ import java.util.Vector; */ class VideoListAdapter extends BaseAdapter { - private static final String TAG = VideoListAdapter.class.toString(); - private final Context context; private final VideoInfoItemViewCreator viewCreator; private Vector videoList = new Vector<>(); @@ -44,6 +42,8 @@ class VideoListAdapter extends BaseAdapter { public VideoListAdapter(Context context, VideoItemListFragment videoListFragment) { viewCreator = new VideoInfoItemViewCreator(LayoutInflater.from(context)); this.listView = videoListFragment.getListView(); + this.listView.setDivider(null); + this.listView.setDividerHeight(0); this.context = context; } diff --git a/app/src/main/java/org/schabi/newpipe/services/SearchEngine.java b/app/src/main/java/org/schabi/newpipe/services/SearchEngine.java index 42b0fed6c..98aa42ae5 100644 --- a/app/src/main/java/org/schabi/newpipe/services/SearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/services/SearchEngine.java @@ -25,6 +25,7 @@ import java.util.Vector; * along with NewPipe. If not, see . */ +@SuppressWarnings("ALL") public interface SearchEngine { diff --git a/app/src/main/java/org/schabi/newpipe/services/ServiceList.java b/app/src/main/java/org/schabi/newpipe/services/ServiceList.java index 53bba3ffb..da1b293fb 100644 --- a/app/src/main/java/org/schabi/newpipe/services/ServiceList.java +++ b/app/src/main/java/org/schabi/newpipe/services/ServiceList.java @@ -26,6 +26,8 @@ import org.schabi.newpipe.services.youtube.YoutubeService; /**Provides access to the video streaming services supported by NewPipe. * Currently only Youtube until the API becomes more stable.*/ + +@SuppressWarnings("ALL") public class ServiceList { private static final String TAG = ServiceList.class.toString(); private static final StreamingService[] services = { diff --git a/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java b/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java index 01ff361ef..dfe2e161f 100644 --- a/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/services/VideoExtractor.java @@ -23,6 +23,8 @@ package org.schabi.newpipe.services; import org.schabi.newpipe.VideoInfo; /**Scrapes information from a video streaming service (eg, YouTube).*/ + +@SuppressWarnings("ALL") public abstract class VideoExtractor { protected final String pageUrl; protected VideoInfo videoInfo; diff --git a/app/src/main/res/drawable-nodpi/dummy_thumbnail_dark.png b/app/src/main/res/drawable-nodpi/dummy_thumbnail_dark.png new file mode 100644 index 000000000..7123a6f01 Binary files /dev/null and b/app/src/main/res/drawable-nodpi/dummy_thumbnail_dark.png differ diff --git a/app/src/main/res/drawable-nodpi/thumbs_down.png b/app/src/main/res/drawable-nodpi/thumbs_down.png index 62baa65ac..23c0f0487 100644 Binary files a/app/src/main/res/drawable-nodpi/thumbs_down.png and b/app/src/main/res/drawable-nodpi/thumbs_down.png differ diff --git a/app/src/main/res/drawable-nodpi/thumbs_up.png b/app/src/main/res/drawable-nodpi/thumbs_up.png index 11bf85637..1fdd2293f 100644 Binary files a/app/src/main/res/drawable-nodpi/thumbs_up.png and b/app/src/main/res/drawable-nodpi/thumbs_up.png differ diff --git a/app/src/main/res/layout-land/fragment_videoitem_detail.xml b/app/src/main/res/layout-land/fragment_videoitem_detail.xml deleted file mode 100644 index 02201f9f4..000000000 --- a/app/src/main/res/layout-land/fragment_videoitem_detail.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -