Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix#211 help feature doesn't work #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'com.android.application'
apply from: '../config/quality/quality.gradle'
//apply from: '../config/quality/quality.gradle'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
//apply plugin: 'com.google.android.gms.oss-licenses-plugin'

android {
compileSdkVersion 28
Expand All @@ -15,6 +15,7 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {

Expand Down
50 changes: 28 additions & 22 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mifos.mobile.cn">
package="org.mifos.mobile.cn">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".MifosApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MifosApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.mifos.launcher.LauncherActivity"
<activity
android:name=".ui.mifos.help.HelpActivity"
android:exported="false" />
<activity
android:name=".ui.mifos.launcher.LauncherActivity"
android:theme="@style/LauncherTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".ui.mifos.DashboardActivity" />
<activity android:name=".ui.mifos.login.LoginActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mifos.passcode.PasscodeActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mifos.loanApplication.loanActivity.LoanApplicationActivity"/>
<activity android:name=".ui.mifos.customerDetails.CustomerDetailsActivity"/>
<activity android:name=".ui.mifos.customerActivities.CustomerActivitiesActivity"/>
<activity android:name=".ui.mifos.identificationlist.IdentificationsActivity"/>
<activity android:name=".ui.mifos.viewScanCard.ViewScanCardActivity"/>
<activity android:name=".ui.mifos.customerProfile.CustomerProfileActivity"/>
<activity android:name=".ui.mifos.plannedPlayment.PlannedPaymentActivity"/>
<activity android:name=".ui.mifos.debtincomereport.DebtIncomeReportActivity"/>
<activity android:name=".ui.mifos.aboutus.AboutUsActivity"/>
<activity android:name=".ui.mifos.privacypolicy.PrivacyPolicyActivity"/>
<activity
android:name=".ui.mifos.login.LoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mifos.passcode.PasscodeActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.mifos.settings.SettingActivity" />
<activity android:name=".ui.mifos.loanApplication.loanActivity.LoanApplicationActivity" />
<activity android:name=".ui.mifos.customerDetails.CustomerDetailsActivity" />
<activity android:name=".ui.mifos.customerActivities.CustomerActivitiesActivity" />
<activity android:name=".ui.mifos.identificationlist.IdentificationsActivity" />
<activity android:name=".ui.mifos.viewScanCard.ViewScanCardActivity" />
<activity android:name=".ui.mifos.customerProfile.CustomerProfileActivity" />
<activity android:name=".ui.mifos.plannedPlayment.PlannedPaymentActivity" />
<activity android:name=".ui.mifos.debtincomereport.DebtIncomeReportActivity" />
<activity android:name=".ui.mifos.aboutus.AboutUsActivity" />
<activity android:name=".ui.mifos.privacypolicy.PrivacyPolicyActivity" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.mifos.mobile.cn.ui.mifos.loanApplication.loanActivity.LoanApplication
import org.mifos.mobile.cn.ui.mifos.loanApplication.loanDetails.LoanDetailsFragment
import org.mifos.mobile.cn.ui.mifos.customerLoanDetails.CustomerLoanDetailsFragment
import org.mifos.mobile.cn.ui.mifos.debtincomereport.DebtIncomeReportFragment
import org.mifos.mobile.cn.ui.mifos.help.HelpFragment
import org.mifos.mobile.cn.ui.mifos.login.LoginActivity
import org.mifos.mobile.cn.ui.mifos.passcode.PasscodeActivity
import org.mifos.mobile.cn.ui.mifos.plannedPlayment.PlannedPaymentFragment
Expand Down Expand Up @@ -78,4 +79,6 @@ interface ActivityComponent {
fun inject(customerDepositDetailsFragment: CustomerDepositDetailsFragment)

fun inject(aboutUsFragment: AboutUsFragment)

fun inject(helpFragment: HelpFragment)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import org.mifos.mobile.cn.ui.mifos.customerAccounts.CustomerAccountFragment
import org.mifos.mobile.cn.ui.mifos.loanApplication.loanActivity.LoanApplicationActivity
import org.mifos.mobile.cn.ui.mifos.products.ProductFragment
import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragment
import org.mifos.mobile.cn.ui.mifos.settings.SettingsFragment
import org.mifos.mobile.cn.ui.utils.CircularImageView
import org.mifos.mobile.cn.ui.utils.Toaster
import android.widget.Toast
import org.mifos.mobile.cn.ui.mifos.settings.SettingActivity

class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationView.OnNavigationItemSelectedListener {

@Inject
internal lateinit var preferencesHelper: PreferencesHelper
// @Inject
// internal lateinit var preferencesHelper: PreferencesHelper

private lateinit var tvUsername: TextView
private lateinit var ivCircularUserProfilePicture: CircularImageView
Expand All @@ -60,24 +60,24 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
/**
* Asks users to confirm whether he want to logout or not
*/
private fun showLogoutDialog() {
MaterialDialog.Builder().init(this)
.setMessage(R.string.dialog_logout)
.setPositiveButton(getString(R.string.logout),
DialogInterface.OnClickListener { dialog, which ->
preferencesHelper.clear()
val intent = Intent(this, LoginActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(intent)
finish()
//Show successful logout Toast.
Toast.makeText(applicationContext, "Logged Out Successfully", Toast.LENGTH_SHORT).show()
})
.setNegativeButton(getString(R.string.cancel),
DialogInterface.OnClickListener { dialog, which -> setNavigationViewSelectedItem(R.id.item_home) })
.createMaterialDialog()
.show()
}
// private fun showLogoutDialog() {
// MaterialDialog.Builder().init(this)
// .setMessage(R.string.dialog_logout)
// .setPositiveButton(getString(R.string.logout),
// DialogInterface.OnClickListener { dialog, which ->
// preferencesHelper.clear()
// val intent = Intent(this, LoginActivity::class.java)
// intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
// startActivity(intent)
// finish()
// //Show successful logout Toast.
// Toast.makeText(applicationContext, "Logged Out Successfully", Toast.LENGTH_SHORT).show()
// })
// .setNegativeButton(getString(R.string.cancel),
// DialogInterface.OnClickListener { dialog, which -> setNavigationViewSelectedItem(R.id.item_home) })
// .createMaterialDialog()
// .show()
// }


private fun setNavigationViewSelectedItem(id: Int) {
Expand Down Expand Up @@ -163,31 +163,28 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
replaceFragment(DashboardFragment.newInstance(), true, R.id.container)
}
R.id.item_accounts -> {
replaceFragment(CustomerAccountFragment.newInstance(AccountType.DEPOSIT), true,
R.id.container)
}
R.id.item_logout -> {
showLogoutDialog()
replaceFragment(
CustomerAccountFragment.newInstance(AccountType.DEPOSIT), true,
R.id.container
)
}

R.id.item_product -> {
replaceFragment(ProductFragment.Companion.newInstance(), true,
R.id.container)
replaceFragment(
ProductFragment.Companion.newInstance(), true,
R.id.container
)
}
R.id.item_recent_transactions -> {
replaceFragment(RecentTransactionsFragment.Companion.newInstance(),true,R.id.container)
}
R.id.item_about_us -> {
showAboutUs()
R.id.item_recent_transactions -> {
replaceFragment(
RecentTransactionsFragment.Companion.newInstance(),
true,
R.id.container
)
}

R.id.item_settings -> {
replaceFragment(SettingsFragment.newInstance(), true, R.id.container)
}
R.id.item_share -> {
val sharingIntent = Intent(android.content.Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.app_link))
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.share_message))
startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_the_app_link)))
settingClicked()
}
}
// close the drawer
Expand Down Expand Up @@ -220,8 +217,8 @@ class DashboardActivity : MifosBaseActivity(), View.OnClickListener, NavigationV
super.onBackPressed()
}
}
fun showAboutUs(){
val intent = Intent(this, AboutUsActivity::class.java)
fun settingClicked() {
val intent = Intent(this, SettingActivity::class.java)
startActivity(intent)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup
import com.github.therajanmaurya.sweeterror.SweetUIErrorHandler
import kotlinx.android.synthetic.main.fragment_accounts.*
import kotlinx.android.synthetic.main.layout_exception_handler.*
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.accounts.deposit.DepositAccount
import org.mifos.mobile.cn.data.models.accounts.loan.LoanAccount
Expand All @@ -19,7 +20,6 @@ import org.mifos.mobile.cn.ui.base.MifosBaseFragment
import org.mifos.mobile.cn.ui.utils.ConstantKeys
import org.mifos.mobile.cn.ui.utils.Network
import javax.inject.Inject
import kotlinx.android.synthetic.main.layout_sweet_exception_handler.*
import org.mifos.mobile.cn.data.models.CheckboxStatus
import org.mifos.mobile.cn.ui.base.OnItemClickListener
import org.mifos.mobile.cn.ui.mifos.customerDepositDetails.CustomerDepositDetailsFragment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.mifos.mobile.cn.ui.mifos.help

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.ui.base.MifosBaseActivity

class HelpActivity : MifosBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_toolbar_container)

setToolbarTitle(getString(R.string.help))
showBackButton()
replaceFragment(HelpFragment.newInstance(),false,R.id.container)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.mifos.mobile.cn.ui.mifos.help

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import kotlinx.android.synthetic.main.fragment_about_us.*
import kotlinx.android.synthetic.main.fragment_help.view.*
import org.mifos.mobile.cn.BuildConfig
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.ui.base.MifosBaseActivity
import org.mifos.mobile.cn.ui.base.MifosBaseFragment
import org.mifos.mobile.cn.ui.mifos.aboutus.AboutUsFragment
import org.mifos.mobile.cn.ui.mifos.privacypolicy.PrivacyPolicyActivity
import java.util.*

// TODO: Rename parameter arguments, choose names that match

class HelpFragment : MifosBaseFragment(){

lateinit var rootview: View
var url: String = "https://gitter.im/openMF/mifos-mobile-cn"

lateinit var button: Button

companion object {
fun newInstance(): Fragment {
val fragment: Fragment = HelpFragment()
val args = Bundle()
fragment.arguments = args
return fragment
}
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
rootview = inflater.inflate(R.layout.fragment_help, container, false)
(activity as MifosBaseActivity).activityComponent.inject(this)
setToolbarTitle(getString(R.string.help))
rootview.want_help.setOnClickListener {
openGitter()
}
return rootview
}

private fun openGitter() {
startActivity(Intent(Intent.ACTION_VIEW ,Uri.parse(url)))
}

}
Loading