Coder Social home page Coder Social logo

leanback-showcase's Introduction

Leanback Support Library Showcase App for Android TV

This repo has been migrated to github.com/android/tv-samples. Please check that repo for future updates. Thank you!

leanback-showcase's People

Contributors

bluemix avatar codingjeremy avatar dakegu2 avatar fstanis avatar jfschmakeit avatar keyvanamiri avatar lijingjiang avatar ryanseys avatar tjohns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leanback-showcase's Issues

scale issue

how i can change scaling of selected card in page row fragment

Focus navigation

hello,
im creating custom fragment which i follow the instruction from the google I/O presentation,
lets say inside this fragment there was button and 2 radioButtons.
when i navigate to this fragment from the header, it direcly focus to the button view.
but, i cant navigate to the RadioButton with the D-Pad, i can still click it with mouse though.
i force each View with focusable(true) method, but no result.

my solution for this is set on each View.onClickListener and navigate it to other View.
but its not actually solve the problem

Can't refresh the data in PageAndListRowFragment

I'm using this to add multiple rows for each header item. now I'm unable to refresh data in this fragment. I'll provide an example how I set data and how I tried to refresh the data.
this is my onCreate

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupUi();
loadData();
mBackgroundManager = BackgroundManager.getInstance(getActivity());
mBackgroundManager.attach(getActivity().getWindow());
getMainFragmentRegistry().registerFragment(PageRow.class,new PageRowFragmentFactory(mBackgroundManager,myObject));
}

I've passed myObject into PageRowFragmentFactory, That's how i pass data into my fragments.
When I refresh the data (i do the same thing in onCreate with different data)
getMainFragmentRegistry().registerFragment(PageRow.class,new PageRowFragmentFactory(mBackgroundManager,myObject));

data never refreshed, and the important thing is createFragment() method in PageRowFragmentFactory is not calling. What could be the issue?

Multiple build issues

Manifest merger failed: changing buildTools and supportlib to 26.1.0 in build.gradle fixes this

The gradle version is not compatible with the latest Android Studio

In VideosViewModel, import import android.arch.core.util.Function; could not be resolved

Video Grid Examples Causing illegalStateException

Line 121 of VideoGridExampleFragment.java

VideoRow[] videoRows = new Gson().fromJson(videoRowsJson, VideoRow[].class);

Causes a Fatal Exception

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 246 path $[0].videos[0].sources

leanback-library: 25.+: BackgroundManager loses background when going back from DatailsFragment to MainFragment

Let's say we have two fragments. MainFragment showing a ListRow of card-items and the DetailFragment that opens when a card is clicked.

  • When a card is selected, the background of MainFragment get set according to the bgImagUrl.
  • When a card is clicked, the background of DetailsFragment is also set.
  • When leaving DetailsFragment and going back to MainFragment the background fades out and there's no background-image on the MainFragment.

I tried calling updateBackground() in onResume() of MainFragment, but the result is, that the background fades out, and fades back in.

The behaviour of leanback-library:24 was:

  • When leaving DetailsFragment and going back to MainFragment, the background was still there.

AndroidX migration issue

We just moved to AndroidX and we are using RowsSupportFragment, ArrayObjectAdapter to populate our list. Now, the problem here is that the scroll is broken, where the first item is snapped to the top always. However, when we use android.support.v17.leanback the scroll is fine.

Is this a known issue? Any workarounds for this?

fragment design through xml

How we can add custom design for fragment through xml file example if we want to used custom layout where web view given now

Exoplayer button handling

Hi,

Can you please guide me to handle event of remote Button of TV in ExoPlayerAdapter.

best Regards,
srinivas

Crash in leanback BrowseFragment

I have this strange crash happening in leanback BrowseFragment. It occurs when fast scrolling through the row. Do you have any idea how to prevent this crash ?

java.lang.IllegalArgumentException: View android.support.v17.leanback.widget.ShadowOverlayContainer{cee235a V.ED..... ........ 1854,334-2268,851} is not a direct child of android.support.v17.leanback.widget.HorizontalGridView{81dc26e VFE...... ........ 0,0-1920,605 #7f12014c app:id/row_content}
                                                   at android.support.v7.widget.RecyclerView.getChildViewHolder(SourceFile:4224)
                                                   at android.support.v17.leanback.widget.GridLayoutManager$3.createItem(SourceFile:1488)
                                                   at ct.a(SourceFile:78)
                                                   at android.support.v17.leanback.widget.Grid.j(SourceFile:346)
                                                   at android.support.v17.leanback.widget.GridLayoutManager.m(SourceFile:1734)
                                                   at android.support.v17.leanback.widget.GridLayoutManager.j(SourceFile:2070)
                                                   at android.support.v17.leanback.widget.GridLayoutManager.scrollHorizontallyBy(SourceFile:2005)
                                                   at android.support.v7.widget.RecyclerView$d.run(SourceFile:4722)
                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:683)
                                                   at android.view.Choreographer.doFrame(Choreographer.java:616)
                                                   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
                                                   at android.os.Handler.handleCallback(Handler.java:751)
                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                   at android.os.Looper.loop(Looper.java:154)
                                                   at android.app.ActivityThread.main(ActivityThread.java:6120)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

