dextorer / sofa Goto Github PK
View Code? Open in Web Editor NEWA library for Android TV that extends the Leanback library functionalities
License: Other
A library for Android TV that extends the Leanback library functionalities
License: Other
1.How to change animation between Header and RowFragment (left and right animation right now.)
2. How to stable focus ,while traverse ImageCard View?
from Browse Screen, If I Click an Item & then go to another activity (assume, I've another activity name Activity B). When I return to Browse Screen from Activity B by back press, the application goes to force close.
from log cat :
ava.lang.RuntimeException: Unable to resume activity : java.lang.IllegalStateException: Item clicked listener must be set before views are created
Caused by: java.lang.IllegalStateException: Item clicked listener must be set before views are created
at .RowsSupportFragment.setOnItemViewClickedListener(RowsSupportFragment.java:158)
at .BrowseSupportFragment.onStart(BrowseSupportFragment.java:933)
The most reported error of my AndroidTV app is the following. I hope you/somebody can fix this bug!
Fatal Exception: java.lang.NullPointerException
at com.sgottard.sofa.BrowseFragment$9.onItemSelected(BrowseFragment.java:821)
at android.support.v17.leanback.widget.RowPresenter.dispatchItemSelectedListener(RowPresenter.java:470)
at android.support.v17.leanback.widget.ListRowPresenter.dispatchItemSelectedListener(ListRowPresenter.java:441)
at android.support.v17.leanback.widget.RowPresenter.createRowViewHolder(RowPresenter.java:481)
at android.support.v17.leanback.widget.ListRowPresenter.onRowViewSelected(ListRowPresenter.java:455)
at android.support.v17.leanback.widget.RowPresenter.setRowViewSelected(RowPresenter.java:404)
at com.sgottard.sofa.RowsFragment.setRowViewSelected(RowsFragment.java:329)
at com.sgottard.sofa.RowsFragment.onRowSelected(RowsFragment.java:230)
at com.sgottard.sofa.BaseRowFragment$1.onChildViewHolderSelected(BaseRowFragment.java:47)
at android.support.v17.leanback.widget.GridLayoutManager.dispatchChildSelected(GridLayoutManager.java:873)
at android.support.v17.leanback.widget.GridLayoutManager.access$200(GridLayoutManager.java:50)
at android.support.v17.leanback.widget.GridLayoutManager$2.createItem(GridLayoutManager.java:1437)
at android.support.v17.leanback.widget.StaggeredGrid.appendVisibleItemToRow(StaggeredGrid.java:393)
at android.support.v17.leanback.widget.StaggeredGridDefault.appendVisibleItemsWithoutCache(StaggeredGridDefault.java:300)
at android.support.v17.leanback.widget.StaggeredGrid.appendVisibleItems(StaggeredGrid.java:286)
at android.support.v17.leanback.widget.Grid.appendOneColumnVisibleItems(Grid.java:360)
at android.support.v17.leanback.widget.GridLayoutManager.appendOneColumnVisibleItems(GridLayoutManager.java:1625)
at android.support.v17.leanback.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:1808)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2713)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3011)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.support.v17.leanback.widget.ScaleFrameLayout.onLayout(ScaleFrameLayout.java:137)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14125)
at android.view.ViewGroup.layout(ViewGroup.java:4404)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1984)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1803)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1047)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4588)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5130)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
When setHeadersState(BrowseFragment.HEADERS_DISABLED)
is used, rows can't have focus, the focus will stay in the hidden headers, please help
Hello.
Found some strange behaviour with BrowserFragment.
Please see description below.
Steps to reproduce on Android TV Emulator:
We assumes that the problem is in BrowseFragment.mRowViewSelectedListener, where we trying to get VerticalGridView from mCurrentFragment, which can be not yet fully initialized (onCreateView hasn't been called yet).
I'm trying to clone the project on my local device but it gives some error while reading a while which is not available in the projec.
A problem occurred evaluating project ':sofa'.
Could not read script 'C:\Users\Lenovo\AndroidStudioProjects\Sofa\config\bintray.gradle' as it does not exist.
Hi, i have extended RowsFragment for the BrowseFragment, everytime when i select the view in the navigation (left side) the onCreate, onCreateView, onViewCreated
methods of the fragment are called again, but the global variables persist...
Currently i have the following in my onCreate:
// load data
if (mRecordedBroadcasts == null) {
mArchiveCall = mApp.getService().archivedBroadcasts();
mArchiveCall.enqueue(this);
} else {
loadRows();
}
In my case mRecordedBroadcasts is only null the first time. So why is onCreate called everytime if its already initialized?
Thanks for your brilliant library. I'm new on Android TV app development.
I've a query about "OnItemViewSelectedListener" issue on "DemoActivity" (I've used Custom Rows, Multiple Rows per Header item). I've implemented "OnItemViewSelectedListener" for Item Selection on each row (right now, just shows a toast message of Item's title).
When the application launched, the First Category of Header has the focus (not the first item of item list of first row). Though right now, the First Item of First Rows (on the right panel) is not focused but it shows the Item's title (on toast message). Then if I move from Header item to First Item on the Rows, it doesn't show any toast. It acts as if I select any Header, It'll automatically selects the first item of its Rows (right panel rows items) despite specifically select the first one of list of items on the Rows.
how to detect category selection is changed?
specially when there is no video in a category.
I managed to get the rows working, but when I click on an item and open up my details activity and go back instead of returning to the row item I just clicked it reloads the complete Browse Fragment again.
Ex.
private final class ItemViewClickedListener implements OnItemViewClickedListener {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Log.d(TAG, "OnItemViewClickedListener called");
if (item instanceof Item) {
Item mItem = (Item) item;
Log.d(TAG, "Item: " + item.toString());
Intent intent = new Intent(MainActivity.this, DetailsActivity.class);
intent.putExtra(DetailsActivity.ITEM, mItem);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
MainActivity.this,
((ImageCardView) itemViewHolder.view).getMainImageView(),
DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
MainActivity.this.startActivity(intent, bundle);
}
}
}
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ridsys.example.com.r_home, PID: 14619
java.lang.NoSuchMethodError: No static method getInstance()Landroid/support/v17/leanback/transition/TransitionHelper; in class Landroid/support/v17/leanback/transition/TransitionHelper; or its super classes (declaration of 'android.support.v17.leanback.transition.TransitionHelper' appears in /data/app/ridsys.example.com.r_home-2/split_lib_dependencies_apk.apk)
at com.sgottard.sofa.BaseFragment.(BaseFragment.java:28)
at ridsys.example.com.r_home.DemoActivity.onCreate(DemoActivity.java:68)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5267)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Memory Leak caused by the adapter of the VerticalGridView
The solution is deallocate the adapter in the OnDestroyView method of RowsFragment
getVerticalGridView().setAdapter(null);
in sofa\build.gradle
did you mean?
apply from: '../build.gradle'
awesome work so with Sofa.
I've seen another issue regarding Search Button.
If I use your code for Custom Rows (that means, when useStandardAdapter = false
& useStockBrowseFragment = false
) and If I chose for HEADER_HIDDEN
(browseFragment.setHeadersState(BrowseFragment.HEADERS_HIDDEN)
or browseSupportFragment.setHeadersState(BrowseSupportFragment.HEADERS_HIDDEN))
on Main Screen, after that If I try to hide the Search button on Main Screen by just commenting browseSupportFragment.setOnSearchClickedListener(searchClickListener)
or browseFragment.setOnSearchClickedListener(searchClickListener)
.... then when you run the application, search icon will be focused first & then you can't move to your right side. I mean through remote control, you can't go to the items.
Hi there, I'm trying to put icons left side of the menus. I created a class that extends from RowHeaderPresenter in order to put a leftDrawable to the TextView, but I haven't get it.
I want to set title for each row in category adapter ,how can i do that?
first of all thanks for this brilliant library.
I've a query regarding "setHeadersTransitionOnBackEnabled" functionality. If I use "BrowseFragment" then "setHeadersTransitionOnBackEnabled" (which is by default True) doesn't work. But If I use "BrowseSupportFragment" then "setHeadersTransitionOnBackEnabled" works properly. Can you please describle whats the issue behind this ??? Thanks
mScaleFrameLayout is null when I tried to upgrade the project into com.android.tools.build:gradle:2.1.3
:
mScaleFrameLayout = (ScaleFrameLayout) view.findViewById(R.id.scale_frame);
What is wrong? Thanks.
Log and stack trace
java.lang.IncompatibleClassChangeError: The method 'java.lang.Object android.support.v17.leanback.transition.TransitionHelper.createScene(android.view.ViewGroup, java.lang.Runnable)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.sgottard.sofa.BrowseFragment' appears in /data/data/com.testo.androidtv/files/instant-run/dex/slice-com.github.dextorer-sofa-1.0.0_0335c9765600c53bc126f1578e46b4b7eeaf29a5-classes.dex)
at com.sgottard.sofa.BrowseFragment.onCreateView(BrowseFragment.java:667)
at android.app.Fragment.performCreateView(Fragment.java:2352)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:959)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1149)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1251)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2311)
at android.app.FragmentController.onCreateView(FragmentController.java:98)
at android.app.Activity.onCreateView(Activity.java:5884)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:414)
at android.app.Activity.setContentView(Activity.java:2414)
at sdk.androidtv.testo.MainActivity.onCreate(MainActivity.java:42)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
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)
It seens like they changed TransitionHelper sources in 24th sdk
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.