mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 04:22:30 +01:00
fix: notification menu option disappears when switching tabs
This commit is contained in:
parent
e3614cb932
commit
b5893f3fa3
@ -97,6 +97,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||||||
|
|
||||||
private MenuItem menuRssButton;
|
private MenuItem menuRssButton;
|
||||||
private MenuItem menuNotifyButton;
|
private MenuItem menuNotifyButton;
|
||||||
|
private SubscriptionEntity channelSubscription;
|
||||||
|
|
||||||
public static ChannelFragment getInstance(final int serviceId, final String url,
|
public static ChannelFragment getInstance(final int serviceId, final String url,
|
||||||
final String name) {
|
final String name) {
|
||||||
@ -193,8 +194,14 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||||||
Log.d(TAG, "onCreateOptionsMenu() called with: "
|
Log.d(TAG, "onCreateOptionsMenu() called with: "
|
||||||
+ "menu = [" + menu + "], inflater = [" + inflater + "]");
|
+ "menu = [" + menu + "], inflater = [" + inflater + "]");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrepareOptionsMenu(final @NonNull Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
menuRssButton = menu.findItem(R.id.menu_item_rss);
|
menuRssButton = menu.findItem(R.id.menu_item_rss);
|
||||||
menuNotifyButton = menu.findItem(R.id.menu_item_notify);
|
menuNotifyButton = menu.findItem(R.id.menu_item_notify);
|
||||||
|
updateNotifyButton(channelSubscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -346,15 +353,17 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||||||
info.getAvatarUrl(),
|
info.getAvatarUrl(),
|
||||||
info.getDescription(),
|
info.getDescription(),
|
||||||
info.getSubscriberCount());
|
info.getSubscriberCount());
|
||||||
|
channelSubscription = null;
|
||||||
updateNotifyButton(null);
|
updateNotifyButton(null);
|
||||||
subscribeButtonMonitor = monitorSubscribeButton(mapOnSubscribe(channel, info));
|
subscribeButtonMonitor = monitorSubscribeButton(mapOnSubscribe(channel, info));
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "Found subscription to this channel!");
|
Log.d(TAG, "Found subscription to this channel!");
|
||||||
}
|
}
|
||||||
final SubscriptionEntity subscription = subscriptionEntities.get(0);
|
channelSubscription = subscriptionEntities.get(0);
|
||||||
updateNotifyButton(subscription);
|
updateNotifyButton(channelSubscription);
|
||||||
subscribeButtonMonitor = monitorSubscribeButton(mapOnUnsubscribe(subscription));
|
subscribeButtonMonitor =
|
||||||
|
monitorSubscribeButton(mapOnUnsubscribe(channelSubscription));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user