Browse Source

added code

PankajBranch^2
Hemant Khadase 2 years ago
parent
commit
d34a651242
9 changed files with 165 additions and 13 deletions
  1. +35
    -1
      app/src/main/java/com/nivesh/production/niveshfd/fd/util/Common.kt
  2. +34
    -11
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/RegisterActivity.kt
  3. +3
    -0
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/OTPFragment.kt
  4. +9
    -0
      app/src/main/res/drawable/round_corner_top.xml
  5. +2
    -1
      app/src/main/res/layout/fragment_otp.xml
  6. +28
    -0
      app/src/main/res/layout/web_view_bottom_dialog.xml
  7. +1
    -0
      app/src/main/res/values-hi-rIN/strings.xml
  8. +1
    -0
      app/src/main/res/values/strings.xml
  9. +52
    -0
      app/src/main/res/values/style.xml

+ 35
- 1
app/src/main/java/com/nivesh/production/niveshfd/fd/util/Common.kt View File

@ -4,11 +4,13 @@ import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.hardware.display.DisplayManager
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.Uri
@ -17,9 +19,19 @@ import android.provider.Settings
import android.telephony.TelephonyManager
import android.text.TextUtils
import android.text.format.DateFormat
import android.util.DisplayMetrics
import android.util.Log
import android.util.Patterns
import android.view.Display
import android.view.Gravity
import android.view.Window
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.ImageView
import androidx.appcompat.app.ActionBar
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat.getSystemService
import androidx.core.hardware.display.DisplayManagerCompat
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
@ -136,6 +148,29 @@ class Common {
builder.show()
}
fun showWebViewDialogBottom(context: Context, url: String,height: Int){
val dialog = Dialog(context)
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
dialog.setContentView(R.layout.web_view_bottom_dialog)
val webView: WebView = dialog.findViewById(R.id.webView)
val imageCross: ImageView = dialog.findViewById(R.id.imageCross)
imageCross.setOnClickListener {
dialog.dismiss()
}
webView.isScrollbarFadingEnabled = false
webView.isHorizontalScrollBarEnabled = false
webView.settings.javaScriptEnabled = true
webView.settings.userAgentString = "AndroidWebView"
webView.clearCache(true)
webView.loadUrl(url)
dialog.show()
val window: Window = dialog.window!!
window.setGravity(Gravity.BOTTOM)
window.setLayout(ActionBar.LayoutParams.MATCH_PARENT,(height-400))
window.setWindowAnimations(R.style.DialogBottomAnimation)
}
fun showDialogWithTwoButtons(activity: Activity?, message: CharSequence?, title: String) {
val builder = AlertDialog.Builder(activity)
builder.setTitle(title)
@ -371,6 +406,5 @@ class Common {
}
return deviceInfo
}
}
}

+ 34
- 11
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/RegisterActivity.kt View File

