parent
29fee28d1d
commit
46fa9a9366
|
@ -126,10 +126,18 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
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))) {
|
||||||
|
return new SubscriptionFragment();
|
||||||
|
} else {
|
||||||
|
return getMainPageFramgent();
|
||||||
|
}
|
||||||
case 1:
|
case 1:
|
||||||
return new SubscriptionFragment();
|
return new SubscriptionFragment();
|
||||||
default:
|
default:
|
||||||
return getMainPageFramgent();
|
return new BlankFragment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +148,13 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return this.tabTitles.length;
|
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))) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,4 +200,10 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
return new BlankFragment();
|
return new BlankFragment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
// Main page content
|
||||||
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_channel, container, false);
|
View v = inflater.inflate(R.layout.fragment_channel, container, false);
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,6 +111,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
headerTitleView = headerRootLayout.findViewById(R.id.channel_title_view);
|
headerTitleView = headerRootLayout.findViewById(R.id.channel_title_view);
|
||||||
headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view);
|
headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view);
|
||||||
headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button);
|
headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button);
|
||||||
|
|
||||||
return headerRootLayout;
|
return headerRootLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
ActionBar supportActionBar = activity.getSupportActionBar();
|
ActionBar supportActionBar = activity.getSupportActionBar();
|
||||||
if(useAsFrontPage) {
|
if(useAsFrontPage) {
|
||||||
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
||||||
supportActionBar.setDisplayShowTitleEnabled(false);
|
//supportActionBar.setDisplayShowTitleEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
inflater.inflate(R.menu.menu_channel, menu);
|
inflater.inflate(R.menu.menu_channel, menu);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi
|
||||||
|
|
||||||
if(useAsFrontPage) {
|
if(useAsFrontPage) {
|
||||||
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
||||||
supportActionBar.setDisplayShowTitleEnabled(false);
|
//supportActionBar.setDisplayShowTitleEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.ExtractorHelper;
|
import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
|
import org.schabi.newpipe.util.KioskTranslator;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
|
@ -90,7 +91,7 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
ActionBar supportActionBar = activity.getSupportActionBar();
|
ActionBar supportActionBar = activity.getSupportActionBar();
|
||||||
if (supportActionBar != null && useAsFrontPage) {
|
if (supportActionBar != null && useAsFrontPage) {
|
||||||
supportActionBar.setDisplayShowTitleEnabled(false);
|
//supportActionBar.setDisplayShowTitleEnabled(false);
|
||||||
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +141,7 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
super.handleResult(result);
|
super.handleResult(result);
|
||||||
|
|
||||||
animateView(headerRootLayout, true, 100);
|
animateView(headerRootLayout, true, 100);
|
||||||
headerTitleView.setText("★★ " +result.name+ " ★★");
|
headerTitleView.setText("★★ " + KioskTranslator.getTranslatedKioskName(result.id, getActivity())+ " ★★");
|
||||||
|
|
||||||
if (!result.errors.isEmpty()) {
|
if (!result.errors.isEmpty()) {
|
||||||
showSnackBarError(result.errors,
|
showSnackBarError(result.errors,
|
||||||
|
|
|
@ -62,6 +62,8 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||||
|
activity.setTitle(R.string.tab_subscriptions);
|
||||||
return inflater.inflate(R.layout.fragment_subscription, container, false);
|
return inflater.inflate(R.layout.fragment_subscription, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
return R.string.kiosk_page_summary;
|
return R.string.kiosk_page_summary;
|
||||||
} else if(key.equals(getString(R.string.feed_page_key))) {
|
} else if(key.equals(getString(R.string.feed_page_key))) {
|
||||||
return R.string.feed_page_summary;
|
return R.string.feed_page_summary;
|
||||||
|
} else if(key.equals(getString(R.string.subscription_page_key))) {
|
||||||
|
return R.string.subscription_page_summary;
|
||||||
} else if(key.equals(getString(R.string.channel_page_key))) {
|
} else if(key.equals(getString(R.string.channel_page_key))) {
|
||||||
return R.string.channel_page_summary;
|
return R.string.channel_page_summary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.schabi.newpipe.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Chrsitian Schabesberger on 28.09.17.
|
||||||
|
* KioskTranslator.java is part of NewPipe.
|
||||||
|
*
|
||||||
|
* NewPipe is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* NewPipe is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class KioskTranslator {
|
||||||
|
public static String getTranslatedKioskName(String kioskId, Context c) {
|
||||||
|
switch(kioskId) {
|
||||||
|
case "Trending":
|
||||||
|
return c.getString(R.string.trending);
|
||||||
|
case "Top 50":
|
||||||
|
return c.getString(R.string.top_50);
|
||||||
|
case "New & hot":
|
||||||
|
return c.getString(R.string.new_and_hot);
|
||||||
|
default:
|
||||||
|
return kioskId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,6 @@
|
||||||
|
|
||||||
<item android:id="@+id/action_about"
|
<item android:id="@+id/action_about"
|
||||||
android:orderInCategory="1000"
|
android:orderInCategory="1000"
|
||||||
android:title="@string/action_about" />
|
android:title="@string/action_about"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
|
@ -105,12 +105,14 @@
|
||||||
<string name="main_page_content_key" translatable="false">main_page_content</string>
|
<string name="main_page_content_key" translatable="false">main_page_content</string>
|
||||||
<string name="blank_page_key" translatable="false">blank_page</string>
|
<string name="blank_page_key" translatable="false">blank_page</string>
|
||||||
<string name="feed_page_key" translatable="false">feed_page</string>
|
<string name="feed_page_key" translatable="false">feed_page</string>
|
||||||
|
<string name="subscription_page_key" translatable="false">subscription_page_key</string>
|
||||||
<string name="kiosk_page_key" translatable="false">kiosk_page</string>
|
<string name="kiosk_page_key" translatable="false">kiosk_page</string>
|
||||||
<string name="channel_page_key" translatable="false">channel_page</string>
|
<string name="channel_page_key" translatable="false">channel_page</string>
|
||||||
<string-array name="main_page_content_pages" translatable="false">
|
<string-array name="main_page_content_pages" translatable="false">
|
||||||
<item>@string/blank_page_key</item>
|
<item>@string/blank_page_key</item>
|
||||||
<item>@string/kiosk_page_key</item>
|
<item>@string/kiosk_page_key</item>
|
||||||
<item>@string/feed_page_key</item>
|
<item>@string/feed_page_key</item>
|
||||||
|
<item>@string/subscription_page_key</item>
|
||||||
<item>@string/channel_page_key</item>
|
<item>@string/channel_page_key</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="main_page_selected_service" translatable="false">main_page_selected_service</string>
|
<string name="main_page_selected_service" translatable="false">main_page_selected_service</string>
|
||||||
|
|
|
@ -270,14 +270,21 @@
|
||||||
<string name="main_page_content">Content of main page</string>
|
<string name="main_page_content">Content of main page</string>
|
||||||
<string name="blank_page_summary">Blank Page</string>
|
<string name="blank_page_summary">Blank Page</string>
|
||||||
<string name="kiosk_page_summary">Kiosk Page</string>
|
<string name="kiosk_page_summary">Kiosk Page</string>
|
||||||
|
<string name="subscription_page_summary">Subscription Page</string>
|
||||||
<string name="feed_page_summary">Feed Page</string>
|
<string name="feed_page_summary">Feed Page</string>
|
||||||
<string name="channel_page_summary">Channel Page</string>
|
<string name="channel_page_summary">Channel Page</string>
|
||||||
<string-array name="main_page_content_names">
|
<string-array name="main_page_content_names">
|
||||||
<item>@string/blank_page_summary</item>
|
<item>@string/blank_page_summary</item>
|
||||||
<item>@string/kiosk_page_summary</item>
|
<item>@string/kiosk_page_summary</item>
|
||||||
<item>@string/feed_page_summary</item>
|
<item>@string/feed_page_summary</item>
|
||||||
|
<item>@string/subscription_page_summary</item>
|
||||||
<item>@string/channel_page_summary</item>
|
<item>@string/channel_page_summary</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="select_a_channel">Select a channel</string>
|
<string name="select_a_channel">Select a channel</string>
|
||||||
<string name="no_channel_subscribed_yet">No channel subscribed yet</string>
|
<string name="no_channel_subscribed_yet">No channel subscribed yet</string>
|
||||||
|
|
||||||
|
<!-- Kiosk Names -->
|
||||||
|
<string name="trending">Trending</string>
|
||||||
|
<string name="top_50">Top 50</string>
|
||||||
|
<string name="new_and_hot">New & hot</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue