1
1
package org.mifos.mobilewallet.mifospay.faq.ui
2
2
3
3
import android.os.Bundle
4
- import android.widget.ExpandableListView
5
- import org.mifos.mobilewallet.mifospay.R
4
+ import androidx.activity.compose.setContent
6
5
import org.mifos.mobilewallet.mifospay.base.BaseActivity
7
- import org.mifos.mobilewallet.mifospay.faq.FAQContract
8
- import org.mifos.mobilewallet.mifospay.faq.FAQContract.FAQView
9
- import org.mifos.mobilewallet.mifospay.faq.FAQListAdapter
10
- import org.mifos.mobilewallet.mifospay.faq.presenter.FAQPresenter
11
- import org.mifos.mobilewallet.mifospay.utils.Constants
12
- import javax.inject.Inject
6
+ import org.mifos.mobilewallet.mifospay.theme.MifosTheme
13
7
14
8
/* *
15
9
* This class is the UI component of the Architecture.
16
10
*
17
11
* @author ankur
18
12
* @since 11/July/2018
19
13
*/
20
- class FAQActivity : BaseActivity (), FAQView {
21
- @JvmField
22
- @Inject
23
- var mPresenter: FAQPresenter ? = null
24
- private var mFAQPresenter: FAQContract .FAQPresenter ? = null
25
- private var expandableListView: ExpandableListView ? = null
26
- private var faqListAdapter: FAQListAdapter ? = null
27
- private var listDataGroup: MutableList <String >? = null
28
- private var listDataChild: HashMap <String , List <String >>? = null
29
- override fun onCreate (savedInstanceState : Bundle ? ) {
30
- super .onCreate(savedInstanceState)
31
- setContentView(R .layout.activity_faq)
32
- showColoredBackButton(Constants .BLACK_BACK_BUTTON )
33
- setToolbarTitle(Constants .FAQ )
34
-
35
- // initializing the views
36
- initViews()
37
-
38
- // initializing the objects
39
- initObjects()
40
-
41
- // preparing list data
42
- initListData()
43
- }
44
-
45
- override fun setPresenter (presenter : FAQContract .FAQPresenter ? ) {
46
- mFAQPresenter = presenter
47
- }
48
-
49
- /* *
50
- * Method to initialize the views
51
- */
52
- override fun initViews () {
53
- expandableListView = findViewById(R .id.faq_list)
54
- }
55
-
56
- /* *
57
- * Method to initialize the objects
58
- */
59
- override fun initObjects () {
60
14
61
- // initializing the list of groups
62
- listDataGroup = ArrayList ()
15
+ class FAQActivity : BaseActivity () {
63
16
64
- // initializing the list of child
65
- listDataChild = HashMap ()
66
-
67
- // initializing the adapter object
68
- faqListAdapter = FAQListAdapter (this , listDataGroup as ArrayList <String >, listDataChild!! )
69
-
70
- // setting list adapter
71
- expandableListView?.setAdapter(faqListAdapter)
72
- }
73
-
74
- /* *
75
- * Preparing the list data
76
- * Dummy Items
77
- */
78
- override fun initListData () {
79
-
80
-
81
- // Adding group data
82
- listDataGroup?.add(getString(R .string.question1))
83
- listDataGroup?.add(getString(R .string.question2))
84
- listDataGroup?.add(getString(R .string.question3))
85
- listDataGroup?.add(getString(R .string.question4))
86
-
87
- // list of alcohol
88
- val question1List: MutableList <String > = ArrayList ()
89
- question1List.add(getString(R .string.answer1))
90
-
91
- // list of coffee
92
- val question2List: MutableList <String > = ArrayList ()
93
- question2List.add(getString(R .string.answer2))
94
-
95
- // list of pasta
96
- val question3List: MutableList <String > = ArrayList ()
97
- question3List.add(getString(R .string.answer3))
98
-
99
-
100
- // list of cold drinks
101
- val question4List: MutableList <String > = ArrayList ()
102
- question4List.add(getString(R .string.answer4))
103
-
104
-
105
- // Adding child data
106
- listDataChild!! [listDataGroup!! [0 ]] = question1List
107
- listDataChild!! [listDataGroup!! [1 ]] = question2List
108
- listDataChild!! [listDataGroup!! [2 ]] = question3List
109
- listDataChild!! [listDataGroup!! [3 ]] = question4List
110
-
111
- // notify the adapter
112
- faqListAdapter?.notifyDataSetChanged()
17
+ override fun onCreate (savedInstanceState : Bundle ? ) {
18
+ super .onCreate(savedInstanceState)
19
+ setContent {
20
+ MifosTheme {
21
+ FaqScreen (
22
+ navigateBack = { onBackPressedDispatcher.onBackPressed() }
23
+ )
24
+ }
25
+ }
113
26
}
114
27
}
0 commit comments