/* * Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://mindorks.com/license/apache-v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.mindorks.framework.mvvm.ui.about; import android.os.Bundle; import android.support.annotation.Nullable; import com.mindorks.framework.mvvm.BR; import com.mindorks.framework.mvvm.R; import com.mindorks.framework.mvvm.databinding.FragmentAboutBinding; import com.mindorks.framework.mvvm.di.component.ActivityComponent; import com.mindorks.framework.mvvm.ui.base.BaseFragment; import javax.inject.Inject; /** * Created by amitshekhar on 09/07/17. */ public class AboutFragment extends BaseFragment implements AboutNavigator { public static final String TAG = "AboutFragment"; @Inject AboutViewModel mAboutViewModel; public static AboutFragment newInstance() { Bundle args = new Bundle(); AboutFragment fragment = new AboutFragment(); fragment.setArguments(args); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); performDependencyInjection(); mAboutViewModel.setNavigator(this); } @Override public AboutViewModel getViewModel() { return mAboutViewModel; } @Override public int getBindingVariable() { return BR.viewModel; } @Override public int getLayoutId() { return R.layout.fragment_about; } @Override public void goBack() { getBaseActivity().onFragmentDetached(TAG); } @Override public void onDestroyView() { mAboutViewModel.onDestroy(); super.onDestroyView(); } private void performDependencyInjection(){ ActivityComponent component = getActivityComponent(); if (getActivityComponent() != null) { component.inject(this); } } }