Lokesh vor 5 Jahren
Ursprung
Commit
26d0281a7f
100 geänderte Dateien mit 14491 neuen und 0 gelöschten Zeilen
  1. 15 0
      app/.gitignore
  2. 124 0
      app/build.gradle
  3. 443 0
      app/google-services.json
  4. 172 0
      app/gradlew
  5. 84 0
      app/gradlew.bat
  6. 464 0
      app/src/main/AndroidManifest.xml
  7. BIN
      app/src/main/about_us-web.png
  8. BIN
      app/src/main/add_button-web.png
  9. BIN
      app/src/main/addtxt-web.png
  10. BIN
      app/src/main/assessment_icon-web.png
  11. BIN
      app/src/main/assessmenttype_1-web.png
  12. BIN
      app/src/main/assessmenttype_2-web.png
  13. BIN
      app/src/main/assets/Architex.ttf
  14. BIN
      app/src/main/assets/Roboto-Light.ttf
  15. BIN
      app/src/main/assets/roboto_medium.ttf
  16. BIN
      app/src/main/assets/robotothin.ttf
  17. BIN
      app/src/main/audio_icon-web.png
  18. BIN
      app/src/main/back-web.png
  19. BIN
      app/src/main/back_icon-web.png
  20. BIN
      app/src/main/bar_code-web.png
  21. BIN
      app/src/main/blogicon-web.png
  22. BIN
      app/src/main/bullet-web.png
  23. BIN
      app/src/main/bulletin-web.png
  24. BIN
      app/src/main/camera_icon-web.png
  25. BIN
      app/src/main/change_password-web.png
  26. BIN
      app/src/main/clear-web.png
  27. BIN
      app/src/main/cling_bleached_new-web.png
  28. BIN
      app/src/main/close_icon-web.png
  29. BIN
      app/src/main/correct-web.png
  30. BIN
      app/src/main/date-web.png
  31. BIN
      app/src/main/dateofjoin-web.png
  32. BIN
      app/src/main/dealer_code-web.png
  33. BIN
      app/src/main/delete_icon-web.png
  34. BIN
      app/src/main/designation-web.png
  35. BIN
      app/src/main/dob-web.png
  36. BIN
      app/src/main/down_arrow-web.png
  37. BIN
      app/src/main/download-web.png
  38. BIN
      app/src/main/drop-web.png
  39. BIN
      app/src/main/dropdown-web.png
  40. BIN
      app/src/main/edit_icon-web.png
  41. BIN
      app/src/main/edit_icon_white-web.png
  42. BIN
      app/src/main/email_grey-web.png
  43. BIN
      app/src/main/email_icon-web.png
  44. BIN
      app/src/main/emp_id_icon-web.png
  45. BIN
      app/src/main/enquiry-web.png
  46. BIN
      app/src/main/error_icon-web.png
  47. BIN
      app/src/main/faq-web.png
  48. BIN
      app/src/main/feed_back-web.png
  49. 8 0
      app/src/main/gen/com/ttiglobal/suzuki/BuildConfig.java
  50. 7 0
      app/src/main/gen/com/ttiglobal/suzuki/Manifest.java
  51. 7 0
      app/src/main/gen/com/ttiglobal/suzuki/R.java
  52. BIN
      app/src/main/help_icon-web.png
  53. BIN
      app/src/main/history-web.png
  54. BIN
      app/src/main/home-web.png
  55. BIN
      app/src/main/home_icon-web.png
  56. BIN
      app/src/main/ic_backspace-web.png
  57. BIN
      app/src/main/ic_bot-web.png
  58. BIN
      app/src/main/ic_bot1-web.png
  59. BIN
      app/src/main/ic_bot112-web.png
  60. BIN
      app/src/main/ic_edit-web.png
  61. BIN
      app/src/main/ic_launcher-web.png
  62. BIN
      app/src/main/icon_about-web.png
  63. BIN
      app/src/main/icon_change_password-web.png
  64. BIN
      app/src/main/icon_faq-web.png
  65. BIN
      app/src/main/icon_logout-web.png
  66. BIN
      app/src/main/icon_settings-web.png
  67. BIN
      app/src/main/info_icon-web.png
  68. BIN
      app/src/main/invalid_icon-web.png
  69. 1428 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/AMHomeActivity.java
  70. 71 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/AboutActivity.java
  71. 750 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/AssessmentActivity.java
  72. 395 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/AudioViewActivity.java
  73. 298 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/BulletinActivity.java
  74. 108 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/BulletinDetails.java
  75. 241 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ChangePasswordActivity.java
  76. 404 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ContentListActivity.java
  77. 179 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/CropActivity.java
  78. 129 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/FaqActivity.java
  79. 483 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ForgotPasswordActivity.java
  80. 1704 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/HomeActivity.java
  81. 135 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/IndroScreen.java
  82. 263 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/LearningPathActivity.java
  83. 354 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/LoginActivity.java
  84. 117 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/MainActivity.java
  85. 861 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/MainProfileActivity.java
  86. 420 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/MyEarnedPoints.java
  87. 892 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/MyProfileActivity.java
  88. 309 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/MyWallet.java
  89. 464 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/NotificationActivity.java
  90. 85 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/NotificationViewActivity.java
  91. 457 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/OtpActivity.java
  92. 612 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/PdfViewActivity.java
  93. 431 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ProductExploreDetailsActivity.java
  94. 304 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ProductExplorerActivity.java
  95. 341 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ProductFeedbackFormActivity.java
  96. 46 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ProductHomeActivity.java
  97. 165 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemPointsCategoryActivity.java
  98. 504 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemProductDetailsActivity.java
  99. 217 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemProductListActivity.java
  100. 0 0
      app/src/main/java/com/ttiglobal/inttilectgpchat/ResetPasswordActivity.java

+ 15 - 0
app/.gitignore

@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea
+/.idea/libraries
+.DS_Store
+/build
+/app/build
+/app/.idea
+/app/gradle
+/app/release
+/app/*.xml
+/captures
+/gradle
+/release

+ 124 - 0
app/build.gradle

@@ -0,0 +1,124 @@
+apply plugin: 'com.android.application'
+android {
+    compileSdkVersion 29
+    buildToolsVersion "29.0.3"
+    lintOptions {
+        checkReleaseBuilds false
+    }
+    defaultConfig {
+        applicationId "com.ttiglobal.inttilectgpchat"
+        targetSdkVersion 29
+        minSdkVersion 21
+        versionCode 6
+        versionName "6.0"
+        multiDexEnabled true
+    }
+    repositories {
+        maven {
+            url 'http://dl.bintray.com/amulyakhare/maven'
+        }
+        maven {
+            url "https://github.com/omadahealth/omada-nexus/raw/master/release"
+        }
+    }
+    // solve duplicate classes
+    applicationVariants.all { variant ->
+        variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
+        variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'annotations'
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+        }
+    }
+    compileOptions {
+        sourceCompatibility = 1.8
+        targetCompatibility = 1.8
+    }
+}
+
+dependencies {
+
+    implementation 'androidx.palette:palette:1.0.0'
+    implementation 'androidx.multidex:multidex:2.0.1'
+    implementation 'androidx.cardview:cardview:1.0.0'
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
+    implementation 'androidx.recyclerview:recyclerview:1.1.0'
+    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+    implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
+
+    implementation 'com.google.code.gson:gson:2.8.6'
+    implementation 'com.google.android.material:material:1.1.0'
+    implementation 'com.google.android.gms:play-services-auth:18.0.0'
+
+//    implementation 'com.squareup.okhttp3:okhttp:4.2.2'
+    implementation 'com.squareup.retrofit2:retrofit:2.6.2'
+    implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
+    implementation 'com.squareup.okhttp:okhttp:2.7.5'
+
+
+    implementation 'com.ogaclejapan.smarttablayout:library:2.0.0@aar'
+    implementation 'com.ogaclejapan.smarttablayout:utils-v13:1.7.0@aar'
+
+    implementation 'io.reactivex.rxjava2:rxjava:2.2.14'
+    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
+
+    implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
+    implementation "me.leolin:ShortcutBadger:1.1.22@aar"
+    implementation 'com.hendraanggrian:collapsingtoolbarlayout-subtitle:27.1.1'
+    implementation 'com.budiyev.android:circular-progress-bar:1.1.9'
+    implementation 'com.andrognito.pinlockview:pinlockview:2.1.0'
+    implementation 'com.intuit.sdp:sdp-android:1.0.6'
+
+    implementation 'com.github.enricocid:cpl:1.0.3'
+    implementation 'com.github.bumptech.glide:glide:4.10.0'
+    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
+    implementation 'com.github.kittinunf.fuel:fuel-android:1.9.0'
+    implementation 'com.github.traex.rippleeffect:ripple:1.3.1-OG'
+    implementation 'com.github.warkiz.widget:indicatorseekbar:2.1.2'
+    implementation 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
+    implementation 'com.github.dmytrodanylyk.shadow-layout:library:1.0.3'
+    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
+    implementation 'com.github.tylersuehr7:empty-state-recyclerview:1.0.4'
+    implementation 'com.github.douglasjunior:android-simple-tooltip:0.2.2'
+
+    implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
+    implementation 'com.firebaseui:firebase-ui-database:5.0.0'
+    implementation 'com.firebaseui:firebase-ui-firestore:4.3.2'
+
+    implementation 'com.google.firebase:firebase-core:17.2.1'
+    implementation 'com.google.firebase:firebase-auth:19.2.0'
+    implementation 'com.google.firebase:firebase-storage:19.1.0'
+    implementation 'com.google.firebase:firebase-database:19.2.0'
+    implementation 'com.google.firebase:firebase-firestore:21.3.0'
+    implementation 'com.google.firebase:firebase-messaging:20.0.1'
+
+    implementation 'com.google.firebase:firebase-analytics:17.2.1'
+
+    implementation 'com.ibm.watson:assistant:8.0.0'
+    implementation 'com.ibm.watson:text-to-speech:8.0.0'
+    implementation 'com.ibm.watson:speech-to-text:8.0.0'
+    implementation 'com.ibm.watson.developer_cloud:java-sdk:3.7.2'
+    implementation 'com.ibm.watson.developer_cloud:android-sdk:0.5.1'
+
+    implementation 'jp.wasabeef:blurry:2.1.1'
+    implementation 'de.hdodenhof:circleimageview:3.0.1'
+    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
+    implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
+    implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
+
+    testImplementation 'junit:junit:4.13'
+    androidTestImplementation 'androidx.test:runner:1.2.0'
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+    implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
+    implementation ('org.jitsi.react:jitsi-meet-sdk:2.8.2') { transitive = true }
+    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
+
+}
+apply plugin: 'com.google.gms.google-services'

+ 443 - 0
app/google-services.json

@@ -0,0 +1,443 @@
+{
+  "project_info": {
+    "project_number": "964577546994",
+    "firebase_url": "https://tti-product.firebaseio.com",
+    "project_id": "tti-product",
+    "storage_bucket": "tti-product.appspot.com"
+  },
+  "client": [
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:056d9cf9f5ca70b6def66b",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.bmwlearning"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:a879eeb0013d0a9d",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.fordausinttilect"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:aaaff1df1770dc4e",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.fordschedulingapp"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:2f7a972fd8eb297cdef66b",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.inttilectgpchat"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:15c35b4ae2c0b82b",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.isuzu"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:70ece312119a5a42def66b",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.jlrinttilectsa"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:f52a9f7d3928c545",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.kenworth"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:95d3912a4977c630def66b",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.porsche"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:1c74c27791af6b14",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.psa"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:3e955cb0a33d0b99",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.suzuki"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:b00fbd02241b5082",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.suzuki_ce"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    },
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:964577546994:android:307fce0da2fd0ad3",
+        "android_client_info": {
+          "package_name": "com.ttiglobal.venue"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyA8TxoGqM7JljkX4PFm5sM0c5eLhmClpzw"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "964577546994-d66v7qt14dh0lbjviarglnpod1mnhn6k.apps.googleusercontent.com",
+              "client_type": 3
+            },
+            {
+              "client_id": "964577546994-nu41p0c74hhc7pc72vql48n704djtf1t.apps.googleusercontent.com",
+              "client_type": 2,
+              "ios_info": {
+                "bundle_id": "com.ttiglobal.bmwlearning"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "configuration_version": "1"
+}

+ 172 - 0
app/gradlew

@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

+ 84 - 0
app/gradlew.bat

@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 464 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    package="com.ttiglobal.inttilectgpchat"
+    android:installLocation="internalOnly">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <uses-feature android:name="android.hardware.camera" />
+    <uses-feature android:name="android.hardware.camera.autofocus" />
+
+
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+
+    <application
+        android:name="com.ttiglobal.inttilectgpchat.util.MainApplication"
+        android:hardwareAccelerated="true"
+        android:icon="@mipmap/int_logo"
+        android:label="@string/app_name"
+        android:largeHeap="true"
+        android:supportsRtl="true"
+
+        android:theme="@style/AppTheme"
+        tools:ignore="GoogleAppIndexingWarning">
+
+        <activity android:name=".blog.BlogHoUser" />
+
+        <activity
+            android:name=".training.activities.JitsiActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+
+        <activity
+            android:name=".training.activities.ScheduleListActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+
+        <activity
+            android:name=".training.activities.ScheduleActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+
+        <activity
+            android:name=".training.activities.AddParticipantActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+
+        <activity
+            android:name=".blog.VideoView"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name=".blog.BlogDetails"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name=".chatti.ChatMain"
+            android:screenOrientation="portrait"
+            android:windowSoftInputMode="adjustResize" />
+        <activity
+            android:name=".blog.PostActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name=".blog.BlogActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name=".blog.CommentActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustResize" />
+
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ProductFeedbackFormActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ProductExploreDetailsActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ProductHomeActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SEHomeActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.HomeActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.screenpinview.AppLockActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.screenpinview.ForgotAppLockActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.OtpActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.screenpinview.ChangeAppLockActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.TermsandConditions"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.RedeemProductDetailsActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.AMHomeActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SplashScreen"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.LoginActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SetNewPasswordActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ResetPasswordActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ForgotPasswordActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.MainProfileActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SignUpActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.NotificationActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.TopicListActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.MyWallet"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.RedeemPointsCategoryActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.RedeemProductListActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.BulletinActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.MyEarnedPoints"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.TargetSalesActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.LearningPathActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.BulletinDetails"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ContentListActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.PdfViewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="unspecified"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.WebViewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="unspecified"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.VideoViewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="unspecified"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.AssessmentActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ReviewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SurveyActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ChangePasswordActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SettingsActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.MyProfileActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.AudioViewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.NotificationViewActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.IndroScreen"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.CropActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.FaqActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.AboutActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme.NoActionBar"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.MainActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.SuzukiEnquiryForm"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+        <activity
+            android:name="com.ttiglobal.inttilectgpchat.ProductExplorerActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/app_name"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppFullScreenTheme"
+            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
+
+        <receiver
+            android:name="com.ttiglobal.inttilectgpchat.service.NetworkUpdateReceiver"
+            android:enabled="true"
+            android:exported="true">
+            <intent-filter>
+                <action
+                    android:name="android.net.conn.CONNECTIVITY_CHANGE"
+                    tools:ignore="BatteryLife" />
+            </intent-filter>
+        </receiver>
+        <receiver
+            android:name="com.ttiglobal.inttilectgpchat.service.SwitchOnReceiver"
+            android:enabled="true"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </receiver>
+        <receiver android:name="com.ttiglobal.inttilectgpchat.service.IncomingSMSReceiver">
+            <intent-filter>
+                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
+            </intent-filter>
+        </receiver>
+
+        <service
+            android:name="com.ttiglobal.inttilectgpchat.pushnotification.FcmMessageService"
+            android:enabled="true"
+            android:exported="false"
+            android:stopWithTask="false">
+            <intent-filter>
+                <action android:name="com.google.firebase.MESSAGING_EVENT" />
+            </intent-filter>
+        </service>
+
+        <provider
+            android:name="androidx.core.content.FileProvider"
+            android:authorities="${applicationId}.provider"
+            android:exported="false"
+            android:grantUriPermissions="true"
+            tools:replace="android:authorities">
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/picker_provider_paths" />
+        </provider>
+    </application>
+
+</manifest>

BIN
app/src/main/about_us-web.png


BIN
app/src/main/add_button-web.png


BIN
app/src/main/addtxt-web.png


BIN
app/src/main/assessment_icon-web.png


BIN
app/src/main/assessmenttype_1-web.png


BIN
app/src/main/assessmenttype_2-web.png


BIN
app/src/main/assets/Architex.ttf


BIN
app/src/main/assets/Roboto-Light.ttf


BIN
app/src/main/assets/roboto_medium.ttf


BIN
app/src/main/assets/robotothin.ttf


BIN
app/src/main/audio_icon-web.png


BIN
app/src/main/back-web.png


BIN
app/src/main/back_icon-web.png


BIN
app/src/main/bar_code-web.png


BIN
app/src/main/blogicon-web.png


BIN
app/src/main/bullet-web.png


BIN
app/src/main/bulletin-web.png


BIN
app/src/main/camera_icon-web.png


BIN
app/src/main/change_password-web.png


BIN
app/src/main/clear-web.png


BIN
app/src/main/cling_bleached_new-web.png


BIN
app/src/main/close_icon-web.png


BIN
app/src/main/correct-web.png


BIN
app/src/main/date-web.png


BIN
app/src/main/dateofjoin-web.png


BIN
app/src/main/dealer_code-web.png


BIN
app/src/main/delete_icon-web.png


BIN
app/src/main/designation-web.png


BIN
app/src/main/dob-web.png


BIN
app/src/main/down_arrow-web.png


BIN
app/src/main/download-web.png


BIN
app/src/main/drop-web.png


BIN
app/src/main/dropdown-web.png


BIN
app/src/main/edit_icon-web.png


BIN
app/src/main/edit_icon_white-web.png


BIN
app/src/main/email_grey-web.png


BIN
app/src/main/email_icon-web.png


BIN
app/src/main/emp_id_icon-web.png


BIN
app/src/main/enquiry-web.png


BIN
app/src/main/error_icon-web.png


BIN
app/src/main/faq-web.png


BIN
app/src/main/feed_back-web.png


+ 8 - 0
app/src/main/gen/com/ttiglobal/suzuki/BuildConfig.java

@@ -0,0 +1,8 @@
+/*___Generated_by_IDEA___*/
+
+package com.ttiglobal.inttilectgpchat;
+
+/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
+public final class BuildConfig {
+  public final static boolean DEBUG = Boolean.parseBoolean(null);
+}

+ 7 - 0
app/src/main/gen/com/ttiglobal/suzuki/Manifest.java

@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package com.ttiglobal.inttilectgpchat;
+
+/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
+public final class Manifest {
+}

+ 7 - 0
app/src/main/gen/com/ttiglobal/suzuki/R.java

@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package com.ttiglobal.inttilectgpchat;
+
+/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
+public final class R {
+}

BIN
app/src/main/help_icon-web.png


BIN
app/src/main/history-web.png


BIN
app/src/main/home-web.png


BIN
app/src/main/home_icon-web.png


BIN
app/src/main/ic_backspace-web.png


BIN
app/src/main/ic_bot-web.png


BIN
app/src/main/ic_bot1-web.png


BIN
app/src/main/ic_bot112-web.png


BIN
app/src/main/ic_edit-web.png


BIN
app/src/main/ic_launcher-web.png


BIN
app/src/main/icon_about-web.png


BIN
app/src/main/icon_change_password-web.png


BIN
app/src/main/icon_faq-web.png


BIN
app/src/main/icon_logout-web.png


BIN
app/src/main/icon_settings-web.png


BIN
app/src/main/info_icon-web.png


BIN
app/src/main/invalid_icon-web.png


Datei-Diff unterdrückt, da er zu groß ist
+ 1428 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/AMHomeActivity.java


+ 71 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/AboutActivity.java

@@ -0,0 +1,71 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.WindowManager;
+
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+
+public class AboutActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
+                WindowManager.LayoutParams.FLAG_SECURE);
+        setContentView(R.layout.activity_about);
+        setupWindowAnimations();
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+    }
+
+    @Override
+    public void onBackPressed() {
+        Intent result = new Intent();
+        setResult(Activity.RESULT_CANCELED, result);
+        finish();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+}

+ 750 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/AssessmentActivity.java

