Browse Source

added code

PankajBranch
Hemant Khadase 2 years ago
parent
commit
cfbfd52594
6 changed files with 91 additions and 67 deletions
  1. +1
    -0
      app/src/main/AndroidManifest.xml
  2. +19
    -9
      app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
  3. +3
    -3
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt
  4. +50
    -45
      app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt
  5. +9
    -5
      app/src/main/res/values-hi-rIN/strings.xml
  6. +9
    -5
      app/src/main/res/values/strings.xml

+ 1
- 0
app/src/main/AndroidManifest.xml View File

@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature
android:name="android.hardware.camera"


+ 19
- 9
app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt View File

@ -28,7 +28,6 @@ import com.nivesh.production.niveshfd.ui.fragment.*
import com.nivesh.production.niveshfd.ui.providerfactory.*
import com.nivesh.production.niveshfd.util.Common
import com.nivesh.production.niveshfd.util.Common.Companion.defaultShape
import com.nivesh.production.niveshfd.util.Common.Companion.getDate
import com.nivesh.production.niveshfd.util.Common.Companion.selectedShape
import com.nivesh.production.niveshfd.util.Common.Companion.showDialogValidation
import com.nivesh.production.niveshfd.util.Constants.Companion.token
@ -57,12 +56,13 @@ class NiveshFdMainActivity : BaseActivity() {
var nomineeDetails: NomineeDetails = NomineeDetails()
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails()
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse()
var uniqueId: String = ""
var stepCount: Int = 0
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter
private lateinit var fragments: Array<Fragment>
var dialogWebView: Dialog? = null
var loginRole: Int = 0
var stepCount: Int = 0
var uniqueId: String = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -81,7 +81,7 @@ class NiveshFdMainActivity : BaseActivity() {
}
// For Set Data
PreferenceManager( this@NiveshFdMainActivity).setSubBrokerID("")
PreferenceManager(this@NiveshFdMainActivity).setSubBrokerID("")
// For Get Data
PreferenceManager(context = this@NiveshFdMainActivity).getSubBrokerID()
@ -140,7 +140,10 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}
@ -187,9 +190,12 @@ class NiveshFdMainActivity : BaseActivity() {
200 -> {
setViewPager(stepsCount)
}
650 -> ""
650 -> ""
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
showDialogValidation(
this@NiveshFdMainActivity,
response.message
)
}
}
}
@ -206,7 +212,9 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}
@ -432,7 +440,9 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}


+ 3
- 3
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt View File

@ -109,14 +109,14 @@ class StepOneNiveshFDFragment : Fragment() {
}
// Maturity Options
rgMaturity.text = "Total"
rgMaturity.text = getString(R.string.totalDeduction)
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
rgMaturity = group.findViewById(checkedId)
Log.e("Maturity", "-->" + rgMaturity.text)
if (rgMaturity.text.contains("credit")){
rgMaturity.text = "Total"
rgMaturity.text = getString(R.string.totalDeduction)
}else{
rgMaturity.text = "Principal"
rgMaturity.text = getString(R.string.principalDeduction)
}
}


+ 50
- 45
app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt View File

