AboutFragment.java 2.1 KB
Newer Older
A
amitshekhariitbhu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 *  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;

19
import android.arch.lifecycle.ViewModelProviders;
L
Lam Tran 已提交
20 21
import android.os.Bundle;
import android.support.annotation.Nullable;
22
import com.mindorks.framework.mvvm.BR;
A
amitshekhariitbhu 已提交
23
import com.mindorks.framework.mvvm.R;
24
import com.mindorks.framework.mvvm.ViewModelProviderFactory;
A
amitshekhariitbhu 已提交
25 26 27 28 29 30 31 32
import com.mindorks.framework.mvvm.databinding.FragmentAboutBinding;
import com.mindorks.framework.mvvm.ui.base.BaseFragment;
import javax.inject.Inject;

/**
 * Created by amitshekhar on 09/07/17.
 */

33 34
public class AboutFragment extends BaseFragment<FragmentAboutBinding, AboutViewModel> implements
    AboutNavigator {
A
amitshekhariitbhu 已提交
35

36 37 38
  public static final String TAG = AboutFragment.class.getSimpleName();
  @Inject
  ViewModelProviderFactory factory;
J
Jyoti Dubey 已提交
39
  private AboutViewModel mAboutViewModel;
L
Lam Tran 已提交
40

41 42 43 44 45 46
  public static AboutFragment newInstance() {
    Bundle args = new Bundle();
    AboutFragment fragment = new AboutFragment();
    fragment.setArguments(args);
    return fragment;
  }
L
Lam Tran 已提交
47

48 49 50 51
  @Override
  public int getBindingVariable() {
    return BR.viewModel;
  }
L
Lam Tran 已提交
52

53 54 55 56
  @Override
  public int getLayoutId() {
    return R.layout.fragment_about;
  }
L
Lam Tran 已提交
57

58 59 60 61 62
  @Override
  public AboutViewModel getViewModel() {
    mAboutViewModel = ViewModelProviders.of(this, factory).get(AboutViewModel.class);
    return mAboutViewModel;
  }
L
Lam Tran 已提交
63

64 65 66 67
  @Override
  public void goBack() {
    getBaseActivity().onFragmentDetached(TAG);
  }
L
Lam Tran 已提交
68

69 70 71 72 73
  @Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mAboutViewModel.setNavigator(this);
  }
A
amitshekhariitbhu 已提交
74
}