App crash on SettingsExampleActivity

5-18 18:11:22.093 12591-12591/android.support.v17.leanback.supportleanbackshowcase E/AndroidRuntime: FATAL EXCEPTION: main
Process: android.support.v17.leanback.supportleanbackshowcase, PID: 12591
java.lang.RuntimeException: Unable to start activity ComponentInfo{android.support.v17.leanback.supportleanbackshowcase/android.support.v17.leanback.supportleanbackshowcase.app.settings.SettingsExampleActivity}: java.lang.IllegalStateException: Must specify preferenceTheme in theme
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2630)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2691)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1444)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:802)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:692)
Caused by: java.lang.IllegalStateException: Must specify preferenceTheme in theme
at android.support.v14.preference.PreferenceFragment.onCreate(PreferenceFragment.java:218)
at android.app.Fragment.performCreate(Fragment.java:2335)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:949)
at android.app.BackStackRecord.setLastIn(BackStackRecord.java:857)
at android.app.BackStackRecord.calculateFragments(BackStackRecord.java:880)
at android.app.BackStackRecord.run(BackStackRecord.java:727)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1578)
at android.app.Fragment.performStart(Fragment.java:2374)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1027)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1153)
at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2044)
at android.app.FragmentController.dispatchStart(FragmentController.java:187)
at android.app.Activity.performStart(Activity.java:6681)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2593)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2691) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1444) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6010) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:802) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:692) 

Search fragment closing after gaining focus on results

In the search fragment when we have committed a search with the keyboard and we have search results the fragment is closing when the search query is submitted with the back button. We can see that on action down of the back button the results are gaining focus and the keyboard is hiding(as expected) but on action up the screen is closing.
I believe this is a bug in the leanback framework since this is reproducing in this showcase. Is there a workaround to disable the closing of the screen.

Short dialog

Hallo! Sorry about my English but i have a question.. how to make short dialog ? i see this dialog in Publish Channels .. when i click in channel i see system dialog in bottom (agree/disagree) .. How to make like this? i try add application rule in my application and i wanna do short dialog like agree to the rules yes/no ... but basic full screen i think to big for this case..

2017-09-19 21-04-48

App crashes in video play

Error message:

java.lang.NoClassDefFoundError: android.media.session.MediaSession

when I'm trying to run the app in android 4.4. I think it's because MediaSession is not supported in 4.4. Am I right? What is the best practice if I want to support MediaSession when I'm running in Android 5.0 and above and without MediaSession running in Android 4.2 and above.

Thanks.

Picture in Picture shows MainActivity

Both this project and the official sample have this issue.

Reproduction

When using the PIP feature, if you completely leave the app and then re-open it from the home screen, the MainActivity is displayed in the picture in picture window.
All my tests were done in an emulator running API 26.

Fix try

The only way I found to avoid that is to put something like that in the player activity manifest entry:
android:taskAffinity="showcase.player"

But it also causes other issues:

  1. The app is shown twice in the recent list
  2. The video controls are not displayed anymore

Is there a ways to manage this case properly?

Changing layout

Is it possible to change the layout of the transport controls in the video example? I would like to move the video title and description to some other part of the screen, so it's e.g. in the upper left corner.

Loader issue

loader is showing when i load webview at pagefragment inside custom fragment activity and i unable to find why the loader is loading.. becuase i have comment all json call inside page_rowlistfragment

setSearchAffordanceColors not working on BrowseFragment

Hi,

This is what I tried :

on CustomTitleView.java

private final SearchOrbView mSearchOrbView;
....


private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() {
       ....
        @Override
        public void setSearchAffordanceColors(SearchOrbView.Colors colors) {
            mSearchOrbView.setOrbColors(colors);
        }
}

public BrowseTitleView(Context context, AttributeSet attrs, int defStyle) {
        ....
        mSearchOrbView = (SearchOrbView) root.findViewById(R.id.search_orb);
}

But when I call setSearchAffordanceColors from my BrowseFragment, color is not set.

See related : #18

Thanks !

