Commit fa6ec363 authored by shohboz's avatar shohboz

[ADD] MUS-217 Feature, added service tarifes screen

parent e2d10b51
package com.mobiuz.app.dev.ui.service.tarifes
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProvider
import com.google.android.material.tabs.TabLayoutMediator
import com.mobiuz.app.R
import com.mobiuz.app.databinding.FragmentTarifsBinding
import com.mobiuz.app.dev.MainViewModel
import com.mobiuz.app.dev.ui.base.BaseFragment
import com.mobiuz.app.dev.ui.service.FragmentPagerAdapter
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class TariffsFragment : BaseFragment(R.layout.fragment_tarifs) {
private lateinit var mainViewModel: MainViewModel
private var _bn: FragmentTarifsBinding? = null
private val bn get() = _bn ?: throw NullPointerException("cannot inflate")
private lateinit var adapter : FragmentPagerAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mainViewModel = ViewModelProvider(requireActivity())[MainViewModel::class.java]
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
_bn = FragmentTarifsBinding.bind(view)
adapter = FragmentPagerAdapter(this, arrayListOf("",""))
setUpUI()
collects()
}
override fun setUpUI() {
bn.apply {
viewPager.adapter = adapter
toolbar.setNavigationOnClickListener {
requireActivity().finish()
}
TabLayoutMediator(bn.tabLayout,bn.viewPager){tab,pos->
if(pos == 0){
tab.text = "Активные"
}else{
tab.text = "Годовые"
}
}.attach()
}
}
override fun collects() {
}
override fun onDestroy() {
_bn = null
super.onDestroy()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white100"
app:navigationIcon="@drawable/ic_baseline_arrow_back"
app:title="@string/tariffs" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white100"
app:tabIndicatorColor="@color/primary100"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/primary100"
app:tabTextColor="@color/grey70" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true"
android:layout_height="84dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/ServicesTextStyle"
android:text="проверка баланса" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*100#"
android:textColor="@color/grey80"
/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_keyboard_arrow_right" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"/>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment