{"action":"created","issue":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/145","repository_url":"https://api.github.com/repos/mikepenz/FastAdapter","labels_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/145/comments","events_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/145/events","html_url":"https://github.com/mikepenz/FastAdapter/issues/145","id":161601273,"number":145,"title":"Reusing Item but with different xml layout in different activities","user":{"login":"stonecold123","id":9678061,"avatar_url":"https://avatars.githubusercontent.com/u/9678061?v=3","gravatar_id":"","url":"https://api.github.com/users/stonecold123","html_url":"https://github.com/stonecold123","followers_url":"https://api.github.com/users/stonecold123/followers","following_url":"https://api.github.com/users/stonecold123/following{/other_user}","gists_url":"https://api.github.com/users/stonecold123/gists{/gist_id}","starred_url":"https://api.github.com/users/stonecold123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stonecold123/subscriptions","organizations_url":"https://api.github.com/users/stonecold123/orgs","repos_url":"https://api.github.com/users/stonecold123/repos","events_url":"https://api.github.com/users/stonecold123/events{/privacy}","received_events_url":"https://api.github.com/users/stonecold123/received_events","type":"User","site_admin":false},"labels":[{"id":304496575,"url":"https://api.github.com/repos/mikepenz/FastAdapter/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":{"login":"mikepenz","id":1476232,"avatar_url":"https://avatars.githubusercontent.com/u/1476232?v=3","gravatar_id":"","url":"https://api.github.com/users/mikepenz","html_url":"https://github.com/mikepenz","followers_url":"https://api.github.com/users/mikepenz/followers","following_url":"https://api.github.com/users/mikepenz/following{/other_user}","gists_url":"https://api.github.com/users/mikepenz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikepenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikepenz/subscriptions","organizations_url":"https://api.github.com/users/mikepenz/orgs","repos_url":"https://api.github.com/users/mikepenz/repos","events_url":"https://api.github.com/users/mikepenz/events{/privacy}","received_events_url":"https://api.github.com/users/mikepenz/received_events","type":"User","site_admin":false},"assignees":[{"login":"mikepenz","id":1476232,"avatar_url":"https://avatars.githubusercontent.com/u/1476232?v=3","gravatar_id":"","url":"https://api.github.com/users/mikepenz","html_url":"https://github.com/mikepenz","followers_url":"https://api.github.com/users/mikepenz/followers","following_url":"https://api.github.com/users/mikepenz/following{/other_user}","gists_url":"https://api.github.com/users/mikepenz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikepenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikepenz/subscriptions","organizations_url":"https://api.github.com/users/mikepenz/orgs","repos_url":"https://api.github.com/users/mikepenz/repos","events_url":"https://api.github.com/users/mikepenz/events{/privacy}","received_events_url":"https://api.github.com/users/mikepenz/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-06-22T06:10:16Z","updated_at":"2016-11-22T14:42:23Z","closed_at":"2016-06-22T06:34:40Z","body":"Hi,\nI want to reuse my `itemAdapter` but I also want to use different layouts in different activities. All of the other layouts' views have the same ids and view types as the original one so it should have no issue with the viewHolder class.\n\nIs there a way to change/otherwrite either `getType()` or `getLayoutRes()` after the GenericItemAdapter class is instantiated in the activity? \nIs there a `itemAdapter.setType(R.id.something)` or `itemAdapter.setLayoutRes(R.layout.something)` to overwrite the value in the ItemAdapter class?\n\nFor example:\n\n```\nGenericItemAdapter<ItemModel, ItemAdapter> itemAdapter = new GenericItemAdapter<>(ItemAdapter.class, ItemModel.class);\n        itemAdapter.setType(R.id.other_argument); //<---- Any method like this to change the type or layout resource? \n        fastAdapter = new FastAdapter();\n        FooterAdapter<FooterView> footerAdapter = new FooterAdapter<>();\n        recyclerView.setAdapter(footerAdapter.wrap(itemAdapter.wrap(fastAdapter)));\n        //......\n```\n\nItemAdapter.class\n\n```\npublic class ItemAdapter extends GenericAbstractItem<ItemModel, ItemAdapter, ItemAdapter.ViewHolder> {\n    private static final ViewHolderFactory<? extends ViewHolder> FACTORY = new ItemFactory();\n\n    public ItemReCyclerFastAdapter(ItemModel itemModel) {\n        super(itemModel);\n    }\n\n    @Override\n    public int getType() {\n        return R.id.recycle; // <--- I want it to be changable.\n    }\n\n    @Override\n    public int getLayoutRes() {\n\n        return R.layout.item_layout; <--- I want it to be changable.\n\n    }\n}\n```\n\nThank you~\n"},"comment":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/comments/262258131","html_url":"https://github.com/mikepenz/FastAdapter/issues/145#issuecomment-262258131","issue_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/145","id":262258131,"user":{"login":"pkozlovskiy","id":1486167,"avatar_url":"https://avatars.githubusercontent.com/u/1486167?v=3","gravatar_id":"","url":"https://api.github.com/users/pkozlovskiy","html_url":"https://github.com/pkozlovskiy","followers_url":"https://api.github.com/users/pkozlovskiy/followers","following_url":"https://api.github.com/users/pkozlovskiy/following{/other_user}","gists_url":"https://api.github.com/users/pkozlovskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/pkozlovskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkozlovskiy/subscriptions","organizations_url":"https://api.github.com/users/pkozlovskiy/orgs","repos_url":"https://api.github.com/users/pkozlovskiy/repos","events_url":"https://api.github.com/users/pkozlovskiy/events{/privacy}","received_events_url":"https://api.github.com/users/pkozlovskiy/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T14:42:23Z","updated_at":"2016-11-22T14:42:23Z","body":"@mikepenz \r\n\"You must not change the layout during runtime in one activity\"\r\nBut how can I change layout of the Item, whan I change LayoutManager of RecyclerView(the useful case with List/Grid switcher)?"}}
{"actor":{"display_login":"pkozlovskiy"}}