PlaybackSeekDataProvider can not seek to zero

Hi.
Our application use PlaybackSeekDataProvider for a seek function, but we cannot seek to position only zero.
Furthermore, sample application that made by Google (android.support.v17.leanback.supportleanbackshowcase) also occurred this error.
This error reproduce way is followings:

Play video.
Seek to zero.
Seek failed, and back before setting the position.
However, The error log on the Logcat is not displayed.

Could you tell us correct way to fix this error.

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

I have this error when I navigate to each RowFragments.

 E/AndroidRuntime: FATAL EXCEPTION: Thread-24
                                                                      Process: it.sportube.sportubetv, PID: 3025
                                                                      java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
                                                                          at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2530)
                                                                          at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeInserted(RecyclerView.java:4903)
                                                                          at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeInserted(RecyclerView.java:11123)
                                                                          at android.support.v7.widget.RecyclerView$Adapter.notifyItemRangeInserted(RecyclerView.java:6731)
                                                                          at android.support.v17.leanback.widget.ItemBridgeAdapter$1.onItemRangeInserted(ItemBridgeAdapter.java:156)
                                                                          at android.support.v17.leanback.widget.ObjectAdapter$DataObservable.notifyItemRangeInserted(ObjectAdapter.java:92)
                                                                          at android.support.v17.leanback.widget.ObjectAdapter.notifyItemRangeInserted(ObjectAdapter.java:199)
                                                                          at android.support.v17.leanback.widget.ArrayObjectAdapter.add(ArrayObjectAdapter.java:100)
                                                                          at android.support.v17.leanback.widget.ArrayObjectAdapter.add(ArrayObjectAdapter.java:88)
                                                                          at it.sportube.sportubetv.fragment.LegaProFragment$1.onSuccess(LegaProFragment.java:92)
                                                                          at it.sportube.sportubetv.api.SportubeApiClient$11.run(SportubeApiClient.java:587)
                                                                          at java.lang.Thread.run(Thread.java:761)

Wrong Aspect Ratio

I implemented VideoExampleWithExoPlayerActivity in my app. All works fine except aspect ratio in some videos. It happens with videos with very wide aspect ratio (21:9, for example). Instead shows horizontal black stripes in the top and the bottom of the video, it stretech the video to have same height that screen.

In your sample video it's 16:9 and it doesn't happen, what can i do to show video with its real aspect ratio?

ItemViewClickedListener not working first 3 items

I am using this MusicPlayer sample app. In My AlbumDetailsFragment extends Details Fragment i registered
"ItemViewSelectedListener" and "ItemViewClickedListener". Here ItemViewSelectedListener works all items but ItemViewClickedListener not working first three items remaining working fine.

How to fix?

Fast-forward, Rewind and Video Scrubbing Don't Work on Android OS 6

I am getting reports that the fast-forward, rewind and video scrubbing features don't work on an Android 6 device, namely Xiaomi MiBox3. The app just hangs. They are working fine on my Google Nexus Player running on Android OS 8. What could be the reason? Thanks in advance.

Here's the code I am using in VideoMediaPlayerGlue.java:

/** Skips backwards 10 seconds. */
    public void rewind() {
        Crashlytics.log("rewind action");
        long newPosition = getCurrentPosition() - TEN_SECONDS;
        newPosition = (newPosition < 0) ? 0 : newPosition;
        getPlayerAdapter().seekTo(newPosition);
    }

    /** Skips forward 10 seconds. */
    public void fastForward() {
        Crashlytics.log("fast-forward action");
        if (getDuration() > -1) {
            long newPosition = getCurrentPosition() + TEN_SECONDS;
            newPosition = (newPosition > getDuration()) ? getDuration() : newPosition;
            getPlayerAdapter().seekTo(newPosition);
        }
    }

Slowing the scroll speed of browseFragment

[Question]
I am using BrowseSupportFragment and want to slow down the speed of recyclerView when a navigation key is long pressed. I have tried everything I could.

There are multiple queries on StackOverflow but none of them is answered. I think it would be a great help to me and some other people if you can explain how to do this.

Cannot click first item of recommend in DetailViewExampleFragment

I checkout code and run, In the DetailViewExampleFragment, I replace some code as below:

@Override
    public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                              RowPresenter.ViewHolder rowViewHolder, Row row) {
//        if (!(item instanceof Action)) return;
//        Action action = (Action) item;
//
//        if (action.getId() == ACTION_RELATED) {
//            setSelectedPosition(1);
//        } else {
//            Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG)
//                    .show();
//        }
        Log.d("onItemClicked", item.toString());
    }

