mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 11:02:35 +01:00
Get rid of setUserVisibleHint
This commit is contained in:
parent
7edef8d5a2
commit
51837ce36f
@ -21,7 +21,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
//These values are used for controlling fragments when they are part of the frontpage
|
//These values are used for controlling fragments when they are part of the frontpage
|
||||||
@State
|
@State
|
||||||
protected boolean useAsFrontPage = false;
|
protected boolean useAsFrontPage = false;
|
||||||
private boolean mIsVisibleToUser = false;
|
|
||||||
|
|
||||||
public void useAsFrontPage(final boolean value) {
|
public void useAsFrontPage(final boolean value) {
|
||||||
useAsFrontPage = value;
|
useAsFrontPage = value;
|
||||||
@ -85,12 +84,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
AppWatcher.INSTANCE.getObjectWatcher().watch(this);
|
AppWatcher.INSTANCE.getObjectWatcher().watch(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
|
||||||
mIsVisibleToUser = isVisibleToUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Init
|
// Init
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
@ -109,8 +102,7 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "setTitle() called with: title = [" + title + "]");
|
Log.d(TAG, "setTitle() called with: title = [" + title + "]");
|
||||||
}
|
}
|
||||||
if ((!useAsFrontPage || mIsVisibleToUser)
|
if (!useAsFrontPage && activity != null && activity.getSupportActionBar() != null) {
|
||||||
&& (activity != null && activity.getSupportActionBar() != null)) {
|
|
||||||
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
|
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||||
activity.getSupportActionBar().setTitle(title);
|
activity.getSupportActionBar().setTitle(title);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ public class BlankFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
setTitle("NewPipe");
|
setTitle("NewPipe");
|
||||||
// leave this inline. Will make it harder for copy cats.
|
// leave this inline. Will make it harder for copy cats.
|
||||||
// If you are a Copy cat FUCK YOU.
|
// If you are a Copy cat FUCK YOU.
|
||||||
|
@ -98,11 +98,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
if (activity != null
|
if (activity != null && useAsFrontPage) {
|
||||||
&& useAsFrontPage
|
|
||||||
&& isVisibleToUser) {
|
|
||||||
setTitle(currentInfo != null ? currentInfo.getName() : name);
|
setTitle(currentInfo != null ? currentInfo.getName() : name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,9 +99,12 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
if (useAsFrontPage && isVisibleToUser && activity != null) {
|
if (!Localization.getPreferredContentCountry(requireContext()).equals(contentCountry)) {
|
||||||
|
reloadContent();
|
||||||
|
}
|
||||||
|
if (useAsFrontPage && activity != null) {
|
||||||
try {
|
try {
|
||||||
setTitle(kioskTranslatedName);
|
setTitle(kioskTranslatedName);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -117,15 +120,6 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||||||
return inflater.inflate(R.layout.fragment_kiosk, container, false);
|
return inflater.inflate(R.layout.fragment_kiosk, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
if (!Localization.getPreferredContentCountry(requireContext()).equals(contentCountry)) {
|
|
||||||
reloadContent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Menu
|
// Menu
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -78,9 +78,9 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
if (activity != null && isVisibleToUser) {
|
if (activity != null) {
|
||||||
setTitle(activity.getString(R.string.tab_bookmarks));
|
setTitle(activity.getString(R.string.tab_bookmarks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,9 @@ public class StatisticsPlaylistFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
if (activity != null && isVisibleToUser) {
|
if (activity != null) {
|
||||||
setTitle(activity.getString(R.string.title_activity_history));
|
setTitle(activity.getString(R.string.title_activity_history));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,11 +97,9 @@ public class SubscriptionsImportFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
if (isVisibleToUser) {
|
setTitle(getString(R.string.import_title));
|
||||||
setTitle(getString(R.string.import_title));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
Loading…
Reference in New Issue
Block a user