@ -1,13 +1,14 @@
package com.nivesh.production.niveshfd.partnerOnBoarding.ui.activities1
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import com.nivesh.production.niveshfd.databinding.ActivityLoginBinding
import android.util.DisplayMetrics
import android.view.Display
import androidx.core.hardware.display.DisplayManagerCompat
import com.nivesh.production.niveshfd.databinding.ActivityRegisterBinding
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
import com.nivesh.production.niveshfd.fd.util.Common
import com.nivesh.production.niveshfd.fd.util.Common.Companion.showWebViewDialogBottom
class RegisterActivity : BaseActivity() {
lateinit var binding: ActivityRegisterBinding
@ -23,22 +24,44 @@ class RegisterActivity : BaseActivity() {
setContentView(this.root)
}
binding.imgInfo.setOnClickListener{
binding.imgInfo.setOnClickListener {
}
binding.btnInvestor.setOnClickListener{
intent = Intent(this@RegisterActivity, RegisterActivity::class.java)
binding.btnInvestor.setOnClickListener {
intent = Intent(this@RegisterActivity, RegisterActivity::class.java)
startActivity(intent)
}
binding.btnDistributor.setOnClickListener{
intent = Intent(this@RegisterActivity, ViewPagerActivity::class.java)
binding.btnDistributor.setOnClickListener {
intent = Intent(this@RegisterActivity, ViewPagerActivity::class.java)
startActivity(intent)
}
binding.btnReferrer.setOnClickListener{
intent = Intent(this@RegisterActivity, ViewPagerActivity::class.java)
binding.btnReferrer.setOnClickListener {
intent = Intent(this@RegisterActivity, ViewPagerActivity::class.java)
startActivity(intent)
}
binding.imgInfo.setOnClickListener {
showWebViewDialogBottom(
this@RegisterActivity,
"https://smallbusiness.chron.com/create-dummy-webpage-51199.html",
getScreenHeight()
)
}
}
private fun getScreenHeight(): Int {
val height: Int = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val defaultDisplay =
DisplayManagerCompat.getInstance(this).getDisplay(Display.DEFAULT_DISPLAY)
val displayContext = createDisplayContext(defaultDisplay!!)
displayContext.resources.displayMetrics.heightPixels
} else {
val displayMetrics = DisplayMetrics()
@Suppress("DEPRECATION")
windowManager.defaultDisplay.getMetrics(displayMetrics)
displayMetrics.heightPixels
}
return height
}
}

+ 3
- 0
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/OTPFragment.kt View File

@ -44,6 +44,9 @@ class OTPFragment : Fragment() {
binding.edtOTP5.setOnKeyListener(GenericKeyEvent(binding.edtOTP5, binding.edtOTP4))
binding.edtOTP6.setOnKeyListener(GenericKeyEvent(binding.edtOTP6, binding.edtOTP5))
binding.txtDigit.text = getString(R.string.sixDigitOTP).plus(" ").plus("0000000000")
binding.btnContinue.setOnClickListener {
if (validate()) {


+ 9
- 0
app/src/main/res/drawable/round_corner_top.xml View File

@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="@color/greyColor1" />
<padding android:left="15dp" android:top="15dp" android:right="15dp" android:bottom="10dp" />
<corners android:topLeftRadius="36dp"
android:topRightRadius="36dp"
android:bottomLeftRadius="1dp"
android:bottomRightRadius="1dp"/>
</shape>

+ 2
- 1
app/src/main/res/layout/fragment_otp.xml View File

@ -33,8 +33,9 @@
android:id="@+id/txtDigit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginTop="@dimen/margin_5"
android:text="Enter the 6-digit verification code sent to +91-00000-00000"
android:text="@string/sixDigitOTP"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"


+ 28
- 0
app/src/main/res/layout/web_view_bottom_dialog.xml View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageCross"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cancel"
android:layout_centerHorizontal="true"
android:src="@drawable/svg_close" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/round_corner_top"
android:layout_marginTop="@dimen/margin_60">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</RelativeLayout>

+ 1
- 0
app/src/main/res/values-hi-rIN/strings.xml View File

@ -294,6 +294,7 @@
<string name="upNextHome">Up Next: Home</string>
<string name="onlyAlphabets">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
<string name="invalidOTP">Please enter valid OTP</string>
<string name="sixDigitOTP">Enter the 6-digit verification code sent to</string>
</resources>

+ 1
- 0
app/src/main/res/values/strings.xml View File

@ -301,6 +301,7 @@
<string name="upNextHome">Up Next: Home</string>
<string name="onlyAlphabets">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
<string name="invalidOTP">Please enter valid OTP</string>
<string name="sixDigitOTP">Enter the 6-digit verification code sent to</string>
</resources>

+ 52
- 0
app/src/main/res/values/style.xml View File

@ -99,4 +99,56 @@
<item name="cornerSizeBottomLeft">@dimen/margin_10</item>
</style>
<style name="DialogBottomAnimation">
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
<declare-styleable name="DotsIndicator">
<attr name="dotsColor" />
<attr name="selectedDotColor" />
<attr name="dotsSize" />
<attr name="dotsWidthFactor" />
<attr name="dotsSpacing" />
<attr name="dotsCornerRadius" />
<attr name="progressMode" />
<attr name="dotsClickable" />
<attr name="dotsElevation" format="dimension" />
</declare-styleable>
<attr name="dotsColor" format="color" />
<attr name="selectedDotColor" format="color" />
<attr name="dotsStrokeColor" format="color" />
<attr name="dotsSize" format="dimension" />
<attr name="dotsWidthFactor" format="float" />
<attr name="dotsSpacing" format="dimension" />
<attr name="dotsCornerRadius" format="dimension" />
<attr name="dotsStrokeWidth" format="dimension" />
<attr name="stiffness" format="float" />
<attr name="dampingRatio" format="float" />
<attr name="progressMode" format="boolean" />
<attr name="dotsClickable" format="boolean" />
<declare-styleable name="SpringDotsIndicator">
<attr name="dotsColor" />
<attr name="dotsSize" />
<attr name="dotsSpacing" />
<attr name="dotsCornerRadius" />
<attr name="dotsStrokeWidth" />
<attr name="dotsStrokeColor" />
<attr name="stiffness" />
<attr name="dampingRatio" />
<attr name="dotsClickable" />
</declare-styleable>
<declare-styleable name="WormDotsIndicator">
<attr name="dotsColor" />
<attr name="dotsSize" />
<attr name="dotsSpacing" />
<attr name="dotsCornerRadius" />
<attr name="dotsStrokeWidth" />
<attr name="dotsStrokeColor" />
<attr name="dotsClickable" />
</declare-styleable>
</resources>

Loading…
Cancel
Save

Powered by TurnKey Linux.