Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
shunchaki
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shohboz Qoraboev
shunchaki
Commits
5282610d
Commit
5282610d
authored
Dec 13, 2021
by
shohboz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD]
MUS-215
Feature, added service minutes and sms screen
parent
e577934a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
226 additions
and
0 deletions
+226
-0
ActionAdapter.kt
.../main/java/com/mobiuz/app/dev/ui/service/ActionAdapter.kt
+44
-0
ActionFragment.kt
...main/java/com/mobiuz/app/dev/ui/service/ActionFragment.kt
+53
-0
FragmentPagerAdapter.kt
...ava/com/mobiuz/app/dev/ui/service/FragmentPagerAdapter.kt
+12
-0
MinutesFragment.kt
.../com/mobiuz/app/dev/ui/service/minutes/MinutesFragment.kt
+61
-0
fragment_action.xml
app/src/main/res/layout/fragment_action.xml
+18
-0
fragment_minutes.xml
app/src/main/res/layout/fragment_minutes.xml
+38
-0
No files found.
app/src/main/java/com/mobiuz/app/dev/ui/service/ActionAdapter.kt
0 → 100644
View file @
5282610d
package
com.mobiuz.app.dev.ui.service
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView
import
com.mobiuz.app.databinding.ItemActionBinding
import
com.mobiuz.app.databinding.ItemUssdBinding
import
com.mobiuz.app.dev.model.PinData
import
com.mobiuz.app.dev.utils.extensions.SingleBlock
class
ActionAdapter
:
RecyclerView
.
Adapter
<
ActionAdapter
.
VHolder
>()
{
private
val
list
:
ArrayList
<
PinData
>
by
lazy
{
ArrayList
()
}
private
var
listener
:
SingleBlock
<
String
>?
=
null
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
VHolder
{
return
VHolder
(
ItemActionBinding
.
inflate
(
LayoutInflater
.
from
(
parent
.
context
)))
}
override
fun
onBindViewHolder
(
holder
:
VHolder
,
position
:
Int
)
=
holder
.
bind
(
position
)
override
fun
getItemCount
()
=
16
inner
class
VHolder
(
private
val
binding
:
ItemActionBinding
)
:
RecyclerView
.
ViewHolder
(
binding
.
root
)
{
fun
bind
(
position
:
Int
)
{
itemView
.
setOnClickListener
{
listener
?.
invoke
(
""
)
}
// val d = list[position]
// binding.imagePin.setImageResource(if (d.count == -1) R.drawable.ic_pin_unchecked else R.drawable.ic_pin_checked)
}
}
fun
submitList
(
ls
:
List
<
PinData
>)
{
list
.
clear
()
list
.
addAll
(
ls
)
notifyDataSetChanged
()
}
fun
setOnClickListener
(
block
:
SingleBlock
<
String
>)
{
listener
=
block
}
}
\ No newline at end of file
app/src/main/java/com/mobiuz/app/dev/ui/service/ActionFragment.kt
0 → 100644
View file @
5282610d
package
com.mobiuz.app.dev.ui.service
import
android.os.Bundle
import
android.view.View
import
androidx.lifecycle.ViewModelProvider
import
com.mobiuz.app.R
import
com.mobiuz.app.databinding.FragmentActionBinding
import
com.mobiuz.app.databinding.FragmentMainUssdBinding
import
com.mobiuz.app.dev.MainViewModel
import
com.mobiuz.app.dev.ui.base.BaseFragment
import
dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class
ActionFragment
:
BaseFragment
(
R
.
layout
.
fragment_action
)
{
private
lateinit
var
mainViewModel
:
MainViewModel
private
var
_bn
:
FragmentActionBinding
?
=
null
private
val
bn
get
()
=
_bn
?:
throw
NullPointerException
(
"cannot inflate"
)
private
val
adapter
=
ActionAdapter
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
mainViewModel
=
ViewModelProvider
(
requireActivity
())[
MainViewModel
::
class
.
java
]
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
_bn
=
FragmentActionBinding
.
bind
(
view
)
setUpUI
()
collects
()
}
override
fun
setUpUI
()
{
bn
.
apply
{
rvUssdCommand
.
adapter
=
adapter
adapter
.
setOnClickListener
{
val
dialog
=
UssdBottomSheetDialog
(
UssdData
(
"Переход на тариф"
,
"Mobi 20"
,
"*111*120#"
,
"Перейти"
))
dialog
.
show
(
childFragmentManager
,
"tag"
)
}
}
}
override
fun
collects
()
{
}
override
fun
onDestroy
()
{
_bn
=
null
super
.
onDestroy
()
}
}
\ No newline at end of file
app/src/main/java/com/mobiuz/app/dev/ui/service/FragmentPagerAdapter.kt
0 → 100644
View file @
5282610d
package
com.mobiuz.app.dev.ui.service
import
androidx.fragment.app.Fragment
import
androidx.viewpager2.adapter.FragmentStateAdapter
class
FragmentPagerAdapter
(
fragment
:
Fragment
,
private
val
list
:
List
<
String
>):
FragmentStateAdapter
(
fragment
)
{
override
fun
getItemCount
()
=
list
.
size
override
fun
createFragment
(
position
:
Int
):
Fragment
{
return
ActionFragment
()
}
}
\ No newline at end of file
app/src/main/java/com/mobiuz/app/dev/ui/service/minutes/MinutesFragment.kt
0 → 100644
View file @
5282610d
package
com.mobiuz.app.dev.ui.service.minutes
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.FragmentMinutesBinding
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
MinutesFragment
:
BaseFragment
(
R
.
layout
.
fragment_minutes
)
{
private
lateinit
var
mainViewModel
:
MainViewModel
private
var
_bn
:
FragmentMinutesBinding
?
=
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
=
FragmentMinutesBinding
.
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
=
"SMS"
}
}.
attach
()
}
}
override
fun
collects
()
{
}
override
fun
onDestroy
()
{
_bn
=
null
super
.
onDestroy
()
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_action.xml
0 → 100644
View file @
5282610d
<?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"
xmlns:tools=
"http://schemas.android.com/tools"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
android:layout_width=
"match_parent"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:id=
"@+id/rv_ussd_command"
android:layout_marginHorizontal=
"12dp"
tools:listitem=
"@layout/item_ussd"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_minutes.xml
0 → 100644
View file @
5282610d
<?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/minutes_and_sms"
/>
<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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment