| | |
| | | package com.duqing.missions.ui.main.dashboard; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProvider; |
| | | |
| | | import com.duqing.missions.MainActivity; |
| | | import com.duqing.missions.base.BaseFragment; |
| | | import com.duqing.missions.databinding.FragmentDashboardBinding; |
| | | |
| | | public class DashboardFragment extends Fragment { |
| | | public class DashboardFragment extends BaseFragment<MainActivity,FragmentDashboardBinding> { |
| | | |
| | | private DashboardViewModel dashboardViewModel; |
| | | private FragmentDashboardBinding binding; |
| | | |
| | | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
| | | @Override |
| | | public void initViews() { |
| | | dashboardViewModel = new ViewModelProvider(this).get(DashboardViewModel.class); |
| | | |
| | | binding = FragmentDashboardBinding.inflate(inflater, container, false); |
| | | View root = binding.getRoot(); |
| | | |
| | | dashboardViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
| | | @Override |
| | | public void onChanged(@Nullable String s) { |
| | | } |
| | | }); |
| | | return root; |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroyView() { |
| | | super.onDestroyView(); |
| | | binding = null; |
| | | } |
| | | } |