From 2489c6c32998d33bd9af0f0f6161a975751cb606 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 21 Sep 2015 01:10:11 +0200 Subject: [PATCH] Some smaller UI changes and else: - added play video button for better lefthand support - wrote codepart to darkon5s listitem improvements - set minimum api level to 15 (Android 4.0.3 support) - updated to sdk level 23 including the new support libs --- app/app.iml | 18 +- app/build.gradle | 13 +- .../org/schabi/newpipe/VideoInfoItem.java | 1 + .../newpipe/VideoItemDetailFragment.java | 35 ++- .../org/schabi/newpipe/VideoListAdapter.java | 6 +- .../newpipe/youtube/YoutubeSearchEngine.java | 3 + .../layout-land/fragment_videoitem_detail.xml | 248 ++++++++++-------- .../res/layout/fragment_videoitem_detail.xml | 240 +++++++++-------- app/src/main/res/layout/video_item.xml | 8 +- app/src/main/res/values-de/strings.xml | 2 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-sr/strings.xml | 1 + app/src/main/res/values-v21/styles.xml | 5 +- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 4 +- app/src/main/res/values/styles.xml | 4 +- app/src/main/res/xml/settings_screen.xml | 5 + build.gradle | 2 +- 20 files changed, 347 insertions(+), 252 deletions(-) diff --git a/app/app.iml b/app/app.iml index 243fbdbfa..cf9c27cba 100644 --- a/app/app.iml +++ b/app/app.iml @@ -36,13 +36,13 @@ - + - + @@ -71,8 +71,9 @@ - - + + + @@ -88,12 +89,13 @@ - + - - + - + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 98cea98df..5662b2efc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { applicationId "org.schabi.newpipe" - minSdkVersion 16 - targetSdkVersion 22 + minSdkVersion 15 + targetSdkVersion 23 versionCode 2 versionName "0.3.5" } @@ -21,8 +21,9 @@ android { dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:appcompat-v7:22.2.1' - compile 'com.android.support:support-v4:22.2.1' + compile 'com.android.support:appcompat-v7:23.0.1' + compile 'com.android.support:support-v4:23.0.1' compile 'org.jsoup:jsoup:1.8.3' compile 'org.mozilla:rhino:1.7.7' + compile 'com.android.support:design:23.0.1' } diff --git a/app/src/main/java/org/schabi/newpipe/VideoInfoItem.java b/app/src/main/java/org/schabi/newpipe/VideoInfoItem.java index ed0904a0b..30d304bd7 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoInfoItem.java +++ b/app/src/main/java/org/schabi/newpipe/VideoInfoItem.java @@ -30,4 +30,5 @@ public class VideoInfoItem { public String thumbnail_url = ""; public Bitmap thumbnail = null; public String webpage_url = ""; + public String upload_date = ""; } \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index 9b2afe39d..558bd2569 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -6,6 +6,8 @@ import android.graphics.BitmapFactory; import android.media.Image; import android.os.Bundle; import android.os.Handler; +import android.preference.PreferenceManager; +import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBar; import android.text.Html; @@ -14,9 +16,11 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.GridLayout; import android.widget.ImageView; import android.widget.ListView; import android.widget.ProgressBar; +import android.widget.RelativeLayout; import android.widget.TextView; @@ -159,6 +163,7 @@ public class VideoItemDetailFragment extends Fragment { ImageView thumbsDownPic = (ImageView) a.findViewById(R.id.detailThumbsDownImgView); View textSeperationLine = a.findViewById(R.id.textSeperationLine); + if(textSeperationLine != null) { textSeperationLine.setVisibility(View.VISIBLE); } @@ -202,7 +207,7 @@ public class VideoItemDetailFragment extends Fragment { } ActionBarHandler.getHandler().setStreams(streamList); } - break; + break; case VideoInfo.VIDEO_UNAVAILABLE_GEMA: thumbnailView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.gruese_die_gema_unangebracht)); break; @@ -257,7 +262,31 @@ public class VideoItemDetailFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_videoitem_detail, container, false); - return rootView; } -} + + @Override + public void onActivityCreated(Bundle savedInstanceBundle) { + super.onActivityCreated(savedInstanceBundle); + FloatingActionButton playVideoButton = (FloatingActionButton) getActivity().findViewById(R.id.playVideoButton); + + if(PreferenceManager.getDefaultSharedPreferences(getActivity()) + .getBoolean(getString(R.string.leftHandLayout), false)) { + 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.rightMargin); + playVideoButton.setLayoutParams(layoutParams); + } + + playVideoButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ActionBarHandler.getHandler().playVideo(); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java index 51ca76044..6edda8736 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java @@ -104,6 +104,7 @@ public class VideoListAdapter extends BaseAdapter { holder.itemVideoTitleView = (TextView) convertView.findViewById(R.id.itemVideoTitleView); holder.itemUploaderView = (TextView) convertView.findViewById(R.id.itemUploaderView); holder.itemDurationView = (TextView) convertView.findViewById(R.id.itemDurationView); + holder.itemUploadDateView = (TextView) convertView.findViewById(R.id.itemUploadDateView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); @@ -118,6 +119,7 @@ public class VideoListAdapter extends BaseAdapter { holder.itemVideoTitleView.setText(videoList.get(position).title); holder.itemUploaderView.setText(videoList.get(position).uploader); holder.itemDurationView.setText(videoList.get(position).duration); + holder.itemUploadDateView.setText(videoList.get(position).upload_date); if(listView.isItemChecked(position)) { convertView.setBackgroundColor(context.getResources().getColor(R.color.primaryColorYoutube)); @@ -130,6 +132,6 @@ public class VideoListAdapter extends BaseAdapter { private class ViewHolder { public ImageView itemThumbnailView; - public TextView itemVideoTitleView, itemUploaderView, itemDurationView; + public TextView itemVideoTitleView, itemUploaderView, itemDurationView, itemUploadDateView; } -} +} \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java index 2f66ea2ac..395a3d768 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeSearchEngine.java @@ -97,6 +97,9 @@ public class YoutubeSearchEngine implements SearchEngine { resultItem.uploader = item.select("div[class=\"yt-lockup-byline\"]").first() .select("a").first() .text(); + resultItem.upload_date = item.select("div[class=\"yt-lockup-meta\"]").first() + .select("li").first() + .text(); Element te = item.select("div[class=\"yt-thumb video-thumb\"]").first() .select("img").first(); resultItem.thumbnail_url = te.attr("abs:src"); diff --git a/app/src/main/res/layout-land/fragment_videoitem_detail.xml b/app/src/main/res/layout-land/fragment_videoitem_detail.xml index 2f8eb35dc..b420f96c6 100644 --- a/app/src/main/res/layout-land/fragment_videoitem_detail.xml +++ b/app/src/main/res/layout-land/fragment_videoitem_detail.xml @@ -1,139 +1,159 @@ - + android:layout_height="match_parent"> - + android:textIsSelectable="true"> - + android:padding="16dp"> - + - + - + - + - + - + - + - + - + - + - + - + - + - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_videoitem_detail.xml b/app/src/main/res/layout/fragment_videoitem_detail.xml index 84a9a659a..d58c52b10 100644 --- a/app/src/main/res/layout/fragment_videoitem_detail.xml +++ b/app/src/main/res/layout/fragment_videoitem_detail.xml @@ -1,133 +1,151 @@ - + android:layout_height="match_parent"> - - - + android:layout_height="match_parent"> - + - + - + - + - + - + - + - + - + - + - + - + - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/video_item.xml b/app/src/main/res/layout/video_item.xml index 61988eefa..02b0f5cdb 100644 --- a/app/src/main/res/layout/video_item.xml +++ b/app/src/main/res/layout/video_item.xml @@ -22,6 +22,7 @@ android:paddingTop="4dp" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="@dimen/text_search_title_size" + android:text="title" /> + android:textSize="@dimen/text_search_uploader_size" + android:text="uploader"/> - \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index da39d8f3b..0b05a450d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,3 +1,4 @@ + NewPipe NewPipe @@ -34,4 +35,5 @@ https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore Zeige \"Mit Kodi abspielen\" Option Zeigt eine Option an, über die man Videos mit dem Kodi Mediacenter abspielen kann. + Linkshänder freundliches Layout. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index dc09bbf93..c40c0538a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,3 +1,4 @@ + NewPipe NewPipe diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index a74b6bd7f..bbc194006 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -1,3 +1,4 @@ + NewPipe NewPipe diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index f0e40b832..3bcde793a 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -1,3 +1,4 @@ + Јутјуб цев Јутјуб цев diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index be37c278f..7a7d2adb6 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -1,11 +1,12 @@ - - + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index eaf1f6c18..b444b0725 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,5 +2,6 @@ #dd0000 #bb0000 + #000000 #66000000 \ No newline at end of file diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 5ad6be083..0b104a97c 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -12,4 +12,5 @@ 360p show_play_with_kodi_preference + left_hand_layout \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a971eb68..89b944448 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ + NewPipe NewPipe @@ -34,4 +35,5 @@ https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore Show \"Play with Kodi\" option Displays an option to play a video via Kodi media center. - + Left hand friendly layout. + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8bfa3427f..3789b6867 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,11 +1,11 @@ - - + \ No newline at end of file diff --git a/app/src/main/res/xml/settings_screen.xml b/app/src/main/res/xml/settings_screen.xml index a20d21711..82b50ef38 100644 --- a/app/src/main/res/xml/settings_screen.xml +++ b/app/src/main/res/xml/settings_screen.xml @@ -34,4 +34,9 @@ android:summary="@string/showPlayWithKodiSummary" android:defaultValue="false" /> + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9405f3fd1..1b7886d14 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files