@@ -0,0 +1,750 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.content.ContentValues;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.database.Cursor;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ogaclejapan.smarttablayout.SmartTabLayout;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.fragments.QuestionFragment;
+import com.ttiglobal.inttilectgpchat.roundcornerprogressbar.RoundCornerProgressBar;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.CustomViewPager;
+import com.ttiglobal.inttilectgpchat.util.DepthPageTransformerNew;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.AnswerResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentAnswer;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentList;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentQuestion;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentQuestionResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentScore;
+import com.ttiglobal.inttilectgpchat.wrappers.CommonResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.HitCountModel;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class AssessmentActivity extends AppCompatActivity {
+    public static AssessmentList ASSESSMENT = new AssessmentList();
+    public static String TRAINING_ID = "";
+    public static String CATEGORY_ID = "";
+    public static boolean isOffline = false;
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    TextView title;
+    ArrayList<AssessmentQuestion> ASSESSMENT_QUESTIONS = new ArrayList<>();
+    CustomViewPager viewPager;
+    SmartTabLayout indicatorTab;
+    ImageButton previous, next;
+    RoundCornerProgressBar linearTimerView;
+    TextView time;
+    Button submitButton;
+    String START_TIME = "";
+    String END_TIME = "";
+    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    Bundle bundle;
+    Handler handler = new Handler();
+    private boolean isBlinking = false;
+    String fromTime, toTime, finalTime;
+    Calendar c;
+    SimpleDateFormat df;
+    Runnable runnable = new Runnable() {
+        @Override
+        public void run() {
+            if (linearTimerView.getProgress() == 0) {
+                onSubmitAnswer(true);
+                time.setText("TIME LEFT");
+            } else {
+                linearTimerView.setProgress(linearTimerView.getProgress() - 1);
+                long millis = (long) (linearTimerView.getProgress() * 1000);
+                String formattedTime = String.format("%02d:%02d",
+                        TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1),
+                        TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1));
+                time.setText(formattedTime);
+                updateProgressColor();
+                handler.postDelayed(runnable, 1000);
+            }
+        }
+    };
+    private FirebaseAnalytics firebaseAnalytics;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_assessment);
+        setupWindowAnimations();
+        restService = ((MainApplication) getApplication()).getClient();
+        viewPager = findViewById(R.id.viewPager);
+        title = findViewById(R.id.title);
+        indicatorTab = findViewById(R.id.indicatorTab);
+        submitButton = findViewById(R.id.submitButton);
+        submitButton.setVisibility(View.GONE);
+        linearTimerView = findViewById(R.id.linearTimerView);
+
+        previous = findViewById(R.id.previous);
+        next = findViewById(R.id.next);
+        time = findViewById(R.id.time);
+
+        time.setVisibility(View.VISIBLE);
+        linearTimerView.setVisibility(View.GONE);
+
+        firebaseAnalytics = FirebaseAnalytics.getInstance(this);
+        FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(true);
+
+        bundle = new Bundle();
+        bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
+        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Assessment Activity");
+        firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        title.setText(ASSESSMENT.getAssessmentname() + "");
+        title.setSelected(true);
+
+        if (ASSESSMENT.getAssessmenttimetype().trim().equalsIgnoreCase("0")) {
+            time.setVisibility(View.INVISIBLE);
+            linearTimerView.setVisibility(View.INVISIBLE);
+        }
+
+
+        viewPager.post(new Runnable() {
+            @Override
+            public void run() {
+                getAssesmentQuistion();
+            }
+        });
+
+        previous.setEnabled(false);
+        next.setEnabled(false);
+
+        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+                if (position == 0) {
+                    previous.setEnabled(false);
+                    next.setEnabled(true);
+                    if (ASSESSMENT_QUESTIONS.size() == 1) {
+                        submitButton.setVisibility(View.VISIBLE);
+                    }
+                } else if (position == ASSESSMENT_QUESTIONS.size() - 1) {
+                    previous.setEnabled(true);
+                    next.setEnabled(false);
+                    submitButton.setVisibility(View.VISIBLE);
+                } else {
+                    previous.setEnabled(true);
+                    next.setEnabled(true);
+                }
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+
+            }
+        });
+
+        previous.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (viewPager.getCurrentItem() > 0) {
+                    viewPager.setCurrentItem(viewPager.getCurrentItem() - 1, true);
+                }
+            }
+        });
+
+        next.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (viewPager.getCurrentItem() < ASSESSMENT_QUESTIONS.size() - 1) {
+                    viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, true);
+                }
+            }
+        });
+
+        submitButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                getToTime();
+                onSubmitAnswer(false);
+            }
+        });
+
+        findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showHelpScreen();
+            }
+        });
+
+        getCurrentTime();
+
+
+    }
+
+
+    private void getCurrentTime() {
+        c = Calendar.getInstance();
+        System.out.println("fromTime " + c.getTime());
+
+        df = new SimpleDateFormat("HH:mm:ss");
+        fromTime = df.format(c.getTime());
+        Log.e("fromTime", fromTime);
+    }
+
+    private void sendHitCountToServer() {
+        restService.sendAllHitCount(buildConfigData()).enqueue(new Callback<CommonResponse>() {
+            @Override
+            public void onResponse(Call<CommonResponse> call, Response<CommonResponse> response) {
+
+            }
+
+            @Override
+            public void onFailure(Call<CommonResponse> call, Throwable t) {
+                if (t.getMessage() != null) {
+                    Log.e("responeHit", t.getMessage());
+                }
+            }
+        });
+    }
+
+    private HitCountModel buildConfigData() {
+        HitCountModel hitCountModel = new HitCountModel();
+        hitCountModel.setPage("Assessment");
+        hitCountModel.setViewtime("0");
+        return hitCountModel;
+    }
+
+
+    private void onSubmitAnswer(boolean isAutoSubmit) {
+        if (ASSESSMENT_QUESTIONS != null && ASSESSMENT_QUESTIONS.size() > 0) {
+            ArrayList<AssessmentAnswer> answers = new ArrayList<>();
+            END_TIME = format.format(new Date());
+            for (AssessmentQuestion question : ASSESSMENT_QUESTIONS) {
+                AssessmentAnswer answer = new AssessmentAnswer();
+                answer.setAqid(question.getAqid());
+                answer.setQid(question.getQid());
+                if (isAutoSubmit) {
+                    answer.setOptions(question.getAnswer());
+                } else {
+                    if (question.getIs_mandatory().trim().equalsIgnoreCase("1")) {
+                        if (!question.isAnswered()) {
+                            viewPager.setCurrentItem(ASSESSMENT_QUESTIONS.indexOf(question));
+                            GlobalData.showToast(AssessmentActivity.this, "Please answer all mandatory questions", Toast.LENGTH_SHORT).show();
+                            return;
+                        } else {
+                            answer.setOptions(question.getAnswer());
+                        }
+                    } else {
+                        answer.setOptions(question.getAnswer());
+                    }
+                }
+                answers.add(answer);
+            }
+
+            Gson gson = new Gson();
+            JsonElement jsonElement = gson.toJsonTree(
+                    answers, new TypeToken<ArrayList<AssessmentAnswer>>() {
+                    }.getType());
+
+            HashMap<String, String> map = new HashMap<>();
+            map.put("ans_arr", jsonElement.toString());
+            map.put("startdatetime", START_TIME);
+            map.put("enddatetime", END_TIME);
+
+            if (new UtilService().isNetworkAvailable(AssessmentActivity.this)) {
+
+                progressDialog = new TransparentProgressDialog(AssessmentActivity.this);
+                progressDialog.show();
+
+                restService.postAssessment(ASSESSMENT.getAssessmentid(), map).enqueue(new Callback<AnswerResponse>() {
+                    @Override
+                    public void onResponse(Call<AnswerResponse> call, Response<AnswerResponse> response) {
+
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            try {
+                                int d = (int) Math.round(Double.parseDouble(response.body().getData().getPercentage_score()));
+                                showPopup(response.body().getData(), String.valueOf(d), response.body().getAssessment_msg());
+                                GlobalData.showToast(getBaseContext(), response.body().getAssessment_msg(), Toast.LENGTH_LONG).show();
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            try {
+                                handler.removeCallbacksAndMessages(null);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                try {
+                                    handler.removeCallbacksAndMessages(null);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<AnswerResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+            } else {
+                Cursor cursor = GlobalData.sdb.rawQuery("select * from assessment_question where category_id='"
+                        + CATEGORY_ID + "' and training_id='" + TRAINING_ID + "'", null);
+
+                if (isOffline || cursor.getCount() > 0) {
+                    GlobalData.sdb.execSQL("delete from assessment_answer where assessment_id='"
+                            + ASSESSMENT.getAssessmentid()
+                            + "' and category_id='" + CATEGORY_ID + "' and training_id='" + TRAINING_ID + "'");
+                    JsonElement jsonElement1 = gson.toJsonTree(
+                            map, new TypeToken<HashMap<String, String>>() {
+                            }.getType());
+                    ContentValues values = new ContentValues();
+                    values.put("assessment_answer", jsonElement1.toString());
+                    values.put("training_id", TRAINING_ID);
+                    values.put("category_id", CATEGORY_ID);
+                    values.put("assessment_id", ASSESSMENT.getAssessmentid());
+                    GlobalData.sdb.insert("assessment_answer", null, values);
+                    GlobalData.showToast(getBaseContext(), "Assessment saved on local, will sync to server when online", Toast.LENGTH_LONG).show();
+                    try {
+                        handler.removeCallbacksAndMessages(null);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    finish();
+                    AssessmentActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                            R.anim.animation_f_leave);
+                } else {
+                    GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+                }
+            }
+
+        }
+    }
+
+    private void showPopup(final AssessmentScore assessmentScore, String s, String msg) {
+        View view = LayoutInflater.from(AssessmentActivity.this).inflate(
+                R.layout.assessment_popup, null);
+        view.findViewById(R.id.continueButton).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        try {
+                            handler.removeCallbacksAndMessages(null);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        finish();
+                        AssessmentActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                                R.anim.animation_f_leave);
+                    }
+                });
+
+        view.findViewById(R.id.reviewButton).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        ReviewActivity.ASSESSMENT = ASSESSMENT;
+                        ReviewActivity.ASSESSMENT_SCORE = assessmentScore;
+                        startActivity(new Intent(AssessmentActivity.this, ReviewActivity.class));
+                        try {
+                            handler.removeCallbacksAndMessages(null);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        finish();
+                    }
+                });
+
+        TextView linkView = view.findViewById(R.id.score);
+        TextView assesmentName = view.findViewById(R.id.assesmentName);
+        linkView.setText(s);
+
+        TextView assesmentMessage = view.findViewById(R.id.assesmentMessage);
+        assesmentMessage.setText(msg);
+
+        assesmentName.setText("For " + ASSESSMENT.getAssessmentname());
+        alertDialogBuilder = new AlertDialog.Builder(AssessmentActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        new AlertDialog.Builder(AssessmentActivity.this)
+                .setMessage("Are you sure you want to exit the assessment?")
+                .setPositiveButton("Yes",
+                        new DialogInterface.OnClickListener() {
+                            @Override
+                            public void onClick(
+                                    DialogInterface dialog,
+                                    int which) {
+                                try {
+                                    handler.removeCallbacksAndMessages(null);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+
+                                getToTime();
+
+                                finish();
+                                AssessmentActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                                        R.anim.animation_f_leave);
+                            }
+                        }).setNegativeButton("No", null).show();
+    }
+
+    private void getToTime() {
+
+        c = Calendar.getInstance();
+        System.out.println("toTime " + c.getTime());
+
+        df = new SimpleDateFormat("HH:mm:ss");
+        toTime = df.format(c.getTime());
+        Log.e("toTime", toTime);
+
+        finalTime = UtilService.getTimeInterval(this, df, fromTime, toTime);
+
+        if (GlobalData.user.getData().getRole().equalsIgnoreCase("9"))
+            sendHitCountToServer();
+
+    }
+
+    @Override
+    public void onBackPressed() {
+
+        confirmClose();
+    }
+
+    @SuppressLint("StaticFieldLeak")
+    private void getAssesmentQuistion() {
+        progressDialog = new TransparentProgressDialog(AssessmentActivity.this);
+        progressDialog.show();
+
+        if (new UtilService().isNetworkAvailable(AssessmentActivity.this)) {
+            restService.getAssesmentQuistion(ASSESSMENT.getAssessmentid()).enqueue(new Callback<AssessmentQuestionResponse>() {
+                @Override
+                public void onResponse(Call<AssessmentQuestionResponse> call, Response<AssessmentQuestionResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        ASSESSMENT_QUESTIONS = response.body().getData();
+                        bundle = new Bundle();
+                        bundle.putString("Assessment_questions", "Get All Assessment Questions");
+                        firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
+
+                        Cursor cursor = GlobalData.sdb.rawQuery("select * from assessment_question where assessment_id='"
+                                + ASSESSMENT.getAssessmentid()
+                                + "' and category_id='" + CATEGORY_ID + "' and training_id='" + TRAINING_ID + "'", null);
+                        if (cursor.getCount() > 0) {
+                            GlobalData.sdb.execSQL("delete from assessment_question where assessment_id='"
+                                    + ASSESSMENT.getAssessmentid()
+                                    + "' and category_id='" + CATEGORY_ID + "' and training_id='" + TRAINING_ID + "'");
+                            Gson gson = new Gson();
+                            JsonElement jsonElement = gson.toJsonTree(
+                                    ASSESSMENT_QUESTIONS, new TypeToken<ArrayList<AssessmentQuestion>>() {
+                                    }.getType());
+                            ContentValues values = new ContentValues();
+                            values.put("assessment_question", jsonElement.toString());
+                            values.put("training_id", TRAINING_ID);
+                            values.put("category_id", CATEGORY_ID);
+                            values.put("assessment_id", ASSESSMENT.getAssessmentid());
+                            GlobalData.sdb.insert("assessment_question", null, values);
+                        }
+
+                        setAssesmentQuistion();
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        try {
+                            handler.removeCallbacksAndMessages(null);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            try {
+                                handler.removeCallbacksAndMessages(null);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            finish();
+                        }
+                    }
+                }
+
+                @Override
+                public void onFailure(Call<AssessmentQuestionResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            new AsyncTask<Void, Void, String>() {
+                @Override
+                protected String doInBackground(Void... params) {
+                    try {
+                        Cursor cursor = GlobalData.sdb.rawQuery("select * from assessment_question where category_id='"
+                                + CATEGORY_ID + "' and training_id='" + TRAINING_ID + "' and assessment_id='"
+                                + ASSESSMENT.getAssessmentid() + "'", null);
+                        ASSESSMENT_QUESTIONS = new ArrayList<>();
+                        if (cursor.getCount() != 0) {
+                            cursor.moveToFirst();
+                            Gson gson = new Gson();
+                            ASSESSMENT_QUESTIONS = gson.fromJson(
+                                    cursor.getString(cursor.getColumnIndex("assessment_question")),
+                                    new TypeToken<ArrayList<AssessmentQuestion>>() {
+                                    }.getType());
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return null;
+                }
+
+                @Override
+                protected void onPostExecute(String s) {
+                    super.onPostExecute(s);
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    if (ASSESSMENT_QUESTIONS.size() == 0) {
+                        GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+                    }
+                    setAssesmentQuistion();
+                }
+            }.execute();
+        }
+    }
+
+    private void setAssesmentQuistion() {
+        viewPager.setPageTransformer(true, new DepthPageTransformerNew());
+        viewPager.setAdapter(new AssesmentQuistionAdapter(getSupportFragmentManager()));
+        indicatorTab.setViewPager(viewPager);
+        viewPager.setPagingEnabled(true);
+        if (ASSESSMENT_QUESTIONS.size() > 0) {
+            previous.setEnabled(false);
+            next.setEnabled(true);
+            if (ASSESSMENT_QUESTIONS.size() == 1) {
+                submitButton.setVisibility(View.VISIBLE);
+            }
+        }
+        viewPager.setOffscreenPageLimit(ASSESSMENT_QUESTIONS.size());
+
+        if (ASSESSMENT.getAssessmenttimetype().trim().equalsIgnoreCase("1")) {
+            if (!ASSESSMENT.getAssessmenttime().trim().isEmpty()) {
+                int seconds = Integer.parseInt(ASSESSMENT.getAssessmenttime().trim()) * 60;
+//                seconds = 60;
+                linearTimerView.setMax(seconds);
+                linearTimerView.setProgress(seconds);
+                handler.post(runnable);
+            }
+        }
+
+        START_TIME = format.format(new Date());
+
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                if (getPreferences(MODE_PRIVATE).getBoolean("AssessmentActivity", true)) {
+//                    showHelpScreen();
+                    getPreferences(MODE_PRIVATE).edit().putBoolean("AssessmentActivity", false).apply();
+                }
+            }
+        }, 1000);
+    }
+
+    private void manageBlinkEffect() {
+        if (isBlinking) {
+            return;
+        }
+
+        isBlinking = true;
+        Animation anim = new AlphaAnimation(0.0f, 1.0f);
+        anim.setDuration(1000);
+        anim.setStartOffset(20);
+        anim.setRepeatMode(Animation.REVERSE);
+        anim.setRepeatCount(Animation.INFINITE);
+        time.startAnimation(anim);
+    }
+
+    private void updateProgressColor() {
+        float progress = linearTimerView.getProgress() / linearTimerView.getMax() * 100;
+        if (progress < 20) {
+            time.setTextColor(Color.parseColor("#F44336"));
+            linearTimerView.setProgressColor(Color.parseColor("#F44336"));
+            manageBlinkEffect();
+        } else {
+            linearTimerView.setProgressColor(Color.parseColor("#00344c"));
+            time.setTextColor(Color.parseColor("#00344c"));
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (GlobalData.canLogout) {
+            try {
+                handler.removeCallbacksAndMessages(null);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            finish();
+        }
+    }
+
+    private void showHelpScreen() {
+        bundle = new Bundle();
+        bundle.putString("Assessment_help_screen", "Assessment Help Screen");
+        firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
+
+        try {
+            new FancyShowCaseView.Builder(this)
+                    .focusOn((View) indicatorTab.getParent())
+                    .title("Tap on the arrows to navigate next or previous questions")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .focusShape(FocusShape.CIRCLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public class AssesmentQuistionAdapter extends FragmentStatePagerAdapter {
+
+        private AssesmentQuistionAdapter(FragmentManager fm) {
+            super(fm);
+        }
+
+        @Override
+        public Fragment getItem(int position) {
+            QuestionFragment fragment = new QuestionFragment();
+            fragment.setTrainingId(TRAINING_ID);
+            fragment.setAssessmentQuestion(ASSESSMENT_QUESTIONS.get(position));
+            fragment.setQuestionNo(String.valueOf((position + 1)));
+            return fragment;
+        }
+
+        @Override
+        public int getCount() {
+            return ASSESSMENT_QUESTIONS.size();
+        }
+
+
+        @Override
+        public CharSequence getPageTitle(int position) {
+            return String.valueOf((position + 1));
+        }
+    }
+}

+ 395 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/AudioViewActivity.java

@@ -0,0 +1,395 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.media.MediaPlayer;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.StrictMode;
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.appbar.CollapsingToolbarLayout;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.AppCompatSeekBar;
+import androidx.appcompat.widget.Toolbar;
+import android.text.method.ScrollingMovementMethod;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.ProgressBar;
+import android.widget.SeekBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.MyCallback;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.MyContent;
+import com.ttiglobal.inttilectgpchat.wrappers.MyTopic;
+import com.ttiglobal.inttilectgpchat.wrappers.TrainingCategory;
+
+import java.util.HashMap;
+import java.util.Objects;
+
+import retrofit2.Call;
+import retrofit2.Response;
+
+
+public class AudioViewActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener,
+        MediaPlayer.OnBufferingUpdateListener {
+    TextView contentTitle, contentDescription;
+    public static MyContent CONTENT = new MyContent();
+    public static MyTopic TOPIC = new MyTopic();
+    public static TrainingCategory TRAINING_ID;
+
+    ApiService restService;
+
+    ImageButton toolPlayIcon, stopButton;
+    AppBarLayout appBarLayout;
+    Toolbar toolbar;
+    FloatingActionButton playButton;
+    CollapsingToolbarLayout collapsingToolbar;
+    private MediaPlayer mediaPlayer;
+    private int mediaFileLengthInMilliseconds;
+    private Handler handler = new Handler();
+    ProgressBar progressBar;
+    private AppCompatSeekBar seekBar;
+    TextView seekValue;
+    private int mDurationSecondsMax = 0;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_audio_view);
+        setupWindowAnimations();
+        restService = ((MainApplication) getApplication()).getClient();
+
+        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+        StrictMode.setThreadPolicy(policy);
+
+        contentTitle = findViewById(R.id.contentTitle);
+        contentTitle.setText(CONTENT.getTitle());
+        contentDescription = findViewById(R.id.contentDescription);
+        contentDescription.setText(CONTENT.getDescription());
+        contentDescription.setMovementMethod(new ScrollingMovementMethod());
+        toolPlayIcon = findViewById(R.id.toolPlayIcon);
+        appBarLayout = findViewById(R.id.appBarLayout);
+        toolbar = findViewById(R.id.toolbar);
+        seekBar = findViewById(R.id.seekBar);
+        seekValue = findViewById(R.id.seekValue);
+        stopButton = findViewById(R.id.stopButton);
+        progressBar = findViewById(R.id.progressBar);
+        progressBar.setVisibility(View.GONE);
+
+        stopButton.setEnabled(false);
+        seekBar.setEnabled(false);
+
+        setSupportActionBar(toolbar);
+        toolbar.setTitle("");
+        Objects.requireNonNull(getSupportActionBar()).setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+        collapsingToolbar = findViewById(R.id.collapsing_toolbar);
+
+        appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
+            @Override
+            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
+                if (Math.abs(verticalOffset) - appBarLayout.getTotalScrollRange() == 0) {
+                    toolbar.setBackgroundColor(Color.parseColor("#2f6aac"));
+                    toolPlayIcon.setVisibility(View.VISIBLE);
+                } else {
+                    toolbar.setBackgroundColor(Color.TRANSPARENT);
+                    toolPlayIcon.setVisibility(View.GONE);
+                }
+            }
+        });
+
+        playButton = findViewById(R.id.playButton);
+
+        playButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
+                    progressBar.setVisibility(View.VISIBLE);
+                    playButton.setImageResource(R.mipmap.pause_icon);
+                    toolPlayIcon.setImageResource(R.mipmap.pause_icon_white);
+                    new Handler().post(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                mediaPlayer.setDataSource(CONTENT.getContent_files().get(0).getFile_url().trim());
+                                mediaPlayer.prepare();
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            mediaFileLengthInMilliseconds = mediaPlayer.getDuration();
+                            seekBar.setMax(mediaFileLengthInMilliseconds / 1000);
+                            mDurationSecondsMax = mediaFileLengthInMilliseconds / 1000;
+                            seekValue.setText(secondsToTime(seekBar.getProgress()));
+
+                            if (seekBar.getProgress() == 0 && !CONTENT.getStatus().trim().equalsIgnoreCase("1")
+                                    && !CONTENT.getStatus().trim().equalsIgnoreCase("2")) {
+                                updateStatus("1");
+                            }
+                            seekBar.setEnabled(true);
+                            stopButton.setEnabled(true);
+                            mediaPlayer.start();
+                            progressBar.setVisibility(View.GONE);
+                            primarySeekBarProgressUpdater();
+                        }
+                    });
+                } else {
+                    Objects.requireNonNull(mediaPlayer).pause();
+                    playButton.setImageResource(R.mipmap.play_icon);
+                    toolPlayIcon.setImageResource(R.mipmap.play_icon_white);
+                    primarySeekBarProgressUpdater();
+                }
+            }
+        });
+
+        toolPlayIcon.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
+                    progressBar.setVisibility(View.VISIBLE);
+                    playButton.setImageResource(R.mipmap.pause_icon);
+                    toolPlayIcon.setImageResource(R.mipmap.pause_icon_white);
+                    new Handler().post(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                mediaPlayer.setDataSource(CONTENT.getContent_files().get(0).getFile_url().trim());
+                                mediaPlayer.prepare();
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            mediaFileLengthInMilliseconds = mediaPlayer.getDuration();
+                            seekBar.setMax(mediaFileLengthInMilliseconds / 1000);
+                            mDurationSecondsMax = mediaFileLengthInMilliseconds / 1000;
+                            seekValue.setText(secondsToTime(seekBar.getProgress()));
+
+                            if (seekBar.getProgress() == 0 && !CONTENT.getStatus().trim().equalsIgnoreCase("1")
+                                    && !CONTENT.getStatus().trim().equalsIgnoreCase("2")) {
+                                updateStatus("1");
+                            }
+                            seekBar.setEnabled(true);
+                            stopButton.setEnabled(true);
+                            mediaPlayer.start();
+                            progressBar.setVisibility(View.GONE);
+                            primarySeekBarProgressUpdater();
+                        }
+                    });
+                } else {
+                    Objects.requireNonNull(mediaPlayer).pause();
+                    playButton.setImageResource(R.mipmap.play_icon);
+                    toolPlayIcon.setImageResource(R.mipmap.play_icon_white);
+                    primarySeekBarProgressUpdater();
+                }
+            }
+        });
+
+        collapsingToolbar.setTitle(TOPIC.getTopicname());
+
+        mediaPlayer = new MediaPlayer();
+        mediaPlayer.setOnBufferingUpdateListener(this);
+        mediaPlayer.setOnCompletionListener(this);
+
+        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                seekValue.setText(secondsToTime(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                if (mediaPlayer.isPlaying()) {
+                    int playPositionInMillisecconds = seekBar.getProgress() * 1000;
+                    mediaPlayer.seekTo(playPositionInMillisecconds);
+                }
+            }
+        });
+
+        stopButton.setOnClickListener(new View.OnClickListener() {
+            @SuppressLint("SetTextI18n")
+            @Override
+            public void onClick(View v) {
+                try {
+                    mediaPlayer.stop();
+                    mediaPlayer.release();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                handler.removeCallbacksAndMessages(null);
+                seekBar.setProgress(0);
+                seekBar.setEnabled(false);
+                stopButton.setEnabled(false);
+                playButton.setImageResource(R.mipmap.play_icon);
+                toolPlayIcon.setImageResource(R.mipmap.play_icon_white);
+                seekValue.setText("00:00/00:00");
+                mediaPlayer = new MediaPlayer();
+            }
+        });
+    }
+
+    private void primarySeekBarProgressUpdater() {
+        try {
+            seekBar.setProgress(mediaPlayer.getCurrentPosition() / 1000);
+            if (mediaPlayer.isPlaying()) {
+                Runnable notification = new Runnable() {
+                    public void run() {
+                        primarySeekBarProgressUpdater();
+                    }
+                };
+                handler.postDelayed(notification, 1000);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private String secondsToTime(int seconds) {
+        String time;
+
+        String minutesText = String.valueOf(seconds / 60);
+        if (minutesText.length() == 1)
+            minutesText = "0" + minutesText;
+
+        String secondsText = String.valueOf(seconds % 60);
+        if (secondsText.length() == 1)
+            secondsText = "0" + secondsText;
+
+        String minutesText1 = String.valueOf(mDurationSecondsMax / 60);
+        if (minutesText1.length() == 1)
+            minutesText1 = "0" + minutesText1;
+
+        String secondsText1 = String.valueOf(mDurationSecondsMax % 60);
+        if (secondsText1.length() == 1)
+            secondsText1 = "0" + secondsText1;
+
+        time = minutesText + ":" + secondsText + "/" + minutesText1 + ":" + secondsText1;
+
+        return time;
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            if (mediaPlayer != null && mediaPlayer.isPlaying()) {
+                mediaPlayer.stop();
+            }
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        if (mediaPlayer != null && mediaPlayer.isPlaying()) {
+            mediaPlayer.stop();
+        }
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void updateStatus(String status) {
+        CONTENT.setStatus(status);
+        if (new UtilService().isNetworkAvailable(AudioViewActivity.this)) {
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("contentid", CONTENT.getContentid());
+                map.put("assettopicid", CONTENT.getAssettopicid());
+                map.put("status", status);
+
+                restService.updateContentStaus(map).enqueue(new MyCallback<ErrorResponse>(status) {
+                    @Override
+                    public void onResponse(Call<ErrorResponse> call, Response<ErrorResponse> response) {
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            CONTENT.setStatus(ids);
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<ErrorResponse> call, Throwable t) {
+
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    @Override
+    public void onBufferingUpdate(MediaPlayer mp, int percent) {
+        seekBar.setSecondaryProgress(percent);
+    }
+
+    @Override
+    public void onCompletion(MediaPlayer mp) {
+        if (!CONTENT.getStatus().trim().equalsIgnoreCase("2")) {
+            updateStatus("2");
+        }
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        if (mediaPlayer != null && mediaPlayer.isPlaying()) {
+            playButton.performClick();
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (mediaPlayer != null && mediaPlayer.isPlaying()) {
+            mediaPlayer.stop();
+        }
+    }
+
+}

+ 298 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/BulletinActivity.java

@@ -0,0 +1,298 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.BulletinAdapter;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.Bulletin;
+import com.ttiglobal.inttilectgpchat.wrappers.BulletinResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import java.util.ArrayList;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class BulletinActivity extends AppCompatActivity {
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    EmptyStateRecyclerView bulletinList;
+    TextView title;
+    ProgressBar progressBar;
+    LinearLayoutManager linearLayoutManager;
+    BulletinAdapter adapter = null;
+    int TOTAL_RECORD = 0;
+    int PAGE = 0;
+    int LIMIT = 10;
+    ArrayList<Bulletin> MY_CONTENTS = new ArrayList<>();
+    public  Bulletin Bulletin = new Bulletin();
+    private FirebaseAnalytics firebaseAnalytics;
+
+    @Override
+            protected void onCreate(Bundle savedInstanceState) {
+                super.onCreate(savedInstanceState);
+
+                setContentView(R.layout.activity_bulletin);
+                setupWindowAnimations();
+                setupUI(findViewById(R.id.bgLayout));
+            firebaseAnalytics = FirebaseAnalytics.getInstance(this);
+            restService = ((MainApplication) getApplication()).getClient();
+            title = findViewById(R.id.title);
+            bulletinList = findViewById(R.id.topicList);
+            bulletinList.setHasFixedSize(true);
+            bulletinList.setItemAnimator(new SlideInLeftAnimator());
+            linearLayoutManager = new LinearLayoutManager(getBaseContext());
+            bulletinList.setLayoutManager(linearLayoutManager);
+            bulletinList.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                    new TextStateDisplay(this, "No data available", ""));
+            title.setText("Bulletin");
+            bulletinList.addOnScrollListener(recyclerViewOnScrollListener);
+            progressBar = findViewById(R.id.progressBar);
+
+            Toolbar toolbar = findViewById(R.id.toolbar);
+            setSupportActionBar(toolbar);
+            toolbar.setNavigationIcon(R.mipmap.back);
+            toolbar.setContentInsetStartWithNavigation(0);
+            toolbar.setTitle("");
+            getSupportActionBar().setTitle("");
+            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+            getSupportActionBar().setDisplayShowHomeEnabled(true);
+            @SuppressLint("PrivateResource")
+            Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+            backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+            getSupportActionBar().setHomeAsUpIndicator(backArrow);
+            bulletinList.post(new Runnable() {
+                @Override
+                public void run() {
+                    getBulletinContents(true);
+                }
+            });
+            findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                  //  showHelpScreen();
+                }
+            });
+        Bundle bundle = new Bundle();
+        /*bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
+        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "BulletinActivity");
+        //bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
+        firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);*/
+
+        }
+
+    private RecyclerView.OnScrollListener recyclerViewOnScrollListener = new RecyclerView.OnScrollListener() {
+        @Override
+        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+            super.onScrollStateChanged(recyclerView, newState);
+        }
+
+        @Override
+        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+            super.onScrolled(recyclerView, dx, dy);
+            int visibleItemCount = linearLayoutManager.getChildCount();
+            int totalItemCount = linearLayoutManager.getItemCount();
+            int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
+
+            if (progressBar.getVisibility() != View.VISIBLE) {
+                if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
+                        && firstVisibleItemPosition >= 0
+                        && totalItemCount < TOTAL_RECORD && MY_CONTENTS.size() < TOTAL_RECORD) {
+                    PAGE++;
+                    getBulletinContents(false);
+                }
+            }
+        }
+    };
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(BulletinActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (adapter != null) {
+            adapter.notifyDataSetChanged();
+        }
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+    private void showHelpScreen() {
+        try {
+            View view;
+            if (adapter != null && adapter.getItemCount() > 0) {
+                view = bulletinList.findViewHolderForAdapterPosition(linearLayoutManager.findFirstVisibleItemPosition()).itemView;
+            } else {
+                view = bulletinList;
+            }
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(view)
+                    .title("Tap here to view the PDF or Video")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .focusShape(FocusShape.ROUNDED_RECTANGLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        finish();
+        BulletinActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void getBulletinContents(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(BulletinActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(BulletinActivity.this);
+                progressDialog.show();
+                progressBar.setVisibility(View.GONE);
+            } else {
+                progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getBulletinContents(PAGE, LIMIT).enqueue(new Callback<BulletinResponse>() {
+                @Override
+                public void onResponse(Call<BulletinResponse> call, Response<BulletinResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        TOTAL_RECORD = Integer.parseInt(response.body().getTotal());
+                        if (adapter == null) {
+                            MY_CONTENTS = response.body().getData();
+                            adapter = new BulletinAdapter(BulletinActivity.this,  MY_CONTENTS);
+                            bulletinList.setAdapter(adapter);
+                        } else {
+                            MY_CONTENTS.addAll(response.body().getData());
+
+                        }
+
+                        if (MY_CONTENTS.size() == 0) {
+                            bulletinList.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+                        } else {
+                            bulletinList.invokeState(EmptyStateRecyclerView.STATE_OK);
+                        }
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    }
+
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (getPreferences(MODE_PRIVATE).getBoolean("ContentListActivity", true)) {
+                               // showHelpScreen();
+                                getPreferences(MODE_PRIVATE).edit().putBoolean("ContentListActivity", false).apply();
+                            }
+                        }
+                    }, 1000);
+                }
+
+                @Override
+                public void onFailure(Call<BulletinResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+}

+ 108 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/BulletinDetails.java

@@ -0,0 +1,108 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.request.RequestOptions;
+import com.ttiglobal.inttilectgpchat.wrappers.Bulletin;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class BulletinDetails extends AppCompatActivity {
+    public static Bulletin CONTENT = new Bulletin();
+    TextView title,desc,publishedDate,headtitle;
+ImageView image;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_bulletin_details);
+        setupWindowAnimations();
+
+        headtitle = findViewById(R.id.title);
+        title = findViewById(R.id.bulletinTitle);
+        desc = findViewById(R.id.bulletinDescription);
+        publishedDate = findViewById(R.id.publishedDate);
+        image=findViewById(R.id.myImage);
+      //  mImageLangSelection = findViewById(R.id.imgLanguage);
+        publishedDate.setText("Published On: "+dateFormate(CONTENT.getPublished_date()));
+        title.setText(CONTENT.getBulletin_title());
+        headtitle.setText("Bulletin");
+        desc.setText(CONTENT.getBulletin_desc());
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+        findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+            }
+        });
+        Glide.with(this).load(CONTENT.getImage_url())
+                .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
+                        .placeholder(R.drawable.placeholder)).into(image);
+    }
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        finish();
+        BulletinDetails.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+    public String dateFormate(String dte) {
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date newDate = null;
+        try {
+            newDate = format.parse(dte);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        format = new SimpleDateFormat("dd-MMM-yyyy");
+        String date = format.format(newDate);
+
+
+        return date;
+    }
+
+}

+ 241 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ChangePasswordActivity.java

@@ -0,0 +1,241 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
+import android.text.TextUtils;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class ChangePasswordActivity extends AppCompatActivity {
+    EditText newPassword, confirmPassword, oldPassword;
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z,A-Z]).{8,30})";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_change_password);
+        GlobalData.openDatabase(ChangePasswordActivity.this);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.bgLayout));
+
+        restService = ((MainApplication) getApplication()).getClient();
+        newPassword = findViewById(R.id.newPassword);
+        confirmPassword = findViewById(R.id.confirmPassword);
+        oldPassword = findViewById(R.id.oldPassword);
+
+        findViewById(R.id.continueButton).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                attemptLogin();
+            }
+        });
+
+//        Toolbar toolbar = findViewById(R.id.toolbar);
+//        setSupportActionBar(toolbar);
+//        toolbar.setTitle("");
+//        getSupportActionBar().setTitle("");
+//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+//        getSupportActionBar().setDisplayShowHomeEnabled(true);
+       @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+//        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        ImageView imageView = findViewById(R.id.back_btn);
+        imageView.setImageDrawable(backArrow);
+        imageView.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+                overridePendingTransition(R.anim.animation_f_enter,
+                        R.anim.animation_f_leave);
+            }
+        });
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        finish();
+        overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void attemptLogin() {
+        String nPassword = newPassword.getText().toString().trim();
+        String cPassword = confirmPassword.getText().toString().trim();
+        String oPassword = oldPassword.getText().toString().trim();
+
+        boolean cancel = false;
+        View focusView = null;
+        if (TextUtils.isEmpty(oPassword) && TextUtils.isEmpty(nPassword) && TextUtils.isEmpty(cPassword)) {
+            GlobalData.showToast(getBaseContext(), "Please fill in all necessary fields.", Toast.LENGTH_SHORT).show();
+            focusView = oldPassword;
+            cancel = true;
+        } else if (TextUtils.isEmpty(oPassword)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the old password", Toast.LENGTH_SHORT).show();
+            focusView = oldPassword;
+            cancel = true;
+        } else if (TextUtils.isEmpty(nPassword)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the new password", Toast.LENGTH_SHORT).show();
+            focusView = newPassword;
+            cancel = true;
+        } else if (TextUtils.isEmpty(cPassword)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the confirm password", Toast.LENGTH_SHORT).show();
+            focusView = confirmPassword;
+            cancel = true;
+        } else if (!nPassword.equals(cPassword)) {
+            GlobalData.showToast(getBaseContext(), "Password not matching", Toast.LENGTH_SHORT).show();
+            focusView = confirmPassword;
+            cancel = true;
+        } else if (!Pattern.compile(PASSWORD_PATTERN).matcher(cPassword).matches()) {
+            GlobalData.showToast(getBaseContext(), "The password must have at least 8 characters and its alphanumeric", Toast.LENGTH_LONG).show();
+            focusView = confirmPassword;
+            cancel = true;
+        }
+
+        if (cancel) {
+            focusView.requestFocus();
+        } else {
+            if (new UtilService().isNetworkAvailable(ChangePasswordActivity.this)) {
+                progressDialog = new TransparentProgressDialog(ChangePasswordActivity.this);
+                progressDialog.show();
+
+                try {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("new_password", nPassword);
+                    map.put("current_password", oPassword);
+                    map.put("type", "old");
+
+                    restService.changePassword(map).enqueue(new Callback<ErrorResponse>() {
+                        @Override
+                        public void onResponse(Call<ErrorResponse> call, Response<ErrorResponse> response) {
+
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+
+                            if (response.body() != null && response.body().getStatus() == 200) {
+                                GlobalData.showToast(getBaseContext(), "Password changed successfully", Toast.LENGTH_SHORT).show();
+                                finish();
+                                ChangePasswordActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                                        R.anim.animation_f_leave);
+                            } else if (response.body() != null && response.body().getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            } else if (response.body() != null) {
+                                GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                            } else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                                if (message.getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    finish();
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<ErrorResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+        }
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(ChangePasswordActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+

+ 404 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ContentListActivity.java

@@ -0,0 +1,404 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.database.Cursor;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.adapter.ContentAdapter;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.CommonResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ContentResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.HitCountModel;
+import com.ttiglobal.inttilectgpchat.wrappers.MyContent;
+import com.ttiglobal.inttilectgpchat.wrappers.MyTopic;
+import com.ttiglobal.inttilectgpchat.wrappers.TrainingCategory;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class ContentListActivity extends AppCompatActivity {
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    EmptyStateRecyclerView topicList;
+    TextView title;
+    public static MyTopic TOPIC = new MyTopic();
+    int PAGE = 0;
+    int LIMIT = 10;
+    ContentAdapter adapter = null;
+
+    ArrayList<MyContent> FILTER_CONTENTS = new ArrayList<>();
+
+    LinearLayoutManager linearLayoutManager;
+    int TOTAL_RECORD = 0;
+    ArrayList<MyContent> MY_CONTENTS = new ArrayList<>();
+    ProgressBar progressBar;
+    EditText contentSearch;
+    public static TrainingCategory TRAINING_ID;
+    private StorePreference storePreference;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_content_list);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.bgLayout));
+
+        restService = ((MainApplication) getApplication()).getClient();
+        title = findViewById(R.id.title);
+        topicList = findViewById(R.id.topicList);
+        topicList.setHasFixedSize(true);
+        topicList.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new LinearLayoutManager(getBaseContext());
+        topicList.setLayoutManager(linearLayoutManager);
+        topicList.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                new TextStateDisplay(this, "No data available", ""));
+        topicList.addOnScrollListener(recyclerViewOnScrollListener);
+        title.setText(TOPIC.getTopicname());
+        storePreference = new StorePreference(this);
+
+        title.setSelected(true);
+        topicList.addOnScrollListener(recyclerViewOnScrollListener);
+        progressBar = findViewById(R.id.progressBar);
+        contentSearch = findViewById(R.id.contentSearch);
+        contentSearch.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                doFilter();
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        topicList.post(new Runnable() {
+            @Override
+            public void run() {
+                getTopicContents(true);
+            }
+        });
+        findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showHelpScreen();
+            }
+        });
+        if (StorePreference.getInstance(this).getBooleanValue(GlobalData.ISDSELOGIN))
+            sendHitCountToServer();
+    }
+
+
+    private void sendHitCountToServer() {
+        restService.sendAllHitCount(buildConfigData()).enqueue(new Callback<CommonResponse>() {
+            @Override
+            public void onResponse(Call<CommonResponse> call, Response<CommonResponse> response) {
+
+            }
+
+            @Override
+            public void onFailure(Call<CommonResponse> call, Throwable t) {
+                if (t.getMessage() != null) {
+                    Log.e("responeHit", t.getMessage());
+                }
+            }
+        });
+    }
+
+    private HitCountModel buildConfigData() {
+        Calendar calendar = Calendar.getInstance();
+        HitCountModel hitCountModel = new HitCountModel();
+        hitCountModel.setPage("Learning");
+        hitCountModel.setCateid(Integer.valueOf(TOPIC.getCateid()));
+        hitCountModel.setAssettopicid(Integer.valueOf(TOPIC.getAssettopicid()));
+        hitCountModel.setViewtime("0");
+        return hitCountModel;
+    }
+
+    private void showHelpScreen() {
+        try {
+            View view;
+            if (adapter != null && adapter.getItemCount() > 0) {
+                view = topicList.findViewHolderForAdapterPosition(linearLayoutManager.findFirstVisibleItemPosition()).itemView;
+            } else {
+                view = topicList;
+            }
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(view)
+                    .title("Tap here to view the PDF or Video")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .focusShape(FocusShape.ROUNDED_RECTANGLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void doFilter() {
+        FILTER_CONTENTS.clear();
+        for (int i = 0; i < MY_CONTENTS.size(); i++) {
+            if (MY_CONTENTS.get(i).getTitle().trim().toLowerCase().contains(contentSearch.getText().toString().toLowerCase().trim()) ||
+                    MY_CONTENTS.get(i).getDescription().trim().toLowerCase().contains(contentSearch.getText().toString().trim().toLowerCase()) ||
+                    MY_CONTENTS.get(i).getContent_files().get(0).getFiletype().trim().toLowerCase().contains(contentSearch.getText().toString().trim().toLowerCase()))
+                FILTER_CONTENTS.add(MY_CONTENTS.get(i));
+        }
+        adapter.notifyDataSetChanged();
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (adapter != null) {
+            adapter.notifyDataSetChanged();
+        }
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    @SuppressLint("StaticFieldLeak")
+    private void getTopicContents(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(ContentListActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(ContentListActivity.this);
+                progressDialog.show();
+                progressBar.setVisibility(View.GONE);
+            } else {
+                progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getTopicContents(TOPIC.getAssettopicid(), PAGE, LIMIT).enqueue(new Callback<ContentResponse>() {
+                @Override
+                public void onResponse(Call<ContentResponse> call, Response<ContentResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        TOTAL_RECORD = Integer.parseInt(response.body().getTotal());
+                        if (adapter == null) {
+                            MY_CONTENTS = response.body().getData();
+                            setContentList();
+                        } else {
+                            MY_CONTENTS.addAll(response.body().getData());
+                            doFilter();
+                        }
+
+                        if (MY_CONTENTS.size() == 0) {
+                            topicList.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+                        } else {
+                            topicList.invokeState(EmptyStateRecyclerView.STATE_OK);
+                        }
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    }
+
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (getPreferences(MODE_PRIVATE).getBoolean("ContentListActivity", true)) {
+//                                showHelpScreen();
+                                getPreferences(MODE_PRIVATE).edit().putBoolean("ContentListActivity", false).apply();
+                            }
+                        }
+                    }, 1000);
+                }
+
+                @Override
+                public void onFailure(Call<ContentResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+
+            Cursor cursor = GlobalData.sdb.rawQuery("select * from topic_content where" + " category_id='"
+                    + TRAINING_ID.getCateid() +
+                    "' and topic_id='" + TOPIC.getAssettopicid() + "'", null);
+
+            MY_CONTENTS = new ArrayList<>();
+            if (cursor.getCount() > 0) {
+                cursor.moveToFirst();
+                Gson gson = new Gson();
+                for (int i = 0; i < cursor.getCount(); i++) {
+                    MyContent myContent = gson.fromJson(
+                            cursor.getString(cursor.getColumnIndex("topic_content")),
+                            new TypeToken<MyContent>() {
+                            }.getType());
+                    MY_CONTENTS.add(myContent);
+                    cursor.moveToNext();
+                }
+                setContentList();
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+
+        }
+    }
+
+    private void setContentList() {
+        FILTER_CONTENTS.addAll(MY_CONTENTS);
+        adapter = new ContentAdapter(ContentListActivity.this, FILTER_CONTENTS, TOPIC, TRAINING_ID);
+        topicList.setAdapter(adapter);
+    }
+
+    private RecyclerView.OnScrollListener recyclerViewOnScrollListener = new RecyclerView.OnScrollListener() {
+        @Override
+        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+            super.onScrollStateChanged(recyclerView, newState);
+        }
+
+        @Override
+        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+            super.onScrolled(recyclerView, dx, dy);
+            int visibleItemCount = linearLayoutManager.getChildCount();
+            int totalItemCount = linearLayoutManager.getItemCount();
+            int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
+
+            if (progressBar.getVisibility() != View.VISIBLE) {
+                if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
+                        && firstVisibleItemPosition >= 0
+                        && totalItemCount < TOTAL_RECORD && MY_CONTENTS.size() < TOTAL_RECORD) {
+                    PAGE++;
+                    getTopicContents(false);
+                }
+            }
+        }
+    };
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(ContentListActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 179 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/CropActivity.java

@@ -0,0 +1,179 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Toast;
+
+import com.ttiglobal.inttilectgpchat.cropview.CropImageView;
+import com.ttiglobal.inttilectgpchat.cropview.callback.CropCallback;
+import com.ttiglobal.inttilectgpchat.cropview.callback.LoadCallback;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class CropActivity extends AppCompatActivity {
+
+    public static Uri mSourceUri;
+    CropImageView mCropView;
+    TransparentProgressDialog progressDialog;
+    private Bitmap.CompressFormat mCompressFormat = Bitmap.CompressFormat.JPEG;
+    String IMAGE_PATH;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.crop_image_activity);
+        setupWindowAnimations();
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        mCropView = findViewById(R.id.cropImageView);
+
+        findViewById(R.id.buttonRotateLeft).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                mCropView.rotateImage(CropImageView.RotateDegrees.ROTATE_M90D);
+            }
+        });
+
+        findViewById(R.id.buttonRotateRight).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                mCropView.rotateImage(CropImageView.RotateDegrees.ROTATE_90D);
+            }
+        });
+
+        findViewById(R.id.buttonPickImage).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent result = new Intent();
+                setResult(Activity.RESULT_CANCELED, result);
+                finish();
+            }
+        });
+
+        findViewById(R.id.buttonDone).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                cropImage();
+            }
+        });
+
+        File f = new File(Environment.getExternalStorageDirectory(), ".SUZUKI");
+        if (!f.exists()) {
+            f.mkdirs();
+        }
+
+        File f1 = new File(Environment.getExternalStorageDirectory() + "/" + ".SUZUKI", "Profile");
+        if (!f1.exists()) {
+            f1.mkdirs();
+        }
+
+        mCropView.post(new Runnable() {
+            @Override
+            public void run() {
+                loadImage();
+            }
+        });
+    }
+
+    @Override
+    public void onBackPressed() {
+        Intent result = new Intent();
+        setResult(Activity.RESULT_CANCELED, result);
+        finish();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            Intent result = new Intent();
+            setResult(Activity.RESULT_CANCELED, result);
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void loadImage() {
+        mCropView.load(mSourceUri).execute(new LoadCallback() {
+            @Override
+            public void onSuccess() {
+                mCropView.setCropMode(CropImageView.CropMode.SQUARE);
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                Toast.makeText(CropActivity.this, "Error", Toast.LENGTH_SHORT).show();
+            }
+        });
+    }
+
+    private void cropImage() {
+        showProgress();
+        mCropView.crop(mSourceUri).execute(new CropCallback() {
+            @Override
+            public void onSuccess(Bitmap cropped) {
+                String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
+                String imageFileName = timeStamp + ".jpg";
+                File f1 = new File(Environment.getExternalStorageDirectory() + "/" + ".SUZUKI/Profile", imageFileName);
+                IMAGE_PATH = f1.getAbsolutePath();
+                try {
+                    FileOutputStream out = new FileOutputStream(f1);
+                    cropped.compress(Bitmap.CompressFormat.JPEG, 60, out);
+                    out.flush();
+                    out.close();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                dismissProgress();
+                Intent result = new Intent();
+                result.setData(Uri.fromFile(f1));
+                result.putExtra("IMAGE_PATH", IMAGE_PATH);
+                setResult(Activity.RESULT_OK, result);
+                finish();
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                dismissProgress();
+            }
+        });
+    }
+
+    public void showProgress() {
+        progressDialog = new TransparentProgressDialog(CropActivity.this);
+        progressDialog.show();
+    }
+
+    public void dismissProgress() {
+        if (progressDialog != null && progressDialog.isShowing()) {
+            progressDialog.dismiss();
+        }
+    }
+}

+ 129 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/FaqActivity.java

@@ -0,0 +1,129 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.StrictMode;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ProgressBar;
+
+import com.github.barteksc.pdfviewer.PDFView;
+import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
+import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
+import com.github.barteksc.pdfviewer.listener.OnPageErrorListener;
+import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
+import com.github.barteksc.pdfviewer.util.FitPolicy;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+
+import java.net.URL;
+
+public class FaqActivity extends AppCompatActivity implements OnPageChangeListener, OnPageErrorListener, OnLoadCompleteListener {
+
+    TransparentProgressDialog progressDialog;
+    PDFView pdfView;
+    ProgressBar progressBar;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_faq);
+        setupWindowAnimations();
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        progressBar = findViewById(R.id.progressBar);
+        pdfView = findViewById(R.id.pdfView);
+        progressBar.setVisibility(View.VISIBLE);
+        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+        StrictMode.setThreadPolicy(policy);
+
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                try {
+
+                    pdfView.fromStream(new URL(GlobalData.FAQ_URL+"faq/"+GlobalData.user.getData().getRole()+"/"+"faq.pdf").openStream())
+                            .onPageChange(FaqActivity.this)
+                            .enableAnnotationRendering(true)
+                            .onLoad(FaqActivity.this)
+                            .scrollHandle(new DefaultScrollHandle(FaqActivity.this))
+                            .spacing(10)
+                            .onPageError(FaqActivity.this)
+                            .pageFitPolicy(FitPolicy.WIDTH)
+                            .load();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    progressBar.setVisibility(View.GONE);
+                }
+            }
+        }, 1000);
+    }
+
+    @Override
+    public void onBackPressed() {
+        Intent result = new Intent();
+        setResult(Activity.RESULT_CANCELED, result);
+        finish();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    public void showProgress() {
+        progressDialog = new TransparentProgressDialog(FaqActivity.this);
+        progressDialog.show();
+    }
+
+    public void dismissProgress() {
+        if (progressDialog != null && progressDialog.isShowing()) {
+            progressDialog.dismiss();
+        }
+    }
+
+    @Override
+    public void loadComplete(int nbPages) {
+        progressBar.setVisibility(View.GONE);
+    }
+
+    @Override
+    public void onPageChanged(int page, int pageCount) {
+
+    }
+
+    @Override
+    public void onPageError(int page, Throwable t) {
+
+    }
+}

