clean up build-gradle
* remove unused dependencies
This commit is contained in:
		| @ -4,29 +4,22 @@ import android.os.Bundle | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.widget.TextView | ||||
| import androidx.fragment.app.Fragment | ||||
| import androidx.lifecycle.Observer | ||||
| import androidx.lifecycle.ViewModelProviders | ||||
| import kotlinx.android.synthetic.main.fragment_home.* | ||||
| import org.mosad.teapod.R | ||||
|  | ||||
| class HomeFragment : Fragment() { | ||||
|  | ||||
|     private lateinit var homeViewModel: HomeViewModel | ||||
|  | ||||
|     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||||
|         homeViewModel = ViewModelProviders.of(this).get(HomeViewModel::class.java) | ||||
|         val root = inflater.inflate(R.layout.fragment_home, container, false) | ||||
|         val textView: TextView = root.findViewById(R.id.text_home) | ||||
|         homeViewModel.text.observe(viewLifecycleOwner, Observer { | ||||
|             textView.text = it | ||||
|         }) | ||||
|         return root | ||||
|         return inflater.inflate(R.layout.fragment_home, container, false) | ||||
|     } | ||||
|  | ||||
|     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||
|         super.onViewCreated(view, savedInstanceState) | ||||
|  | ||||
|         text_home.text = "This is the home fragment" | ||||
|  | ||||
|         println("HomeFragment created") | ||||
|     } | ||||
| } | ||||
| @ -1,13 +0,0 @@ | ||||
| package org.mosad.teapod.ui.home | ||||
|  | ||||
| import androidx.lifecycle.LiveData | ||||
| import androidx.lifecycle.MutableLiveData | ||||
| import androidx.lifecycle.ViewModel | ||||
|  | ||||
| class HomeViewModel : ViewModel() { | ||||
|  | ||||
|     private val _text = MutableLiveData<String>().apply { | ||||
|         value = "This is the home Fragment" | ||||
|     } | ||||
|     val text: LiveData<String> = _text | ||||
| } | ||||
| @ -4,28 +4,18 @@ import android.os.Bundle | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.widget.TextView | ||||
| import androidx.fragment.app.Fragment | ||||
| import androidx.lifecycle.Observer | ||||
| import androidx.lifecycle.ViewModelProviders | ||||
| import kotlinx.android.synthetic.main.fragment_search.* | ||||
| import org.mosad.teapod.R | ||||
|  | ||||
| class SearchFragment : Fragment() { | ||||
|  | ||||
|     private lateinit var notificationsViewModel: SearchViewModel | ||||
|     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||||
|         return inflater.inflate(R.layout.fragment_search, container, false) | ||||
|     } | ||||
|  | ||||
|     override fun onCreateView( | ||||
|             inflater: LayoutInflater, | ||||
|             container: ViewGroup?, | ||||
|             savedInstanceState: Bundle? | ||||
|     ): View? { | ||||
|         notificationsViewModel = | ||||
|                 ViewModelProviders.of(this).get(SearchViewModel::class.java) | ||||
|         val root = inflater.inflate(R.layout.fragment_search, container, false) | ||||
|         val textView: TextView = root.findViewById(R.id.text_notifications) | ||||
|         notificationsViewModel.text.observe(viewLifecycleOwner, Observer { | ||||
|             textView.text = it | ||||
|         }) | ||||
|         return root | ||||
|     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||
|         super.onViewCreated(view, savedInstanceState) | ||||
|         text_search.text = "This is the search Fragment" | ||||
|     } | ||||
| } | ||||
| @ -1,13 +0,0 @@ | ||||
| package org.mosad.teapod.ui.search | ||||
|  | ||||
| import androidx.lifecycle.LiveData | ||||
| import androidx.lifecycle.MutableLiveData | ||||
| import androidx.lifecycle.ViewModel | ||||
|  | ||||
| class SearchViewModel : ViewModel() { | ||||
|  | ||||
|     private val _text = MutableLiveData<String>().apply { | ||||
|         value = "This is the search Fragment" | ||||
|     } | ||||
|     val text: LiveData<String> = _text | ||||
| } | ||||
| @ -8,7 +8,7 @@ | ||||
|     tools:context=".ui.search.SearchFragment"> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/text_notifications" | ||||
|         android:id="@+id/text_search" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="8dp" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user