@ -25,8 +25,6 @@ import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
import com.google.gson.JsonObject
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.db.PreferenceManager
import com.nivesh.production.niveshfd.interfaces.IPreferenceHelper
import com.nivesh.production.niveshfd.model.DeviceInfo
import com.nivesh.production.niveshfd.ui.activity.NiveshFdMainActivity
import kotlinx.coroutines.CoroutineExceptionHandler
@ -140,7 +138,11 @@ class Common {
builder.setPositiveButton(activity.getString(R.string.Ok)) { dialogInterface, _ ->
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", (activity as NiveshFdMainActivity).packageName, null)
Uri.fromParts(
"package",
(activity as NiveshFdMainActivity).packageName,
null
)
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
activity.startActivity(intent)
@ -217,20 +219,20 @@ class Common {
return Resource.Error(response.message())
}
fun handleResponse1(response: Response<String>): Resource<String> {
if (response.isSuccessful && response.body() != null) {
return if (response.body().toString().isNotEmpty()) {
Log.e("response", "-->$response")
val str: String = response.body().toString().replace("\r\n", "")
Log.e("str", "-->$str")
val jsonObject = JSONObject(str)
Log.e("jsonObject", "-->$jsonObject")
Resource.Success(jsonObject.toString())
}else {
Resource.Error(response.message())
}
}
return Resource.Error(response.message())
fun handleResponse1(response: Response<String>): Resource<String> {
if (response.isSuccessful && response.body() != null) {
return if (response.body().toString().isNotEmpty()) {
Log.e("response", "-->$response")
val str: String = response.body().toString().replace("\r\n", "")
Log.e("str", "-->$str")
val jsonObject = JSONObject(str)
Log.e("jsonObject", "-->$jsonObject")
Resource.Success(jsonObject.toString())
} else {
Resource.Error(response.message())
}
}
return Resource.Error(response.message())
}
@ -264,12 +266,11 @@ class Common {
}
/* this function is used for file size in readable format(End)*/
fun getFileSizeInMB(length: Long): Double {
// Get length of file in bytes
val fileSizeInBytes = length.toDouble()
// Convert the bytes to Kilobytes (1 KB = 1024 Bytes)
val fileSizeInKB = fileSizeInBytes / 1024
// Convert the KB to MegaBytes (1 MB = 1024 KBytes)
fun getFileSizeInMB(length: Long): Double { // Get length of file in bytes
val fileSizeInBytes =
length.toDouble() // Convert the bytes to Kilobytes (1 KB = 1024 Bytes)
val fileSizeInKB =
fileSizeInBytes / 1024 // Convert the KB to MegaBytes (1 MB = 1024 KBytes)
return fileSizeInKB / 1024
}
@ -285,32 +286,36 @@ class Common {
@SuppressLint("HardwareIds")
fun getDeviceInfo(mContext: Context): DeviceInfo {
val preferenceHelper: IPreferenceHelper = PreferenceManager(mContext)
val deviceInfo = DeviceInfo()
var device_id: String? = ""
var deviceId: String? = ""
try {
val telephonyManager =
mContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
deviceInfo.device_model = if (TextUtils.isEmpty(Build.DEVICE)) "" else Build.DEVICE
deviceInfo.device_os_version = if (TextUtils.isEmpty(Build.VERSION.RELEASE)) "" else Build.VERSION.RELEASE
deviceInfo.device_os_version =
if (TextUtils.isEmpty(Build.VERSION.RELEASE)) "" else Build.VERSION.RELEASE
deviceInfo.device_name = if (TextUtils.isEmpty(Build.PRODUCT)) "" else Build.PRODUCT
deviceInfo.device_type = "Android"
if (device_id == null || device_id.isEmpty() || device_id.equals(
if ((deviceId == null) || deviceId.isEmpty() || deviceId.equals(
"unknown",
ignoreCase = true
)
) {
device_id = if (TextUtils.isEmpty(Settings.Secure.getString(mContext.contentResolver, Settings.Secure.ANDROID_ID))
deviceId = if (TextUtils.isEmpty(
Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
)
) "" else Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
}
// deviceInfo.device_id = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = device_id
// deviceInfo.sdk_version = com.nivesh.production.BuildConfig.VERSION_NAME
// deviceInfo.device_id = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = deviceId
// deviceInfo.sdk_version = com.nivesh.production.BuildConfig.VERSION_NAME
if (ActivityCompat.checkSelfPermission(
mContext,
@ -318,33 +323,33 @@ class Common {
) != PackageManager.PERMISSION_GRANTED
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
device_id = telephonyManager.imei
if (device_id == null) {
device_id =
deviceId = telephonyManager.imei
if (deviceId == null) {
deviceId =
if (TextUtils.isEmpty(Build.getSerial())) "" else Build.getSerial()
}
} else {
device_id = telephonyManager.deviceId
if (device_id == null) {
device_id =
deviceId = telephonyManager.deviceId
if (deviceId == null) {
deviceId =
if (TextUtils.isEmpty(Build.SERIAL)) "" else Build.SERIAL
}
}
} else {
device_id = telephonyManager.deviceId
if (device_id == null) {
device_id = if (TextUtils.isEmpty(Build.SERIAL)) "" else Build.SERIAL
deviceId = telephonyManager.deviceId
if (deviceId == null) {
deviceId = if (TextUtils.isEmpty(Build.SERIAL)) "" else Build.SERIAL
}
}
} catch (e: Exception) {
e.printStackTrace()
if (device_id == null || device_id.isEmpty() || device_id.equals(
if ((deviceId == null) || deviceId.isEmpty() || deviceId.equals(
"unknown",
ignoreCase = true
)
) {
device_id = if (TextUtils.isEmpty(
deviceId = if (TextUtils.isEmpty(
Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
@ -355,8 +360,8 @@ class Common {
Settings.Secure.ANDROID_ID
)
}
// deviceInfo.deviceId = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = device_id
// deviceInfo.deviceId = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = deviceId
}
return deviceInfo
}


+ 9
- 5
app/src/main/res/values-hi-rIN/strings.xml View File

@ -44,6 +44,8 @@
<string name="minMaxValidation">Min. 12 months, Max. 60 months</string>
<string name="minAmountCategory">MINAmount</string>
<string name="MaxAmountCategory">MAXAmount</string>
<string name="totalDeduction">Total</string>
<string name="principalDeduction">Principal</string>
<!-- Validations -->
<string name="emptyAmount">Please enter amount</string>
@ -209,6 +211,10 @@
<string name="addPhoto">Add Photo!</string>
<string name="cancel">Cancel</string>
<string name="aadhar">Aadhar</string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<!-- Step Four -->
<string name="makePayment">Make Payment</string>
@ -231,6 +237,7 @@
<string name="TransactionIsUnsuccessful">Your transaction is unsuccessful.</string>
<string name="tryAgainLater">Sorry for the inconvenience please try again later</string>
<string name="retry">Retry</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
<!-- Others -->
@ -246,11 +253,8 @@
<string name="add_new_account">Add New Account</string>
<string name="Ok"><font fgcolor='#FF8E8E93'>OK</font></string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
</resources>

+ 9
- 5
app/src/main/res/values/strings.xml View File

@ -44,6 +44,8 @@
<string name="minMaxValidation">Min. 12 months, Max. 60 months</string>
<string name="minAmountCategory">MINAmount</string>
<string name="MaxAmountCategory">MAXAmount</string>
<string name="totalDeduction">Total</string>
<string name="principalDeduction">Principal</string>
<!-- Validations -->
<string name="emptyAmount">Please enter amount</string>
@ -209,6 +211,10 @@
<string name="addPhoto">Add Photo!</string>
<string name="cancel">Cancel</string>
<string name="aadhar">Aadhar</string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<!-- Step Four -->
<string name="makePayment">Make Payment</string>
@ -231,6 +237,7 @@
<string name="TransactionIsUnsuccessful">Your transaction is unsuccessful.</string>
<string name="tryAgainLater">Sorry for the inconvenience please try again later</string>
<string name="retry">Retry</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
<!-- Others -->
@ -246,11 +253,8 @@
<string name="add_new_account">Add New Account</string>
<string name="Ok"><font fgcolor='#FF8E8E93'>OK</font></string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
</resources>

Loading…
Cancel
Save

Powered by TurnKey Linux.