+ 483 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ForgotPasswordActivity.java

@@ -0,0 +1,483 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.os.Bundle;
+import com.google.android.material.textfield.TextInputLayout;
+import androidx.core.app.ActivityCompat;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.pinview.PinView;
+import com.ttiglobal.inttilectgpchat.tooltip.Tooltip;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ForgotPasswordResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.OtpResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.UserResponse;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class ForgotPasswordActivity extends AppCompatActivity {
+
+    public ForgotPasswordResponse signup = new ForgotPasswordResponse();
+    public int counter;
+    public OtpResponse errorResponse = new OtpResponse();
+    public UserResponse user = new UserResponse();
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    EditText userName;
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    TextInputLayout inputLayout;
+    PinView pinview;
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            Objects.requireNonNull(inputMethodManager).hideSoftInputFromWindow(
+                    Objects.requireNonNull(activity.getCurrentFocus()).getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_forgotpassword);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.bgLayout));
+        restService = ((MainApplication) getApplication()).getClient();
+
+        checkPermission();
+
+        userName = findViewById(R.id.userName);
+
+        findViewById(R.id.continueButton).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                attemptForgotPassword();
+            }
+        });
+
+        findViewById(R.id.info).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                String header = "If you are dealer staff enter the SMPIN for registering and logging into the system\n" +
+                        "\nIf you are Suzuki staff enter your Employee ID for registering and logging into the system";
+                View mView = LayoutInflater.from(ForgotPasswordActivity.this).inflate(R.layout.login_tooltip_text, null);
+                TextView text = mView.findViewById(R.id.text11);
+                text.setText(header);
+                Tooltip.TooltipView tooltip = Tooltip.make(ForgotPasswordActivity.this,
+                        new Tooltip.Builder(101)
+                                .anchor(view, Tooltip.Gravity.TOP)
+                                .closePolicy(new Tooltip.ClosePolicy()
+                                        .insidePolicy(true, false)
+                                        .outsidePolicy(true, false), 0)
+                                .activateDelay(800)
+                                .withStyleId(R.style.ToolTipLayoutCustomStyle)
+                                .showDelay(300)
+                                .text("")
+                                .setBgColor(getResources().getColor(R.color.bg_color))
+                                .view(mView)
+                                .maxWidth(300)
+                                .withArrow(true)
+                                .build()
+                );
+                tooltip.setTextColor(Color.YELLOW);
+                tooltip.show();
+            }
+        });
+
+
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+//        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        ImageView imageView = findViewById(R.id.back_btn);
+        imageView.setImageDrawable(backArrow);
+        imageView.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+                overridePendingTransition(R.anim.animation_f_enter,
+                        R.anim.animation_f_leave);
+            }
+        });
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void attemptForgotPassword() {
+        String inputString = userName.getText().toString().trim();
+
+        boolean cancel = false;
+        View focusView = null;
+        HashMap<String, String> map = new HashMap<>();
+
+        if (TextUtils.isEmpty(inputString)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the SMPIN", Toast.LENGTH_SHORT).show();
+            focusView = userName;
+            cancel = true;
+        }
+        map.put("username", inputString);
+        map.put("device_type", "android");
+        if (cancel) {
+            focusView.requestFocus();
+        } else {
+            if (new UtilService().isNetworkAvailable(ForgotPasswordActivity.this)) {
+                progressDialog = new TransparentProgressDialog(ForgotPasswordActivity.this);
+                progressDialog.show();
+                try {
+                    restService.forgotPassword(map).enqueue(new Callback<ForgotPasswordResponse>() {
+                        @Override
+                        public void onResponse(Call<ForgotPasswordResponse> call, Response<ForgotPasswordResponse> response) {
+                            signup = response.body();
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+
+                            if (response.body() != null && response.body().getStatus() == 200) {
+
+                                //  GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                                showOtpPopUp(signup.getData(), signup.getOtp_expiry());
+                            } else if (response.body() != null) {
+
+                                GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                            } else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<ForgotPasswordResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+        }
+    }
+
+    private void showOtpPopUp(String mobileNo, String otpexpirytime) {
+        if (mobileNo == null || mobileNo.trim().isEmpty()) {
+            GlobalData.showToast(getBaseContext(), "Invalid Mobile Number", Toast.LENGTH_SHORT).show();
+            return;
+        }
+        View view = LayoutInflater.from(ForgotPasswordActivity.this).inflate(
+                R.layout.otp_popup, null);
+
+        pinview = (PinView) view.findViewById(R.id.pinView);
+
+
+        TextView mobileNumTextView = view.findViewById(R.id.mobileNo);
+        final TextView resentOtpTxt = view.findViewById(R.id.resentOtp);
+        resentOtpTxt.setEnabled(false);
+        resentOtpTxt.setAlpha(0.5f);
+
+        final TextView count_time = view.findViewById(R.id.count_time);
+        view.findViewById(R.id.btn_cancel).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                    }
+                });
+        resentOtpTxt.setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        reSentOtp();
+                    }
+                });
+        view.findViewById(R.id.btn_submit).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        if (pinview.getText().toString().equalsIgnoreCase("")) {
+                            GlobalData.showToast(getBaseContext(), "Please enter OTP", Toast.LENGTH_SHORT).show();
+                            return;
+                        }
+                        otpValidation(pinview.getText().toString());
+
+                    }
+                });
+
+        int millsec = Integer.parseInt(otpexpirytime) * 60 * 1000;
+        new android.os.CountDownTimer(millsec, 1000) {
+            public void onTick(long millisUntilFinished) {
+
+                String formattedTime = String.format("%02d:%02d Sec",
+                        TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % TimeUnit.HOURS.toMinutes(1),
+                        TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) % TimeUnit.MINUTES.toSeconds(1));
+                count_time.setText(formattedTime);
+                counter++;
+            }
+
+            public void onFinish() {
+                count_time.setText("00:00");
+                resentOtpTxt.setEnabled(true);
+                resentOtpTxt.setAlpha(1f);
+            }
+        }.start();
+
+        Paint p = new Paint();
+        p.setColor(getResources().getColor(R.color.btn_bg_color));
+        resentOtpTxt.setPaintFlags(resentOtpTxt.getPaintFlags() | p.UNDERLINE_TEXT_FLAG);
+        String alterStr = new StringBuilder(mobileNo).replace(2, 7, "XXXXX").toString();
+        mobileNumTextView.setText(alterStr);
+        alertDialogBuilder = new AlertDialog.Builder(ForgotPasswordActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+        setupUI(alertDialog.getWindow().getDecorView());
+        view.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                try {
+                    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+                    imm.hideSoftInputFromWindow(pinview.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+
+            }
+        });
+    }
+
+    private void otpValidation(String otp) {
+        if (new UtilService().isNetworkAvailable(ForgotPasswordActivity.this)) {
+            progressDialog = new TransparentProgressDialog(ForgotPasswordActivity.this);
+            progressDialog.show();
+
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("otp", otp);
+                map.put("type", "forgot_password");
+                map.put("username", userName.getText().toString());
+                restService.OtpValidation(map).enqueue(new Callback<UserResponse>() {
+                    @Override
+                    public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                        user = response.body();
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (user != null && user.getStatus() == 200) {
+                            ((MainApplication) getApplication()).addAccessToken(String.format("Bearer %s", user.getAccess_token().trim()));
+                            restService = ((MainApplication) getApplication()).getClient();
+                            Intent i = new Intent(ForgotPasswordActivity.this, ResetPasswordActivity.class);
+                            i.putExtra("username", userName.getText().toString().trim());
+                            startActivity(i);
+                            finish();
+                        } else if (user != null) {
+                            GlobalData.showToast(getBaseContext(), user.getMessage(), Toast.LENGTH_SHORT).show();
+
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+
+                        }
+
+
+                    }
+
+                    @Override
+                    public void onFailure(Call<UserResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    public void reSentOtp() {
+        if (new UtilService().isNetworkAvailable(ForgotPasswordActivity.this)) {
+            progressDialog = new TransparentProgressDialog(ForgotPasswordActivity.this);
+            progressDialog.show();
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("username", userName.getText().toString());
+
+                restService.sentOtp(map).enqueue(new Callback<OtpResponse>() {
+                    @Override
+                    public void onResponse(Call<OtpResponse> call, Response<OtpResponse> response) {
+                        errorResponse = response.body();
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        if (errorResponse != null && errorResponse.getStatus() == 200) {
+                            showOtpPopUp(signup.getData(), errorResponse.getData().getOtp_expiry());
+                        } else if (errorResponse != null) {
+                            GlobalData.showToast(getBaseContext(), errorResponse.getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        }
+
+
+                    }
+
+                    @Override
+                    public void onFailure(Call<OtpResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    private void showPopup(String emailIdString) {
+        View view = LayoutInflater.from(ForgotPasswordActivity.this).inflate(
+                R.layout.password_popup, null);
+        view.findViewById(R.id.okButton).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        finish();
+                        ForgotPasswordActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                                R.anim.animation_f_leave);
+                    }
+                });
+        TextView linkView = view.findViewById(R.id.linkView);
+        linkView.setText(linkView.getText().toString().trim() + " " + emailIdString);
+        alertDialogBuilder = new AlertDialog.Builder(ForgotPasswordActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(ForgotPasswordActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void checkPermission() {
+        if (Build.VERSION.SDK_INT >= 23) {
+            ArrayList<String> listPermissionsNeeded = new ArrayList<>();
+            if (checkSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_DENIED) {
+                listPermissionsNeeded
+                        .add(android.Manifest.permission.READ_SMS);
+                listPermissionsNeeded
+                        .add(android.Manifest.permission.READ_SMS);
+            }
+
+            if (!listPermissionsNeeded.isEmpty())
+                ActivityCompat.requestPermissions(this, listPermissionsNeeded
+                        .toArray(new String[listPermissionsNeeded.size()]), 1);
+
+        }
+    }
+
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 1704 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/HomeActivity.java


+ 135 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/IndroScreen.java

@@ -0,0 +1,135 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.content.Intent;
+import android.os.Bundle;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
+import android.view.View;
+import android.view.animation.TranslateAnimation;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+
+import com.ogaclejapan.smarttablayout.SmartTabLayout;
+import com.ttiglobal.inttilectgpchat.fragments.IndroFragment;
+import com.ttiglobal.inttilectgpchat.util.BackgroundToForegroundTransformerNew;
+import com.ttiglobal.inttilectgpchat.util.ViewPagerCustomDuration;
+
+
+public class IndroScreen extends AppCompatActivity {
+
+    ViewPagerCustomDuration viewPager;
+    SmartTabLayout viewpagerTab;
+    FrameLayout frameLayout;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_indro_screen);
+        ImageView splashLogo = findViewById(R.id.splashLogo);
+        setupWindowAnimations();
+        viewPager = findViewById(R.id.viewPager);
+        frameLayout = findViewById(R.id.frame);
+        viewpagerTab = findViewById(R.id.viewpagerTab);
+        viewPager.setPageTransformer(true, new BackgroundToForegroundTransformerNew());
+        viewPager.setScrollDurationFactor(3.0);
+
+
+        frameLayout.setVisibility(View.GONE);
+
+
+        findViewById(R.id.next).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                goLogin();
+
+            }
+        });
+
+        viewPager.post(new Runnable() {
+            @Override
+            public void run() {
+                viewPager.setAdapter(new IndroAdapter(getSupportFragmentManager()));
+                viewpagerTab.setViewPager(viewPager);
+            }
+        });
+
+        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+                if (position == 2) {
+                    if (frameLayout.getVisibility() == View.GONE)
+                        slideToTop(frameLayout);
+                } else {
+                    if (frameLayout.getVisibility() == View.VISIBLE)
+                        slideToBottom(frameLayout);
+                }
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+
+            }
+        });
+    }
+
+    public void slideToBottom(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, 0, view.getHeight());
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.GONE);
+    }
+
+    public void slideToTop(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, view.getHeight(), 0);
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.VISIBLE);
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    private void goLogin() {
+        startActivity(new Intent(getBaseContext(), LoginActivity.class));
+        finish();
+    }
+
+    public class IndroAdapter extends FragmentStatePagerAdapter {
+
+
+        private IndroAdapter(FragmentManager fm) {
+            super(fm);
+        }
+
+        @Override
+        public Fragment getItem(int position) {
+            IndroFragment fragment = new IndroFragment();
+            fragment.setPosition(position);
+            return fragment;
+        }
+
+        @Override
+        public int getCount() {
+            return 3;
+        }
+
+
+        @Override
+        public CharSequence getPageTitle(int position) {
+            return "";
+        }
+    }
+}

+ 263 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/LearningPathActivity.java

@@ -0,0 +1,263 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.LearningPathAdapter;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.LearningPath;
+import com.ttiglobal.inttilectgpchat.wrappers.LearningPathResponse;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import java.util.ArrayList;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class LearningPathActivity extends AppCompatActivity {
+    View mainView;
+
+
+    TransparentProgressDialog progressDialog;
+    ApiService restService;
+    ArrayList<LearningPath> MY_LEARNING_PATH = new ArrayList<>();
+
+    private int SHOWCASE_POSITION = 0;
+    EmptyStateRecyclerView learningPath;
+
+    public static Handler.Callback callback;
+    LearningPathAdapter adapter;
+    LinearLayoutManager linearLayoutManager;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_learning_path);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.bgLayout));
+        restService = ((MainApplication)getApplication()).getClient();
+        learningPath =findViewById(R.id.learningPath);
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+        learningPath.post(new Runnable() {
+            @Override
+            public void run() {
+                getLearningPath();
+            }
+        });
+        findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                //  showHelpScreen();
+            }
+        });
+
+    }
+
+    private void getLearningPath() {
+
+        if (new UtilService().isNetworkAvailable(this)) {
+            progressDialog = new TransparentProgressDialog(this);
+            progressDialog.show();
+
+            try {
+                restService.getLearningPath()
+                        .enqueue(new Callback<LearningPathResponse>() {
+                            @Override
+                            public void onResponse(Call<LearningPathResponse> call, Response<LearningPathResponse> response) {
+                                if (progressDialog != null && progressDialog.isShowing()) {
+                                    progressDialog.dismiss();
+                                }
+
+                                if (response.body() != null && response.body().getStatus() == 200) {
+                                    MY_LEARNING_PATH = response.body().getData();
+
+
+                                    if (MY_LEARNING_PATH == null) {
+                                        MY_LEARNING_PATH = new ArrayList<>();
+                                    }
+
+                                    if (MY_LEARNING_PATH.size() == 0) {
+                                        learningPath.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+                                    } else {
+                                        learningPath.invokeState(EmptyStateRecyclerView.STATE_OK);
+                                    }
+                                    setLearningPath();
+                                } else if (response.body() != null && response.body().getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                } else if (response.body() != null) {
+                                    GlobalData.showToast(LearningPathActivity.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                                } else if (response.errorBody() != null) {
+                                    Gson gson = new Gson();
+                                    ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                    GlobalData.showToast(LearningPathActivity.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                                    if (message.getStatus() == 401) {
+                                        GlobalData.canLogout = true;
+                                        new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                    }
+                                }
+                            }
+
+                            @Override
+                            public void onFailure(Call<LearningPathResponse> call, Throwable t) {
+                                if (progressDialog != null && progressDialog.isShowing()) {
+                                    progressDialog.dismiss();
+                                }
+                                GlobalData.showToast(LearningPathActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                            }
+                        });
+
+            } catch (Exception e) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+                GlobalData.showToast(this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+            }
+        } else {
+            GlobalData.showToast(this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    public void setLearningPath() {
+        learningPath.setHasFixedSize(true);
+        learningPath.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new LinearLayoutManager(this);
+        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+        learningPath.setLayoutManager(linearLayoutManager);
+        learningPath.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                new TextStateDisplay(this, "No data available", ""));
+
+        adapter = new LearningPathAdapter(this,  MY_LEARNING_PATH);
+
+        learningPath.setAdapter(adapter);
+
+    }
+
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(LearningPathActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (adapter != null) {
+            adapter.notifyDataSetChanged();
+        }
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    private void showHelpScreen() {
+        try {
+            View view;
+            if (adapter != null && adapter.getItemCount() > 0) {
+                view = learningPath.findViewHolderForAdapterPosition(linearLayoutManager.findFirstVisibleItemPosition()).itemView;
+            } else {
+                view = learningPath;
+            }
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(view)
+                    .title("Tap here to view the PDF or Video")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .focusShape(FocusShape.ROUNDED_RECTANGLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        finish();
+        LearningPathActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+
+}

+ 354 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/LoginActivity.java

@@ -0,0 +1,354 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import androidx.appcompat.app.AppCompatActivity;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.style.UnderlineSpan;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.tooltip.Tooltip;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.UserResponse;
+
+import java.io.File;
+import java.util.HashMap;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class LoginActivity extends AppCompatActivity {
+    EditText mPasswordView, mEmailView;
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    SharedPreferences preferences;
+    SharedPreferences.Editor editor;
+    StorePreference storePreference;
+
+    @SuppressLint("ClickableViewAccessibility")
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_login);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.bgLayout));
+
+        restService = ((MainApplication) getApplication()).getClient();
+        mEmailView = findViewById(R.id.userName);
+        mPasswordView = findViewById(R.id.password);
+        storePreference = new StorePreference(this);
+        TextView textView = (TextView) findViewById(R.id.notRegistered);
+        SpannableString loginText = new SpannableString("Signup");
+        loginText.setSpan(new UnderlineSpan(), 0, loginText.length(), 0);
+        textView.setText(loginText);
+
+        mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
+                if (id == 2276) {
+                    attemptLogin();
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        findViewById(R.id.email_sign_in_button).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                attemptLogin();
+            }
+        });
+
+        findViewById(R.id.notRegistered).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(LoginActivity.this, SignUpActivity.class));
+            }
+        });
+
+
+        findViewById(R.id.info).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                String header = "-If you are dealer staff enter the SMPIN for registering and logging into the system\n" +
+                        "\n-If you are Suzuki staff enter your Employee ID for registering and logging into the system";
+                View mView = LayoutInflater.from(LoginActivity.this).inflate(R.layout.login_tooltip_text, null);
+                TextView text = mView.findViewById(R.id.text11);
+                text.setText(header);
+                Tooltip.TooltipView tooltip = Tooltip.make(LoginActivity.this,
+                        new Tooltip.Builder(101)
+                                .anchor(view, Tooltip.Gravity.TOP)
+                                .closePolicy(new Tooltip.ClosePolicy()
+                                        .insidePolicy(true, false)
+                                        .outsidePolicy(true, false), 0)
+                                .activateDelay(300)
+                                .withStyleId(R.style.ToolTipLayoutCustomStyle)
+                                .showDelay(300)
+                                .text("")
+                                .setBgColor(getResources().getColor(R.color.bg_color))
+                                .view(mView)
+                                .maxWidth(300)
+                                .withArrow(true)
+                                .build()
+                );
+                tooltip.setTextColor(Color.WHITE);
+                tooltip.show();
+            }
+        });
+        TextView mTextView = findViewById(R.id.forgotPassword);
+        String udata = mTextView.getText().toString().trim();
+        SpannableString content = new SpannableString(udata);
+        content.setSpan(new UnderlineSpan(), 0, udata.length(), 0);
+        mTextView.setText(content);
+        mTextView.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(getBaseContext(), ForgotPasswordActivity.class));
+            }
+        });
+
+        findViewById(R.id.faq).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(new Intent(LoginActivity.this, FaqActivity.class));
+                finish();
+            }
+        });
+
+        findViewById(R.id.faq1).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                findViewById(R.id.faq).performClick();
+            }
+        });
+    }
+
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    private void attemptLogin() {
+        String email = mEmailView.getText().toString().trim();
+        String password = mPasswordView.getText().toString().trim();
+
+        boolean cancel = false;
+        View focusView = null;
+        if (TextUtils.isEmpty(email) && TextUtils.isEmpty(password)) {
+            GlobalData.showToast(getBaseContext(), "Please fill in all necessary fields", Toast.LENGTH_SHORT).show();
+            focusView = mEmailView;
+            cancel = true;
+        } else if (TextUtils.isEmpty(email)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the SMPIN", Toast.LENGTH_SHORT).show();
+            focusView = mEmailView;
+            cancel = true;
+        } else if (TextUtils.isEmpty(password)) {
+            GlobalData.showToast(getBaseContext(), "Please enter the password", Toast.LENGTH_SHORT).show();
+            focusView = mPasswordView;
+            cancel = true;
+        }
+
+        if (cancel) {
+            focusView.requestFocus();
+        } else {
+            if (new UtilService().isNetworkAvailable(LoginActivity.this)) {
+                progressDialog = new TransparentProgressDialog(LoginActivity.this);
+                progressDialog.show();
+
+                try {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("username", email);
+                    map.put("password", password);
+                    restService.login(map).enqueue(new Callback<UserResponse>() {
+                        @Override
+                        public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                            GlobalData.user = response.body();
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            if (GlobalData.user != null && GlobalData.user.getStatus() == 200) {
+                                getSharedPreferences("FCM_TOKEN", Context.MODE_PRIVATE)
+                                        .edit().putString("FCM_TOKEN_ID", "").apply();
+                                if (Build.VERSION.SDK_INT >= 23) {
+                                    if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                                            == PackageManager.PERMISSION_GRANTED) {
+                                        File f1 = new File(Environment.getExternalStorageDirectory()
+                                                + "/" + ".SUZUKI", "PDF");
+                                        if (f1.exists()) {
+                                            f1.delete();
+                                        }
+                                    }
+                                } else {
+                                    File f1 = new File(Environment.getExternalStorageDirectory()
+                                            + "/" + ".SUZUKI", "PDF");
+                                    if (f1.exists()) {
+                                        f1.delete();
+                                    }
+                                }
+
+                                GlobalData.sdb.delete("session", null, null);
+                                preferences = getSharedPreferences("UserDetails",
+                                        Context.MODE_PRIVATE);
+                                if (!preferences.getString("inputUsername", "").trim()
+                                        .equalsIgnoreCase(mEmailView.getText().toString().trim())) {
+                                    GlobalData.sdb.delete("training", null, null);
+                                    GlobalData.sdb.delete("assessment", null, null);
+                                    GlobalData.sdb.delete("assessment_question", null, null);
+                                    GlobalData.sdb.delete("assessment_answer", null, null);
+                                    GlobalData.sdb.delete("notifications", null, null);
+                                    GlobalData.sdb.delete("notification_readed", null, null);
+                                    GlobalData.sdb.delete("notification_deleted", null, null);
+                                    GlobalData.sdb.delete("banner", null, null);
+                                    GlobalData.sdb.delete("topic", null, null);
+                                    GlobalData.sdb.delete("topic_content", null, null);
+                                }
+                                editor = preferences.edit();
+                                editor.putString("inputUsername", mEmailView.getText().toString().trim());
+                                editor.putString("inputPassword", mPasswordView.getText().toString().trim());
+                                editor.apply();
+                                ((MainApplication) getApplication()).addAccessToken(String.format("Bearer %s", GlobalData.user.getAccess_token().trim()));
+                                restService = ((MainApplication) getApplication()).getClient();
+
+                                if (GlobalData.user.getData().getIs_first_login().trim().equalsIgnoreCase("1")) {
+                                    startActivity(new Intent(getBaseContext(), SetNewPasswordActivity.class));
+                                    finish();
+                                } else if (GlobalData.user.getData().getIs_password_expired().trim().equalsIgnoreCase("1")) {
+                                    GlobalData.showToast(LoginActivity.this, "Your password is expired, please create new password", Toast.LENGTH_SHORT).show();
+                                    startActivity(new Intent(getBaseContext(), SetNewPasswordActivity.class));
+                                    finish();
+                                } else if (GlobalData.user.getData().getIs_profile_updated().equalsIgnoreCase("0")) {
+                                    startActivity(new Intent(getBaseContext(), MainProfileActivity.class));
+                                    finish();
+                                } else {
+                                    Gson gson = new Gson();
+                                    JsonElement jsonElement = gson.toJsonTree(
+                                            GlobalData.user, new TypeToken<UserResponse>() {
+                                            }.getType());
+                                    ContentValues values = new ContentValues();
+                                    values.put("user", jsonElement.toString());
+                                    GlobalData.sdb.insert("session", null, values);
+                                    GlobalData.zmEmail = "none";
+                                    GlobalData.rmEmail = "none";
+                                    GlobalData.amEmail = "none";
+
+                                    GlobalData.canLogout = false;
+                                    if (GlobalData.user.getData().getRole().equalsIgnoreCase("3") || GlobalData.user.getData().getRole().equalsIgnoreCase("4") || GlobalData.user.getData().getRole().equalsIgnoreCase("5") || GlobalData.user.getData().getRole().equalsIgnoreCase("6") || GlobalData.user.getData().getRole().equalsIgnoreCase("7") || GlobalData.user.getData().getRole().equalsIgnoreCase("14")) {
+                                        storePreference.setBoolean(GlobalData.ISDSELOGIN,false);
+                                        startActivity(new Intent(LoginActivity.this, AMHomeActivity.class));
+                                    } else if (GlobalData.user.getData().getRole().equalsIgnoreCase("15")) {
+                                        storePreference.setBoolean(GlobalData.ISDSELOGIN,false);
+                                        startActivity(new Intent(LoginActivity.this, SEHomeActivity.class));
+                                    }
+                                    else if (GlobalData.user.getData().getRole().equalsIgnoreCase("16")) {
+                                        startActivity(new Intent(LoginActivity.this, ProductExploreDetailsActivity.class));
+                                    }
+                                    else {
+                                        storePreference.setBoolean(GlobalData.ISDSELOGIN,true);
+                                        startActivity(new Intent(LoginActivity.this, HomeActivity.class));
+                                    }
+                                    finish();
+                                }
+                            } else if (GlobalData.user != null) {
+                                GlobalData.showToast(getBaseContext(), GlobalData.user.getMessage(), Toast.LENGTH_SHORT).show();
+                            } else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<UserResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+        }
+    }
+
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(LoginActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+

+ 117 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/MainActivity.java

@@ -0,0 +1,117 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import androidx.annotation.NonNull;
+import com.google.android.material.tabs.TabLayout;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.ttiglobal.inttilectgpchat.adapter.ViewPagerAdapter;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+
+
+public class MainActivity extends AppCompatActivity implements View.OnClickListener {
+    private static final int PERMISSION_REQUEST_CODE = 1;
+
+    ViewPager viewPager;
+    ViewPagerAdapter viewPagerAdapter;
+    TabLayout tabLayout;
+
+    public static ImageView img_broucher, img_rating;
+    public static ImageView layout1;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_explore);
+        initViews();
+
+        if (GlobalData.user.getData().getRole().equalsIgnoreCase("16")) {
+            layout1.setVisibility(View.GONE);
+            img_rating.setVisibility(View.VISIBLE);
+            img_broucher.setVisibility(View.VISIBLE);
+        } else {
+            layout1.setVisibility(View.VISIBLE);
+            img_rating.setVisibility(View.GONE);
+            img_broucher.setVisibility(View.GONE);
+        }
+
+        if (checkPermissionStorage()) {
+            requestPermission();
+        }
+
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+    }
+
+    private boolean checkPermissionStorage() {
+        int result = ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
+        return result == PackageManager.PERMISSION_GRANTED;
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        if (requestCode == PERMISSION_REQUEST_CODE) {
+            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+                Log.e("value", "Permission Granted, Now you can use local drive .");
+                viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
+                viewPager.setAdapter(viewPagerAdapter);
+            } else {
+                Log.e("value", "Permission Denied, You cannot use local drive .");
+            }
+        }
+    }
+
+    private void requestPermission() {
+
+        if (!ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+            ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+        }
+    }
+
+    private void initViews() {
+
+        //initHomeFragment(new Hotspot360());
+
+        viewPager = findViewById(R.id.viewPager);
+        viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
+        viewPager.setAdapter(viewPagerAdapter);
+
+        tabLayout = findViewById(R.id.tabs);
+        tabLayout.setupWithViewPager(viewPager);
+
+        img_broucher = findViewById(R.id.imgBroucher);
+        img_broucher.setOnClickListener(this);
+
+        img_rating = findViewById(R.id.img_rating);
+        img_rating.setOnClickListener(this);
+
+        layout1 = findViewById(R.id.fabEnquiry);
+        layout1.setOnClickListener(this);
+
+    }
+
+    @Override
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case R.id.imgBroucher:
+                startActivity(new Intent(this, SuzukiEnquiryForm.class));
+                break;
+            case R.id.img_rating:
+                startActivity(new Intent(this, ProductFeedbackFormActivity.class));
+                break;
+            default:
+        }
+    }
+}

