@@ -27,15 +27,15 @@ import org.mifos.mobile.cn.ui.mifos.customerAccounts.CustomerAccountFragment
27
27
import org.mifos.mobile.cn.ui.mifos.loanApplication.loanActivity.LoanApplicationActivity
28
28
import org.mifos.mobile.cn.ui.mifos.products.ProductFragment
29
29
import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragment
30
- import org.mifos.mobile.cn.ui.mifos.settings.SettingsFragment
31
30
import org.mifos.mobile.cn.ui.utils.CircularImageView
32
31
import org.mifos.mobile.cn.ui.utils.Toaster
33
32
import android.widget.Toast
33
+ import org.mifos.mobile.cn.ui.mifos.settings.SettingActivity
34
34
35
35
class DashboardActivity : MifosBaseActivity (), View.OnClickListener, NavigationView.OnNavigationItemSelectedListener {
36
36
37
- @Inject
38
- internal lateinit var preferencesHelper: PreferencesHelper
37
+ // @Inject
38
+ // internal lateinit var preferencesHelper: PreferencesHelper
39
39
40
40
private lateinit var tvUsername: TextView
41
41
private lateinit var ivCircularUserProfilePicture: CircularImageView
@@ -60,24 +60,24 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
60
60
/* *
61
61
* Asks users to confirm whether he want to logout or not
62
62
*/
63
- private fun showLogoutDialog () {
64
- MaterialDialog .Builder ().init (this )
65
- .setMessage(R .string.dialog_logout)
66
- .setPositiveButton(getString(R .string.logout),
67
- DialogInterface .OnClickListener { dialog, which ->
68
- preferencesHelper.clear()
69
- val intent = Intent (this , LoginActivity ::class .java)
70
- intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK or Intent .FLAG_ACTIVITY_CLEAR_TASK
71
- startActivity(intent)
72
- finish()
73
- // Show successful logout Toast.
74
- Toast .makeText(applicationContext, " Logged Out Successfully" , Toast .LENGTH_SHORT ).show()
75
- })
76
- .setNegativeButton(getString(R .string.cancel),
77
- DialogInterface .OnClickListener { dialog, which -> setNavigationViewSelectedItem(R .id.item_home) })
78
- .createMaterialDialog()
79
- .show()
80
- }
63
+ // private fun showLogoutDialog() {
64
+ // MaterialDialog.Builder().init(this)
65
+ // .setMessage(R.string.dialog_logout)
66
+ // .setPositiveButton(getString(R.string.logout),
67
+ // DialogInterface.OnClickListener { dialog, which ->
68
+ // preferencesHelper.clear()
69
+ // val intent = Intent(this, LoginActivity::class.java)
70
+ // intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
71
+ // startActivity(intent)
72
+ // finish()
73
+ // //Show successful logout Toast.
74
+ // Toast.makeText(applicationContext, "Logged Out Successfully", Toast.LENGTH_SHORT).show()
75
+ // })
76
+ // .setNegativeButton(getString(R.string.cancel),
77
+ // DialogInterface.OnClickListener { dialog, which -> setNavigationViewSelectedItem(R.id.item_home) })
78
+ // .createMaterialDialog()
79
+ // .show()
80
+ // }
81
81
82
82
83
83
private fun setNavigationViewSelectedItem (id : Int ) {
@@ -163,31 +163,28 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
163
163
replaceFragment(DashboardFragment .newInstance(), true , R .id.container)
164
164
}
165
165
R .id.item_accounts -> {
166
- replaceFragment(CustomerAccountFragment .newInstance(AccountType .DEPOSIT ), true ,
167
- R .id.container)
168
- }
169
- R .id.item_logout -> {
170
- showLogoutDialog()
166
+ replaceFragment(
167
+ CustomerAccountFragment .newInstance(AccountType .DEPOSIT ), true ,
168
+ R .id.container
169
+ )
171
170
}
171
+
172
172
R .id.item_product -> {
173
- replaceFragment(ProductFragment .Companion .newInstance(), true ,
174
- R .id.container)
173
+ replaceFragment(
174
+ ProductFragment .Companion .newInstance(), true ,
175
+ R .id.container
176
+ )
175
177
}
176
- R .id.item_recent_transactions -> {
177
- replaceFragment(RecentTransactionsFragment .Companion .newInstance(),true ,R .id.container)
178
- }
179
- R .id.item_about_us -> {
180
- showAboutUs()
178
+ R .id.item_recent_transactions -> {
179
+ replaceFragment(
180
+ RecentTransactionsFragment .Companion .newInstance(),
181
+ true ,
182
+ R .id.container
183
+ )
181
184
}
185
+
182
186
R .id.item_settings -> {
183
- replaceFragment(SettingsFragment .newInstance(), true , R .id.container)
184
- }
185
- R .id.item_share -> {
186
- val sharingIntent = Intent (android.content.Intent .ACTION_SEND )
187
- sharingIntent.type = " text/plain"
188
- sharingIntent.putExtra(android.content.Intent .EXTRA_SUBJECT , getString(R .string.app_link))
189
- sharingIntent.putExtra(android.content.Intent .EXTRA_TEXT , getString(R .string.share_message))
190
- startActivity(Intent .createChooser(sharingIntent, getString(R .string.share_the_app_link)))
187
+ settingClicked()
191
188
}
192
189
}
193
190
// close the drawer
@@ -220,8 +217,8 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
220
217
super .onBackPressed()
221
218
}
222
219
}
223
- fun showAboutUs () {
224
- val intent = Intent (this , AboutUsActivity ::class .java)
220
+ fun settingClicked () {
221
+ val intent = Intent (this , SettingActivity ::class .java)
225
222
startActivity(intent)
226
223
}
227
224
0 commit comments