From 74bda719a6224cfae1c307ce860bdafc51634e61 Mon Sep 17 00:00:00 2001
From: TobiGr
Date: Fri, 22 Sep 2017 11:07:10 +0200
Subject: [PATCH 1/9] add themes to license dialog
---
app/src/main/assets/gpl_2.html | 6 +-
app/src/main/assets/mpl2.html | 1 +
.../org/schabi/newpipe/about/License.java | 4 ++
.../schabi/newpipe/about/LicenseFragment.java | 57 ++++++++++++++++---
app/src/main/res/values/colors.xml | 8 ++-
5 files changed, 64 insertions(+), 12 deletions(-)
diff --git a/app/src/main/assets/gpl_2.html b/app/src/main/assets/gpl_2.html
index 37d578a69..0e1b8827e 100644
--- a/app/src/main/assets/gpl_2.html
+++ b/app/src/main/assets/gpl_2.html
@@ -15,9 +15,9 @@ Version 2, June 1991
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
diff --git a/app/src/main/assets/mpl2.html b/app/src/main/assets/mpl2.html
index 5009391a0..5e988a70c 100644
--- a/app/src/main/assets/mpl2.html
+++ b/app/src/main/assets/mpl2.html
@@ -4,6 +4,7 @@
Mozilla Public License, version 2.0
+
Mozilla Public License Version 2.0
1. Definitions
diff --git a/app/src/main/java/org/schabi/newpipe/about/License.java b/app/src/main/java/org/schabi/newpipe/about/License.java
index 312ad5087..e51e1d0f1 100644
--- a/app/src/main/java/org/schabi/newpipe/about/License.java
+++ b/app/src/main/java/org/schabi/newpipe/about/License.java
@@ -50,6 +50,10 @@ public class License implements Parcelable {
public String getAbbreviation() {
return abbreviation;
}
+
+ public String getFilename() {
+ return filename;
+ }
@Override
public int describeContents() {
diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
index 8b0e67d18..42e886d30 100644
--- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
@@ -8,17 +8,15 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
-import android.view.ContextMenu;
-import android.view.LayoutInflater;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
+import android.view.*;
import android.webkit.WebView;
import android.widget.TextView;
import org.schabi.newpipe.R;
+import org.schabi.newpipe.util.ThemeHelper;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
@@ -58,7 +56,26 @@ public class LicenseFragment extends Fragment {
alert.setTitle(license.getName());
WebView wv = new WebView(context);
- wv.loadUrl(license.getContentUri().toString());
+ String licenseContent = "";
+ String webViewData;
+ try {
+ BufferedReader in = new BufferedReader(new InputStreamReader(context.getAssets().open(license.getFilename()), "UTF-8"));
+ String str;
+ while ((str = in.readLine()) != null) {
+ licenseContent += str;
+ }
+ in.close();
+
+ // split the HTML file and insert the stylesheet into the HEAD of the file
+ String[] insert = licenseContent.split("");
+ webViewData = insert[0] + ""
+ + insert[1];
+ } catch (Exception e) {
+ throw new NullPointerException("could not get license file:" + getLicenseStylesheet(context));
+ }
+ wv.loadData(webViewData, "text/html", "utf-8");
+
alert.setView(wv);
alert.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
@@ -69,6 +86,32 @@ public class LicenseFragment extends Fragment {
alert.show();
}
+ public static String getLicenseStylesheet(Context context) {
+ return "body{padding:12px 15px;margin:0;background:#"
+ + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
+ ? R.color.light_license_background_color
+ : R.color.dark_license_background_color)
+ + ";color:#"
+ + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
+ ? R.color.light_license_text_color
+ : R.color.dark_license_text_color) + ";}"
+ + "a[href]{color:#"
+ + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
+ ? R.color.light_youtube_primary_color
+ : R.color.dark_youtube_primary_color) + ";}"
+ + "pre{white-space: pre-wrap;}";
+ }
+
+ /**
+ * Cast R.color to a hexadecimal color value
+ * @param context the context to use
+ * @param color the color number from R.color
+ * @return a six characters long String with hexadecimal RGB values
+ */
+ public static String getHexRGBColor(Context context, int color) {
+ return context.getResources().getString(color).substring(3);
+ }
+
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9f8a41bc5..3008f68ee 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -10,6 +10,8 @@
#48868686
#1fa6a6a6
#5a000000
+ #ffffff
+ #212121
#222222
@@ -20,6 +22,8 @@
#48ffffff
#1f717171
#82000000
+ #424242
+ #ffffff
#000
@@ -37,8 +41,8 @@
#e53935
#fff
- #d6d6d6 d
- #717171 d
+ #d6d6d6
+ #717171
#607D8B
From 0040ee5cb674da9832ea1b85fdee6742d7a82a99 Mon Sep 17 00:00:00 2001
From: TobiGr
Date: Fri, 20 Oct 2017 23:41:30 +0200
Subject: [PATCH 2/9] Fix charset issue. Move Java I/O related methods to
separate thread.
---
.../schabi/newpipe/about/LicenseFragment.java | 73 +-----------
.../newpipe/about/LicenseFragmentHelper.java | 111 ++++++++++++++++++
2 files changed, 112 insertions(+), 72 deletions(-)
create mode 100644 app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.java
diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
index 42e886d30..4400cac53 100644
--- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.java
@@ -1,22 +1,15 @@
package org.schabi.newpipe.about;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import android.support.v7.app.AlertDialog;
import android.view.*;
-import android.webkit.WebView;
import android.widget.TextView;
-
import org.schabi.newpipe.R;
-import org.schabi.newpipe.util.ThemeHelper;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
@@ -46,70 +39,7 @@ public class LicenseFragment extends Fragment {
* @param license the license to show
*/
public static void showLicense(Context context, License license) {
- if(context == null) {
- throw new NullPointerException("context is null");
- }
- if(license == null) {
- throw new NullPointerException("license is null");
- }
- AlertDialog.Builder alert = new AlertDialog.Builder(context);
- alert.setTitle(license.getName());
-
- WebView wv = new WebView(context);
- String licenseContent = "";
- String webViewData;
- try {
- BufferedReader in = new BufferedReader(new InputStreamReader(context.getAssets().open(license.getFilename()), "UTF-8"));
- String str;
- while ((str = in.readLine()) != null) {
- licenseContent += str;
- }
- in.close();
-
- // split the HTML file and insert the stylesheet into the HEAD of the file
- String[] insert = licenseContent.split("");
- webViewData = insert[0] + ""
- + insert[1];
- } catch (Exception e) {
- throw new NullPointerException("could not get license file:" + getLicenseStylesheet(context));
- }
- wv.loadData(webViewData, "text/html", "utf-8");
-
- alert.setView(wv);
- alert.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- }
- });
- alert.show();
- }
-
- public static String getLicenseStylesheet(Context context) {
- return "body{padding:12px 15px;margin:0;background:#"
- + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
- ? R.color.light_license_background_color
- : R.color.dark_license_background_color)
- + ";color:#"
- + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
- ? R.color.light_license_text_color
- : R.color.dark_license_text_color) + ";}"
- + "a[href]{color:#"
- + getHexRGBColor(context,(ThemeHelper.isLightThemeSelected(context))
- ? R.color.light_youtube_primary_color
- : R.color.dark_youtube_primary_color) + ";}"
- + "pre{white-space: pre-wrap;}";
- }
-
- /**
- * Cast R.color to a hexadecimal color value
- * @param context the context to use
- * @param color the color number from R.color
- * @return a six characters long String with hexadecimal RGB values
- */
- public static String getHexRGBColor(Context context, int color) {
- return context.getResources().getString(color).substring(3);
+ new LicenseFragmentHelper().execute(context, license);
}
@Override
@@ -154,7 +84,6 @@ public class LicenseFragment extends Fragment {
});
softwareComponentsView.addView(componentView);
registerForContextMenu(componentView);
-
}
return rootView;
}
diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.java b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.java
new file mode 100644
index 000000000..726e97ec2
--- /dev/null
+++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.java
@@ -0,0 +1,111 @@
+package org.schabi.newpipe.about;
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.support.v7.app.AlertDialog;
+import android.webkit.WebView;
+import org.schabi.newpipe.R;
+import org.schabi.newpipe.util.ThemeHelper;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+public class LicenseFragmentHelper extends AsyncTask {
+
+ private Context context;
+ private License license;
+
+ @Override
+ protected Integer doInBackground(Object... objects) {
+ context = (Context) objects[0];
+ license = (License) objects[1];
+ return 1;
+ }
+
+ @Override
+ protected void onPostExecute(Integer result){
+ String webViewData = getFormattedLicense(context, license);
+ AlertDialog.Builder alert = new AlertDialog.Builder(context);
+ alert.setTitle(license.getName());
+
+ WebView wv = new WebView(context);
+ wv.loadData(webViewData, "text/html; charset=UTF-8", null);
+
+ alert.setView(wv);
+ alert.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ });
+ alert.show();
+ }
+
+ /**
+ * @param context the context to use
+ * @param license the license
+ * @return String which contains a HTML formatted license page styled according to the context's theme
+ */
+ public static String getFormattedLicense(Context context, License license) {
+ if(context == null) {
+ throw new NullPointerException("context is null");
+ }
+ if(license == null) {
+ throw new NullPointerException("license is null");
+ }
+
+ String licenseContent = "";
+ String webViewData;
+ try {
+ BufferedReader in = new BufferedReader(new InputStreamReader(context.getAssets().open(license.getFilename()), "UTF-8"));
+ String str;
+ while ((str = in.readLine()) != null) {
+ licenseContent += str;
+ }
+ in.close();
+
+ // split the HTML file and insert the stylesheet into the HEAD of the file
+ String[] insert = licenseContent.split("");
+ webViewData = insert[0] + ""
+ + insert[1];
+ } catch (Exception e) {
+ throw new NullPointerException("could not get license file:" + getLicenseStylesheet(context));
+ }
+ return webViewData;
+ }
+
+ /**
+ *
+ * @param context
+ * @return String which is a CSS stylesheet according to the context's theme
+ */
+ public static String getLicenseStylesheet(Context context) {
+ boolean isLightTheme = ThemeHelper.isLightThemeSelected(context);
+ return "body{padding:12px 15px;margin:0;background:#"
+ + getHexRGBColor(context, isLightTheme
+ ? R.color.light_license_background_color
+ : R.color.dark_license_background_color)
+ + ";color:#"
+ + getHexRGBColor(context, isLightTheme
+ ? R.color.light_license_text_color
+ : R.color.dark_license_text_color) + ";}"
+ + "a[href]{color:#"
+ + getHexRGBColor(context, isLightTheme
+ ? R.color.light_youtube_primary_color
+ : R.color.dark_youtube_primary_color) + ";}"
+ + "pre{white-space: pre-wrap;}";
+ }
+
+ /**
+ * Cast R.color to a hexadecimal color value
+ * @param context the context to use
+ * @param color the color number from R.color
+ * @return a six characters long String with hexadecimal RGB values
+ */
+ public static String getHexRGBColor(Context context, int color) {
+ return context.getResources().getString(color).substring(3);
+ }
+
+}
From 9a073713bb715e13d4bdf706048354bb62f37e23 Mon Sep 17 00:00:00 2001
From: Christian Schabesberger
Date: Wed, 25 Oct 2017 15:20:57 +0200
Subject: [PATCH 3/9] put tabs on top
---
.../fragments/list/feed/FeedFragment.java | 2 +-
.../subscription/SubscriptionFragment.java | 1 +
app/src/main/res/layout/fragment_blank.xml | 6 +
app/src/main/res/layout/fragment_channel.xml | 6 +
app/src/main/res/layout/fragment_feed.xml | 6 +
app/src/main/res/layout/fragment_kiosk.xml | 7 +
app/src/main/res/layout/fragment_main.xml | 5 +-
app/src/main/res/layout/fragment_playlist.xml | 6 +
app/src/main/res/layout/fragment_search.xml | 6 +
.../main/res/layout/fragment_subscription.xml | 6 +
.../main/res/layout/fragment_video_detail.xml | 682 +++++++++---------
app/src/main/res/layout/toolbar_layout.xml | 5 -
12 files changed, 395 insertions(+), 343 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/feed/FeedFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/feed/FeedFragment.java
index 379ec591a..835647eec 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/list/feed/FeedFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/list/feed/FeedFragment.java
@@ -121,7 +121,7 @@ public class FeedFragment extends BaseListFragment, Voi
}
if(useAsFrontPage) {
- supportActionBar.setDisplayHomeAsUpEnabled(false);
+ supportActionBar.setDisplayShowTitleEnabled(true);
//supportActionBar.setDisplayShowTitleEnabled(false);
}
}
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
index afb2f078e..3ff56a163 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
@@ -62,6 +62,7 @@ public class SubscriptionFragment extends BaseStateFragment
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_channel.xml b/app/src/main/res/layout/fragment_channel.xml
index 460f95a7a..67691fc81 100644
--- a/app/src/main/res/layout/fragment_channel.xml
+++ b/app/src/main/res/layout/fragment_channel.xml
@@ -62,4 +62,10 @@
android:visibility="gone"
tools:visibility="visible"/>
+
+
diff --git a/app/src/main/res/layout/fragment_feed.xml b/app/src/main/res/layout/fragment_feed.xml
index 0f2d0b675..0868d8233 100644
--- a/app/src/main/res/layout/fragment_feed.xml
+++ b/app/src/main/res/layout/fragment_feed.xml
@@ -34,4 +34,10 @@
android:visibility="gone"
tools:visibility="visible"/>
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_kiosk.xml b/app/src/main/res/layout/fragment_kiosk.xml
index a85c30cb1..4730e66c8 100644
--- a/app/src/main/res/layout/fragment_kiosk.xml
+++ b/app/src/main/res/layout/fragment_kiosk.xml
@@ -4,6 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
index dac5478ff..b1dd3e20b 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -10,13 +10,14 @@
android:id="@+id/main_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
+ android:layout_alignParentTop="true"
+ android:background="@color/dark_youtube_primary_color"
app:tabGravity="fill"/>
+ android:layout_below="@id/main_tab_layout"/>
diff --git a/app/src/main/res/layout/fragment_playlist.xml b/app/src/main/res/layout/fragment_playlist.xml
index d5ef26a63..37c609fa4 100644
--- a/app/src/main/res/layout/fragment_playlist.xml
+++ b/app/src/main/res/layout/fragment_playlist.xml
@@ -62,4 +62,10 @@
android:visibility="gone"
tools:visibility="visible"/>
+
+
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml
index 04b10347c..d49d23175 100644
--- a/app/src/main/res/layout/fragment_search.xml
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -81,4 +81,10 @@
android:visibility="gone"
tools:visibility="visible"/>
+
+
diff --git a/app/src/main/res/layout/fragment_subscription.xml b/app/src/main/res/layout/fragment_subscription.xml
index 35cfbfeb7..e0d0348dc 100644
--- a/app/src/main/res/layout/fragment_subscription.xml
+++ b/app/src/main/res/layout/fragment_subscription.xml
@@ -35,4 +35,10 @@
android:visibility="gone"
tools:visibility="visible"/>
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml
index 0d87809fc..b067db7bc 100644
--- a/app/src/main/res/layout/fragment_video_detail.xml
+++ b/app/src/main/res/layout/fragment_video_detail.xml
@@ -1,345 +1,308 @@
-
-
-
+
+ android:focusableInTouchMode="true">
-
-
+ android:layout_height="match_parent"
+ android:visibility="visible"
+ app:parallax_factor="1.9">
-
-
+
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
+
-
-
+ android:foreground="?attr/selectableItemBackground">
+ android:id="@+id/detail_thumbnail_image_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/transparent"
+ android:contentDescription="@string/detail_thumbnail_view_description"
+ android:scaleType="centerCrop"
+ tools:ignore="RtlHardcoded"
+ tools:layout_height="200dp"
+ tools:src="@drawable/dummy_thumbnail"/>
+
+
-
-
-
-
-
-
-
-
+
+ android:background="?android:windowBackground">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+ android:paddingRight="12dp">
+ tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum. Nunc eleifend est quis ipsum porttitor egestas. Sed facilisis, nisl quis eleifend pellentesque, orci metus egestas dolor, at accumsan eros metus quis libero."/>
-
-
+ android:layout_marginLeft="5dp"
+ android:src="@drawable/arrow_down"
+ tools:ignore="ContentDescription,RtlHardcoded"/>
-
+
-
-
+
+
+
+
+
+
+
-
+
+ android:layout_marginTop="6dp"
+ android:baselineAligned="false"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:background="?attr/selectableItemBackground"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingBottom="8dp"
+ android:paddingLeft="12dp"
+ android:paddingRight="12dp"
+ android:paddingTop="8dp">
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
+ android:layout_marginTop="5dp"
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/toolbar_layout.xml b/app/src/main/res/layout/toolbar_layout.xml
index 36ab6454e..096974c03 100644
--- a/app/src/main/res/layout/toolbar_layout.xml
+++ b/app/src/main/res/layout/toolbar_layout.xml
@@ -36,9 +36,4 @@
-
-
\ No newline at end of file
From 4c4cfb49b47cf6eb84b486b43c30ec1935348c34 Mon Sep 17 00:00:00 2001
From: Christian Schabesberger
Date: Wed, 25 Oct 2017 16:09:26 +0200
Subject: [PATCH 4/9] make tabs contain icons instead of title
---
.../schabi/newpipe/fragments/MainFragment.java | 12 +++++++++++-
.../subscription/SubscriptionFragment.java | 1 -
.../res/drawable-hdpi/ic_channel_white_24dp.png | Bin 0 -> 398 bytes
.../res/drawable-hdpi/ic_whatshot_white_24dp.png | Bin 0 -> 468 bytes
.../res/drawable-mdpi/ic_channel_white_24dp.png | Bin 0 -> 304 bytes
.../res/drawable-mdpi/ic_whatshot_white_24dp.png | Bin 0 -> 334 bytes
.../res/drawable-xhdpi/ic_channel_white_24dp.png | Bin 0 -> 468 bytes
.../drawable-xhdpi/ic_whatshot_white_24dp.png | Bin 0 -> 595 bytes
.../drawable-xxhdpi/ic_channel_white_24dp.png | Bin 0 -> 739 bytes
.../drawable-xxhdpi/ic_whatshot_white_24dp.png | Bin 0 -> 866 bytes
.../drawable-xxxhdpi/ic_channel_white_24dp.png | Bin 0 -> 633 bytes
.../drawable-xxxhdpi/ic_whatshot_white_24dp.png | Bin 0 -> 1129 bytes
12 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 app/src/main/res/drawable-hdpi/ic_channel_white_24dp.png
create mode 100644 app/src/main/res/drawable-hdpi/ic_whatshot_white_24dp.png
create mode 100644 app/src/main/res/drawable-mdpi/ic_channel_white_24dp.png
create mode 100644 app/src/main/res/drawable-mdpi/ic_whatshot_white_24dp.png
create mode 100644 app/src/main/res/drawable-xhdpi/ic_channel_white_24dp.png
create mode 100644 app/src/main/res/drawable-xhdpi/ic_whatshot_white_24dp.png
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_channel_white_24dp.png
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_whatshot_white_24dp.png
create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_channel_white_24dp.png
create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
index 317630faa..42f52431e 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
@@ -84,6 +84,15 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
viewPager.setOffscreenPageLimit(adapter.getCount());
tabLayout.setupWithViewPager(viewPager);
+
+ if(PreferenceManager.getDefaultSharedPreferences(getActivity())
+ .getString(getString(R.string.main_page_content_key), getString(R.string.blank_page_key))
+ .equals(getString(R.string.subscription_page_key))) {
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_white_24dp);
+ } else {
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_white_24dp);
+ tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_white_24dp);
+ }
}
/*//////////////////////////////////////////////////////////////////////////
@@ -171,7 +180,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
@Override
public CharSequence getPageTitle(int position) {
- return getString(this.tabTitles[position]);
+ //return getString(this.tabTitles[position]);
+ return "";
}
@Override
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
index 3ff56a163..afb2f078e 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
@@ -62,7 +62,6 @@ public class SubscriptionFragment extends BaseStateFragmentn;!$1&*;dh)(f!siq0+~ZlBH#{)`w)j?Q1Ejfej4sTiHHIe@%p1MjzWkQdlw-D
z(^$5p$K%0+6RWZtRsmP%lj
zsm_cJbt|u!sCB1n+a
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-hdpi/ic_whatshot_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..46ed1f8b67db8c34ee5ec652fab79b36ef42a684
GIT binary patch
literal 468
zcmV;_0W1EAP)5Q+*74bf0x&=Nt=AV`E`P;rr%
zjXDH^f>SO>Q6R;g4&L4KeM_!?|GRhZ|K5wMtQ@v7FkaE7-?&cDjH2)q>kD@n<{Vd9q~507XyO~ue0DK<<-#Cw
zCU}8yO)lIf$`%=kNsK3Q;Uz9x+@)PVaRFmVE^JV5g&8i=q+d9W@lh^(r`87s6hI22
zAQwthTc=ea@Tu_RLWyc)3PB2^C>K6q`LrkmXEAbe;Vo8Kp}2>Ul?ykic2adXN*-fM
zF7&X6^*{kMvxMQ1mK)EpJjPUoW4yzlnj?B;F2e!iUQ07sBGET*?k!xiBhgQF7;_
zt=D(V3|Lkn8~1QgbnsNeRQ3b2B&YAn+7hJYof5_7X|_XU=^;)Qi_=_;*MF9LG(5Cm
zWxP+&4wdcRQj?TrYOC2r(`AdU+*5S4xO15Mt#f>#%8DJA9SS;b2e&jDED~?tC;#ia
vey!RkT_w&;2fdy;+f2DTzqbCAddycI&vNIBYtmVuXBa$P{an^LB{Ts5C^vIp
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-mdpi/ic_whatshot_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..4cf6f85f83b9b993773a899637777e081a897e0b
GIT binary patch
literal 334
zcmV-U0kQsxP)PLcWj2anrF;5%c2NSX}hp$76Tfz#mu|gK@oGFANh9etScs3QnAx2X+cJOQ~
zfN9<_O0tp1#kgl&J&bXV;gVB7s(2dAGQuPUZt#>9g%rm`IU=cOq^RN&)VR$jk6L2xJaZ4ns%n0LBXC)U?y|U
z+~2uyz#oSmm2ce7H}7wwzf>W0Qz)0T)Wtp$x7`vo{nfrs>W~OT51_m65;gsGs8HXx
zC2IPcklECbh(HgZhe|@Zq{5qC0}VA%D9rS%L7RT8&=@x)G*k?X01QAA`Vsof%=%vf
zs#eSbB}9WSiQO*$iGWOzEf5IBchN2)iRa&^I`b27ssp8z2m_2GQs!2;)iw|991>Z51df-u$x84
zRV}Qg=!mL?ITq#UQgx7_XqI)V25#}o1T|WIT&CohmV$aVD-uJLd}h7kW0*cg;u5B-
zii{AFj`GhG)tK2YzpT`0D(7-A3_zlPvjXWplF8f(cEzRs;koN>lk&rvu
z$P&jaEsBQ@vbdUMlj5U|XSkT6MN2~i=gCt^jsX(-6SR@WBaFugty&JO(@+%0@$YfnCcp+Oup_~S#0D#fH>lKsg#m<+U}HdmSD`O}#Q!&dQiM=c2^LmF
z2c!=9N8%qtY}rm+;>5A91wI)ZC6Vt(=iGDeO#)3c(L}96Pt;lJ^Bp}dlk-%P@{`n&
zBt0sNv#EDdep1Mhp35tX)Xq;zaJI@UT3c`PkSgMYq&JI56>{>BD&{OAIp6@OrPo;`
zN1TxKYL?`X6OvvgNsc)o=|w~;fuj?8s81TG${1*057f@$oY#R|MOWt{heg?8p9>C;
z5nV3Z5Fpz2?mFebMeagZg$d2~zxyS%nM7+_)Y!iw4wy9D#)D
zmm!&~UL_Nfsb+IXm^SMGGAvx>#YAUyX6CN(qw+2@0)Aj>D}F`c)l0ya-BaSoIeknh
zzS{KqaXyQ-+_)=luE(h-9C5lnn`?k*^OIdiU6xUffB=uHyyyDLH(kAChDVUB-h?qj
z2J{&)dId7`
zw>`w=UbfzYwO_1Y>p$iDtfOY`LFN5G(tMR}K>r*l>at<{qo?FV(obio>pV5xG-%g3
z=vn$a)MAfI4mqE>VxvTcY{(71ION=%a?<-{OZT;>UZwv7_4Gmaoc-a~L=*pI`~fV*
V9>c$)0PO$(002ovPDHLkV1jjtSHA!N
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-xxhdpi/ic_whatshot_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..8eaf3755da5295bbe800e7022c2db30d17f680f6
GIT binary patch
literal 866
zcmV-o1D*VdP)7r0tpIELMaN&@wqXVwGqKn-Kqw3Fc(-sVUA4Js=7Sr{7>1#2m?Fj^D^
zEyVXdHt#D6J|?bjNi&Wqt0)*Io-@=*oWQ15p}2u~j&ZI2K|40v6pGzMH_9IUhwa!r
zrcgXjG*fhNz5YiUn@)w|J;MFMbEI_zMltm$6kiZxkWTJknJoAk(^m?`5BT_Qg9Q$K_=O;5zb{x)h3LT%J_`
z_F&VbP&DB3k^=B0rXqC;$0_W3d=hUbu=uY%+?1HB4gHEH89plcQGA
z@EUemR;nzX!mdM6v5p*eM^zHbIEdW@4T_F-Tn@8b4y>mSmo~*ginF-%vqc8dyvPJD
zr>RjqY+?eJ0w;KgO{^qEn%l^5oQt@P)2R5^MSb*`Z|6N)lR>99k(5N1hfXi=F&M
zRO9SW^4Q2XL~)u%Eeui|AV-J^+NjY&VlACa;v+`~4O$GW;c-q<#HGjp8EUn-sOLet
s=wpZxrkQ4hA^PZ|i8?J=vZQML4Wq^#!k7$FxBvhE07*qoM6N<$f@DjJI{*Lx
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_channel_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_channel_white_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..9384592d6aada1745b649ff14a9bd93b13119605
GIT binary patch
literal 633
zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%xcgn3BBRT^Rni_n+Ah4nJ
za0`PlBg3pY5H=O_J>@Oyb2bFjdNpwnz%e&978H@y}jk{cgR74^#l9A=H76F
zygNd|jwxxmyo!fc~Ula*WC4&INvL)2weL1
z*XnZFGLe9lAzD{;!Vl&aZgXJa)8??d&nFlY*RFC>;p-4@uS@u(V6862Gn>+2;RtL%O8y^$I
zD!bX@+T*(>%J=Q<;D7T-!$>{t#`pJoW}Xy&eK=V$r;&Mmp6eU+-2r!3@7Da9A};mh
z-I1Tcya8Rz8P&%%n(OS1;xB%;E@t9TXkdU4H++n2*aKoc7#LXu91ujqmTavb_n5v&
zKlr<(?p*l+Be7+LUK?&dk$U#w-+zX`{%g2r0u3;@-SBh0fBr`Hc{5($X-?t(vgg*v
zyDATEX*;M}PFeB5uKaNO$HQG*a*uUCG!*B5`~T9wZl7&c%puh>+m8C?y@Bk8AG+Ai
z71e!H^jq}N@X^QLT;BqZYfUREfAnTi^XCnpdzfE%>402n;N8G~wop%c^5vIyz=Xo!
M>FVdQ&MBb@06@0`-T(jq
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c5d86873cce687891517d459d778b4b840d38c4
GIT binary patch
literal 1129
zcmV-v1eW`WP)Z*MU8R+!PP3YYb2E=S+pnxf>h`>!&wJ)e=ene<{}H+?-gt{5#Tl!Q-KusDXz%pqBQdqR~+J^79LeRv5{5_6h|zgRWq{{KitlLnwYA%p%<5G;AX`Q
zr?}J!1}I+mgv;%ttKx)pTxp%+gy(2$zT$(qwDkug6&FmQJyql=9vDUYmMR_?O#7M`
zqfBC;0-+Zsdr2r$=)(>LLJ!PJl^G=2&3*+!FU(GpuT0y7{e{;stCkH^W8bIr)8CkZS&B{yi!P+F
zE6p-;^e+bCq)1^g3cD&9qsvf-+1(0@nb=dq47I_>m@QIREWw5rKI9$}Y6ojDTdA;E
zPgn3qU=?l#DIofj!mM02a2sx>
zD@s6eJUPvNYQ-tvtCPU2*-Y~fnY;%tR{q8pVsIYSTG!^=2p
z;uiTpH+JEyOg7Pz(>VKqzVe7dDslD;d9sT~aC3m`%riBd*Q@fbJdM@Cuo+3qqxp>jcZXRbmy~*Jk`clkX)^Y@|W+^(XCTiu1
z5=pibr7a{BEppjORNkYDqDL;
Date: Wed, 25 Oct 2017 22:00:58 -0700
Subject: [PATCH 5/9] -Added fling mechanic for popup player shutdown. -Changed
long click to fill screen for popup player. -Added 2-finger resizing for
popup player. -Removed long click resize mechanic.
---
.../newpipe/player/PopupVideoPlayer.java | 78 +++++++++++++------
1 file changed, 53 insertions(+), 25 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
index b022cd003..a4087a942 100644
--- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
@@ -92,6 +92,7 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class PopupVideoPlayer extends Service {
private static final String TAG = ".PopupVideoPlayer";
private static final boolean DEBUG = BasePlayer.DEBUG;
+ private static final int SHUTDOWN_FLING_VELOCITY = 10000;
private static final int NOTIFICATION_ID = 40028922;
public static final String ACTION_CLOSE = "org.schabi.newpipe.player.PopupVideoPlayer.CLOSE";
@@ -303,7 +304,6 @@ public class PopupVideoPlayer extends Service {
public void onVideoClose() {
if (DEBUG) Log.d(TAG, "onVideoClose() called");
- savePositionAndSize();
stopSelf();
}
@@ -574,9 +574,7 @@ public class PopupVideoPlayer extends Service {
private int initialPopupX, initialPopupY;
private boolean isMoving;
- private int onDownPopupWidth = 0;
private boolean isResizing;
- private boolean isResizingRightSide;
@Override
public boolean onDoubleTap(MotionEvent e) {
@@ -603,27 +601,20 @@ public class PopupVideoPlayer extends Service {
initialPopupY = windowLayoutParams.y;
popupWidth = windowLayoutParams.width;
popupHeight = windowLayoutParams.height;
- onDownPopupWidth = windowLayoutParams.width;
- return false;
+ return super.onDown(e);
}
@Override
public void onLongPress(MotionEvent e) {
if (DEBUG) Log.d(TAG, "onLongPress() called with: e = [" + e + "]");
- playerImpl.showAndAnimateControl(-1, true);
- playerImpl.getLoadingPanel().setVisibility(View.GONE);
-
- playerImpl.hideControls(0, 0);
- animateView(playerImpl.getCurrentDisplaySeek(), false, 0, 0);
- animateView(playerImpl.getResizingIndicator(), true, 200, 0);
-
- isResizing = true;
- isResizingRightSide = e.getRawX() > windowLayoutParams.x + (windowLayoutParams.width / 2f);
+ updateScreenSize();
+ checkPositionBounds();
+ updatePopupSize((int) screenWidth, -1);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
- if (isResizing) return false;
+ if (isResizing) return super.onScroll(e1, e2, distanceX, distanceY);
if (playerImpl.getCurrentState() != BasePlayer.STATE_BUFFERING
&& (!isMoving || playerImpl.getControlsRoot().getAlpha() != 1f)) playerImpl.showControls(0);
@@ -659,19 +650,33 @@ public class PopupVideoPlayer extends Service {
}
}
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ if (Math.abs(velocityX) > SHUTDOWN_FLING_VELOCITY) {
+ if (DEBUG) Log.d(TAG, "Popup close fling velocity= " + velocityX);
+ onVideoClose();
+ return true;
+ }
+ return false;
+ }
+
@Override
public boolean onTouch(View v, MotionEvent event) {
gestureDetector.onTouchEvent(event);
- if (event.getAction() == MotionEvent.ACTION_MOVE && isResizing && !isMoving) {
- //if (DEBUG) Log.d(TAG, "onTouch() ACTION_MOVE > v = [" + v + "], e1.getRaw = [" + event.getRawX() + ", " + event.getRawY() + "]");
- int width;
- if (isResizingRightSide) width = (int) event.getRawX() - windowLayoutParams.x;
- else {
- width = (int) (windowLayoutParams.width + (windowLayoutParams.x - event.getRawX()));
- if (width > minimumWidth) windowLayoutParams.x = initialPopupX - (width - onDownPopupWidth);
- }
- if (width <= maximumWidth && width >= minimumWidth) updatePopupSize(width, -1);
- return true;
+ if (event.getPointerCount() == 2 && !isResizing) {
+ if (DEBUG) Log.d(TAG, "onTouch() 2 finger pointer detected, enabling resizing.");
+ playerImpl.showAndAnimateControl(-1, true);
+ playerImpl.getLoadingPanel().setVisibility(View.GONE);
+
+ playerImpl.hideControls(0, 0);
+ animateView(playerImpl.getCurrentDisplaySeek(), false, 0, 0);
+ animateView(playerImpl.getResizingIndicator(), true, 200, 0);
+ isResizing = true;
+ }
+
+ if (event.getAction() == MotionEvent.ACTION_MOVE && !isMoving && isResizing) {
+ if (DEBUG) Log.d(TAG, "onTouch() ACTION_MOVE > v = [" + v + "], e1.getRaw = [" + event.getRawX() + ", " + event.getRawY() + "]");
+ return handleMultiDrag(event);
}
if (event.getAction() == MotionEvent.ACTION_UP) {
@@ -692,6 +697,29 @@ public class PopupVideoPlayer extends Service {
return true;
}
+ private boolean handleMultiDrag(final MotionEvent event) {
+ if (event.getPointerCount() != 2) return false;
+
+ final float firstPointerX = event.getX(0);
+ final float secondPointerX = event.getX(1);
+
+ final float diff = Math.abs(firstPointerX - secondPointerX);
+ if (firstPointerX > secondPointerX) {
+ // second pointer is the anchor (the leftmost pointer)
+ windowLayoutParams.x = (int) (event.getRawX() - diff);
+ } else {
+ // first pointer is the anchor
+ windowLayoutParams.x = (int) event.getRawX();
+ }
+
+ checkPositionBounds();
+ updateScreenSize();
+
+ final int width = (int) Math.min(screenWidth, diff);
+ updatePopupSize(width, -1);
+
+ return true;
+ }
}
/**
From 0a2aa54508747e2e2dd9164629594d77515fd2c0 Mon Sep 17 00:00:00 2001
From: TobiGr
Date: Thu, 26 Oct 2017 09:23:43 +0200
Subject: [PATCH 6/9] fix typo
---
.../org/schabi/newpipe/settings/ContentSettingsFragment.java | 4 ++--
.../java/org/schabi/newpipe/settings/SelectKioskFragment.java | 2 +-
app/src/main/res/values-fr/strings.xml | 1 -
app/src/main/res/values-ro/strings.xml | 1 -
app/src/main/res/values/strings.xml | 2 +-
5 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
index 4f6c2d1ae..2cda95987 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java
@@ -50,7 +50,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
getContext());
String summary =
- String.format(getString(R.string.service_kosk_string),
+ String.format(getString(R.string.service_kiosk_string),
serviceName,
kioskName);
@@ -122,7 +122,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
getContext());
String summary =
- String.format(getString(R.string.service_kosk_string),
+ String.format(getString(R.string.service_kiosk_string),
service.getServiceInfo().name,
kioskName);
diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
index a9f0a53ed..9e5420b6e 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/SelectKioskFragment.java
@@ -126,7 +126,7 @@ public class SelectKioskFragment extends DialogFragment {
for(StreamingService service : NewPipe.getServices()) {
for(String kioskId : service.getKioskList().getAvailableKiosks()) {
- String name = String.format(getString(R.string.service_kosk_string),
+ String name = String.format(getString(R.string.service_kiosk_string),
service.getServiceInfo().name,
KioskTranslator.getTranslatedKioskName(kioskId, getContext()));
kioskList.add(new Entry(
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 9f89e07d8..f8de02050 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -257,5 +257,4 @@
Objet effacé
Voulez-vous supprimer cet élément de l\'historique de recherche ?
-%1$s/%2$s
diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml
index bbac3946c..acbc9891a 100644
--- a/app/src/main/res/values-ro/strings.xml
+++ b/app/src/main/res/values-ro/strings.xml
@@ -273,5 +273,4 @@ pentru a deschide în mod pop-up
Trenduri
Top 50
Tendințe
- %1$s/%2$s
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 94b185988..4f06dc4c4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -290,5 +290,5 @@
Trending
Top 50
New & hot
- %1$s/%2$s
+ %1$s/%2$s
From dd64bf2af712e7b8cb07dd967bb14e10d1b93181 Mon Sep 17 00:00:00 2001
From: Christian Schabesberger
Date: Thu, 26 Oct 2017 15:16:35 +0200
Subject: [PATCH 7/9] make title contain current tab
---
.../java/org/schabi/newpipe/MainActivity.java | 1 -
.../newpipe/fragments/BlankFragment.java | 19 +++++++++++++++++++
.../newpipe/fragments/MainFragment.java | 1 -
.../list/channel/ChannelFragment.java | 2 +-
.../fragments/list/kiosk/KioskFragment.java | 17 ++++++++++++++++-
.../subscription/SubscriptionFragment.java | 16 ++++++++++++++++
6 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java
index 3ff55cb76..03b856d31 100644
--- a/app/src/main/java/org/schabi/newpipe/MainActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java
@@ -181,7 +181,6 @@ public class MainActivity extends AppCompatActivity implements HistoryListener {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
- actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
}
return true;
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/BlankFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/BlankFragment.java
index e9e50dd69..e81645202 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/BlankFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/BlankFragment.java
@@ -2,6 +2,7 @@ package org.schabi.newpipe.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -13,6 +14,24 @@ public class BlankFragment extends BaseFragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
+ if(activity != null && activity.getSupportActionBar() != null) {
+ activity.getSupportActionBar()
+ .setTitle("NewPipe");
+ }
return inflater.inflate(R.layout.fragment_blank, container, false);
}
+
+ @Override
+ public void setUserVisibleHint(boolean isVisibleToUser) {
+ super.setUserVisibleHint(isVisibleToUser);
+ if(isVisibleToUser) {
+ if(activity != null && activity.getSupportActionBar() != null) {
+ activity.getSupportActionBar()
+ .setTitle("NewPipe");
+ }
+ // leave this inline. Will make it harder for copy cats.
+ // If you are a Copy cat FUCK YOU.
+ // I WILL FIND YOU, AND I WILL ...
+ }
+ }
}
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
index 42f52431e..190361f0e 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
@@ -117,7 +117,6 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar != null) {
- supportActionBar.setDisplayShowTitleEnabled(false);
supportActionBar.setDisplayHomeAsUpEnabled(false);
}
}
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
index daa1b62ed..f98f8c36a 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
@@ -33,6 +33,7 @@ import org.schabi.newpipe.fragments.subscription.SubscriptionService;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.ExtractorHelper;
+import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.Localization;
import java.util.List;
@@ -125,7 +126,6 @@ public class ChannelFragment extends BaseListInfoFragment {
ActionBar supportActionBar = activity.getSupportActionBar();
if(useAsFrontPage) {
supportActionBar.setDisplayHomeAsUpEnabled(false);
- //supportActionBar.setDisplayShowTitleEnabled(false);
} else {
inflater.inflate(R.menu.menu_channel, menu);
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/kiosk/KioskFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/kiosk/KioskFragment.java
index b1387b1ad..a9d1cda76 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/list/kiosk/KioskFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/list/kiosk/KioskFragment.java
@@ -53,6 +53,9 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class KioskFragment extends BaseListInfoFragment {
+ private String kioskId = "";
+
+
/*//////////////////////////////////////////////////////////////////////////
// Views
//////////////////////////////////////////////////////////////////////////*/
@@ -76,6 +79,7 @@ public class KioskFragment extends BaseListInfoFragment {
instance.setInitialData(serviceId,
kioskTypeUrlIdHandler.getUrl(kioskId),
kioskId);
+ instance.kioskId = kioskId;
return instance;
}
@@ -83,6 +87,18 @@ public class KioskFragment extends BaseListInfoFragment {
// LifeCycle
//////////////////////////////////////////////////////////////////////////*/
+ @Override
+ public void setUserVisibleHint(boolean isVisibleToUser) {
+ super.setUserVisibleHint(isVisibleToUser);
+ if(useAsFrontPage && isVisibleToUser) {
+ try {
+ activity.getSupportActionBar().setTitle(KioskTranslator.getTranslatedKioskName(kioskId, getActivity()));
+ } catch (Exception e) {
+ onError(e);
+ }
+ }
+ }
+
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_kiosk, container, false);
@@ -97,7 +113,6 @@ public class KioskFragment extends BaseListInfoFragment {
super.onCreateOptionsMenu(menu, inflater);
ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar != null && useAsFrontPage) {
- //supportActionBar.setDisplayShowTitleEnabled(false);
supportActionBar.setDisplayHomeAsUpEnabled(false);
}
}
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
index afb2f078e..c4dfbc50d 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/subscription/SubscriptionFragment.java
@@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -19,6 +20,7 @@ import org.schabi.newpipe.fragments.BaseStateFragment;
import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.info_list.InfoListAdapter;
import org.schabi.newpipe.report.UserAction;
+import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.NavigationHelper;
import java.util.ArrayList;
@@ -52,6 +54,17 @@ public class SubscriptionFragment extends BaseStateFragment
Date: Thu, 26 Oct 2017 20:45:16 +0200
Subject: [PATCH 8/9] fix channel title for new tabs
---
.../fragments/list/channel/ChannelFragment.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
index f98f8c36a..61a97e847 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java
@@ -26,6 +26,7 @@ import org.schabi.newpipe.R;
import org.schabi.newpipe.database.subscription.SubscriptionEntity;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
+import org.schabi.newpipe.extractor.UrlIdHandler;
import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
@@ -82,6 +83,20 @@ public class ChannelFragment extends BaseListInfoFragment {
// LifeCycle
//////////////////////////////////////////////////////////////////////////*/
+ @Override
+ public void setUserVisibleHint(boolean isVisibleToUser) {
+ super.setUserVisibleHint(isVisibleToUser);
+ if(activity != null
+ && useAsFrontPage
+ && isVisibleToUser) {
+ try {
+ activity.getSupportActionBar().setTitle(currentInfo.name);
+ } catch (Exception e) {
+ onError(e);
+ }
+ }
+ }
+
@Override
public void onAttach(Context context) {
super.onAttach(context);
From 8d5a59e7d51c601190d410bbef77ccad79823da7 Mon Sep 17 00:00:00 2001
From: Christian Schabesberger
Date: Thu, 26 Oct 2017 23:56:02 +0200
Subject: [PATCH 9/9] fix light theme for main page
---
.../newpipe/fragments/MainFragment.java | 20 +++++++++++++++---
.../drawable-hdpi/ic_channel_black_24dp.png | Bin 0 -> 396 bytes
.../drawable-hdpi/ic_whatshot_black_24dp.png | Bin 0 -> 462 bytes
.../drawable-mdpi/ic_channel_black_24dp.png | Bin 0 -> 290 bytes
.../drawable-mdpi/ic_whatshot_black_24dp.png | Bin 0 -> 330 bytes
.../drawable-xhdpi/ic_channel_black_24dp.png | Bin 0 -> 423 bytes
.../drawable-xhdpi/ic_whatshot_black_24dp.png | Bin 0 -> 601 bytes
.../drawable-xxhdpi/ic_channel_black_24dp.png | Bin 0 -> 483 bytes
.../ic_whatshot_black_24dp.png | Bin 0 -> 874 bytes
.../ic_channel_black_24dp.png | Bin 0 -> 592 bytes
.../ic_whatshot_black_24dp.png | Bin 0 -> 1134 bytes
11 files changed, 17 insertions(+), 3 deletions(-)
create mode 100644 app/src/main/res/drawable-hdpi/ic_channel_black_24dp.png
create mode 100644 app/src/main/res/drawable-hdpi/ic_whatshot_black_24dp.png
create mode 100644 app/src/main/res/drawable-mdpi/ic_channel_black_24dp.png
create mode 100644 app/src/main/res/drawable-mdpi/ic_whatshot_black_24dp.png
create mode 100644 app/src/main/res/drawable-xhdpi/ic_channel_black_24dp.png
create mode 100644 app/src/main/res/drawable-xhdpi/ic_whatshot_black_24dp.png
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_channel_black_24dp.png
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_whatshot_black_24dp.png
create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_channel_black_24dp.png
create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_whatshot_black_24dp.png
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
index 190361f0e..7992f88f0 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
@@ -33,6 +33,7 @@ import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.NavigationHelper;
+import org.schabi.newpipe.util.ThemeHelper;
import java.util.concurrent.ExecutionException;
@@ -85,13 +86,26 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
tabLayout.setupWithViewPager(viewPager);
+ if(ThemeHelper.isLightThemeSelected(getActivity())) {
+ tabLayout.setBackgroundColor(getResources().getColor(R.color.light_youtube_primary_color));
+ }
+
if(PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(getString(R.string.main_page_content_key), getString(R.string.blank_page_key))
.equals(getString(R.string.subscription_page_key))) {
- tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_white_24dp);
+ if(ThemeHelper.isLightThemeSelected(getActivity())) {
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_black_24dp);
+ } else{
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_white_24dp);
+ }
} else {
- tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_white_24dp);
- tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_white_24dp);
+ if(ThemeHelper.isLightThemeSelected(getActivity())) {
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_black_24dp);
+ tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_black_24dp);
+ } else {
+ tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_white_24dp);
+ tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_white_24dp);
+ }
}
}
diff --git a/app/src/main/res/drawable-hdpi/ic_channel_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_channel_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..ac66a3b860064d933a365f3e7454a8d83af3835d
GIT binary patch
literal 396
zcmV;70dxL|P)
zI*6odGjzi@RZUF~tZfua)~`6_VZnNz9*^m~aF5boz$n+vDs|lbpaLUJn|9pJQAQ?E
zH&ZHunWd7M99tt9>gI;4|6
zIUA9^cNAzbT19J0MJxKcgo+eFQ7RNc7~3n-Inc#UECy`?LV-hJLKT+Q9H97_`nH_h
qW?ueZ?A0|L^J4rRd7e39z2h5Zpw|+kS*+s#0000
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-hdpi/ic_whatshot_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_whatshot_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2db5994cecf747f3dc2276b20cf40f45e3162bb
GIT binary patch
literal 462
zcmV;<0WtoGP)7Bih!S+{oXiJ2yCR>=~#3lD{-D!F3ZVspI^sl7^VGbJ35waS!84J-9X
z2(NXS?YfxN7KQrK;zP?MPKZo{3f&T^PcGVTr(=diHlqr3_$mr(`I+9ma_tr+opwLH
zkIQvI6!b+u&ZN&b<$6$X<66Oo$I-sQAWm+PF6vdLVljivd3TtPIRF3v07*qoM6N<$
Ef?reB(f|Me
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-mdpi/ic_channel_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_channel_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..984ff498ea08633941f05f9e06203a72c76ed406
GIT binary patch
literal 290
zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1rX+877l!}s{b%+Ad7K3vkw8&y
zVGw3ym^BBap1s7=*OmPtmz1c!)I{&xK%mfOPZ!4!i_?22d2=0d5O9gNTU6~>@c2^o
ziy#5}=N|-$jrTSz;C`Q=B^6
zTRfGVb*xZNG4r0wa>Z;0%jDiRcauy(-mjAyH?IqAzSTbO)Iq>Klv+FMfI-kMQ)z4*}Q$iB}166B7
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-mdpi/ic_whatshot_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_whatshot_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..31b1981f0abb4c0d99e9ab77fbd93150c9be23f0
GIT binary patch
literal 330
zcmV-Q0k!^#P)SX$|J@^;bm4$-i?4V4+;hX%KMZtq$t|4>g_}D0tZ_vLYvGI2D!|A{+e!#a6*%mb
ztJ*$@?3@bMgy(tyE(@8ZO3z#Q(GXm;6EeS?R9p};ziqu2?MxJRMa@Ish44tRD#zd4
zaL6+uyjFZ_oqqM$bp!Aqm!0B|keNFMfIISCiXS3-0p*9i;*H2|YvW0-8^wK*-P3l)
z&s?X9vl=0MbOOL}FLP^*RTd&!JMV~7Cfxv^m)s_V`bXd4W3ABlm%rV(T
zf1z1Td4z#Hz|9JgB4qXD2Mn1aN@LDFgQEOIO?*8jdBjj%UJynA4uC0rgElj#zXr(a
zlT(t;=|$Gv^1lF%h?@e!Om?|{OiWGy*R00E0EZ+*#KgF|u7#y&kAyc~07t}>_w|UGn)r;nqI?%W8ShfUA6ud7
RF;f5l002ovPDHLkV1hPjsssQ4
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-xhdpi/ic_whatshot_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_whatshot_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..e9ae826708be97f118730111e3975486ba9ef25d
GIT binary patch
literal 601
zcmV-f0;c_mP)2x%>qIMq5TA4+W
z&g1M1sx(DgWL*;|rVljXB*OwSdc`3c`K6b~D51SL$)iZ`xyv{=c!`puh?5CaXLC4c
z#z)RQKxTAel|#~+<8Q-YxZ0NMC`cbGBl4W>{jPh8uMTWYaWP_oRW^pi%
z%(zC9t)b10;iNnC*b@7Q)5}L>6wryI5oCtX0hVjwWaP#S;jEQsDAXPHvzkWQ*}*XH
zVyj?#t&8WxTqt|PUU9}|iB
zvy9Vx8r!Mk01}BLZbpvnPqB+fhxQeA@Dz`K1_GgS;1CEWu{bMu06CDVw)G{lSftW{
z^v79^Ip#{-FGWhk(WJYDq=cMhNQpU%NDLeRC~(_LV&Z7hjYVSQXwtPoV&-Vl)h{Um
zXAMV~plN?N&C%cmhba3v+xSdM=^izp)I4YF>bu>hJ&n002ovPDHLkV1jgi#R>ob
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable-xxhdpi/ic_whatshot_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_whatshot_black_24dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..a14dcd695f0de6b126efd3745d359c7b78fcb771
GIT binary patch
literal 874
zcmV-w1C{)VP)vfAJuvc8F$0Vcf
zJu#$RM%@NsXseB~E@5bA+-OuS7n$}OuW~oZ>wY2I6DoGMx8!xNknNNX6`J91AIWQ(
zNVHXjz7Y1wYpqCh&Kwn4DTK4Gmd_56>|>Saa7tY0L3y+|DUzKxTLs<`7uze3rDE8&
zYS?^(;!=x^WP(Ft*v^=&K|95ej+v>xXGPtf(vW#-!q5)uFuePm6LmYRA=`v(zqw7?
zN&{lV<|}QIevxR5{W)k%BP~ie$b{@$kwBjW1^wH(~dnN(G-QDC%
z=y8R;C`xt4M%Qymn@F@tVIPRX{q6;AvQ7xub}H;EQJ^C>xzji)-wN5jQP|HSM}OJk
z0qyG9Rn3QgLX6O#9@S!GZzrF9VP{3%cAG4p*M)3-3L6x4+GT>g)+gtFVgHF?`_(n_
zdr8PPps`fuvtBSbJc_G_o
zg)JA-J+FurBGEF1O%u|+qKL1BY&GplI3SYkl;1*;XrEG6i)1IY%I7LaM4~RGOx54u
ze`u>n)Mtv4-Vn)pOf<4*M6!)ao1sr6+pfNG){A7PP1AsNBAqS9OJk;Pk~}X
zv)9eCX!EkuBAtU;G-z&};|J~Wu(>8`)#i3xcGq1Ay=JSx5`&_G&Re7+t3(BLs?aKf
z4c<
zku?3j-uqr3F9jHeVHhTT`fxK{?`FI{W3C~P3tZSzO#Z#{Ds2X4hkXuOc(xc3aasc
zS5S`+02hf0Ch!5E6RWU^f2MtZ+QIvlf+_r{Lh1M?@bCG^884tm5Oqkbu9M
z$f1Bl%A_j^d^PJQYZRaW1t_pD0*-Y7sYW8-77{q9+nxi00QE8}!MzZdQ3_Ci0u-PC
z1t>s)RNKg0wu_C*@WplogmZubY5)1_ei{o|fg(yG)3Q)jW!oASP)(20bn%j?7;MLTFe~Ai=
zO$ppZe`+Bx^x5TcoRw!rU=UxHCMG8E$2d&ttR_6=jTB&zjK7)-w|K-{9r_#(xQXw5
ehG7`y|KA*ZU8cIrkjqdl)YN
zD@FZ?xwlCXYp>AEG-7NfBF#O-RyjgsSV(LgMu<)xA*ME?t`-wZOHo%H%p-{zcoR}Dia@Nj73Tn9ND9dUe2?}NqJBg-0@~nmeNwS9n)^|XhrksL!9&wClu0cM%
zN&!@nL3B_`6t^Ou&NCdx`tmJ8h$%$zDDv$s99xOHdX6ZzBHuEM!l5ywQCE%Ruap)P
z&^jF2g)V9a`I?UcJ4Z#K?lE;F$VY+$C`8L~q``3XEJC3=K`$J*8)enX^@KH&zfj0#
z;lS4@M@^&%qm2D1bRS{eH004qst8iSS16A%RAAXQlI1{mNJXUPqoaxVnRy_XR@$
zfH}Ssz8A*&kVaO^u!0ikG6MOO!q|9ZwK^tpsb=Kaofx|hS*wvbWcv(xwzQ`Vu}(hW
zE)wLj4tcg3V;hlShj@_`-X2GuZNb>b20xVVvV>6tsYafCim`7{p0)D<3mHaOQ+#*N
z*fEqx7g)nki+}evVeAYFT|HyTUpexu8Dr;B$hOg!D0(B$S~1pvLbaO`2cMBC)B;X0
zfauaL7jO=R=zgM0x;;WCQD8?&5?vYc>^R2uqrg^TVgmB49%DODVAGvl7q?>UB@|dW
zCe|U(YB4q&1(e3j5#(7l#)hGQS}-vQ`BaGoKOo;SB#3T3@~jan)}Vk!5Yg
zaWe{NHc@RtK264o1V19*HWSTl$fv_t^Ca@Eje+E^B4Eld!*WZnNtHr7ToJPL=%wWQ*qz?J^2W43HFbe1(R}seToI(NBU|o`ZD4-^$
zlWxJ!N--iN8vf9DfPf}3xX+@Sg%Urs_Xud=i
z+DnRVlH?(pkwJe_LxOHKfR(hM2%VvpGJ1qEp5O?|qr)ttKRrr`a7cP@RBX-4|iU0rr07*qoM6N<$f+o2K
A_y7O^
literal 0
HcmV?d00001