@Override public void onResume() { super.onResume(); Call<HomeFeedResponse> timelineResponseCall = ApiManager.getInstance().getService().getHomeFeed(); timelineResponseCall.enqueue( new Callback<HomeFeedResponse>() { @Override public void onResponse(Response<HomeFeedResponse> response, Retrofit retrofit) { if (response.isSuccess()) { if (response.body().getHomeFeedOneModel() != null) { populateRecycler(response.body().getHomeFeedOneModel()); } else { NotesHelpers.toastMessage( context, getResources().getString(R.string.error_something_is_wrong)); } } } @Override public void onFailure(Throwable t) { NotesHelpers.toastMessage( context, getResources().getString(R.string.error_something_is_wrong)); } }); }
@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_core_home, container, false); ButterKnife.bind(this, v); context = getContext(); TAG = getClass().getSimpleName(); Call<HomeFeedResponse> timelineResponseCall = ApiManager.getInstance().getService().getHomeFeed(); timelineResponseCall.enqueue( new Callback<HomeFeedResponse>() { @Override public void onResponse(Response<HomeFeedResponse> response, Retrofit retrofit) { if (response.isSuccess()) { if (response.body().getHomeFeedOneModel() != null) { populateRecycler(response.body().getHomeFeedOneModel()); } else { NotesHelpers.toastMessage( context, getResources().getString(R.string.error_something_is_wrong)); } } else { RetrofitHelper.checkCode(response.code(), context); } } @Override public void onFailure(Throwable t) { NotesHelpers.toastMessage( context, getResources().getString(R.string.error_something_is_wrong)); } }); return v; }