dextorer / Sofa

A library for Android TV that extends the Leanback library functionalities
Other
148 stars 34 forks source link

Browse Fragment On Back Reloads all Fragment #10

Open indieocean opened 8 years ago

indieocean commented 8 years ago

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);
            }
        }
    }
philipgiuliani commented 8 years ago

Hi i have the same issue i think and opened an issue some days ago: https://github.com/dextorer/Sofa/issues/9 Its so bad :(

dextorer commented 8 years ago

I haven't had the time to look into issues in these months, as I'm pretty busy with work/other projects. Any chance you can submit a PR?