RateUsDialog.java 2.4 KB
Newer Older
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.main.rating;

19
import android.arch.lifecycle.ViewModelProviders;
20 21
import android.databinding.DataBindingUtil;
import android.os.Bundle;
L
Lam Tran 已提交
22
import android.support.annotation.NonNull;
23 24 25 26
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
L
Lam Tran 已提交
27
import com.mindorks.framework.mvvm.R;
28
import com.mindorks.framework.mvvm.ViewModelProviderFactory;
L
Lam Tran 已提交
29 30
import com.mindorks.framework.mvvm.databinding.DialogRateUsBinding;
import com.mindorks.framework.mvvm.ui.base.BaseDialog;
31
import dagger.android.support.AndroidSupportInjection;
32
import javax.inject.Inject;
33

34 35 36 37 38 39
/**
 * Created by amitshekhar on 10/07/17.
 */

public class RateUsDialog extends BaseDialog implements RateUsCallback {

40 41 42
  private static final String TAG = RateUsDialog.class.getSimpleName();
  @Inject
  ViewModelProviderFactory factory;
J
Jyoti Dubey 已提交
43
  private RateUsViewModel mRateUsViewModel;
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

  public static RateUsDialog newInstance() {
    RateUsDialog fragment = new RateUsDialog();
    Bundle bundle = new Bundle();
    fragment.setArguments(bundle);
    return fragment;
  }

  @Override
  public void dismissDialog() {
    dismissDialog(TAG);
  }

  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    DialogRateUsBinding binding = DataBindingUtil
        .inflate(inflater, R.layout.dialog_rate_us, container, false);
    View view = binding.getRoot();

    AndroidSupportInjection.inject(this);
    mRateUsViewModel = ViewModelProviders.of(this, factory).get(RateUsViewModel.class);
    binding.setViewModel(mRateUsViewModel);

    mRateUsViewModel.setNavigator(this);

    return view;
  }

  public void show(FragmentManager fragmentManager) {
    super.show(fragmentManager, TAG);
  }
76
}