But When I click first item in relate or recommend row log is not be shown.

Custom Fragment focus

Hello!I have focus problem witn my i have layout like this

<FrameLayout>
    <CustomViewOne android:id="@+id/vOne"></FrameLayout>
    <CustomViewTwo android:id="@+id/vTwo"></FrameLayout>
</FrameLayout>

My CustomViewOne its class extends FrameLayout and have one button in layout. CustomViewTwo seem class have one button too. When i use vOne.setVisibility(View.GONE) i see my vTwo. When i press button down in my keyboard my vTwo lost focus, and button from vOne can found focus... Actualy i can click on invisible view. How to fix this problem?

udp audio can't paly in Exoplayer adapter

10-08 20:55:46.015 1465-4317/? E/OMXNodeInstance: getExtensionIndex(6f:hisi.decoder.avc, OMX.google.android.index.storeMetaDataInBuffers) ERROR: NotImplemented(0x80001006)
10-08 20:55:46.015 13897-13990/com.example.android.persistence E/ACodec: [OMX.hisi.video.decoder.avc] storeMetaDataInBuffers failed w/ err -2147483648
10-08 20:55:46.016 13897-13990/com.example.android.persistence I/ACodec: [OMX.hisi.video.decoder.avc] prepareForAdaptivePlayback(528x576)
10-08 20:55:46.020 1465-13991/? D/HISI_OMXVDEC: [OmxState] Loaded --> Idle_Pending
10-08 20:55:46.020 13897-13990/com.example.android.persistence I/ACodec: [OMX.hisi.video.decoder.avc] Allocating 4 buffers of size 2097152 on input port
10-08 20:55:46.021 1465-1138/? D/HISI_OMXVDEC: Alloc buffer vir:0x0x0 phy:0x1adc000, size:2097152 dir:0 sec:0 success!
10-08 20:55:46.022 1465-24889/? D/HISI_OMXVDEC: Alloc buffer vir:0x0x0 phy:0x1cdd000, size:2097152 dir:0 sec:0 success!
10-08 20:55:46.023 1465-31203/? D/HISI_OMXVDEC: Alloc buffer vir:0x0x0 phy:0x1ede000, size:2097152 dir:0 sec:0 success!
10-08 20:55:46.024 1465-4318/? D/HISI_OMXVDEC: Alloc buffer vir:0x0x0 phy:0x20df000, size:2097152 dir:0 sec:0 success!
10-08 20:55:46.025 13897-13990/com.example.android.persistence I/ACodec: [OMX.hisi.video.decoder.avc] will output to SurfaceView
10-08 20:55:46.025 13897-13990/com.example.android.persistence I/ACodec: Output will queue to overlay.
10-08 20:55:46.025 1465-31203/? D/HISI_OMXVDEC: get vpss bypass info = 0 (w = 528,h = 576)
10-08 20:55:46.025 13897-13990/com.example.android.persistence I/ACodec: isVideoBypass -- omxBypass = 0, queuesToNativeWindow = 1
10-08 20:55:46.025 1465-4318/? D/HISI_OMXVDEC: set vpss bypass info = 0
10-08 20:55:46.026 13897-13990/com.example.android.persistence I/ACodec: [OMX.hisi.video.decoder.avc] Allocating 7 buffers from a native window of size 456192 on output port

How to set OnItemViewSelectedListener for header

Good day.

How can I set onItemViewClickedListener event for header items?
I tried with code below
getHeadersFragment().setOnHeaderViewSelectedListener((viewHolder, row) -> Utils.print("test"));
but get null in onCreate/onAttach, and application freezes in onActivityCreated.

Thanks you.

Expresso testing

Hello there! I can't found information about ui testing for Android TV. I know possible use unit testing to test functional... But how to use espresso or seam framework to testing ui?

Error in building program

when i try to build the program, i receive this error:
"Android TV (720p) API 23 (Android 6.0, API 23) (minSdk(API 23, N preview) != deviceSdk(API 23))"
how to solve this issue?
thanks.

Unable to run the sample app on any device

I am getting minSdk(API 25, O preview) != deviceSdk(API 23) error when running the app on every device with the deviceSdk being the Android OS version. I have not changed anything in the sample app.

Please fix it or tell me how to fix it.

Crash When click the Music consumption Examples?

image

The code is well done on other computer, but When i run on my computer (Music consumption Examples), it crashed .
The only difference is my buildToolsVersion is 24.0.2 ,I will check the jdk version ,or change the buildToolsVersion , check later.

Sorry for my English

Headers Fragment

Is Leanback has default possibility to make HeadersFragment non scrollable like it implemented in the Google Play Store?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.