From 9a073713bb715e13d4bdf706048354bb62f37e23 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 25 Oct 2017 15:20:57 +0200 Subject: [PATCH 1/4] 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 2/4] 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^MS&#b*`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: Thu, 26 Oct 2017 15:16:35 +0200 Subject: [PATCH 3/4] 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 4/4] 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);