make name translatable, fix tab on items, remove back button
s/kisok/kiosk/g
This commit is contained in:
parent
90b9223aae
commit
f6c624b59a
4 changed files with 44 additions and 14 deletions
|
@ -48,7 +48,7 @@ dependencies {
|
|||
exclude module: 'support-annotations'
|
||||
}
|
||||
|
||||
compile 'com.github.TeamNewPipe:NewPipeExtractor:7fffef5'
|
||||
compile 'com.github.TeamNewPipe:NewPipeExtractor:466d87c'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.view.ViewGroup;
|
|||
|
||||
import org.schabi.newpipe.BaseFragment;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.fragments.list.kisok.KioskFragment;
|
||||
import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
|
||||
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package org.schabi.newpipe.fragments.list.kisok;
|
||||
package org.schabi.newpipe.fragments.list.kiosk;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
@ -17,10 +19,9 @@ import org.schabi.newpipe.extractor.StreamingService;
|
|||
import org.schabi.newpipe.extractor.UrlIdHandler;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
|
||||
import org.schabi.newpipe.extractor.kiosk.KioskList;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||
import org.schabi.newpipe.fragments.list.channel.ChannelFragment;
|
||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
||||
import org.schabi.newpipe.report.UserAction;
|
||||
import org.schabi.newpipe.util.ExtractorHelper;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
|
@ -63,12 +64,12 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||
throws ExtractionException {
|
||||
KioskFragment instance = new KioskFragment();
|
||||
StreamingService service = NewPipe.getService(serviceId);
|
||||
String defaultKioskType = service.getKioskList().getDefaultKioskType();
|
||||
String defaultKioskId = service.getKioskList().getDefaultKioskId();
|
||||
UrlIdHandler defaultKioskTypeUrlIdHandler = service.getKioskList()
|
||||
.getUrlIdHandlerByType(defaultKioskType);
|
||||
.getUrlIdHandlerByType(defaultKioskId);
|
||||
instance.setInitialData(serviceId,
|
||||
defaultKioskTypeUrlIdHandler.getUrl(defaultKioskType),
|
||||
defaultKioskType);
|
||||
defaultKioskTypeUrlIdHandler.getUrl(defaultKioskId),
|
||||
defaultKioskId);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,20 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||
return inflater.inflate(R.layout.fragment_kiosk, container, false);
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Menu
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
ActionBar supportActionBar = activity.getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
supportActionBar.setDisplayShowTitleEnabled(false);
|
||||
supportActionBar.setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Init
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
@ -92,6 +107,21 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||
return headerRootLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initListeners() {
|
||||
// We have to override this because the default implementation of this function calls
|
||||
// openVideoDetailFragment on getFragmentManager() but what we want here is
|
||||
// getParentFragment().getFragmentManager()
|
||||
infoListAdapter.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener<StreamInfoItem>() {
|
||||
@Override
|
||||
public void selected(StreamInfoItem selectedItem) {
|
||||
onItemSelected(selectedItem);
|
||||
NavigationHelper.openVideoDetailFragment(getParentFragment().getFragmentManager(),
|
||||
selectedItem.service_id, selectedItem.url, selectedItem.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Load and handle
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
@ -107,7 +137,7 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||
|
||||
@Override
|
||||
public Single<ListExtractor.NextItemsResult> loadMoreItemsLogic() {
|
||||
return ExtractorHelper.getMoreKisokItems(serviceId, url, currentNextItemsUrl);
|
||||
return ExtractorHelper.getMoreKioskItems(serviceId, url, currentNextItemsUrl);
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -126,7 +156,7 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
|||
super.handleResult(result);
|
||||
|
||||
animateView(headerRootLayout, true, 100);
|
||||
headerTitleView.setText(result.type);
|
||||
headerTitleView.setText("★★ " +result.name+ " ★★");
|
||||
|
||||
if (!result.errors.isEmpty()) {
|
||||
showSnackBarError(result.errors,
|
|
@ -134,7 +134,7 @@ public final class ExtractorHelper {
|
|||
}));
|
||||
}
|
||||
|
||||
public static Single<NextItemsResult> getMoreKisokItems(final int serviceId, final String url, final String nextStreamsUrl) {
|
||||
public static Single<NextItemsResult> getMoreKioskItems(final int serviceId, final String url, final String nextStreamsUrl) {
|
||||
return Single.fromCallable(new Callable<NextItemsResult>() {
|
||||
@Override
|
||||
public NextItemsResult call() throws Exception {
|
||||
|
|
Loading…
Reference in a new issue