1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-21 18:42:35 +01:00

[AndroidTV] Fix selecting PeerTube instance in navigation drawer

Fixes #10020
This commit is contained in:
TobiGr 2023-07-15 04:37:59 +02:00
parent 5c7a9a52f5
commit 27b2d5de70

View File

@ -63,6 +63,7 @@ import org.schabi.newpipe.databinding.InstanceSpinnerLayoutBinding;
import org.schabi.newpipe.databinding.ToolbarLayoutBinding;
import org.schabi.newpipe.error.ErrorUtil;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
@ -258,8 +259,15 @@ public class MainActivity extends AppCompatActivity {
private boolean drawerItemSelected(final MenuItem item) {
switch (item.getGroupId()) {
case R.id.menu_services_group:
changeService(item);
break;
if (item.getItemId() == ServiceList.PeerTube.getServiceId()
&& DeviceUtils.isTv(getApplicationContext())
&& !item.isActionViewExpanded()) {
((Spinner) item.getActionView()).performClick();
return true;
} else {
changeService(item);
break;
}
case R.id.menu_tabs_group:
try {
tabSelected(item);
@ -383,8 +391,8 @@ public class MainActivity extends AppCompatActivity {
.add(R.id.menu_services_group, s.getServiceId(), ORDER, title)
.setIcon(ServiceHelper.getIcon(s.getServiceId()));
// peertube specifics
if (s.getServiceId() == 3) {
// PeerTube specifics
if (s == ServiceList.PeerTube) {
enhancePeertubeMenu(menuItem);
}
}