+ 861 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/MainProfileActivity.java

@@ -0,0 +1,861 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.DatePickerDialog;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.textfield.TextInputLayout;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AnimationUtils;
+import android.view.animation.TranslateAnimation;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.DatePicker;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.bumptech.glide.Glide;
+import com.google.android.material.widget.SubtitleCollapsingToolbarLayout;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.pickimage.bean.PickResult;
+import com.ttiglobal.inttilectgpchat.pickimage.bundle.PickSetup;
+import com.ttiglobal.inttilectgpchat.pickimage.dialog.PickImageDialog;
+import com.ttiglobal.inttilectgpchat.pickimage.listeners.IPickCancel;
+import com.ttiglobal.inttilectgpchat.pickimage.listeners.IPickResult;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.UserResponse;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class MainProfileActivity extends AppCompatActivity implements IPickResult {
+    public Calendar calendar;
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    AppBarLayout appBarLayout;
+    Toolbar toolbar;
+    ImageView userImage;
+    FloatingActionButton editButton;
+    FloatingActionButton cameraButton;
+    LinearLayout bottomLayout;
+    EditText dob, email, mobile, doj, dealer, zone, state, city, region, designation, weddingDate;
+    Button submitButton;
+    UserResponse MY_PROFILE = new UserResponse();
+    SubtitleCollapsingToolbarLayout collapsingToolbar;
+    String IMAGE_PATH = "";
+    ImageButton toolEditIcon;
+    CheckBox checkBoxMarried;
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    LinearLayout linearWeddingDate;
+    private ImageView dobCalendar;
+    private int year;
+    private int month;
+    private int day;
+    boolean isDOB = false;
+    public TextInputLayout editInputDob,editInputEmail,editInputWedding;
+
+
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_my_profile);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.main_content));
+        calendar = Calendar.getInstance();
+        year = calendar.get(Calendar.YEAR);
+        month = calendar.get(Calendar.MONTH);
+        day = calendar.get(Calendar.DAY_OF_MONTH);
+
+        restService = ((MainApplication) getApplication()).getClient();
+        appBarLayout = findViewById(R.id.appBarLayout);
+        userImage = findViewById(R.id.userImage);
+        toolbar = findViewById(R.id.toolbar);
+        bottomLayout = findViewById(R.id.bottomLayout);
+        toolEditIcon = findViewById(R.id.toolEditIcon);
+
+        email = findViewById(R.id.email);
+        mobile = findViewById(R.id.mobile);
+        doj = findViewById(R.id.doj);
+        dob = findViewById(R.id.dob);
+        dealer = findViewById(R.id.dealer);
+        zone = findViewById(R.id.zone);
+        region = findViewById(R.id.region);
+        state = findViewById(R.id.state);
+        city = findViewById(R.id.city);
+        designation = findViewById(R.id.designation);
+        checkBoxMarried = findViewById(R.id.checkMarried);
+        weddingDate = findViewById(R.id.weddingDate);
+        dobCalendar = findViewById(R.id.dob_date);
+        final ImageView weddingCalendar = findViewById(R.id.weddding_date);
+        linearWeddingDate = findViewById(R.id.linear_wedding_date);
+        editInputEmail = findViewById(R.id.txtemail);
+        editInputDob = findViewById(R.id.txtInputDob);
+        editInputWedding = findViewById(R.id.txtInputWedding);
+
+        submitButton = findViewById(R.id.submitButton);
+        email.setEnabled(false);
+        weddingDate.setEnabled(false);
+        dob.setEnabled(false);
+        doj.setEnabled(false);
+        dealer.setEnabled(false);
+        designation.setEnabled(false);
+        mobile.setEnabled(false);
+        region.setEnabled(false);
+        state.setEnabled(false);
+        zone.setEnabled(false);
+        city.setEnabled(false);
+        weddingCalendar.setVisibility(View.VISIBLE);
+        checkBoxMarried.setChecked(false);
+
+        setSupportActionBar(toolbar);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+
+
+        collapsingToolbar = findViewById(R.id.collapsing_toolbar);
+        appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
+            @Override
+            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
+                if (Math.abs(verticalOffset) - appBarLayout.getTotalScrollRange() == 0) {
+                    toolbar.setBackgroundColor(getResources().getColor(R.color.bg_color));
+                    toolEditIcon.setVisibility(View.GONE);
+                } else {
+                    toolbar.setBackgroundColor(Color.TRANSPARENT);
+                    toolEditIcon.setVisibility(View.GONE);
+                }
+            }
+        });
+
+        toolEditIcon.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                editButton.performClick();
+            }
+        });
+
+        dobCalendar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                isDOB = true;
+                Calendar c = Calendar.getInstance();
+                c.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
+                Date date = new Date();
+
+                if (dob.getText().toString().trim().isEmpty()
+                        || dob.getText().toString().trim().equalsIgnoreCase("0000-00-00")
+                        || dob.getText().toString().trim().equalsIgnoreCase("00-00-0000")
+                        || dob.getText().toString().trim().equalsIgnoreCase("00/00/0000")
+                        || dob.getText().toString().trim().equalsIgnoreCase("0000/00/00")) {
+                    date = c.getTime();
+                } else {
+                    if (dob.getText().toString().trim().contains("-")) {
+                        try {
+                            date = new SimpleDateFormat("yyyy-MM-dd").parse(dob.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    } else {
+                        try {
+                            date = new SimpleDateFormat("dd-MMM-yyyy").parse(dob.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+                c.setTime(date);
+
+                DatePickerDialog dialog = new DatePickerDialog(MainProfileActivity.this, tolistener,
+                        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
+                try {
+                    c = Calendar.getInstance();
+                    c.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
+                    DatePicker datePicker = dialog.getDatePicker();
+                    datePicker.setMaxDate(c.getTime().getTime());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                dialog.show();
+            }
+        });
+
+
+        weddingCalendar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                isDOB = false;
+                Calendar c = Calendar.getInstance();
+                Date date = new Date();
+
+                if (weddingDate.getText().toString().trim().isEmpty()
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("0000-00-00")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("00-00-0000")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("00/00/0000")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("0000/00/00")) {
+                    date = c.getTime();
+                } else {
+                    if (weddingDate.getText().toString().trim().contains("-")) {
+                        try {
+                            date = new SimpleDateFormat("yyyy-MM-dd").parse(weddingDate.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    } else {
+                        try {
+                            date = new SimpleDateFormat("dd-MMM-yyyy").parse(weddingDate.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+                c.setTime(date);
+
+                DatePickerDialog dialog = new DatePickerDialog(MainProfileActivity.this, tolistener,
+                        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
+                try {
+                    DatePicker datePicker = dialog.getDatePicker();
+                    datePicker.setMaxDate(c.getTime().getTime());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                dialog.show();
+            }
+        });
+
+        editButton = findViewById(R.id.editButton);
+        cameraButton = findViewById(R.id.cameraButton);
+        cameraButton.setVisibility(View.GONE);
+        bottomLayout.setVisibility(View.INVISIBLE);
+        getMyProfile();
+
+        checkBoxMarried.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                boolean checked = ((CheckBox) v).isChecked();
+                if (checked) {
+                    linearWeddingDate.setVisibility(View.VISIBLE);
+                } else {
+                    linearWeddingDate.setVisibility(View.INVISIBLE);
+                }
+            }
+        });
+
+
+        IMAGE_PATH = "";
+        cameraButton.setVisibility(View.VISIBLE);
+        cameraButton.startAnimation(AnimationUtils.loadAnimation(MainProfileActivity.this, R.anim.zoomin));
+        slideToTop(bottomLayout);
+        dobCalendar.setEnabled(true);
+        email.setEnabled(true);
+        editButton.setVisibility(View.INVISIBLE);
+        linearWeddingDate.setVisibility(View.INVISIBLE);
+
+        editButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (cameraButton.getVisibility() == View.GONE) {
+                    IMAGE_PATH = "";
+
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputDob);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputEmail);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputWedding);
+                    mobile.setTextColor(getResources().getColor(R.color.material_grey300));
+                    designation.setTextColor(getResources().getColor(R.color.material_grey300));
+                    dealer.setTextColor(getResources().getColor(R.color.material_grey300));
+                    doj.setTextColor(getResources().getColor(R.color.material_grey300));
+                    zone.setTextColor(getResources().getColor(R.color.material_grey300));
+                    region.setTextColor(getResources().getColor(R.color.material_grey300));
+                    state.setTextColor(getResources().getColor(R.color.material_grey300));
+                    city.setTextColor(getResources().getColor(R.color.material_grey300));
+                    weddingDate.setHintTextColor(getResources().getColor(R.color.material_grey700));
+                    cameraButton.setVisibility(View.VISIBLE);
+                    cameraButton.startAnimation(AnimationUtils.loadAnimation(MainProfileActivity.this, R.anim.zoomin));
+                    slideToTop(bottomLayout);
+                    email.setEnabled(true);
+                    dobCalendar.setVisibility(View.VISIBLE);
+                } else {
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputDob);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputEmail);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color),editInputWedding);
+                    mobile.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    designation.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    doj.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    zone.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    region.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    state.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    city.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    dealer.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    cameraButton.startAnimation(AnimationUtils.loadAnimation(MainProfileActivity.this, R.anim.zoomout));
+                    cameraButton.setVisibility(View.GONE);
+                    slideToBottom(bottomLayout);
+                    email.setEnabled(false);
+                    dobCalendar.setVisibility(View.INVISIBLE);
+                    weddingCalendar.setVisibility(View.INVISIBLE);
+                    IMAGE_PATH = "";
+                    setMyProfile();
+                }
+
+            }
+        });
+
+        cameraButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                PickImageDialog.build(new PickSetup().setButtonOrientation(LinearLayout.HORIZONTAL)).setOnPickCancel(new IPickCancel() {
+                    @Override
+                    public void onCancelClick() {
+
+                    }
+                }).show(MainProfileActivity.this);
+            }
+        });
+
+        submitButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                updateProfile();
+            }
+        });
+    }
+    public DatePickerDialog.OnDateSetListener tolistener = new DatePickerDialog.OnDateSetListener() {
+        @Override
+        public void onDateSet(DatePicker view, int y, int monthOfYear, int dayOfMonth) {
+            year = y;
+            month = monthOfYear;
+            day = dayOfMonth;
+            String datevalue = String.valueOf(day);
+            int mval = (month + 1);
+            String monthvalue = String.valueOf(mval);
+            String date;
+            String monthname;
+            if (datevalue.length() == 1) {
+                date = "0" + datevalue;
+            } else {
+                date = datevalue;
+            }
+
+            if (monthvalue.length() == 1) {
+                monthname = "0" + monthvalue;
+            } else {
+                monthname = monthvalue;
+            }
+           // String dateValue = date + "/" + monthname + "/" + String.valueOf(year) + " ";
+            String dateValue =  String.valueOf(year) + "-"+monthname+"-"+date;
+            dob.setText(dateFormate(dateValue));
+            if (isDOB) {
+                dob.setText(dateFormate(dateValue));
+            } else {
+                weddingDate.setText(dateFormate(dateValue));
+            }
+
+        }
+    };
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static boolean isValidEmail(String email) {
+        return !TextUtils.isEmpty(email) && android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
+    }
+
+    private void setUpperHintColor(int color, TextInputLayout txtInputLayout) {
+        try {
+            Field field = txtInputLayout.getClass().getDeclaredField("mFocusedTextColor");
+            field.setAccessible(true);
+            int[][] states = new int[][]{
+                    new int[]{}
+            };
+            int[] colors = new int[]{
+                    color
+            };
+            ColorStateList myList = new ColorStateList(states, colors);
+            field.set(txtInputLayout, myList);
+
+            Method method = txtInputLayout.getClass().getDeclaredMethod("updateLabelState", boolean.class);
+            method.setAccessible(true);
+            method.invoke(txtInputLayout, true);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String dateFormate(String dte) {
+        String date = "";
+        if (dte.equalsIgnoreCase("0000-00-00")) {
+            date = "";
+            return date;
+        } else {
+
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+            Date newDate = null;
+            try {
+                newDate = format.parse(dte);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+
+            format = new SimpleDateFormat("dd-MMM-yyyy");
+            date = format.format(newDate);
+
+        }
+        return date;
+    }
+
+    public String finalDateFormat(String date) {
+
+        SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy");
+        Date newDate = null;
+        try {
+            newDate = format.parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        format = new SimpleDateFormat("yyyy-MM-dd");
+        date = format.format(newDate);
+        return date;
+
+    }
+
+    private void showHelpScreen() {
+        try {
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(editButton)
+                    .title("Tap here to edit profile details")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .focusShape(FocusShape.CIRCLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        finish();
+        overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+        finish();
+    }
+
+    public void slideToBottom(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, 0, view.getHeight());
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.GONE);
+    }
+
+    public void slideToTop(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, view.getHeight(), 0);
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.VISIBLE);
+    }
+
+    private void getMyProfile() {
+        if (new UtilService().isNetworkAvailable(MainProfileActivity.this)) {
+            progressDialog = new TransparentProgressDialog(MainProfileActivity.this);
+            progressDialog.show();
+
+            try {
+                restService.getProfile().enqueue(new Callback<UserResponse>() {
+                    @Override
+                    public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            MY_PROFILE = response.body();
+                            if (MY_PROFILE.getData().getIs_married().equalsIgnoreCase("1")) {
+                                checkBoxMarried.setEnabled(true);
+                                linearWeddingDate.setVisibility(View.VISIBLE);
+                            }
+                            setMyProfile();
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+
+                        new Handler().postDelayed(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (getPreferences(MODE_PRIVATE).getBoolean("MyProfileActivity", true)) {
+//                                    showHelpScreen();
+                                    getPreferences(MODE_PRIVATE).edit().putBoolean("MyProfileActivity", false).apply();
+                                }
+                            }
+                        }, 1000);
+                    }
+
+                    @Override
+                    public void onFailure(Call<UserResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void setMyProfile() {
+
+        email.setText(MY_PROFILE.getData().getEmailid());
+        mobile.setText(MY_PROFILE.getData().getMobileno());
+        dealer.setText(MY_PROFILE.getData().getDealer().getDealer_name());
+        designation.setText(MY_PROFILE.getData().getRolename());
+        doj.setText(dateFormate(MY_PROFILE.getData().getDoj()));
+        zone.setText(MY_PROFILE.getData().getZone());
+        region.setText(MY_PROFILE.getData().getZone());
+        state.setText(MY_PROFILE.getData().getState());
+        city.setText(MY_PROFILE.getData().getCity());
+        dob.setText(dateFormate(MY_PROFILE.getData().getDob()));
+        weddingDate.setText(dateFormate(MY_PROFILE.getData().getMarriage_date()));
+
+        collapsingToolbar.setTitle(MY_PROFILE.getData().getFname() + " " + MY_PROFILE.getData().getLname());
+        collapsingToolbar.setSubtitle(MY_PROFILE.getData().getRolename());
+        Glide.with(this).load(MY_PROFILE.getData().getProfile_photo())
+                .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                .into(userImage);
+    }
+
+    @Override
+    public void onPickResult(PickResult pickResult) {
+        if (pickResult.getError() == null) {
+            IMAGE_PATH = pickResult.getPath();
+            if (IMAGE_PATH != null && !IMAGE_PATH.trim().isEmpty()) {
+                Intent intent = new Intent(MainProfileActivity.this, CropActivity.class);
+                CropActivity.mSourceUri = pickResult.getUri();
+                startActivityForResult(intent, 2276);
+            } else {
+                userImage.setImageBitmap(pickResult.getBitmap());
+            }
+
+        } else {
+            GlobalData.showToast(this, pickResult.getError().getMessage(), Toast.LENGTH_LONG).show();
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (resultCode == RESULT_OK && requestCode == 2276) {
+            IMAGE_PATH = data.getStringExtra("IMAGE_PATH");
+            Glide.with(this).load(new File(IMAGE_PATH))
+                    .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                    .into(userImage);
+        } else if (resultCode == RESULT_CANCELED && requestCode == 2276) {
+            IMAGE_PATH = "";
+        }
+    }
+
+    public void updateProfile() {
+        if (dob.getText().toString().trim().isEmpty() || dob.getText().toString().equalsIgnoreCase("00/00/0000")) {
+            GlobalData.showToast(this, "Please enter DOB", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (email.getText().toString().trim().isEmpty()) {
+            GlobalData.showToast(this, "Enter email", Toast.LENGTH_SHORT).show();
+            return;
+        }
+        if (!isValidEmail(email.getText().toString())) {
+            GlobalData.showToast(this, "Please enter valid email address", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (mobile.getText().toString().trim().isEmpty()) {
+            GlobalData.showToast(this, "Enter mobile number", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (checkBoxMarried.isChecked()) {
+            if (weddingDate.getText().toString().trim().isEmpty() || weddingDate.getText().toString().equalsIgnoreCase("00/00/0000")) {
+                GlobalData.showToast(this, "Please enter wedding date", Toast.LENGTH_SHORT).show();
+                return;
+            }
+        }
+
+        if (new UtilService().isNetworkAvailable(MainProfileActivity.this)) {
+            if (IMAGE_PATH.trim().isEmpty()) {
+                try {
+                    HashMap<String, String> map = new HashMap<>();
+
+                    map.put("dob", finalDateFormat(dob.getText().toString().trim()));
+                    map.put("email", email.getText().toString().trim());
+                    map.put("is_married", checkBoxMarried.isChecked() ? "1" : "0");
+                    if (checkBoxMarried.isChecked()) {
+                        map.put("marriage_date", finalDateFormat(weddingDate.getText().toString().trim()));
+                    } else {
+                        map.put("marriage_date", "0000-00-00");
+                    }
+
+                    progressDialog = new TransparentProgressDialog(MainProfileActivity.this);
+                    progressDialog.show();
+                    restService.postProfile(map).enqueue(new Callback<UserResponse>() {
+                        @Override
+                        public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+
+                            if (response.body() != null && response.body().getStatus() == 200) {
+                                MY_PROFILE = response.body();
+                                GlobalData.user = MY_PROFILE;
+                                GlobalData.user.setAccess_token(SetNewPasswordActivity.accessToken);
+                                saveUserData();
+                                showInstructions();
+                            } else if (response.body() != null && response.body().getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            } else if (response.body() != null) {
+                                GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                            } else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                                if (message.getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    finish();
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<UserResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(MainProfileActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+            } else {
+                File file = new File(IMAGE_PATH);
+                RequestBody reqFile = RequestBody.create(MediaType.parse("image/*"), file);
+                MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), reqFile);
+                RequestBody emailtxt = RequestBody.create(MediaType.parse("text/plain"), email.getText().toString().trim());
+                RequestBody dobtxt = RequestBody.create(MediaType.parse("text/plain"), finalDateFormat(dob.getText().toString().trim()));
+                RequestBody isMarried = RequestBody.create(MediaType.parse("text/plain"), checkBoxMarried.isChecked() ? "1" : "0");
+                RequestBody isMarriedDate = RequestBody.create(MediaType.parse("text/plain"), "0000-00-00");
+                if (checkBoxMarried.isChecked()) {
+                    isMarriedDate = RequestBody.create(MediaType.parse("text/plain"), finalDateFormat(weddingDate.getText().toString().trim()));
+                }
+
+                progressDialog = new TransparentProgressDialog(MainProfileActivity.this);
+                progressDialog.show();
+                restService.postProfileWithImage(body, emailtxt, dobtxt, isMarried, isMarriedDate).enqueue(new Callback<UserResponse>() {
+                    @Override
+                    public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            MY_PROFILE = response.body();
+                            GlobalData.user = MY_PROFILE;
+                            saveUserData();
+                            showInstructions();
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<UserResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        t.printStackTrace();
+                        GlobalData.showToast(MainProfileActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+            }
+
+        } else {
+            GlobalData.showToast(MainProfileActivity.this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void showInstructions() {
+        View view = LayoutInflater.from(MainProfileActivity.this).inflate(
+                R.layout.profile_success, null);
+        TextView textHead = (TextView) view.findViewById(R.id.textHead);
+        TextView text1 = (TextView) view.findViewById(R.id.text1);
+        TextView text2 = (TextView) view.findViewById(R.id.text2);
+        TextView text3 = (TextView) view.findViewById(R.id.text3);
+
+
+        view.findViewById(R.id.btn_ok).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        if(MY_PROFILE.getData().getRole().equalsIgnoreCase("3")||MY_PROFILE.getData().getRole().equalsIgnoreCase("4")||MY_PROFILE.getData().getRole().equalsIgnoreCase("5")||MY_PROFILE.getData().getRole().equalsIgnoreCase("6")||MY_PROFILE.getData().getRole().equalsIgnoreCase("7")||MY_PROFILE.getData().getRole().equalsIgnoreCase("14")){
+                            startActivity(new Intent(MainProfileActivity.this, AMHomeActivity.class));
+
+                        }else if(MY_PROFILE.getData().getRole().equalsIgnoreCase("15")) {
+                            startActivity(new Intent(MainProfileActivity.this, SEHomeActivity.class));
+                        }else{
+                            startActivity(new Intent(MainProfileActivity.this, HomeActivity.class));
+                        }
+                        finish();
+
+                    }
+                });
+
+        alertDialogBuilder = new AlertDialog.Builder(MainProfileActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+    }
+
+
+    private void saveUserData() {
+        editButton.performClick();
+        GlobalData.sdb.delete("session", null, null);
+        Gson gson = new Gson();
+        JsonElement jsonElement = gson.toJsonTree(
+                GlobalData.user, new TypeToken<UserResponse>() {
+                }.getType());
+        ContentValues values = new ContentValues();
+        values.put("user", jsonElement.toString());
+        GlobalData.sdb.insert("session", null, values);
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(MainProfileActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+

+ 420 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/MyEarnedPoints.java

@@ -0,0 +1,420 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+
+import com.google.gson.Gson;
+
+import com.ogaclejapan.smarttablayout.SmartTabLayout;
+import com.ttiglobal.inttilectgpchat.autofit.AutofitTextView;
+import com.ttiglobal.inttilectgpchat.fragments.RewardPointFragment;
+import com.ttiglobal.inttilectgpchat.screenpinview.AppLockActivity;
+import com.ttiglobal.inttilectgpchat.tooltip.Tooltip;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.DepthPageTransformerNew;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.FragmentItem;
+import com.ttiglobal.inttilectgpchat.wrappers.LearningLevel;
+import com.ttiglobal.inttilectgpchat.wrappers.LevelData;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemToWalletResponse;
+
+import java.util.ArrayList;
+
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class MyEarnedPoints extends AppCompatActivity {
+    TextView title, earnedPoints;
+    Button btnRedeemNow;
+    TransparentProgressDialog progressDialog;
+    ViewPager earningPager;
+    SmartTabLayout earningTab;
+    ArrayList<String> arrEarnedPoints = new ArrayList<>();
+    ArrayList<FragmentItem> fragments = new ArrayList<>();
+    EarningPointsAdapter adapter;
+    AutofitTextView points;
+    public static Handler.Callback myEarnedPointsCallback;
+    ApiService restService;
+    public String currPoint = "";
+    public RedeemToWalletResponse data = new RedeemToWalletResponse();
+    int cPoints;
+    private TextView minPoint;
+    public LearningLevel responseLevel = new LearningLevel();
+    public ArrayList<LevelData> LEARNING_LEVEL_LIST = new ArrayList<>();
+    View mView;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_earned_points);
+        setupWindowAnimations();
+        restService = ((MainApplication) getApplication()).getClient();
+        title = findViewById(R.id.title);
+        minPoint = findViewById(R.id.text_message);
+        points = findViewById(R.id.points);
+        earnedPoints = findViewById(R.id.earned);
+        btnRedeemNow = findViewById(R.id.btn_redeem);
+        earningPager = findViewById(R.id.myEarningPager);
+        earningTab = findViewById(R.id.myEarningPagerTab);
+        arrEarnedPoints.clear();
+        arrEarnedPoints.add("Earned History");
+        arrEarnedPoints.add("Redeem History");
+
+        btnRedeemNow.setEnabled(false);
+        btnRedeemNow.setAlpha(0.3f);
+        setLeaderBoardCategory();
+        earningPager.setOffscreenPageLimit(0);
+        btnRedeemNow.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                final int cPoints = Integer.parseInt(currPoint);
+                new androidx.appcompat.app.AlertDialog.Builder(MyEarnedPoints.this)
+                        .setMessage("Confirm redemption of points to your wallet?")
+                        .setPositiveButton("Ok",
+                                new DialogInterface.OnClickListener() {
+                                    @Override
+                                    public void onClick(
+                                            DialogInterface dialog,
+                                            int which) {
+                                        getRedeemNow();
+                                    }
+                                }).setNegativeButton("Cancel", null).show();
+
+
+            }
+        });
+        earningPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            public void onPageScrollStateChanged(int state) {
+            }
+
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+            }
+
+            public void onPageSelected(int position) {
+                try {
+                    RewardPointFragment fragment = (RewardPointFragment) fragments.get(position).getFragment();
+
+                    if (position == 0) {
+                        earnedPoints.setText(String.format("Total Points Earned %s", fragment.getTotalPoint()));
+                    } else {
+                        earnedPoints.setText(String.format("Total Points Redeemed %s", fragment.getTotalPoint()));
+                    }
+                    currPoint = fragment.getCurrentPoint();
+                    cPoints = Integer.parseInt(currPoint);
+                    points.setText(fragment.getCurrentPoint() + "");
+                    minPoint.setText(String.format("Minimum %s points required for redemption", fragment.getMinPoint()));
+                    if (fragment.getIs_Redeem_Point().equalsIgnoreCase("0") || cPoints == 0) {
+                        btnRedeemNow.setEnabled(false);
+                        btnRedeemNow.setAlpha(0.3f);
+                    } else if (fragment.getIs_Redeem_Point().equalsIgnoreCase("1") || cPoints >= 1500) {
+                        btnRedeemNow.setEnabled(true);
+                        btnRedeemNow.setAlpha(1f);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        myEarnedPointsCallback = new Handler.Callback() {
+            @Override
+            public boolean handleMessage(Message msg) {
+                RewardPointFragment fragment = (RewardPointFragment) fragments.get(earningPager.getCurrentItem()).getFragment();
+                if (earningPager.getCurrentItem() == 0) {
+                    earnedPoints.setText(String.format("Total Points Earned %s", fragment.getTotalPoint()));
+                } else {
+                    earnedPoints.setText(String.format("Total Points Redeemed %s", fragment.getTotalPoint()));
+                }
+                currPoint = fragment.getCurrentPoint();
+                cPoints = Integer.parseInt(currPoint);
+                points.setText(fragment.getCurrentPoint());
+                minPoint.setText(String.format("Minimum %s points required for redemption", fragment.getMinPoint()));
+                if (fragment.getIs_Redeem_Point().equalsIgnoreCase("0") || cPoints == 0) {
+                    btnRedeemNow.setEnabled(false);
+                    btnRedeemNow.setAlpha(0.3f);
+                } else if (fragment.getIs_Redeem_Point().equalsIgnoreCase("1") || cPoints >= 1500) {
+                    btnRedeemNow.setEnabled(true);
+                    btnRedeemNow.setAlpha(1f);
+                }
+
+                return false;
+            }
+        };
+
+        findViewById(R.id.info).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+            }
+        });
+        getLearningData();
+        findViewById(R.id.info).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setupView();
+                Tooltip.TooltipView tooltip = Tooltip.make(MyEarnedPoints.this,
+                        new Tooltip.Builder(101)
+                                .anchor(view, Tooltip.Gravity.BOTTOM)
+                                .closePolicy(new Tooltip.ClosePolicy()
+                                        .insidePolicy(true, false)
+                                        .outsidePolicy(true, false), 0)
+                                .activateDelay(800)
+                                .withStyleId(R.style.ToolTipLayoutCustomStyle)
+                                .showDelay(300)
+                                .text("")
+                                .setBgColor(getResources().getColor(R.color.white))
+                                .view(mView)
+                                .maxWidth(800)
+                                .withArrow(true)
+                                .build()
+                );
+                tooltip.setTextColor(Color.YELLOW);
+                tooltip.show();
+            }
+        });
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+    }
+
+
+    private void getLearningData() {
+        if (new UtilService().isNetworkAvailable(this)) {
+            progressDialog = new TransparentProgressDialog(this);
+            progressDialog.show();
+            try {
+                restService.getLearninglevel()
+                        .enqueue(new Callback<LearningLevel>() {
+                            @Override
+                            public void onResponse(Call<LearningLevel> call, Response<LearningLevel> response) {
+                                if (progressDialog != null && progressDialog.isShowing()) {
+                                    progressDialog.dismiss();
+                                }
+                                if (response.body() != null && response.body().getStatus() == 200) {
+                                    responseLevel = response.body();
+                                    LEARNING_LEVEL_LIST = response.body().getData();
+                                } else if (response.body() != null && response.body().getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                    finish();
+                                } else if (response.body() != null) {
+                                    GlobalData.showToast(MyEarnedPoints.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                                } else if (response.errorBody() != null) {
+                                    Gson gson = new Gson();
+                                    ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                    GlobalData.showToast(MyEarnedPoints.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                                    if (message.getStatus() == 401) {
+                                        GlobalData.canLogout = true;
+                                        new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                        finish();
+                                    }
+                                }
+                            }
+
+                            @Override
+                            public void onFailure(Call<LearningLevel> call, Throwable t) {
+                                if (progressDialog != null && progressDialog.isShowing()) {
+                                    progressDialog.dismiss();
+                                }
+                                GlobalData.showToast(MyEarnedPoints.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                            }
+                        });
+
+            } catch (Exception e) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+                GlobalData.showToast(MyEarnedPoints.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+            }
+        } else {
+            GlobalData.showToast(MyEarnedPoints.this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+
+    private void setupView() {
+        mView = LayoutInflater.from(MyEarnedPoints.this).inflate(R.layout.tooltip, null);
+        LinearLayout vocItemExpLayout = (LinearLayout) mView.findViewById(R.id.linearLevel);
+        vocItemExpLayout.removeAllViews();
+        for (int i = 0; i < LEARNING_LEVEL_LIST.size(); i++) {
+            View view = LayoutInflater.from(this).inflate(
+                    R.layout.tooltip_item, null);
+            TextView levelText = (TextView) view.findViewById(R.id.level);
+            TextView levelPointText = (TextView) view.findViewById(R.id.level_point);
+            TextView levelRateText = (TextView) view.findViewById(R.id.level_rate);
+            levelText.setText(LEARNING_LEVEL_LIST.get(i).getLvl_name());
+            levelPointText.setText("1");
+            levelRateText.setText(LEARNING_LEVEL_LIST.get(i).getLvl_points());
+            vocItemExpLayout.addView(view);
+        }
+
+
+    }
+
+
+    private void getRedeemNow() {
+        if (new UtilService().isNetworkAvailable(this)) {
+            progressDialog = new TransparentProgressDialog(this);
+            progressDialog.show();
+            try {
+                restService.getRedeemToWallet().enqueue(new Callback<RedeemToWalletResponse>() {
+                    @Override
+                    public void onResponse(Call<RedeemToWalletResponse> call, Response<RedeemToWalletResponse> response) {
+                        data = response.body();
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (data != null && data.getStatus() == 200) {
+                            if (GlobalData.user.getData().getMpin().trim().isEmpty()) {
+                                Intent i = new Intent(MyEarnedPoints.this, OtpActivity.class);
+                                i.putExtra("type", "redeem");
+                                startActivity(i);
+                                finish();
+                            } else {
+                                startActivity(new Intent(MyEarnedPoints.this, AppLockActivity.class));
+                                finish();
+                            }
+
+                        } else if (GlobalData.user != null) {
+                            GlobalData.showToast(MyEarnedPoints.this, GlobalData.user.getMessage(), Toast.LENGTH_SHORT).show();
+
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(MyEarnedPoints.this, response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(MyEarnedPoints.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<RedeemToWalletResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(MyEarnedPoints.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(MyEarnedPoints.this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    public void showView() {
+
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        finish();
+        MyEarnedPoints.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    public class EarningPointsAdapter extends FragmentStatePagerAdapter {
+
+        ArrayList<String> categories;
+
+
+        private EarningPointsAdapter(FragmentManager fm, ArrayList<String> list) {
+            super(fm);
+            categories = list;
+            fragments = new ArrayList<>();
+        }
+
+        @Override
+        public Fragment getItem(int position) {
+
+            RewardPointFragment fragment = new RewardPointFragment();
+            fragment.setIsEarnedHistory(position == 0);
+            FragmentItem item = new FragmentItem();
+            item.setFragment(fragment);
+            item.setTitle(categories.get(position));
+            fragments.add(item);
+            return fragment;
+        }
+
+        @Override
+        public int getCount() {
+            return categories.size();
+        }
+
+
+        @Override
+        public CharSequence getPageTitle(int position) {
+            return categories.get(position);
+        }
+    }
+
+    private void setLeaderBoardCategory() {
+        earningPager.setPageTransformer(true, new DepthPageTransformerNew());
+        adapter = new EarningPointsAdapter(getSupportFragmentManager(),
+                arrEarnedPoints);
+        earningPager.setAdapter(adapter);
+        earningTab.setViewPager(earningPager);
+    }
+
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+}

+ 892 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/MyProfileActivity.java

@@ -0,0 +1,892 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.DatePickerDialog;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.textfield.TextInputLayout;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AnimationUtils;
+import android.view.animation.TranslateAnimation;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.DatePicker;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.bumptech.glide.Glide;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.pickimage.bean.PickResult;
+import com.ttiglobal.inttilectgpchat.pickimage.bundle.PickSetup;
+import com.ttiglobal.inttilectgpchat.pickimage.dialog.PickImageDialog;
+import com.ttiglobal.inttilectgpchat.pickimage.listeners.IPickCancel;
+import com.ttiglobal.inttilectgpchat.pickimage.listeners.IPickResult;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.widget.SubtitleCollapsingToolbarLayout;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.UserResponse;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class MyProfileActivity extends AppCompatActivity implements IPickResult {
+    public Calendar calendar;
+    public Calendar calendarret;
+    ApiService restService;
+    TransparentProgressDialog progressDialog;
+    AppBarLayout appBarLayout;
+    Toolbar toolbar;
+    ImageView userImage;
+    FloatingActionButton editButton;
+    FloatingActionButton cameraButton;
+    LinearLayout bottomLayout;
+    EditText firstName, lastName, dob, email, mobile, doj, dealer, zone, state, city, region, designation, weddingDate;
+    Button submitButton;
+    UserResponse MY_PROFILE = new UserResponse();
+    SubtitleCollapsingToolbarLayout collapsingToolbar;
+    String IMAGE_PATH = "";
+    ImageButton toolEditIcon;
+    CheckBox checkBoxMarried;
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
+    private ImageView dobCalendar, weddingCalendar;
+    private int year;
+    private int month;
+    private int day;
+    boolean isDOB = false;
+    private LinearLayout linearWeddingDate;
+    private boolean isEditable = false;
+    public TextInputLayout editInputDob, editInputEmail, editInputWedding, getEditInputMobile;
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static boolean isValidEmail(String email) {
+        return !TextUtils.isEmpty(email) && android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
+    }
+
+
+    @SuppressLint("WrongViewCast")
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_my_profile);
+        setupWindowAnimations();
+        setupUI(findViewById(R.id.main_content));
+        calendar = Calendar.getInstance();
+        year = calendar.get(Calendar.YEAR);
+        month = calendar.get(Calendar.MONTH);
+        day = calendar.get(Calendar.DAY_OF_MONTH);
+        restService = ((MainApplication) getApplication()).getClient();
+        appBarLayout = findViewById(R.id.appBarLayout);
+        userImage = findViewById(R.id.userImage);
+        toolbar = findViewById(R.id.toolbar);
+        bottomLayout = findViewById(R.id.bottomLayout);
+        toolEditIcon = findViewById(R.id.toolEditIcon);
+        email = findViewById(R.id.email);
+        editInputEmail = findViewById(R.id.txtemail);
+        editInputDob = findViewById(R.id.txtInputDob);
+        editInputWedding = findViewById(R.id.txtInputWedding);
+        editInputWedding = findViewById(R.id.edit_mobile);
+
+
+        mobile = findViewById(R.id.mobile);
+        doj = findViewById(R.id.doj);
+        dob = findViewById(R.id.dob);
+        dealer = findViewById(R.id.dealer);
+        zone = findViewById(R.id.zone);
+        region = findViewById(R.id.region);
+        state = findViewById(R.id.state);
+        city = findViewById(R.id.city);
+        designation = findViewById(R.id.designation);
+        checkBoxMarried = findViewById(R.id.checkMarried);
+        weddingDate = findViewById(R.id.weddingDate);
+        dobCalendar = findViewById(R.id.dob_date);
+        weddingCalendar = findViewById(R.id.weddding_date);
+        linearWeddingDate = findViewById(R.id.linear_wedding_date);
+
+        submitButton = findViewById(R.id.submitButton);
+        email.setEnabled(false);
+        weddingDate.setEnabled(false);
+        dob.setEnabled(false);
+        doj.setEnabled(false);
+        dealer.setEnabled(false);
+        designation.setEnabled(false);
+        mobile.setEnabled(false);
+        region.setEnabled(false);
+        state.setEnabled(false);
+        zone.setEnabled(false);
+        city.setEnabled(false);
+        weddingCalendar.setVisibility(View.VISIBLE);
+        checkBoxMarried.setChecked(false);
+
+
+        setSupportActionBar(toolbar);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+
+
+        collapsingToolbar = findViewById(R.id.collapsing_toolbar);
+        appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
+            @Override
+            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
+                if (Math.abs(verticalOffset) - appBarLayout.getTotalScrollRange() == 0) {
+                    toolbar.setBackgroundColor(getResources().getColor(R.color.bg_color));
+                    toolEditIcon.setVisibility(View.VISIBLE);
+                } else {
+                    toolbar.setBackgroundColor(Color.TRANSPARENT);
+                    toolEditIcon.setVisibility(View.GONE);
+                }
+            }
+        });
+
+        toolEditIcon.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                editButton.performClick();
+            }
+        });
+        dobCalendar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                isDOB = true;
+                Calendar c = Calendar.getInstance();
+                c.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
+                Date date = new Date();
+
+                if (dob.getText().toString().trim().isEmpty()
+                        || dob.getText().toString().trim().equalsIgnoreCase("0000-00-00")
+                        || dob.getText().toString().trim().equalsIgnoreCase("00-00-0000")
+                        || dob.getText().toString().trim().equalsIgnoreCase("00/00/0000")
+                        || dob.getText().toString().trim().equalsIgnoreCase("0000/00/00")) {
+                    date = c.getTime();
+                } else {
+                    if (dob.getText().toString().trim().contains("-")) {
+                        try {
+                            date = new SimpleDateFormat("yyyy-MM-dd").parse(dob.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    } else {
+                        try {
+                            date = new SimpleDateFormat("dd-MMM-yyyy").parse(dob.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+                c.setTime(date);
+
+                DatePickerDialog dialog = new DatePickerDialog(MyProfileActivity.this, tolistener,
+                        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
+                try {
+                    c = Calendar.getInstance();
+                    c.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
+                    DatePicker datePicker = dialog.getDatePicker();
+                    datePicker.setMaxDate(c.getTime().getTime());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                dialog.show();
+            }
+        });
+
+
+        weddingCalendar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                isDOB = false;
+                Calendar c = Calendar.getInstance();
+                Date date = new Date();
+
+                if (weddingDate.getText().toString().trim().isEmpty()
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("0000-00-00")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("00-00-0000")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("00/00/0000")
+                        || weddingDate.getText().toString().trim().equalsIgnoreCase("0000/00/00")) {
+                    date = c.getTime();
+                } else {
+                    if (weddingDate.getText().toString().trim().contains("-")) {
+                        try {
+                            date = new SimpleDateFormat("yyyy-MM-dd").parse(weddingDate.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    } else {
+                        try {
+                            date = new SimpleDateFormat("dd-MMM-yyyy").parse(weddingDate.getText().toString().trim());
+                        } catch (ParseException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+                c.setTime(date);
+
+                DatePickerDialog dialog = new DatePickerDialog(MyProfileActivity.this, tolistener,
+                        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
+                try {
+                    DatePicker datePicker = dialog.getDatePicker();
+                    datePicker.setMaxDate(c.getTime().getTime());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                dialog.show();
+            }
+        });
+
+
+        editButton = findViewById(R.id.editButton);
+        cameraButton = findViewById(R.id.cameraButton);
+        cameraButton.setVisibility(View.GONE);
+        bottomLayout.setVisibility(View.INVISIBLE);
+        linearWeddingDate.setVisibility(View.INVISIBLE);
+        dobCalendar.setVisibility(View.INVISIBLE);
+        checkBoxMarried.setEnabled(false);
+        weddingCalendar.setVisibility(View.INVISIBLE);
+        getMyProfile();
+
+        checkBoxMarried.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                boolean checked = ((CheckBox) v).isChecked();
+                if (checked) {
+                    linearWeddingDate.setVisibility(View.VISIBLE);
+                    if (isEditable == false) {
+                        weddingCalendar.setVisibility(View.INVISIBLE);
+                    } else {
+                        weddingCalendar.setVisibility(View.VISIBLE);
+                    }
+                } else {
+                    linearWeddingDate.setVisibility(View.INVISIBLE);
+                    if (isEditable == false) {
+                        weddingCalendar.setVisibility(View.INVISIBLE);
+                    } else {
+                        weddingCalendar.setVisibility(View.VISIBLE);
+                    }
+                }
+            }
+        });
+
+
+        editButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (cameraButton.getVisibility() == View.GONE) {
+                    IMAGE_PATH = "";
+                    setUpperHintColor(getResources().getColor(R.color.bg_color_dark), editInputDob);
+                    setUpperHintColor(getResources().getColor(R.color.bg_color_dark), editInputEmail);
+                    setUpperHintColor(getResources().getColor(R.color.bg_color_dark), editInputWedding);
+
+                    mobile.setTextColor(getResources().getColor(R.color.material_grey300));
+                    designation.setTextColor(getResources().getColor(R.color.material_grey300));
+                    dealer.setTextColor(getResources().getColor(R.color.material_grey300));
+                    doj.setTextColor(getResources().getColor(R.color.material_grey300));
+                    zone.setTextColor(getResources().getColor(R.color.material_grey300));
+                    region.setTextColor(getResources().getColor(R.color.material_grey300));
+                    state.setTextColor(getResources().getColor(R.color.material_grey300));
+                    city.setTextColor(getResources().getColor(R.color.material_grey300));
+                    weddingDate.setHintTextColor(getResources().getColor(R.color.material_grey700));
+                    cameraButton.setVisibility(View.VISIBLE);
+                    cameraButton.startAnimation(AnimationUtils.loadAnimation(MyProfileActivity.this, R.anim.zoomin));
+                    slideToTop(bottomLayout);
+                    email.setEnabled(true);
+                    checkBoxMarried.setEnabled(true);
+                    dobCalendar.setVisibility(View.VISIBLE);
+                    isEditable = true;
+
+                } else {
+
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color), editInputDob);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color), editInputEmail);
+                    setUpperHintColor(getResources().getColor(R.color.btn_bg_color), editInputWedding);
+                    mobile.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    designation.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    doj.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    zone.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    region.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    state.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    city.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    dealer.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                    cameraButton.startAnimation(AnimationUtils.loadAnimation(MyProfileActivity.this, R.anim.zoomout));
+                    cameraButton.setVisibility(View.GONE);
+                    slideToBottom(bottomLayout);
+                    email.setEnabled(false);
+                    checkBoxMarried.setEnabled(false);
+                    dobCalendar.setVisibility(View.INVISIBLE);
+                    weddingCalendar.setVisibility(View.INVISIBLE);
+                    IMAGE_PATH = "";
+                    isEditable = false;
+                    setMyProfile();
+
+                }
+
+            }
+        });
+
+        cameraButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                PickImageDialog.build(new PickSetup().setButtonOrientation(LinearLayout.HORIZONTAL)).setOnPickCancel(new IPickCancel() {
+                    @Override
+                    public void onCancelClick() {
+
+                    }
+                }).show(MyProfileActivity.this);
+            }
+        });
+
+        submitButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                updateProfile();
+            }
+        });
+
+
+    }
+
+    private static String displayMonth(String date) throws ParseException {
+        Date d = new SimpleDateFormat("dd-MM-yyyy").parse(date);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(d);
+        String monthName = new SimpleDateFormat("dd-MMM-yyyy").format(cal.getTime());
+        return monthName;
+    }
+
+    private void setUpperHintColor(int color, TextInputLayout txtInputLayout) {
+        try {
+            Field field = txtInputLayout.getClass().getDeclaredField("mFocusedTextColor");
+            field.setAccessible(true);
+            int[][] states = new int[][]{
+                    new int[]{}
+            };
+            int[] colors = new int[]{
+                    color
+            };
+            ColorStateList myList = new ColorStateList(states, colors);
+            field.set(txtInputLayout, myList);
+
+            Method method = txtInputLayout.getClass().getDeclaredMethod("updateLabelState", boolean.class);
+            method.setAccessible(true);
+            method.invoke(txtInputLayout, true);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public DatePickerDialog.OnDateSetListener tolistener = new DatePickerDialog.OnDateSetListener() {
+        @Override
+        public void onDateSet(DatePicker view, int y, int monthOfYear, int dayOfMonth) {
+            year = y;
+            month = monthOfYear;
+            day = dayOfMonth;
+            String datevalue = String.valueOf(day);
+            int mval = (month + 1);
+            String monthvalue = String.valueOf(mval);
+            String date = "0";
+            String monthname = "0";
+            if (datevalue.length() == 1) {
+                date = "0" + datevalue;
+            } else {
+                date = datevalue;
+            }
+
+            if (monthvalue.length() == 1) {
+                monthname = "0" + monthvalue;
+            } else {
+                monthname = monthvalue;
+            }
+            //dateValue = String.valueOf(year) + "-" + (month + 1) + "-" + day + " ";
+            String dateValue = String.valueOf(year) + "-" + monthname + "-" + date;
+            dob.setText(dateFormate(dateValue));
+            if (isDOB) {
+                dob.setText(dateFormate(dateValue));
+            } else {
+                weddingDate.setText(dateFormate(dateValue));
+            }
+        }
+    };
+
+
+    public String dateFormate(String dte) {
+        String date = "";
+        if (dte.equalsIgnoreCase("0000-00-00")) {
+            date = "00/00/0000";
+            return date;
+        } else {
+
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+            Date newDate = null;
+            try {
+                newDate = format.parse(dte);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+
+            format = new SimpleDateFormat("dd-MMM-yyyy");
+            date = format.format(newDate);
+
+        }
+        return date;
+    }
+
+    public String finalDateFormat(String date) {
+
+        SimpleDateFormat format1 = new SimpleDateFormat("dd-MMM-yyyy");
+        Date newDate = null;
+        try {
+            newDate = format1.parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        format1 = new SimpleDateFormat("yyyy-MM-dd");
+        date = format1.format(newDate);
+        return date;
+
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        finish();
+        overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    public void slideToBottom(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, 0, view.getHeight());
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.GONE);
+    }
+
+    public void slideToTop(View view) {
+        TranslateAnimation animate = new TranslateAnimation(0, 0, view.getHeight(), 0);
+        animate.setDuration(500);
+        animate.setFillAfter(true);
+        view.startAnimation(animate);
+        view.setVisibility(View.VISIBLE);
+    }
+
+    private void getMyProfile() {
+        if (new UtilService().isNetworkAvailable(MyProfileActivity.this)) {
+            progressDialog = new TransparentProgressDialog(MyProfileActivity.this);
+            progressDialog.show();
+
+            try {
+                restService.getProfile().enqueue(new Callback<UserResponse>() {
+                    @Override
+                    public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            MY_PROFILE = response.body();
+                            if (MY_PROFILE.getData().getIs_married().equalsIgnoreCase("1")) {
+                                checkBoxMarried.setChecked(true);
+                                linearWeddingDate.setVisibility(View.VISIBLE);
+                            }
+                            setMyProfile();
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+
+                        new Handler().postDelayed(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (getPreferences(MODE_PRIVATE).getBoolean("MyProfileActivity", true)) {
+//                                    showHelpScreen();
+                                    getPreferences(MODE_PRIVATE).edit().putBoolean("MyProfileActivity", false).apply();
+                                }
+                            }
+                        }, 1000);
+                    }
+
+                    @Override
+                    public void onFailure(Call<UserResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    private void setMyProfile() {
+
+        email.setText(MY_PROFILE.getData().getEmailid());
+        mobile.setText(MY_PROFILE.getData().getMobileno());
+        dealer.setText(MY_PROFILE.getData().getDealer().getDealer_name());
+        designation.setText(MY_PROFILE.getData().getRolename());
+        doj.setText(dateFormate(MY_PROFILE.getData().getDoj()));
+        zone.setText(MY_PROFILE.getData().getZone());
+        region.setText(MY_PROFILE.getData().getZone());
+        state.setText(MY_PROFILE.getData().getState());
+        city.setText(MY_PROFILE.getData().getCity());
+        dob.setText(dateFormate(MY_PROFILE.getData().getDob()));
+        weddingDate.setText(dateFormate(MY_PROFILE.getData().getMarriage_date()));
+        collapsingToolbar.setTitle(MY_PROFILE.getData().getFname() + " " + MY_PROFILE.getData().getLname());
+        collapsingToolbar.setSubtitle(MY_PROFILE.getData().getRolename());
+        Glide.with(this).load(MY_PROFILE.getData().getProfile_photo())
+                .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                .into(userImage);
+    }
+
+    @Override
+    public void onPickResult(PickResult pickResult) {
+        if (pickResult.getError() == null) {
+            IMAGE_PATH = pickResult.getPath();
+            if (IMAGE_PATH != null && !IMAGE_PATH.trim().isEmpty()) {
+                Intent intent = new Intent(MyProfileActivity.this, CropActivity.class);
+                CropActivity.mSourceUri = pickResult.getUri();
+                startActivityForResult(intent, 2276);
+            } else {
+                userImage.setImageBitmap(pickResult.getBitmap());
+            }
+
+        } else {
+            GlobalData.showToast(this, pickResult.getError().getMessage(), Toast.LENGTH_LONG).show();
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (resultCode == RESULT_OK && requestCode == 2276) {
+            IMAGE_PATH = data.getStringExtra("IMAGE_PATH");
+            Glide.with(this).load(new File(IMAGE_PATH))
+                    .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                    .into(userImage);
+        } else if (resultCode == RESULT_CANCELED && requestCode == 2276) {
+            IMAGE_PATH = "";
+        }
+    }
+
+    private void showHelpScreen() {
+        try {
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(editButton)
+                    .title("Tap here to edit profile details")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .focusShape(FocusShape.CIRCLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    public void updateProfile() {
+        if (dob.getText().toString().trim().isEmpty() || dob.getText().toString().equalsIgnoreCase("00/00/0000")) {
+            GlobalData.showToast(this, "Enter Date of Birth", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (email.getText().toString().trim().isEmpty()) {
+            GlobalData.showToast(this, "Enter email", Toast.LENGTH_SHORT).show();
+            return;
+        }
+        if (!isValidEmail(email.getText().toString())) {
+            GlobalData.showToast(this, "Enter valid email address", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (mobile.getText().toString().trim().isEmpty()) {
+            GlobalData.showToast(this, "Enter mobile number", Toast.LENGTH_SHORT).show();
+            return;
+        }
+
+        if (checkBoxMarried.isChecked()) {
+            if (weddingDate.getText().toString().trim().isEmpty() || weddingDate.getText().toString().equalsIgnoreCase("00/00/0000")) {
+                GlobalData.showToast(this, "Enter wedding date", Toast.LENGTH_SHORT).show();
+                return;
+            }
+        }
+
+        if (new UtilService().isNetworkAvailable(MyProfileActivity.this)) {
+            if (IMAGE_PATH.trim().isEmpty()) {
+                try {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("dob", finalDateFormat(dob.getText().toString().trim()));
+                    map.put("email", email.getText().toString().trim());
+                    map.put("is_married", checkBoxMarried.isChecked() ? "1" : "0");
+                    if (checkBoxMarried.isChecked()) {
+                        map.put("marriage_date", finalDateFormat(weddingDate.getText().toString().trim()));
+                    } else {
+                        map.put("marriage_date", "0000-00-00");
+                    }
+
+                    progressDialog = new TransparentProgressDialog(MyProfileActivity.this);
+                    progressDialog.show();
+                    restService.postProfile(map).enqueue(new Callback<UserResponse>() {
+                        @Override
+                        public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+
+                            if (response.body() != null && response.body().getStatus() == 200) {
+                                MY_PROFILE = response.body();
+                                GlobalData.showToast(MyProfileActivity.this, "Profile updated successfully", Toast.LENGTH_SHORT).show();
+                                setMyProfile();
+                                GlobalData.user.setData(response.body().getData());
+                                saveUserData();
+                                new Handler(HomeActivity.profileUpdateCallback).sendEmptyMessage(0);
+
+                            } else if (response.body() != null && response.body().getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            } else if (response.body() != null) {
+                                GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                            } else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                                if (message.getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    finish();
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<UserResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(MyProfileActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+            } else {
+                File file = new File(IMAGE_PATH);
+                RequestBody reqFile = RequestBody.create(MediaType.parse("image/*"), file);
+                MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), reqFile);
+                RequestBody emailtxt = RequestBody.create(MediaType.parse("text/plain"), email.getText().toString().trim());
+                RequestBody dobtxt = RequestBody.create(MediaType.parse("text/plain"), finalDateFormat(dob.getText().toString().trim()));
+                RequestBody isMarried = RequestBody.create(MediaType.parse("text/plain"), checkBoxMarried.isChecked() ? "1" : "0");
+                RequestBody isMarriedDate = RequestBody.create(MediaType.parse("text/plain"), "0000-00-00");
+                if (checkBoxMarried.isChecked()) {
+                    isMarriedDate = RequestBody.create(MediaType.parse("text/plain"), finalDateFormat(weddingDate.getText().toString().trim()));
+                }
+                progressDialog = new TransparentProgressDialog(MyProfileActivity.this);
+                progressDialog.show();
+                restService.postProfileWithImage(body, emailtxt, dobtxt, isMarried, isMarriedDate).enqueue(new Callback<UserResponse>() {
+                    @Override
+                    public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            MY_PROFILE = response.body();
+                            GlobalData.showToast(MyProfileActivity.this, "Profile updated successfully", Toast.LENGTH_SHORT).show();
+                            setMyProfile();
+                            GlobalData.user.setData(response.body().getData());
+                            saveUserData();
+                            new Handler(HomeActivity.profileUpdateCallback).sendEmptyMessage(0);
+
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<UserResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        t.printStackTrace();
+                        GlobalData.showToast(MyProfileActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+            }
+
+        } else {
+            GlobalData.showToast(MyProfileActivity.this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void showInstructions() {
+        View view = LayoutInflater.from(MyProfileActivity.this).inflate(
+                R.layout.profile_success, null);
+        TextView textHead = (TextView) view.findViewById(R.id.textHead);
+        TextView text1 = (TextView) view.findViewById(R.id.text1);
+        TextView text2 = (TextView) view.findViewById(R.id.text2);
+        TextView text3 = (TextView) view.findViewById(R.id.text3);
+
+
+        view.findViewById(R.id.btn_ok).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        alertDialog.dismiss();
+                        startActivity(new Intent(MyProfileActivity.this, HomeActivity.class));
+                    }
+                });
+
+        alertDialogBuilder = new AlertDialog.Builder(MyProfileActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+    }
+
+
+    private void saveUserData() {
+        editButton.performClick();
+        GlobalData.sdb.delete("session", null, null);
+        Gson gson = new Gson();
+        JsonElement jsonElement = gson.toJsonTree(
+                GlobalData.user, new TypeToken<UserResponse>() {
+                }.getType());
+        ContentValues values = new ContentValues();
+        values.put("user", jsonElement.toString());
+        GlobalData.sdb.insert("session", null, values);
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(MyProfileActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+

+ 309 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/MyWallet.java

@@ -0,0 +1,309 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.OrderHistoryAdapter;
+import com.ttiglobal.inttilectgpchat.autofit.AutofitTextView;
+import com.ttiglobal.inttilectgpchat.droppy.DroppyClickCallbackInterface;
+import com.ttiglobal.inttilectgpchat.droppy.DroppyMenuItem;
+import com.ttiglobal.inttilectgpchat.droppy.DroppyMenuPopup;
+import com.ttiglobal.inttilectgpchat.droppy.EasyDialog;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.OrderHistoryResponse;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import java.util.Objects;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class MyWallet extends AppCompatActivity {
+    TextView title, earnedPoints;
+    Button purchaseNow;
+    TransparentProgressDialog progressDialog;
+    AutofitTextView points, unApprovedPoints;
+    EmptyStateRecyclerView purchasedList;
+    LinearLayoutManager linearLayoutManager;
+    ProgressBar progressBar;
+    ApiService restService;
+
+    public OrderHistoryResponse dataOrderHistory = new OrderHistoryResponse();
+    int TOTAL_RECORD = 0;
+    int PAGE = 0;
+    int LIMIT = 10;
+    public static Handler.Callback callbackOrderHistory;
+    public static String strCurrentAmount = "";
+
+    ImageView rightMenu;
+    EasyDialog easyDialog;
+    DroppyMenuPopup droppyMenu;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_wallet_history);
+        rightMenu = findViewById(R.id.rightMenu);
+
+        restService = ((MainApplication) getApplication()).getClient();
+        title = findViewById(R.id.title);
+        points = findViewById(R.id.points);
+        unApprovedPoints = findViewById(R.id.unApprovedPoints);
+
+        FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
+
+        Bundle bundle = new Bundle();
+       /* bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
+        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "MyWalletActivity");
+        firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);*/
+        // GlobalData.user.getData().setMpin("");
+        purchaseNow = findViewById(R.id.btn_purchase);
+        purchasedList = findViewById(R.id.redeemProductList);
+        purchasedList.setHasFixedSize(true);
+        purchasedList.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new LinearLayoutManager(MyWallet.this);
+        purchasedList.setLayoutManager(linearLayoutManager);
+        purchasedList.addOnScrollListener(recyclerViewOnScrollListener);
+        callbackOrderHistory = new Handler.Callback() {
+            @Override
+            public boolean handleMessage(Message msg) {
+                getOrderHistory();
+                return false;
+            }
+        };
+
+        purchasedList.post(new Runnable() {
+            @Override
+            public void run() {
+
+                getOrderHistory();
+            }
+        });
+
+
+        purchasedList.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                new TextStateDisplay(this, "No data available", ""));
+
+        purchaseNow.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(new Intent(MyWallet.this, RedeemProductListActivity.class));
+            }
+        });
+        progressBar = findViewById(R.id.progressBar);
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        Objects.requireNonNull(getSupportActionBar()).setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+        initDroppyMenu();
+        rightMenu.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+                easyDialog = new EasyDialog(MyWallet.this, droppyMenu)
+                        .setLayout(droppyMenu.show())
+                        .setGravity(EasyDialog.GRAVITY_BOTTOM)
+                        .setBackgroundColor(Color.TRANSPARENT, Color.WHITE)
+                        .setLocationByAttachedView(rightMenu)
+                        .setAnimationTranslationShow(EasyDialog.DIRECTION_X, 350,
+                                GlobalData.width, 0)
+                        .setAnimationTranslationDismiss(EasyDialog.DIRECTION_X, 350, 0,
+                                GlobalData.width).setTouchOutsideDismiss(true)
+                        .setMatchParent(false).setMarginLeftAndRight(0, 15)
+                        .setOutsideColor(Color.parseColor("#80000000")).show();
+
+            }
+        });
+    }
+
+    private void initDroppyMenu() {
+        DroppyMenuPopup.Builder droppyBuilder = new DroppyMenuPopup.Builder(
+                MyWallet.this, rightMenu);
+        droppyBuilder.addMenuItem(new DroppyMenuItem("Change Pin", R.mipmap.icon_change_password))
+                .triggerOnAnchorClick(false);
+        droppyBuilder.setOnClick(new DroppyClickCallbackInterface() {
+            @Override
+            public void call(View v, int id) {
+                easyDialog.dismiss();
+                switch (id) {
+                    case 0:
+                        new Handler().postDelayed(new Runnable() {
+                            @Override
+                            public void run() {
+                                Intent i = new Intent(MyWallet.this, OtpActivity.class);
+                                i.putExtra("type", "change");
+                                startActivity(i);
+
+                            }
+                        }, 300);
+                        break;
+                }
+            }
+        });
+        droppyMenu = droppyBuilder.build();
+    }
+
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    private RecyclerView.OnScrollListener recyclerViewOnScrollListener = new RecyclerView.OnScrollListener() {
+        @Override
+        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+            super.onScrollStateChanged(recyclerView, newState);
+        }
+
+        @Override
+        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+            super.onScrolled(recyclerView, dx, dy);
+            int visibleItemCount = linearLayoutManager.getChildCount();
+            int totalItemCount = linearLayoutManager.getItemCount();
+            int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
+
+            if (progressBar.getVisibility() != View.VISIBLE) {
+                if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
+                        && firstVisibleItemPosition >= 0
+                        && totalItemCount < TOTAL_RECORD && dataOrderHistory.getData().size() < TOTAL_RECORD) {
+                    PAGE++;
+                    getOrderHistory();
+                }
+            }
+        }
+    };
+
+    private void getOrderHistory() {
+        if (new UtilService().isNetworkAvailable(this)) {
+            progressDialog = new TransparentProgressDialog(this);
+            progressDialog.show();
+            try {
+                restService.getOrderHistory(PAGE, LIMIT).enqueue(new Callback<OrderHistoryResponse>() {
+                    @Override
+                    public void onResponse(Call<OrderHistoryResponse> call, Response<OrderHistoryResponse> response) {
+                        dataOrderHistory = response.body();
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        if (dataOrderHistory != null && dataOrderHistory.getStatus() == 200) {
+                            setDataOrderHistory();
+                        } else if (response.body() != null && Objects.requireNonNull(response.body()).getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(MyWallet.this, Objects.requireNonNull(response.body()).getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(Objects.requireNonNull(response.errorBody()).charStream(), ErrorResponse.class);
+                            GlobalData.showToast(MyWallet.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<OrderHistoryResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(MyWallet.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(MyWallet.this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        finish();
+        overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void setDataOrderHistory() {
+        strCurrentAmount = dataOrderHistory.getCurrent_amount();
+        if (dataOrderHistory != null) {
+            int totalAmount = 0;
+            try {
+                totalAmount = Integer.parseInt(strCurrentAmount);
+            } catch (NumberFormatException e) {
+                e.printStackTrace();
+            }
+            if (totalAmount > 0) {
+                purchaseNow.setEnabled(true);
+                purchaseNow.setAlpha(1f);
+            }
+        }
+        points.setText(dataOrderHistory.getCurrent_amount());
+        if (dataOrderHistory.getUnapproved_amount() == null)
+            unApprovedPoints.setText("0");
+        else
+            unApprovedPoints.setText("" + dataOrderHistory.getUnapproved_amount());
+        OrderHistoryAdapter adapter = new OrderHistoryAdapter(this, dataOrderHistory.getData());
+        purchasedList.setAdapter(adapter);
+
+    }
+}

+ 464 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/NotificationActivity.java

@@ -0,0 +1,464 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import androidx.recyclerview.widget.ItemTouchHelper;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ProgressBar;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.adapter.NotificationAdapter;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.DismissListener;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FancyShowCaseView;
+import com.ttiglobal.inttilectgpchat.fancyshowcase.FocusShape;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.MyCallback;
+import com.ttiglobal.inttilectgpchat.util.PositionUpdateListener;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.util.WrapContentLinearLayoutManager;
+import com.ttiglobal.inttilectgpchat.wrappers.AssessmentList;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.Notification;
+import com.ttiglobal.inttilectgpchat.wrappers.NotificationResponse;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class NotificationActivity extends AppCompatActivity implements PositionUpdateListener, DismissListener {
+    ApiService restService;
+    EmptyStateRecyclerView notificationList;
+    TransparentProgressDialog progressDialog;
+    int PAGE = 0;
+    int LIMIT = 10;
+    WrapContentLinearLayoutManager linearLayoutManager;
+    int TOTAL_RECORD = 0;
+    ProgressBar progressBar;
+    ArrayList<Notification> MY_NOTIFICATIONS = new ArrayList<>();
+    NotificationAdapter adapter;
+    private Paint p = new Paint();
+    public static Handler.Callback notificationCallback;
+    ArrayList<AssessmentList> ASSESSMENT_LIST = new ArrayList<>();
+    ArrayList<AssessmentList> OFFLINE_ASSESSMENT_LIST = new ArrayList<>();
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_notification);
+        setupWindowAnimations();
+
+        restService = ((MainApplication) getApplication()).getClient();
+        GlobalData.openDatabase(NotificationActivity.this);
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+        notificationList = findViewById(R.id.notificationList);
+        notificationList.setHasFixedSize(true);
+        notificationList.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new WrapContentLinearLayoutManager(getBaseContext());
+        notificationList.setLayoutManager(linearLayoutManager);
+        notificationList.addOnScrollListener(recyclerViewOnScrollListener);
+        progressBar = findViewById(R.id.progressBar);
+        notificationList.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                new TextStateDisplay(this, "No data available", ""));
+
+        notificationList.post(new Runnable() {
+            @Override
+            public void run() {
+                getNotifications(true);
+            }
+        });
+
+        initSwipe();
+
+        findViewById(R.id.helpIcon).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showHelpScreen();
+            }
+        });
+
+        notificationCallback = new Handler.Callback() {
+            @Override
+            public boolean handleMessage(Message msg) {
+                PAGE = 0;
+                getNotifications(false);
+                return false;
+            }
+        };
+    }
+
+    private void showHelpScreen() {
+        try {
+            View view;
+//            if (adapter != null && adapter.getItemCount() > 0) {
+//                view = notificationList.findViewHolderForAdapterPosition(linearLayoutManager.findFirstVisibleItemPosition()).itemView;
+//            } else {
+//                view = notificationList;
+//            }
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(notificationList)
+                    .title("Tap here to view notification")
+                    .titleSize(22, 1)
+                    .titleGravity(1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .dismissListener(this)
+                    .focusShape(FocusShape.ROUNDED_RECTANGLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @Override
+    public void onDismiss(String id) {
+        try {
+            View view;
+            if (adapter != null && adapter.getItemCount() > 0) {
+                view = notificationList.findViewHolderForAdapterPosition(linearLayoutManager.findFirstVisibleItemPosition()).itemView;
+            } else {
+                view = notificationList;
+            }
+            new FancyShowCaseView.Builder(this)
+                    .focusOn(view)
+                    .title("Swipe right to left delete notification")
+                    .titleSize(22, 1)
+                    .closeOnTouch(true)
+                    .fitSystemWindows(false)
+                    .focusShape(FocusShape.ROUNDED_RECTANGLE)
+                    .backgroundColor(Color.parseColor("#99000000"))
+                    .build()
+                    .show();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void onSkipped(String id) {
+
+    }
+
+    private void initSwipe() {
+        ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {
+
+            @Override
+            public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
+                return false;
+            }
+
+            @Override
+            public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
+                int position = viewHolder.getAdapterPosition();
+                if (direction == ItemTouchHelper.LEFT) {
+                    try {
+                        notificationList.setEnabled(false);
+                        deleteNotification(position);
+                        notificationList.setEnabled(true);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+
+            @Override
+            public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
+
+                Bitmap icon;
+                if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
+
+                    View itemView = viewHolder.itemView;
+                    float height = (float) itemView.getBottom() - (float) itemView.getTop();
+                    float width = height / 3;
+
+                    if (dX < 0) {
+                        p.setColor(Color.RED);
+                        RectF background = new RectF((float) itemView.getRight() + dX, (float) itemView.getTop(),
+                                (float) itemView.getRight(), (float) itemView.getBottom());
+                        c.drawRect(background, p);
+                        icon = BitmapFactory.decodeResource(getResources(), R.mipmap.delete_icon);
+                        RectF icon_dest = new RectF((float) itemView.getRight() - 2 * width,
+                                (float) itemView.getTop() + width, (float) itemView.getRight() - width,
+                                (float) itemView.getBottom() - width);
+                        c.drawBitmap(icon, null, icon_dest, p);
+                    }
+                }
+                super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
+            }
+        };
+        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
+        itemTouchHelper.attachToRecyclerView(notificationList);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    private void getNotifications(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(NotificationActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(NotificationActivity.this);
+                progressDialog.show();
+                progressBar.setVisibility(View.GONE);
+            } else {
+                progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getNotifications(PAGE, LIMIT).enqueue(new Callback<NotificationResponse>() {
+                @Override
+                public void onResponse(Call<NotificationResponse> call, Response<NotificationResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        TOTAL_RECORD = Integer.parseInt(response.body().getTotal());
+
+                        if (adapter == null) {
+                            MY_NOTIFICATIONS = response.body().getData();
+                            adapter = new NotificationAdapter(NotificationActivity.this, MY_NOTIFICATIONS,
+                                    NotificationActivity.this, restService);
+                            notificationList.setAdapter(adapter);
+                        } else {
+
+                            MY_NOTIFICATIONS.addAll(response.body().getData());
+                            adapter.notifyDataSetChanged();
+                        }
+
+                        if (MY_NOTIFICATIONS.size() == 0) {
+                            notificationList.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+                        } else {
+                            notificationList.invokeState(EmptyStateRecyclerView.STATE_OK);
+                        }
+
+                        GlobalData.sdb.delete("notifications", null, null);
+                        Gson gson = new Gson();
+                        JsonElement jsonElement = gson.toJsonTree(
+                                MY_NOTIFICATIONS, new TypeToken<ArrayList<Notification>>() {
+                                }.getType());
+                        ContentValues values = new ContentValues();
+                        values.put("notifications", jsonElement.toString());
+                        GlobalData.sdb.insert("notifications", null, values);
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    }
+
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (getPreferences(MODE_PRIVATE).getBoolean("NotificationActivity", true)) {
+//                                showHelpScreen();
+                                getPreferences(MODE_PRIVATE).edit().putBoolean("NotificationActivity", false).apply();
+                            }
+                        }
+                    }, 1000);
+                }
+
+                @Override
+                public void onFailure(Call<NotificationResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    progressBar.setVisibility(View.GONE);
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            if (adapter == null) {
+                Cursor cursor = GlobalData.sdb.rawQuery("select * from notifications", null);
+                if (cursor.getCount() > 0) {
+                    cursor.moveToFirst();
+                    Gson gson = new Gson();
+                    MY_NOTIFICATIONS = gson.fromJson(
+                            cursor.getString(cursor.getColumnIndex("notifications")),
+                            new TypeToken<ArrayList<Notification>>() {
+                            }.getType());
+                    TOTAL_RECORD = MY_NOTIFICATIONS.size();
+                    adapter = new NotificationAdapter(NotificationActivity.this, MY_NOTIFICATIONS,
+                            NotificationActivity.this, restService);
+                    notificationList.setAdapter(adapter);
+                } else {
+                    GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+                }
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+        }
+    }
+
+
+    private RecyclerView.OnScrollListener recyclerViewOnScrollListener = new RecyclerView.OnScrollListener() {
+        @Override
+        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+            super.onScrollStateChanged(recyclerView, newState);
+        }
+
+        @Override
+        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+            super.onScrolled(recyclerView, dx, dy);
+            int visibleItemCount = linearLayoutManager.getChildCount();
+            int totalItemCount = linearLayoutManager.getItemCount();
+            int firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
+
+            if (progressBar.getVisibility() != View.VISIBLE) {
+                if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
+                        && firstVisibleItemPosition >= 0
+                        && totalItemCount < TOTAL_RECORD && MY_NOTIFICATIONS.size() < TOTAL_RECORD) {
+                    PAGE++;
+                    getNotifications(false);
+                }
+            }
+        }
+    };
+
+    @Override
+    public void onPositionUpdate(int position) {
+
+    }
+
+    private void deleteNotification(int id) {
+        Cursor cursor = GlobalData.sdb.rawQuery("select * from notification_deleted", null);
+        String ids;
+        if (cursor.getCount() > 0) {
+            cursor.moveToFirst();
+            ids = cursor.getString(cursor.getColumnIndex("notification_deleted"));
+            ids = ids + "," + MY_NOTIFICATIONS.get(id).getId().trim();
+        } else {
+            ids = MY_NOTIFICATIONS.get(id).getId().trim();
+        }
+        adapter.remove(id);
+        if (MY_NOTIFICATIONS.size() == 0) {
+            notificationList.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+        }
+
+        GlobalData.sdb.delete("notification_deleted", null, null);
+        ContentValues values1 = new ContentValues();
+        values1.put("notification_deleted", ids);
+        GlobalData.sdb.insert("notification_deleted", null, values1);
+
+        GlobalData.sdb.delete("notifications", null, null);
+        Gson gson = new Gson();
+        JsonElement jsonElement = gson.toJsonTree(
+                MY_NOTIFICATIONS, new TypeToken<ArrayList<Notification>>() {
+                }.getType());
+        ContentValues values = new ContentValues();
+        values.put("notifications", jsonElement.toString());
+        GlobalData.sdb.insert("notifications", null, values);
+
+        if (new UtilService().isNetworkAvailable(NotificationActivity.this)) {
+            HashMap<String, String> map = new HashMap<>();
+            map.put("notificationid", ids);
+
+            restService.updateDeleteNotifications(map)
+                    .enqueue(new MyCallback<ErrorResponse>(ids) {
+                        @Override
+                        public void onResponse(Call<ErrorResponse> call, Response<ErrorResponse> response) {
+                            if (response.body() != null && response.body().getStatus() == 200) {
+                                GlobalData.sdb.delete("notification_deleted", null, null);
+                            }
+                            try {
+                                new android.os.Handler(HomeActivity.badgeUpdateCallback).sendEmptyMessage(0);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
+
+                        @Override
+                        public void onFailure(Call<ErrorResponse> call, Throwable t) {
+                            GlobalData.showToast(NotificationActivity.this, "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+        } else {
+            try {
+                new android.os.Handler(HomeActivity.badgeUpdateCallback).sendEmptyMessage(0);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+}

+ 85 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/NotificationViewActivity.java

@@ -0,0 +1,85 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.text.method.ScrollingMovementMethod;
+import android.view.MenuItem;
+import android.widget.TextView;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.wrappers.Notification;
+
+
+public class NotificationViewActivity extends AppCompatActivity {
+    TextView title, contentTitle, contentDescription;
+    public static Notification NOTIFICATION = new Notification();
+    Toolbar toolbar;
+    private FirebaseAnalytics firebaseAnalytics;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_notification_view);
+        setupWindowAnimations();
+        title = findViewById(R.id.title);
+        firebaseAnalytics = FirebaseAnalytics.getInstance(this);
+        Bundle bundle = new Bundle();
+
+        contentTitle = findViewById(R.id.contentTitle);
+        contentTitle.setText(NOTIFICATION.getNotificationtitle());
+        contentDescription = findViewById(R.id.contentDescription);
+        contentDescription.setText(NOTIFICATION.getNotificationtext());
+        contentDescription.setMovementMethod(new ScrollingMovementMethod());
+
+        toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+    }
+
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+}

+ 457 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/OtpActivity.java

@@ -0,0 +1,457 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.pinview.PinView;
+import com.ttiglobal.inttilectgpchat.screenpinview.AppLockActivity;
+import com.ttiglobal.inttilectgpchat.screenpinview.ChangeAppLockActivity;
+import com.ttiglobal.inttilectgpchat.screenpinview.ForgotAppLockActivity;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.OtpResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.UserResponse;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class OtpActivity extends AppCompatActivity {
+
+    PinView pinview;
+    public OtpResponse errorResponse = new OtpResponse();
+    public UserResponse user = new UserResponse();
+    TransparentProgressDialog progressDialog;
+    ApiService restService;
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    public int counter;
+    public static Handler.Callback myOtpCallback;
+    TextView mobileNumTextView, resentOtpTxt, count_time;
+    String type;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        restService = ((MainApplication) getApplication()).getClient();
+
+        setContentView(R.layout.otp_activity);
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            type = extras.getString("type");
+
+        }
+        pinview = (PinView) findViewById(R.id.pinView);
+        count_time = findViewById(R.id.count_time);
+        mobileNumTextView = findViewById(R.id.mobileNo);
+        resentOtpTxt = findViewById(R.id.resentOtp);
+        resentOtpTxt.setEnabled(false);
+        resentOtpTxt.setAlpha(0.5f);
+        resentOtpTxt.setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        reSentOtp();
+                    }
+                });
+
+        findViewById(R.id.btn_cancel).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        if(type.equalsIgnoreCase("forgot")){
+                            Intent i = new Intent(OtpActivity.this, AppLockActivity.class);
+                            startActivity(i);
+                            finish();
+                        }else {
+                            Intent result = new Intent();
+                            setResult(Activity.RESULT_CANCELED, result);
+                            finish();
+                            OtpActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                                    R.anim.animation_f_leave);
+                        }
+
+                    }
+                });
+
+        findViewById(R.id.btn_submit).setOnClickListener(
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        if (pinview.getText().toString().equalsIgnoreCase("")) {
+                            GlobalData.showToast(getBaseContext(), "Please enter Valid OTP", Toast.LENGTH_SHORT).show();
+                            return;
+                        }
+                        otpValidation(pinview.getText().toString());
+
+                    }
+                });
+       findViewById(R.id.bgLayout).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                try {
+                    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+                    imm.hideSoftInputFromWindow(pinview.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+
+            }
+        });
+        sentOtp();
+        setupWindowAnimations();
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+    }
+
+
+    private void setData(String mobileNo, String otpexpirytime) {
+        int millsec = Integer.parseInt(otpexpirytime) * 60 * 1000;
+        new android.os.CountDownTimer(millsec, 1000) {
+            public void onTick(long millisUntilFinished) {
+                String formattedTime = String.format("%02d:%02d Sec",
+                        TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % TimeUnit.HOURS.toMinutes(1),
+                        TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) % TimeUnit.MINUTES.toSeconds(1));
+                count_time.setText(formattedTime);
+                counter++;
+            }
+
+            public void onFinish() {
+                count_time.setText("00:00");
+                resentOtpTxt.setEnabled(true);
+                resentOtpTxt.setAlpha(1f);
+            }
+        }.start();
+        Paint p = new Paint();
+        p.setColor(getResources().getColor(R.color.btn_bg_color));
+        resentOtpTxt.setPaintFlags(resentOtpTxt.getPaintFlags() | p.UNDERLINE_TEXT_FLAG);
+        String alterStr = new StringBuilder(mobileNo).replace(2, 7, "XXXXX").toString();
+        mobileNumTextView.setText("Your OTP has been sent to your "+alterStr);
+
+
+    }
+
+    public void sentOtp() {
+        if (new UtilService().isNetworkAvailable(OtpActivity.this)) {
+            progressDialog = new TransparentProgressDialog(OtpActivity.this);
+            progressDialog.show();
+
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("device_type","android");
+                restService.sentMPINOtp(map).enqueue(new Callback<OtpResponse>() {
+                    @Override
+                    public void onResponse(Call<OtpResponse> call, Response<OtpResponse> response) {
+                        errorResponse = response.body();
+
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        if (errorResponse != null && errorResponse.getStatus() == 200) {
+                            setData(GlobalData.user.getData().getMobileno(), errorResponse.getData().getOtp_expiry());
+                        } else if (errorResponse != null) {
+                            GlobalData.showToast(getBaseContext(), errorResponse.getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<OtpResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+
+
+
+    private void otpValidation(String otp) {
+
+        boolean cancel = false;
+        View focusView = null;
+        if (pinview.getText().toString().length() < 4) {
+            GlobalData.showToast(getBaseContext(), "please enter 4 digits", Toast.LENGTH_SHORT).show();
+            focusView = pinview;
+            cancel = true;
+        }
+        if (cancel) {
+            focusView.requestFocus();
+        } else {
+            if (new UtilService().isNetworkAvailable(OtpActivity.this)) {
+                progressDialog = new TransparentProgressDialog(OtpActivity.this);
+                progressDialog.show();
+                try {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("otp", otp);
+                    map.put("type", "mpin");
+
+
+                    restService.OtpValidation(map).enqueue(new Callback<UserResponse>() {
+                        @Override
+                        public void onResponse(Call<UserResponse> call, Response<UserResponse> response) {
+                            user = response.body();
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+
+                            if (user != null && user.getStatus() == 200) {
+                                getSharedPreferences("FCM_TOKEN", Context.MODE_PRIVATE)
+                                        .edit().putString("FCM_TOKEN_ID", "").apply();
+                                if (Build.VERSION.SDK_INT >= 23) {
+                                    if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                                            == PackageManager.PERMISSION_GRANTED) {
+                                        File f1 = new File(Environment.getExternalStorageDirectory()
+                                                + "/" + ".SUZUKI", "PDF");
+                                        if (f1.exists()) {
+                                            f1.delete();
+                                        }
+                                    }
+                                } else {
+                                    File f1 = new File(Environment.getExternalStorageDirectory()
+                                            + "/" + ".SUZUKI", "PDF");
+                                    if (f1.exists()) {
+                                        f1.delete();
+                                    }
+                                }
+                                if(type.equalsIgnoreCase("change")){
+                                    Intent i = new Intent(OtpActivity.this, ChangeAppLockActivity.class);
+                                    startActivity(i);
+                                    finish();
+                                }else if(type.equalsIgnoreCase("forgot")) {
+                                    Intent i = new Intent(OtpActivity.this, ForgotAppLockActivity.class);
+                                    startActivity(i);
+                                    finish();
+                                }else {
+                                    Intent i = new Intent(OtpActivity.this, AppLockActivity.class);
+                                    startActivity(i);
+                                    finish();
+                                }
+
+
+                            } else if (user != null) {
+                                GlobalData.showToast(getBaseContext(), user.getMessage(), Toast.LENGTH_SHORT).show();
+
+                            } else if (response.body() != null && Objects.requireNonNull(response.body()).getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                finish();
+                            }
+                            else if (response.errorBody() != null) {
+                                Gson gson = new Gson();
+                                ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                                GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+
+
+                                if (message.getStatus() == 401) {
+                                    GlobalData.canLogout = true;
+                                    new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                                    finish();
+                                }
+
+
+                            }
+
+
+                        }
+
+                        @Override
+                        public void onFailure(Call<UserResponse> call, Throwable t) {
+                            if (progressDialog != null && progressDialog.isShowing()) {
+                                progressDialog.dismiss();
+                            }
+                            GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                        }
+                    });
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+            }
+        }
+
+    }
+
+    public void reSentOtp() {
+        if (new UtilService().isNetworkAvailable(OtpActivity.this)) {
+            progressDialog = new TransparentProgressDialog(OtpActivity.this);
+            progressDialog.show();
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("device_type","android");
+                restService.sentMPINOtp(map).enqueue(new Callback<OtpResponse>() {
+                    @Override
+                    public void onResponse(Call<OtpResponse> call, Response<OtpResponse> response) {
+                        errorResponse = response.body();
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        if (errorResponse != null && errorResponse.getStatus() == 200) {
+                            setData(GlobalData.user.getData().getMobileno(), errorResponse.getData().getOtp_expiry());
+                        } else if (errorResponse != null) {
+                            GlobalData.showToast(getBaseContext(), errorResponse.getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        }
+
+
+                    }
+
+                    @Override
+                    public void onFailure(Call<OtpResponse> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(OtpActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @Override
+    public void onBackPressed() {
+
+        if(type.equalsIgnoreCase("forgot")){
+            Intent i = new Intent(OtpActivity.this, AppLockActivity.class);
+            startActivity(i);
+            finish();
+        }else {
+            finish();
+            OtpActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+
+            if(type.equalsIgnoreCase("forgot")){
+                Intent i = new Intent(OtpActivity.this, AppLockActivity.class);
+                startActivity(i);
+                finish();
+            }else {
+                finish();
+                OtpActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                        R.anim.animation_f_leave);
+            }
+
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+}

+ 612 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/PdfViewActivity.java

@@ -0,0 +1,612 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.database.Cursor;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.StrictMode;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import android.util.Log;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.github.barteksc.pdfviewer.PDFView;
+import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
+import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
+import com.github.barteksc.pdfviewer.listener.OnPageErrorListener;
+import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
+import com.github.barteksc.pdfviewer.util.FitPolicy;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.MyCallback;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.CommonResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.ContentFile;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.HitCountModel;
+import com.ttiglobal.inttilectgpchat.wrappers.MyContent;
+import com.ttiglobal.inttilectgpchat.wrappers.MyTopic;
+import com.ttiglobal.inttilectgpchat.wrappers.TrainingCategory;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+
+import javax.crypto.Cipher;
+import javax.crypto.CipherInputStream;
+import javax.crypto.CipherOutputStream;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.SecretKeySpec;
+
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class PdfViewActivity extends AppCompatActivity implements OnPageChangeListener, OnPageErrorListener, OnLoadCompleteListener {
+    TextView title, contentTitle, mTextLanguageSelection;
+    public static MyContent CONTENT = new MyContent();
+    public static MyTopic TOPIC = new MyTopic();
+    public static TrainingCategory TRAINING_ID = new TrainingCategory();
+    //  public static String TRAINING_ID="";
+    ImageView mImageLangSelection;
+    ProgressBar progressBar;
+    PDFView pdfView;
+    ApiService restService;
+    private AlertDialog.Builder builder;
+    private ContentFile SELECTED_CONTENT = new ContentFile();
+    String type;
+    public static boolean isOffline = false;
+    Handler handler = new Handler();
+    public static final String HASH_ALGORITHM = "SHA-256";
+    public String encryptKey = "Suzuki";
+    public File decryptFile = null;
+    private StorePreference storePreference;
+    public static String tempfilename = "temp";
+    String fromTime, toTime, finalTime;
+    Calendar c;
+    SimpleDateFormat df;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_pdf_view);
+        setupWindowAnimations();
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            type = extras.getString("type");
+        }
+        restService = ((MainApplication) getApplication()).getClient();
+        title = findViewById(R.id.title);
+        File f = new File(Environment.getExternalStorageDirectory(), ".SUZUKI");
+        if (!f.exists()) {
+            f.mkdirs();
+        }
+
+        File f1 = new File(Environment.getExternalStorageDirectory() + "/" + ".SUZUKI", "PDF");
+        if (!f1.exists()) {
+            f1.mkdirs();
+        }
+        storePreference = new StorePreference(this);
+
+
+        getCurrentTime();
+
+        contentTitle = findViewById(R.id.contentTitle);
+        mTextLanguageSelection = findViewById(R.id.textLanguage);
+        mImageLangSelection = findViewById(R.id.imgLanguage);
+        progressBar = findViewById(R.id.progressBar);
+        pdfView = findViewById(R.id.pdfView);
+        progressBar.setVisibility(View.VISIBLE);
+        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+        StrictMode.setThreadPolicy(policy);
+
+        mTextLanguageSelection.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                showLanguageSelectionList();
+            }
+        });
+        mImageLangSelection.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                showLanguageSelectionList();
+            }
+        });
+
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                LoadContentFile(getContentFile());
+            }
+        }, 1000);
+
+    }
+
+    private void getCurrentTime() {
+        c = Calendar.getInstance();
+        System.out.println("fromTime " + c.getTime());
+
+        df = new SimpleDateFormat("HH:mm:ss");
+        fromTime = df.format(c.getTime());
+        Log.e("fromTime", fromTime);
+    }
+
+    private void sendHitCountToServer() {
+        restService.sendAllHitCount(buildConfigData()).enqueue(new Callback<CommonResponse>() {
+            @Override
+            public void onResponse(Call<CommonResponse> call, Response<CommonResponse> response) {
+
+            }
+
+            @Override
+            public void onFailure(Call<CommonResponse> call, Throwable t) {
+                if (t.getMessage() != null) {
+                    Log.e("responeHit", t.getMessage());
+                }
+            }
+        });
+    }
+
+    private HitCountModel buildConfigData() {
+        HitCountModel hitCountModel = new HitCountModel();
+        hitCountModel.setPage("Learning");
+        hitCountModel.setAssettopicid(Integer.valueOf(CONTENT.getAssettopicid()));
+        hitCountModel.setContentid(Integer.valueOf(CONTENT.getContentid()));
+        hitCountModel.setViewtime(finalTime);
+        return hitCountModel;
+    }
+
+    public void decrypt(String pathstr, String filetype, Runnable runnable) throws IOException, NoSuchAlgorithmException,
+            NoSuchPaddingException, InvalidKeyException {
+        FileInputStream fis = new FileInputStream(pathstr);
+        File outputDir = this.getCacheDir(); // context being the Activity pointer
+        String format = ".pdf";
+        if (filetype.equalsIgnoreCase("pdf")) {
+            format = ".pdf";
+        } else if (filetype.equalsIgnoreCase("mp4")) {
+            format = ".mp4";
+        }
+        decryptFile = File.createTempFile(tempfilename, format, this.getCacheDir());
+        FileOutputStream fos = new FileOutputStream(decryptFile);
+        SecretKeySpec sks = generateKey(encryptKey);
+        Cipher cipher = Cipher.getInstance("AES");
+        cipher.init(Cipher.DECRYPT_MODE, sks);
+        CipherInputStream cis = new CipherInputStream(fis, cipher);
+        int b;
+        byte[] d = new byte[1024];
+        while ((b = cis.read(d)) != -1) {
+            fos.write(d, 0, b);
+        }
+
+        fos.flush();
+        fos.close();
+        cis.close();
+        runnable.run();
+    }
+
+
+    private ArrayList<String> getContentFile(MyContent item) {
+        if (item.getContent_files() == null) {
+            return null;
+        }
+        ArrayList<String> Language = new ArrayList<>();
+        for (ContentFile file : item.getContent_files()) {
+            Language.add(file.getLanguage_title());
+        }
+        return Language;
+    }
+
+    private void showLanguageSelectionList() {
+        final ArrayList<String> contentFile = getContentFile(CONTENT);
+        builder = new AlertDialog.Builder(PdfViewActivity.this);
+        builder.setTitle("SELECT LANGUAGE")
+                .setItems(contentFile.toArray(new String[contentFile.size()]), new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        LoadContentFile(CONTENT.getContent_files().get(i));
+                        dialogInterface.dismiss();
+                    }
+                });
+
+        builder.create().show();
+    }
+
+    public void LoadContentFile(final ContentFile con) {
+
+        SELECTED_CONTENT = con;
+        mTextLanguageSelection.setText(SELECTED_CONTENT.getLanguage_title());
+        contentTitle.setText(CONTENT.getTitle());
+        title.setText(CONTENT.getTitle());
+
+        title.setSelected(true);
+        pdfView.post(new Runnable() {
+            @Override
+            public void run() {
+                File file = new File(Environment.getExternalStorageDirectory()
+                        + "/" + ".SUZUKI", "PDF/" + CONTENT.getContentid() + "_" + CONTENT.getVersion() + "_" + SELECTED_CONTENT.getLanguage_code() + ".pdf");
+                if (file.exists()) {
+                    saveTopicData();
+                    try {
+                        decrypt(file.toString(), "pdf", new Runnable() {
+                            @Override
+                            public void run() {
+                                pdfView.fromFile(decryptFile)
+                                        .onPageChange(PdfViewActivity.this)
+                                        .enableAnnotationRendering(true)
+                                        .onLoad(PdfViewActivity.this)
+                                        .scrollHandle(new DefaultScrollHandle(PdfViewActivity.this))
+                                        .spacing(10)
+                                        .onPageError(PdfViewActivity.this)
+                                        .pageFitPolicy(FitPolicy.WIDTH)
+                                        .load();
+                            }
+                        });
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        progressBar.setVisibility(View.GONE);
+                    }
+                } else {
+                    downloadPDF(con);
+                }
+            }
+        });
+
+    }
+
+    public void saveTopicData() {
+
+        Cursor cursor = GlobalData.sdb.rawQuery("select * from topic_content where" + " category_id='"
+                + TRAINING_ID.getCateid() + "' and topic_id='" + TOPIC.getAssettopicid() + "' and content_id='" + CONTENT.getContentid() + "'", null);
+        if (cursor.getCount() == 0) {
+
+            Gson gson = new Gson();
+            JsonElement jsonElement = gson.toJsonTree(
+                    CONTENT, new TypeToken<MyContent>() {
+                    }.getType());
+            ContentValues values = new ContentValues();
+            values.put("topic_content", jsonElement.toString());
+            values.put("category_id", TRAINING_ID.getCateid());
+            values.put("topic_id", TOPIC.getAssettopicid());
+            values.put("content_id", CONTENT.getContentid());
+            GlobalData.sdb.insert("topic_content", null, values);
+        }
+        cursor = GlobalData.sdb.rawQuery("select * from topic where" + " category_id='"
+                + TRAINING_ID.getCateid()
+                + "' and topic_id='" + TOPIC.getAssettopicid() + "'", null);
+        if (cursor.getCount() == 0) {
+            Gson gson1 = new Gson();
+            JsonElement jsonElement1 = gson1.toJsonTree(
+                    TOPIC, new TypeToken<MyTopic>() {
+                    }.getType());
+            ContentValues values = new ContentValues();
+            values.put("topic", jsonElement1.toString());
+            values.put("category_id", TRAINING_ID.getCateid());
+            values.put("topic_id", TOPIC.getAssettopicid());
+            GlobalData.sdb.insert("topic", null, values);
+        }
+//        else {
+//            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+//        }
+    }
+
+    public ContentFile getContentFile() {
+        if (CONTENT.getContent_files() == null) {
+            return null;
+        }
+        String language = this.getSharedPreferences("LANGUAGE", Context.MODE_PRIVATE).getString("DEFAULT", "en_us");
+
+        for (ContentFile file : CONTENT.getContent_files()) {
+            if (file.getLanguage_code().trim().equalsIgnoreCase(language.trim())) {
+                return file;
+            }
+        }
+        return CONTENT.getContent_files().get(0);
+    }
+
+    @SuppressLint("StaticFieldLeak")
+    private void downloadPDF(final ContentFile con) {
+        new AsyncTask<Void, Void, Void>() {
+            @Override
+            protected Void doInBackground(Void... voids) {
+                OutputStream output = null;
+                CipherOutputStream cos = null;
+                InputStream input = null;
+                try {
+                    int count;
+                    URL url = new URL(con.getFile_url());
+                    URLConnection conection = url.openConnection();
+                    conection.connect();
+                    int lenghtOfFile = conection.getContentLength();
+                    input = new BufferedInputStream(url.openStream(),
+                            8192);
+                    String fileName = Environment.getExternalStorageDirectory()
+                            + "/" + ".SUZUKI/PDF/" + CONTENT.getContentid() + "_" + CONTENT.getVersion() + "_" + SELECTED_CONTENT.getLanguage_code() + ".pdf";
+                    output = new FileOutputStream(fileName);
+
+                    SecretKeySpec sks = generateKey(encryptKey);
+                    // Create cipher
+                    Cipher cipher = Cipher.getInstance("AES");
+                    cipher.init(Cipher.ENCRYPT_MODE, sks);
+                    // Wrap the output stream
+                    cos = new CipherOutputStream(output, cipher);
+                    byte data[] = new byte[1024];
+                    long total = 0;
+
+                    while ((count = input.read(data)) != -1) {
+                        total += count;
+                        cos.write(data, 0, count);
+                    }
+                    cos.flush();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                } finally {
+                    try {
+                        cos.close();
+                        input.close();
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                return null;
+            }
+
+            @Override
+            protected void onPostExecute(Void aVoid) {
+                super.onPostExecute(aVoid);
+                File file = new File(Environment.getExternalStorageDirectory()
+                        + "/" + ".SUZUKI", "PDF/" + CONTENT.getContentid() + "_" + CONTENT.getVersion() + ".pdf");
+                if (file.exists()) {
+                    try {
+                        decrypt(file.toString(), "pdf", new Runnable() {
+                            @Override
+                            public void run() {
+                                pdfView.fromFile(decryptFile)
+                                        .onPageChange(PdfViewActivity.this)
+                                        .enableAnnotationRendering(true)
+                                        .onLoad(PdfViewActivity.this)
+                                        .scrollHandle(new DefaultScrollHandle(PdfViewActivity.this))
+                                        .spacing(10)
+                                        .onPageError(PdfViewActivity.this)
+                                        .pageFitPolicy(FitPolicy.WIDTH)
+                                        .load();
+                            }
+                        });
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        progressBar.setVisibility(View.GONE);
+                    }
+
+                } else {
+                    loadPdf(con);
+                }
+            }
+        }.execute();
+
+
+    }
+
+    public static SecretKeySpec generateKey(final String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        final MessageDigest digest = MessageDigest.getInstance(HASH_ALGORITHM);
+        byte[] bytes = password.getBytes("UTF-8");
+        digest.update(bytes, 0, bytes.length);
+        byte[] key = digest.digest();
+        SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
+        return secretKeySpec;
+    }
+
+    private void loadPdf(ContentFile contentFile) {
+        try {
+            pdfView.fromStream(new URL(contentFile.getFile_url()).openStream())
+                    .onPageChange(PdfViewActivity.this)
+                    .enableAnnotationRendering(true)
+                    .onLoad(PdfViewActivity.this)
+                    .scrollHandle(new DefaultScrollHandle(PdfViewActivity.this))
+                    .spacing(10)
+                    .onPageError(PdfViewActivity.this)
+                    .pageFitPolicy(FitPolicy.WIDTH)
+                    .load();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private boolean writeResponseBodyToDisk(ResponseBody body) {
+        try {
+            File futureStudioIconFile = new File(Environment.getExternalStorageDirectory()
+                    + "/" + ".SUZUKI", "PDF/" + CONTENT.getContentid() + "_" + CONTENT.getVersion() + ".pdf");
+            InputStream inputStream = null;
+            OutputStream outputStream = null;
+
+            try {
+                byte[] fileReader = new byte[4096];
+                long fileSize = body.contentLength();
+                long fileSizeDownloaded = 0;
+                inputStream = body.byteStream();
+                outputStream = new FileOutputStream(futureStudioIconFile);
+
+                while (true) {
+                    int read = inputStream.read(fileReader);
+                    if (read == -1) {
+                        break;
+                    }
+                    outputStream.write(fileReader, 0, read);
+                    fileSizeDownloaded += read;
+                }
+                outputStream.flush();
+                return true;
+            } catch (IOException e) {
+                return false;
+            } finally {
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+                if (outputStream != null) {
+                    outputStream.close();
+                }
+            }
+        } catch (IOException e) {
+            return false;
+        }
+    }
+
+    private void setupWindowAnimations() {
+        this.overridePendingTransition(R.anim.animation_enter,
+                R.anim.animation_leave);
+    }
+
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            this.overridePendingTransition(R.anim.animation_f_enter,
+                    R.anim.animation_f_leave);
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        getToTime();
+        this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+    private void getToTime() {
+
+        c = Calendar.getInstance();
+        System.out.println("toTime " + c.getTime());
+
+        df = new SimpleDateFormat("HH:mm:ss");
+        toTime = df.format(c.getTime());
+        Log.e("toTime", toTime);
+
+        finalTime = UtilService.getTimeInterval(this,df,fromTime,toTime);
+        if (StorePreference.getInstance(this).getBooleanValue(GlobalData.ISDSELOGIN))
+            sendHitCountToServer();
+
+    }
+
+    @Override
+    public void loadComplete(int nbPages) {
+        progressBar.setVisibility(View.GONE);
+    }
+
+    @Override
+    public void onPageChanged(int page, int pageCount) {
+        if (page + 1 == pageCount) {
+            if (!CONTENT.getStatus().trim().equalsIgnoreCase("2")) {
+                updateStatus("2");
+            }
+        } else {
+            if (!CONTENT.getStatus().trim().equalsIgnoreCase("1") && !CONTENT.getStatus().trim().equalsIgnoreCase("2")) {
+                updateStatus("1");
+            }
+        }
+    }
+
+    private void updateStatus(String status) {
+        CONTENT.setStatus(status);
+        if (new UtilService().isNetworkAvailable(PdfViewActivity.this)) {
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("contentid", CONTENT.getContentid());
+                map.put("assettopicid", CONTENT.getAssettopicid());
+                map.put("status", status);
+
+                restService.updateContentStaus(map).enqueue(new MyCallback<ErrorResponse>(status) {
+                    @Override
+                    public void onResponse(Call<ErrorResponse> call, Response<ErrorResponse> response) {
+                        if (response.body() != null && response.body().getStatus() == 200) {
+                            CONTENT.setStatus(ids);
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Call<ErrorResponse> call, Throwable t) {
+
+                    }
+                });
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public void onPageError(int page, Throwable t) {
+        progressBar.setVisibility(View.GONE);
+        GlobalData.showToast(this, "Error", Toast.LENGTH_SHORT).show();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+}

+ 431 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ProductExploreDetailsActivity.java

@@ -0,0 +1,431 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.AppCompatActivity;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.util.Patterns;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.MediaController;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.dbadapters.CommonDBHelper;
+import com.ttiglobal.inttilectgpchat.dbadapters.CustomerDetailsAdapter;
+import com.ttiglobal.inttilectgpchat.dbadapters.TableConstants;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.CommonMethods;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.GetAllCustomerDetailsResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.GetAllSalutationModel;
+import com.ttiglobal.inttilectgpchat.wrappers.SendAllCustomerData;
+import com.ttiglobal.inttilectgpchat.wrappers.SendAllExploreDetailsModel;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class ProductExploreDetailsActivity extends AppCompatActivity implements View.OnClickListener {
+    Context context;
+    private Button btn_get_started;
+    private List<String> prefixDetailsSpinnerArray;
+    Spinner spnPrefix;
+    DisplayMetrics dm;
+    MediaController media_Controller;
+    private LinearLayout llout_get_started;
+    private String ageRange = "";
+    private EditText edtFirstName, edtLastName, edtMobileNumber, edtEmail;
+    private TextView txtAgeFirst, txtAgeSecond, txtAgeThird, txtAgeFour, txtAgeFive;
+    ApiService restService;
+    ArrayAdapter<String> mGroupAdapter;
+    List<SendAllExploreDetailsModel> detailsModelList;
+    SendAllExploreDetailsModel detailsModel;
+    StorePreference storePreference;
+    boolean doubleBackToExitPressedOnce = false;
+    private TransparentProgressDialog progressDialog;
+    private LinearLayout whole_layout;
+    private String currentTime = "";
+
+    List<SendAllCustomerData> getAllOfflineData = new ArrayList<>();
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_product_explore_details);
+
+        initViews();
+        detailsModel = new SendAllExploreDetailsModel();
+
+        if (CommonMethods.isNetworkAvailable(this)) {
+            getAllSalutation();
+            sendOfflineDataToServer();
+        } else {
+            getLocal();
+        }
+    }
+
+    private void getLocal() {
+
+        SharedPreferences pref = Objects.requireNonNull(ProductExploreDetailsActivity.this).getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+        if (pref.getString("SALUTATION_" + storePreference.getStringValue(GlobalData.SALUTATION_MODEL), null) != null) {
+            Gson gson = new Gson();
+            prefixDetailsSpinnerArray = gson.fromJson(
+                    pref.getString("SALUTATION_" + storePreference.getStringValue(GlobalData.SALUTATION_MODEL), null),
+                    new TypeToken<List<String>>() {
+                    }.getType());
+            if (prefixDetailsSpinnerArray != null) {
+                mGroupAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_left, R.id.spinner_text, prefixDetailsSpinnerArray);
+                spnPrefix.setAdapter(mGroupAdapter);
+            }
+        } else {
+            Toast.makeText(ProductExploreDetailsActivity.this, "No data found", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void getAllSalutation() {
+        restService.getAllSaltuation().enqueue(new Callback<GetAllSalutationModel>() {
+            @Override
+            public void onResponse(Call<GetAllSalutationModel> call, Response<GetAllSalutationModel> response) {
+                if (response.body() != null) {
+                    if (response.body().getStatus() == 200) {
+                        SharedPreferences pref = Objects.requireNonNull(ProductExploreDetailsActivity.this).getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+                        SharedPreferences.Editor editor = pref.edit();
+                        prefixDetailsSpinnerArray = response.body().getData();
+                        if (prefixDetailsSpinnerArray.size() > 0) {
+                            Gson gson = new Gson();
+                            JsonElement jsonElement = gson.toJsonTree(
+                                    prefixDetailsSpinnerArray, new TypeToken<List<String>>() {
+                                    }.getType());
+                            editor.putString("SALUTATION_" + storePreference.getStringValue(GlobalData.SALUTATION_MODEL),
+                                    jsonElement.toString()).apply();
+
+                            mGroupAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_left, R.id.spinner_text, prefixDetailsSpinnerArray);
+                            spnPrefix.setAdapter(mGroupAdapter);
+                        } else {
+                            getLocal();
+                        }
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    } else {
+                        prefixDetailsSpinnerArray.add("-");
+                        mGroupAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_left, R.id.spinner_text, prefixDetailsSpinnerArray);
+                        spnPrefix.setAdapter(mGroupAdapter);
+                    }
+                }
+            }
+
+            @Override
+            public void onFailure(Call<GetAllSalutationModel> call, Throwable t) {
+                getLocal();
+            }
+        });
+    }
+
+    private void initViews() {
+        context = this;
+        spnPrefix = findViewById(R.id.spn_select_from);
+        prefixDetailsSpinnerArray = new ArrayList<>();
+        llout_get_started = findViewById(R.id.llout_get_started);
+        btn_get_started = findViewById(R.id.btn_get_started);
+        btn_get_started.setOnClickListener(this);
+        llout_get_started.setOnClickListener(this);
+        storePreference = new StorePreference(this);
+
+        edtEmail = findViewById(R.id.edtEmail);
+        edtFirstName = findViewById(R.id.edtFirstName);
+        edtLastName = findViewById(R.id.edt_last_name);
+        edtMobileNumber = findViewById(R.id.edtMobNumer);
+
+        edtMobileNumber.setShowSoftInputOnFocus(false);
+        edtEmail.setShowSoftInputOnFocus(false);
+        edtFirstName.setShowSoftInputOnFocus(false);
+        edtLastName.setShowSoftInputOnFocus(false);
+
+        txtAgeFirst = findViewById(R.id.txtAgeFirst);
+        txtAgeSecond = findViewById(R.id.txtAgeSecond);
+        txtAgeThird = findViewById(R.id.txtAgeThird);
+        txtAgeFour = findViewById(R.id.txtAgeFour);
+        txtAgeFive = findViewById(R.id.txtAgeFive);
+
+        txtAgeFive.setOnClickListener(this);
+        txtAgeFour.setOnClickListener(this);
+        txtAgeThird.setOnClickListener(this);
+        txtAgeSecond.setOnClickListener(this);
+        txtAgeFirst.setOnClickListener(this);
+        progressDialog = new TransparentProgressDialog(ProductExploreDetailsActivity.this);
+        whole_layout = findViewById(R.id.whole_lin_layout);
+        whole_layout.setOnClickListener(this);
+
+        restService = ((MainApplication) getApplication()).getClient();
+    }
+
+    @Override
+    public void onBackPressed() {
+
+        if (doubleBackToExitPressedOnce) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+                finishAffinity();
+            } else {
+                System.exit(0);
+                finish();
+            }
+            return;
+        }
+
+        this.doubleBackToExitPressedOnce = true;
+        Toast.makeText(this, "Please click again to exit", Toast.LENGTH_SHORT).show();
+
+        new Handler().postDelayed(new Runnable() {
+
+            @Override
+            public void run() {
+                doubleBackToExitPressedOnce = false;
+            }
+        }, 2000);
+
+    }
+
+    private void loadVideo() {
+
+        media_Controller = new MediaController(this);
+        dm = new DisplayMetrics();
+        this.getWindowManager().getDefaultDisplay().getMetrics(dm);
+        int height = dm.heightPixels;
+        int width = dm.widthPixels;
+    }
+
+    @Override
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case R.id.llout_get_started:
+                currentTime = String.valueOf(System.currentTimeMillis());
+                currentTime = GlobalData.user.getData().getEmp_code() + currentTime;
+                storePreference.setString(GlobalData.CURRENTTIME, currentTime);
+                sendOfflineDataToServer();
+               // startActivity(new Intent(ProductExploreDetailsActivity.this, ProductHomeActivity.class));
+                fieldValidation();
+                break;
+            case R.id.whole_lin_layout:
+                hideKeyboard(ProductExploreDetailsActivity.this);
+                break;
+            case R.id.btn_get_started:
+                currentTime = String.valueOf(System.currentTimeMillis());
+                currentTime = GlobalData.user.getData().getEmp_code() + currentTime;
+                storePreference.setString(GlobalData.CURRENTTIME, currentTime);
+                sendOfflineDataToServer();
+                fieldValidation();
+                break;
+            case R.id.txtAgeFirst:
+                clickSelectedAgeRange(txtAgeFirst, txtAgeSecond, txtAgeThird, txtAgeFour, txtAgeFive);
+                ageRange = txtAgeFirst.getText().toString();
+                break;
+            case R.id.txtAgeSecond:
+                clickSelectedAgeRange(txtAgeSecond, txtAgeFirst, txtAgeThird, txtAgeFour, txtAgeFive);
+                ageRange = txtAgeSecond.getText().toString();
+                break;
+            case R.id.txtAgeThird:
+                clickSelectedAgeRange(txtAgeThird, txtAgeFirst, txtAgeSecond, txtAgeFour, txtAgeFive);
+                ageRange = txtAgeThird.getText().toString();
+                break;
+            case R.id.txtAgeFour:
+                clickSelectedAgeRange(txtAgeFour, txtAgeFirst, txtAgeSecond, txtAgeThird, txtAgeFive);
+                ageRange = txtAgeFour.getText().toString();
+                break;
+            case R.id.txtAgeFive:
+                clickSelectedAgeRange(txtAgeFive, txtAgeFirst, txtAgeSecond, txtAgeThird, txtAgeFour);
+                ageRange = txtAgeFive.getText().toString();
+                break;
+            default:
+        }
+    }
+
+    private void hideKeyboard(Activity activity) {
+        InputMethodManager inputMethodManager =
+                (InputMethodManager) activity.getSystemService(
+                        Activity.INPUT_METHOD_SERVICE);
+        inputMethodManager.hideSoftInputFromWindow(
+                activity.getCurrentFocus().getWindowToken(), 0);
+    }
+
+    private void fieldValidation() {
+        if (edtFirstName.getText().toString().equalsIgnoreCase("")) {
+            CommonMethods.showToast(context, "Enter your name.").show();
+        } else if (edtMobileNumber.getText().toString().equalsIgnoreCase("")) {
+            CommonMethods.showToast(context, "Enter your mobile number.").show();
+        } else if (!Patterns.PHONE.matcher(edtMobileNumber.getText().toString()).matches()) {
+            CommonMethods.showToast(context, "Enter your valid mobile number.").show();
+        } else if (edtMobileNumber.getText().length() < 10) {
+            CommonMethods.showToast(context, "Enter your valid mobile number.").show();
+        } else if (ageRange.equalsIgnoreCase("")) {
+            CommonMethods.showToast(context, "Select age range.").show();
+        } else {
+            storePreference.setString(GlobalData.PRODUCT_NAME, edtFirstName.getText().toString().trim());
+            if (CommonMethods.isNetworkAvailable(this)) {
+                sendOfflineDataToServer();
+                sendDetailsToServer();
+            } else {
+                insertDetailsToServer();
+            }
+        }
+    }
+
+    private void sendOfflineDataToServer() {
+        SendAllExploreDetailsModel detailsModel = new SendAllExploreDetailsModel();
+        CustomerDetailsAdapter customerDetailsAdapter = new CustomerDetailsAdapter(ProductExploreDetailsActivity.this);
+        getAllOfflineData = customerDetailsAdapter.getAllDataFromDB();
+        List<SendAllCustomerData> allCustomerData = new ArrayList<>();
+        if (getAllOfflineData != null && getAllOfflineData.size() > 0) {
+            detailsModel.setEmp_code(GlobalData.user.getData().getEmp_code());
+            detailsModel.setSmpin(GlobalData.user.getData().getSmpin());
+
+            for (int i = 0; i < getAllOfflineData.size(); i++) {
+                Log.e("Name", getAllOfflineData.get(i).getFirstname());
+
+                SendAllCustomerData customerData = new SendAllCustomerData();
+                customerData.setSalutation(getAllOfflineData.get(i).getSalutation());
+                customerData.setAge(getAllOfflineData.get(i).getAge());
+                customerData.setEmail(getAllOfflineData.get(i).getEmail());
+                customerData.setFirstname(getAllOfflineData.get(i).getFirstname());
+                customerData.setLastname(getAllOfflineData.get(i).getLastname());
+                customerData.setMobile(getAllOfflineData.get(i).getMobile());
+                customerData.setUid(getAllOfflineData.get(i).getUid());
+                allCustomerData.add(customerData);
+
+            }
+            if (allCustomerData.size() > 0)
+                detailsModel.setCustomerData(allCustomerData);
+            restService.sendAllExploreDetails(detailsModel).enqueue(new Callback<GetAllCustomerDetailsResponse>() {
+                @Override
+                public void onResponse(Call<GetAllCustomerDetailsResponse> call, Response<GetAllCustomerDetailsResponse> response) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    if (response.body() != null) {
+                        if (response.body().getStatus() == 200) {
+                            Log.e("Message", "Local Value Updated");
+                            CommonDBHelper.getInstance(getApplicationContext()).deleteTableValues(TableConstants.TABLE_CUSTOMER_DETAILS);
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        } else {
+                            CommonMethods.showToast(context, response.body().getMessage()).show();
+                        }
+                    }
+                }
+
+                @Override
+                public void onFailure(Call<GetAllCustomerDetailsResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                }
+            });
+        }
+    }
+
+    private void insertDetailsToServer() {
+        CustomerDetailsAdapter customerDetailsAdapter = new CustomerDetailsAdapter(ProductExploreDetailsActivity.this);
+        if (!CustomerDetailsAdapter.checkRecordExists(edtMobileNumber.getText().toString())) {
+            customerDetailsAdapter.insertLoginDetails(currentTime, spnPrefix.getSelectedItem().toString(), edtFirstName.getText().toString(), edtMobileNumber.getText().toString(), edtEmail.getText().toString(), ageRange);
+            startActivity(new Intent(ProductExploreDetailsActivity.this, ProductHomeActivity.class));
+        } else {
+            startActivity(new Intent(ProductExploreDetailsActivity.this, ProductHomeActivity.class));
+        }
+    }
+
+
+    private void sendDetailsToServer() {
+        progressDialog.show();
+        restService.sendAllExploreDetails(buildConfigData()).enqueue(new Callback<GetAllCustomerDetailsResponse>() {
+            @Override
+            public void onResponse(Call<GetAllCustomerDetailsResponse> call, Response<GetAllCustomerDetailsResponse> response) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+                if (response.body() != null) {
+                    if (response.body().getStatus() == 200) {
+                        Log.e("Message", response.body().getMessage());
+                        storePreference.setString(GlobalData.DETAIL_NAME, edtFirstName.getText().toString());
+                        storePreference.setString(GlobalData.DETAIL_EMAIL, edtEmail.getText().toString());
+                        storePreference.setString(GlobalData.DETAIL_MOBILE, edtMobileNumber.getText().toString());
+                        startActivity(new Intent(ProductExploreDetailsActivity.this, ProductHomeActivity.class));
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                    } else {
+                        CommonMethods.showToast(context, response.body().getMessage()).show();
+                    }
+                }
+            }
+
+            @Override
+            public void onFailure(Call<GetAllCustomerDetailsResponse> call, Throwable t) {
+                if (progressDialog != null && progressDialog.isShowing()) {
+                    progressDialog.dismiss();
+                }
+            }
+        });
+
+    }
+
+    private SendAllExploreDetailsModel buildConfigData() {
+        SendAllExploreDetailsModel detailsModel = new SendAllExploreDetailsModel();
+        detailsModel.setEmp_code(GlobalData.user.getData().getEmp_code());
+        detailsModel.setSmpin(GlobalData.user.getData().getSmpin());
+        List<SendAllCustomerData> allCustomerData = new ArrayList<>();
+        SendAllCustomerData customerData = new SendAllCustomerData();
+        customerData.setSalutation(spnPrefix.getSelectedItem().toString());
+        customerData.setAge(ageRange);
+        customerData.setEmail(edtEmail.getText().toString());
+        customerData.setFirstname(edtFirstName.getText().toString());
+        customerData.setLastname(edtLastName.getText().toString());
+        customerData.setMobile(edtMobileNumber.getText().toString());
+        customerData.setUid(currentTime);
+        allCustomerData.add(customerData);
+        detailsModel.setCustomerData(allCustomerData);
+        return detailsModel;
+    }
+
+    private void clickSelectedAgeRange(TextView txtAgeFirst, TextView txtAgeSecond, TextView txtAgeThird, TextView txtAgeFour, TextView txtAgeFive) {
+        txtAgeFirst.setBackground(ContextCompat.getDrawable(context, R.drawable.edt_border));
+        txtAgeSecond.setBackground(ContextCompat.getDrawable(context, R.drawable.edt_unselected_border));
+        txtAgeThird.setBackground(ContextCompat.getDrawable(context, R.drawable.edt_unselected_border));
+        txtAgeFour.setBackground(ContextCompat.getDrawable(context, R.drawable.edt_unselected_border));
+        txtAgeFive.setBackground(ContextCompat.getDrawable(context, R.drawable.edt_unselected_border));
+    }
+}

+ 304 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ProductExplorerActivity.java

@@ -0,0 +1,304 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.swipe.OnSwipeItemSelectedListener;
+import com.ttiglobal.inttilectgpchat.swipe.SwipeItem;
+import com.ttiglobal.inttilectgpchat.swipe.SwipeSelector;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.CommonMethods;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.GetAllExploreImageList;
+import com.ttiglobal.inttilectgpchat.wrappers.GetAllExploreModel;
+
+import java.util.List;
+import java.util.Objects;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class ProductExplorerActivity extends AppCompatActivity implements View.OnClickListener, OnSwipeItemSelectedListener {
+
+    Button btnNext;
+    SwipeSelector swipeSelector;
+    StorePreference storePreference;
+    String selectedModel = "1";
+    GetAllExploreModel getAllExploreModel;
+    ApiService restService;
+    private TextView txtModelName;
+    ProgressBar progressBar;
+    ImageView img_home, img_close, img_broucher, img_rating;
+    ImageView layout1;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+
+        restService = ((MainApplication) getApplication()).getClient();
+        initViews();
+        if (GlobalData.user.getData() != null)
+            if (GlobalData.user.getData().getRole().equalsIgnoreCase("16")) {
+                img_home.setVisibility(View.GONE);
+                layout1.setVisibility(View.GONE);
+                img_rating.setVisibility(View.VISIBLE);
+                img_broucher.setVisibility(View.VISIBLE);
+                img_close.setVisibility(View.VISIBLE);
+            } else {
+                img_home.setVisibility(View.VISIBLE);
+                layout1.setVisibility(View.VISIBLE);
+                img_rating.setVisibility(View.GONE);
+                img_broucher.setVisibility(View.GONE);
+                img_close.setVisibility(View.GONE);
+            }
+    }
+
+    @Override
+    public void onBackPressed() {
+        if (GlobalData.user.getData().getRole().equalsIgnoreCase("16")) {
+            startActivity(new Intent(ProductExplorerActivity.this, ProductExploreDetailsActivity.class));
+            finish();
+        } else {
+            super.onBackPressed();
+        }
+    }
+
+    private void initViews() {
+
+        btnNext = findViewById(R.id.btnNext);
+        btnNext.setOnClickListener(this);
+        storePreference = new StorePreference(this);
+        storePreference.setString(GlobalData.SELECTED_MODEL, selectedModel);
+        txtModelName = findViewById(R.id.txtModelName);
+        progressBar = findViewById(R.id.progress);
+        progressBar.setVisibility(View.GONE);
+
+        getAllExploreModel = new GetAllExploreModel();
+
+        swipeSelector = findViewById(R.id.swipeSelector);
+        swipeSelector.setOnItemSelectedListener(this);
+
+        img_home = findViewById(R.id.img_home);
+        img_home.setOnClickListener(this);
+        img_close = findViewById(R.id.img_close);
+        img_close.setOnClickListener(this);
+        img_broucher = findViewById(R.id.imgBroucher);
+        img_broucher.setOnClickListener(this);
+
+        img_rating = findViewById(R.id.img_rating);
+        img_rating.setOnClickListener(this);
+
+        layout1 = findViewById(R.id.fabEnquiry);
+        layout1.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(ProductExplorerActivity.this, SuzukiEnquiryForm.class));
+            }
+        });
+
+        if (CommonMethods.isNetworkAvailable(this)) {
+            getAllExploreImageDataList();
+        } else {
+            checkLocalExplorerFile();
+        }
+    }
+
+    private void getAllExploreImageDataList() {
+        progressBar.setVisibility(View.VISIBLE);
+        restService.getAllExploreImage().enqueue(new Callback<GetAllExploreModel>() {
+            @Override
+            public void onResponse(@NonNull Call<GetAllExploreModel> call, @NonNull Response<GetAllExploreModel> response) {
+                progressBar.setVisibility(View.GONE);
+                SharedPreferences pref = getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+                SharedPreferences.Editor editor = pref.edit();
+
+                if (response.body() != null && response.body().getStatus() == 200) {
+                    List<GetAllExploreImageList> data = response.body().getData();
+                    if (data != null && data.size() > 0) {
+                        Gson gson = new Gson();
+                        JsonElement jsonElement = gson.toJsonTree(
+                                data, new TypeToken<List<GetAllExploreImageList>>() {
+                                }.getType());
+                        editor.putString("EXPLORE_DATA", jsonElement.toString()).apply();
+
+                        SwipeItem[] swipeItems = new SwipeItem[data.size()];
+                        for (int i = 0; i < data.size(); i++) {
+                            storePreference.setString(GlobalData.SELECTED_MODEL_NAME, data.get(0).getModelName());
+                            txtModelName.setText(data.get(0).getModelName());
+                            SwipeItem item = new SwipeItem(data.get(i).getModelName(), data.get(i).getModelImageUrl(), data.get(i).getModelId());
+                            swipeItems[i] = item;
+                        }
+                        swipeSelector.setItems(swipeItems);
+                    } else {
+                        checkLocalExplorerFile();
+                    }
+                } else if (response.body() != null && response.body().getStatus() == 401) {
+                    GlobalData.canLogout = true;
+                    finish();
+                } else if (response.errorBody() != null) {
+                    Gson gson = new Gson();
+                    ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                    GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                    if (message.getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    }
+                } else {
+                    checkLocalExplorerFile();
+                }
+            }
+
+            @Override
+            public void onFailure(Call<GetAllExploreModel> call, Throwable t) {
+                progressBar.setVisibility(View.GONE);
+                checkLocalExplorerFile();
+            }
+        });
+    }
+
+    private void checkLocalExplorerFile() {
+        SharedPreferences pref = getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+        if (pref.getString("EXPLORE_DATA", null) != null) {
+            Gson gson = new Gson();
+            List<GetAllExploreImageList> data = gson.fromJson(
+                    pref.getString("EXPLORE_DATA", null),
+                    new TypeToken<List<GetAllExploreImageList>>() {
+                    }.getType());
+            SwipeItem[] swipeItems = new SwipeItem[Objects.requireNonNull(data).size()];
+            for (int i = 0; i < data.size(); i++) {
+                storePreference.setString(GlobalData.SELECTED_MODEL_NAME, data.get(0).getModelName());
+                txtModelName.setText(data.get(0).getModelName());
+                SwipeItem item = new SwipeItem(data.get(i).getModelName(), data.get(i).getModelImageUrl(), data.get(i).getModelId());
+                swipeItems[i] = item;
+            }
+            swipeSelector.setItems(swipeItems);
+        } else {
+            Toast.makeText(this, "No data found", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void openCloseAlertBox() {
+
+        final Dialog aDialog = new Dialog(this);
+        aDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+        aDialog.setContentView(R.layout.popup_alert_close);
+        aDialog.setCancelable(true);
+        TextView aAlertMessage = aDialog.findViewById(R.id.txt_alert_message);
+        aAlertMessage.setText("Dear " + storePreference.getStringValue(GlobalData.PRODUCT_NAME));
+        aDialog.show();
+        Button btnYes = aDialog.findViewById(R.id.btn_yes);
+        Button btnNo = aDialog.findViewById(R.id.btn_no);
+        btnYes.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+//                startActivity(new Intent(SuzukiEnquiryForm.this, ProductFeedbackFormActivity.class));
+                openFeedbackAlertBox();
+                aDialog.dismiss();
+            }
+        });
+        btnNo.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View arg0) {
+                // TODO Auto-generated method stub
+                aDialog.dismiss();
+            }
+
+        });
+
+
+    }
+
+    private void openFeedbackAlertBox() {
+
+        final Dialog aDialog = new Dialog(this);
+        aDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+        aDialog.setContentView(R.layout.popup_alert_feedback);
+        aDialog.setCancelable(true);
+        TextView aAlertMessage = aDialog.findViewById(R.id.txt_alert_message);
+        aAlertMessage.setText("Dear " + storePreference.getStringValue(GlobalData.PRODUCT_NAME));
+        aDialog.show();
+
+        TextView txtSkip;
+        ImageView imgClose;
+        imgClose = aDialog.findViewById(R.id.img_close);
+        txtSkip = aDialog.findViewById(R.id.txtSkip);
+        imgClose.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                aDialog.dismiss();
+            }
+        });
+        txtSkip.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                aDialog.dismiss();
+                startActivity(new Intent(ProductExplorerActivity.this, ProductExploreDetailsActivity.class));
+                finish();
+            }
+        });
+
+        Button btnYes = aDialog.findViewById(R.id.btn_yes);
+        btnYes.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(ProductExplorerActivity.this, ProductFeedbackFormActivity.class));
+                aDialog.dismiss();
+            }
+        });
+    }
+
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()) {
+            case R.id.btnNext:
+                startActivity(new Intent(this, MainActivity.class));
+                break;
+            case R.id.img_close:
+                openCloseAlertBox();
+                break;
+            case R.id.imgBroucher:
+                startActivity(new Intent(this, SuzukiEnquiryForm.class));
+                break;
+            case R.id.img_rating:
+                startActivity(new Intent(this, ProductFeedbackFormActivity.class));
+                break;
+            case R.id.img_home:
+                onBackPressed();
+                break;
+            default:
+        }
+    }
+
+    @Override
+    public void onItemSelected(SwipeItem item) {
+        int modelId = Integer.parseInt(item.getDescription());
+        Log.e("ModelId", String.valueOf(modelId));
+        storePreference.setString(GlobalData.SELECTED_MODEL, item.getDescription());
+        txtModelName.setText(item.getValue());
+        storePreference.setString(GlobalData.SELECTED_MODEL_NAME, item.getValue());
+    }
+}

+ 341 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ProductFeedbackFormActivity.java

@@ -0,0 +1,341 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import com.ttiglobal.inttilectgpchat.adapter.ProductFeedbackListAdapter;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.CommonMethods;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.wrappers.AnswerResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.CustomerFeedbackModel;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.FeedbackAnswerArrayModel;
+import com.ttiglobal.inttilectgpchat.wrappers.FeedbackDataList;
+import com.ttiglobal.inttilectgpchat.wrappers.ProductFeedback;
+import com.ttiglobal.inttilectgpchat.wrappers.ProductFeedbackResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.SingleTon;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class ProductFeedbackFormActivity extends AppCompatActivity
+        implements View.OnClickListener {
+    ImageButton backButton;
+    Button submitBtn;
+    ImageView imgBroucher, img_close;
+    EmptyStateRecyclerView rcv_feedback_form;
+    ApiService restService;
+    ProductFeedbackListAdapter adapter;
+    ArrayList<ProductFeedback> FEEDBACK_QUESTIONS = new ArrayList<>();
+    LinearLayoutManager linearLayoutManager;
+    private TransparentProgressDialog progressDialog;
+    StorePreference storePreference;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_product_feedback_form);
+
+        backButton = findViewById(R.id.backButton);
+        backButton.setOnClickListener(this);
+        imgBroucher = findViewById(R.id.imgBroucher);
+        imgBroucher.setOnClickListener(this);
+        submitBtn = findViewById(R.id.submitButton);
+        submitBtn.setOnClickListener(this);
+        img_close = findViewById(R.id.img_close);
+        img_close.setOnClickListener(this);
+
+        storePreference = new StorePreference(this);
+        restService = ((MainApplication) getApplication()).getClient();
+        rcv_feedback_form = findViewById(R.id.surveyListView);
+        rcv_feedback_form.setHasFixedSize(true);
+        rcv_feedback_form.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new LinearLayoutManager(getBaseContext());
+        rcv_feedback_form.setLayoutManager(linearLayoutManager);
+        if (CommonMethods.isNetworkAvailable(this)) {
+            getAllFeedbackQuestions();
+            getAllOfflineAnswerSendToServer();
+
+        } else {
+            getLocal();
+        }
+    }
+
+    private void getLocal() {
+        SharedPreferences pref = Objects.requireNonNull(ProductFeedbackFormActivity.this).getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+        if (pref.getString("FEEDBACK_QUESTIONS_" + storePreference.getStringValue(GlobalData.FEEDBACK_MODEL), null) != null) {
+            Gson gson = new Gson();
+            FEEDBACK_QUESTIONS = gson.fromJson(
+                    pref.getString("FEEDBACK_QUESTIONS_" + storePreference.getStringValue(GlobalData.FEEDBACK_MODEL), null),
+                    new TypeToken<ArrayList<ProductFeedback>>() {
+                    }.getType());
+            if (FEEDBACK_QUESTIONS != null) {
+                adapter = new ProductFeedbackListAdapter(ProductFeedbackFormActivity.this, FEEDBACK_QUESTIONS);
+                rcv_feedback_form.setAdapter(adapter);
+            }
+        } else {
+            Toast.makeText(ProductFeedbackFormActivity.this, "No data found", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void getAllFeedbackQuestions() {
+        restService.getAllFeedbackData().enqueue(new Callback<ProductFeedbackResponse>() {
+            @Override
+            public void onResponse(Call<ProductFeedbackResponse> call, Response<ProductFeedbackResponse> response) {
+                if (response.body() != null && response.body().getStatus() == 200) {
+                    SharedPreferences pref = Objects.requireNonNull(ProductFeedbackFormActivity.this).getSharedPreferences("PRODUCT_MODULE", Context.MODE_PRIVATE);
+                    SharedPreferences.Editor editor = pref.edit();
+                    if (response.body().getData() != null && response.body().getTotal() > 0) {
+                        FEEDBACK_QUESTIONS = response.body().getData();
+
+                        Gson gson = new Gson();
+                        JsonElement jsonElement = gson.toJsonTree(
+                                FEEDBACK_QUESTIONS, new TypeToken<ArrayList<ProductFeedback>>() {
+                                }.getType());
+                        editor.putString("FEEDBACK_QUESTIONS_" + storePreference.getStringValue(GlobalData.FEEDBACK_MODEL),
+                                jsonElement.toString()).apply();
+
+                        adapter = new ProductFeedbackListAdapter(ProductFeedbackFormActivity.this, FEEDBACK_QUESTIONS);
+                        rcv_feedback_form.setAdapter(adapter);
+                    } else {
+                        GlobalData.showToast(getBaseContext(), "No data found.", Toast.LENGTH_SHORT).show();
+                    }
+                } else if (response.body() != null && response.body().getStatus() == 401) {
+                    CommonMethods.showToast(ProductFeedbackFormActivity.this, response.body().getMessage()).show();
+                } else if (response.body() != null) {
+                    GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                } else if (response.errorBody() != null) {
+                    Gson gson = new Gson();
+                    ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                    GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                }
+            }
+
+            @Override
+            public void onFailure(Call<ProductFeedbackResponse> call, Throwable t) {
+                GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+            }
+        });
+    }
+
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+    }
+
+    private void onSubmitAnswer() {
+        if (ProductFeedbackListAdapter.feedbackAnsArr != null && ProductFeedbackListAdapter.feedbackAnsArr.size() > 0) {
+
+            progressDialog = new TransparentProgressDialog(ProductFeedbackFormActivity.this);
+            progressDialog.show();
+
+            restService.sendFeedBack(buildConfigData()).enqueue(new Callback<AnswerResponse>() {
+                @Override
+                public void onResponse(Call<AnswerResponse> call, Response<AnswerResponse> response) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    if (response.body() != null && response.body().getStatus() == 200) {
+
+                        CommonMethods.showToast(ProductFeedbackFormActivity.this, response.body().getMessage()).show();
+                        startActivity(new Intent(ProductFeedbackFormActivity.this, ProductExplorerActivity.class));
+                        finish();
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        CommonMethods.showToast(ProductFeedbackFormActivity.this, response.body().getMessage()).show();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                    }
+                }
+
+                @Override
+                public void onFailure(Call<AnswerResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Kindly give atleast one feedback!", Toast.LENGTH_SHORT).show();
+        }
+
+    }
+
+    private CustomerFeedbackModel buildConfigData() {
+        CustomerFeedbackModel customerFeedbackModel = new CustomerFeedbackModel();
+        customerFeedbackModel.setSmpin(GlobalData.user.getData().getSmpin());
+        customerFeedbackModel.setEmpCode(GlobalData.user.getData().getEmp_code());
+        FeedbackDataList feedbackDataLists = new FeedbackDataList();
+        List<FeedbackDataList> feedbackDataListList = new ArrayList<>();
+        List<FeedbackAnswerArrayModel> feedbackDataList = ProductFeedbackListAdapter.feedbackAnsArr;
+        FeedbackAnswerArrayModel answerArrayModel;
+        List<FeedbackAnswerArrayModel> answerArrayModelList = new ArrayList<>();
+        if (feedbackDataList.size() > 0) {
+            for (int i = 0; i < feedbackDataList.size(); i++) {
+                answerArrayModel = new FeedbackAnswerArrayModel();
+                answerArrayModel.setQid(feedbackDataList.get(i).getQid());
+                answerArrayModel.setSurveyRating(feedbackDataList.get(i).getSurveyRating());
+                answerArrayModelList.add(answerArrayModel);
+            }
+        }
+        feedbackDataLists.setUid(storePreference.getStringValue(GlobalData.CURRENTTIME));
+        feedbackDataLists.setFeedbackAnsArr(answerArrayModelList);
+        feedbackDataListList.add(feedbackDataLists);
+        customerFeedbackModel.setCustomerData(feedbackDataListList);
+        return customerFeedbackModel;
+    }
+
+    private void openAlertBox() {
+
+        final Dialog aDialog = new Dialog(this);
+        aDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+        aDialog.setContentView(R.layout.popup_alert_close);
+        aDialog.setCancelable(true);
+        TextView aAlertMessage = aDialog.findViewById(R.id.txt_alert_message);
+        aAlertMessage.setText("Dear " + storePreference.getStringValue(GlobalData.PRODUCT_NAME));
+        aDialog.show();
+        Button btnYes = aDialog.findViewById(R.id.btn_yes);
+        Button btnNo = aDialog.findViewById(R.id.btn_no);
+        btnYes.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(ProductFeedbackFormActivity.this, ProductExploreDetailsActivity.class));
+                finish();
+                aDialog.dismiss();
+            }
+        });
+        btnNo.setOnClickListener(new View.OnClickListener() {
+
+            @Override
+            public void onClick(View arg0) {
+                // TODO Auto-generated method stub
+                aDialog.dismiss();
+            }
+
+        });
+
+    }
+
+    @Override
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case R.id.backButton:
+                onBackPressed();
+                break;
+            case R.id.imgBroucher:
+                startActivity(new Intent(ProductFeedbackFormActivity.this, SuzukiEnquiryForm.class));
+                finish();
+                break;
+            case R.id.submitButton:
+                if (CommonMethods.isNetworkAvailable(this)) {
+                    getAllOfflineAnswerSendToServer();
+                    onSubmitAnswer();
+                } else {
+                    onSubmitLocalAnswer();
+                }
+                break;
+            case R.id.img_close:
+                openAlertBox();
+                break;
+            default:
+        }
+    }
+
+    private void getAllOfflineAnswerSendToServer() {
+        CustomerFeedbackModel customerFeedbackModel = new CustomerFeedbackModel();
+        if (SingleTon.getInstance().feedbackModel.getCustomerData() != null && SingleTon.getInstance().feedbackModel.getCustomerData().size() > 0) {
+            customerFeedbackModel = SingleTon.getInstance().feedbackModel;
+        }
+        if (customerFeedbackModel.getCustomerData() != null && customerFeedbackModel.getCustomerData().size() > 0) {
+            restService.sendFeedBack(customerFeedbackModel).enqueue(new Callback<AnswerResponse>() {
+                @Override
+                public void onResponse(Call<AnswerResponse> call, Response<AnswerResponse> response) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        SingleTon.getInstance().feedbackModel = new CustomerFeedbackModel();
+                        CommonMethods.showToast(ProductFeedbackFormActivity.this, response.body().getMessage()).show();
+                        startActivity(new Intent(ProductFeedbackFormActivity.this, ProductExplorerActivity.class));
+                        finish();
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        CommonMethods.showToast(ProductFeedbackFormActivity.this, response.body().getMessage()).show();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                    }
+                }
+
+                @Override
+                public void onFailure(Call<AnswerResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+
+        }
+    }
+
+    private void onSubmitLocalAnswer() {
+        CustomerFeedbackModel customerFeedbackModel = new CustomerFeedbackModel();
+        customerFeedbackModel.setSmpin(GlobalData.user.getData().getSmpin());
+        customerFeedbackModel.setEmpCode(GlobalData.user.getData().getEmp_code());
+        FeedbackDataList feedbackDataLists = new FeedbackDataList();
+        List<FeedbackAnswerArrayModel> feedbackDataList = ProductFeedbackListAdapter.feedbackAnsArr;
+        FeedbackAnswerArrayModel answerArrayModel;
+        List<FeedbackAnswerArrayModel> answerArrayModelList = new ArrayList<>();
+        if (feedbackDataList.size() > 0) {
+            for (int i = 0; i < feedbackDataList.size(); i++) {
+                answerArrayModel = new FeedbackAnswerArrayModel();
+                answerArrayModel.setQid(feedbackDataList.get(i).getQid());
+                answerArrayModel.setSurveyRating(feedbackDataList.get(i).getSurveyRating());
+                answerArrayModelList.add(answerArrayModel);
+            }
+        }
+        feedbackDataLists.setUid(storePreference.getStringValue(GlobalData.CURRENTTIME));
+        feedbackDataLists.setFeedbackAnsArr(answerArrayModelList);
+        SingleTon.getInstance().feedbackDataLists.add(feedbackDataLists);
+        customerFeedbackModel.setCustomerData(SingleTon.getInstance().feedbackDataLists);
+        SingleTon.getInstance().feedbackModel = customerFeedbackModel;
+        Log.e("Singleton", SingleTon.getInstance().feedbackModel.getEmpCode());
+        startActivity(new Intent(ProductFeedbackFormActivity.this, ProductExplorerActivity.class));
+        finish();
+    }
+}

+ 46 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ProductHomeActivity.java

@@ -0,0 +1,46 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import android.widget.TextView;
+
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+
+public class ProductHomeActivity extends AppCompatActivity {
+    Handler handler;
+    TextView txtFname;
+    private StorePreference storePreference;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_product_home);
+        initViews();
+    }
+
+    private void initViews() {
+
+        storePreference = new StorePreference(this);
+        handler = new Handler();
+        txtFname = findViewById(R.id.firstname);
+        String upperString = "";
+        if (storePreference.getStringValue(GlobalData.PRODUCT_NAME) != null || !storePreference.getStringValue(GlobalData.PRODUCT_NAME).equalsIgnoreCase(""))
+        txtFname.setText(storePreference.getStringValue(GlobalData.PRODUCT_NAME));
+
+        handler.postDelayed(new Runnable() {
+
+            @Override
+            public void run() {
+                startExploreMoreActivity();
+            }
+        }, 3000);
+    }
+
+    private void startExploreMoreActivity() {
+        startActivity(new Intent(ProductHomeActivity.this, ProductExplorerActivity.class));
+        finish();
+    }
+}

+ 165 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemPointsCategoryActivity.java

@@ -0,0 +1,165 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.RedeemPointListAdapter;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemCategory;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemCategoryListResponse;
+import com.tylersuehr.esr.EmptyStateRecyclerView;
+import com.tylersuehr.esr.TextStateDisplay;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class RedeemPointsCategoryActivity extends AppCompatActivity {
+    private EmptyStateRecyclerView redeemList;
+    RedeemPointListAdapter adapter;
+    TransparentProgressDialog progressDialog;
+    ApiService restService;
+    RedeemCategory Categories = new RedeemCategory();
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_redeem);
+        restService = ((MainApplication) getApplication()).getClient();
+        redeemList = findViewById(R.id.redeemList);
+        redeemList.setHasFixedSize(true);
+        redeemList.setItemAnimator(new SlideInLeftAnimator());
+        StaggeredGridLayoutManager gridLayoutManager =
+                new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
+        redeemList.setLayoutManager(gridLayoutManager);
+        redeemList.setStateDisplay(EmptyStateRecyclerView.STATE_EMPTY,
+                new TextStateDisplay(this, "No data available", ""));
+        redeemList.post(new Runnable() {
+            @Override
+            public void run() {
+               //startActivity(new Intent(RedeemPointsCategoryActivity.this, RedeemProductListActivity.class));
+                getCategoryList(true);
+            }
+        });
+
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+    }
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+    private void getCategoryList(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(RedeemPointsCategoryActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(RedeemPointsCategoryActivity.this);
+                progressDialog.show();
+               // progressBar.setVisibility(View.GONE);
+            } else {
+               // progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getRedeemCategoryList().enqueue(new Callback<RedeemCategoryListResponse>() {
+                @Override
+                public void onResponse(Call<RedeemCategoryListResponse> call, Response<RedeemCategoryListResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                 //   progressBar.setVisibility(View.GONE);
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+
+                        if (adapter == null) {
+                            Categories = response.body().getData();
+                            adapter = new RedeemPointListAdapter(RedeemPointsCategoryActivity.this,  Categories);
+                            redeemList.setAdapter(adapter);
+                        } else {
+                           // Categories.addAll(response.body().getData());
+
+                        }
+
+//                        if (Categories.getRoot_category(). == 0) {
+//                            redeemList.invokeState(EmptyStateRecyclerView.STATE_EMPTY);
+//                        } else {
+//                            redeemList.invokeState(EmptyStateRecyclerView.STATE_OK);
+//                        }
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(RedeemPointsCategoryActivity.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                            finish();
+                        }
+                    }
+
+
+                }
+
+                @Override
+                public void onFailure(Call<RedeemCategoryListResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                   // progressBar.setVisibility(View.GONE);
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        new Handler(MyWallet.callbackOrderHistory).sendEmptyMessage(0);
+        finish();
+        RedeemPointsCategoryActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+
+}

+ 504 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemProductDetailsActivity.java

@@ -0,0 +1,504 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import android.text.SpannableString;
+import android.text.style.UnderlineSpan;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.request.RequestOptions;
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.RedeemProductListAdapter;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.OrderStatus;
+import com.ttiglobal.inttilectgpchat.wrappers.ProductListDetails;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemProductDetails;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemProductDetailsResponse;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+public class RedeemProductDetailsActivity extends AppCompatActivity {
+    private RecyclerView redeemList;
+    RedeemProductListAdapter adapter;
+    TransparentProgressDialog progressDialog;
+    ApiService restService;
+    private LinearLayoutManager linearLayoutManager;
+    private ImageView productImage;
+    private TextView productTitle, desc, productPrice, earnedPoints, header;
+    RedeemProductDetails productDetailsResponse = new RedeemProductDetails();
+    Button btnPurchase;
+    public static ProductListDetails productList = new ProductListDetails();
+    private LinearLayout priceListView;
+    public String[] priceDenominations;
+    public ArrayList<String> priceDenominationsFinal = new ArrayList<>();
+    public ArrayList<MyViewHolderPrice> PRICE_HOLDER = new ArrayList<>();
+    public String strPrice = "0";
+    public EditText editPrice;
+    public LinearLayout rangeLayout, slabLayout;
+    int minAmount = 0, maxAmount = 0, enteredAmount = 0;
+    public OrderStatus orderStatus = new OrderStatus();
+    String typePrice = "";
+    Integer iCurrentAmount = 0;
+    private String strTermsnContions;
+    AlertDialog.Builder alertDialogBuilder;
+    AlertDialog alertDialog;
+    private TextView txtTermsnConditions;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.redeem_product_details);
+        setupUI(findViewById(R.id.bgLayout));
+
+        restService = ((MainApplication) getApplication()).getClient();
+        productImage = findViewById(R.id.product_image);
+        header = findViewById(R.id.title);
+        productTitle = findViewById(R.id.productTitle);
+        editPrice = findViewById(R.id.edit_price);
+        rangeLayout = findViewById(R.id.range);
+        slabLayout = findViewById(R.id.slab);
+        productPrice = findViewById(R.id.redeem_price);
+        earnedPoints = findViewById(R.id.total_earned_points);
+        desc = findViewById(R.id.productDesc);
+        btnPurchase = findViewById(R.id.btn_purchase);
+        getProductDetails(true);
+        iCurrentAmount = Integer.parseInt(MyWallet.strCurrentAmount);
+        //  Amount = findViewById(R.id.redeem_price);
+        priceListView = (LinearLayout) findViewById(R.id.priceList);
+        txtTermsnConditions = (TextView) findViewById(R.id.terms_link);
+        SpannableString loginText = new SpannableString("Terms and Conditions");
+        loginText.setSpan(new UnderlineSpan(), 0, loginText.length(), 0);
+        txtTermsnConditions.setText(loginText);
+        txtTermsnConditions.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent i = new Intent(RedeemProductDetailsActivity.this, TermsandConditions.class);
+                i.putExtra("tnc", productDetailsResponse.getTnc_web() + "");
+                startActivity(i);
+            }
+        });
+        btnPurchase.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (!typePrice.equalsIgnoreCase("")) {
+                    if (typePrice.equalsIgnoreCase("Range")) {
+                        if (editPrice.getText().toString() == null || editPrice.getText().toString().equalsIgnoreCase("")) {
+                            GlobalData.showToast(RedeemProductDetailsActivity.this, "Enter amount", Toast.LENGTH_SHORT).show();
+                            return;
+                        }
+
+
+                        if (!editPrice.getText().toString().equalsIgnoreCase("")) {
+                            enteredAmount = Integer.parseInt(editPrice.getText().toString());
+                            if (enteredAmount <= maxAmount && enteredAmount >= minAmount) {
+
+                                if (enteredAmount <= iCurrentAmount) {
+                                    productOrder(true, editPrice.getText().toString());
+                                } else {
+                                    GlobalData.showToast(RedeemProductDetailsActivity.this, "Entered amount should be less than available balance", Toast.LENGTH_SHORT).show();
+                                    return;
+                                }
+
+                            } else {
+                                GlobalData.showToast(RedeemProductDetailsActivity.this, "Enter amount should be in limit", Toast.LENGTH_SHORT).show();
+                                return;
+                            }
+
+
+                        }
+                    } else {
+
+                        if (strPrice == null || strPrice.equalsIgnoreCase("")) {
+                            GlobalData.showToast(RedeemProductDetailsActivity.this, "Select slab amount", Toast.LENGTH_SHORT).show();
+                            return;
+                        }
+                        enteredAmount = Integer.parseInt(strPrice);
+                        if (enteredAmount <= maxAmount && enteredAmount >= minAmount) {
+                            productOrder(true, strPrice);
+                        } else {
+                            GlobalData.showToast(RedeemProductDetailsActivity.this, "Entered amount should be in limit", Toast.LENGTH_SHORT).show();
+                        }
+                    }
+
+                }
+
+            }
+        });
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+
+    }
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    public static void hideSoftKeyboard(Activity activity) {
+        try {
+            InputMethodManager inputMethodManager =
+                    (InputMethodManager) activity.getSystemService(
+                            Activity.INPUT_METHOD_SERVICE);
+            inputMethodManager.hideSoftInputFromWindow(
+                    activity.getCurrentFocus().getWindowToken(), 0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void setupUI(View view) {
+        try {
+            if (!(view instanceof EditText)) {
+                view.setOnTouchListener(new View.OnTouchListener() {
+                    @SuppressLint("ClickableViewAccessibility")
+                    public boolean onTouch(View v, MotionEvent event) {
+                        hideSoftKeyboard(RedeemProductDetailsActivity.this);
+                        return false;
+                    }
+                });
+            }
+
+            if (view instanceof ViewGroup) {
+                for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
+                    View innerView = ((ViewGroup) view).getChildAt(i);
+                    setupUI(innerView);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void productOrder(boolean canLoadProgress, String price) {
+        if (new UtilService().isNetworkAvailable(RedeemProductDetailsActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(RedeemProductDetailsActivity.this);
+                progressDialog.show();
+                // progressBar.setVisibility(View.GONE);
+            } else {
+                // progressBar.setVisibility(View.VISIBLE);
+            }
+
+            try {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("product_id", productDetailsResponse.getId());
+                map.put("product_price", price);
+
+                restService.postProductOrder(map).enqueue(new Callback<OrderStatus>() {
+                    @Override
+                    public void onResponse(Call<OrderStatus> call, Response<OrderStatus> response) {
+
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        //   progressBar.setVisibility(View.GONE);
+                        orderStatus = response.body();
+
+                        if (response.body() != null && response.body().getStatus() == 200) {
+
+                            showInstructions(orderStatus.getType() + "");
+
+                        } else if (response.body() != null && response.body().getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        } else if (response.body() != null) {
+                            GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                        } else if (response.errorBody() != null) {
+                            Gson gson = new Gson();
+                            ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                            GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                            if (message.getStatus() == 401) {
+                                GlobalData.canLogout = true;
+                                finish();
+                            }
+                        }
+
+                    }
+
+                    @Override
+                    public void onFailure(Call<OrderStatus> call, Throwable t) {
+                        if (progressDialog != null && progressDialog.isShowing()) {
+                            progressDialog.dismiss();
+                        }
+                        // progressBar.setVisibility(View.GONE);
+                        GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                    }
+                });
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    public void arrayList(String s) {
+        priceDenominations = s.split(",");
+
+    }
+
+    public void updateList() {
+
+        priceListView.removeAllViews();
+        int indexListSize = priceDenominationsFinal.size();
+        if (indexListSize < 1) {
+            return;
+        }
+        for (int i = 0; i < indexListSize; i++) {
+            MyViewHolderPrice holder = new MyViewHolderPrice(this, LayoutInflater.from(this).inflate(R.layout.price_text_item, null, false));
+            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
+            params.setMargins(0, 0, 0, 15);
+            holder.getView().setId(i);
+            holder.txtPrice.setText(priceDenominationsFinal.get(i));
+            priceListView.addView(holder.getView(), params);
+            PRICE_HOLDER.add(holder);
+            holder.getView().setOnClickListener(new onDayClick());
+            //  strPrice =priceDenominations[0];
+        }
+
+    }
+
+    private void showInstructions(String type) {
+        View view = LayoutInflater.from(RedeemProductDetailsActivity.this).inflate(
+                R.layout.profile_success, null);
+        TextView textHead = (TextView) view.findViewById(R.id.textHead);
+        ImageView successImage = (ImageView) view.findViewById(R.id.success);
+        TextView text1 = (TextView) view.findViewById(R.id.text1);
+        TextView text2 = (TextView) view.findViewById(R.id.text2);
+        TextView text3 = (TextView) view.findViewById(R.id.text3);
+        text3.setVisibility(View.GONE);
+        textHead.setVisibility(View.GONE);
+        if (type.trim().equalsIgnoreCase("1")) {
+            successImage.setImageDrawable(getResources().getDrawable(R.drawable.success));
+            text1.setText("Your order has been");
+            text2.setText("placed successfully");
+        } else {
+            successImage.setImageDrawable(getResources().getDrawable(R.drawable.success_orange));
+
+             text1.setText("Your order placed");
+             text2.setText("Status will be updated soon!");
+        }
+
+        view.findViewById(R.id.btn_ok).setOnClickListener(
+                new View.OnClickListener() {
+
+                    @Override
+                    public void onClick(View v) {
+                        startActivity(new Intent(RedeemProductDetailsActivity.this, RedeemProductListActivity.class));
+                        finish();
+                    }
+                });
+
+        alertDialogBuilder = new AlertDialog.Builder(RedeemProductDetailsActivity.this);
+        alertDialogBuilder.setCancelable(false);
+        alertDialogBuilder.setView(view);
+        alertDialog = alertDialogBuilder.create();
+        alertDialog.show();
+    }
+
+    public class onDayClick implements View.OnClickListener {
+        @Override
+        public void onClick(View v) {
+            for (int id = 0; id < priceListView.getChildCount(); id++) {
+                LinearLayout child = (LinearLayout) priceListView.getChildAt(id);
+                TextView txt = (TextView) child.getChildAt(0);
+                txt.setTextColor(getResources().getColor(R.color.btn_bg_color));
+                txt.setBackgroundResource(R.drawable.border_grey);
+            }
+            LinearLayout child = (LinearLayout) priceListView.getChildAt(v.getId());
+            TextView txt = (TextView) child.getChildAt(0);
+            txt.setBackgroundResource(R.drawable.fill_color);
+            txt.setTextColor(getResources().getColor(R.color.material_white));
+            strPrice = priceDenominationsFinal.get(v.getId());
+
+        }
+    }
+
+    public class MyViewHolderPrice {
+
+        TextView txtPrice;
+        View convertView;
+
+        MyViewHolderPrice(Context context, View view) {
+            convertView = view;
+            txtPrice = (TextView) view.findViewById(R.id.price_denominations);
+            view.setTag(this);
+        }
+
+        public View getView() {
+            return convertView;
+        }
+    }
+
+
+    private void getProductDetails(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(RedeemProductDetailsActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(RedeemProductDetailsActivity.this);
+                progressDialog.show();
+                // progressBar.setVisibility(View.GONE);
+            } else {
+                // progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getProductDetails(productList.getId()).enqueue(new Callback<RedeemProductDetailsResponse>() {
+                @Override
+                public void onResponse(Call<RedeemProductDetailsResponse> call, Response<RedeemProductDetailsResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        productDetailsResponse = response.body().getData();
+                        setProductDetails();
+
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    }
+
+
+                }
+
+                @Override
+                public void onFailure(Call<RedeemProductDetailsResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    // progressBar.setVisibility(View.GONE);
+
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void setProductDetails() {
+
+        txtTermsnConditions.setVisibility(View.VISIBLE);
+        minAmount = Integer.parseInt(productDetailsResponse.getMin_custom_price());
+        maxAmount = Integer.parseInt(productDetailsResponse.getMax_custom_price());
+        if (productDetailsResponse.getPrice_type().equalsIgnoreCase("Range")) {
+
+            slabLayout.setVisibility(View.GONE);
+            rangeLayout.setVisibility(View.VISIBLE);
+            if (iCurrentAmount < Integer.parseInt(productDetailsResponse.getMax_custom_price())) {
+                editPrice.setHint(productDetailsResponse.getMin_custom_price() + " to " + MyWallet.strCurrentAmount);
+            } else {
+                editPrice.setHint(productDetailsResponse.getMin_custom_price() + " to " + productDetailsResponse.getMax_custom_price());
+            }
+            priceListView.setVisibility(View.GONE);
+
+        } else if (productDetailsResponse.getPrice_type().equalsIgnoreCase("Slab")) {
+            if (productDetailsResponse.getCustom_denominations() != null) {
+
+                arrayList(productDetailsResponse.getCustom_denominations());
+                for (int i = 0; i < priceDenominations.length; i++) {
+                    int iAmount = Integer.parseInt(priceDenominations[i]);
+                    if (iCurrentAmount > iAmount) {
+                        priceDenominationsFinal.add(priceDenominations[i]);
+                    }
+                }
+            }
+            slabLayout.setVisibility(View.VISIBLE);
+            rangeLayout.setVisibility(View.GONE);
+            priceListView.setVisibility(View.VISIBLE);
+            updateList();
+        }
+
+        if (productDetailsResponse.getPrice_type() != null) {
+            typePrice = productDetailsResponse.getPrice_type();
+        }
+
+        productTitle.setText(productDetailsResponse.getName());
+        productPrice.setText(productDetailsResponse.getMin_custom_price() + " to " + productDetailsResponse.getMax_custom_price());
+        //  earnedPoints.setText("Available Points:"+"5000");
+        desc.setText(productDetailsResponse.getDescription());
+        Glide.with(this).load(productDetailsResponse.getImages())
+                .thumbnail(Glide.with(this).load(R.drawable.gif_loader))
+                .apply(new RequestOptions().fitCenter().diskCacheStrategy(DiskCacheStrategy.ALL)
+                        .placeholder(R.drawable.placeholder).error(R.drawable.placeholder)).into(productImage);
+
+    }
+    @Override
+    public void onBackPressed() {
+        super.onBackPressed();
+        confirmClose();
+
+    }
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void confirmClose() {
+        startActivity(new Intent(RedeemProductDetailsActivity.this, RedeemProductListActivity.class));
+        finish();
+        RedeemProductDetailsActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+}

+ 217 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/RedeemProductListActivity.java

@@ -0,0 +1,217 @@
+package com.ttiglobal.inttilectgpchat;
+
+import android.annotation.SuppressLint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.appcompat.widget.Toolbar;
+import android.view.MenuItem;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+import com.ttiglobal.inttilectgpchat.adapter.RedeemProductListAdapter;
+import com.ttiglobal.inttilectgpchat.util.ApiService;
+import com.ttiglobal.inttilectgpchat.util.GlobalData;
+import com.ttiglobal.inttilectgpchat.util.MainApplication;
+import com.ttiglobal.inttilectgpchat.util.StorePreference;
+import com.ttiglobal.inttilectgpchat.util.TransparentProgressDialog;
+import com.ttiglobal.inttilectgpchat.util.UtilService;
+import com.ttiglobal.inttilectgpchat.wrappers.ErrorResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemCategoryListResponse;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemProduct;
+import com.ttiglobal.inttilectgpchat.wrappers.RedeemProductResponse;
+
+import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class RedeemProductListActivity extends AppCompatActivity {
+    private RecyclerView redeemList;
+    RedeemProductListAdapter adapter;
+    TransparentProgressDialog progressDialog;
+    ApiService restService;
+    private LinearLayoutManager linearLayoutManager;
+    RedeemProduct productList = new RedeemProduct();
+    TextView header;
+    private StorePreference storePreference;
+    String cate_id = "";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_redeem_product_list);
+        restService = ((MainApplication) getApplication()).getClient();
+        redeemList = findViewById(R.id.redeemProductList);
+        header = findViewById(R.id.title);
+        redeemList.setHasFixedSize(true);
+        redeemList.setItemAnimator(new SlideInLeftAnimator());
+        linearLayoutManager = new LinearLayoutManager(getBaseContext());
+        redeemList.setLayoutManager(linearLayoutManager);
+
+        getCategoryList(true);
+
+        storePreference = new StorePreference(this);
+
+        Toolbar toolbar = findViewById(R.id.toolbar);
+        setSupportActionBar(toolbar);
+        toolbar.setNavigationIcon(R.mipmap.back);
+        toolbar.setContentInsetStartWithNavigation(0);
+        toolbar.setTitle("");
+        getSupportActionBar().setTitle("");
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setDisplayShowHomeEnabled(true);
+        @SuppressLint("PrivateResource")
+        Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
+        backArrow.setColorFilter(getResources().getColor(R.color.btn_bg_color), PorterDuff.Mode.SRC_ATOP);
+        getSupportActionBar().setHomeAsUpIndicator(backArrow);
+
+
+    }
+
+    private void getCategoryList(boolean canLoadProgress) {
+        if (new UtilService().isNetworkAvailable(RedeemProductListActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(RedeemProductListActivity.this);
+                progressDialog.show();
+                // progressBar.setVisibility(View.GONE);
+            } else {
+                // progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getRedeemCategoryList().enqueue(new Callback<RedeemCategoryListResponse>() {
+                @Override
+                public void onResponse(Call<RedeemCategoryListResponse> call, Response<RedeemCategoryListResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    //   progressBar.setVisibility(View.GONE);
+
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                            cate_id = response.body().getData().getRoot_category().getCategory_id();
+                        redeemList.post(new Runnable() {
+                            @Override
+                            public void run() {
+                                // startActivity(new Intent(RedeemProductListActivity.this, RedeemProductDetailsActivity.class));
+                                getProductList(true,cate_id);
+                            }
+                        });
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        GlobalData.showToast(RedeemProductListActivity.this, message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            new Handler(HomeActivity.callback).sendEmptyMessage(0);
+                            finish();
+                        }
+                    }
+
+
+                }
+
+                @Override
+                public void onFailure(Call<RedeemCategoryListResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    // progressBar.setVisibility(View.GONE);
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    protected void onResume() {
+        super.onResume();
+
+        if (GlobalData.canLogout) {
+            finish();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            confirmClose();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void getProductList(boolean canLoadProgress, String cate_id) {
+        if (new UtilService().isNetworkAvailable(RedeemProductListActivity.this)) {
+            if (canLoadProgress) {
+                progressDialog = new TransparentProgressDialog(RedeemProductListActivity.this);
+                progressDialog.show();
+                // progressBar.setVisibility(View.GONE);
+            } else {
+                // progressBar.setVisibility(View.VISIBLE);
+            }
+
+            restService.getRedeemCategoryProductList(cate_id).enqueue(new Callback<RedeemProductResponse>() {
+                @Override
+                public void onResponse(Call<RedeemProductResponse> call, Response<RedeemProductResponse> response) {
+
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    if (response.body() != null && response.body().getStatus() == 200) {
+                        productList = response.body().getData();
+                        header.setText(productList.getName());
+                        adapter = new RedeemProductListAdapter(RedeemProductListActivity.this, productList);
+                        redeemList.setAdapter(adapter);
+
+                    } else if (response.body() != null && response.body().getStatus() == 401) {
+                        GlobalData.canLogout = true;
+                        finish();
+                    } else if (response.body() != null) {
+                        GlobalData.showToast(getBaseContext(), response.body().getMessage(), Toast.LENGTH_SHORT).show();
+                    } else if (response.errorBody() != null) {
+                        Gson gson = new Gson();
+                        ErrorResponse message = gson.fromJson(response.errorBody().charStream(), ErrorResponse.class);
+                        //  GlobalData.showToast(getBaseContext(), message.getMessage(), Toast.LENGTH_SHORT).show();
+                        if (message.getStatus() == 401) {
+                            GlobalData.canLogout = true;
+                            finish();
+                        }
+                    }
+
+
+                }
+
+                @Override
+                public void onFailure(Call<RedeemProductResponse> call, Throwable t) {
+                    if (progressDialog != null && progressDialog.isShowing()) {
+                        progressDialog.dismiss();
+                    }
+                    // progressBar.setVisibility(View.GONE);
+
+                    GlobalData.showToast(getBaseContext(), "Connection Failure, try again!", Toast.LENGTH_SHORT).show();
+                }
+            });
+        } else {
+            GlobalData.showToast(getBaseContext(), "Please check your internet connection", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    private void confirmClose() {
+        finish();
+        RedeemProductListActivity.this.overridePendingTransition(R.anim.animation_f_enter,
+                R.anim.animation_f_leave);
+    }
+}

+ 0 - 0
app/src/main/java/com/ttiglobal/inttilectgpchat/ResetPasswordActivity.java


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.