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 aa28c54fb..c6d3f07f9 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -126,10 +126,18 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte @Override public Fragment getItem(int 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: return new SubscriptionFragment(); default: - return getMainPageFramgent(); + return new BlankFragment(); } } @@ -140,7 +148,13 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte @Override 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(); } } + + /*////////////////////////////////////////////////////////////////////////// + // Main page content + //////////////////////////////////////////////////////////////////////////*/ + + } 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 5a722ec4c..daa1b62ed 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 @@ -89,7 +89,8 @@ public class ChannelFragment extends BaseListInfoFragment { @Override 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 @@ -110,6 +111,7 @@ public class ChannelFragment extends BaseListInfoFragment { headerTitleView = headerRootLayout.findViewById(R.id.channel_title_view); headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view); headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button); + return headerRootLayout; } @@ -123,7 +125,7 @@ public class ChannelFragment extends BaseListInfoFragment { ActionBar supportActionBar = activity.getSupportActionBar(); if(useAsFrontPage) { supportActionBar.setDisplayHomeAsUpEnabled(false); - supportActionBar.setDisplayShowTitleEnabled(false); + //supportActionBar.setDisplayShowTitleEnabled(false); } else { inflater.inflate(R.menu.menu_channel, menu); 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 1a8f8e625..379ec591a 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 @@ -122,7 +122,7 @@ public class FeedFragment extends BaseListFragment, Voi if(useAsFrontPage) { supportActionBar.setDisplayHomeAsUpEnabled(false); - supportActionBar.setDisplayShowTitleEnabled(false); + //supportActionBar.setDisplayShowTitleEnabled(false); } } 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 3d019e6cb..451ade674 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 @@ -24,6 +24,7 @@ import org.schabi.newpipe.fragments.list.BaseListInfoFragment; import org.schabi.newpipe.info_list.InfoItemBuilder; import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.ExtractorHelper; +import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.NavigationHelper; import io.reactivex.Single; @@ -90,7 +91,7 @@ public class KioskFragment extends BaseListInfoFragment { super.onCreateOptionsMenu(menu, inflater); ActionBar supportActionBar = activity.getSupportActionBar(); if (supportActionBar != null && useAsFrontPage) { - supportActionBar.setDisplayShowTitleEnabled(false); + //supportActionBar.setDisplayShowTitleEnabled(false); supportActionBar.setDisplayHomeAsUpEnabled(false); } } @@ -140,7 +141,7 @@ public class KioskFragment extends BaseListInfoFragment { super.handleResult(result); animateView(headerRootLayout, true, 100); - headerTitleView.setText("★★ " +result.name+ " ★★"); + headerTitleView.setText("★★ " + KioskTranslator.getTranslatedKioskName(result.id, getActivity())+ " ★★"); if (!result.errors.isEmpty()) { showSnackBarError(result.errors, 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 646fe597e..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,6 +62,8 @@ public class SubscriptionFragment extends BaseStateFragment. + */ + +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; + } + } +} diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml index be3548532..02402e2e8 100644 --- a/app/src/main/res/menu/main_menu.xml +++ b/app/src/main/res/menu/main_menu.xml @@ -20,6 +20,6 @@ + android:title="@string/action_about"/> \ No newline at end of file diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 878d51741..dabbfb40d 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -105,12 +105,14 @@ main_page_content blank_page feed_page + subscription_page_key kiosk_page channel_page @string/blank_page_key @string/kiosk_page_key @string/feed_page_key + @string/subscription_page_key @string/channel_page_key main_page_selected_service diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b71bfa7db..bd8bdc048 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -270,14 +270,21 @@ Content of main page Blank Page Kiosk Page + Subscription Page Feed Page Channel Page @string/blank_page_summary @string/kiosk_page_summary @string/feed_page_summary + @string/subscription_page_summary @string/channel_page_summary Select a channel No channel subscribed yet + + + Trending + Top 50 + New & hot