Compare commits
10 Commits
883cbf0756
...
1fbb7ebadf
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fbb7ebadf | |||
| aaec7b4768 | |||
| 903b281f8c | |||
| 564797c2c9 | |||
| 42c1685176 | |||
| d52ce68cf5 | |||
| 6f260fd0b0 | |||
| e3dd446623 | |||
| 0f5fabea00 | |||
| ffd20ef524 |
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AndroidProjectSystem">
|
||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+14
File diff suppressed because one or more lines are too long
Generated
+1761
File diff suppressed because it is too large
Load Diff
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -4,6 +4,14 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="GSKMTOrange">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-04-28T11:27:59.892971400Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=HA1712TP" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
||||
Generated
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceTable">
|
||||
<option name="columnSorters">
|
||||
<list>
|
||||
<ColumnSorterState>
|
||||
<option name="column" value="Name" />
|
||||
<option name="order" value="ASCENDING" />
|
||||
</ColumnSorterState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+2
-2
@@ -4,8 +4,9 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="11" />
|
||||
<option name="gradleJvm" value="jbr-21" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
@@ -13,7 +14,6 @@
|
||||
<option value="$PROJECT_DIR$/library" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
Generated
+9
-1
@@ -42,10 +42,18 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
<component name="VisualizationToolProject">
|
||||
<option name="state">
|
||||
<ProjectState>
|
||||
<option name="scale" value="0.097802734375" />
|
||||
</ProjectState>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-16
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/HALEON_KENYA_PD.iml" filepath="$PROJECT_DIR$/.idea/modules/HALEON_KENYA_PD.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.androidTest.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.androidTest.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.main.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/HALEON_KENYA_PD.GSKMTOrange.unitTest.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.iml" filepath="$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.androidTest.iml" filepath="$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.androidTest.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.main.iml" filepath="$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/library/HALEON_KENYA_PD.library.unitTest.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-527
@@ -1,527 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="direct_access_persist.xml">
|
||||
<option name="deviceSelectionList">
|
||||
<list>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="27" />
|
||||
<option name="brand" value="DOCOMO" />
|
||||
<option name="codename" value="F01L" />
|
||||
<option name="id" value="F01L" />
|
||||
<option name="manufacturer" value="FUJITSU" />
|
||||
<option name="name" value="F-01L" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1280" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OnePlus" />
|
||||
<option name="codename" value="OP5552L1" />
|
||||
<option name="id" value="OP5552L1" />
|
||||
<option name="manufacturer" value="OnePlus" />
|
||||
<option name="name" value="CPH2415" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2412" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OPPO" />
|
||||
<option name="codename" value="OP573DL1" />
|
||||
<option name="id" value="OP573DL1" />
|
||||
<option name="manufacturer" value="OPPO" />
|
||||
<option name="name" value="CPH2557" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="28" />
|
||||
<option name="brand" value="DOCOMO" />
|
||||
<option name="codename" value="SH-01L" />
|
||||
<option name="id" value="SH-01L" />
|
||||
<option name="manufacturer" value="SHARP" />
|
||||
<option name="name" value="AQUOS sense2 SH-01L" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2160" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="Lenovo" />
|
||||
<option name="codename" value="TB370FU" />
|
||||
<option name="id" value="TB370FU" />
|
||||
<option name="manufacturer" value="Lenovo" />
|
||||
<option name="name" value="Tab P12" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1840" />
|
||||
<option name="screenY" value="2944" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a15" />
|
||||
<option name="id" value="a15" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A15" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a35x" />
|
||||
<option name="id" value="a35x" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A35" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="31" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a51" />
|
||||
<option name="id" value="a51" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy A51" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="akita" />
|
||||
<option name="id" value="akita" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="arcfox" />
|
||||
<option name="id" value="arcfox" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="razr plus 2024" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="1272" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="austin" />
|
||||
<option name="id" value="austin" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g 5G (2022)" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="b0q" />
|
||||
<option name="id" value="b0q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S22 Ultra" />
|
||||
<option name="screenDensity" value="600" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3088" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="32" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="bluejay" />
|
||||
<option name="id" value="bluejay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 6a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="caiman" />
|
||||
<option name="id" value="caiman" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="960" />
|
||||
<option name="screenY" value="2142" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="comet" />
|
||||
<option name="id" value="comet" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro Fold" />
|
||||
<option name="screenDensity" value="390" />
|
||||
<option name="screenX" value="2076" />
|
||||
<option name="screenY" value="2152" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="29" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="crownqlteue" />
|
||||
<option name="id" value="crownqlteue" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Note9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2220" />
|
||||
<option name="screenY" value="1080" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="dm2q" />
|
||||
<option name="id" value="dm2q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="S23 Plus" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="dm3q" />
|
||||
<option name="id" value="dm3q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S23 Ultra" />
|
||||
<option name="screenDensity" value="600" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3088" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="e1q" />
|
||||
<option name="id" value="e1q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S24" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="e3q" />
|
||||
<option name="id" value="e3q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S24 Ultra" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3120" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="eos" />
|
||||
<option name="id" value="eos" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Eos" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="384" />
|
||||
<option name="screenY" value="384" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix" />
|
||||
<option name="id" value="felix" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix" />
|
||||
<option name="id" value="felix" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix_camera" />
|
||||
<option name="id" value="felix_camera" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold (Camera-enabled)" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="fogona" />
|
||||
<option name="id" value="fogona" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g play - 2024" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="g0q" />
|
||||
<option name="id" value="g0q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-S906U1" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts7xllite" />
|
||||
<option name="id" value="gts7xllite" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-T738U" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts8uwifi" />
|
||||
<option name="id" value="gts8uwifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S8 Ultra" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="1848" />
|
||||
<option name="screenY" value="2960" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts8wifi" />
|
||||
<option name="id" value="gts8wifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S8" />
|
||||
<option name="screenDensity" value="274" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts9fe" />
|
||||
<option name="id" value="gts9fe" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S9 FE 5G" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="2304" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="husky" />
|
||||
<option name="id" value="husky" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8 Pro" />
|
||||
<option name="screenDensity" value="390" />
|
||||
<option name="screenX" value="1008" />
|
||||
<option name="screenY" value="2244" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="java" />
|
||||
<option name="id" value="java" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="G20" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="komodo" />
|
||||
<option name="id" value="komodo" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro XL" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="1008" />
|
||||
<option name="screenY" value="2244" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="lynx" />
|
||||
<option name="id" value="lynx" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 7a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="maui" />
|
||||
<option name="id" value="maui" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g play - 2023" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="o1q" />
|
||||
<option name="id" value="o1q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S21" />
|
||||
<option name="screenDensity" value="421" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="31" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="oriole" />
|
||||
<option name="id" value="oriole" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 6" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="panther" />
|
||||
<option name="id" value="panther" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 7" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="q5q" />
|
||||
<option name="id" value="q5q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Z Fold5" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1812" />
|
||||
<option name="screenY" value="2176" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="q6q" />
|
||||
<option name="id" value="q6q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Z Fold6" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1856" />
|
||||
<option name="screenY" value="2160" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="r11" />
|
||||
<option name="id" value="r11" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Watch" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="384" />
|
||||
<option name="screenY" value="384" />
|
||||
<option name="type" value="WEAR_OS" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="r11q" />
|
||||
<option name="id" value="r11q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-S711U" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="redfin" />
|
||||
<option name="id" value="redfin" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 5" />
|
||||
<option name="screenDensity" value="440" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="shiba" />
|
||||
<option name="id" value="shiba" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="t2q" />
|
||||
<option name="id" value="t2q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S21 Plus" />
|
||||
<option name="screenDensity" value="394" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tangorpro" />
|
||||
<option name="id" value="tangorpro" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Tablet" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tokay" />
|
||||
<option name="id" value="tokay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2424" />
|
||||
</PersistentDeviceSelectionData>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+17
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="StudioBotProjectSettings">
|
||||
<option name="shareContext" value="OptedIn" />
|
||||
</component>
|
||||
</project>
|
||||
+77
-69
@@ -1,111 +1,110 @@
|
||||
apply plugin: 'com.android.application'
|
||||
//apply plugin: 'io.fabric'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'org.jetbrains.kotlin.android'
|
||||
android {
|
||||
compileSdk(34)
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
namespace "cpm.com.gskmtorange"
|
||||
namespace("cpm.com.gskmtorange")
|
||||
compileSdk(35)
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
disable 'MissingTranslation'
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
// all*.exclude module: 'okio'
|
||||
// all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
||||
//all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
||||
all*.exclude module: 'support-v4' // This removes all other versions of `support-v4` if gets duplicated from all the artifacts.
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
multiDexEnabled true
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
applicationId "cpm.com.gskmtorange"
|
||||
minSdkVersion 24
|
||||
minSdkVersion 26
|
||||
targetSdk(34)
|
||||
|
||||
// For Lebanon
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
|
||||
//For Egypt
|
||||
/*versionCode 35
|
||||
versionName "4.6"*/
|
||||
|
||||
versionCode 39
|
||||
versionName "5.0"
|
||||
//For UAE
|
||||
/*versionCode 29
|
||||
versionName "4.1"*/
|
||||
|
||||
//For Turkey
|
||||
/* versionCode 34
|
||||
versionName "4.6"*/
|
||||
|
||||
//For Turkey
|
||||
/*versionCode 32
|
||||
versionName "4.4"*/
|
||||
|
||||
//For KSA
|
||||
/*versionCode 28
|
||||
versionName "4.0"*/
|
||||
|
||||
// aading price facing
|
||||
// adding price facing
|
||||
/* versionCode 27
|
||||
versionName "3.8"*/
|
||||
|
||||
//sa
|
||||
/* versionCode 28
|
||||
versionName "3.9"*/
|
||||
|
||||
//Kenya
|
||||
/* //Kenya
|
||||
versionCode 2
|
||||
versionName "1.1"
|
||||
|
||||
versionName "1.1"*/
|
||||
//kenya-lite
|
||||
/* versionCode 2
|
||||
versionName "1.1"*/
|
||||
|
||||
//nigeria
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
|
||||
//For jordan
|
||||
/* versionCode 7
|
||||
versionName "1.6"*/
|
||||
|
||||
//For Kuwait
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
|
||||
//For Bahrain
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
|
||||
//For QATAR
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
|
||||
//For Libya
|
||||
/*versionCode 3
|
||||
versionName "1.2"*/
|
||||
|
||||
//For Oman
|
||||
/*versionCode 1
|
||||
versionName "1.0"*/
|
||||
ndk {abiFilters "armeabi-v7a", "arm64-v8a"}
|
||||
}
|
||||
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
signingConfigs {
|
||||
config {
|
||||
keyAlias 'hp'
|
||||
keyPassword 'android'
|
||||
storeFile file('D:\\jeevanp_cpm_projects\\keystore\\hp.dat')
|
||||
storePassword 'android'
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.config
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-camera-lib.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
firebaseCrashlytics {
|
||||
nativeSymbolUploadEnabled true
|
||||
}
|
||||
@@ -113,59 +112,68 @@ android {
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
exclude 'META-INF/gradle/incremental.annotation.processors'
|
||||
exclude 'META-INF/AL2.0'
|
||||
exclude 'META-INF/LGPL2.1'
|
||||
}
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')
|
||||
// implementation files('libs/ksoap2-android-assembly-3.6.4.jar')
|
||||
// implementation files('libs/ksoap2-android-3.3.0.jar')
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation project(path: ':library')
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.firebase:firebase-auth:20.0.3'
|
||||
implementation 'androidx.activity:activity:1.9.3'
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.15.1'
|
||||
//implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
|
||||
// implementation 'com.github.leocadiotine:ksoap2-android:3.6.2'
|
||||
implementation 'androidx.activity:activity:1.10.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.mockito:mockito-core:4.11.0'
|
||||
testImplementation 'org.mockito:mockito-android:4.11.0'
|
||||
testImplementation 'org.robolectric:robolectric:4.10.3'
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:2.9.0"
|
||||
androidTestImplementation "androidx.test:core:1.6.1"
|
||||
androidTestImplementation "androidx.test:espresso:espresso-core:3.5.1"
|
||||
androidTestImplementation "androidx.test.ext:junit:1.2.1"
|
||||
androidTestImplementation "androidx.test:annotation:1.0.1"
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
||||
|
||||
implementation platform('com.google.firebase:firebase-bom:26.7.0')
|
||||
// implementation 'com.google.firebase:firebase-analytics'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ndk'
|
||||
implementation platform('com.google.firebase:firebase-bom:33.14.0')
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-messaging'
|
||||
|
||||
implementation 'com.google.android.gms:play-services-location:17.1.0'
|
||||
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
||||
//implementation 'com.kyanogen.signatureview:signature-view:1.0'
|
||||
// implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation 'com.google.android.gms:play-services-location:21.3.0'
|
||||
implementation 'com.google.android.gms:play-services-maps:19.2.0'
|
||||
implementation 'com.google.firebase:firebase-analytics:22.4.0'
|
||||
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
|
||||
// implementation 'com.google.firebase:firebase-crashlytics:19.4.3'
|
||||
implementation 'com.google.firebase:firebase-auth:23.2.1'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.google.firebase:firebase-appindexing:10.2.1'
|
||||
// Add the Firebase Crashlytics SDK.
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
|
||||
// Recommended: Add the Google Analytics SDK.
|
||||
implementation 'com.google.firebase:firebase-analytics:18.0.0'
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
//using stable version
|
||||
// implementation 'com.github.pratham-PDots:camera_lib:1.5.1'
|
||||
// implementation 'com.github.pratham-PDots:camera_lib:1.5.0-external-2'
|
||||
// implementation 'com.github.pratham-PDots:camera_lib:1.5.1.0'
|
||||
// Main SDK dependency
|
||||
implementation("com.github.pratham-PDots:camera_lib:1.5.1.1")
|
||||
/*implementation 'androidx.activity:activity-ktx:1.9.0'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.6.2'*/
|
||||
// implementation("com.github.pratham-PDots:camera_lib:1.5.1.1")
|
||||
// implementation("com.github.pratham-PDots:camera_lib:1.5.3.2")
|
||||
// implementation("com.github.pratham-PDots:camera_lib:1.5.4.5")
|
||||
//latest
|
||||
implementation("com.github.pratham-PDots:camera_lib:1.5.4.9")
|
||||
implementation 'com.github.miteshpithadiya:SearchableSpinner:master'
|
||||
implementation "androidx.core:core-splashscreen:1.0.1"
|
||||
implementation "androidx.media3:media3-exoplayer:1.3.1"
|
||||
implementation "androidx.media3:media3-ui:1.3.1"
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'org.jetbrains.kotlin.android'
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Vendored
+3
@@ -15,3 +15,6 @@
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
-keep class com.github.pratham_pdots.camera_lib. { *; }
|
||||
-keep class com.github.pratham_pdots. { *; }
|
||||
-dontwarn com.github.pratham_pdots.**
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -11,10 +11,11 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 7,
|
||||
"versionName": "1.6",
|
||||
"versionCode": 39,
|
||||
"versionName": "5.0",
|
||||
"outputFile": "GSKMTOrange-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
"elementType": "File",
|
||||
"minSdkVersionForDexing": 26
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
|
||||
string in this file.
|
||||
-->
|
||||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyDdgvyAY0_pb-k7PLPJoG6wR-KN0xnhkRE</string>
|
||||
<!--<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyDdgvyAY0_pb-k7PLPJoG6wR-KN0xnhkRE</string>-->
|
||||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyCs2VZqLl4OgStAraUHr8012cUc7vf3Uo8</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -8,17 +8,15 @@
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
@@ -50,9 +48,48 @@
|
||||
android:largeHeap="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:supportsRtl="false"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:supportsRtl">
|
||||
|
||||
<activity
|
||||
android:name=".dailyentry.PD_Realtime_Report_Detail"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".dailyentry.PD_Realtime_Report"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".dailyentry.WebViewActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.PD_Pog_Activity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.PDVisibilityActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".Paralleldots.PdJavaImageActivity"
|
||||
android:exported="false" />
|
||||
@@ -61,90 +98,105 @@
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.StockEntryActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.VisitTypeStatusActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="Ad hoc - Visit Type"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.OrderStatusDetailActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.OrderConfirmActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.OrderTakingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.NewStockDataActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_new_stock_data"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.CounterfeitIndicatorWebActivity"
|
||||
android:label="@string/title_activity_counterfeit_indicator_web"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.StockPricingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_stock_pricing"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".pharma_stores.PharmaActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_paharma"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.StockActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/stock"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.CounterfeitProductsActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_counterfeit_products"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".password.MPinActivity"
|
||||
android:label="@string/title_activity_mpin"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".password.ChangePasswordActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_change_password"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".SplashScreenActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -156,50 +208,59 @@
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_login"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/main_menu_activity_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".autoupdate.AutoUpdateActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".SelectLanguageActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_select_language"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".download.DownloadActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".GeoTag.GeoTagStoreList"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_store_list"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.StoreListActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_store_list"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.StoreimageActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_store_image"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".GeoTag.GeoTagActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_store_geotag"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<!--
|
||||
<meta-data
|
||||
android:name="com.google.android.maps.v2.API_KEY"
|
||||
@@ -213,137 +274,160 @@
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" /> <!-- Gagan Start Declaration -->
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> <!-- Gagan Start Declaration -->
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.CategoryListActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.DailyDataMenuActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.Stock_FacingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.PromoComplianceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.StoreWisePerformanceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" /> <!-- Gagan End Declaration -->
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> <!-- Gagan End Declaration -->
|
||||
<activity
|
||||
android:name=".dailyentry.NonWorkingReason"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_Non_Work"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.AdditionalVisibility"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_Additional_visibility"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".upload.UploadActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_upload"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.SettingsActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.CheckoutActivity"
|
||||
android:label="@string/title_activity_checkout"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.ServiceActivity"
|
||||
android:label="@string/title_activity_service"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".upload.PreviousDataUploadActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_upload"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.T2pBrand_Avaibility"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_t2p_brand__avaibility"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.StockFacing_PlanogramTrackerActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_stock_facing__planogram_tracker"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.CategoryPicture"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_category_picture"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.StoreCheckoutImageActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_store_checkout_image"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.MSL_Availability_StockFacingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.FutureJCPActivity"
|
||||
android:label=""
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.CreateSelfActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_create_self"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.NoCameraActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:label="@string/title_activity_create_self"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.PlanogramPDFActivity"
|
||||
android:label="@string/category_performance_PLANOGRAM"
|
||||
@@ -354,13 +438,15 @@
|
||||
android:label="@string/title_activity_stock_data"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity
|
||||
android:name=".dailyentry.AuditActivity"
|
||||
android:label="@string/audit"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
|
||||
<service
|
||||
android:name=".service.FCMNotificationService"
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"Mer_NoticeBoard": [
|
||||
{
|
||||
"NoticeBoardId": 1,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/Parinaam\/BM_th1.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/share3.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 4,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/video.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/Trainings\/Data_security_video-final_eng.mp4?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "video"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 5,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/image.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/Trainings\/datasec_training_th.png?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "image"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 6,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/html-webview.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/image.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 7,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/html-browser.png",
|
||||
"NoticeLink_FullPage": "https:\/\/cd.parinaam.in?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webbrowser"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 8,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/Frame.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/share1.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 9,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/deeplink.png",
|
||||
"NoticeLink_FullPage": "reports?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "deeplink"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 10,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/contact.png",
|
||||
"NoticeLink_FullPage": "{\"Name\":\"CPMHelpline\",\"Label\":\"Mobile\",\"Value\":\"9898989898\"}?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "contact"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.GeoTag;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -92,6 +94,7 @@ import cpm.com.gskmtorange.dailyentry.StoreimageActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.VisitTypeStatusActivity;
|
||||
import cpm.com.gskmtorange.messgae.AlertMessage;
|
||||
import cpm.com.gskmtorange.upload.Base64;
|
||||
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -258,11 +261,16 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
||||
else{
|
||||
db.updateStatus(storeid, status, latitude, longitude, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
|
||||
db.InsertSTOREgeotag(storeid, latitude, longitude, img_str, status);
|
||||
img_str = "";
|
||||
|
||||
new GeoTagUpload(GeoTagActivity.this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new GeoTagUpload(GeoTagActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
+26
-1
@@ -3,7 +3,32 @@ package cpm.com.gskmtorange.GetterSetter;
|
||||
public class AdditionalDialogGetterSetter {
|
||||
public String Display_id,display,brand_id,brand, trg_quantity, image1, image2, category_id,
|
||||
image3, BEFORE_QTY, camera1, camera2, camera3, AFTER_QTY, store_id, stock_count, question_id, question, answer, type,
|
||||
KEY_ID, unique_id,image_url, sku_id,quantity, process_id, sku_name, stock_flag;
|
||||
KEY_ID, unique_id,image_url, sku_id,quantity, process_id, sku_name, stock_flag,subcatid,subcat,subcatEng;
|
||||
|
||||
|
||||
public String getSubcatid() {
|
||||
return subcatid;
|
||||
}
|
||||
|
||||
public void setSubcatid(String subcatid) {
|
||||
this.subcatid = subcatid;
|
||||
}
|
||||
|
||||
public String getSubcat() {
|
||||
return subcat;
|
||||
}
|
||||
|
||||
public void setSubcat(String subcat) {
|
||||
this.subcat = subcat;
|
||||
}
|
||||
|
||||
public String getSubcatEng() {
|
||||
return subcatEng;
|
||||
}
|
||||
|
||||
public void setSubcatEng(String subcatEng) {
|
||||
this.subcatEng = subcatEng;
|
||||
}
|
||||
|
||||
public String getCOMMON_ID() {
|
||||
return COMMON_ID;
|
||||
|
||||
+27
@@ -59,6 +59,33 @@ public class AddittionalGetterSetter {
|
||||
|
||||
String Brand,Brand_id,Sku,Sku_id,Store_id,Image="";
|
||||
|
||||
String SubCatId,SubCat="";
|
||||
|
||||
public String getSubCatId() {
|
||||
return SubCatId;
|
||||
}
|
||||
|
||||
public void setSubCatId(String subCatId) {
|
||||
SubCatId = subCatId;
|
||||
}
|
||||
|
||||
public String getSubCat() {
|
||||
return SubCat;
|
||||
}
|
||||
|
||||
public void setSubCat(String subCat) {
|
||||
SubCat = subCat;
|
||||
}
|
||||
|
||||
public String getSubCatEng() {
|
||||
return SubCatEng;
|
||||
}
|
||||
|
||||
public void setSubCatEng(String subCatEng) {
|
||||
SubCatEng = subCatEng;
|
||||
}
|
||||
|
||||
String SubCatEng="";
|
||||
|
||||
String Image2="";
|
||||
|
||||
|
||||
+12
@@ -90,6 +90,18 @@ public class CategoryPictureGetterSetter {
|
||||
|
||||
String SubCategoryCamera1;
|
||||
|
||||
String Toggle_value="1";
|
||||
|
||||
public String getToggle_value() {
|
||||
return Toggle_value;
|
||||
}
|
||||
|
||||
public void setToggle_value(String toggle_value) {
|
||||
Toggle_value = toggle_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String SUB_CATEGORY_ID;
|
||||
|
||||
public String getSUB_CATEGORY() {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package cpm.com.gskmtorange.GetterSetter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class NoticeboardItem implements Serializable {
|
||||
String NoticeBoardId;
|
||||
String NoticThumnail_Path;
|
||||
String NoticeLink_Thumbnail;
|
||||
String NoticeLink_FullPage;
|
||||
String FullPageTarget;
|
||||
|
||||
public String getNoticeBoardId() {
|
||||
return NoticeBoardId;
|
||||
}
|
||||
|
||||
public void setNoticeBoardId(String noticeBoardId) {
|
||||
this.NoticeBoardId = noticeBoardId;
|
||||
}
|
||||
|
||||
public String getNoticThumnail_Path() {
|
||||
return NoticThumnail_Path;
|
||||
}
|
||||
|
||||
public void setNoticThumnail_Path(String noticThumnail_Path) {
|
||||
this.NoticThumnail_Path = noticThumnail_Path;
|
||||
}
|
||||
|
||||
public String getNoticeLink_Thumbnail() {
|
||||
return NoticeLink_Thumbnail;
|
||||
}
|
||||
|
||||
public void setNoticeLink_Thumbnail(String noticeLink_Thumbnail) {
|
||||
this.NoticeLink_Thumbnail = noticeLink_Thumbnail;
|
||||
}
|
||||
|
||||
public String getNoticeLink_FullPage() {
|
||||
return NoticeLink_FullPage;
|
||||
}
|
||||
|
||||
public void setNoticeLink_FullPage(String noticeLink_FullPage) {
|
||||
this.NoticeLink_FullPage = noticeLink_FullPage;
|
||||
}
|
||||
|
||||
public String getFullPageTarget() {
|
||||
return FullPageTarget;
|
||||
}
|
||||
|
||||
public void setFullPageTarget(String fullPageTarget) {
|
||||
this.FullPageTarget = fullPageTarget;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cpm.com.gskmtorange.GetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PD_CONFIGURATION {
|
||||
ArrayList<String> PROJECT_ID = new ArrayList<>();
|
||||
ArrayList<String> USER_ID = new ArrayList<>();
|
||||
public ArrayList<String> getUSER_ID() {
|
||||
return USER_ID;
|
||||
}
|
||||
public void setUSER_ID(String USER_ID) {
|
||||
this.USER_ID.add(USER_ID);
|
||||
}
|
||||
public ArrayList<String> getPROJECT_ID() {
|
||||
return PROJECT_ID;
|
||||
}
|
||||
public void setPROJECT_ID(String PROJECT_ID) {
|
||||
this.PROJECT_ID.add(PROJECT_ID);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
|
||||
public class StoreBean implements Serializable{
|
||||
|
||||
String STORE_ID;
|
||||
String EMP_ID;
|
||||
String KEYACCOUNT;
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -13,6 +14,7 @@ import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.AsyncTask;
|
||||
@@ -25,12 +27,15 @@ import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.cardview.widget.CardView;
|
||||
@@ -59,6 +64,7 @@ import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
@@ -70,9 +76,11 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -80,18 +88,22 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.PD_CONFIGURATION;
|
||||
import cpm.com.gskmtorange.autoupdate.AutoUpdateActivity;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeItem;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeboardGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
|
||||
//import io.fabric.sdk.android.Fabric;
|
||||
|
||||
import static android.Manifest.permission.READ_CONTACTS;
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
@@ -99,6 +111,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
private static final int MY_PERMISSIONS_REQUEST_LOCATION = 11;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_READ = 12;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_WRITE = 14;
|
||||
int eventType;
|
||||
private FirebaseAnalytics mFirebaseAnalytics;
|
||||
|
||||
private static final int PERMISSION_ALL = 99;
|
||||
@@ -130,7 +143,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
private View mLoginFormView;
|
||||
private String userid, password;
|
||||
private int versionCode;
|
||||
int eventType;
|
||||
CardView museridSignInButton;
|
||||
|
||||
GoogleApiClient mGoogleApiClient;
|
||||
@@ -142,12 +154,22 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
private Location mLastLocation;
|
||||
private LocationRequest mLocationRequest;
|
||||
private Context context;
|
||||
GSKOrangeDB db;
|
||||
private Dialog dialog;
|
||||
boolean ResultFlag = true;
|
||||
NoticeboardGetterSetter noticeboardGetterSetter;
|
||||
String str;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
context = this;
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
|
||||
TextView tv_version = (TextView) findViewById(R.id.tv_version_code);
|
||||
try {
|
||||
@@ -158,7 +180,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
tv_version.setText("Version/Versiyon - " + app_ver);
|
||||
tv_version.setText("Version/Versiyon - " + app_ver + "-T3");
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
editor = preferences.edit();
|
||||
// Set up the login form.
|
||||
@@ -170,9 +192,9 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
//for lebanon
|
||||
// museridView.setText("test.lebanon1");
|
||||
// mPasswordView.setText("cpm@123");
|
||||
// for EGYPT
|
||||
// museridView.setText("test.egypt");
|
||||
// mPasswordView.setText("cpm123");
|
||||
// for EGYPT
|
||||
// museridView.setText("test.egypt");
|
||||
// mPasswordView.setText("cpm123");
|
||||
/*museridView.setText("egypt.1");
|
||||
mPasswordView.setText("cpm123");*/
|
||||
|
||||
@@ -231,8 +253,8 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
/* museridView.setText("test.jordan");
|
||||
mPasswordView.setText("cpm@123");*/
|
||||
|
||||
// museridView.setText("test.kuwait");
|
||||
// mPasswordView.setText("cpm@123");
|
||||
// museridView.setText("test.kuwait");
|
||||
// mPasswordView.setText("cpm@123");
|
||||
|
||||
// museridView.setText("test.oman");
|
||||
|
||||
@@ -448,40 +470,35 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
} else if (!isPasswordValid(password)) {
|
||||
Snackbar.make(museridView, getString(R.string.error_incorrect_password), Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isuseridValid(String userid) {
|
||||
//TODO: Replace this with your own logic
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
String u_id = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||
|
||||
if (!u_id.equals("") && !userid.equalsIgnoreCase(u_id)) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
//TODO: Replace this with your own logic
|
||||
boolean flag = true;
|
||||
|
||||
String pw = preferences.getString(CommonString.KEY_PASSWORD, "");
|
||||
|
||||
if (!pw.equals("") && !password.equals(pw)) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the progress UI and hides the login form.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
private void showProgress(final boolean show) {
|
||||
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
||||
@@ -515,39 +532,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
}
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
return new CursorLoader(this,
|
||||
// Retrieve data rows for the device user's 'profile' contact.
|
||||
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
|
||||
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
|
||||
|
||||
// Select only userid addresses.
|
||||
ContactsContract.Contacts.Data.MIMETYPE +
|
||||
" = ?", new String[]{ContactsContract.CommonDataKinds.userid
|
||||
.CONTENT_ITEM_TYPE},
|
||||
|
||||
// Show primary userid addresses first. Note that there won't be
|
||||
// a primary userid address if the user hasn't specified one.
|
||||
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
|
||||
List<String> userids = new ArrayList<>();
|
||||
cursor.moveToFirst();
|
||||
while (!cursor.isAfterLast()) {
|
||||
userids.add(cursor.getString(ProfileQuery.ADDRESS));
|
||||
cursor.moveToNext();
|
||||
}
|
||||
|
||||
adduseridsToAutoComplete(userids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> cursorLoader) {
|
||||
|
||||
}*/
|
||||
|
||||
private void adduseridsToAutoComplete(List<String> useridAddressCollection) {
|
||||
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
|
||||
@@ -559,21 +543,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
}
|
||||
|
||||
|
||||
/* private interface ProfileQuery {
|
||||
String[] PROJECTION = {
|
||||
ContactsContract.CommonDataKinds.userid.ADDRESS,
|
||||
ContactsContract.CommonDataKinds.userid.IS_PRIMARY,
|
||||
};
|
||||
|
||||
int ADDRESS = 0;
|
||||
int IS_PRIMARY = 1;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Represents an asynchronous login/registration task used to authenticate
|
||||
* the user.
|
||||
*/
|
||||
|
||||
private class AuthenticateTask extends AsyncTask<Void, Void, String> {
|
||||
private ProgressDialog dialog = null;
|
||||
|
||||
@@ -590,14 +559,14 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
Log.e("latitudedata",lat + ","+ lon);
|
||||
Log.e("latitudedata", lat + "," + lon);
|
||||
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
|
||||
+ userid + "[/USER_ID]" + "[PASSWORD]" + password
|
||||
+ "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context)
|
||||
+ "[/IN_TIME]" + "[LATITUDE]" + lat
|
||||
+ "[/LATITUDE]" + "[LONGITUDE]" + lon
|
||||
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver
|
||||
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver + "-T3"
|
||||
+ "[/APP_VERSION]" + "[ATT_MODE]OnLine[/ATT_MODE]"
|
||||
+ "[NETWORK_STATUS]" + "LoginStatus"
|
||||
+ "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]";
|
||||
@@ -607,8 +576,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
request.addProperty("onXML", userauth_xml);
|
||||
Log.d("loginrequest", String.valueOf(request));
|
||||
|
||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
|
||||
SoapEnvelope.VER11);
|
||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
try {
|
||||
@@ -616,46 +584,20 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN,
|
||||
envelope);
|
||||
} catch (Exception e){
|
||||
Log.e("httpexception",e.getMessage());
|
||||
} catch (Exception e) {
|
||||
Log.e("httpexception", e.getMessage());
|
||||
}
|
||||
/*HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||
CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN,
|
||||
envelope);*/
|
||||
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
if (result.toString()
|
||||
.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
showAlert(CommonString.MESSAGE_FAILURE);
|
||||
}
|
||||
});
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_FAILURE));
|
||||
|
||||
} else if (result.toString().equalsIgnoreCase(
|
||||
CommonString.KEY_FALSE)) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showAlert(CommonString.MESSAGE_FALSE);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_FALSE));
|
||||
} else if (result.toString().equalsIgnoreCase(
|
||||
CommonString.KEY_CHANGED)) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showAlert(CommonString.MESSAGE_CHANGED);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_CHANGED));
|
||||
} else {
|
||||
|
||||
XmlPullParserFactory factory = XmlPullParserFactory
|
||||
@@ -671,47 +613,109 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
|
||||
if (failureGetterSetter.getStatus().equalsIgnoreCase(
|
||||
CommonString.KEY_FAILURE)) {
|
||||
/* final AlertMessage message = new AlertMessage(
|
||||
LoginActivity.this, CommonString.METHOD_LOGIN
|
||||
+ failureGetterSetter.getErrorMsg(),
|
||||
"login", null);*/
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
showAlert(CommonString.METHOD_LOGIN
|
||||
+ failureGetterSetter.getErrorMsg());
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
showAlert(CommonString.METHOD_LOGIN
|
||||
+ failureGetterSetter.getErrorMsg());
|
||||
});
|
||||
} else {
|
||||
|
||||
try {
|
||||
// For String source
|
||||
// For String source
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
lgs = XMLHandlers.loginXMLHandler(xpp, eventType);
|
||||
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
lgs = XMLHandlers.loginXMLHandler(xpp, eventType);
|
||||
|
||||
} catch (XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//PD_CONFIGURATION
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userid);
|
||||
request.addProperty("Type", "PD_CONFIGURATION");
|
||||
request.addProperty("cultureid", "1");
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
result = envelope.getResponse();
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
PD_CONFIGURATION pdConfiguration = XMLHandlers.PDConfigXMLHandler(xpp);
|
||||
Log.e("PD_CONFIGURATION_RESULT", result.toString());
|
||||
// PUT IN PREFERENCES
|
||||
if (pdConfiguration.getPROJECT_ID() != null && !pdConfiguration.getPROJECT_ID().isEmpty()) {
|
||||
editor.putString(CommonString.KEY_PD_PROJECT_Id, pdConfiguration.getPROJECT_ID().get(0));
|
||||
editor.putString(CommonString.KEY_PD_USER_Id, pdConfiguration.getUSER_ID().get(0));
|
||||
} else {
|
||||
return CommonString.KEY_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
//Mer_NoticeBoard
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userid);
|
||||
request.addProperty("Type", "Mer_NoticeBoard");
|
||||
request.addProperty("cultureid", "1");
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
result = envelope.getResponse();
|
||||
|
||||
factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(false);
|
||||
|
||||
Log.e("Noticeboard_Result", result.toString());
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
NoticeboardGetterSetter noticeboardGetterSetter1 = XMLHandlers.Noticeboard_XMLHandler(xpp,eventType);
|
||||
Log.e("noticeboardGetterSetter1", noticeboardGetterSetter1.toString());
|
||||
// PUT IN PREFERENCES
|
||||
if (noticeboardGetterSetter1.getNoticeBoardId() != null && !noticeboardGetterSetter1.getNoticeBoardId().isEmpty()) {
|
||||
List<NoticeItem> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < noticeboardGetterSetter1.getNoticeBoardId().size(); i++) {
|
||||
|
||||
NoticeItem item = new NoticeItem(
|
||||
safe(noticeboardGetterSetter1.getNoticeBoardId(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticThumnail_Path(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticeLink_Thumbnail(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticeLink_FullPage(), i),
|
||||
safe(noticeboardGetterSetter1.getFullPageTarget(), i)
|
||||
);
|
||||
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
NoticeResponse response = new NoticeResponse(list);
|
||||
|
||||
Gson gson = new GsonBuilder()
|
||||
.disableHtmlEscaping()
|
||||
.setPrettyPrinting()
|
||||
.create();
|
||||
|
||||
String noticeJson = gson.toJson(response);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putString("NOTICEBOARD_DATA", noticeJson);
|
||||
editor.apply();
|
||||
|
||||
} else {
|
||||
return CommonString.KEY_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
editor.putString(CommonString.KEY_USERNAME, userid);
|
||||
editor.putString(CommonString.KEY_PASSWORD, password);
|
||||
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
|
||||
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
|
||||
//editor.putString(CommonString.KEY_DATE, "12/05/2022");
|
||||
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
|
||||
//editor.putString(CommonString.KEY_DATE, "01/25/2019");
|
||||
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
|
||||
Log.e("countryid",lgs.getCOUNTRY_ID());
|
||||
Log.e("countryid", lgs.getCOUNTRY_ID());
|
||||
editor.commit();
|
||||
setDataFromSharedPreferences(lgs);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, userid);
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
|
||||
@@ -722,9 +726,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
return CommonString.KEY_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e);
|
||||
runOnUiThread(new Runnable() {
|
||||
@@ -738,38 +740,24 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
|
||||
} catch (IOException e) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e);
|
||||
/* final AlertMessage message = new AlertMessage(
|
||||
LoginActivity.this,
|
||||
AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket_login", e);*/
|
||||
|
||||
counter++;
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
if (counter < 3) {
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
if (counter < 3) {
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
} else {
|
||||
showAlert(getString(R.string.nonetwork));
|
||||
counter = 1;
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
showAlert(getString(R.string.nonetwork));
|
||||
counter = 1;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e);
|
||||
/* final AlertMessage message = new AlertMessage(
|
||||
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
|
||||
"acra_login", e);*/
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.logException(new Exception("My custom login Exception"));
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showAlert(CommonString.MESSAGE_EXCEPTION);
|
||||
}
|
||||
});
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_EXCEPTION));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -777,16 +765,15 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
//Stop performance trace
|
||||
/// myTrace.stop();
|
||||
|
||||
if (result.equals(CommonString.KEY_SUCCESS)) {
|
||||
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
// manually set true for South Africa
|
||||
|
||||
// new UploadTask(LoginActivity.this).execute();
|
||||
boolean forSA = false;
|
||||
// database.open();
|
||||
if (forSA) {
|
||||
//For SA Only
|
||||
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equals("")) {
|
||||
// new NoticeboardTask().execute();
|
||||
Intent intent = new Intent(getBaseContext(), SelectLanguageActivity.class);
|
||||
intent.putExtra(CommonString.KEY_LOGIN_DATA, lgs);
|
||||
startActivity(intent);
|
||||
@@ -828,6 +815,13 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
}
|
||||
}
|
||||
|
||||
private String safe(ArrayList<String> list, int index) {
|
||||
if (list == null || list.size() <= index || list.get(index) == null) {
|
||||
return "";
|
||||
}
|
||||
return list.get(index).trim();
|
||||
}
|
||||
|
||||
public void showAlert(String str) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
|
||||
@@ -836,9 +830,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
/* Intent i = new Intent(activity, StorelistActivity.class);
|
||||
activity.startActivity(i);
|
||||
activity.finish();*/
|
||||
|
||||
}
|
||||
});
|
||||
@@ -872,26 +863,23 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
cdate = arabicToenglish(cdate);
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_JORDAN)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KUWAIT)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KUWAIT)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_BAHRAIN)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_BAHRAIN)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_OMAN)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_OMAN)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_QATAR)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_QATAR)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}
|
||||
else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LEBANON)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LEBANON)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}
|
||||
else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LIBIYA)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LIBIYA)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}
|
||||
return cdate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
|
||||
Gson gson = new Gson();
|
||||
String jsonCurProduct = gson.toJson(lgs);
|
||||
@@ -935,18 +923,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
} else if (requestCode == MY_PERMISSIONS_REQUEST_STORAGE_READ) {
|
||||
checkAppPermission(Manifest.permission.ACCESS_FINE_LOCATION, MY_PERMISSIONS_REQUEST_LOCATION);
|
||||
} else {
|
||||
|
||||
// Create a Folder for Images
|
||||
|
||||
/* File file = new File(Environment.getExternalStorageDirectory(), ".GSK_MT_ORANGE_IMAGES");
|
||||
if (!file.isDirectory()) {
|
||||
file.mkdir();
|
||||
}
|
||||
File file_planogram = new File(Environment.getExternalStorageDirectory(), "GSK_MT_ORANGE_Planogram_Images");
|
||||
if (!file_planogram.isDirectory()) {
|
||||
file_planogram.mkdir();
|
||||
}*/
|
||||
|
||||
if (checkPlayServices()) {
|
||||
// Building the GoogleApi client
|
||||
buildGoogleApiClient();
|
||||
@@ -1002,10 +978,9 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
|
||||
if (mGoogleApiClient != null) {
|
||||
mGoogleApiClient.connect();
|
||||
|
||||
}
|
||||
checkgpsEnableDevice();
|
||||
locationRequest= new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 100000)
|
||||
locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 100000)
|
||||
.setWaitForAccurateLocation(false)
|
||||
.setMinUpdateIntervalMillis(IMPLICIT_MIN_UPDATE_INTERVAL)
|
||||
.setMaxUpdateDelayMillis(1000)
|
||||
@@ -1034,29 +1009,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
fusedLocationProviderClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
|
||||
|
||||
if (checkPlayServices()) {
|
||||
// Building the GoogleApi client
|
||||
buildGoogleApiClient();
|
||||
createLocationRequest();
|
||||
}
|
||||
|
||||
// Create an instance of GoogleAPIClient.
|
||||
if (mGoogleApiClient == null) {
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||
.addConnectionCallbacks(this)
|
||||
.addOnConnectionFailedListener(this)
|
||||
.addApi(LocationServices.API)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
private boolean checkPlayServices() {
|
||||
int resultCode = GooglePlayServicesUtil
|
||||
.isGooglePlayServicesAvailable(this);
|
||||
@@ -1106,11 +1058,9 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
if (mGoogleApiClient != null) {
|
||||
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startLocationUpdates() {
|
||||
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mGoogleApiClient != null) {
|
||||
@@ -1118,7 +1068,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
// Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int distFrom(double lat1, double lng1, double lat2, double lng2) {
|
||||
@@ -1136,27 +1085,8 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
Log.e("onConnectdata","true" + ","+mGoogleApiClient);
|
||||
/*if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mLastLocation != null) {
|
||||
lat = mLastLocation.getLatitude();
|
||||
lon = mLastLocation.getLongitude();
|
||||
// Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
startLocationUpdates();
|
||||
}*/
|
||||
Log.e("onConnectdata", "true" + "," + mGoogleApiClient);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1258,8 +1188,8 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//return ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +1,49 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.io.File;
|
||||
import org.json.JSONObject;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
||||
@@ -52,20 +58,26 @@ import cpm.com.gskmtorange.dailyentry.PlanogramPDFActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.ServiceActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.SettingsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.WebViewActivity;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.password.ChangePasswordActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivityFragment;
|
||||
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
|
||||
import cpm.com.gskmtorange.upload.UploadActivity;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeItem;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
private Context context;
|
||||
WebView webView;
|
||||
ImageView imageView;
|
||||
ViewPager2 viewPager;
|
||||
private Handler sliderHandler = new Handler();
|
||||
private Runnable sliderRunnable;
|
||||
private List<ImageView> dots = new ArrayList<>();
|
||||
List<NoticeItem>bannerlist = null;
|
||||
String date;
|
||||
String app_ver;
|
||||
private SharedPreferences preferences = null;
|
||||
GSKOrangeDB db;
|
||||
String user_name, country_id;
|
||||
@@ -74,6 +86,7 @@ public class MainActivity extends AppCompatActivity
|
||||
ArrayList<CoverageBean> coverageList;
|
||||
String error_msg;
|
||||
Toolbar toolbar;
|
||||
LinearLayout dotsLayout;
|
||||
NavigationView navigationView;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@@ -82,19 +95,68 @@ public class MainActivity extends AppCompatActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
setSupportActionBar(toolbar);
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
context = this;
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
imageView = (ImageView) findViewById(R.id.img_main);
|
||||
dotsLayout = findViewById(R.id.dotsLayout);
|
||||
webView = (WebView) findViewById(R.id.webview);
|
||||
String url = preferences.getString(CommonString.KEY_NOTICE_BOARD_LINK, "");
|
||||
// String url = "https://dle.parinaam.in/OneApp/Dabur/brand-spiels/dabur-brand-spiels.html";
|
||||
user_name = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||
db = new GSKOrangeDB(MainActivity.this);
|
||||
db.open();
|
||||
webView.setWebViewClient(new MyWebViewClient());
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
|
||||
String json = preferences.getString("NOTICEBOARD_DATA", null);
|
||||
Log.d("noticejsondata",json);
|
||||
if (json != null) {
|
||||
Gson gson = new Gson();
|
||||
NoticeResponse response =
|
||||
gson.fromJson(json, NoticeResponse.class);
|
||||
bannerlist = response.Mer_NoticeBoard;
|
||||
Log.d("SIZE", String.valueOf(bannerlist.size()));
|
||||
}
|
||||
|
||||
|
||||
if(bannerlist!=null && bannerlist.size()>0){
|
||||
setupDots(bannerlist.size());
|
||||
viewPager.setAdapter(new NoticeAdapter(bannerlist, this::handleClick));
|
||||
}
|
||||
viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
|
||||
setActiveDot(position); // 👈 your dots logic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
super.onPageScrollStateChanged(state);
|
||||
|
||||
if (state == ViewPager2.SCROLL_STATE_DRAGGING) {
|
||||
sliderHandler.removeCallbacks(sliderRunnable); // stop
|
||||
}
|
||||
else if (state == ViewPager2.SCROLL_STATE_IDLE) {
|
||||
startAutoSlide(); // 🔥 don't call postDelayed directly
|
||||
}
|
||||
}
|
||||
});
|
||||
viewPager.setClipToPadding(false);
|
||||
viewPager.setClipChildren(false);
|
||||
// TabLayout tabLayout = findViewById(R.id.tabDots);
|
||||
/*new TabLayoutMediator(tabLayout, viewPager,
|
||||
(tab, position) -> {
|
||||
// no title, just dots
|
||||
}
|
||||
).attach();*/
|
||||
|
||||
if (!url.isEmpty()) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
@@ -121,6 +183,150 @@ public class MainActivity extends AppCompatActivity
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
}
|
||||
|
||||
private void setupDots(int size) {
|
||||
dotsLayout.removeAllViews();
|
||||
dots.clear();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
ImageView dot = new ImageView(this);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
params.setMargins(8, 0, 8, 0);
|
||||
dot.setLayoutParams(params);
|
||||
|
||||
// default (inactive)
|
||||
dot.setImageResource(R.drawable.dot_inactive);
|
||||
|
||||
dotsLayout.addView(dot);
|
||||
dots.add(dot);
|
||||
}
|
||||
|
||||
// set first dot active
|
||||
if (size > 0) {
|
||||
setActiveDot(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void setActiveDot(int position) {
|
||||
|
||||
for (int i = 0; i < dots.size(); i++) {
|
||||
ImageView dot = dots.get(i);
|
||||
|
||||
if (i == position) {
|
||||
// Active dot (bigger + dark)
|
||||
dot.setImageResource(R.drawable.dot_active);
|
||||
|
||||
dot.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(200)
|
||||
.start();
|
||||
|
||||
} else {
|
||||
// Inactive dot (small + light)
|
||||
dot.setImageResource(R.drawable.dot_inactive);
|
||||
|
||||
dot.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(200)
|
||||
.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleClick(NoticeItem item) {
|
||||
|
||||
String url = String.valueOf(item.getNoticeLink_FullPage());
|
||||
String type = String.valueOf(item.getFullPageTarget());
|
||||
Log.d("clickdata",url + ","+type);
|
||||
|
||||
if (type == null) return;
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
|
||||
case "html-webview":
|
||||
Log.d("itemdata", String.valueOf(item.getFullPageTarget()));
|
||||
Intent webIntent = new Intent(this, WebViewActivity.class);
|
||||
webIntent.putExtra("url", url);
|
||||
webIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(webIntent);
|
||||
break;
|
||||
|
||||
case "html-webbrowser":
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||
break;
|
||||
|
||||
case "video":
|
||||
Intent videoIntent = new Intent(this, WebViewActivity.class);
|
||||
videoIntent.putExtra("url", url);
|
||||
videoIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(videoIntent);
|
||||
break;
|
||||
|
||||
case "image":
|
||||
Intent imageIntent = new Intent(this, WebViewActivity.class);
|
||||
imageIntent.putExtra("url", url);
|
||||
imageIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(imageIntent);
|
||||
break;
|
||||
|
||||
case "deeplink":
|
||||
try {
|
||||
Intent deepIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(deepIntent);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Invalid deeplink", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
||||
case "contact":
|
||||
handleContact(url);
|
||||
break;
|
||||
|
||||
default:
|
||||
Toast.makeText(this, "Unsupported type", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleContact(String raw) {
|
||||
try {
|
||||
// remove query params
|
||||
String jsonPart = raw.split("\\?")[0];
|
||||
|
||||
JSONObject obj = new JSONObject(jsonPart);
|
||||
|
||||
String number = obj.getString("Value");
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
intent.setData(Uri.parse("tel:" + number));
|
||||
startActivity(intent);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, "Invalid contact data", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private String loadJSONFromAsset() {
|
||||
String json = null;
|
||||
try {
|
||||
InputStream is = getAssets().open("notice.json");
|
||||
int size = is.available();
|
||||
byte[] buffer = new byte[size];
|
||||
is.read(buffer);
|
||||
is.close();
|
||||
json = new String(buffer, "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -130,6 +336,14 @@ public class MainActivity extends AppCompatActivity
|
||||
db.open();
|
||||
//usk
|
||||
navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
startAutoSlide();
|
||||
try {
|
||||
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||
// login_version.setText("Parinaam Version " + app_ver);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
// get menu from navigationView
|
||||
Menu menu = navigationView.getMenu();
|
||||
// find MenuItem you want to change
|
||||
@@ -163,6 +377,9 @@ public class MainActivity extends AppCompatActivity
|
||||
nav_route_plan13.setTitle(getResources().getString(R.string.menu_setting));
|
||||
MenuItem nav_route_plan14 = menu.findItem(R.id.nav_services);
|
||||
nav_route_plan14.setTitle(getResources().getString(R.string.menu_services));
|
||||
|
||||
MenuItem nav_route_plan15 = menu.findItem(R.id.nav_version);
|
||||
nav_route_plan15.setTitle("Version/Versiyon - " + app_ver + "-T3");
|
||||
//Enable disable According to Configuration
|
||||
ArrayList<ConfigurationMasterGetterSetter> configurationData = db.getConfigurationMasterData(country_id);
|
||||
if (!configurationData.isEmpty()) {
|
||||
@@ -212,8 +429,33 @@ public class MainActivity extends AppCompatActivity
|
||||
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
|
||||
private void startAutoSlide() {
|
||||
|
||||
if (sliderRunnable != null) {
|
||||
sliderHandler.removeCallbacks(sliderRunnable); // 🔥 prevent duplicate
|
||||
}
|
||||
|
||||
sliderRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (viewPager.getAdapter() == null) return;
|
||||
|
||||
int nextItem = (viewPager.getCurrentItem() + 1) %
|
||||
viewPager.getAdapter().getItemCount();
|
||||
|
||||
viewPager.setCurrentItem(nextItem, true);
|
||||
|
||||
sliderHandler.postDelayed(this, 3000); // 3 sec
|
||||
}
|
||||
};
|
||||
|
||||
sliderHandler.postDelayed(sliderRunnable, 3000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
@@ -366,7 +608,7 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
imageView.setVisibility(View.INVISIBLE);
|
||||
imageView.setVisibility(View.GONE);
|
||||
webView.setVisibility(View.VISIBLE);
|
||||
super.onPageFinished(view, url);
|
||||
view.clearCache(true);
|
||||
@@ -491,4 +733,59 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
|
||||
}
|
||||
public class NoticeAdapter extends RecyclerView.Adapter<NoticeAdapter.ViewHolder> {
|
||||
|
||||
private List<NoticeItem> list;
|
||||
private OnItemClickListener listener;
|
||||
|
||||
// Interface for click handling
|
||||
public interface OnItemClickListener {
|
||||
void onClick(NoticeItem item);
|
||||
}
|
||||
|
||||
public NoticeAdapter(List<NoticeItem> list, OnItemClickListener listener) {
|
||||
this.list = list;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView image;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
image = itemView.findViewById(R.id.bannerImage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoticeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.banner_item, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(NoticeAdapter.ViewHolder holder, int position) {
|
||||
NoticeItem item = list.get(position);
|
||||
|
||||
String url = String.valueOf(item.getNoticeLink_Thumbnail());
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(url)
|
||||
.transform(new RoundedCorners(30))
|
||||
.into(holder.image);
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) {
|
||||
listener.onClick(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list != null ? list.size() : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeItem;
|
||||
|
||||
public class NoticeResponse implements Serializable {
|
||||
List<NoticeItem> Mer_NoticeBoard;
|
||||
|
||||
public NoticeResponse(List<NoticeItem> list) {
|
||||
this.Mer_NoticeBoard = list;
|
||||
}
|
||||
public List<NoticeItem> getMer_NoticeBoard() {
|
||||
return Mer_NoticeBoard;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,33 +85,31 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
|
||||
switch (id) {
|
||||
case R.id.btn_language_one:
|
||||
selected_flag = true;
|
||||
CommonFunctions.updateLangResources(context, language.get(0));
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.black));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(0));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(0));
|
||||
editor.commit();
|
||||
break;
|
||||
if (id == R.id.btn_language_one) {
|
||||
selected_flag = true;
|
||||
CommonFunctions.updateLangResources(context, language.get(0));
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.black));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(0));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(0));
|
||||
editor.commit();
|
||||
|
||||
case R.id.btn_language_two:
|
||||
selected_flag = true;
|
||||
CommonFunctions.updateLangResources(context, language.get(1));
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.black));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(1));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(1));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(1));
|
||||
editor.commit();
|
||||
break;
|
||||
} else if (id == R.id.btn_language_two) {
|
||||
selected_flag = true;
|
||||
CommonFunctions.updateLangResources(context, language.get(1));
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.black));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(1));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(1));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(1));
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
|
||||
|
||||
@@ -1,30 +1,16 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
|
||||
@@ -35,11 +21,11 @@ public class SplashScreenActivity extends AppCompatActivity {
|
||||
private Context context;
|
||||
private SharedPreferences preferences = null;
|
||||
|
||||
public void onAttachedToWindow() {
|
||||
/* public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
Window window = getWindow();
|
||||
window.setFormat(PixelFormat.RGBA_8888);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Called when the activity is first created.
|
||||
@@ -47,103 +33,50 @@ public class SplashScreenActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(R.layout.activity_splash_main_layout);
|
||||
|
||||
linearLayout = findViewById(R.id.lin_lay);
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
context = this;
|
||||
//StartAnimations();
|
||||
|
||||
sendToLogin();
|
||||
|
||||
/* File f = new File(CommonString.getImagesFolder(context)_OLD);
|
||||
if(f!=null){
|
||||
File file[] = f.listFiles();
|
||||
if(file!=null){
|
||||
|
||||
for (int i=0;i<file.length;i++){
|
||||
Date lastModDate = new Date(file[0].lastModified());
|
||||
String day = lastModDate.toString();
|
||||
|
||||
*//*SimpleDateFormat spf= new SimpleDateFormat("MM/dd/yyyy");
|
||||
date = spf.format(newDate);
|
||||
System.out.println(date);*//*
|
||||
}
|
||||
*//* if(file.length>0){
|
||||
UploadImageWithRetrofit.uploadedFiles = 0;
|
||||
UploadImageWithRetrofit.totalFiles = file.length;
|
||||
UploadImageWithRetrofit uploadImg = new UploadImageWithRetrofit( SplashScreenActivity.this);
|
||||
uploadImg.UploadImageRecursive(SplashScreenActivity.this);
|
||||
}
|
||||
else {
|
||||
sendToLogin();
|
||||
}*//*
|
||||
}else {
|
||||
sendToLogin();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
sendToLogin();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
/* private void StartAnimations() {
|
||||
Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
|
||||
anim.reset();
|
||||
LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
|
||||
l.clearAnimation();
|
||||
l.startAnimation(anim);
|
||||
|
||||
anim = AnimationUtils.loadAnimation(this, R.anim.translate);
|
||||
anim.reset();
|
||||
ImageView iv = (ImageView) findViewById(R.id.logo);
|
||||
iv.clearAnimation();
|
||||
iv.startAnimation(anim);
|
||||
|
||||
}*/
|
||||
|
||||
public void sendToLogin() {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
|
||||
/*
|
||||
* Showing splash screen with a timer. This will be useful when you
|
||||
* want to show case your app logo / company
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//after Mpin
|
||||
String mpin = preferences.getString(CommonString.MPIN, null);
|
||||
if (mpin != null) {
|
||||
Intent in = new Intent(context, MPinActivity.class);
|
||||
in.putExtra(CommonString.IS_PASSWORD_CHECK, true);
|
||||
startActivity(in);
|
||||
finish();
|
||||
} else {
|
||||
Intent i = new Intent(context, LoginActivity.class);
|
||||
startActivity(i);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
}, SPLASH_TIME_OUT);
|
||||
}
|
||||
|
||||
public static String getCalculatedDate(String date, String dateFormat, int days) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
@SuppressLint("SimpleDateFormat") SimpleDateFormat s = new SimpleDateFormat(dateFormat);
|
||||
cal.add(Calendar.DAY_OF_YEAR, days);
|
||||
try {
|
||||
return s.format(new Date(s.parse(date).getTime()));
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.e("TAG", "Error in Parsing Date : " + e.getMessage());
|
||||
// Optional: hide the status bar safely
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
}catch (Exception ignored){}
|
||||
setContentView(R.layout.activity_splash_main_layout);
|
||||
linearLayout = findViewById(R.id.lin_lay);
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
startSplashTimer();
|
||||
}
|
||||
|
||||
|
||||
private void sendToLogin() {
|
||||
try {
|
||||
String mpin = preferences.getString(CommonString.MPIN, null);
|
||||
Intent intent;
|
||||
if (mpin != null) {
|
||||
intent = new Intent(this, MPinActivity.class);
|
||||
intent.putExtra(CommonString.IS_PASSWORD_CHECK, true);
|
||||
} else {
|
||||
intent = new Intent(this, LoginActivity.class);
|
||||
}
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} catch (Exception ignored) {} finally {
|
||||
String mpin = preferences.getString(CommonString.MPIN, null);
|
||||
Intent intent;
|
||||
if (mpin != null) {
|
||||
intent = new Intent(this, MPinActivity.class);
|
||||
intent.putExtra(CommonString.IS_PASSWORD_CHECK, true);
|
||||
} else {
|
||||
intent = new Intent(this, LoginActivity.class);
|
||||
}
|
||||
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private void startSplashTimer() {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(this::sendToLogin, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package cpm.com.gskmtorange.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
import cpm.com.gskmtorange.databinding.ItemRealtimePdBinding
|
||||
|
||||
class RealtimeAdapter(
|
||||
val category: String?,
|
||||
var context: Context,
|
||||
private var subcates: ArrayList<CategoryPictureGetterSetter>?,
|
||||
private val btnlistener: BtnClickListener,
|
||||
) : RecyclerView.Adapter<RealtimeAdapter.CustomViewHolder>() {
|
||||
class CustomViewHolder(view: View) : RecyclerView.ViewHolder(view)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CustomViewHolder(
|
||||
ItemRealtimePdBinding.inflate(LayoutInflater.from(context), parent, false).root
|
||||
)
|
||||
|
||||
@SuppressLint(
|
||||
"NotifyDataSetChanged", "ClickableViewAccessibility",
|
||||
"UseCompatLoadingForDrawables", "SetTextI18n"
|
||||
)
|
||||
override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {
|
||||
ItemRealtimePdBinding.bind(holder.itemView).apply {
|
||||
val subcat = subcates!![position]
|
||||
tvSubCategory.text = "$category-${subcat.suB_CATEGORY}"
|
||||
analyticBT.text = context.getString(R.string.view_report_pd)
|
||||
analyticBT.setOnClickListener {
|
||||
btnlistener.onStartSessionClick(position, subcat)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return subcates!!.size
|
||||
}
|
||||
|
||||
interface BtnClickListener {
|
||||
fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter)
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun addsubCatItems(langList: ArrayList<CategoryPictureGetterSetter>?) {
|
||||
subcates = langList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun updateItem(position: Int, uris: List<ImageUri>) {
|
||||
subcates!![position].imageUris = (subcates!![position].imageUris
|
||||
?: ArrayList()).apply { addAll(uris as ArrayList<ImageUri>) }
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cpm.com.gskmtorange.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -24,6 +25,7 @@ class SavedImagesAdapter(private val context: Context, private val images: List<
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SavedImageViewHolder, position: Int) {
|
||||
Log.d("imagedata",images[position].uri)
|
||||
imgPreviewwithError(
|
||||
context = context,
|
||||
url = images[position].uri,
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
package cpm.com.gskmtorange.adapter
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import cpm.com.gskmtorange.dailyentry.WebViewActivity
|
||||
import cpm.com.gskmtorange.databinding.ItemCategoryScoreBinding
|
||||
import cpm.com.gskmtorange.databinding.ItemOverallScoreBinding
|
||||
import cpm.com.gskmtorange.databinding.ItemPdImageBinding
|
||||
import cpm.com.gskmtorange.utils.ScoreItem
|
||||
|
||||
class ScoreAdapter(private val items: List<ScoreItem>) :
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
private val TYPE_OVERALL = 0
|
||||
private val TYPE_CATEGORY = 1
|
||||
private val TYPE_IMAGE = 2
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return when (items[position]) {
|
||||
is ScoreItem.OverallScore -> TYPE_OVERALL
|
||||
is ScoreItem.CategoryScore -> TYPE_CATEGORY
|
||||
is ScoreItem.ImageItem -> TYPE_IMAGE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
return when (viewType) {
|
||||
TYPE_OVERALL -> {
|
||||
val binding = ItemOverallScoreBinding.inflate(inflater, parent, false)
|
||||
OverallViewHolder(binding)
|
||||
}
|
||||
TYPE_CATEGORY -> {
|
||||
val binding = ItemCategoryScoreBinding.inflate(inflater, parent, false)
|
||||
CategoryViewHolder(binding)
|
||||
}
|
||||
TYPE_IMAGE -> {
|
||||
val binding = ItemPdImageBinding.inflate(inflater, parent, false)
|
||||
ImageViewHolder(binding)
|
||||
}
|
||||
else -> throw IllegalArgumentException("Invalid view type")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (val item = items[position]) {
|
||||
is ScoreItem.OverallScore -> (holder as OverallViewHolder).bind(item)
|
||||
is ScoreItem.CategoryScore -> (holder as CategoryViewHolder).bind(item)
|
||||
is ScoreItem.ImageItem -> (holder as ImageViewHolder).bind(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
class OverallViewHolder(private val binding: ItemOverallScoreBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: ScoreItem.OverallScore) {
|
||||
binding.tvOsa.text = "OSA: ${item.osa}"
|
||||
binding.tvMsl.text = "MSL: ${item.msl}"
|
||||
binding.tvPosm.text = "POSM: ${item.posm}"
|
||||
binding.tvSosSku.text = "SOS (SKU): ${item.sosSku}"
|
||||
binding.tvSosBrand.text = "SOS (Brand): ${item.sosBrand}"
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryViewHolder(private val binding: ItemCategoryScoreBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: ScoreItem.CategoryScore) {
|
||||
binding.tvCategory.text = item.categoryName
|
||||
binding.tvMsl.text = "MSL: ${item.msl}"
|
||||
binding.tvPosm.text = "POSM: ${item.posm}"
|
||||
binding.tvSosSku.text = "SOS (SKU): ${item.sosSku}"
|
||||
binding.tvSosBrand.text = "SOS (Brand): ${item.sosBrand}"
|
||||
|
||||
binding.layoutBrands.removeAllViews()
|
||||
for (brand in item.brandDetails) {
|
||||
val tv = TextView(binding.root.context)
|
||||
tv.text = "${brand.first}: ${brand.second}"
|
||||
binding.layoutBrands.addView(tv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ImageViewHolder(private val binding: ItemPdImageBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: ScoreItem.ImageItem) {
|
||||
Log.d("itemuri",item.url)
|
||||
/* binding.btnViewImage.setOnClickListener {
|
||||
val context = binding.root.context
|
||||
val intent = Intent(context, WebViewActivity::class.java)
|
||||
intent.putExtra("url", item.url)
|
||||
context.startActivity(intent)
|
||||
}*/
|
||||
val actualUrl = if (item.url.contains("?url=")) {
|
||||
item.url.substringAfter("?url=") // extract the real image link
|
||||
} else item.url
|
||||
|
||||
Glide.with(binding.ivRawImage.context)
|
||||
.load(actualUrl)
|
||||
//.placeholder(R.drawable.ic_placeholder) // optional
|
||||
// .error(R.drawable.ic_broken_image) // fallback if fail
|
||||
.into(binding.ivRawImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -29,10 +32,6 @@ import android.app.AlertDialog;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 13-11-2017.
|
||||
*/
|
||||
|
||||
public class CommonFunctions {
|
||||
public static boolean updateLangResources(Context context, String language) {
|
||||
String lang;
|
||||
@@ -153,7 +152,6 @@ public class CommonFunctions {
|
||||
inSampleSize *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
return inSampleSize;
|
||||
}
|
||||
|
||||
@@ -210,4 +208,29 @@ public class CommonFunctions {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isInternetAvailable(Context context) {
|
||||
ConnectivityManager connectivityManager =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (connectivityManager == null)
|
||||
return false;
|
||||
|
||||
Network network = connectivityManager.getActiveNetwork();
|
||||
if (network == null)
|
||||
return false;
|
||||
|
||||
NetworkCapabilities capabilities =
|
||||
connectivityManager.getNetworkCapabilities(network);
|
||||
if (capabilities == null)
|
||||
return false;
|
||||
|
||||
return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
|
||||
capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,16 +8,20 @@ import cpm.com.gskmtorange.AppUtils;
|
||||
/**
|
||||
* Created by yadavendras on 19-12-2016.
|
||||
*/
|
||||
|
||||
public class CommonString {
|
||||
public static final String BACKUP_PATH = Environment.getExternalStorageDirectory().getPath() + "/gsk_orange_backup";
|
||||
// webservice constants
|
||||
// preferenec keys
|
||||
public static final String PD_PROJECT_iD = "4f57635b-6b07-45bf-bfba-c61c2826b6db";
|
||||
public static final String KEY_PD_PROJECT_Id = "PD_PROJECT_Id";
|
||||
public static final String KEY_PD_USER_Id = "PD_USER_Id";
|
||||
public static final String KEY_USERNAME = "username";
|
||||
public static final String KEY_PASSWORD = "password";
|
||||
public static final String KEY_DATE = "date";
|
||||
public static final String KEY_COUNTRY_ID = "COUNTRY_ID";
|
||||
public static final String KEY_STOREVISITED_STATUS = "STOREVISITED_STATUS";
|
||||
public static final String KEY_SAVE_MODE = "SAVE_MODE";
|
||||
public static final String KEY_DRAFT = "DRAFT";
|
||||
public static final String KEY_COMPELETE = "COMPELETE";
|
||||
|
||||
|
||||
public static final String KEY_PATH = "path";
|
||||
@@ -98,6 +102,7 @@ public class CommonString {
|
||||
public static final String KEY_NON_T2P_REASON_ID = "TREASON_ID";
|
||||
|
||||
public static final String KEY_JOURNEY_PLAN = "JOURNEY_PLAN";
|
||||
public static final String KEY_NOTICE_BOARD = "Mer_NoticeBoard";
|
||||
public static final String KEY_ADHOC_JOURNEY_PLAN = "ADHOC_JOURNEYPLAN";
|
||||
public static final String KEY_JOURNEY_PLAN_ADDITIONAL = "JOURNEY_PLAN_ADDITIONAL";
|
||||
public static final String KEY_JOURNEY_PLAN_PHARMA = "JOURNEY_PLAN_PHARMA";
|
||||
@@ -135,6 +140,7 @@ public class CommonString {
|
||||
public static final String KEY_SUB_CATEGORY = "SUB_CATEGORY";
|
||||
public static final String KEY_SUB_CATEGORY_ID = "SUB_CATEGORY_ID";
|
||||
public static final String KEY_SUB_CATEGORY_CODE = "SUB_CATEGORY_CODE";
|
||||
public static final String KEY_SUB_CATEGORY_ENGLISH = "SUB_CATEGORY_ENGLISH";
|
||||
public static final String KEY_FROM = "FROM";
|
||||
public static final String KEY_CHAT_ID = "CHAT_ID";
|
||||
public static final String KEY_MESSAGE = "MESSAGE";
|
||||
@@ -146,16 +152,14 @@ public class CommonString {
|
||||
public static final int UNIT_VERTICAL = 50;
|
||||
public static final int UNIT_HORIZONTAL = 200;
|
||||
|
||||
// public static String URL = "http://gskme.parinaam.in/Gskwebservice.asmx";
|
||||
public static String URL = "http://gskmeIR.parinaam.in/Gskwebservice.asmx";
|
||||
// public static String URL = "https://gskme1.parinaam.in/Gskwebservice.asmx";
|
||||
// public static String URL = "http://gskme.parinaam.in/Gskwebservice.asmx";
|
||||
// public static String URL = "http://gskmeIR.parinaam.in/Gskwebservice.asmx";
|
||||
// public static String URL = "https://gskme2.parinaam.in/Gskwebservice.asmx";
|
||||
//Added new Test url for Turkey
|
||||
// public static String URL = "http://gskmetest.parinaam.in/Gskwebservice.asmx";
|
||||
|
||||
// public static String URL = "https://haleonme.parinaam.in/Gskwebservice.asmx";
|
||||
//public static String URL = " https://gskme1.parinaam.in/Gskwebservice.asmx";
|
||||
//public static String URL = "https://gskme-test.parinaam.in/Gskwebservice.asmx";
|
||||
|
||||
public static String URL = "https://haleonme.parinaam.in/Gskwebservice.asmx";
|
||||
// public static String URL = "https://gskme2.parinaam.in/Gskwebservice.asmx";
|
||||
public static final String NAMESPACE = "http://tempuri.org/";
|
||||
public static final String METHOD_LOGIN = "UserLoginDetail";
|
||||
public static final String SOAP_ACTION_LOGIN = "http://tempuri.org/"
|
||||
@@ -695,7 +699,8 @@ public class CommonString {
|
||||
+ KEY_SKU_ID + " VARCHAR," + KEY_QUANTITY + " VARCHAR," + KEY_Common_ID + " VARCHAR,"
|
||||
+ "categoryId" + " VARCHAR,"
|
||||
+ KEY_SKUNAME + " VARCHAR,"
|
||||
+ KEY_PROCESS_ID + " VARCHAR)";
|
||||
+ KEY_SUB_CATEGORY_ID + " VARCHAR,"
|
||||
+ KEY_SUB_CATEGORY + " VARCHAR)";
|
||||
|
||||
//Tables related to T2p Compliance
|
||||
|
||||
@@ -1132,6 +1137,12 @@ public class CommonString {
|
||||
+ "QTYPE"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SUB_CATEGORY"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "ANSWER"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "ANSWER_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
@@ -1147,6 +1158,7 @@ public class CommonString {
|
||||
public static String MPIN = "MPIN";
|
||||
public static String TABLE_MAPPING_STOCK_ADHOC = "MAPPING_STOCK_ADHOC";
|
||||
public static String TABLE_MAPPING_STOCK = "MAPPING_STOCK";
|
||||
public static String TABLE_MASTER_STORELIST_PD = "Master_StoreList_PDA";
|
||||
public static String TABLE_MAPPING_STOCK_STOREWISE = "MAPPING_STOCK_STOREWISE";
|
||||
public static String TABLE_MAPPING_STOCK_ADDITIONAL = "MAPPING_STOCK_ADDITIONAL";
|
||||
public static String TABLE_MAPPING_T2P_ADHOC = "MAPPING_T2P_ADHOC";
|
||||
@@ -1240,6 +1252,15 @@ public class CommonString {
|
||||
|
||||
public static final String TABLE_INSERT_STOCK = "Stock_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_DATA = "CREATE TABLE IF NOT EXISTS " + TABLE_INSERT_STOCK
|
||||
+ " ("
|
||||
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ "Store_Id INTEGER, " + KEY_VISIT_DATE + " VARCHAR,"
|
||||
+ "Category_Id INTEGER," + "Brand_Id INTEGER,"
|
||||
+ "SKU_ID INTEGER," + "SKU VARCHAR," + "SKU_SEQUENCE INTEGER,"
|
||||
+ "MBQ INTEGER," + "STOCK INTEGER," + "COMPANY_ID INTEGER," + "TOGGLE_VALUE VARCHAR,"
|
||||
+ "MUST_HAVE VARCHAR)";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_ENTRY = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_STOCK_ENTRY
|
||||
+ "("
|
||||
@@ -1434,7 +1455,6 @@ public class CommonString {
|
||||
public static final String CREATE_TABLE_INSERT_ORDER_TAKING_DATA = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_ORDER_TAKING_DATA
|
||||
+ " ("
|
||||
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
@@ -1465,9 +1485,18 @@ public class CommonString {
|
||||
+ "SKU_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SUBCAT_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "BRAND"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SUBCAT"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "SKU_SEQUENCE"
|
||||
+ " VARCHAR,"
|
||||
|
||||
@@ -1536,6 +1565,7 @@ public class CommonString {
|
||||
|
||||
public static final String KEY_IRPD_IMAGES = "IRPD_IMAGES";
|
||||
public static final String KEY_IRPD_MODIFY_IMAGES = "IRPD_IMAGES_MODIFY";
|
||||
public static final String KEY_TOGGLE_VALUE = "TOGGLE_VALUE";
|
||||
public static final String TABLE_IRPD = "DR_IRPD";
|
||||
public static final String CREATE_TABLE_IRPD = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_IRPD
|
||||
@@ -1546,6 +1576,34 @@ public class CommonString {
|
||||
+ " INTEGER,"
|
||||
+ KEY_VISIT_DATE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_SAVE_MODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_CODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_MODIFY_IMAGES
|
||||
+ " VARCHAR,"
|
||||
+ KEY_TOGGLE_VALUE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
|
||||
public static final String TABLE_IRPD_POG = "DR_IRPD_POG";
|
||||
public static final String CREATE_TABLE_IRPD_POG = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_IRPD_POG
|
||||
+ " ("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_STORE_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_VISIT_DATE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_SAVE_MODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_ID
|
||||
@@ -1557,6 +1615,33 @@ public class CommonString {
|
||||
+ KEY_IRPD_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
public static final String KEY_IRPD_VISIBILITY_IMAGES = "IRPD_VISIBILITY_IMAGES";
|
||||
public static final String KEY_IRPD_VISIBILITY_MODIFY_IMAGES = "IRPD_VISIBILITY_IMAGES_MODIFY";
|
||||
public static final String TABLE_IRPD_VISIBILITY = "DR_IRPD_VISIBILITY";
|
||||
public static final String CREATE_TABLE_IRPD_VISIBILITY = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_IRPD_VISIBILITY
|
||||
+ " ("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_STORE_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_VISIT_DATE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_SAVE_MODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_CODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_MODIFY_IMAGES
|
||||
+ " VARCHAR,"
|
||||
+ KEY_TOGGLE_VALUE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
public static final String BACKUP_FOLDER_NAME = "HaleonMT_Backup";
|
||||
public static final String IMAGE_FOLDER_NAME = "HaleonMT_Images";
|
||||
public static final String Download_IMAGE_FOLDER = "Downloaded_HaleonMT_Images";
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package cpm.com.gskmtorange.constant
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.util.Patterns
|
||||
import android.widget.ImageView
|
||||
import androidx.core.net.toUri
|
||||
import androidx.swiperefreshlayout.widget.CircularProgressDrawable
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.Priority
|
||||
@@ -13,10 +14,10 @@ import com.sj.camera_lib_android.utils.CameraSDK.init
|
||||
import java.io.File
|
||||
|
||||
object CommonUtils {
|
||||
fun initializePDSDK(context: Context?, _userId: String?) {
|
||||
fun initializePDSDK(context: Context?,projectId:String, _userId: String?) {
|
||||
if (context != null) {
|
||||
if (_userId != null) {
|
||||
init(context, CommonString.PD_PROJECT_iD, _userId)
|
||||
init(context = context, projectId = projectId, userId = _userId,uploadToSWServer = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +31,6 @@ object CommonUtils {
|
||||
val options: RequestOptions =
|
||||
RequestOptions().centerCrop().placeholder(circularProgressDrawable).error(resId)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).priority(Priority.HIGH)
|
||||
|
||||
Glide.with(context).load(url).apply(options).into(imgView)
|
||||
}
|
||||
|
||||
@@ -39,18 +39,14 @@ object CommonUtils {
|
||||
}
|
||||
|
||||
fun deleteSpecificImage(context: Context,filePath: String?) {
|
||||
val file = File(context.filesDir, "")
|
||||
if (!filePath.isNullOrEmpty()) {
|
||||
val file = File(filePath)
|
||||
val file = File(filePath)
|
||||
if (file.exists()) {
|
||||
val directory = file.parent // Get the directory path
|
||||
val imageName = file.name // Get the image file name
|
||||
println("Directory: $directory")
|
||||
println("Image Name: $imageName")
|
||||
if (file.delete()) {
|
||||
println("File deleted successfully: $filePath")
|
||||
val isDeleted = file.delete()
|
||||
if (isDeleted) {
|
||||
Log.d("deletefile","File deleted successfully");
|
||||
} else {
|
||||
println("Failed to delete file: $filePath")
|
||||
println("Failed to delete file")
|
||||
}
|
||||
} else {
|
||||
println("File does not exist: $filePath")
|
||||
@@ -59,7 +55,7 @@ object CommonUtils {
|
||||
}
|
||||
|
||||
fun deleteImage(context: Context, filePath: String) {
|
||||
val uri = Uri.parse(filePath)
|
||||
val uri = filePath.toUri()
|
||||
val contentResolver = context.contentResolver
|
||||
val deleted = contentResolver.delete(uri, null, null)
|
||||
if (deleted > 0) {
|
||||
|
||||
+179
-342
@@ -1,5 +1,6 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@@ -219,84 +220,66 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
switch (parent.getId()) {
|
||||
case R.id.sp_sub_category:
|
||||
if (parent.getId() == R.id.sp_sub_category) {
|
||||
|
||||
if (position != 0) {
|
||||
sub_category = sub_category_list.get(position).getSub_category();
|
||||
sub_category_id = sub_category_list.get(position).getSub_category_id();
|
||||
if (position != 0) {
|
||||
sub_category = sub_category_list.get(position).getSub_category();
|
||||
sub_category_id = sub_category_list.get(position).getSub_category_id();
|
||||
|
||||
brand_list = db.getBrandMasterDataBySubCategory(sub_category_id);
|
||||
brand_list = db.getBrandMasterDataBySubCategory(sub_category_id);
|
||||
|
||||
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||
String str = getResources().getString(R.string.select);
|
||||
brand_select.setBRAND(str);
|
||||
brand_select.setBRAND_ID("0");
|
||||
brand_list.add(0, brand_select);
|
||||
CustomBrandAdapter adapter = new CustomBrandAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||
String str = getResources().getString(R.string.select);
|
||||
brand_select.setBRAND(str);
|
||||
brand_select.setBRAND_ID("0");
|
||||
brand_list.add(0, brand_select);
|
||||
|
||||
spinner_brand_list.setAdapter(adapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
CustomBrandAdapter adapter = new CustomBrandAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
spinner_brand_list.setAdapter(adapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
clearBrandSpinner();
|
||||
}
|
||||
|
||||
clearBrandSpinner();
|
||||
}
|
||||
} else if (parent.getId() == R.id.sp_brand) {
|
||||
|
||||
break;
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = brand_list.get(position).getBRAND_ID().get(0);
|
||||
|
||||
case R.id.sp_brand:
|
||||
sku_list = db.getSKUMasterNewData(brand_id);
|
||||
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = brand_list.get(position).getBRAND_ID().get(0);
|
||||
SkuMasterGetterSetter sku_select = new SkuMasterGetterSetter();
|
||||
String str = getResources().getString(R.string.select);
|
||||
sku_select.setSKU(str);
|
||||
sku_select.setSKU_ID("0");
|
||||
sku_list.add(0, sku_select);
|
||||
|
||||
sku_list = db.getSKUMasterNewData(brand_id);
|
||||
CustomSkuAdapter adapter = new CustomSkuAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
spinner_sku_list.setAdapter(adapter);
|
||||
spinner_sku_list.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
clearSkuSpinner();
|
||||
}
|
||||
|
||||
SkuMasterGetterSetter sku_select = new SkuMasterGetterSetter();
|
||||
String str = getResources().getString(R.string.select);
|
||||
sku_select.setSKU(str);
|
||||
sku_select.setSKU_ID("0");
|
||||
sku_list.add(0, sku_select);
|
||||
CustomSkuAdapter adapter = new CustomSkuAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
} else if (parent.getId() == R.id.sp_sku) {
|
||||
|
||||
spinner_sku_list.setAdapter(adapter);
|
||||
spinner_sku_list.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
if (position != 0) {
|
||||
sku = sku_list.get(position).getSKU().get(0);
|
||||
sku_id = sku_list.get(position).getSKU_ID().get(0);
|
||||
}
|
||||
|
||||
clearSkuSpinner();
|
||||
}
|
||||
} else if (parent.getId() == R.id.sp_flasher) {
|
||||
|
||||
break;
|
||||
|
||||
case R.id.sp_sku:
|
||||
|
||||
if (position != 0) {
|
||||
sku = sku_list.get(position).getSKU().get(0);
|
||||
sku_id = sku_list.get(position).getSKU_ID().get(0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R.id.sp_flasher:
|
||||
|
||||
switch (position) {
|
||||
|
||||
case 0:
|
||||
|
||||
price_flasher_available = -1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
price_flasher_available = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
price_flasher_available = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
if (position == 0) {
|
||||
price_flasher_available = -1;
|
||||
} else if (position == 1) {
|
||||
price_flasher_available = 1;
|
||||
} else if (position == 2) {
|
||||
price_flasher_available = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -336,222 +319,154 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
switch (id) {
|
||||
if (id == R.id.fab) {
|
||||
|
||||
case R.id.fab:
|
||||
boolean valid_flag = true;
|
||||
|
||||
boolean valid_flag = true;
|
||||
if (isExists) {
|
||||
if (added_promo_list.size() == 0) {
|
||||
valid_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isExists) {
|
||||
if (added_promo_list.size() == 0) {
|
||||
valid_flag = false;
|
||||
}
|
||||
if (!valid_flag) {
|
||||
Snackbar.make(rec_added_promo, R.string.title_activity_Want_add, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (isdata_added) {
|
||||
db.InsertPromoSKUwiseData(added_promo_list, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
} else if (id == R.id.fab_add) {
|
||||
|
||||
discount = et_discount.getText().toString();
|
||||
price = et_price.getText().toString();
|
||||
|
||||
if (sub_category.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_sub_category, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_brand, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (sku.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_sku, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (price.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_enter_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (!price.equals("") && price.substring(0, 1).equals(".")) {
|
||||
Snackbar.make(rec_added_promo, R.string.incorrect_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (is_camera_compulsory && img_str.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (price_flasher_available == -1) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
PromoComplianceSkuwiseGetterSetter promo = new PromoComplianceSkuwiseGetterSetter();
|
||||
promo.setBrand(brand);
|
||||
promo.setBrand_id(brand_id);
|
||||
promo.setSub_category(sub_category);
|
||||
promo.setSub_category_id(sub_category_id);
|
||||
promo.setSku(sku);
|
||||
promo.setSku_id(sku_id);
|
||||
promo.setImg(img_str);
|
||||
promo.setDiscount_value(discount);
|
||||
promo.setPrice(price);
|
||||
promo.setPrice_flasher(price_flasher_available);
|
||||
added_promo_list.add(promo);
|
||||
|
||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
|
||||
PromoAdapter gapAdapter = new PromoAdapter(added_promo_list);
|
||||
rec_added_promo.setAdapter(gapAdapter);
|
||||
|
||||
sub_category = "";
|
||||
sub_category_id = "0";
|
||||
brand = "";
|
||||
brand_id = "0";
|
||||
sku = "";
|
||||
sku_id = "0";
|
||||
discount = "";
|
||||
price = "";
|
||||
img_str = "";
|
||||
price_flasher_available = -1;
|
||||
|
||||
et_discount.setText("");
|
||||
et_price.setText("");
|
||||
spinner_sub_category_list.setSelection(0);
|
||||
clearBrandSpinner();
|
||||
clearSkuSpinner();
|
||||
sp_flasher.setSelection(0);
|
||||
|
||||
if (is_camera_compulsory) {
|
||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
} else {
|
||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
}
|
||||
|
||||
if (!valid_flag) {
|
||||
Snackbar.make(rec_added_promo, R.string.title_activity_Want_add, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (isdata_added) {
|
||||
isdata_added = true;
|
||||
}
|
||||
|
||||
db.InsertPromoSKUwiseData(added_promo_list, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
} else if (id == R.id.img_promotion_add) {
|
||||
|
||||
/*String promotion_sku_wise_data_xml = "", add_promotion_data_xml = "", exists_xml = "", add_xml = "";
|
||||
_pathforcheck = "Additional_Promo_Skuwise_Image" + store_id + categoryId + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
|
||||
db.open();
|
||||
ArrayList<PromoComplianceSkuwiseGetterSetter> promoComplianceSkuwiseGetterSetters, promoComplianceSkuwiseExistsGetterSetters;
|
||||
promoComplianceSkuwiseExistsGetterSetters = db.getPromoComplianceSkuwiseExistsAfterData(store_id, null);
|
||||
if (promoComplianceSkuwiseExistsGetterSetters.size() > 0) {
|
||||
startCameraActivity(1);
|
||||
|
||||
for (int l = 0; l < promoComplianceSkuwiseExistsGetterSetters.size(); l++) {
|
||||
} else if (id == R.id.btntoggle) {
|
||||
|
||||
promoComplianceSkuwiseGetterSetters = db.getPromoComplianceSkuwiseAfterData(promoComplianceSkuwiseExistsGetterSetters.get(l).get_id(), null);
|
||||
isExists = btntoggle.isChecked();
|
||||
|
||||
for (int i1 = 0; i1 < promoComplianceSkuwiseGetterSetters.size(); i1++) {
|
||||
if (!promoComplianceSkuwiseGetterSetters.get(i1).getCategory_id().equals("0")) {
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
fab_add.show();
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalPromoSKUwiseActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
fab_add.hide();
|
||||
added_promo_list.clear();
|
||||
|
||||
String discount_val = promoComplianceSkuwiseGetterSetters.get(i1).getDiscount_value();
|
||||
if (discount_val.equals("")) {
|
||||
discount_val = "0";
|
||||
}
|
||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
|
||||
promoAdapter = new PromoAdapter(added_promo_list);
|
||||
rec_added_promo.setAdapter(promoAdapter);
|
||||
|
||||
add_xml = "[PROMOTION_DATA]"
|
||||
+ "[MID]" + "0" + "[/MID]"
|
||||
+ "[USER_ID]" + username + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(promoComplianceSkuwiseGetterSetters.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_ID]" + Integer.parseInt(promoComplianceSkuwiseGetterSetters.get(i1).getSub_category_id()) + "[/SUB_CATEGORY_ID]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(promoComplianceSkuwiseGetterSetters.get(i1).getSku_id()) + "[/SKU_ID]"
|
||||
+ "[BRAND_ID]" + Integer.parseInt(promoComplianceSkuwiseGetterSetters.get(i1).getBrand_id()) + "[/BRAND_ID]"
|
||||
+ "[DISCOUNT_VALUE]" + discount_val + "[/DISCOUNT_VALUE]"
|
||||
+ "[PRICE]" + promoComplianceSkuwiseGetterSetters.get(i1).getPrice() + "[/PRICE]"
|
||||
+ "[PROMO_IMAGE]" + promoComplianceSkuwiseGetterSetters.get(i1).getImg() + "[/PROMO_IMAGE]"
|
||||
+ "[PRICE_FLASHER_AVAILABLE]" + promoComplianceSkuwiseGetterSetters.get(i1).getPrice_flasher() + "[/PRICE_FLASHER_AVAILABLE]"
|
||||
+ "[/PROMOTION_DATA]";
|
||||
add_promotion_data_xml = add_promotion_data_xml + add_xml;
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
|
||||
sub_category = "";
|
||||
sub_category_id = "0";
|
||||
brand = "";
|
||||
brand_id = "0";
|
||||
sku = "";
|
||||
sku_id = "0";
|
||||
discount = "";
|
||||
price = "";
|
||||
img_str = "";
|
||||
|
||||
et_discount.setText("");
|
||||
et_price.setText("");
|
||||
spinner_sub_category_list.setSelection(0);
|
||||
clearBrandSpinner();
|
||||
clearSkuSpinner();
|
||||
|
||||
if (is_camera_compulsory) {
|
||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
} else {
|
||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
}
|
||||
|
||||
isdata_added = true;
|
||||
}
|
||||
|
||||
int exists = 0;
|
||||
if (promoComplianceSkuwiseExistsGetterSetters.get(l).isExists()) {
|
||||
exists = 1;
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
|
||||
exists_xml = "[ADDITIONAL_PROMOTION_SKUWISE_DATA]"
|
||||
+ "[MID]" + "0" + "[/MID]"
|
||||
+ "[USER_ID]" + username + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(promoComplianceSkuwiseExistsGetterSetters.get(l).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[IS_EXISTS]" + exists + "[/IS_EXISTS]"
|
||||
+ "[ADDITIONAL_PROMOTION_DATA]" + add_promotion_data_xml + "[/ADDITIONAL_PROMOTION_DATA]"
|
||||
+ "[/ADDITIONAL_PROMOTION_SKUWISE_DATA]";
|
||||
|
||||
promotion_sku_wise_data_xml = promotion_sku_wise_data_xml + exists_xml;
|
||||
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + promotion_sku_wise_data_xml + "[/DATA]";
|
||||
Log.d("sosdata", sos_xml);
|
||||
}*/
|
||||
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R.id.fab_add:
|
||||
discount = et_discount.getText().toString();
|
||||
price = et_price.getText().toString();
|
||||
if (sub_category.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_sub_category, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_brand, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (sku.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_sku, Snackbar.LENGTH_SHORT).show();
|
||||
}/*else if(discount.equals("")){
|
||||
Snackbar.make(rec_added_promo, R.string.pls_enter_discount,Snackbar.LENGTH_SHORT).show();
|
||||
}*/ else if (price.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_enter_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (!price.equals("") && price.substring(0, 1).equals(".")) {
|
||||
Snackbar.make(rec_added_promo, R.string.incorrect_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (is_camera_compulsory && img_str.equals("")) {
|
||||
Snackbar.make(rec_added_promo, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (price_flasher_available == -1) {
|
||||
Snackbar.make(rec_added_promo, R.string.pls_select_price, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
PromoComplianceSkuwiseGetterSetter promo = new PromoComplianceSkuwiseGetterSetter();
|
||||
promo.setBrand(brand);
|
||||
promo.setBrand_id(brand_id);
|
||||
promo.setSub_category(sub_category);
|
||||
promo.setSub_category_id(sub_category_id);
|
||||
promo.setSku(sku);
|
||||
promo.setSku_id(sku_id);
|
||||
promo.setImg(img_str);
|
||||
promo.setDiscount_value(discount);
|
||||
promo.setPrice(price);
|
||||
promo.setPrice_flasher(price_flasher_available);
|
||||
added_promo_list.add(promo);
|
||||
|
||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
|
||||
PromoAdapter gapAdapter = new PromoAdapter(added_promo_list);
|
||||
rec_added_promo.setAdapter(gapAdapter);
|
||||
|
||||
sub_category = "";
|
||||
sub_category_id = "0";
|
||||
brand = "";
|
||||
brand_id = "0";
|
||||
sku = "";
|
||||
sku_id = "0";
|
||||
discount = "";
|
||||
price = "";
|
||||
img_str = "";
|
||||
price_flasher_available = -1;
|
||||
|
||||
et_discount.setText("");
|
||||
et_price.setText("");
|
||||
spinner_sub_category_list.setSelection(0);
|
||||
clearBrandSpinner();
|
||||
clearSkuSpinner();
|
||||
sp_flasher.setSelection(0);
|
||||
|
||||
if (is_camera_compulsory) {
|
||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
} else {
|
||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
}
|
||||
isdata_added = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R.id.img_promotion_add:
|
||||
|
||||
_pathforcheck = "Additional_Promo_Skuwise_Image" + store_id + categoryId + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
|
||||
startCameraActivity(1);
|
||||
break;
|
||||
|
||||
case R.id.btntoggle:
|
||||
isExists = btntoggle.isChecked();
|
||||
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
fab_add.show();//.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalPromoSKUwiseActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
fab_add.hide();//.setVisibility(View.GONE);
|
||||
added_promo_list.clear();
|
||||
|
||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
|
||||
promoAdapter = new PromoAdapter(added_promo_list);
|
||||
rec_added_promo.setAdapter(promoAdapter);
|
||||
|
||||
/* if(promoAdapter!=null){
|
||||
promoAdapter.list.clear();
|
||||
promoAdapter.notifyDataSetChanged();
|
||||
}*/
|
||||
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
|
||||
sub_category = "";
|
||||
sub_category_id = "0";
|
||||
brand = "";
|
||||
brand_id = "0";
|
||||
sku = "";
|
||||
sku_id = "0";
|
||||
discount = "";
|
||||
price = "";
|
||||
img_str = "";
|
||||
|
||||
et_discount.setText("");
|
||||
et_price.setText("");
|
||||
spinner_sub_category_list.setSelection(0);
|
||||
clearBrandSpinner();
|
||||
clearSkuSpinner();
|
||||
if (is_camera_compulsory) {
|
||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
} else {
|
||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
}
|
||||
isdata_added = true;
|
||||
|
||||
}
|
||||
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//checkBox.setChecked(true);
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
break;
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -877,90 +792,12 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("MissingSuperCall")
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
ischanged();
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_promo_skuwise, menu);
|
||||
|
||||
final CheckBox checkBox = (CheckBox) menu.findItem(R.id.menuShowDue).getActionView();
|
||||
checkBox.setText(R.string.exists);
|
||||
checkBox.setChecked(isExists);
|
||||
|
||||
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
isExists = isChecked;
|
||||
|
||||
if(isExists){
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
fab_add.show();//.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalPromoSKUwiseActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
fab_add.hide();//.setVisibility(View.GONE);
|
||||
added_promo_list.clear();
|
||||
|
||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
promoAdapter = new PromoAdapter(added_promo_list);
|
||||
rec_added_promo.setAdapter(promoAdapter);
|
||||
|
||||
*//* if(promoAdapter!=null){
|
||||
promoAdapter.list.clear();
|
||||
promoAdapter.notifyDataSetChanged();
|
||||
}*//*
|
||||
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
|
||||
sub_category = "";
|
||||
sub_category_id = "0";
|
||||
brand= "";
|
||||
brand_id = "0";
|
||||
sku = "";
|
||||
sku_id = "0";
|
||||
discount = "";
|
||||
price = "";
|
||||
img_str = "";
|
||||
|
||||
et_discount.setText("");
|
||||
et_price.setText("");
|
||||
spinner_sub_category_list.setSelection(0);
|
||||
clearBrandSpinner();
|
||||
clearSkuSpinner();
|
||||
if(is_camera_compulsory){
|
||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
}
|
||||
else {
|
||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
}
|
||||
isdata_added = true;
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
checkBox.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
|
||||
+64
-417
@@ -1,5 +1,6 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -41,6 +42,7 @@ import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
@@ -82,7 +84,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
ArrayList<AdditionalDialogGetterSetter> defdata = new ArrayList<AdditionalDialogGetterSetter>();
|
||||
Spinner spinner_brand, spinner_sku;
|
||||
Spinner spinner_brand_list, spinner_sku_list;
|
||||
|
||||
String subcatid = "", subcat= "", subcatEng= "";
|
||||
AdditionalDialogGetterSetter additionalgeetersetter;
|
||||
public static ArrayList<AddittionalGetterSetter> data = new ArrayList<AddittionalGetterSetter>();
|
||||
ToggleButton btntoggle;
|
||||
@@ -90,7 +92,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
Button btnsku; //btnaddlayout;
|
||||
GSKOrangeDB db;
|
||||
ArrayList<SkuGetterSetter> sku_list;
|
||||
String brand_name = "", brand_id = "", SKU_name = "", SKU_ID = "", brand_list_name = "", brand_list_id = "", sku_list_name = "", sku_list_id = "", display_planogram_url="";
|
||||
String brand_name = "", brand_id = "", SKU_name = "", SKU_ID = "", brand_list_name = "", brand_list_id = "", sku_list_name = "", sku_list_id = "", display_planogram_url = "";
|
||||
public ListView listview;
|
||||
LinearLayout linearlay;
|
||||
CardView cardlay;
|
||||
@@ -104,13 +106,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
ArrayList<SkuGetterSetter> empty_list = new ArrayList<>();
|
||||
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _path, str, msg;
|
||||
private SharedPreferences preferences;
|
||||
String store_id, date, intime, img_str1="", img_str2="", img_str3="", togglevalue = "1", CATEGORY_ID, camera_allow, store_type_id, class_id, key_account_id;
|
||||
String store_id, date, intime, img_str1 = "", img_str2 = "", img_str3 = "", togglevalue = "1", CATEGORY_ID, camera_allow, store_type_id, class_id, key_account_id;
|
||||
ImageView img_cam, img_clicked, img_planogram;
|
||||
Button btn_add, btn_close;
|
||||
EditText Edt_txt;
|
||||
MyAdaptorStock adapterData;
|
||||
ListView listviewlay;
|
||||
String errormsg, categoryName, categoryId,country_id, store_flag_str;
|
||||
String errormsg, categoryName, categoryId, country_id, store_flag_str;
|
||||
MyAdaptorAdditionalStock adapteradditional;
|
||||
AddittionalGetterSetter adGt, newadd;
|
||||
LinearLayout brandlayout, diaplylayout, cameralayout;
|
||||
@@ -139,9 +141,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
store_type_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||
Log.e("camera_allow", camera_allow + " CountryId - " + country_id);
|
||||
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
@@ -188,7 +190,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
///band List
|
||||
|
||||
//brand_list = db.getBrandMasterData(store_type_id, class_id,key_account_id,categoryId,store_id);
|
||||
brand_list = db.getBrandMasterDataNew(key_account_id,categoryId,store_type_id,class_id);
|
||||
brand_list = db.getBrandMasterDataNew(key_account_id, categoryId, store_type_id, class_id);
|
||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||
String str = getResources().getString(R.string.select);
|
||||
brand.setBRAND(str);
|
||||
@@ -223,20 +225,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
spinner_sku_list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if (position != 0) {
|
||||
|
||||
img_planogram.setEnabled(true);
|
||||
sku_list_name = DisplayMaster_list.get(position).getDISPLAY().get(0);
|
||||
sku_list_id = DisplayMaster_list.get(position).getDISPLAY_ID().get(0);
|
||||
display_planogram_url = DisplayMaster_list.get(position).getIMAGE_PATH().get(0) + DisplayMaster_list.get(position).getIMAGE_URL().get(0);
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
img_planogram.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
@@ -246,25 +244,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
/// maintable
|
||||
|
||||
listdata = db.getAdditionalMainStock(store_id, categoryId);
|
||||
|
||||
for (int k = 0; k < listdata.size(); k++) {
|
||||
listdata.get(k).setSkuDialogList(db.getDialogStock(listdata.get(k).getKey_id()));
|
||||
|
||||
String tooglevalue = listdata.get(k).getBtn_toogle();
|
||||
|
||||
/*if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
btntoggle.setChecked(false);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
}*/
|
||||
|
||||
if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
@@ -283,126 +266,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
fab_add.show();
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/* String KeyID = listdata.get(k).getKey_id();
|
||||
|
||||
uploadlist = db.getDialogStock(KeyID);*/
|
||||
|
||||
}
|
||||
|
||||
/* listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
for (int k = 0; k < listdata.size(); k++) {
|
||||
|
||||
String tooglevalue = listdata.get(k).getBtn_toogle();
|
||||
|
||||
if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
btntoggle.setChecked(false);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
/*if (listdata.size() > 0) {
|
||||
for (int i = 0; i < listdata.size(); i++) {
|
||||
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
maincard.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if (togglevalue.equals("1")) {
|
||||
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
if (listdata.size() > 0) {
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.title_activity_Want_save))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
*//*for (int J = 0; J < listdata.size(); J++) {
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand(listdata.get(J).getBrand_id());
|
||||
newadd.setBrand_id(listdata.get(J).getBrand_id());
|
||||
newadd.setImage(listdata.get(J).getImage());
|
||||
newadd.setImage2(listdata.get(J).getImage2());
|
||||
newadd.setImage3(listdata.get(J).getImage3());
|
||||
newadd.setSku(listdata.get(J).getSku());
|
||||
newadd.setSku_id(listdata.get(J).getSku_id());
|
||||
newadd.setStore_id(listdata.get(J).getStore_id());
|
||||
newadd.setBtn_toogle(listdata.get(J).getBtn_toogle());
|
||||
newadd.setCategoryId(listdata.get(J).getCategoryId());
|
||||
String KeyID = listdata.get(J).getKey_id();
|
||||
|
||||
//additionalVisibilitySkuList = db.getDialogStock(KeyID);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, additionalVisibilitySkuList, categoryId);
|
||||
|
||||
KeyID = "";
|
||||
additionalVisibilitySkuList.clear();
|
||||
}*//*
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
// show it
|
||||
alertDialog.show();*/
|
||||
|
||||
} else {
|
||||
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
@@ -410,7 +283,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
listdata.clear();
|
||||
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand("");
|
||||
newadd.setBrand_id("");
|
||||
@@ -419,88 +291,34 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
newadd.setImage3("");
|
||||
newadd.setSku("");
|
||||
newadd.setSku_id("");
|
||||
newadd.setSubCat("");
|
||||
newadd.setSubCatId("");
|
||||
newadd.setStore_id(store_id);
|
||||
newadd.setBtn_toogle(togglevalue);
|
||||
newadd.setCategoryId(categoryId);
|
||||
|
||||
listdata.add(newadd);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.title_activity_Want_save))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
listdata.clear();
|
||||
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand("");
|
||||
newadd.setBrand_id("");
|
||||
newadd.setImage("");
|
||||
newadd.setImage2("");
|
||||
newadd.setImage3("");
|
||||
newadd.setSku("");
|
||||
newadd.setSku_id("");
|
||||
newadd.setStore_id(store_id);
|
||||
newadd.setBtn_toogle(togglevalue);
|
||||
newadd.setCategoryId(categoryId);
|
||||
|
||||
listdata.add(newadd);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
// show it
|
||||
alertDialog.show();*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fab_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
// Log.d("subcatdata",subcat + ","+subcatid);
|
||||
adGt = new AddittionalGetterSetter();
|
||||
adGt.setBrand(brand_list_name);
|
||||
adGt.setBrand_id(brand_list_id);
|
||||
adGt.setImage(img_str1);
|
||||
adGt.setImage2(img_str2);
|
||||
adGt.setImage3(img_str3);
|
||||
|
||||
adGt.setSku(sku_list_name);
|
||||
adGt.setSku_id(sku_list_id);
|
||||
adGt.setStore_id(store_id);
|
||||
adGt.setBtn_toogle(togglevalue);
|
||||
adGt.setCategoryId(categoryId);
|
||||
|
||||
ArrayList<AdditionalDialogGetterSetter> listdataTemp = new ArrayList<>();
|
||||
listdataTemp.addAll(defdata);
|
||||
adGt.setSkuDialogList(listdataTemp);
|
||||
@@ -522,9 +340,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
//Adding data to existing parent list
|
||||
listdata.add(adGt);
|
||||
editFlag = true;
|
||||
|
||||
clearViews();
|
||||
|
||||
clearViews();
|
||||
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
if (listdata.size() > 0) {
|
||||
@@ -572,114 +388,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
public void onClick(View view) {
|
||||
|
||||
if (btntoggle.isChecked()) {
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
/*if (listdata.size() > 0) {
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.data_will_be_lost))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
db.deleteStockEntryall(store_id, categoryId);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
|
||||
listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
btntoggle.setChecked(false);
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
// show it
|
||||
alertDialog.show();
|
||||
|
||||
} else {
|
||||
|
||||
listMain = db.getAdditionalMainStock(store_id, categoryId);
|
||||
|
||||
if (listMain.size() > 0) {
|
||||
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.data_will_be_lost))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.deleteStockEntryall(store_id, categoryId);
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
btntoggle.setChecked(false);
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
// show it
|
||||
alertDialog.show();
|
||||
|
||||
} else {
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
listdata.clear();
|
||||
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
@@ -706,26 +415,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
//db.deleteStockEntryall(store_id, categoryId);
|
||||
/* togglevalue = "0";
|
||||
btntoggle.setChecked(false);
|
||||
*/
|
||||
//clear both parent and child data lists
|
||||
//defdata.clear();
|
||||
listdata.clear();
|
||||
|
||||
/* btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);*/
|
||||
|
||||
// listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
/* adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();*/
|
||||
togglevalue = "0";
|
||||
btntoggle.setChecked(false);
|
||||
defdata.clear();
|
||||
@@ -738,7 +428,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
adapteradditional.notifyDataSetChanged();
|
||||
editFlag = true;
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
@@ -769,7 +458,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
alertDialog.show();
|
||||
|
||||
|
||||
}else {
|
||||
} else {
|
||||
togglevalue = "0";
|
||||
btntoggle.setChecked(false);
|
||||
defdata.clear();
|
||||
@@ -788,67 +477,56 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
|
||||
if (camera_allow.equals("1")) {
|
||||
|
||||
btnimage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
_pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context)+ _pathforcheck1;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
}
|
||||
btnimage.setOnClickListener(view -> {
|
||||
_pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
});
|
||||
|
||||
btnimage1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
_pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context)+ _pathforcheck2;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
}
|
||||
btnimage1.setOnClickListener(view -> {
|
||||
_pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
});
|
||||
|
||||
btnimage2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
_pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context)+ _pathforcheck3;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
}
|
||||
btnimage2.setOnClickListener(view -> {
|
||||
_pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck3;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
});
|
||||
|
||||
} else {
|
||||
btnimage.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_grey);
|
||||
}
|
||||
|
||||
/// new changes by jp
|
||||
if (camera_allow.equals("1")) {
|
||||
btnimage.setBackgroundResource(country_id.equals("6") ? R.mipmap.camera_orange_star_green : R.mipmap.camera_orange);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
} else {
|
||||
Log.d("camallow","false");
|
||||
btnimage.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_grey);
|
||||
}
|
||||
|
||||
btnsku.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showSkuDialog();
|
||||
}
|
||||
});
|
||||
|
||||
btnsku.setOnClickListener(view -> showSkuDialog());
|
||||
}
|
||||
|
||||
@SuppressLint("MissingSuperCall")
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
showDataLostAlert();
|
||||
}
|
||||
|
||||
void showDataLostAlert(){
|
||||
if(editFlag){
|
||||
void showDataLostAlert() {
|
||||
if (editFlag) {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalVisibility.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
@@ -867,14 +545,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
}
|
||||
|
||||
void clearViews(){
|
||||
void clearViews() {
|
||||
spinner_brand_list.setSelection(0);
|
||||
spinner_sku_list.setSelection(0);
|
||||
img_str1 = "";
|
||||
@@ -885,29 +562,21 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
sku_list_name = "";
|
||||
sku_list_id = "";
|
||||
defdata.clear();
|
||||
|
||||
btnsku.setBackgroundResource(R.color.colorPrimary);
|
||||
|
||||
if (camera_allow.equals("1")) {
|
||||
btnimage.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||
|
||||
btnimage.setBackgroundResource(country_id.equals("6") ? R.mipmap.camera_orange_star_green : R.mipmap.camera_orange);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
|
||||
} else {
|
||||
btnimage.setBackgroundResource(R.mipmap.camera_grey);
|
||||
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_grey);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showPlanogram(String planogram_image) {
|
||||
|
||||
final Dialog dialog = new Dialog(AdditionalVisibility.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
//dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.planogram_dialog_layout);
|
||||
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
dialog.setCancelable(false);
|
||||
@@ -923,20 +592,11 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.getSettings().setBuiltInZoomControls(true);
|
||||
|
||||
|
||||
String html = "<html><head></head><body><img src=\"" + planogram_image + "\"></body></html>";
|
||||
webView.loadDataWithBaseURL("", html, "text/html", "utf-8", "");
|
||||
|
||||
dialog.show();
|
||||
|
||||
ImageView cancel = (ImageView) dialog.findViewById(R.id.img_cancel);
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
cancel.setOnClickListener(v -> dialog.dismiss());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -990,7 +650,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KSA)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)) {
|
||||
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)) {
|
||||
cdate = arabicToenglish(cdate);
|
||||
}
|
||||
|
||||
@@ -1035,12 +695,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@@ -1199,7 +860,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
|
||||
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
@@ -1307,7 +968,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id);
|
||||
}*/
|
||||
|
||||
if (country_id.equals("7")||country_id.equals("8") ||country_id.equals("11") || country_id.equals("17")) {
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("11") || country_id.equals("17")) {
|
||||
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
@@ -1393,6 +1054,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
ab.setBrand(brand_name);
|
||||
ab.setBrand_id(brand_id);
|
||||
ab.setSubcat(subcat);
|
||||
ab.setSubcatid(subcatid);
|
||||
//ab.setDisplay_id(data.get(position).getDisplay_id());
|
||||
ab.setStore_id(store_id);
|
||||
// ab.setUnique_id(data.get(position).getUnique_id());
|
||||
@@ -1410,6 +1073,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
Edt_txt.setText("");
|
||||
SKU_ID = "";
|
||||
SKU_name = "";
|
||||
subcatid="";
|
||||
subcat="";
|
||||
// list = db.getDialogStock(store_id);
|
||||
linearlay.setVisibility(View.VISIBLE);
|
||||
cardlay.setVisibility(View.VISIBLE);
|
||||
@@ -1445,14 +1110,14 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
brand_id = brandList.get(position).getBRAND_ID().get(0);
|
||||
brand_name = brandList.get(position).getBRAND().get(0);
|
||||
subcatid = brandList.get(position).getSUB_CATEGORY_ID().get(0);
|
||||
subcat = brandList.get(position).getSUB_CATEGORY().get(0);
|
||||
|
||||
if(country_id.equals("7")||country_id.equals("8")||country_id.equals("11") ||country_id.equals("17")){
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("11") || country_id.equals("17")) {
|
||||
sku_list = db.getSkuT2PData(null, null, null, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
}
|
||||
else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
sku_list = db.getSkuT2PData(store_type_id, class_id, key_account_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sku_list = db.getSkuT2PData(store_type_id, class_id, key_account_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||
}
|
||||
|
||||
@@ -1639,10 +1304,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
holder.brand.setText(list.get(position1).getBrand().toString());
|
||||
holder.display.setText(list.get(position1).getSku_name().toString());
|
||||
|
||||
holder.qty_bought.setText(list.get(position1).getQuantity());
|
||||
|
||||
|
||||
holder.brand.setId(position1);
|
||||
holder.display.setId(position1);
|
||||
holder.qty_bought.setId(position1);
|
||||
@@ -1692,11 +1355,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
@Override
|
||||
public View getView(final int position1, View convertView, ViewGroup parent) {
|
||||
final ViewHolder holder;
|
||||
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.additionallistlayout, null);
|
||||
holder = new ViewHolder();
|
||||
|
||||
holder.brand = (TextView) convertView.findViewById(R.id.brand_name);
|
||||
holder.display = (TextView) convertView.findViewById(R.id.display_name);
|
||||
holder.qty_bought = (TextView) convertView.findViewById(R.id.qty_bought);
|
||||
@@ -1708,7 +1369,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
}
|
||||
|
||||
holder.delete.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(AdditionalVisibility.this);
|
||||
@@ -1753,8 +1413,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
@@ -1782,10 +1440,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
boolean validateData(AddittionalGetterSetter data) {
|
||||
boolean flag = true;
|
||||
|
||||
String brandid = data.getBrand_id();
|
||||
String skuid = data.getSku_id();
|
||||
|
||||
String imageu = data.getImage();
|
||||
String toggleid = data.getBtn_toogle();
|
||||
ArrayList<AdditionalDialogGetterSetter> skuList = data.getSkuDialogList();
|
||||
@@ -1796,15 +1452,11 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
if (/*brandid.equalsIgnoreCase("") ||*/ skuid.equalsIgnoreCase("")) {
|
||||
flag = false;
|
||||
|
||||
errormsg = getResources().getString(R.string.title_activity_select_dropdown);
|
||||
|
||||
} else if (camera_allow.equals("1")) {
|
||||
if (!country_id.equals("6") && (imageu == null || imageu.equalsIgnoreCase(""))) {
|
||||
if ((imageu == null || imageu.equalsIgnoreCase(""))) {
|
||||
flag = false;
|
||||
|
||||
errormsg = getResources().getString(R.string.title_activity_take_image);
|
||||
|
||||
} else if (skuList.size() == 0) {
|
||||
errormsg = getResources().getString(R.string.title_activity_fill_sku);
|
||||
flag = false;
|
||||
@@ -1815,15 +1467,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
errormsg = getResources().getString(R.string.title_activity_fill_sku);
|
||||
flag = false;
|
||||
|
||||
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,14 @@ import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
@@ -130,7 +134,6 @@ public class AuditActivity extends AppCompatActivity {
|
||||
for (int j = 0; j < childListData.size(); j++) {
|
||||
answerList.add(childListData.get(j));
|
||||
}
|
||||
|
||||
hashMapAnsListChildData.put(question_list.get(i), answerList); // Header, Child data
|
||||
}
|
||||
|
||||
@@ -514,7 +517,7 @@ public class AuditActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
/*holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
@@ -528,8 +531,66 @@ public class AuditActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
EditText edit = (EditText) v;
|
||||
String input = edit.getText().toString();
|
||||
String cleanText;
|
||||
|
||||
// Clean text based on type
|
||||
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("NUMBER")) {
|
||||
cleanText = input.replaceFirst("^0+.(?!$)", "");
|
||||
} else {
|
||||
cleanText = input.replaceAll("[&^<>{}'$]", "");
|
||||
}
|
||||
|
||||
// ✔ Prevent crash if ViewHolder is recycled
|
||||
if (holder.getAdapterPosition() != RecyclerView.NO_POSITION) {
|
||||
holder.data.setANSWER_ID("0");
|
||||
holder.data.setANSWER(cleanText);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*holder.edt_answer.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
||||
holder.edt_answer.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT) {
|
||||
|
||||
View next = v.focusSearch(View.FOCUS_DOWN);
|
||||
|
||||
if (next != null) {
|
||||
if (next instanceof EditText) {
|
||||
// Focus next EditText, keyboard stays
|
||||
next.requestFocus();
|
||||
} else if (next instanceof Spinner) {
|
||||
// Hide keyboard safely
|
||||
InputMethodManager imm = (InputMethodManager) v.getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(holder.edt_answer.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
// Post the performClick to ensure it happens after keyboard hides
|
||||
next.post(() -> next.performClick());
|
||||
} else {
|
||||
next.requestFocus();
|
||||
}
|
||||
}
|
||||
return true; // consume action
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
//set remark
|
||||
holder.edt_text.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
|
||||
@@ -167,68 +167,32 @@ public class CategoryPicture extends AppCompatActivity {
|
||||
db.InsertCategoryPictureData(CP, listdat, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder builder = new AlertDialog.Builder(CategoryPicture.this);
|
||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
|
||||
db.InsertCategoryPictureData(CP, listdat, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();*/
|
||||
|
||||
|
||||
} else {
|
||||
Snackbar.make(view, R.string.title_activity_take_image, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
im1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
|
||||
_pathforcheck1 = store_id + "CategoryPicture1" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
im2.setOnClickListener(view -> {
|
||||
|
||||
_pathforcheck2 = store_id + "CategoryPicture2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
});
|
||||
im3.setOnClickListener(view -> {
|
||||
|
||||
_pathforcheck3 = store_id + "CategoryPicture3" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck3;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
|
||||
});
|
||||
im4.setOnClickListener(view -> {
|
||||
|
||||
@@ -237,8 +201,6 @@ public class CategoryPicture extends AppCompatActivity {
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck4;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,26 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
@@ -39,7 +29,8 @@ import cpm.com.gskmtorange.adapter.data.ImageUri;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.upload.UploadActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
|
||||
public class CheckoutActivity extends AppCompatActivity {
|
||||
private Context context;
|
||||
@@ -73,7 +64,13 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
lat = getIntent().getStringExtra(CommonString.KEY_LATITUDE);
|
||||
lon = getIntent().getStringExtra(CommonString.KEY_LONGITUDE);
|
||||
coverageBean = db.getCoverageSpecificData(visit_date, store_id);
|
||||
new BackgroundTask(CheckoutActivity.this).execute();
|
||||
|
||||
if(isInternetAvailable(context)){
|
||||
new BackgroundTask(CheckoutActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private class BackgroundTask extends AsyncTask<Void, Data, String> {
|
||||
@@ -122,7 +119,7 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + service, envelope);
|
||||
|
||||
Object result = (Object) envelope.getResponse();
|
||||
@@ -177,9 +174,7 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
table = CommonString.KEY_ADHOC_JOURNEY_PLAN;
|
||||
break;
|
||||
}
|
||||
|
||||
db.updateCheckoutStatus(store_id, CommonString.KEY_Y, table);
|
||||
|
||||
} else {
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
||||
return service;
|
||||
|
||||
+99
-140
@@ -33,6 +33,7 @@ import com.androidbuts.multispinnerfilter.MultiSpinnerSearch;
|
||||
import com.androidbuts.multispinnerfilter.SpinnerListener;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -114,8 +115,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
if (configurationData.size() > 0) {
|
||||
|
||||
for (int i = 0; i < configurationData.size(); i++) {
|
||||
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("COACHING VISIT IMAGE") &&
|
||||
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
|
||||
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("COACHING VISIT IMAGE") && configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
|
||||
coaching_visit_camera_flag = true;
|
||||
break;
|
||||
}
|
||||
@@ -131,8 +131,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
|
||||
supervisorList = database.getSupervisorListData();
|
||||
|
||||
exist_adapter = new ArrayAdapter<>(this,
|
||||
android.R.layout.simple_spinner_item);
|
||||
exist_adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
|
||||
|
||||
String select_str = getResources().getString(R.string.select);
|
||||
|
||||
@@ -142,8 +141,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
|
||||
exist_spinner.setAdapter(exist_adapter);
|
||||
|
||||
exist_adapter
|
||||
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
exist_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
exist_spinner.setOnItemSelectedListener(this);
|
||||
|
||||
@@ -168,94 +166,61 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
switch (parent.getId()) {
|
||||
case R.id.spinner_coaching_visit:
|
||||
if (position != 0) {
|
||||
if (parent.getId() == R.id.spinner_coaching_visit) {
|
||||
|
||||
if (!update_flag) {
|
||||
if (position != 0) {
|
||||
|
||||
fab_save.show();//setVisibility(View.VISIBLE);
|
||||
if (!update_flag) {
|
||||
|
||||
if (position == 1) {
|
||||
fab_save.show(); //setVisibility(View.VISIBLE);
|
||||
|
||||
linear_supervisor.setVisibility(View.VISIBLE);
|
||||
if (position == 1) {
|
||||
|
||||
coaching_visit = 1;
|
||||
linear_supervisor.setVisibility(View.VISIBLE);
|
||||
coaching_visit = 1;
|
||||
|
||||
/*supervisor_adapter = new ArrayAdapter<CharSequence>(this,
|
||||
android.R.layout.simple_spinner_item);
|
||||
final List<KeyPairBoolData> listArray0 = new ArrayList<>();
|
||||
|
||||
String select_str = getResources().getString(R.string.select_promo);
|
||||
for (int i = 0; i < supervisorList.size(); i++) {
|
||||
KeyPairBoolData h = new KeyPairBoolData();
|
||||
h.setId(i + 1);
|
||||
h.setName(supervisorList.get(i).getSUPERVISOR().get(0));
|
||||
h.setSelected(false);
|
||||
listArray0.add(h);
|
||||
}
|
||||
|
||||
supervisor_adapter.add(select_str);
|
||||
multi_spinner_supervisor.setItems(listArray0, -1, new SpinnerListener() {
|
||||
@Override
|
||||
public void onItemsSelected(List<KeyPairBoolData> items) {
|
||||
|
||||
for (int i = 0; i < supervisorList.size(); i++) {
|
||||
supervisor_adapter.add(supervisorList.get(i).getSUPERVISOR().get(0));
|
||||
}
|
||||
selectedSupervisorList.clear();
|
||||
|
||||
supervisor_spinner.setAdapter(supervisor_adapter);
|
||||
|
||||
supervisor_adapter
|
||||
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
supervisor_spinner.setOnItemSelectedListener(this);*/
|
||||
|
||||
/**
|
||||
* Getting array of String to Bind in Spinner
|
||||
*/
|
||||
//final List<String> list = Arrays.asList(getResources().getStringArray(R.array.sports_array));
|
||||
|
||||
final List<KeyPairBoolData> listArray0 = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < supervisorList.size(); i++) {
|
||||
KeyPairBoolData h = new KeyPairBoolData();
|
||||
h.setId(i + 1);
|
||||
h.setName(supervisorList.get(i).getSUPERVISOR().get(0));
|
||||
h.setSelected(false);
|
||||
listArray0.add(h);
|
||||
}
|
||||
|
||||
multi_spinner_supervisor.setItems(listArray0, -1, new SpinnerListener() {
|
||||
|
||||
@Override
|
||||
public void onItemsSelected(List<KeyPairBoolData> items) {
|
||||
|
||||
selectedSupervisorList.clear();
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (items.get(i).isSelected()) {
|
||||
|
||||
selectedSupervisorList.add(items.get(i).getName());
|
||||
Log.i("MultiSpinner", i + " : " + items.get(i).getName() + " : " + items.get(i).isSelected());
|
||||
}
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (items.get(i).isSelected()) {
|
||||
selectedSupervisorList.add(items.get(i).getName());
|
||||
Log.i("MultiSpinner", i + " : " + items.get(i).getName() + " : " + items.get(i).isSelected());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
coaching_visit = 0;
|
||||
selectedSupervisorList.clear();
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
coaching_visit = 0;
|
||||
selectedSupervisorList.clear();
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
coaching_visit = -1;
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
fab_save.hide();//setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
coaching_visit = -1;
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
fab_save.hide(); //setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
case R.id.multi_spinner_supervisor:
|
||||
/* if(position!=0){
|
||||
emp_id = supervisorList.get(position-1).getEMP_ID().get(0);
|
||||
}
|
||||
else {
|
||||
emp_id = "";
|
||||
}*/
|
||||
|
||||
break;
|
||||
} else if (parent.getId() == R.id.multi_spinner_supervisor) {
|
||||
// Commented-out code from original
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,75 +231,69 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.img_cam:
|
||||
_pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
break;
|
||||
if (v.getId() == R.id.img_cam) {
|
||||
|
||||
case R.id.fab_save:
|
||||
if (coaching_visit == 1) {
|
||||
String error_msg = "";
|
||||
boolean flag = true;
|
||||
//if(emp_id.equals("")){
|
||||
if (selectedSupervisorList.size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.title_activity_select_dropdown);
|
||||
} else if (coaching_visit_camera_flag && image_name.equals("")) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.clickimage);
|
||||
_pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
|
||||
} else if (v.getId() == R.id.fab_save) {
|
||||
|
||||
if (coaching_visit == 1) {
|
||||
String error_msg = "";
|
||||
boolean flag = true;
|
||||
|
||||
if (selectedSupervisorList.size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.title_activity_select_dropdown);
|
||||
} else if (coaching_visit_camera_flag && image_name.equals("")) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.clickimage);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
for (int i = 0; i < selectedSupervisorList.size(); i++) {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id(getEmp_idFromName(selectedSupervisorList.get(i)));
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
for (int i = 0; i < selectedSupervisorList.size(); i++) {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id(getEmp_idFromName(selectedSupervisorList.get(i)));
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
|
||||
}
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
|
||||
saved_flag = true;
|
||||
|
||||
fab_next.show();//setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id("0");
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
saved_flag = true;
|
||||
fab_next.show();//setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case R.id.fab:
|
||||
|
||||
if (saved_flag || update_flag) {
|
||||
|
||||
// Intent i = new Intent(CoachingVisitActivity.this, StoreCheckoutImageActivity.class);
|
||||
Intent i = new Intent(CoachingVisitActivity.this, CoachingVisitStoreActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
startActivity(i);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
fab_next.show(); // setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, getString(R.string.please_save_data), Snackbar.LENGTH_SHORT).show();
|
||||
Snackbar.make(linear_supervisor, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
||||
} else {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id("0");
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
saved_flag = true;
|
||||
fab_next.show(); // setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} else if (v.getId() == R.id.fab) {
|
||||
if (saved_flag || update_flag) {
|
||||
Intent i = new Intent(CoachingVisitActivity.this, CoachingVisitStoreActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
startActivity(i);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, getString(R.string.please_save_data), Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String getEmp_idFromName(String name) {
|
||||
@@ -355,7 +314,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
|
||||
Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
|
||||
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
@@ -402,8 +361,8 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
} catch (Exception e) {
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
//Crashlytics.logException(new Exception(e.getCause()));
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
+93
-118
@@ -168,79 +168,58 @@ public class CoachingVisitStoreActivity extends AppCompatActivity implements Ada
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
switch (parent.getId()) {
|
||||
case R.id.spinner_coaching_visit:
|
||||
if (position != 0) {
|
||||
if (parent.getId() == R.id.spinner_coaching_visit) {
|
||||
|
||||
if (!update_flag) {
|
||||
if (position != 0) {
|
||||
|
||||
fab_save.show();//setVisibility(View.VISIBLE);
|
||||
if (!update_flag) {
|
||||
|
||||
if (position == 1) {
|
||||
fab_save.show(); // setVisibility(View.VISIBLE);
|
||||
|
||||
linear_supervisor.setVisibility(View.VISIBLE);
|
||||
if (position == 1) {
|
||||
|
||||
coaching_visit = 1;
|
||||
linear_supervisor.setVisibility(View.VISIBLE);
|
||||
coaching_visit = 1;
|
||||
|
||||
/**
|
||||
* Getting array of String to Bind in Spinner
|
||||
*/
|
||||
//final List<String> list = Arrays.asList(getResources().getStringArray(R.array.sports_array));
|
||||
// Creating list for multi-spinner
|
||||
final List<KeyPairBoolData> listArray0 = new ArrayList<>();
|
||||
|
||||
final List<KeyPairBoolData> listArray0 = new ArrayList<>();
|
||||
for (int i = 0; i < supervisorList.size(); i++) {
|
||||
KeyPairBoolData h = new KeyPairBoolData();
|
||||
h.setId(i + 1);
|
||||
h.setName(supervisorList.get(i).getSUPERVISOR().get(0));
|
||||
h.setSelected(false);
|
||||
listArray0.add(h);
|
||||
}
|
||||
|
||||
for (int i = 0; i < supervisorList.size(); i++) {
|
||||
KeyPairBoolData h = new KeyPairBoolData();
|
||||
h.setId(i + 1);
|
||||
h.setName(supervisorList.get(i).getSUPERVISOR().get(0));
|
||||
h.setSelected(false);
|
||||
listArray0.add(h);
|
||||
}
|
||||
|
||||
multi_spinner_supervisor.setItems(listArray0, -1, new SpinnerListener() {
|
||||
|
||||
@Override
|
||||
public void onItemsSelected(List<KeyPairBoolData> items) {
|
||||
|
||||
selectedSupervisorList.clear();
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (items.get(i).isSelected()) {
|
||||
|
||||
selectedSupervisorList.add(items.get(i).getName());
|
||||
Log.i("MultiSpinner", i + " : " + items.get(i).getName() + " : " + items.get(i).isSelected());
|
||||
}
|
||||
multi_spinner_supervisor.setItems(listArray0, -1, new SpinnerListener() {
|
||||
@Override
|
||||
public void onItemsSelected(List<KeyPairBoolData> items) {
|
||||
selectedSupervisorList.clear();
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (items.get(i).isSelected()) {
|
||||
selectedSupervisorList.add(items.get(i).getName());
|
||||
Log.i("MultiSpinner", i + " : " + items.get(i).getName() + " : " + items.get(i).isSelected());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
coaching_visit = 0;
|
||||
selectedSupervisorList.clear();
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
coaching_visit = 0;
|
||||
selectedSupervisorList.clear();
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
coaching_visit = -1;
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
fab_save.hide();//setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
coaching_visit = -1;
|
||||
linear_supervisor.setVisibility(View.GONE);
|
||||
fab_save.hide(); // setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
case R.id.multi_spinner_supervisor:
|
||||
|
||||
/* if(position!=0){
|
||||
emp_id = supervisorList.get(position-1).getEMP_ID().get(0);
|
||||
}
|
||||
else {
|
||||
emp_id = "";
|
||||
}*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,80 +230,76 @@ public class CoachingVisitStoreActivity extends AppCompatActivity implements Ada
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.img_cam:
|
||||
_pathforcheck = store_id + "CheckVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
if (v.getId() == R.id.img_cam) {
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
_pathforcheck = store_id + "CheckVisit" + visit_date.replace("/", "") +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
startCameraActivity();
|
||||
break;
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
|
||||
case R.id.fab_save:
|
||||
startCameraActivity();
|
||||
|
||||
if (coaching_visit == 1) {
|
||||
} else if (v.getId() == R.id.fab_save) {
|
||||
|
||||
String error_msg = "";
|
||||
boolean flag = true;
|
||||
//if(emp_id.equals("")){
|
||||
if (selectedSupervisorList.size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.title_activity_select_dropdown);
|
||||
} else if (coaching_visit_camera_flag && image_name.equals("")) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.clickimage);
|
||||
if (coaching_visit == 1) {
|
||||
String error_msg = "";
|
||||
boolean flag = true;
|
||||
|
||||
if (selectedSupervisorList.size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.title_activity_select_dropdown);
|
||||
} else if (coaching_visit_camera_flag && image_name.equals("")) {
|
||||
flag = false;
|
||||
error_msg = getString(R.string.clickimage);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
for (int i = 0; i < selectedSupervisorList.size(); i++) {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id(getEmp_idFromName(selectedSupervisorList.get(i)));
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitStoreData(coachingVisitGetterSetter, store_id);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
for (int i = 0; i < selectedSupervisorList.size(); i++) {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id(getEmp_idFromName(selectedSupervisorList.get(i)));
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitStoreData(coachingVisitGetterSetter, store_id);
|
||||
}
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
|
||||
saved_flag = true;
|
||||
|
||||
fab_next.show();//setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id("0");
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitStoreData(coachingVisitGetterSetter, store_id);
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
saved_flag = true;
|
||||
fab_next.show();//setVisibility(View.VISIBLE);
|
||||
}
|
||||
fab_next.show(); // setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case R.id.fab:
|
||||
|
||||
if (saved_flag || update_flag) {
|
||||
|
||||
Intent i = new Intent(CoachingVisitStoreActivity.this, StoreCheckoutImageActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
startActivity(i);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, getString(R.string.please_save_data), Snackbar.LENGTH_SHORT).show();
|
||||
Snackbar.make(linear_supervisor, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
||||
} else {
|
||||
CoachingVisitGetterSetter coachingVisitGetterSetter = new CoachingVisitGetterSetter();
|
||||
coachingVisitGetterSetter.setEmp_id("0");
|
||||
coachingVisitGetterSetter.setImg_path(image_name);
|
||||
coachingVisitGetterSetter.setExists(coaching_visit == 1);
|
||||
|
||||
database.insertCoachingVisitStoreData(coachingVisitGetterSetter, store_id);
|
||||
|
||||
Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
saved_flag = true;
|
||||
fab_next.show(); // setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} else if (v.getId() == R.id.fab) {
|
||||
|
||||
if (saved_flag || update_flag) {
|
||||
|
||||
Intent i = new Intent(CoachingVisitStoreActivity.this, StoreCheckoutImageActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
startActivity(i);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
|
||||
} else {
|
||||
Snackbar.make(linear_supervisor, getString(R.string.please_save_data), Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String getEmp_idFromName(String name) {
|
||||
|
||||
+142
-168
@@ -172,9 +172,6 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
|
||||
sp_promotion_typ.setAdapter(comp_adapter);
|
||||
sp_promotion_typ.setOnItemSelectedListener(this);
|
||||
|
||||
|
||||
|
||||
|
||||
//Product List
|
||||
exists_data = db.getCompetitionPromoExistsAfterData(store_id, categoryId);
|
||||
|
||||
@@ -204,140 +201,124 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
switch (id) {
|
||||
case R.id.btntoggle:
|
||||
isExists = btntoggle.isChecked();
|
||||
if (id == R.id.btntoggle) {
|
||||
isExists = btntoggle.isChecked();
|
||||
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
isdata_added = true;
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CompetitionPromoActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
isdata_added = true;
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CompetitionPromoActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
|
||||
brand = "";
|
||||
subcategory = "";
|
||||
promotion = "";
|
||||
brand_id = 0;
|
||||
subcategoryId = 0;
|
||||
promotion_id = 0;
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
et_sku_name.setText("");
|
||||
sp_subcategory.setSelection(0);
|
||||
spinner_brand_list.setSelection(0);
|
||||
sp_promotion_typ.setSelection(0);
|
||||
brand = "";
|
||||
subcategory = "";
|
||||
promotion = "";
|
||||
brand_id = 0;
|
||||
subcategoryId = 0;
|
||||
promotion_id = 0;
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
et_sku_name.setText("");
|
||||
sp_subcategory.setSelection(0);
|
||||
spinner_brand_list.setSelection(0);
|
||||
sp_promotion_typ.setSelection(0);
|
||||
|
||||
addedCounterfeitProducts.clear();
|
||||
isdata_added = true;
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//checkBox.setChecked(true);
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
break;
|
||||
addedCounterfeitProducts.clear();
|
||||
isdata_added = true;
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
case R.id.fab_add:
|
||||
} else if (id == R.id.fab_add) {
|
||||
skuName = et_sku_name.getText().toString().replaceAll("[&^<>{}'$]", "").replaceFirst("^0+(?!$)", "");
|
||||
if (promotion.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_promo_type, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (subcategory.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_sub_category, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_competitor, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (skuName.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_comment, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
CompetitonPromoGetterSetter product = new CompetitonPromoGetterSetter();
|
||||
product.setBrand(brand);
|
||||
product.setPromotion(promotion);
|
||||
product.setBrandId(brand_id);
|
||||
product.setPromotion_id(promotion_id);
|
||||
product.setSkuName(skuName);
|
||||
product.setImgStr(img_str);
|
||||
product.setImgStr1(img_str1);
|
||||
product.setImgStr2(img_str2);
|
||||
addedCounterfeitProducts.add(product);
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
|
||||
skuName = et_sku_name.getText().toString().replaceAll("[&^<>{}'$]", "").replaceFirst("^0+(?!$)", "");
|
||||
subcategory = "";
|
||||
brand = "";
|
||||
promotion = "";
|
||||
subcategoryId = 0;
|
||||
brand_id = 0;
|
||||
promotion_id = 0;
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
et_sku_name.setText("");
|
||||
sp_subcategory.setSelection(0);
|
||||
spinner_brand_list.setSelection(0);
|
||||
sp_promotion_typ.setSelection(0);
|
||||
|
||||
if (promotion.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_promo_type, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (subcategory.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_sub_category, Snackbar.LENGTH_SHORT).show();
|
||||
}else if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_competitor, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (skuName.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_comment, Snackbar.LENGTH_SHORT).show();
|
||||
} /*else if (img_str.equals("") && img_str1.equals("") && img_str2.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||
}*/ else {
|
||||
CompetitonPromoGetterSetter product = new CompetitonPromoGetterSetter();
|
||||
product.setBrand(brand);
|
||||
product.setPromotion(promotion);
|
||||
product.setBrandId(brand_id);
|
||||
product.setPromotion_id(promotion_id);
|
||||
product.setSkuName(skuName);
|
||||
product.setImgStr(img_str);
|
||||
product.setImgStr1(img_str1);
|
||||
product.setImgStr2(img_str2);
|
||||
imgCam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
|
||||
addedCounterfeitProducts.add(product);
|
||||
isdata_added = true;
|
||||
}
|
||||
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
} else if (id == R.id.fab) {
|
||||
|
||||
subcategory = "";
|
||||
brand = "";
|
||||
promotion = "";
|
||||
subcategoryId = 0;
|
||||
brand_id = 0;
|
||||
promotion_id = 0;
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
et_sku_name.setText("");
|
||||
sp_subcategory.setSelection(0);
|
||||
spinner_brand_list.setSelection(0);
|
||||
sp_promotion_typ.setSelection(0);
|
||||
//clearBrandSpinner();
|
||||
if (isExists && addedCounterfeitProducts.size() == 0) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
db.InsertComptionPromotData(addedCounterfeitProducts, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
imgCam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
} else if (id == R.id.img_cam) {
|
||||
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
|
||||
isdata_added = true;
|
||||
}
|
||||
} else if (id == R.id.img_cam1) {
|
||||
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
startCameraActivity();
|
||||
|
||||
break;
|
||||
|
||||
case R.id.fab:
|
||||
if(isExists && addedCounterfeitProducts.size()==0){
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add,Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
db.InsertComptionPromotData(addedCounterfeitProducts, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R.id.img_cam:
|
||||
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
break;
|
||||
|
||||
case R.id.img_cam1:
|
||||
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
startCameraActivity();
|
||||
break;
|
||||
|
||||
case R.id.img_cam2:
|
||||
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
startCameraActivity();
|
||||
break;
|
||||
} else if (id == R.id.img_cam2) {
|
||||
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
startCameraActivity();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void clearBrandSpinner() {
|
||||
@@ -355,59 +336,52 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (parent.getId()) {
|
||||
case R.id.sp_subcategory:
|
||||
if (position != 0) {
|
||||
subcategory = subcategory_list.get(position).getSUB_CATEGORY().get(0);
|
||||
subcategoryId = Integer.parseInt(subcategory_list.get(position).getSUB_CATEGORY_ID().get(0));
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long _po) {
|
||||
int id = parent.getId();
|
||||
|
||||
brand_list = db.getCompetionData(keyAccount_id, storeType_id,class_id,categoryId,subcategoryId);
|
||||
//brand data
|
||||
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||
String select = getResources().getString(R.string.select);
|
||||
brand_select.setBRAND(select);
|
||||
brand_select.setBRAND_ID("0");
|
||||
brand_list.add(0, brand_select);
|
||||
CustomBrandAdapter adapter = new CustomBrandAdapter(CompetitionPromoActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
spinner_brand_list.setAdapter(adapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
if (id == R.id.sp_subcategory) {
|
||||
if (position != 0) {
|
||||
subcategory = subcategory_list.get(position).getSUB_CATEGORY().get(0);
|
||||
subcategoryId = Integer.parseInt(subcategory_list.get(position).getSUB_CATEGORY_ID().get(0));
|
||||
|
||||
lay_competitor_name.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
subcategory = "";
|
||||
subcategoryId = 0;
|
||||
lay_competitor_name.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
brand_list = db.getCompetionData(keyAccount_id, storeType_id, class_id, categoryId, subcategoryId);
|
||||
|
||||
case R.id.sp_brand:
|
||||
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = Integer.parseInt(brand_list.get(position).getBRAND_ID().get(0));
|
||||
} else {
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
case R.id.sp_promotion_typ:
|
||||
|
||||
if (position != 0) {
|
||||
promotion = promotion_list.get(position).getPROMOTION_TYPE().get(0);
|
||||
promotion_id = Integer.parseInt(promotion_list.get(position).getPROMOTION_TYPE_ID().get(0));
|
||||
} else {
|
||||
promotion = "";
|
||||
promotion_id = 0;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
// Prepare brand data with default "Select" option
|
||||
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||
String select = getResources().getString(R.string.select);
|
||||
brand_select.setBRAND(select);
|
||||
brand_select.setBRAND_ID("0");
|
||||
brand_list.add(0, brand_select);
|
||||
|
||||
CustomBrandAdapter adapter = new CustomBrandAdapter(CompetitionPromoActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
spinner_brand_list.setAdapter(adapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
|
||||
lay_competitor_name.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
subcategory = "";
|
||||
subcategoryId = 0;
|
||||
lay_competitor_name.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (id == R.id.sp_brand) {
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = Integer.parseInt(brand_list.get(position).getBRAND_ID().get(0));
|
||||
} else {
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
}
|
||||
} else if (id == R.id.sp_promotion_typ) {
|
||||
if (position != 0) {
|
||||
promotion = promotion_list.get(position).getPROMOTION_TYPE().get(0);
|
||||
promotion_id = Integer.parseInt(promotion_list.get(position).getPROMOTION_TYPE_ID().get(0));
|
||||
} else {
|
||||
promotion = "";
|
||||
promotion_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+108
-119
@@ -168,134 +168,126 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
switch (id) {
|
||||
case R.id.btntoggle:
|
||||
isExists = btntoggle.isChecked();
|
||||
if (id == R.id.btntoggle) {
|
||||
isExists = btntoggle.isChecked();
|
||||
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
isdata_added = true;
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CounterfeitProductsActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
if (isExists) {
|
||||
lin_parent.setVisibility(View.VISIBLE);
|
||||
isdata_added = true;
|
||||
} else {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CounterfeitProductsActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
lin_parent.setVisibility(View.GONE);
|
||||
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
|
||||
stock = "";
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
stock = "";
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
|
||||
et_stock.setText("");
|
||||
et_sku_name.setText("");
|
||||
spinner_brand_list.setSelection(0);
|
||||
et_stock.setText("");
|
||||
et_sku_name.setText("");
|
||||
spinner_brand_list.setSelection(0);
|
||||
|
||||
addedCounterfeitProducts.clear();
|
||||
isdata_added = true;
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//checkBox.setChecked(true);
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
break;
|
||||
addedCounterfeitProducts.clear();
|
||||
isdata_added = true;
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//checkBox.setChecked(true);
|
||||
btntoggle.setChecked(true);
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
case R.id.fab_add:
|
||||
} else if (id == R.id.fab_add) {
|
||||
skuName = et_sku_name.getText().toString().replaceAll("[&^<>{}'$]", "").replaceFirst("^0+(?!$)", "");
|
||||
stock = et_stock.getText().toString();
|
||||
|
||||
skuName = et_sku_name.getText().toString().replaceAll("[&^<>{}'$]", "").replaceFirst("^0+(?!$)", "");
|
||||
stock = et_stock.getText().toString();
|
||||
if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_brand, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (stock.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_stock, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (skuName.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_sku, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (img_str.equals("") && img_str1.equals("") && img_str2.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
CounterfeitProductGetterSetter product = new CounterfeitProductGetterSetter();
|
||||
product.setBrand(brand);
|
||||
product.setBrandId(brand_id);
|
||||
product.setStock(Integer.parseInt(stock));
|
||||
product.setSkuName(skuName);
|
||||
product.setImgStr(img_str);
|
||||
product.setImgStr1(img_str1);
|
||||
product.setImgStr2(img_str2);
|
||||
|
||||
if (brand.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_brand, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (stock.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_stock, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (skuName.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_sku, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (img_str.equals("") && img_str1.equals("") && img_str2.equals("")) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
CounterfeitProductGetterSetter product = new CounterfeitProductGetterSetter();
|
||||
product.setBrand(brand);
|
||||
product.setBrandId(brand_id);
|
||||
product.setStock(Integer.parseInt(stock));
|
||||
product.setSkuName(skuName);
|
||||
product.setImgStr(img_str);
|
||||
product.setImgStr1(img_str1);
|
||||
product.setImgStr2(img_str2);
|
||||
addedCounterfeitProducts.add(product);
|
||||
|
||||
addedCounterfeitProducts.add(product);
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
stock = "";
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
|
||||
stock = "";
|
||||
skuName = "";
|
||||
img_str = "";
|
||||
img_str1 = "";
|
||||
img_str2 = "";
|
||||
et_stock.setText("");
|
||||
et_sku_name.setText("");
|
||||
spinner_brand_list.setSelection(0);
|
||||
|
||||
et_stock.setText("");
|
||||
et_sku_name.setText("");
|
||||
spinner_brand_list.setSelection(0);
|
||||
//clearBrandSpinner();
|
||||
imgCam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
|
||||
imgCam.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
imgCam2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
isdata_added = true;
|
||||
}
|
||||
|
||||
isdata_added = true;
|
||||
}
|
||||
} else if (id == R.id.fab) {
|
||||
if (isExists && addedCounterfeitProducts.size() == 0) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
db.InsertCounterfeitProductData(addedCounterfeitProducts, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
break;
|
||||
} else if (id == R.id.img_cam) {
|
||||
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
|
||||
case R.id.fab:
|
||||
if(isExists && addedCounterfeitProducts.size()==0){
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add,Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
db.InsertCounterfeitProductData(addedCounterfeitProducts, categoryId, store_id, isExists);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
} else if (id == R.id.img_cam1) {
|
||||
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
startCameraActivity();
|
||||
|
||||
break;
|
||||
|
||||
case R.id.img_cam:
|
||||
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
startCameraActivity();
|
||||
break;
|
||||
|
||||
case R.id.img_cam1:
|
||||
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck1;
|
||||
startCameraActivity();
|
||||
break;
|
||||
|
||||
case R.id.img_cam2:
|
||||
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
startCameraActivity();
|
||||
break;
|
||||
} else if (id == R.id.img_cam2) {
|
||||
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck2;
|
||||
startCameraActivity();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void clearBrandSpinner() {
|
||||
@@ -314,20 +306,17 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (parent.getId()) {
|
||||
case R.id.sp_brand:
|
||||
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = Integer.parseInt(brand_list.get(position).getBRAND_ID().get(0));
|
||||
} else {
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
if (parent.getId() == R.id.sp_brand) {
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBRAND().get(0);
|
||||
brand_id = Integer.parseInt(brand_list.get(position).getBRAND_ID().get(0));
|
||||
} else {
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
-20
@@ -91,27 +91,18 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
|
||||
|
||||
int id = v.getId();
|
||||
|
||||
switch (id) {
|
||||
|
||||
case R.id.fab_upload:
|
||||
|
||||
new UploadTask().execute();
|
||||
break;
|
||||
|
||||
case R.id.fab:
|
||||
|
||||
if (isCheckedIn()) {
|
||||
Snackbar.make(recyclerView, getString(R.string.title_store_list_checkout_current), Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
||||
Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
|
||||
startActivity(in);
|
||||
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
|
||||
break;
|
||||
if (id == R.id.fab_upload) {
|
||||
new UploadTask().execute();
|
||||
} else if (id == R.id.fab) {
|
||||
if (isCheckedIn()) {
|
||||
Snackbar.make(recyclerView, getString(R.string.title_store_list_checkout_current), Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DeliveryAdapter extends RecyclerView.Adapter<DeliveryAdapter.MyViewHolder> {
|
||||
|
||||
+14
-13
@@ -315,29 +315,30 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.img_checkin:
|
||||
int viewId = v.getId();
|
||||
|
||||
in_time = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
if (viewId == R.id.img_checkin) {
|
||||
|
||||
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
in_time = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
startCameraActivity(0);
|
||||
break;
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
|
||||
case R.id.img_checkout:
|
||||
startCameraActivity(0);
|
||||
|
||||
out_time = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
} else if (viewId == R.id.img_checkout) {
|
||||
|
||||
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
out_time = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
|
||||
startCameraActivity(1);
|
||||
|
||||
startCameraActivity(1);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startCameraActivity(int request_code) {
|
||||
|
||||
@@ -80,20 +80,21 @@ public class FutureJCPActivity extends AppCompatActivity implements View.OnClick
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iconCalender:
|
||||
c = Calendar.getInstance();
|
||||
year = c.get(Calendar.YEAR);
|
||||
month = c.get(Calendar.MONTH);
|
||||
day = c.get(Calendar.DAY_OF_MONTH);
|
||||
showDatePickerDialog(year, month, day);
|
||||
break;
|
||||
case R.id.fab:
|
||||
Snackbar.make(v, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
break;
|
||||
int viewId = v.getId();
|
||||
|
||||
if (viewId == R.id.iconCalender) {
|
||||
c = Calendar.getInstance();
|
||||
year = c.get(Calendar.YEAR);
|
||||
month = c.get(Calendar.MONTH);
|
||||
day = c.get(Calendar.DAY_OF_MONTH);
|
||||
showDatePickerDialog(year, month, day);
|
||||
|
||||
} else if (viewId == R.id.fab) {
|
||||
Snackbar.make(v, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void showDatePickerDialog(int year, int month, int day) {
|
||||
|
||||
@@ -211,9 +211,8 @@ public class NonWorkingReason extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
super.onBackPressed();
|
||||
finish();
|
||||
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
@@ -222,77 +221,72 @@ public class NonWorkingReason extends AppCompatActivity implements
|
||||
long arg3) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
switch (arg0.getId()) {
|
||||
case R.id.spinner_reason:
|
||||
if (position != 0) {
|
||||
reasonname = reasondata.get(position - 1).getREASON().get(0);
|
||||
reasonid = reasondata.get(position - 1).getREASON_ID().get(0);
|
||||
entry_allow = reasondata.get(position - 1).getENTRY_ALLOW().get(0);
|
||||
int id = arg0.getId();
|
||||
|
||||
image_allow = reasondata.get(position - 1).getIMAGE_ALLOW().get(0);
|
||||
remark_allow = reasondata.get(position - 1).getREMARK_REQUIRED().get(0);
|
||||
remark_type = reasondata.get(position - 1).getREMARK_TYPE().get(0);
|
||||
if (id == R.id.spinner_reason) {
|
||||
if (position != 0) {
|
||||
reasonname = reasondata.get(position - 1).getREASON().get(0);
|
||||
reasonid = reasondata.get(position - 1).getREASON_ID().get(0);
|
||||
entry_allow = reasondata.get(position - 1).getENTRY_ALLOW().get(0);
|
||||
|
||||
if (image_allow.equalsIgnoreCase("1")) {
|
||||
rel_cam.setVisibility(View.VISIBLE);
|
||||
image = "true";
|
||||
} else {
|
||||
rel_cam.setVisibility(View.GONE);
|
||||
image = "false";
|
||||
}
|
||||
//reason_reamrk = "true";
|
||||
if (remark_allow.equalsIgnoreCase("1")) {
|
||||
reason_lay.setVisibility(View.VISIBLE);
|
||||
if(remark_type.equalsIgnoreCase("Text")){
|
||||
text.setVisibility(View.VISIBLE);
|
||||
subreason_spinner.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
text.setVisibility(View.GONE);
|
||||
subreason_spinner.setVisibility(View.VISIBLE);
|
||||
image_allow = reasondata.get(position - 1).getIMAGE_ALLOW().get(0);
|
||||
remark_allow = reasondata.get(position - 1).getREMARK_REQUIRED().get(0);
|
||||
remark_type = reasondata.get(position - 1).getREMARK_TYPE().get(0);
|
||||
|
||||
sub_reasondata = database.getNonWorkingSubReasonData(reasonid);
|
||||
|
||||
sub_reason_adapter = new ArrayAdapter<CharSequence>(this,
|
||||
android.R.layout.simple_spinner_item);
|
||||
|
||||
String select_str = getResources().getString(R.string.select_promo) + " " +reasondata.get(position - 1).getREMARK_LABEL().get(0);
|
||||
|
||||
sub_reason_adapter.add(select_str);
|
||||
|
||||
for (int i = 0; i < sub_reasondata.size(); i++) {
|
||||
sub_reason_adapter.add(sub_reasondata.get(i).getSUB_REASON().get(0));
|
||||
}
|
||||
|
||||
subreason_spinner.setAdapter(sub_reason_adapter);
|
||||
|
||||
sub_reason_adapter
|
||||
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
subreason_spinner.setOnItemSelectedListener(this);
|
||||
}
|
||||
tv_remark.setText(reasondata.get(position - 1).getREMARK_LABEL().get(0));
|
||||
} else {
|
||||
reason_lay.setVisibility(View.GONE);
|
||||
}
|
||||
if (image_allow.equalsIgnoreCase("1")) {
|
||||
rel_cam.setVisibility(View.VISIBLE);
|
||||
image = "true";
|
||||
} else {
|
||||
rel_cam.setVisibility(View.GONE);
|
||||
image = "false";
|
||||
}
|
||||
|
||||
if (remark_allow.equalsIgnoreCase("1")) {
|
||||
reason_lay.setVisibility(View.VISIBLE);
|
||||
if (remark_type.equalsIgnoreCase("Text")) {
|
||||
text.setVisibility(View.VISIBLE);
|
||||
subreason_spinner.setVisibility(View.GONE);
|
||||
} else {
|
||||
text.setVisibility(View.GONE);
|
||||
subreason_spinner.setVisibility(View.VISIBLE);
|
||||
|
||||
sub_reasondata = database.getNonWorkingSubReasonData(reasonid);
|
||||
|
||||
sub_reason_adapter = new ArrayAdapter<CharSequence>(this,
|
||||
android.R.layout.simple_spinner_item);
|
||||
|
||||
String select_str = getResources().getString(R.string.select_promo) + " " + reasondata.get(position - 1).getREMARK_LABEL().get(0);
|
||||
|
||||
sub_reason_adapter.add(select_str);
|
||||
|
||||
for (int i = 0; i < sub_reasondata.size(); i++) {
|
||||
sub_reason_adapter.add(sub_reasondata.get(i).getSUB_REASON().get(0));
|
||||
}
|
||||
|
||||
subreason_spinner.setAdapter(sub_reason_adapter);
|
||||
|
||||
sub_reason_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
subreason_spinner.setOnItemSelectedListener(this);
|
||||
}
|
||||
tv_remark.setText(reasondata.get(position - 1).getREMARK_LABEL().get(0));
|
||||
} else {
|
||||
reasonname = "";
|
||||
reasonid = "";
|
||||
reason_lay.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.spinner_sub_reason:
|
||||
|
||||
if (position != 0) {
|
||||
sub_reason_id = sub_reasondata.get(position-1).getSUB_REASON_ID().get(0);
|
||||
}
|
||||
else {
|
||||
sub_reason_id = "";
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
reasonname = "";
|
||||
reasonid = "";
|
||||
reason_lay.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (id == R.id.spinner_sub_reason) {
|
||||
if (position != 0) {
|
||||
sub_reason_id = sub_reasondata.get(position - 1).getSUB_REASON_ID().get(0);
|
||||
} else {
|
||||
sub_reason_id = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+503
-72
@@ -1,25 +1,22 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@@ -34,59 +31,58 @@ import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import com.toptoche.searchablespinnerlibrary.SearchableSpinner;
|
||||
import java.io.File;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.MSL_Availability_StockFacingActivity;
|
||||
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.PharmaMSLInsertedGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGetterSetter;
|
||||
|
||||
public class OrderTakingActivity extends AppCompatActivity implements DialogCallbackListener {
|
||||
public class OrderTakingActivity extends AppCompatActivity implements DialogCallbackListener, AdapterView.OnItemSelectedListener {
|
||||
ExpandableListView expandableListView;
|
||||
private Context context;
|
||||
String sys_po_number="";
|
||||
EditText editText_QTY;
|
||||
RecyclerView rec_added_counterfeit_product;
|
||||
int brand_id = 0;
|
||||
FloatingActionButton fab_add;
|
||||
int skuid = 0;
|
||||
String skuname = "";
|
||||
int subcategoryId = 0;
|
||||
TextView txt_mslAvailabilityName;
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> headerDataList;
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> childDataList;
|
||||
List<MSL_AvailabilityStockFacingGetterSetter> hashMapListHeaderData;
|
||||
|
||||
List<MSL_AvailabilityStockFacingGetterSetter> hashMapListHeaderData;
|
||||
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _path, str, msg;
|
||||
boolean editFlag = false, isdata_added = false;
|
||||
|
||||
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<MSL_AvailabilityStockFacingGetterSetter>> hashMapListChildData;
|
||||
List<Integer> checkHeaderArray = new ArrayList<>();
|
||||
@@ -95,14 +91,23 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
ImageView camera1, camera2, camera3, camera4;
|
||||
LinearLayout lin_camera1, lin_camera2, lin_camera3, lin_camera4;
|
||||
GSKOrangeDB db;
|
||||
|
||||
String brand = "",subcategory="";
|
||||
String categoryName, categoryId, storeId, Error_Message = "";
|
||||
String store_id, store_flag_hide, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, store_flag_str;
|
||||
boolean isDialogOpen = true;
|
||||
private SharedPreferences preferences;
|
||||
int scrollPosition = 0;
|
||||
Spinner spinner_brand_list,sp_subcategory;
|
||||
|
||||
SearchableSpinner sp_promotion_typ;
|
||||
|
||||
String gallery_package = "";
|
||||
Uri outputFileUri;
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> subcategory_list = new ArrayList<>();
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> brand_list = new ArrayList<>();
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> addedCounterfeitProducts = new ArrayList<>();
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> skuListdata = new ArrayList<>();
|
||||
|
||||
String str_planogram = "", _pathforcheck = "";
|
||||
EditText storepoET,podateET;
|
||||
@@ -110,15 +115,15 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramShelfHeaderDataList = new ArrayList<>();
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramSkuChildDataList;
|
||||
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, ArrayList<StockFacing_PlanogramTrackerDataGetterSetter>> planogramHashMapListChildData = new HashMap<>();
|
||||
boolean editFlag = false;
|
||||
String Order_qty = "";
|
||||
//temp
|
||||
public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/";
|
||||
ProductAdapter productAdapter;
|
||||
//ImageView bmImage;
|
||||
RelativeLayout view;
|
||||
RadioButton radio_yes,radio_no;
|
||||
RadioGroup radio_group;
|
||||
String isExist="";
|
||||
String sys_po_number="";
|
||||
TextView sys_gen_poTV;
|
||||
LinearLayout poLL,pocamLL;
|
||||
String storepo ="";
|
||||
@@ -133,14 +138,18 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
|
||||
editText_QTY = findViewById(R.id.editText_QTY);
|
||||
rec_added_counterfeit_product =findViewById(R.id.rec_added_counterfeit_product);
|
||||
spinner_brand_list = (Spinner) findViewById(R.id.sp_brand);
|
||||
sp_promotion_typ = findViewById(R.id.sp_promotion_typ);
|
||||
camera1 = (ImageView) findViewById(R.id.img_camera1);
|
||||
camera2 = (ImageView) findViewById(R.id.img_camera2);
|
||||
camera3 = (ImageView) findViewById(R.id.img_camera3);
|
||||
camera4 = (ImageView) findViewById(R.id.img_camera4);
|
||||
fab_add = findViewById(R.id.fab_add);
|
||||
poIV = (ImageView) findViewById(R.id.poIV);
|
||||
pocamLL = findViewById(R.id.pocamLL);
|
||||
poLL = findViewById(R.id.poLL);
|
||||
|
||||
radio_group =findViewById(R.id.radio_group);
|
||||
radio_yes = findViewById(R.id.radio_yes);
|
||||
radio_no = findViewById(R.id.radio_no);
|
||||
@@ -148,6 +157,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
storepoET = findViewById(R.id.storepoET);
|
||||
podateET = findViewById(R.id.podateET);
|
||||
sp_subcategory = findViewById(R.id.sp_subcategory);
|
||||
|
||||
lin_camera1 = (LinearLayout) findViewById(R.id.lin_camera1);
|
||||
lin_camera2 = (LinearLayout) findViewById(R.id.lin_camera2);
|
||||
@@ -180,9 +190,17 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
setNewData();
|
||||
//subcategory_list.clear();
|
||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||
addedCounterfeitProducts = db.getOrderTakingNewAfterData(store_id, categoryId);
|
||||
if(addedCounterfeitProducts.size()>0){
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
}
|
||||
|
||||
|
||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||
toolbar.setTitle(getResources().getString(R.string.order_taking));
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@@ -190,7 +208,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
String str1 = str[0];
|
||||
String str2 = str[1];
|
||||
String str3 = str[2];
|
||||
sys_po_number = store_id + "-" +str3+str1+str2;
|
||||
sys_po_number = store_id + "-" + categoryId +"-" +str3+str1+str2;
|
||||
sys_gen_poTV.setText(sys_po_number);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
@@ -199,10 +217,63 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
podateET.setText(visit_date);
|
||||
prepareList();
|
||||
|
||||
fab_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Order_qty = editText_QTY.getText().toString();
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter>finddetailbysku= new ArrayList<>();
|
||||
finddetailbysku = db.getSkuDetails(String.valueOf(skuid));
|
||||
|
||||
//Camera
|
||||
// prepareDefaultList();
|
||||
// cameraMethod();
|
||||
for(int i =0;i<addedCounterfeitProducts.size();i++){
|
||||
if (String.valueOf(skuid)
|
||||
.equalsIgnoreCase(addedCounterfeitProducts.get(i).getSku_id())) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.add_different_sku,
|
||||
Snackbar.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if (skuname.isEmpty()) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_sku, Snackbar.LENGTH_SHORT).show();
|
||||
} else if (Order_qty.isEmpty()) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.please_enter_order_qty, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
MSL_AvailabilityStockFacingGetterSetter product = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
product.setBrand(brand.isEmpty() ? finddetailbysku.get(0).getBrand() : brand);
|
||||
product.setSub_category(subcategory.isEmpty() ? finddetailbysku.get(0).getSub_category() : subcategory);
|
||||
product.setSub_category_id(subcategoryId==0? finddetailbysku.get(0).getSub_category_id() : String.valueOf(subcategoryId));
|
||||
product.setBrand_id(brand_id==0 ? finddetailbysku.get(0).getBrand_id() : String.valueOf(brand_id));
|
||||
product.setSku(skuname);
|
||||
product.setSku_id(String.valueOf(skuid));
|
||||
product.setOrder_qty(Order_qty);
|
||||
addedCounterfeitProducts.add(product);
|
||||
|
||||
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
|
||||
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||
|
||||
subcategory = "";
|
||||
brand = "";
|
||||
subcategory = "";
|
||||
subcategoryId = 0;
|
||||
brand_id = 0;
|
||||
skuid = 0;
|
||||
skuname = "";
|
||||
editText_QTY.setText("");
|
||||
sp_subcategory.setSelection(0);
|
||||
spinner_brand_list.setSelection(0);
|
||||
sp_promotion_typ.setSelection(0);
|
||||
brand_list.clear();
|
||||
subcategory_list.clear();
|
||||
skuListdata.clear();
|
||||
setNewData();
|
||||
isdata_added = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
|
||||
@@ -248,23 +319,34 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
expandableListView.clearFocus();
|
||||
adapter.notifyDataSetChanged();
|
||||
storepo = storepoET.getText().toString();
|
||||
if (addedCounterfeitProducts.size() == 0) {
|
||||
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Log.d("sysponumber",sys_po_number);
|
||||
db.InsertOrderTakingData(addedCounterfeitProducts, categoryId, store_id,date,sys_po_number);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
//Log.e("storepo",storepo);
|
||||
if(isExist.equalsIgnoreCase("no")){
|
||||
/* if(isExist.equalsIgnoreCase("no")){
|
||||
if (db.checkOrder_taking_Data(store_id, categoryId)) {
|
||||
db.updateOrder_taking_data(img_str,isExist,storepo,sys_po_number,date,store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
db.updateOrder_taking_data(addedCounterfeitProducts, categoryId, store_id);
|
||||
Toast.makeText(context,getResources().getString(R.string.update_message),Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
db.InsertOrderTakingData(img_str,isExist,storepo,sys_po_number,date,store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
db.InsertOrderTakingData(addedCounterfeitProducts, categoryId, store_id);
|
||||
Toast.makeText(context,getResources().getString(R.string.save_message),Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
/*String pharma_msl_xml = "";
|
||||
*//*String pharma_msl_xml = "";
|
||||
String onXML = "";
|
||||
String _onxml = "";
|
||||
String categoryxml = "";
|
||||
@@ -305,7 +387,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
final String sos_xml = "[DATA]" + data_xml + "[/DATA]";
|
||||
Log.e("order_xml",sos_xml);
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
@@ -376,7 +458,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
});
|
||||
@@ -457,9 +539,70 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validation() {
|
||||
private void setNewData() {
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
subcategory_list = db.getOrderTaking_SubcategoryData(country_id,categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
subcategory_list = db.getOrderTaking_SubcategoryData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide);
|
||||
} else {
|
||||
// subcategory_list =db.getSubcategoryData(keyAccount_id, storeType_id,class_id,categoryId);
|
||||
subcategory_list = db.getOrderTaking_SubcategoryData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
}
|
||||
|
||||
MSL_AvailabilityStockFacingGetterSetter subcategory_select = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
String subcat_select = getResources().getString(R.string.select);
|
||||
subcategory_select.setSub_category(subcat_select);
|
||||
subcategory_select.setSub_category_id("0");
|
||||
subcategory_list.add(0, subcategory_select);
|
||||
CustomSubcategoryAdapter subcat_adapter = new CustomSubcategoryAdapter(OrderTakingActivity.this, R.layout.custom_spinner_item, subcategory_list);
|
||||
sp_subcategory.setAdapter(subcat_adapter);
|
||||
sp_subcategory.setOnItemSelectedListener(this);
|
||||
|
||||
brand_list.clear();
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
brand_list = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide,0);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
brand_list = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide,0);
|
||||
} else {
|
||||
brand_list = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide,0);
|
||||
}
|
||||
|
||||
MSL_AvailabilityStockFacingGetterSetter brand_select = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
String select = getResources().getString(R.string.select);
|
||||
brand_select.setBrand(select);
|
||||
brand_select.setBrand_id("0");
|
||||
brand_list.add(0, brand_select);
|
||||
CustomBrandAdapter brandAdapter = new CustomBrandAdapter(OrderTakingActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
spinner_brand_list.setAdapter(brandAdapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
|
||||
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData("0", categoryId, "0", null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, store_flag_hide);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData("0", categoryId, "0", keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, store_flag_hide);
|
||||
} else {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData("0", categoryId, "0", keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, store_flag_hide);
|
||||
}
|
||||
|
||||
MSL_AvailabilityStockFacingGetterSetter sku_select = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
String selectnew = getResources().getString(R.string.select);
|
||||
sku_select.setSku(selectnew);
|
||||
sku_select.setSku_id("0");
|
||||
// skuListdata.add(0, sku_select);
|
||||
if (!skuListdata.isEmpty()) {
|
||||
skuListdata.add(0, sku_select);
|
||||
}
|
||||
CustomSkuAdapter skuAdapter = new CustomSkuAdapter(OrderTakingActivity.this, R.layout.custom_spinner_item, skuListdata);
|
||||
sp_promotion_typ.setAdapter(skuAdapter);
|
||||
sp_promotion_typ.setTitle("Search SKU");
|
||||
sp_promotion_typ.setPositiveButton("Close");
|
||||
sp_promotion_typ.setOnItemSelectedListener(this);
|
||||
}
|
||||
|
||||
boolean validation() {
|
||||
boolean flag = true;
|
||||
if(img_str.equals("") && country_id.equals("17")){
|
||||
if(img_str.isEmpty() && country_id.equals("17")){
|
||||
flag = false;
|
||||
Toast.makeText(context, context.getString(R.string.pls_capture_img), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -515,7 +658,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
if (flag == false) {
|
||||
listDataHeaderTemp.add(listDataHeader.get(i));
|
||||
// listDataChildTemp.put(listDataHeader.get(i), listTemp);
|
||||
// listDataChildTemp.put(listDataHeader.get(i), listTemp);
|
||||
} else {
|
||||
childCount = childCount + listDataChild.get(listDataHeader.get(i)).size();
|
||||
}
|
||||
@@ -575,20 +718,17 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
hashMapListChildData = new HashMap<>();
|
||||
//Header
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide, subcategoryId);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide);
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide, subcategoryId);
|
||||
} else {
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
headerDataList = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide, subcategoryId);
|
||||
}
|
||||
|
||||
if (headerDataList.size() > 0) {
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
//childDataList = new ArrayList<>();
|
||||
childDataList = db.getOrder_TAKING_SKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||
//Log.e("childlistsize", String.valueOf(childDataList.size()));
|
||||
// childDataList = db.getMSL_Availability_StockFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||
if (!(childDataList.size() > 0)) {
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
childDataList = db.getORDERTAKING_StockFacingSKUData(headerDataList.get(i).getSub_category_id(), categoryId, headerDataList.get(i).getBrand_id(), null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, store_flag_hide);
|
||||
@@ -600,7 +740,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
}
|
||||
else{
|
||||
//if(childDataList.get(0).getPO_Date())
|
||||
// podateET.setText(childDataList.get(0).getPO_Date());
|
||||
// podateET.setText(childDataList.get(0).getPO_Date());
|
||||
sys_gen_poTV.setText(childDataList.get(0).getSys_PO_No());
|
||||
storepoET.setText(childDataList.get(0).getStore_PO_No());
|
||||
Log.d("childlistdata",childDataList.get(0).getPO_Img());
|
||||
@@ -666,6 +806,81 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long _po) {
|
||||
int id = parent.getId();
|
||||
if (id == R.id.sp_subcategory) {
|
||||
if (position != 0) {
|
||||
subcategory = subcategory_list.get(position).getSub_category();
|
||||
subcategoryId = Integer.parseInt(subcategory_list.get(position).getSub_category_id());
|
||||
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
brand_list = db.getOrderTaking_Branddata(country_id,categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide,subcategoryId);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
brand_list = db.getOrderTaking_Branddata(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide,subcategoryId);
|
||||
} else {
|
||||
brand_list = db.getOrderTaking_StockFacingHeaderData(country_id,categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide,subcategoryId);
|
||||
}
|
||||
|
||||
// brand_list = db.getCompetionData(keyAccount_id, storeType_id, class_id, categoryId, subcategoryId);
|
||||
// Prepare brand data with default "Select" option
|
||||
MSL_AvailabilityStockFacingGetterSetter brand_select = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
String select = getResources().getString(R.string.select);
|
||||
brand_select.setBrand(select);
|
||||
brand_select.setBrand_id("0");
|
||||
brand_list.add(0, brand_select);
|
||||
CustomBrandAdapter adapter = new CustomBrandAdapter(OrderTakingActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||
spinner_brand_list.setAdapter(adapter);
|
||||
spinner_brand_list.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
subcategory = "";
|
||||
subcategoryId = 0;
|
||||
//lay_competitor_name.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (id == R.id.sp_brand) {
|
||||
if (position != 0) {
|
||||
brand = brand_list.get(position).getBrand();
|
||||
brand_id = Integer.parseInt(brand_list.get(position).getBrand_id());
|
||||
// skuListdata.clear();
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData(String.valueOf(subcategoryId), categoryId, String.valueOf(brand_id), null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, store_flag_hide);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData(String.valueOf(subcategoryId), categoryId, String.valueOf(brand_id), keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, store_flag_hide);
|
||||
} else {
|
||||
skuListdata = db.getORDERTAKING_StockFacingSKUData(String.valueOf(subcategoryId), categoryId, String.valueOf(brand_id), keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, store_flag_hide);
|
||||
}
|
||||
MSL_AvailabilityStockFacingGetterSetter sku_select = new MSL_AvailabilityStockFacingGetterSetter();
|
||||
String select = getResources().getString(R.string.select);
|
||||
sku_select.setSku(select);
|
||||
sku_select.setSku_id("0");
|
||||
skuListdata.add(0, sku_select);
|
||||
CustomSkuAdapter skuAdapter = new CustomSkuAdapter(OrderTakingActivity.this, R.layout.custom_spinner_item, skuListdata);
|
||||
sp_promotion_typ.setAdapter(skuAdapter);
|
||||
sp_promotion_typ.setTitle("Search SKU");
|
||||
sp_promotion_typ.setPositiveButton("Close");
|
||||
sp_promotion_typ.setOnItemSelectedListener(this);
|
||||
} else {
|
||||
brand = "";
|
||||
brand_id = 0;
|
||||
}
|
||||
}
|
||||
else if (id == R.id.sp_promotion_typ) {
|
||||
if (position != 0) {
|
||||
skuname = skuListdata.get(position).getSku();
|
||||
skuid = Integer.parseInt(skuListdata.get(position).getSku_id());
|
||||
} else {
|
||||
skuname = "";
|
||||
skuid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
private Context _context;
|
||||
private List<MSL_AvailabilityStockFacingGetterSetter> _listDataHeader;
|
||||
@@ -871,7 +1086,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
|
||||
|
||||
// holder.ed_pricing.setText(childData.getPricingStock());
|
||||
// holder.ed_pricing.setText(childData.getPricingStock());
|
||||
|
||||
|
||||
final ViewHolder finalHolder1 = holder;
|
||||
@@ -903,40 +1118,40 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
//Toggle is no selected
|
||||
|
||||
if (country_id.equals("6")) {
|
||||
if (!childData.getStock().equals("")) {
|
||||
if (country_id.equals("6")) {
|
||||
if (!childData.getStock().equals("")) {
|
||||
|
||||
String faceup = edFaceup.replaceFirst("^0+(?!$)", "");
|
||||
String faceup = edFaceup.replaceFirst("^0+(?!$)", "");
|
||||
|
||||
if (edFaceup != null && !edFaceup.equals("") && !edFaceup.equals(".")) {
|
||||
if (Double.parseDouble(faceup) <= Integer.parseInt(childData.getStock())) {
|
||||
if (edFaceup != null && !edFaceup.equals("") && !edFaceup.equals(".")) {
|
||||
if (Double.parseDouble(faceup) <= Integer.parseInt(childData.getStock())) {
|
||||
|
||||
isFill = true;
|
||||
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(OrderTakingActivity.this);
|
||||
builder.setMessage(getString(R.string.check_faceup))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finalHolder1.facing.setText("");
|
||||
dialog.dismiss();
|
||||
finalHolder2.facing.setText("");
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
} else {
|
||||
isFill = true;
|
||||
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(OrderTakingActivity.this);
|
||||
builder.setMessage(getString(R.string.check_faceup))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finalHolder1.facing.setText("");
|
||||
dialog.dismiss();
|
||||
finalHolder2.facing.setText("");
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
isFill = true;
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
isFill = true;
|
||||
}
|
||||
} else {
|
||||
isFill = true;
|
||||
}
|
||||
|
||||
if (isFill) {
|
||||
if (!edFaceup.equals("") && !edFaceup.equals(".")) {
|
||||
@@ -1070,7 +1285,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
Log.d("imagepath", str + _pathforcheck);
|
||||
Log.d("imagepath", str + _pathforcheck);
|
||||
poIV.setImageResource(R.mipmap.camera_green);
|
||||
img_str = _pathforcheck;
|
||||
_pathforcheck = "";
|
||||
@@ -1100,6 +1315,7 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
super.onBackPressed();
|
||||
if (editFlag) {
|
||||
CommonFunctions.showAlertDialog(OrderTakingActivity.this, getResources().getString(R.string.data_will_be_lost));
|
||||
} else {
|
||||
@@ -1157,10 +1373,225 @@ public class OrderTakingActivity extends AppCompatActivity implements DialogCall
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(gallery_package);
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomSubcategoryAdapter extends ArrayAdapter<String> {
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
MSL_AvailabilityStockFacingGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
public CustomSubcategoryAdapter(
|
||||
OrderTakingActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (MSL_AvailabilityStockFacingGetterSetter) data.get(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
|
||||
if (position == 0) {
|
||||
|
||||
// Default selected Spinner item
|
||||
label.setText(getResources().getString(R.string.select));
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getSub_category());
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomBrandAdapter extends ArrayAdapter<String> {
|
||||
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
MSL_AvailabilityStockFacingGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomBrandAdapter Constructor
|
||||
*****************/
|
||||
public CustomBrandAdapter(
|
||||
OrderTakingActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (MSL_AvailabilityStockFacingGetterSetter) data.get(position);
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
// label.setText(tempValues.getBrand() + "-"+ tempValues.getSub_category());
|
||||
if (position == 0) {
|
||||
// Default selected Spinner item
|
||||
label.setText(getResources().getString(R.string.select));
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getBrand() + "-"+ tempValues.getSub_category());
|
||||
}
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CustomSkuAdapter extends ArrayAdapter<String> {
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
MSL_AvailabilityStockFacingGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomBrandAdapter Constructor
|
||||
*****************/
|
||||
public CustomSkuAdapter(
|
||||
OrderTakingActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (MSL_AvailabilityStockFacingGetterSetter) data.get(position);
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
if (position == 0) {
|
||||
// Default selected Spinner item
|
||||
label.setText(getResources().getString(R.string.select));
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getSku());
|
||||
}
|
||||
// label.setText(tempValues.getSku());
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<MSL_AvailabilityStockFacingGetterSetter> list;
|
||||
|
||||
public ProductAdapter(ArrayList<MSL_AvailabilityStockFacingGetterSetter> promoList) {
|
||||
list = promoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.item_order_taking_new, parent, false);
|
||||
return new ProductAdapter.ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final ProductAdapter.ViewHolder holder, int position) {
|
||||
final MSL_AvailabilityStockFacingGetterSetter mItem = list.get(position);
|
||||
holder.tv_brand.setText(mItem.getSub_category());
|
||||
holder.tv_competitor.setText(mItem.getBrand());
|
||||
holder.tv_sku_name.setText(mItem.getSku());
|
||||
holder.tv_order_qty.setText(mItem.getOrder_qty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final TextView tv_brand, tv_competitor,tv_sku_name,tv_order_qty;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
mView = view;
|
||||
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
|
||||
tv_order_qty = (TextView) mView.findViewById(R.id.tv_order_qty);
|
||||
tv_sku_name = (TextView) mView.findViewById(R.id.tv_sku_name);
|
||||
tv_competitor = (TextView) mView.findViewById(R.id.tv_competitor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.sj.camera_lib_android.Database.ReactPendingData
|
||||
import com.sj.camera_lib_android.Database.ReactSingleImage
|
||||
import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions.savefile
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.constant.CommonUtils
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdvisibilityBinding
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Master_Storelist_PDA_GetterSetter
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
class PDVisibilityActivity : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var lang: String? = null;
|
||||
var date: String? = null;
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
var country_id: String? = null
|
||||
var store_flag_str: String? = null
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var masterStoreListPd: ArrayList<Master_Storelist_PDA_GetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
var toggle: String? = "1"
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdvisibilityBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
var devicename : String? = ""
|
||||
var store_name : String? = ""
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdvisibilityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
context = this
|
||||
db = GSKOrangeDB(context)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
db?.open()
|
||||
preferences?.let {
|
||||
lang = it.getString(CommonString.KEY_LANGUAGE, "")
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
store_name = it.getString(CommonString.KEY_STORE_NAME, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
key_account_id = it.getString(CommonString.KEY_KEYACCOUNT_ID, "")
|
||||
country_id = it.getString(CommonString.KEY_COUNTRY_ID, "")
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
//Log.d("languagedata", lang.toString());
|
||||
}
|
||||
devicename = android.os.Build.MANUFACTURER
|
||||
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
intent?.let {
|
||||
categoryName = it.getStringExtra("categoryName")
|
||||
categoryId = it.getStringExtra("categoryId")
|
||||
Log.d("catdata",categoryId.toString() +","+categoryName);
|
||||
kpi_name = it.getStringExtra("kpi_name")
|
||||
}
|
||||
|
||||
supportActionBar?.apply {
|
||||
setHomeButtonEnabled(true)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
masterStoreListPd = db?.getMasterStoreListPd(store_id,CommonString.TABLE_MASTER_STORELIST_PD)
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PDVisibilityActivity,
|
||||
projectId = projectId,
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
)
|
||||
)
|
||||
binding.rlContent.btntoggle.setOnClickListener {
|
||||
if(toggle =="1"){
|
||||
toggle = "0"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
else{
|
||||
toggle = "1"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
Log.d("toggle_value_new",toggle.toString())
|
||||
}
|
||||
}
|
||||
binding.apply {
|
||||
fab.setOnClickListener {
|
||||
if (validate()) {
|
||||
val builder = AlertDialog.Builder(this@PDVisibilityActivity)
|
||||
builder.setMessage(getString(R.string.check_save_message)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
// Handle Yes button click
|
||||
db?.open()
|
||||
db?.InsertPdImageVisibilityData(
|
||||
date,
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
toggle,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
lifecycleScope.launch {
|
||||
delay(3000) // 3 seconds delay
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
}
|
||||
}
|
||||
dialog.dismiss()
|
||||
}.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
val alert = builder.create()
|
||||
alert.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callAdapter()
|
||||
// checkAndRequestPermissions()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
CommonFunctions.updateLangResources(
|
||||
context,
|
||||
preferences!!.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty() && toggle=="1") {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
"Please capture IR images of ${data.suB_CATEGORY}",
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
break // Stop further checks once an issue is found
|
||||
}
|
||||
}
|
||||
}
|
||||
return checkFlag // Correctly return validation result
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item.itemId
|
||||
if (id == android.R.id.home) {
|
||||
//showDataLossAlert();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out)
|
||||
finish()
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
LocalBroadcastManager.getInstance(this@PDVisibilityActivity)
|
||||
.unregisterReceiver(myBroadcastReceiver) // onDestroy
|
||||
}
|
||||
|
||||
private fun registerIntentFilter(filters: List<String> = listOf()) {
|
||||
filters.forEach { filter ->
|
||||
LocalBroadcastManager.getInstance(this@PDVisibilityActivity)
|
||||
.registerReceiver(myBroadcastReceiver, IntentFilter(filter))
|
||||
}
|
||||
}
|
||||
|
||||
private val savedImages = mutableListOf<ImageUri>()
|
||||
private var myBroadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
"did-receive-queue-data" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ReactPendingData>("imageList")
|
||||
Log.d("DEBUG-LOG did-receive-queue-data", "$receivedList")
|
||||
if (receivedList.isNullOrEmpty()) {
|
||||
CameraSDK.uploadFailedImage(this@PDVisibilityActivity)
|
||||
}
|
||||
}
|
||||
|
||||
"did-receive-image-upload-status" -> {
|
||||
val receivedImage = intent.getParcelableExtra<ReactSingleImage>("image")
|
||||
Log.d("DEBUG-LOG did-receive-image-upload-status", "$receivedImage")
|
||||
}
|
||||
|
||||
"DataSaved" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ImageUploadModel>("imageListSaved")
|
||||
Log.d("DEBUG-LOG DataSaved", "$receivedList")
|
||||
receivedList?.let {
|
||||
savedImages.clear()
|
||||
it.forEach { item ->
|
||||
val dir = CommonString.getImagesFolder(context)
|
||||
val setName =
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPD_VISI_IMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(item.uri.toUri(), "$dir $setName")
|
||||
}
|
||||
adapter?.updateItem(position = _pos, savedImages)
|
||||
Log.e("savedImages", savedImages.toString())
|
||||
_pos = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchCamera(subCat_code: String, subCategory: String, subCategoryId: String) {
|
||||
val uploadFrom = "TestApp"
|
||||
var shelftype = "posm_$subCategory" +"_"+subCategoryId
|
||||
shelftype = shelftype.lowercase().replace("[^a-z0-9_]".toRegex(), "")
|
||||
val masterstorelistpddata = masterStoreListPd?.getOrNull(0)
|
||||
val metadata = JSONObject().apply {
|
||||
put("Device_Name", devicename ?: "NA")
|
||||
put("username", username ?: "NA")
|
||||
put("shop_name", store_name ?: "NA")
|
||||
put("parinaam_id", masterstorelistpddata?.storeId?.getOrNull(0) ?: "NA") //storeid
|
||||
put("channel", masterstorelistpddata?.channel?.getOrNull(0) ?: "NA")
|
||||
put("format", masterstorelistpddata?.format?.getOrNull(0) ?: "NA")
|
||||
put("region", masterstorelistpddata?.region?.getOrNull(0) ?: "NA")
|
||||
put("bay_type", masterstorelistpddata?.bay_type?.getOrNull(0) ?: "NA")
|
||||
put("no_of_bays", masterstorelistpddata?.no_of_bays?.getOrNull(0) ?: "NA")
|
||||
put("category", categoryName?: "NA")
|
||||
put("user_id", masterstorelistpddata?.user_id?.getOrNull(0) ?: "NA")
|
||||
put("Active", masterstorelistpddata?.active?.getOrNull(0) ?: "NA")
|
||||
put("ASMArea", masterstorelistpddata?.asmArea?.getOrNull(0) ?: "NA")
|
||||
put("EmployeeName", masterstorelistpddata?.employeeName?.getOrNull(0) ?: "NA")
|
||||
put("DesignationName", masterstorelistpddata?.designationName?.getOrNull(0) ?: "NA")
|
||||
put("SupervisorId", masterstorelistpddata?.supervisorId?.getOrNull(0) ?: "NA")
|
||||
put("Supervisor", masterstorelistpddata?.supervisor?.getOrNull(0) ?: "NA")
|
||||
put("StoreCode", masterstorelistpddata?.storeCode?.getOrNull(0) ?: "NA")
|
||||
put("ChainId", masterstorelistpddata?.chainId?.getOrNull(0) ?: "NA")
|
||||
put("StoreTypeId", masterstorelistpddata?.storeTypeId?.getOrNull(0) ?: "NA")
|
||||
put("SOName", masterstorelistpddata?.soName?.getOrNull(0) ?: "NA")
|
||||
}
|
||||
|
||||
val uploadParams = JSONObject().apply {
|
||||
put("shop_id", store_id)
|
||||
put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
put("shelf_type", shelftype)
|
||||
put("category_id", subCat_code)
|
||||
put("user_id", username)
|
||||
put("metadata", metadata)
|
||||
}
|
||||
|
||||
// "metadata": { "Device_Name": $devicename,"Username": $username }
|
||||
/* uploadParams.put("shop_id", store_id)
|
||||
uploadParams.put("user_id", username)
|
||||
uploadParams.put("category_id", subCat_code)
|
||||
uploadParams.put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))*/
|
||||
|
||||
Log.d("uploadParams", uploadParams.toString())
|
||||
if(!lang.equals("ENGLISH",ignoreCase = true)){
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "ar",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
else{
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
db?.open()
|
||||
listdat = db?.getirVisibilityData(date,store_id,categoryId)
|
||||
|
||||
// Log.d("listdatsize", listdat?.size.toString() +","+listdat?.get(0)?.toggle_value)
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
subcates = ArrayList(),
|
||||
btnlistener = object : SubCatPdAdapter.BtnClickListener {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PDVisibilityActivity._pos = _pos
|
||||
launchCamera(data.subCatCode,data.suB_CATEGORY,data.suB_CATEGORY_ID)
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDVisibilityActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
|
||||
toggle = listdat?.get(0)?.toggle_value ?: "1"
|
||||
|
||||
if(toggle == "1"){
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
} else {
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
if (!db!!.isPdVisibility(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdImageVisibilityData(date, store_id, categoryId, listdat,toggle, CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
fun isNetworkAvailable(context: Context): Boolean {
|
||||
val connectivityManager =
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
|
||||
val network = connectivityManager.activeNetwork ?: return false
|
||||
val activeNetwork = connectivityManager.getNetworkCapabilities(network) ?: return false
|
||||
|
||||
return when {
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,465 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.Manifest
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.sj.camera_lib_android.Database.ReactPendingData
|
||||
import com.sj.camera_lib_android.Database.ReactSingleImage
|
||||
import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions.savefile
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.constant.CommonUtils
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdPogBinding
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdimageBinding
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
class PD_Pog_Activity : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
var country_id: String? = null
|
||||
var store_flag_str: String? = null
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdPogBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdPogBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
context = this
|
||||
|
||||
db = GSKOrangeDB(context)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
db?.open()
|
||||
preferences?.let {
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
key_account_id = it.getString(CommonString.KEY_KEYACCOUNT_ID, "")
|
||||
country_id = it.getString(CommonString.KEY_COUNTRY_ID, "")
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
}
|
||||
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
intent?.let {
|
||||
categoryName = it.getStringExtra("categoryName")
|
||||
categoryId = it.getStringExtra("categoryId")
|
||||
kpi_name = it.getStringExtra("kpi_name")
|
||||
}
|
||||
supportActionBar?.apply {
|
||||
setHomeButtonEnabled(true)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
Log.d("pd_user_id",userId.toString());
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PD_Pog_Activity,
|
||||
projectId = projectId,
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
)
|
||||
)
|
||||
|
||||
binding.apply {
|
||||
fab.setOnClickListener {
|
||||
if (validate()) {
|
||||
val builder = AlertDialog.Builder(this@PD_Pog_Activity)
|
||||
builder.setMessage(getString(R.string.check_save_message)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
// Handle Yes button click
|
||||
db?.open()
|
||||
db?.InsertPdPogImageData(
|
||||
date,
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
lifecycleScope.launch {
|
||||
delay(3000) // 3 seconds delay
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
}
|
||||
}
|
||||
dialog.dismiss()
|
||||
}.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
val alert = builder.create()
|
||||
alert.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callAdapter()
|
||||
checkAndRequestPermissions()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty()) {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
"Please capture IR images of ${data.suB_CATEGORY}",
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
break // Stop further checks once an issue is found
|
||||
}
|
||||
}
|
||||
}
|
||||
return checkFlag // Correctly return validation result
|
||||
}
|
||||
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item.itemId
|
||||
if (id == android.R.id.home) {
|
||||
//showDataLossAlert();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out)
|
||||
finish()
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
LocalBroadcastManager.getInstance(this@PD_Pog_Activity)
|
||||
.unregisterReceiver(myBroadcastReceiver) // onDestroy
|
||||
}
|
||||
|
||||
private fun registerIntentFilter(filters: List<String> = listOf()) {
|
||||
filters.forEach { filter ->
|
||||
LocalBroadcastManager.getInstance(this@PD_Pog_Activity)
|
||||
.registerReceiver(myBroadcastReceiver, IntentFilter(filter))
|
||||
}
|
||||
}
|
||||
|
||||
private val savedImages = mutableListOf<ImageUri>()
|
||||
private var myBroadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
"did-receive-queue-data" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ReactPendingData>("imageList")
|
||||
Log.d("DEBUG-LOG did-receive-queue-data", "$receivedList")
|
||||
if (receivedList.isNullOrEmpty()) {
|
||||
CameraSDK.uploadFailedImage(this@PD_Pog_Activity)
|
||||
}
|
||||
}
|
||||
|
||||
"did-receive-image-upload-status" -> {
|
||||
val receivedImage = intent.getParcelableExtra<ReactSingleImage>("image")
|
||||
Log.d("DEBUG-LOG did-receive-image-upload-status", "$receivedImage")
|
||||
}
|
||||
|
||||
"DataSaved" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ImageUploadModel>("imageListSaved")
|
||||
Log.d("DEBUG-LOG DataSaved", "$receivedList")
|
||||
receivedList?.let {
|
||||
savedImages.clear()
|
||||
it.forEach { item ->
|
||||
val dir = CommonString.getImagesFolder(context)
|
||||
val setName =
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPDIMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(item.uri.toUri(), "$dir $setName")
|
||||
}
|
||||
adapter?.updateItem(position = _pos, savedImages)
|
||||
Log.e("savedImages", savedImages.toString())
|
||||
_pos = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchCamera(subCat_code: String) {
|
||||
val uploadFrom = "TestApp"
|
||||
val uploadParams = JSONObject(
|
||||
"""
|
||||
{
|
||||
"shop_id": 62475,
|
||||
"project_id": "4f57635b-6b07-45bf-bfba-c61c2826b6db",
|
||||
"td_version_id": 178,
|
||||
"shelf_image_id": null,
|
||||
"asset_image_id": null,
|
||||
"shelf_type": "Primary Shelf",
|
||||
"category_id": 123,
|
||||
"user_id": 133,
|
||||
"isConnected": true,
|
||||
"sn_image_type": "skus",
|
||||
"image_type": "multiple",
|
||||
"seq_no": 1,
|
||||
"level": 1,
|
||||
"uploadOnlyOnWifi": 0,
|
||||
"app_session_id": "8e2faa6b-d6fe-413a-a693-76a0cbe0ce71",
|
||||
"metadata": { "Device_Name": "Samsung" }
|
||||
}
|
||||
"""
|
||||
)
|
||||
uploadParams.put("shop_id", store_id)
|
||||
uploadParams.put("user_id", username)
|
||||
uploadParams.put("category_id", subCat_code)
|
||||
uploadParams.put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
Log.d("uploadparamdata",uploadParams.toString());
|
||||
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
if (country_id == "8") {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_STOREWISE
|
||||
)
|
||||
} else if (store_flag_str.equals(CommonString.FROM_DEVIATION, ignoreCase = true)) {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
key_account_id,
|
||||
store_type_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADHOC
|
||||
)
|
||||
} else {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
key_account_id,
|
||||
store_type_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK
|
||||
)
|
||||
}
|
||||
|
||||
Log.d("listdatsize", listdat?.size.toString())
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
subcates = ArrayList(),
|
||||
btnlistener = object : SubCatPdAdapter.BtnClickListener {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PD_Pog_Activity._pos = _pos
|
||||
launchCamera(data.subCatCode)
|
||||
Log.d("subCatCode", data.subCatCode)
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PD_Pog_Activity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
if (!db!!.isSOSPogCategory(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdPogImageData(date, store_id, categoryId, listdat, CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAndRequestPermissions() {
|
||||
var read_phone_state = 0
|
||||
var write_storage = 0
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES)
|
||||
} else {
|
||||
read_phone_state =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
|
||||
val listPermissionsNeeded: MutableList<String> = java.util.ArrayList()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.READ_MEDIA_IMAGES)
|
||||
}
|
||||
} else {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
}
|
||||
|
||||
if (listPermissionsNeeded.isNotEmpty()) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
listPermissionsNeeded.toTypedArray<String>(),
|
||||
PERMISSION_ALL
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == PERMISSION_ALL) {
|
||||
val perms: MutableMap<String, Int> = HashMap()
|
||||
// Initialize the map with both permissions
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
perms[Manifest.permission.READ_MEDIA_IMAGES] = PackageManager.PERMISSION_GRANTED
|
||||
} else {
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] =
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
// Fill with actual results from user
|
||||
if (grantResults.isNotEmpty()) {
|
||||
for (i in permissions.indices) perms[permissions[i]] = grantResults[i]
|
||||
// Check for both permissions//
|
||||
if (perms[Manifest.permission.READ_MEDIA_IMAGES] == PackageManager.PERMISSION_GRANTED &&
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
Log.d("", "sms & location services permission granted")
|
||||
} else {
|
||||
Log.d("", "Some permissions are not granted ask again ")
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.READ_MEDIA_IMAGES
|
||||
) ||
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
showDialogOK(
|
||||
"Photos or media Service Permission required for this app"
|
||||
) { _: DialogInterface?, which: Int ->
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> checkAndRequestPermissions()
|
||||
DialogInterface.BUTTON_NEGATIVE -> {
|
||||
// proceed with logic by disabling the related features or quit the app.
|
||||
val startMain =
|
||||
Intent(Intent.ACTION_MAIN)
|
||||
startMain.addCategory(Intent.CATEGORY_HOME)
|
||||
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(startMain)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialogOK(message: String, okListener: DialogInterface.OnClickListener) {
|
||||
AlertDialog.Builder(this).setMessage(message).setPositiveButton("OK", okListener)
|
||||
.setNegativeButton("Cancel", okListener).create().show()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.Manifest
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.sj.camera_lib_android.Database.ReactPendingData
|
||||
import com.sj.camera_lib_android.Database.ReactSingleImage
|
||||
import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.RealtimeAdapter
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions.savefile
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.constant.CommonUtils
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdRealtimeReportBinding
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdimageBinding
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
class PD_Realtime_Report : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var lang: String? = null;
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
var country_id: String? = null
|
||||
var store_flag_str: String? = null
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdRealtimeReportBinding
|
||||
private var adapter: RealtimeAdapter? = null
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdRealtimeReportBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
context = this
|
||||
db = GSKOrangeDB(context)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
db?.open()
|
||||
preferences?.let {
|
||||
lang = it.getString(CommonString.KEY_LANGUAGE, "")
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
key_account_id = it.getString(CommonString.KEY_KEYACCOUNT_ID, "")
|
||||
country_id = it.getString(CommonString.KEY_COUNTRY_ID, "")
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
}
|
||||
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
intent?.let {
|
||||
categoryName = it.getStringExtra("categoryName")
|
||||
categoryId = it.getStringExtra("categoryId")
|
||||
kpi_name = it.getStringExtra("kpi_name")
|
||||
}
|
||||
supportActionBar?.apply {
|
||||
setHomeButtonEnabled(true)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
Log.d("pd_user_id",userId.toString());
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PD_Realtime_Report,
|
||||
projectId = projectId,
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
)
|
||||
)
|
||||
callAdapter()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
db?.open()
|
||||
}
|
||||
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item.itemId
|
||||
if (id == android.R.id.home) {
|
||||
//showDataLossAlert();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out)
|
||||
finish()
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
LocalBroadcastManager.getInstance(this@PD_Realtime_Report)
|
||||
.unregisterReceiver(myBroadcastReceiver) // onDestroy
|
||||
}
|
||||
|
||||
private fun registerIntentFilter(filters: List<String> = listOf()) {
|
||||
filters.forEach { filter ->
|
||||
LocalBroadcastManager.getInstance(this@PD_Realtime_Report)
|
||||
.registerReceiver(myBroadcastReceiver, IntentFilter(filter))
|
||||
}
|
||||
}
|
||||
|
||||
private val savedImages = mutableListOf<ImageUri>()
|
||||
private var myBroadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
"did-receive-queue-data" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ReactPendingData>("imageList")
|
||||
Log.d("DEBUG-LOG did-receive-queue-data", "$receivedList")
|
||||
if (receivedList.isNullOrEmpty()) {
|
||||
CameraSDK.uploadFailedImage(this@PD_Realtime_Report)
|
||||
}
|
||||
}
|
||||
|
||||
"did-receive-image-upload-status" -> {
|
||||
val receivedImage = intent.getParcelableExtra<ReactSingleImage>("image")
|
||||
Log.d("DEBUG-LOG did-receive-image-upload-status", "$receivedImage")
|
||||
}
|
||||
|
||||
"DataSaved" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ImageUploadModel>("imageListSaved")
|
||||
Log.d("DEBUG-LOG DataSaved", "$receivedList")
|
||||
receivedList?.let {
|
||||
savedImages.clear()
|
||||
it.forEach { item ->
|
||||
val dir = CommonString.getImagesFolder(context)
|
||||
val setName =
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPDIMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(item.uri.toUri(), "$dir $setName")
|
||||
}
|
||||
adapter?.updateItem(position = _pos, savedImages)
|
||||
Log.e("savedImages", savedImages.toString())
|
||||
_pos = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
if (country_id == "8") {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturedata(
|
||||
date,
|
||||
categoryId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_STOREWISE
|
||||
)
|
||||
} else if (store_flag_str.equals(CommonString.FROM_DEVIATION, ignoreCase = true)) {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturedata(
|
||||
date,
|
||||
categoryId,
|
||||
key_account_id,
|
||||
store_type_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADHOC
|
||||
)
|
||||
} else {
|
||||
db?.open()
|
||||
listdat = db?.getCategoryPicturedata(
|
||||
date,
|
||||
categoryId,
|
||||
key_account_id,
|
||||
store_type_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK
|
||||
)
|
||||
}
|
||||
adapter = RealtimeAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
subcates = ArrayList(),
|
||||
btnlistener = object : RealtimeAdapter.BtnClickListener {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PD_Realtime_Report._pos = _pos
|
||||
val intent = Intent(this@PD_Realtime_Report, PD_Realtime_Report_Detail::class.java)
|
||||
intent.putExtra("categoryName", categoryName)
|
||||
intent.putExtra("categoryId", categoryId)
|
||||
intent.putExtra("pd_subcat_code", data.subCatCode)
|
||||
intent.putExtra("subcat_name", data.suB_CATEGORY)
|
||||
intent.putExtra("kpi_name", "IR Realtime Report")
|
||||
startActivity(intent)
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out)
|
||||
// launchCamera(data.subCatCode)
|
||||
// Log.d("subCatCode", data.subCatCode)
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PD_Realtime_Report)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
}
|
||||
}
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.squareup.okhttp.Callback
|
||||
import com.squareup.okhttp.HttpUrl
|
||||
import com.squareup.okhttp.OkHttpClient
|
||||
import com.squareup.okhttp.Request
|
||||
import com.squareup.okhttp.Response
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.adapter.ScoreAdapter
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdRealtimeReportDetailBinding
|
||||
import cpm.com.gskmtorange.utils.ScoreItem
|
||||
import org.json.JSONObject
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
class PD_Realtime_Report_Detail : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var lang: String? = null;
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
var country_id: String? = null
|
||||
var pd_categoryId: String? = null
|
||||
var subcat_name: String? = null
|
||||
var store_flag_str: String? = null
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdRealtimeReportDetailBinding
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdRealtimeReportDetailBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
context = this
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
preferences?.let {
|
||||
lang = it.getString(CommonString.KEY_LANGUAGE, "")
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
key_account_id = it.getString(CommonString.KEY_KEYACCOUNT_ID, "")
|
||||
country_id = it.getString(CommonString.KEY_COUNTRY_ID, "")
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
}
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
intent?.let {
|
||||
categoryName = it.getStringExtra("categoryName")
|
||||
categoryId = it.getStringExtra("categoryId")
|
||||
kpi_name = it.getStringExtra("kpi_name")
|
||||
pd_categoryId = it.getStringExtra("pd_subcat_code")
|
||||
subcat_name = it.getStringExtra("subcat_name")
|
||||
Log.d("pdcode",pd_categoryId.toString())
|
||||
}
|
||||
supportActionBar?.apply {
|
||||
setHomeButtonEnabled(true)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
Log.d("pd_user_id", userId.toString());
|
||||
|
||||
}
|
||||
if (isNetworkAvailable(this@PD_Realtime_Report_Detail)) {
|
||||
fetchlivedata()
|
||||
} else {
|
||||
Toast.makeText(this, "No internet connection", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun fetchlivedata() {
|
||||
Log.d("apidata",date +","+store_id+","+pd_categoryId+","+preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
binding.recyclerView.visibility = View.GONE
|
||||
}
|
||||
|
||||
val client = OkHttpClient()
|
||||
val formattedDate = formatDate(date)
|
||||
val urlBuilder = HttpUrl.Builder()
|
||||
.scheme("https")
|
||||
.host("apis.shelfwatch.io")
|
||||
.addPathSegment("get_haleon_insights")
|
||||
.addQueryParameter("visit_date", formattedDate)
|
||||
.addQueryParameter("store_id", store_id)
|
||||
.addQueryParameter("category_id", pd_categoryId)
|
||||
.addQueryParameter("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(urlBuilder.build())
|
||||
.build()
|
||||
Log.d("apiparams",request.toString() + ","+urlBuilder)
|
||||
|
||||
client.newCall(request).enqueue(object : Callback {
|
||||
override fun onFailure(request: Request?, e: java.io.IOException?) {
|
||||
Log.e("RealtimeReport", "API call failed", e)
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
binding.recyclerView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResponse(response: Response?) {
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
binding.recyclerView.visibility = View.VISIBLE
|
||||
}
|
||||
val responseData = response?.body()?.string()
|
||||
Log.d("responsedata", responseData.toString())
|
||||
|
||||
responseData?.let { jsonStr ->
|
||||
try {
|
||||
val json = JSONObject(jsonStr)
|
||||
val output = json.getJSONObject("output")
|
||||
val report = output.getJSONObject("report")
|
||||
val overallArray = report.getJSONArray("overall")
|
||||
val imagelist = output.getJSONArray("images")
|
||||
|
||||
var osa = "0%"
|
||||
var msl = "0%"
|
||||
var posm = "0%"
|
||||
var sosSku = "0%"
|
||||
var sosBrand = "0%"
|
||||
|
||||
for (i in 0 until overallArray.length()) {
|
||||
val obj = overallArray.getJSONObject(i)
|
||||
when (obj.getString("kpi_name")) {
|
||||
"OSA" -> osa = obj.getString("value")
|
||||
"MSL OSA" -> msl = obj.getString("value")
|
||||
"POSM" -> posm = obj.getString("value")
|
||||
"SOS - SKU Level" -> sosSku = obj.getString("value")
|
||||
"SOS - Brand Level" -> sosBrand = obj.getString("value")
|
||||
}
|
||||
}
|
||||
|
||||
// Build OverallScore
|
||||
val scoreItems = mutableListOf<ScoreItem>()
|
||||
scoreItems.add(
|
||||
ScoreItem.OverallScore(
|
||||
osa = osa,
|
||||
msl = msl,
|
||||
posm = posm,
|
||||
sosSku = sosSku,
|
||||
sosBrand = sosBrand
|
||||
)
|
||||
)
|
||||
|
||||
// ===== Brand Details for "Toothpaste" =====
|
||||
val detailedArray = report.getJSONArray("detailed")
|
||||
var brandDetails: List<Pair<String, String>> = emptyList()
|
||||
|
||||
for (i in 0 until detailedArray.length()) {
|
||||
val detail = detailedArray.getJSONObject(i)
|
||||
if (detail.getString("kpi_name") == "SOS - Brand Level") {
|
||||
val dataArray = detail.getJSONArray("data")
|
||||
val brands = mutableListOf<Pair<String, String>>()
|
||||
for (j in 0 until dataArray.length()) {
|
||||
val brandObj = dataArray.getJSONObject(j)
|
||||
val brandName = brandObj.optString("brand_name", "Unknown")
|
||||
val value = brandObj.getString("value")
|
||||
if (brandName.isNotEmpty() && brandName != "null") {
|
||||
brands.add(brandName to value)
|
||||
}
|
||||
}
|
||||
brandDetails = brands
|
||||
}
|
||||
}
|
||||
|
||||
scoreItems.add(
|
||||
ScoreItem.CategoryScore(
|
||||
categoryName = subcat_name.toString(),
|
||||
msl = msl,
|
||||
posm = posm,
|
||||
sosSku = sosSku,
|
||||
sosBrand = sosBrand,
|
||||
brandDetails = brandDetails
|
||||
)
|
||||
)
|
||||
|
||||
// ===== IMAGE ITEMS =====
|
||||
if (imagelist.length()>0) {
|
||||
for (i in 0 until imagelist.length()) {
|
||||
val imgObj = imagelist.getJSONObject(i)
|
||||
val rawImages = imgObj.getJSONArray("raw_images")
|
||||
for (j in 0 until rawImages.length()) {
|
||||
val imgObjnew = rawImages.getJSONObject(j)
|
||||
val url = imgObjnew.getString("url")
|
||||
Log.d("imgurl",url);
|
||||
scoreItems.add(ScoreItem.ImageItem(url))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update UI on main thread
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(context)
|
||||
binding.recyclerView.adapter = ScoreAdapter(scoreItems)
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("RealtimeReport", "Parse error", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun formatDate(inputDate: String?): String {
|
||||
return try {
|
||||
// Parse input date (from "MM/dd/yyyy")
|
||||
val inputFormat = SimpleDateFormat("MM/dd/yyyy", Locale.US)
|
||||
val date = inputFormat.parse(inputDate ?: "")
|
||||
|
||||
// Format to "yyyy-MM-dd" for API, using Locale.US to avoid locale-specific digits
|
||||
val outputFormat = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||
if (date != null) outputFormat.format(date) else ""
|
||||
} catch (e: Exception) {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
// Finish the current activity and go back
|
||||
finish()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
fun isNetworkAvailable(context: Context): Boolean {
|
||||
val connectivityManager =
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
|
||||
val network = connectivityManager.activeNetwork ?: return false
|
||||
val activeNetwork = connectivityManager.getNetworkCapabilities(network) ?: return false
|
||||
|
||||
return when {
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true
|
||||
activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,18 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.Manifest
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -28,7 +23,6 @@ import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.LoginActivity
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
@@ -37,18 +31,20 @@ import cpm.com.gskmtorange.constant.CommonFunctions.savefile
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.constant.CommonUtils
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdimageBinding
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Master_Storelist_PDA_GetterSetter
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
|
||||
class PDimageActivity : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var lang: String? = null;
|
||||
var userId: String? = null
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
@@ -57,12 +53,16 @@ class PDimageActivity : AppCompatActivity() {
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var masterStoreListPd: ArrayList<Master_Storelist_PDA_GetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
var toggle: String? = "1"
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdimageBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
var devicename : String? = ""
|
||||
var store_name : String? = ""
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -74,7 +74,9 @@ class PDimageActivity : AppCompatActivity() {
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
db?.open()
|
||||
preferences?.let {
|
||||
lang = it.getString(CommonString.KEY_LANGUAGE, "")
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
store_name = it.getString(CommonString.KEY_STORE_NAME, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
@@ -83,6 +85,8 @@ class PDimageActivity : AppCompatActivity() {
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
}
|
||||
devicename = android.os.Build.MANUFACTURER
|
||||
// Log.d("device_name",devicename.toString())
|
||||
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
@@ -97,7 +101,34 @@ class PDimageActivity : AppCompatActivity() {
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
CommonUtils.initializePDSDK(this@PDimageActivity, _userId = username)
|
||||
masterStoreListPd = db?.getMasterStoreListPd(store_id,CommonString.TABLE_MASTER_STORELIST_PD)
|
||||
// Log.d("master_store_list_size",masterStoreListPd.toString())
|
||||
|
||||
|
||||
binding.rlContent.btntoggle.setOnClickListener {
|
||||
if(toggle =="1"){
|
||||
toggle = "0"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
else{
|
||||
toggle = "1"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
Log.d("toggle_value_new",toggle.toString())
|
||||
}
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
// Log.d("pd_user_id",userId.toString());
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PDimageActivity,
|
||||
projectId = projectId,
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
@@ -112,7 +143,14 @@ class PDimageActivity : AppCompatActivity() {
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
// Handle Yes button click
|
||||
db?.open()
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat)?.let {
|
||||
db?.InsertPdImageData(
|
||||
date,
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
toggle,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
@@ -121,6 +159,12 @@ class PDimageActivity : AppCompatActivity() {
|
||||
).setAction("Action", null).show()
|
||||
lifecycleScope.launch {
|
||||
delay(3000) // 3 seconds delay
|
||||
val intent = Intent(this@PDimageActivity, PD_Realtime_Report::class.java)
|
||||
intent.putExtra("categoryName", categoryName)
|
||||
intent.putExtra("categoryId", categoryId)
|
||||
intent.putExtra("kpi_name", "IR Realtime Analytics")
|
||||
startActivity(intent)
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out)
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
@@ -140,20 +184,23 @@ class PDimageActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callAdapter()
|
||||
checkAndRequestPermissions()
|
||||
// checkAndRequestPermissions()
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
CommonFunctions.updateLangResources(
|
||||
context,
|
||||
preferences!!.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty()) {
|
||||
if (!listdat.isNullOrEmpty() && toggle=="1") {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
@@ -169,7 +216,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
return checkFlag // Correctly return validation result
|
||||
}
|
||||
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item.itemId
|
||||
@@ -181,7 +227,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
@@ -228,12 +273,11 @@ class PDimageActivity : AppCompatActivity() {
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPDIMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(Uri.parse(item.uri), "$dir $setName")
|
||||
savefile(item.uri.toUri(), "$dir $setName")
|
||||
}
|
||||
adapter?.updateItem(position = _pos, savedImages)
|
||||
Log.e("savedImages",savedImages.toString())
|
||||
Log.e("savedImages", savedImages.toString())
|
||||
_pos = -1
|
||||
}
|
||||
}
|
||||
@@ -243,50 +287,85 @@ class PDimageActivity : AppCompatActivity() {
|
||||
|
||||
private fun launchCamera(subCat_code: String) {
|
||||
val uploadFrom = "TestApp"
|
||||
val uploadParams = JSONObject(
|
||||
"""
|
||||
{
|
||||
"shop_id": 62475,
|
||||
"project_id": "4f57635b-6b07-45bf-bfba-c61c2826b6db",
|
||||
"td_version_id": 178,
|
||||
"shelf_image_id": null,
|
||||
"asset_image_id": null,
|
||||
"shelf_type": "Primary Shelf",
|
||||
"category_id": 123,
|
||||
"user_id": 133,
|
||||
"isConnected": true,
|
||||
"sn_image_type": "skus",
|
||||
"image_type": "multiple",
|
||||
"seq_no": 1,
|
||||
"level": 1,
|
||||
"uploadOnlyOnWifi": 0,
|
||||
"app_session_id": "8e2faa6b-d6fe-413a-a693-76a0cbe0ce71",
|
||||
"metadata": { "Device_Name": "Samsung" }
|
||||
}
|
||||
"""
|
||||
)
|
||||
uploadParams.put("shop_id", store_id)
|
||||
val masterstorelistpddata = masterStoreListPd?.getOrNull(0)
|
||||
val metadata = JSONObject().apply {
|
||||
put("Device_Name", devicename ?: "NA")
|
||||
put("username", username ?: "NA")
|
||||
put("shop_name", store_name ?: "NA")
|
||||
put("parinaam_id", masterstorelistpddata?.storeId?.getOrNull(0) ?: "NA") //storeid
|
||||
put("channel", masterstorelistpddata?.channel?.getOrNull(0) ?: "NA")
|
||||
put("format", masterstorelistpddata?.format?.getOrNull(0) ?: "NA")
|
||||
put("region", masterstorelistpddata?.region?.getOrNull(0) ?: "NA")
|
||||
put("bay_type", masterstorelistpddata?.bay_type?.getOrNull(0) ?: "NA")
|
||||
put("no_of_bays", masterstorelistpddata?.no_of_bays?.getOrNull(0) ?: "NA")
|
||||
put("category", categoryName?: "NA")
|
||||
put("user_id", masterstorelistpddata?.user_id?.getOrNull(0) ?: "NA")
|
||||
put("Active", masterstorelistpddata?.active?.getOrNull(0) ?: "NA")
|
||||
put("ASMArea", masterstorelistpddata?.asmArea?.getOrNull(0) ?: "NA")
|
||||
put("EmployeeName", masterstorelistpddata?.employeeName?.getOrNull(0) ?: "NA")
|
||||
put("DesignationName", masterstorelistpddata?.designationName?.getOrNull(0) ?: "NA")
|
||||
put("SupervisorId", masterstorelistpddata?.supervisorId?.getOrNull(0) ?: "NA")
|
||||
put("Supervisor", masterstorelistpddata?.supervisor?.getOrNull(0) ?: "NA")
|
||||
put("StoreCode", masterstorelistpddata?.storeCode?.getOrNull(0) ?: "NA")
|
||||
put("ChainId", masterstorelistpddata?.chainId?.getOrNull(0) ?: "NA")
|
||||
put("StoreTypeId", masterstorelistpddata?.storeTypeId?.getOrNull(0) ?: "NA")
|
||||
put("SOName", masterstorelistpddata?.soName?.getOrNull(0) ?: "NA")
|
||||
}
|
||||
val uploadParams = JSONObject().apply {
|
||||
put("shop_id", store_id)
|
||||
put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
put("shelf_type", "Primary Shelf")
|
||||
put("category_id", subCat_code)
|
||||
put("user_id", userId)
|
||||
// put("user_id", userId)
|
||||
put("metadata", metadata)
|
||||
}
|
||||
|
||||
// "metadata": { "Device_Name": $devicename,"Username": $username }
|
||||
/* uploadParams.put("shop_id", store_id)
|
||||
uploadParams.put("user_id", username)
|
||||
uploadParams.put("category_id", subCat_code)
|
||||
uploadParams.put("project_id", CommonString.PD_PROJECT_iD)
|
||||
uploadParams.put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))*/
|
||||
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
Log.d("uploadParams", uploadParams.toString())
|
||||
if(!lang.equals("ENGLISH",ignoreCase = true)){
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "ar",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
else{
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
@@ -324,9 +403,8 @@ class PDimageActivity : AppCompatActivity() {
|
||||
CommonString.TABLE_MAPPING_STOCK
|
||||
)
|
||||
}
|
||||
|
||||
Log.d("listdatsize", listdat?.size.toString())
|
||||
adapter = SubCatPdAdapter(category = categoryName,
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
subcates = ArrayList(),
|
||||
btnlistener = object : SubCatPdAdapter.BtnClickListener {
|
||||
@@ -336,111 +414,27 @@ class PDimageActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDimageActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDimageActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
// Now only handle toggle visibility
|
||||
toggle = listdat?.get(0)?.toggle_value ?: "1"
|
||||
|
||||
if(toggle == "1"){
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
} else {
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat)
|
||||
}
|
||||
|
||||
private fun checkAndRequestPermissions() {
|
||||
var read_phone_state = 0
|
||||
var write_storage = 0
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES)
|
||||
} else {
|
||||
read_phone_state =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
if (!db!!.isSOSCategory(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat,toggle, CommonString.KEY_DRAFT)
|
||||
}
|
||||
|
||||
val listPermissionsNeeded: MutableList<String> = java.util.ArrayList()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.READ_MEDIA_IMAGES)
|
||||
}
|
||||
} else {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
}
|
||||
|
||||
if (listPermissionsNeeded.isNotEmpty()) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
listPermissionsNeeded.toTypedArray<String>(),
|
||||
PERMISSION_ALL
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
if (requestCode == PERMISSION_ALL) {
|
||||
val perms: MutableMap<String, Int> = HashMap()
|
||||
// Initialize the map with both permissions
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
perms[Manifest.permission.READ_MEDIA_IMAGES] = PackageManager.PERMISSION_GRANTED
|
||||
} else {
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] =
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
// Fill with actual results from user
|
||||
if (grantResults.isNotEmpty()) {
|
||||
for (i in permissions.indices) perms[permissions[i]] = grantResults[i]
|
||||
// Check for both permissions//
|
||||
if (perms[Manifest.permission.READ_MEDIA_IMAGES] == PackageManager.PERMISSION_GRANTED &&
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
Log.d("", "sms & location services permission granted")
|
||||
} else {
|
||||
Log.d("", "Some permissions are not granted ask again ")
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.READ_MEDIA_IMAGES
|
||||
) ||
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
showDialogOK(
|
||||
"Photos or media Service Permission required for this app"
|
||||
) { dialog: DialogInterface?, which: Int ->
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> checkAndRequestPermissions()
|
||||
DialogInterface.BUTTON_NEGATIVE -> {
|
||||
// proceed with logic by disabling the related features or quit the app.
|
||||
val startMain =
|
||||
Intent(Intent.ACTION_MAIN)
|
||||
startMain.addCategory(Intent.CATEGORY_HOME)
|
||||
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(startMain)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialogOK(message: String, okListener: DialogInterface.OnClickListener) {
|
||||
AlertDialog.Builder(this).setMessage(message).setPositiveButton("OK", okListener)
|
||||
.setNegativeButton("Cancel", okListener).create().show()
|
||||
}
|
||||
}
|
||||
@@ -118,32 +118,10 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (validateData()) {
|
||||
|
||||
db.savePOGQuestionAnswerData(hashMapListChildData, headerDataList, store_id, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder builder = new AlertDialog.Builder(POGQuestionsActivity.this);
|
||||
builder.setMessage(R.string.title_activity_Want_save)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.savePOGQuestionAnswerData(hashMapListChildData, headerDataList,store_id, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();*/
|
||||
|
||||
} else {
|
||||
|
||||
if(adapter!=null){
|
||||
adapter.notifyDataSetChanged();
|
||||
expandableListView.invalidateViews();
|
||||
|
||||
+33
-37
@@ -51,7 +51,6 @@ import com.google.android.gms.location.Priority;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -78,6 +77,7 @@ import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -185,39 +185,41 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
switch (id) {
|
||||
case R.id.img_cam_selfie:
|
||||
_pathforcheck = checkOutStore_id + "CHK_SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
break;
|
||||
if (id == R.id.img_cam_selfie) {
|
||||
_pathforcheck = checkOutStore_id + "CHK_SI_"
|
||||
+ visit_date.replace("/", "") + "_"
|
||||
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
case R.id.btn_save_selfie:
|
||||
if (img_str != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreCheckoutImageActivity.this);
|
||||
builder.setMessage(getResources().getString(R.string.title_activity_save_data))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), (dialog, id1) -> {
|
||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
Intent i = new Intent(StoreCheckoutImageActivity.this, CheckoutActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, checkOutStore_id);
|
||||
i.putExtra(CommonString.KEY_CHECKOUT_IMAGE, img_str);
|
||||
i.putExtra(CommonString.KEY_LATITUDE, lat);
|
||||
i.putExtra(CommonString.KEY_LONGITUDE, lon);
|
||||
startActivity(i);
|
||||
finish();
|
||||
}).setNegativeButton(getResources().getString(R.string.cancel), (dialog, id12) -> dialog.cancel());
|
||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
alert = builder.create();
|
||||
alert.show();
|
||||
} else {
|
||||
Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else if (id == R.id.btn_save_selfie) {
|
||||
if (img_str != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreCheckoutImageActivity.this);
|
||||
builder.setMessage(getResources().getString(R.string.title_activity_save_data))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), (dialog, id1) -> {
|
||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
Intent i = new Intent(StoreCheckoutImageActivity.this, CheckoutActivity.class);
|
||||
i.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
i.putExtra(CommonString.KEY_STORE_ID, checkOutStore_id);
|
||||
i.putExtra(CommonString.KEY_CHECKOUT_IMAGE, img_str);
|
||||
i.putExtra(CommonString.KEY_LATITUDE, lat);
|
||||
i.putExtra(CommonString.KEY_LONGITUDE, lon);
|
||||
startActivity(i);
|
||||
finish();
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), (dialog, id12) -> dialog.cancel());
|
||||
|
||||
break;
|
||||
alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
} else {
|
||||
Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startCameraActivity() {
|
||||
@@ -467,9 +469,6 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
|
||||
SoapObject request = new SoapObject(CommonString.NAMESPACE,
|
||||
CommonString.METHOD_UPLOAD_CURRENT_DATA);
|
||||
//request.addProperty("MID", "0");
|
||||
// request.addProperty("KEYS", "CURRENT_DATA");
|
||||
// request.addProperty("USERNAME", username);
|
||||
|
||||
request.addProperty("onXML", current_xml);
|
||||
|
||||
@@ -478,7 +477,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(
|
||||
CommonString.URL);
|
||||
androidHttpTransport.call(
|
||||
CommonString.SOAP_ACTION_UPLOAD_CURRRENT_DATA, envelope);
|
||||
@@ -578,13 +577,10 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
|
||||
//showAlert(getString(R.string.data_downloaded_successfully));
|
||||
} else {
|
||||
|
||||
GSKOrangeDB db = new GSKOrangeDB(StoreCheckoutImageActivity.this);
|
||||
db.open();
|
||||
|
||||
dialog.dismiss();
|
||||
db.deleteTableWithStoreID(store_id);
|
||||
|
||||
showAlert(getString(R.string.datanotfound) + " " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@@ -76,7 +78,6 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
@@ -112,26 +113,22 @@ import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivity;
|
||||
import cpm.com.gskmtorange.storeinmap.StoreListMapActivity;
|
||||
import cpm.com.gskmtorange.storeinmap.StoreListRouteActivity;
|
||||
import cpm.com.gskmtorange.storeinmap.StoreRouteActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ADDITIONAL_DISPLAY_MASTERGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.AdditionalQuestiongetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CategoryMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationContrywiseGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.GeoFencingGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_SOS_TARGET_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingCategoryImageAllowGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingPlanogramCountrywiseGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingPlanogramStorewiseGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
|
||||
@@ -147,7 +144,6 @@ import cpm.com.gskmtorange.xmlGetterSetter.ShelfMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGroupMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SupervisorListGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Visit_Type_Master_GetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
|
||||
|
||||
public class StoreListActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
@@ -287,7 +283,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
|
||||
}
|
||||
|
||||
deleteIRURl();
|
||||
// deleteIRURl();
|
||||
}
|
||||
|
||||
private void deleteIRURl() {
|
||||
@@ -299,7 +295,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
if (uris != null && !uris.isEmpty()) {
|
||||
for (int k = 0; k < uris.size(); k++) {
|
||||
CommonUtils.INSTANCE.deleteSpecificImage(this,uris.get(k).getUri());
|
||||
CommonUtils.INSTANCE. deleteImage(this,uris.get(k).getUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,7 +496,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
for (Location location : locationResult.getLocations()) {
|
||||
lat = location.getLatitude();
|
||||
lon = location.getLongitude();
|
||||
// Log.e("latitude_inside",location.getLatitude() + "," +location.getLongitude());
|
||||
Log.e("latitude_inside",location.getLatitude() + "," +location.getLongitude());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,6 +593,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
|
||||
} else if (id == R.id.iconMap) {
|
||||
|
||||
Log.d("Mapdata", "latitude is :" +" " +lat + "," + lon);
|
||||
Intent in = new Intent(context, StoreListRouteActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_LIST, storelist);
|
||||
startActivity(in);
|
||||
@@ -714,101 +710,153 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
viewHolder.imgview_navigation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
viewHolder.parent_layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
store_id = current.getSTORE_ID();
|
||||
store_facing_hide = current.getFACING_HIDE();
|
||||
storeCurrentObj = current;
|
||||
|
||||
viewHolder.parent_layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U) || current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_data_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_Y)) {
|
||||
|
||||
store_id = current.getSTORE_ID();
|
||||
store_facing_hide = current.getFACING_HIDE();
|
||||
storeCurrentObj = current;
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_checkout, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (store_flag_str.equals(CommonString.FROM_DEVIATION) && (coverageObj.getStatus() != null
|
||||
&& coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID))) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (checkleavestatus(store_id)) {
|
||||
|
||||
if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U) || current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_data_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_Y)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_checkout, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (checkleavestatus(store_id)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
} else {
|
||||
// PUT IN PREFERENCES
|
||||
if (checkotherCheckedIn(store_flag_str)) {
|
||||
Snackbar.make(v, getString(R.string.title_store_list_checkout_current) + " - " + from_checkedIn, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} else {
|
||||
if (!setCheckedMethod(store_id)) {
|
||||
boolean enteryflag = true;
|
||||
if (coverage.size() > 0) {
|
||||
int i;
|
||||
for (i = 0; i < coverage.size(); i++) {
|
||||
// PUT IN PREFERENCES
|
||||
if (checkotherCheckedIn(store_flag_str)) {
|
||||
Snackbar.make(v, getString(R.string.title_store_list_checkout_current) + " - " + from_checkedIn, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} else {
|
||||
if (!setCheckedMethod(store_id)) {
|
||||
boolean enteryflag = true;
|
||||
if (coverage.size() > 0) {
|
||||
int i;
|
||||
for (i = 0; i < coverage.size(); i++) {
|
||||
|
||||
if (coverage.get(i).getInTime() != null) {
|
||||
if (coverage.get(i).getInTime() != null) {
|
||||
|
||||
if (coverage.get(i).getOutTime() == null) {
|
||||
if (!store_id.equals(coverage.get(i).getStoreId())) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
enteryflag = false;
|
||||
if (coverage.get(i).getOutTime() == null) {
|
||||
if (!store_id.equals(coverage.get(i).getStoreId())) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
enteryflag = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enteryflag) {
|
||||
if (store_flag_str.equals(CommonString.FROM_PHARMA) && coverageObj.getStatus() != null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} /*if((store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) && coverageObj.getStatus()!=null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)){
|
||||
if (enteryflag) {
|
||||
if (store_flag_str.equals(CommonString.FROM_PHARMA) && coverageObj.getStatus() != null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} /*if((store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) && coverageObj.getStatus()!=null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)){
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}*/ else if (store_flag_str.equals(CommonString.FROM_JCP) || store_flag_str.equals(CommonString.FROM_PHARMA) || store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) {
|
||||
showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS(), current.getGEO_TAG(), current);
|
||||
} else {
|
||||
if (country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase("15") || country_id.equalsIgnoreCase("2") || country_id.equalsIgnoreCase(CommonString.COUNTRY_ID_EGYPT + "")) {
|
||||
if (!current.getGEO_TAG().equalsIgnoreCase("N")) {
|
||||
boolean flag = true;
|
||||
if (coverage.size() > 0) {
|
||||
for (int i = 0; i < coverage.size(); i++) {
|
||||
if (store_id.equals(coverage.get(i).getStoreId())) {
|
||||
flag = false;
|
||||
break;
|
||||
showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS(), current.getGEO_TAG(), current);
|
||||
} else {
|
||||
if (country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase("15") || country_id.equalsIgnoreCase("2") || country_id.equalsIgnoreCase(CommonString.COUNTRY_ID_EGYPT + "")) {
|
||||
if (!current.getGEO_TAG().equalsIgnoreCase("N")) {
|
||||
boolean flag = true;
|
||||
if (coverage.size() > 0) {
|
||||
for (int i = 0; i < coverage.size(); i++) {
|
||||
if (store_id.equals(coverage.get(i).getStoreId())) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean flag_entry = true;
|
||||
int distance = 0;
|
||||
//geo fencing enabled only if GEO_FENCING equals 1 for COUNTRY_ID
|
||||
if (flag && geoFencingGetterSetters.size() > 0 && geoFencingGetterSetters.get(0).getGEO_FENCING().get(0).equals("1")) {
|
||||
distanceGeoPhence = Integer.parseInt(geoFencingGetterSetters.get(0).getDISTANCE_MTR().get(0));
|
||||
boolean flag_entry = true;
|
||||
int distance = 0;
|
||||
//geo fencing enabled only if GEO_FENCING equals 1 for COUNTRY_ID
|
||||
if (flag && geoFencingGetterSetters.size() > 0 && geoFencingGetterSetters.get(0).getGEO_FENCING().get(0).equals("1")) {
|
||||
distanceGeoPhence = Integer.parseInt(geoFencingGetterSetters.get(0).getDISTANCE_MTR().get(0));
|
||||
|
||||
double store_lat = Double.parseDouble(current.getLATITUDE());
|
||||
double store_lon = Double.parseDouble(current.getLONGITUDE());
|
||||
double store_lat = Double.parseDouble(current.getLATITUDE());
|
||||
double store_lon = Double.parseDouble(current.getLONGITUDE());
|
||||
|
||||
if (store_lat != 0.0 && store_lon != 0.0) {
|
||||
distance = distFrom(store_lat, store_lon, lat, lon);
|
||||
if (store_lat != 0.0 && store_lon != 0.0) {
|
||||
distance = distFrom(store_lat, store_lon, lat, lon);
|
||||
|
||||
if (distance > distanceGeoPhence) {
|
||||
flag_entry = false;
|
||||
if (distance > distanceGeoPhence) {
|
||||
flag_entry = false;
|
||||
} else {
|
||||
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_entry) {
|
||||
// Log.e("flag_entrydata","flagdata");
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
|
||||
if (!coverageObj.getStatus().equalsIgnoreCase("N")) {
|
||||
//if(db.isFilledAdhoc(store_id, visit_date)){
|
||||
Intent in = new Intent(StoreListActivity.this, StoreWisePerformanceActivity.class);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String msg = getString(R.string.you_need_to_be_in_the_store) + "\n " + getString(R.string.distance_from_the_store) + " - " + distance + " " + getString(R.string.meters);
|
||||
//dialog.cancel();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog1, int id) {
|
||||
|
||||
dialog1.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
|
||||
alert.show();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (flag_entry) {
|
||||
// Log.e("flag_entrydata","flagdata");
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
@@ -817,89 +865,51 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
|
||||
if (!coverageObj.getStatus().equalsIgnoreCase("N")) {
|
||||
//if(db.isFilledAdhoc(store_id, visit_date)){
|
||||
Intent in = new Intent(StoreListActivity.this, StoreWisePerformanceActivity.class);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
}
|
||||
} else {
|
||||
String msg = getString(R.string.you_need_to_be_in_the_store) + "\n " + getString(R.string.distance_from_the_store) + " - " + distance + " " + getString(R.string.meters);
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//dialog.cancel();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog1, int id) {
|
||||
|
||||
dialog1.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
|
||||
alert.show();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
//dialog.cancel();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (coverageObj.getStatus().equals("N")) {
|
||||
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
if (coverageObj.getStatus().equals("N")) {
|
||||
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
viewHolder.imgview_navigation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.e("mapdata",lat + ","+lon);
|
||||
Intent in = new Intent(context, StoreRouteActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_LIST, current);
|
||||
startActivity(in);
|
||||
@@ -917,44 +927,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
/* String visit_xml = "";
|
||||
String onXML = "";
|
||||
ArrayList<Visit_Type_Master_GetterSetter> visittypelist = db.getUploadedVisitType(store_id);
|
||||
|
||||
if (visittypelist.size() > 0) {
|
||||
for (int j = 0; j < visittypelist.size(); j++) {
|
||||
// Log.e("visit_type_id", String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()));
|
||||
if(String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()).equalsIgnoreCase("[3]")){
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" + "3" + "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
else if(String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()).equalsIgnoreCase("[2]")){
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" + "2" + "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
else{
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" +"1"+ "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
|
||||
visit_xml = visit_xml + onXML;
|
||||
}
|
||||
final String sos_xml = "[DATA]" + visit_xml + "[/DATA]";
|
||||
Log.e("visit_xml_data", sos_xml);
|
||||
}*/
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setMessage(R.string.wantcheckout).setCancelable(false).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
@@ -1152,34 +1124,32 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
dialog.cancel();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(R.string.first_geotag_the_store).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog1, int id) {
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
builder.setMessage(R.string.first_geotag_the_store).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
|
||||
editor.commit();
|
||||
editor.commit();
|
||||
|
||||
Intent in = new Intent(StoreListActivity.this, GeoTagActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
dialog1.cancel();
|
||||
}
|
||||
Intent in = new Intent(StoreListActivity.this, GeoTagActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
dialog1.cancel();
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
@@ -1445,7 +1415,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
Object result = envelope.getResponse();
|
||||
@@ -1469,7 +1439,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
} else {
|
||||
// return "MAPPING_STOCK";
|
||||
}
|
||||
|
||||
}
|
||||
publishProgress(data);
|
||||
|
||||
@@ -1483,7 +1452,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1523,7 +1492,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1559,7 +1528,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1594,7 +1563,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1632,7 +1601,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1669,7 +1638,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1705,7 +1674,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1927,7 +1896,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
db.createTable(mapping_sos_target_masterGetterSetter.getTable_MAPPING_SOS_TARGET());
|
||||
db.createTable(noCameraLastVisitGetterSetter.getTable_NO_CAMERA_LAST_VISIT_DATA());
|
||||
db.createTable(store_performance_masterGetterSetter.getTable_STORE_PERFORMANCE());
|
||||
|
||||
db.InsertAdhocFilled(storeId, visit_date);
|
||||
db.InsertMAPPING_T2P(mappingt2PGetterSetter, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||
db.InsertMappingStock(mappingStockGetterSetter, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -56,7 +58,6 @@ import com.google.android.gms.location.Priority;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -84,7 +85,9 @@ import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -303,33 +306,6 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
|
||||
/*if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mLastLocation != null) {
|
||||
lat = mLastLocation.getLatitude();
|
||||
lon = mLastLocation.getLongitude();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (mRequestingLocationUpdates) {
|
||||
startLocationUpdates();*/
|
||||
// }
|
||||
|
||||
// startLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,21 +335,12 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
// AppIndex.AppIndexApi.end(client, getIndexApiAction());
|
||||
/* if (mGoogleApiClient.isConnected()) {
|
||||
mGoogleApiClient.disconnect();
|
||||
}*/
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
//client.disconnect();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//stopLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -481,136 +448,116 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
int id = v.getId();
|
||||
|
||||
switch (id) {
|
||||
if (id == R.id.img_cam_selfie) {
|
||||
|
||||
case R.id.img_cam_selfie:
|
||||
_pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
|
||||
_pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
|
||||
_path = str + _pathforcheck;
|
||||
|
||||
_path = str + _pathforcheck;
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
|
||||
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
|
||||
startCameraActivity();
|
||||
|
||||
startCameraActivity();
|
||||
} else if (id == R.id.btn_save_selfie) {
|
||||
|
||||
break;
|
||||
if (img_str != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
|
||||
builder.setMessage(getResources().getString(R.string.title_activity_save_data))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
String status;
|
||||
|
||||
case R.id.btn_save_selfie:
|
||||
if (img_str != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
|
||||
builder.setMessage(getResources().getString(R.string.title_activity_save_data))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
String status;
|
||||
//if (store_flag_str.equals(CommonString.FROM_JCP) || country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase(CommonString.COUNTRY_ID_EGYPT +"")
|
||||
// || store_flag_str.equals(CommonString.FROM_ADDITIONAL) || store_flag_str.equals(CommonString.FROM_PHARMA)) {
|
||||
if (store_flag_str.equals(CommonString.FROM_JCP) || country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase("15")
|
||||
|| store_flag_str.equals(CommonString.FROM_PHARMA)) {
|
||||
status = CommonString.KEY_INVALID;
|
||||
} else {
|
||||
if (VISIT_TYPE_ID != null) {
|
||||
if (country_id.equals("2") && (VISIT_TYPE_ID.equals("1") || VISIT_TYPE_ID.equals("3"))) {
|
||||
status = CommonString.KEY_INVALID;
|
||||
} else {
|
||||
status = CommonString.KEY_VALID;
|
||||
}
|
||||
if (store_flag_str.equals(CommonString.FROM_JCP)
|
||||
|| country_id.equalsIgnoreCase("5")
|
||||
|| country_id.equalsIgnoreCase("15")
|
||||
|| store_flag_str.equals(CommonString.FROM_PHARMA)) {
|
||||
status = CommonString.KEY_INVALID;
|
||||
} else {
|
||||
if (VISIT_TYPE_ID != null) {
|
||||
if (country_id.equals("2") && (VISIT_TYPE_ID.equals("1") || VISIT_TYPE_ID.equals("3"))) {
|
||||
status = CommonString.KEY_INVALID;
|
||||
} else {
|
||||
status = CommonString.KEY_VALID;
|
||||
}
|
||||
|
||||
}
|
||||
CoverageBean cdata = new CoverageBean();
|
||||
cdata.setStoreId(store_id);
|
||||
cdata.setVisitDate(visit_date);
|
||||
cdata.setUserId(username);
|
||||
cdata.setInTime(intime);
|
||||
cdata.setReason("");
|
||||
cdata.setReasonid("0");
|
||||
cdata.setLatitude(lat + "");
|
||||
cdata.setLongitude(lon + "");
|
||||
cdata.setImage(img_str);
|
||||
cdata.setSub_reasonId("0");
|
||||
cdata.setRemark("");
|
||||
cdata.setStatus(status);
|
||||
cdata.setCheckOut_Image("");
|
||||
cdata.setFlag_from(store_flag_str);
|
||||
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
cdata.setKeyAccountId("0");
|
||||
cdata.setStoreTypeId("0");
|
||||
cdata.setClassId("0");
|
||||
} else {
|
||||
cdata.setKeyAccountId(keyAccount_id);
|
||||
cdata.setStoreTypeId(storeType_id);
|
||||
cdata.setClassId(class_id);
|
||||
status = CommonString.KEY_VALID;
|
||||
}
|
||||
}
|
||||
|
||||
database.open();
|
||||
database.InsertCoverageData(cdata);
|
||||
String table;
|
||||
if (store_flag_str.equals(CommonString.FROM_JCP)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_ADDITIONAL)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN_ADDITIONAL;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_PHARMA)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN_PHARMA;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC)) {
|
||||
table = CommonString.KEY_ADHOC_JOURNEYPLAN_ADDITIONAL;
|
||||
} else {
|
||||
table = CommonString.KEY_ADHOC_JOURNEY_PLAN;
|
||||
}
|
||||
CoverageBean cdata = new CoverageBean();
|
||||
cdata.setStoreId(store_id);
|
||||
cdata.setVisitDate(visit_date);
|
||||
cdata.setUserId(username);
|
||||
cdata.setInTime(intime);
|
||||
cdata.setReason("");
|
||||
cdata.setReasonid("0");
|
||||
cdata.setLatitude(lat + "");
|
||||
cdata.setLongitude(lon + "");
|
||||
cdata.setImage(img_str);
|
||||
cdata.setSub_reasonId("0");
|
||||
cdata.setRemark("");
|
||||
cdata.setStatus(status);
|
||||
cdata.setCheckOut_Image("");
|
||||
cdata.setFlag_from(store_flag_str);
|
||||
|
||||
database.updateCheckoutStatus(store_id, status, table);
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
cdata.setKeyAccountId("0");
|
||||
cdata.setStoreTypeId("0");
|
||||
cdata.setClassId("0");
|
||||
} else {
|
||||
cdata.setKeyAccountId(keyAccount_id);
|
||||
cdata.setStoreTypeId(storeType_id);
|
||||
cdata.setClassId(class_id);
|
||||
}
|
||||
|
||||
/* SharedPreferences.Editor editor = preferences.edit();
|
||||
database.open();
|
||||
database.InsertCoverageData(cdata);
|
||||
|
||||
editor.putString(CommonString.KEY_STOREVISITED_STATUS, "");
|
||||
editor.putString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
String table;
|
||||
if (store_flag_str.equals(CommonString.FROM_JCP)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_ADDITIONAL)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN_ADDITIONAL;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_PHARMA)) {
|
||||
table = CommonString.KEY_JOURNEY_PLAN_PHARMA;
|
||||
} else if (store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC)) {
|
||||
table = CommonString.KEY_ADHOC_JOURNEYPLAN_ADDITIONAL;
|
||||
} else {
|
||||
table = CommonString.KEY_ADHOC_JOURNEY_PLAN;
|
||||
}
|
||||
|
||||
editor.commit();*/
|
||||
database.updateCheckoutStatus(store_id, status, table);
|
||||
|
||||
|
||||
//Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class);
|
||||
if(isInternetAvailable(context)){
|
||||
new GeoTagUpload(StoreimageActivity.this).execute();
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
alert = builder.create();
|
||||
alert.show();
|
||||
alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
} else {
|
||||
Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startCameraActivity() {
|
||||
try {
|
||||
/*Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
Uri outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
||||
|
||||
Intent intent = new Intent(
|
||||
MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
|
||||
startActivityForResult(intent, 0);*/
|
||||
|
||||
Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
|
||||
//android.os.FileUriExposedException: file:///storage/emulated/0/.GSK_MT_ORANGE_IMAGES/15024SI_01022019_120426.jpg exposed beyond app through ClipData.Item.getUri()
|
||||
//outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
||||
|
||||
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
@@ -752,17 +699,6 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
|
||||
|
||||
/*protected void onStart() {
|
||||
mGoogleApiClient.connect();
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
protected void onStop() {
|
||||
mGoogleApiClient.disconnect();
|
||||
super.onStop();
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
|
||||
@@ -864,14 +800,13 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + service, envelope);
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
if (result.toString().equalsIgnoreCase(
|
||||
CommonString.KEY_SUCCESS)) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (result.toString().equalsIgnoreCase(
|
||||
|
||||
@@ -0,0 +1,457 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.webkit.ConsoleMessage
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import com.bumptech.glide.request.target.ViewTarget
|
||||
import cpm.com.gskmtorange.databinding.ActivityWebviewBinding
|
||||
import org.json.JSONObject
|
||||
|
||||
class WebViewActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var binding: ActivityWebviewBinding
|
||||
var toolbar: Toolbar? = null
|
||||
|
||||
private lateinit var type : String
|
||||
private var player: ExoPlayer? = null
|
||||
// private var player : ExoPlayer? = null
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityWebviewBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val url = intent.getStringExtra("url") ?: ""
|
||||
type = intent.getStringExtra("type") ?: "html-webview"
|
||||
type = intent.getStringExtra("type") ?: "html-webview"
|
||||
handleContent(type, url)
|
||||
|
||||
binding.toolbar.setTitle("Banner Detail")
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
|
||||
|
||||
/* // ✅ SETTINGS
|
||||
with(binding.webView.settings) {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
javaScriptCanOpenWindowsAutomatically = true
|
||||
setSupportMultipleWindows(true)
|
||||
loadWithOverviewMode = true
|
||||
useWideViewPort = true
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||
}
|
||||
|
||||
// ✅ JS INTERFACE
|
||||
binding.webView.addJavascriptInterface(WebAppInterface(), "Android")
|
||||
|
||||
// ✅ WEBVIEW CLIENT
|
||||
binding.webView.webViewClient = object : WebViewClient() {
|
||||
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: android.graphics.Bitmap?) {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
injectJS(view) // 🔥 early injection
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
injectJS(view) // 🔥 safe injection again
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ JS LOGS
|
||||
binding.webView.webChromeClient = object : WebChromeClient() {
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
|
||||
Log.e("JS_LOG", consoleMessage?.message() ?: "")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
binding.webView.loadUrl(url)
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private fun handleContent(type: String, url: String) {
|
||||
when (type) {
|
||||
"html-webview" -> {
|
||||
binding.webView.visibility = View.VISIBLE
|
||||
binding.imageView.visibility = View.GONE
|
||||
binding.videoView.visibility = View.GONE
|
||||
setupWebView(url)
|
||||
}
|
||||
|
||||
"image" -> {
|
||||
binding.webView.visibility = View.GONE
|
||||
binding.imageView.visibility = View.VISIBLE
|
||||
binding.videoView.visibility = View.GONE
|
||||
|
||||
com.bumptech.glide.Glide.with(this)
|
||||
.load(url)
|
||||
.into(binding.imageView)
|
||||
}
|
||||
|
||||
"video" -> {
|
||||
binding.webView.visibility = View.GONE
|
||||
binding.imageView.visibility = View.GONE
|
||||
binding.videoView.visibility = View.VISIBLE
|
||||
playVideo(url)
|
||||
}
|
||||
|
||||
"html-webbrowser" -> {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
finish()
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.webView.visibility = View.VISIBLE
|
||||
setupWebView(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun playVideo(url: String) {
|
||||
player = ExoPlayer.Builder(this).build()
|
||||
binding.videoView.post {
|
||||
val width = binding.videoView.width
|
||||
val height = (width * 9) / 16
|
||||
binding.videoView.layoutParams.height = height
|
||||
}
|
||||
|
||||
binding.videoView.player = player
|
||||
|
||||
val mediaItem = MediaItem.fromUri(url)
|
||||
player?.setMediaItem(mediaItem)
|
||||
player?.prepare()
|
||||
player?.play()
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private fun setupWebView(url: String) {
|
||||
|
||||
with(binding.webView.settings) {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
javaScriptCanOpenWindowsAutomatically = true
|
||||
setSupportMultipleWindows(true)
|
||||
loadWithOverviewMode = true
|
||||
|
||||
setSupportZoom(true)
|
||||
builtInZoomControls = true
|
||||
displayZoomControls = false
|
||||
useWideViewPort = true
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||
|
||||
|
||||
}
|
||||
|
||||
binding.webView.addJavascriptInterface(WebAppInterface(), "Android")
|
||||
|
||||
binding.webView.webViewClient = object : WebViewClient() {
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: android.graphics.Bitmap?) {
|
||||
injectJS(view)
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
injectJS(view)
|
||||
}
|
||||
}
|
||||
|
||||
binding.webView.webChromeClient = object : WebChromeClient() {
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
|
||||
Log.e("JS_LOG", consoleMessage?.message() ?: "")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
binding.webView.loadUrl(url)
|
||||
}
|
||||
|
||||
// 🔥 JS INJECTION (RN BRIDGE + FIXES)
|
||||
private fun injectJS(view: WebView?) {
|
||||
|
||||
view?.evaluateJavascript(
|
||||
"""
|
||||
(function() {
|
||||
|
||||
console.log("🔥 JS INJECTED");
|
||||
|
||||
var meta = document.querySelector('meta[name=viewport]');
|
||||
if (meta) {
|
||||
meta.setAttribute(
|
||||
'content',
|
||||
'width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes'
|
||||
);
|
||||
} else {
|
||||
var newMeta = document.createElement('meta');
|
||||
newMeta.name = "viewport";
|
||||
newMeta.content = "width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes";
|
||||
document.head.appendChild(newMeta);
|
||||
}
|
||||
|
||||
// ✅ imageToBase64 FIX
|
||||
window.imageToBase64 = function(img) {
|
||||
try {
|
||||
if (!img) return null;
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = img.naturalWidth || img.width;
|
||||
canvas.height = img.naturalHeight || img.height;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
|
||||
return canvas.toDataURL('image/png');
|
||||
|
||||
} catch(e) {
|
||||
console.log("imageToBase64 error:", e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ React Native bridge
|
||||
window.ReactNativeWebView = {
|
||||
postMessage: function(data) {
|
||||
console.log("POST MESSAGE:", data);
|
||||
Android.postMessage(data);
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ Share function
|
||||
window.nativeShare = function(options) {
|
||||
console.log("CALL nativeShare:", options);
|
||||
|
||||
if (!options) return;
|
||||
|
||||
window.ReactNativeWebView.postMessage(JSON.stringify({
|
||||
type: 'SHARE',
|
||||
data: options
|
||||
}));
|
||||
};
|
||||
|
||||
// 🔍 Debug click
|
||||
document.addEventListener('click', function(e) {
|
||||
console.log("CLICK:", e.target.innerText);
|
||||
}, true);
|
||||
|
||||
})();
|
||||
""".trimIndent(),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
// ✅ JS INTERFACE
|
||||
inner class WebAppInterface {
|
||||
|
||||
@JavascriptInterface
|
||||
fun postMessage(message: String?) {
|
||||
Log.e("WEB_MESSAGE", "RAW: $message")
|
||||
|
||||
runOnUiThread {
|
||||
handleWebMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ HANDLE MESSAGE
|
||||
private fun handleWebMessage(message: String?) {
|
||||
try {
|
||||
val obj = JSONObject(message ?: return)
|
||||
val type = obj.optString("type")
|
||||
|
||||
if (type == "SHARE") {
|
||||
val data = obj.optJSONObject("data")
|
||||
handleShare(data)
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("WEB_MESSAGE", "Error: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ HANDLE SHARE
|
||||
private fun handleShare(data: JSONObject?) {
|
||||
|
||||
if (data == null) return
|
||||
|
||||
val type = data.optString("type")
|
||||
val message = data.optString("message")
|
||||
val url = data.optString("url")
|
||||
val image = data.optString("image")
|
||||
val imagesArray = data.optJSONArray("images")
|
||||
|
||||
Log.e("SHARE_DEBUG", "TYPE: $type")
|
||||
Log.e("SHARE_DEBUG", "MESSAGE: $message")
|
||||
Log.e("SHARE_DEBUG", "URL: $url")
|
||||
Log.e("SHARE_DEBUG", "IMAGE: ${image.take(50)}")
|
||||
|
||||
when (type) {
|
||||
|
||||
"text" -> shareText("$message\n$url")
|
||||
|
||||
"image" -> {
|
||||
if (image.isNotEmpty()) shareImageSmart(image)
|
||||
}
|
||||
|
||||
"multiple_images" -> {
|
||||
if (imagesArray != null) {
|
||||
val list = mutableListOf<String>()
|
||||
for (i in 0 until imagesArray.length()) {
|
||||
list.add(imagesArray.getString(i))
|
||||
}
|
||||
shareMultipleImages(list)
|
||||
}
|
||||
}
|
||||
|
||||
"image_with_text" -> {
|
||||
if (image.isNotEmpty()) {
|
||||
shareImageTextSmart(image, "$message\n$url")
|
||||
}
|
||||
}
|
||||
else -> shareText(message)
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ TEXT SHARE
|
||||
private fun shareText(text: String) {
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "text/plain"
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text)
|
||||
startActivity(Intent.createChooser(intent, "Share via"))
|
||||
}
|
||||
|
||||
// ✅ SMART IMAGE SHARE (BASE64 + URL)
|
||||
private fun shareImageSmart(imageData: String) {
|
||||
|
||||
Log.e("SHARE_DEBUG", "Image Data: ${imageData.take(100)}")
|
||||
|
||||
try {
|
||||
if (imageData.startsWith("data:image")) {
|
||||
|
||||
val pure = imageData.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
val uri = Uri.parse(path)
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
|
||||
startActivity(Intent.createChooser(intent, "Share Image"))
|
||||
|
||||
} else {
|
||||
// URL → Glide
|
||||
com.bumptech.glide.Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(imageData)
|
||||
.into(object : com.bumptech.glide.request.target.CustomTarget<android.graphics.Bitmap>() {
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: android.graphics.Bitmap,
|
||||
transition: com.bumptech.glide.request.transition.Transition<in android.graphics.Bitmap>?
|
||||
) {
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(
|
||||
contentResolver, resource, "Image", null
|
||||
)
|
||||
|
||||
val uri = Uri.parse(path)
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
|
||||
startActivity(Intent.createChooser(intent, "Share Image"))
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: android.graphics.drawable.Drawable?) {}
|
||||
})
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("SHARE_DEBUG", "Error: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ IMAGE + TEXT
|
||||
private fun shareImageTextSmart(imageData: String, text: String) {
|
||||
|
||||
if (imageData.startsWith("data:image")) {
|
||||
|
||||
val pure = imageData.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
val uri = Uri.parse(path)
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text)
|
||||
startActivity(Intent.createChooser(intent, "Share"))
|
||||
} else {
|
||||
shareText(text)
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ MULTIPLE IMAGES
|
||||
private fun shareMultipleImages(list: List<String>) {
|
||||
val uris = ArrayList<Uri>()
|
||||
for (base64 in list) {
|
||||
val pure = base64.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
uris.add(Uri.parse(path))
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_SEND_MULTIPLE)
|
||||
intent.type = "image/*"
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
||||
startActivity(Intent.createChooser(intent, "Share Images"))
|
||||
}
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (binding.webView.canGoBack()) {
|
||||
binding.webView.goBack()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
player?.pause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
player?.release()
|
||||
player = null
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+25
-31
@@ -158,45 +158,39 @@ public class SelectLanguageFragment extends Fragment implements View.OnClickList
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
|
||||
switch (id) {
|
||||
case R.id.btn_language_one:
|
||||
if (id == R.id.btn_language_one) {
|
||||
//selected_flag = true;
|
||||
onButtonPressed(language.get(0), culture_id.get(0), login_data.getNOTICE_URL().get(0));
|
||||
|
||||
//selected_flag = true;
|
||||
onButtonPressed(language.get(0),culture_id.get(0),login_data.getNOTICE_URL().get(0));
|
||||
CommonFunctions.updateLangResources(getActivity(), language.get(0));
|
||||
|
||||
CommonFunctions.updateLangResources(getActivity(), language.get(0));
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.black));
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(0));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(0));
|
||||
editor.commit();
|
||||
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(0));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(0));
|
||||
editor.commit();
|
||||
} else if (id == R.id.btn_language_two) {
|
||||
//selected_flag = true;
|
||||
onButtonPressed(language.get(1), culture_id.get(1), login_data.getNOTICE_URL().get(1));
|
||||
|
||||
break;
|
||||
CommonFunctions.updateLangResources(getActivity(), language.get(1));
|
||||
|
||||
case R.id.btn_language_two:
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
//selected_flag = true;
|
||||
onButtonPressed(language.get(1),culture_id.get(1),login_data.getNOTICE_URL().get(1));
|
||||
|
||||
CommonFunctions.updateLangResources(getActivity(), language.get(1));
|
||||
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_2.setTextColor(getResources().getColor(R.color.white));
|
||||
btn_lang_1.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(1));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(1));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(1));
|
||||
editor.commit();
|
||||
|
||||
break;
|
||||
editor.putString(CommonString.KEY_LANGUAGE, language.get(1));
|
||||
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(1));
|
||||
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(1));
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-18
@@ -11,8 +11,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -44,10 +42,6 @@ import retrofit.Callback;
|
||||
import retrofit.Response;
|
||||
import retrofit.Retrofit;
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class ServiceActivityFragment extends Fragment {
|
||||
String result = "";
|
||||
boolean isvalid = false;
|
||||
@@ -119,10 +113,10 @@ public class ServiceActivityFragment extends Fragment {
|
||||
public void onClick(View v) {
|
||||
Fragment nextFrag= mItem.getFragment();
|
||||
|
||||
if(position==0){
|
||||
showExportDialog();
|
||||
// restoreBackup();
|
||||
}
|
||||
if(position==0){
|
||||
showExportDialog();
|
||||
// restoreBackup();
|
||||
}
|
||||
/* else if(position==1){
|
||||
|
||||
File f = new File(CommonString.getImagesFolder(context));
|
||||
@@ -257,7 +251,7 @@ public class ServiceActivityFragment extends Fragment {
|
||||
String backupDBPath = "GSKMT_ORANGE_Database_backup" + "_"+username+"_"+ visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") ;
|
||||
|
||||
// String path = Environment.getExternalStorageDirectory().getPath()+ "/gsk_orange_backup";
|
||||
// String path = Environment.getExternalStorageDirectory().getPath()+ "/gsk_orange_backup";
|
||||
|
||||
String path = CommonString.getBackupFolder(context);
|
||||
File currentDB = new File(data, currentDBPath);
|
||||
@@ -277,14 +271,14 @@ public class ServiceActivityFragment extends Fragment {
|
||||
}
|
||||
|
||||
//usk
|
||||
// File dir = new File(CommonString.BACKUP_PATH);
|
||||
// File dir = new File(CommonString.BACKUP_PATH);
|
||||
File dir = new File(CommonString.getBackupFolder(context));
|
||||
ArrayList<String> list = new ArrayList();
|
||||
list = getFileNames(dir.listFiles());
|
||||
if (list.size() > 0) {
|
||||
for (int i1 = 0; i1 < list.size(); i1++) {
|
||||
if (list.get(i1).contains("GSKMT_ORANGE_Database_backup")) {
|
||||
// File originalFile = new File(CommonString.BACKUP_PATH + list.get(i1));
|
||||
// File originalFile = new File(CommonString.BACKUP_PATH + list.get(i1));
|
||||
Object result = uploadBackup(getActivity(), list.get(i1), "DBBackup");
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.databasexported), Toast.LENGTH_SHORT).show();
|
||||
@@ -296,9 +290,9 @@ public class ServiceActivityFragment extends Fragment {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.logException(new Exception(e.getCause()));
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.logException(new Exception(e.getCause()));
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -357,8 +351,8 @@ public class ServiceActivityFragment extends Fragment {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
|
||||
// Crashlytics.logException(t);
|
||||
// Crashlytics.logException(new Exception(t.getCause()));
|
||||
// Crashlytics.logException(t);
|
||||
// Crashlytics.logException(new Exception(t.getCause()));
|
||||
|
||||
isvalid = true;
|
||||
if (t instanceof UnknownHostException) {
|
||||
|
||||
+218
-262
@@ -28,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
|
||||
@@ -70,14 +71,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||
Log.d("countrydata",country_id);
|
||||
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||
pog_type_id = preferences.getString(CommonString.KEY_POG_TYPE_ID, "");
|
||||
if (preferences.getString(CommonString.KEY_VISIT_ID, "") != null) {
|
||||
visit_type_id = preferences.getString(CommonString.KEY_VISIT_ID, "");
|
||||
}
|
||||
preferences.getString(CommonString.KEY_VISIT_ID, "");
|
||||
visit_type_id = preferences.getString(CommonString.KEY_VISIT_ID, "");
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_list));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_category);
|
||||
fab.setOnClickListener(view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show());
|
||||
}
|
||||
@@ -91,7 +92,6 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
Log.e("country_data", country_id + "," + keyAccount_id);
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
categoryList = db.getCategoryListData(null, null, null, store_id, "MAPPING_STOCK_STOREWISE");
|
||||
Log.d("catlistsize", String.valueOf(categoryList.size()));
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_ADDITIONAL)) {
|
||||
@@ -99,266 +99,49 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
} else {
|
||||
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id, store_id, "MAPPING_STOCK");
|
||||
}
|
||||
|
||||
if (categoryList != null && !categoryList.isEmpty()) {
|
||||
for (int i = 0; i < categoryList.size(); i++) {
|
||||
boolean flag_filled = false;
|
||||
String category_id = categoryList.get(i).getCategory_id();
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_ADDITIONAL)) {
|
||||
db.open();
|
||||
boolean flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADDITIONAL);
|
||||
if (flag_mapping_stock) {
|
||||
if (db.checkStockData(store_id, category_id, visit_date)) {
|
||||
flag_filled = true;
|
||||
} else {
|
||||
flag_filled = false;
|
||||
}
|
||||
}
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION) && country_id.equals("2") && visit_type_id.equals("3")) {
|
||||
db.open();
|
||||
if (db.additionalVisibilitydata(store_id, category_id)) {
|
||||
flag_filled = true;
|
||||
} else {
|
||||
flag_filled = false;
|
||||
}
|
||||
} else {
|
||||
//Additional_Visibility
|
||||
if (db.additionalVisibilitydata(store_id, category_id)) {
|
||||
boolean flag = true;
|
||||
//MSL_Availability
|
||||
boolean flag_mapping_stock;
|
||||
//New MSL_Availability_StockFacing
|
||||
if (country_id.equals("7")) {
|
||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
} else {
|
||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||
}
|
||||
if (flag_mapping_stock) {
|
||||
if (!db.checkMsl_Availability_StockFacingDataNew(store_id, category_id, visit_date)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Stock_Entry
|
||||
boolean flag_stock_mapping_stock;
|
||||
if (country_id.equals("10")) {
|
||||
flag_stock_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
flag_stock_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
} else {
|
||||
flag_stock_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||
}
|
||||
if (flag_stock_mapping_stock) {
|
||||
if (!db.checkStock_Entry_FacingDataNew(store_id, category_id, visit_date)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Promo Compliance
|
||||
if (flag) {
|
||||
if (country_id.equals("7")) {
|
||||
if (db.getPromoComplianceSkuwiseExistsAfterData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
boolean isMappingPromotion_Flag;
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||
} else {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||
}
|
||||
if (isMappingPromotion_Flag) {
|
||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//T2P
|
||||
if (flag) {
|
||||
boolean flag_t2p_mapping;
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||
} else {
|
||||
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id, CommonString.TABLE_MAPPING_T2P);
|
||||
}
|
||||
if (flag_t2p_mapping) {
|
||||
if (!db.isFilledT2P(store_id, category_id)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Category image
|
||||
if (camera_allow.equals("1")) {
|
||||
if (!db.isCategoryPictureData(store_id, category_id)) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
final ArrayList<MSL_AvailabilityStockFacingGetterSetter> sub_category_list = db.getSubCategoryMaster(category_id, store_id, country_id);
|
||||
//if Sub Group Data exists for any Sub Category of the Category
|
||||
boolean isSubGroupDataExists = false;
|
||||
for (int j = 0; j < sub_category_list.size(); j++) {
|
||||
if (db.getSkuGroupMasterData(category_id, sub_category_list.get(j).getSub_category_id()).size() > 0) {
|
||||
isSubGroupDataExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSubGroupDataExists) {
|
||||
if (db.getNoCameraCategoryDataInserted(store_id, category_id, null).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Order Taking Data
|
||||
if (country_id.equals("15") || ((country_id.equals("17") && category_id.equals("2")))) {
|
||||
if (!db.checkOrder_taking_Data(store_id, category_id)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
//changed on 23.10.2018
|
||||
//ArrayList<AuditDataGetterSetter> question_list = getAuditAfterDeletion(category_id);
|
||||
//changed on 03.12.2018
|
||||
ArrayList<AuditDataGetterSetter> question_list = getAuditQnsRemoved(category_id);
|
||||
if (question_list.size() > 0) {
|
||||
/*if (!country_id.equals("6") && db.getAfterSaveAuditQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}*/
|
||||
if (db.getAfterSaveAuditQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//new add UAE pharma
|
||||
if (flag) {
|
||||
if (db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).size() > 0) {
|
||||
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (country_id.equals("2")) {
|
||||
if (camera_allow.equals("1")) {
|
||||
if (db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).size() > 0) {
|
||||
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
if (db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).size() > 0) {
|
||||
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
//Counterfeit Product Option - Egypt
|
||||
if (country_id.equals("6")) {
|
||||
if (db.getCounterfeitProductExistsAfterData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
//usk
|
||||
if (country_id.equals("6") && category_id.equals("2")) {
|
||||
if (db.getCompetitionPromoExistsAfterData(store_id, category_id).size() == 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// IR PD images handling by jp
|
||||
ArrayList<CategoryPictureGetterSetter> irList = isPdIRMapping(category_id);
|
||||
if (irList != null && !irList.isEmpty() && camera_allow.equals("1")) {
|
||||
flag = db.isFilledIRPDdata(store_id, visit_date, category_id);
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
flag_filled = flag;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_filled) {
|
||||
switch (category_id) {
|
||||
case "1":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.health_food_drink_tick);
|
||||
break;
|
||||
case "2":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.oralcare_tick);
|
||||
break;
|
||||
case "3":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.wellness_tick);
|
||||
break;
|
||||
case "4":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.nutritionals_tick);
|
||||
break;
|
||||
case "5":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.gastro_n_indigestion_tick);
|
||||
break;
|
||||
case "6":
|
||||
case "10":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.cough_n_cold_tick);
|
||||
break;
|
||||
case "7":
|
||||
case "9":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.analgesics_tick);
|
||||
break;
|
||||
case "8":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.first_aid_tick);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (category_id) {
|
||||
case "1":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.health_food_drink);
|
||||
break;
|
||||
case "2":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.oral_care);
|
||||
break;
|
||||
case "3":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.wellness);
|
||||
break;
|
||||
case "4":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.nutritionals);
|
||||
break;
|
||||
case "5":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.gastro_n_indigestion);
|
||||
break;
|
||||
case "6":
|
||||
case "10":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.cough_n_cold);
|
||||
break;
|
||||
case "7":
|
||||
case "9":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.analgesics);
|
||||
break;
|
||||
case "8":
|
||||
categoryList.get(i).setCategory_img(R.mipmap.first_aid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean flag_filled = isCategoryComplete(category_id);
|
||||
int imageRes = getImageRes(flag_filled, category_id);
|
||||
categoryList.get(i).setCategory_img(imageRes);
|
||||
}
|
||||
|
||||
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
|
||||
adapter = new CategoryListAdapter(this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
|
||||
updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
private int getImageRes(boolean flag_filled, String category_id) {
|
||||
int imageRes = 0;
|
||||
if (flag_filled) {
|
||||
imageRes = switch (category_id) {
|
||||
case "1" -> R.mipmap.health_food_drink_tick;
|
||||
case "2" -> R.mipmap.oralcare_tick;
|
||||
case "3" -> R.mipmap.wellness_tick;
|
||||
case "4" -> R.mipmap.nutritionals_tick;
|
||||
case "5" -> R.mipmap.gastro_n_indigestion_tick;
|
||||
case "6", "10" -> R.mipmap.cough_n_cold_tick;
|
||||
case "7", "9" -> R.mipmap.analgesics_tick;
|
||||
case "8" -> R.mipmap.first_aid_tick;
|
||||
default -> imageRes;
|
||||
};
|
||||
} else {
|
||||
imageRes = switch (category_id) {
|
||||
case "1" -> R.mipmap.health_food_drink;
|
||||
case "2" -> R.mipmap.oral_care;
|
||||
case "3" -> R.mipmap.wellness;
|
||||
case "4" -> R.mipmap.nutritionals;
|
||||
case "5" -> R.mipmap.gastro_n_indigestion;
|
||||
case "6", "10" -> R.mipmap.cough_n_cold;
|
||||
case "7", "9" -> R.mipmap.analgesics;
|
||||
case "8" -> R.mipmap.first_aid;
|
||||
default -> imageRes;
|
||||
};
|
||||
}
|
||||
return imageRes;
|
||||
}
|
||||
|
||||
ArrayList<AuditDataGetterSetter> getAuditAfterDeletion(String category_id) {
|
||||
@@ -494,6 +277,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
public void onBindViewHolder(MyViewHolder holder, int position) {
|
||||
final CategoryGetterSetter categoryData = list.get(position);
|
||||
holder.categoryName.setText(categoryData.getCategory());
|
||||
Log.e("CatImg--", "" + categoryData.getCategory_img());
|
||||
holder.categoryIcon.setImageResource(categoryData.getCategory_img());
|
||||
holder.lay_menu.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(CategoryListActivity.this, CategoryWisePerformanceActivity.class);
|
||||
@@ -602,7 +386,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
} else {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||
}
|
||||
if (isMappingPromotion_Flag) {
|
||||
if (isMappingPromotion_Flag ) {
|
||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
@@ -683,6 +467,12 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (db.getCounterfeitProductExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//usk
|
||||
if (country_id.equals("6") && category_id.equals("2")) {
|
||||
if (db.getCompetitionPromoExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
@@ -690,12 +480,12 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (country_id.equals("15")) {
|
||||
/*if (country_id.equals("6")) {
|
||||
if (!db.checkOrder_taking_Data(store_id, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//// IR PD images handling by jp
|
||||
ArrayList<CategoryPictureGetterSetter> irList = isPdIRMapping(category_id);
|
||||
@@ -706,6 +496,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<CategoryPictureGetterSetter> irVisibilityList = isPdVisibiltyMapping(category_id);
|
||||
if (irVisibilityList != null && !irVisibilityList.isEmpty() && camera_allow.equals("1")) {
|
||||
if (!db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flag_filled = true;
|
||||
} else {
|
||||
flag_filled = false;
|
||||
@@ -713,9 +511,8 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag_filled) {
|
||||
db.updateCheckoutStatus(store_id, CommonString.KEY_VALID, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
db.open();
|
||||
db.updateCheckoutStatus(store_id, flag_filled ? CommonString.KEY_VALID : CommonString.KEY_INVALID, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
|
||||
|
||||
@@ -731,4 +528,163 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
private ArrayList<CategoryPictureGetterSetter> isPdVisibiltyMapping(String categoryId) {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_list;
|
||||
if (country_id.equals("8")) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else if (store_flag_str != null && store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
}
|
||||
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
private boolean isCategoryComplete(String category_id) {
|
||||
boolean flag_filled = true;
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_ADDITIONAL)) {
|
||||
flag_filled = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADDITIONAL)
|
||||
&& db.checkStockData(store_id, category_id, visit_date);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)
|
||||
&& country_id.equals("2") && visit_type_id.equals("3")) {
|
||||
db.open();
|
||||
flag_filled = db.additionalVisibilitydata(store_id, category_id);
|
||||
|
||||
} else {
|
||||
db.open();
|
||||
if (!db.additionalVisibilitydata(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
// MSL & Stock Entry
|
||||
if (!validateStk(category_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// T2P
|
||||
if (db.isMappingT2PData(store_id, category_id,
|
||||
store_flag_str.equals(CommonString.FROM_DEVIATION)
|
||||
? CommonString.TABLE_MAPPING_T2P_ADHOC
|
||||
: CommonString.TABLE_MAPPING_T2P)) {
|
||||
if (!db.isFilledT2P(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Camera
|
||||
if (camera_allow.equals("1")) {
|
||||
if (!db.isCategoryPictureData(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> sub_category_list =
|
||||
db.getSubCategoryMaster(category_id, store_id, country_id);
|
||||
|
||||
boolean isSubGroupMissing = false;
|
||||
for (MSL_AvailabilityStockFacingGetterSetter subCat : sub_category_list) {
|
||||
if (db.getSkuGroupMasterData(category_id, subCat.getSub_category_id()).isEmpty()) {
|
||||
isSubGroupMissing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSubGroupMissing && db.getNoCameraCategoryDataInserted(store_id, category_id, null).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Audit Questions
|
||||
if (!getAuditQnsRemoved(category_id).isEmpty()
|
||||
&& db.getAfterSaveAuditQuestionAnswerData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (country_id.equals("7")) {
|
||||
if (db.getPromoComplianceSkuwiseExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
boolean isMappingPromotion_Flag;
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||
} else {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||
}
|
||||
if (isMappingPromotion_Flag ) {
|
||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// POG Upload
|
||||
if (!db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).isEmpty()
|
||||
&& db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Egypt - Counterfeit & Promo
|
||||
if (country_id.equals("6")) {
|
||||
if (db.getCounterfeitProductExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (category_id.equals("2") && db.getCompetitionPromoExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Order Taking for country 15
|
||||
/* if (country_id.equals("6") && !db.checkOrder_taking_Data(store_id, category_id)) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
// IR-PD Image Check
|
||||
ArrayList<CategoryPictureGetterSetter> irList = isPdIRMapping(category_id);
|
||||
if (irList != null && !irList.isEmpty() && camera_allow.equals("1")) {
|
||||
if (!db.isFilledIRPDdata(store_id, visit_date, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<CategoryPictureGetterSetter> irvisiList = isPdVisibiltyMapping(category_id);
|
||||
if (irvisiList != null && !irvisiList.isEmpty() && camera_allow.equals("1")) {
|
||||
if (!db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag_filled;
|
||||
}
|
||||
|
||||
|
||||
private boolean validateStk(String category_id) {
|
||||
boolean flag_filled = true;
|
||||
if (isMappingStockData(category_id)) {
|
||||
if (country_id.equals("10")) {
|
||||
db.open();
|
||||
if (!db.checkStock_Entry_FacingDataNew(store_id, category_id, visit_date)) {
|
||||
flag_filled = false;
|
||||
}
|
||||
} else {
|
||||
if (!db.checkMsl_Availability_StockFacingDataNew(store_id, category_id, visit_date)) {
|
||||
flag_filled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag_filled;
|
||||
}
|
||||
|
||||
boolean isMappingStockData(String categoryId) {
|
||||
boolean flag;
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("17")) {
|
||||
flag = db.isMappingStockDataStockFacing(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
flag = db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||
} else {
|
||||
flag = db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
+226
-54
@@ -16,14 +16,17 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@@ -34,8 +37,10 @@ import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalPromoSKUwiseActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
||||
import cpm.com.gskmtorange.dailyentry.AuditActivity;
|
||||
@@ -45,6 +50,8 @@ import cpm.com.gskmtorange.dailyentry.CounterfeitProductsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.CreateSelfActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.NewStockDataActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.OrderTakingActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.PDVisibilityActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.PD_Pog_Activity;
|
||||
import cpm.com.gskmtorange.dailyentry.PDimageActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.POGQuestionsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.StockActivity;
|
||||
@@ -82,6 +89,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
db.open();
|
||||
context = this;
|
||||
//preference data
|
||||
//deletefile(context);
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
@@ -106,6 +114,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
db.open();
|
||||
// deleteIRURl(context);
|
||||
visittypelist = db.getInsertedVisitType(store_id, visit_date, "3");
|
||||
if (visittypelist.size() > 0) {
|
||||
if (visittypelist.get(0).getVISIT_TYPE_ID().equals("3")) {
|
||||
@@ -117,6 +126,66 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteIRURl(Context context) {
|
||||
try {
|
||||
ArrayList<CategoryPictureGetterSetter> irList = db.getIrPDforUpload(store_id, visit_date);
|
||||
Log.d("irlistsize", String.valueOf(irList));
|
||||
if (irList != null && !irList.isEmpty()) {
|
||||
for (int i = 0; i < irList.size(); i++) {
|
||||
ArrayList<ImageUri> uris = irList.get(i).getImageUris();
|
||||
if (uris != null && !uris.isEmpty()) {
|
||||
for (int k = 0; k < uris.size(); k++) {
|
||||
// CommonUtils.INSTANCE.deleteSpecificImage(this,uris.get(k).getUri());
|
||||
deleteSpecificImage(context,uris.get(k).getUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSpecificImage(Context context, String uri) {
|
||||
// Path to the file in app-specific internal storage
|
||||
String filePath = uri;
|
||||
Log.d("filepath",filePath);
|
||||
|
||||
// Create a File object
|
||||
File file = new File(filePath);
|
||||
// Check if the file exists and delete it
|
||||
if (file.exists()) {
|
||||
boolean isDeleted = file.delete();
|
||||
if (isDeleted) {
|
||||
Toast.makeText(context, "File deleted successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to delete the file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(context, "File does not exist", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void deletefile(Context context) {
|
||||
// Path to the file in app-specific internal storage
|
||||
String filePath = context.getFilesDir().getAbsolutePath() + "/e462845c-0dc4-4aa0-9066-6334d33af7d8_1.jpg";
|
||||
Log.d("filepathnew",filePath);
|
||||
|
||||
// Create a File object
|
||||
File file = new File(filePath);
|
||||
// Check if the file exists and delete it
|
||||
if (file.exists()) {
|
||||
boolean isDeleted = file.delete();
|
||||
if (isDeleted) {
|
||||
Toast.makeText(context, "File deleted successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to delete the file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(context, "File does not exist", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -282,34 +351,27 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
|
||||
//Order Taking
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
// ArrayList<AuditDataGetterSetter> question_list;
|
||||
data.setCategory_img(R.mipmap.msl_availability);
|
||||
if (country_id.equals("15") || (country_id.equals("17") && categoryId.equals("2"))) {
|
||||
if (isMappingStockData()) {
|
||||
if (db.checkOrder_taking_Data(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability);
|
||||
}
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability_grey);
|
||||
}
|
||||
data.setCategory_name(getString(R.string.order_taking));
|
||||
categoryList.add(data);
|
||||
}
|
||||
|
||||
//Order Confirm
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
// ArrayList<AuditDataGetterSetter> question_list;
|
||||
if (country_id.equals("15")) {
|
||||
if (db.checkOrder_Received_Data(store_id, categoryId)) {
|
||||
if (isMappingStockData()) {
|
||||
if (db.checkOrder_taking_Data(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability);
|
||||
}
|
||||
data.setCategory_name(getString(R.string.order_confirm));
|
||||
categoryList.add(data);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability_grey);
|
||||
}
|
||||
data.setCategory_name(getString(R.string.order_taking));
|
||||
categoryList.add(data);
|
||||
|
||||
//Order Status
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
if (db.checkOrder_Received_Data(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability);
|
||||
}
|
||||
data.setCategory_name(getString(R.string.order_confirm));
|
||||
categoryList.add(data);
|
||||
|
||||
//Audit
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
@@ -410,7 +472,6 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
if (categoryId.equals("2")) {
|
||||
if (country_id.equals("6")) {
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
|
||||
if (db.getCompetitionPromoExistsAfterData(store_id, categoryId).size() > 0) {
|
||||
data.setCategory_img(R.mipmap.competition_done);
|
||||
} else {
|
||||
@@ -419,6 +480,11 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
|
||||
data.setCategory_name(getString(R.string.title_activity_competition_promo));
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_img(R.mipmap.competition);
|
||||
data.setCategory_name("");
|
||||
categoryList.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +494,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
if (ir_list != null && !ir_list.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
if (db.isFilledIRPDdata(store_id, visit_date, categoryId)) {
|
||||
if (db.isSOSCategory(store_id, visit_date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
@@ -437,6 +503,36 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
data.setCategory_name(getResources()
|
||||
.getString(R.string.title_activity_ir_image));
|
||||
categoryList.add(data);
|
||||
|
||||
//IR Visibility
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visibility = isPdVisibiltyMapping();
|
||||
if (ir_visibility != null && !ir_visibility.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
if (db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_grey);
|
||||
}
|
||||
data.setCategory_name(getResources().getString(R.string.title_activity_ir_visibility));
|
||||
categoryList.add(data);
|
||||
|
||||
//IR POG
|
||||
/*data = new DailyDataMenuGetterSetter();
|
||||
ArrayList<CategoryPictureGetterSetter> ir_pog = isPdPogIRMapping();
|
||||
if (ir_pog != null && !ir_pog.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
if (db.isPdPogImages(store_id, visit_date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_grey);
|
||||
}
|
||||
data.setCategory_name(getResources().getString(R.string.title_activity_ir_pog));
|
||||
categoryList.add(data);*/
|
||||
}
|
||||
|
||||
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
|
||||
@@ -481,11 +577,9 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
} else {
|
||||
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P);
|
||||
}
|
||||
|
||||
if (flag_t2p_mapping) {
|
||||
if (db.isFilledT2P(store_id, categoryId)) {
|
||||
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
||||
|
||||
for (int i = 0; i < t2PList.size(); i++) {
|
||||
if (t2PList.get(i).getPresent() == 1) {
|
||||
t2p_flag = true;
|
||||
@@ -548,6 +642,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
final DailyDataMenuGetterSetter dailyData = list.get(position);
|
||||
holder.categoryName.setText(dailyData.getCategory_name());
|
||||
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
db.open();
|
||||
visittypelist = db.getInsertedVisitType(store_id, visit_date, "3");
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||
@@ -609,6 +704,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
} else {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_taking))) {
|
||||
if (isMappingStockData()) {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||
} else {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_confirm))) {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.audit))) {
|
||||
if (!getAuditQnsRemoved().isEmpty()) {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||
@@ -634,11 +737,29 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_image))) {
|
||||
}
|
||||
else if(dailyData.getCategory_name().equalsIgnoreCase("")){
|
||||
holder.lay_menu.setVisibility(View.GONE);
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
holder.categoryName.setVisibility(View.GONE);
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_image))) {
|
||||
holder.irview.setVisibility(View.VISIBLE);
|
||||
holder.categoryName.setTextColor(isPdIRMapping() != null && !isPdIRMapping().isEmpty() && camera_allow.equals("1")
|
||||
? ContextCompat.getColor(context, R.color.black) : ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_visibility))) {
|
||||
holder.irview.setVisibility(View.VISIBLE);
|
||||
holder.categoryName.setTextColor(isPdVisibiltyMapping() != null && !isPdVisibiltyMapping().isEmpty() && camera_allow.equals("1")
|
||||
? ContextCompat.getColor(context, R.color.black) : ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
/*else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_pog))) {
|
||||
holder.categoryName.setTextColor(isPdPogIRMapping() != null && !isPdPogIRMapping().isEmpty() && camera_allow.equals("1")
|
||||
? ContextCompat.getColor(context, R.color.black) : ContextCompat.getColor(context, R.color.grey_background));
|
||||
}*/
|
||||
else{
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.lay_menu.setOnClickListener(view -> {
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||
@@ -705,7 +826,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_ir_image))) {
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_ir_image))) {
|
||||
if (isPdIRMapping() != null && !isPdIRMapping().isEmpty() && camera_allow.equals("1")) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, PDimageActivity.class);
|
||||
intent.putExtra("kpi_name", dailyData.getCategory_name());
|
||||
@@ -714,7 +836,28 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_taking))) {
|
||||
}
|
||||
/*else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_ir_pog))) {
|
||||
if (isPdPogIRMapping() != null && !isPdPogIRMapping().isEmpty() && camera_allow.equals("1")) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, PD_Pog_Activity.class);
|
||||
intent.putExtra("kpi_name", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
}*/
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_ir_visibility))) {
|
||||
if (isPdVisibiltyMapping() != null && !isPdVisibiltyMapping().isEmpty() && camera_allow.equals("1")) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, PDVisibilityActivity.class);
|
||||
intent.putExtra("kpi_name", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_taking))) {
|
||||
if (isMappingStockData()) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, OrderTakingActivity.class);
|
||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||
@@ -831,12 +974,16 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
TextView categoryName;
|
||||
ImageView categoryIcon;
|
||||
LinearLayout lay_menu;
|
||||
View irview;
|
||||
CardView cardView;
|
||||
|
||||
public MyViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
categoryName = (TextView) itemView.findViewById(R.id.categoryName);
|
||||
categoryIcon = (ImageView) itemView.findViewById(R.id.categoryIcon);
|
||||
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
|
||||
irview = itemView.findViewById(R.id.irview);
|
||||
cardView = itemView.findViewById(R.id.cardView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -892,29 +1039,54 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
/* private void check() {
|
||||
////IRPD-Upload Data
|
||||
String irPD_xmlData = "";
|
||||
String onXML = "";
|
||||
ArrayList<CategoryPictureGetterSetter> irdata = db.getIrPDforUpload(store_id, visit_date);
|
||||
if (irdata != null && !irdata.isEmpty()) {
|
||||
|
||||
for (int j = 0; j < irdata.size(); j++) {
|
||||
onXML = "[IR_DATA]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + username + "[/USERID]"
|
||||
+ "[CATEGORY_ID]" + irdata.get(j).getCategoryId() + "[/CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_ID]" + irdata.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_CODE]" + irdata.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]"
|
||||
+ "[IR_IMAGES]" + irdata.get(j).getSubCategoryCamera2() + "[/IR_IMAGES]"
|
||||
+ "[/IR_DATA]";
|
||||
|
||||
irPD_xmlData = irPD_xmlData + onXML;
|
||||
}
|
||||
|
||||
final String irpd_xml = "[DATA]" + irPD_xmlData + "[/DATA]";
|
||||
Log.e("irpd_xml",irpd_xml);
|
||||
private ArrayList<CategoryPictureGetterSetter> isPdPogIRMapping() {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_list;
|
||||
if (country_id.equals("8")) {
|
||||
ir_list = db.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_STOREWISE
|
||||
);
|
||||
} else if (store_flag_str != null && store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
ir_list = db.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
keyAccount_id,
|
||||
storeType_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADHOC
|
||||
);
|
||||
} else {
|
||||
ir_list = db.getCategoryPicturePogdata(
|
||||
date,
|
||||
categoryId,
|
||||
keyAccount_id,
|
||||
storeType_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
private ArrayList<CategoryPictureGetterSetter> isPdVisibiltyMapping() {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_list;
|
||||
if (country_id.equals("6")) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else if (store_flag_str != null && store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
}
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -215,11 +215,8 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
|
||||
expandableListView.invalidate();
|
||||
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
if (firstVisibleItem == 0) {
|
||||
fab.show();//.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
@@ -269,9 +266,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.planogram, menu);
|
||||
|
||||
+9
-30
@@ -63,7 +63,7 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
//toolbar.setTitle("Order Status" + "-"+"PO List");
|
||||
toolbar.setTitle(context.getString(R.string.order_status_polist));
|
||||
toolbar.setTitle(context.getString(R.string.order_history));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
declaration();
|
||||
@@ -73,11 +73,9 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
recyclerview = (RecyclerView) findViewById(R.id.recyclerview);
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
storeid = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
setDataToListView();
|
||||
}
|
||||
@@ -86,7 +84,7 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
try {
|
||||
db.open();
|
||||
inserteslistData=db.getOrderstatusData(storeid,categoryId);
|
||||
if(inserteslistData.size()>0){
|
||||
if(!inserteslistData.isEmpty()){
|
||||
adapter = new Recycler_view_adapter(context, inserteslistData);
|
||||
recyclerview.setAdapter(adapter);
|
||||
recyclerview.setLayoutManager(new LinearLayoutManager(context));
|
||||
@@ -114,26 +112,10 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final Recycler_view_adapter.Viewholder viewholder, final int pos) {
|
||||
final OrderReceivedStatus current = orderReceivedStatuses.get(pos);
|
||||
viewholder.sys_gen_poTV.setText(current.getSys_gen_po());
|
||||
viewholder.podateTV.setText(current.getPodate());
|
||||
viewholder.storepoTV.setText(current.getStorepo());
|
||||
|
||||
viewholder.lineItemTV.setText( ""+current.getORDERQTY());
|
||||
if(current.getStatus().equalsIgnoreCase("CONFIRMED")){
|
||||
viewholder.statusTV.setText(context.getString(R.string.confirmed));
|
||||
}
|
||||
else if(current.getStatus().equalsIgnoreCase("CONFIRM")){
|
||||
viewholder.statusTV.setText(context.getString(R.string.confirmed));
|
||||
}
|
||||
else if(current.getStatus().equalsIgnoreCase("NOT CONFIRMED")){
|
||||
viewholder.statusTV.setText(context.getString(R.string.not_confirmed));
|
||||
}
|
||||
else if(current.getStatus().equalsIgnoreCase("PENDING")){
|
||||
viewholder.statusTV.setText(context.getString(R.string.pending));
|
||||
}
|
||||
else{
|
||||
viewholder.statusTV.setText(current.getStatus());
|
||||
}
|
||||
//viewholder.podateTV.setText(current.getPodate());
|
||||
viewholder.podateTV.setText(current.getPodate() != null ? current.getPodate() : "");
|
||||
viewholder.lineItemTV.setText(""+current.getORDERQTY());
|
||||
viewholder.sys_gen_poTV.setText(current.getSys_gen_po() != null ? current.getSys_gen_po() : "");
|
||||
|
||||
viewholder.cardview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -155,18 +137,15 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public class Viewholder extends RecyclerView.ViewHolder {
|
||||
TextView sys_gen_poTV,storepoTV,podateTV,lineItemTV,statusTV;
|
||||
TextView podateTV,lineItemTV,sys_gen_poTV;
|
||||
CardView cardview;
|
||||
LinearLayout storepoLL;
|
||||
public Viewholder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
cardview= (CardView) itemView.findViewById(R.id.cardview);
|
||||
storepoLL= itemView.findViewById(R.id.storepoLL);
|
||||
sys_gen_poTV= itemView.findViewById(R.id.sys_gen_poTV);
|
||||
storepoTV= itemView.findViewById(R.id.storepoTV);
|
||||
podateTV= itemView.findViewById(R.id.podateTV);
|
||||
sys_gen_poTV= itemView.findViewById(R.id.sys_gen_poTV);
|
||||
lineItemTV= itemView.findViewById(R.id.lineItemTV);
|
||||
statusTV= itemView.findViewById(R.id.statusTV);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +163,7 @@ public class OrderConfirmActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// super.onBackPressed();
|
||||
super.onBackPressed();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
+119
-90
@@ -89,7 +89,7 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
RadioGroup radio_group;
|
||||
String isExist="";
|
||||
String sys_po_number="";
|
||||
TextView sys_gen_poTV,lineitemTV;
|
||||
//TextView sys_gen_poTV,lineitemTV;
|
||||
LinearLayout poLL;
|
||||
String storepo ="";
|
||||
TextView storepoTV,podateTV;
|
||||
@@ -108,13 +108,11 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
camera2 = (ImageView) findViewById(R.id.img_camera2);
|
||||
camera3 = (ImageView) findViewById(R.id.img_camera3);
|
||||
camera4 = (ImageView) findViewById(R.id.img_camera4);
|
||||
storepoTV = findViewById(R.id.storepoTV);
|
||||
lineitemTV = findViewById(R.id.lineitemTV);
|
||||
podateTV = findViewById(R.id.podateTV);
|
||||
poLL = findViewById(R.id.poLL);
|
||||
|
||||
sys_gen_poTV = findViewById(R.id.sys_gen_poTV);
|
||||
podateTV = findViewById(R.id.podateTV);
|
||||
//sys_gen_poTV = findViewById(R.id.sys_gen_poTV);
|
||||
// podateTV = findViewById(R.id.podateTV);
|
||||
|
||||
lin_camera1 = (LinearLayout) findViewById(R.id.lin_camera1);
|
||||
lin_camera2 = (LinearLayout) findViewById(R.id.lin_camera2);
|
||||
@@ -154,13 +152,11 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
// Log.e("podetai",SYS_PO_NUM + ","+PO_NUM + ","+PO_DATE + ","+LINE);
|
||||
|
||||
// toolbar.setTitle("Order Status" + "-"+"Entry");
|
||||
toolbar.setTitle(context.getString(R.string.order_status_entry));
|
||||
// toolbar.setTitle(context.getString(R.string.order_status_entry));
|
||||
toolbar.setTitle(context.getString(R.string.order_history_detail));
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
sys_gen_poTV.setText(SYS_PO_NUM);
|
||||
storepoTV.setText(PO_NUM);
|
||||
podateTV.setText(PO_DATE);
|
||||
lineitemTV.setText(LINE);
|
||||
// podateTV.setText(PO_DATE);
|
||||
//lineitemTV.setText(LINE);
|
||||
|
||||
// Log.e("sys_po_num",sys_po_number +","+timeMilli);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
@@ -176,7 +172,8 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
/*fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
expandableListView.clearFocus();
|
||||
@@ -184,17 +181,17 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
|
||||
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||
db.open();
|
||||
if (db.checkOrder_Received_Data(store_id, categoryId)) {
|
||||
*//* if (db.checkOrder_Received_Data(store_id, categoryId)) {
|
||||
db.updateOrder_Received_data(storepoTV.getText().toString(), sys_gen_poTV.getText().toString(), podateTV.getText().toString(), store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Toast.makeText(context, getResources().getString(R.string.update_message), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
db.InsertOrderReceivedStatusData(POID, storepoTV.getText().toString(), sys_gen_poTV.getText().toString(), podateTV.getText().toString(), store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Toast.makeText(context, getResources().getString(R.string.save_message), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}*//*
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* String order_received_xml = "";
|
||||
*//* String order_received_xml = "";
|
||||
String onXML = "";
|
||||
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> orderreceiveddata = db.getOrder_RECEIVED_UploadServerData(store_id);
|
||||
@@ -218,7 +215,7 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
final String sos_xml = "[DATA]" + order_received_xml + "[/DATA]";
|
||||
Log.e("order_xml", sos_xml);
|
||||
|
||||
} */
|
||||
} *//*
|
||||
|
||||
}
|
||||
else{
|
||||
@@ -227,7 +224,7 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
@@ -237,13 +234,13 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
if (firstVisibleItem == 0) {
|
||||
/* if (firstVisibleItem == 0) {
|
||||
fab.show();//.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.hide();//setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
fab.show();//setVisibility(View.VISIBLE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -342,11 +339,9 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!child_flag)
|
||||
listTemp.add(data);
|
||||
}
|
||||
|
||||
}
|
||||
if (flag == false) {
|
||||
listDataHeaderTemp.add(listDataHeader.get(i));
|
||||
// listDataChildTemp.put(listDataHeader.get(i), listTemp);
|
||||
@@ -381,15 +376,18 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC, store_flag_hide);
|
||||
} else {
|
||||
//Log.e("categorydata",categoryId + ","+keyAccount_id + ","+storeType_id+","+class_id+","+store_id);
|
||||
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
// headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
headerDataList = db.getMSL_Availability_StockFacingHeaderNewData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET, store_flag_hide);
|
||||
// Log.e("childlistsize", String.valueOf(headerDataList.size()));
|
||||
}
|
||||
|
||||
if (headerDataList.size() > 0) {
|
||||
/*if (headerDataList.size() > 0) {
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
//childDataList = new ArrayList<>();
|
||||
childDataList = db.getOrder_RECEIVED_SKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> filteredChildList =
|
||||
new ArrayList<>();
|
||||
childDataList = new ArrayList<>();
|
||||
//childDataList = db.getOrder_RECEIVED_SKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||
if (!(childDataList.size() > 0)) {
|
||||
if (country_id.equals("7") || country_id.equals("8")) {
|
||||
childDataList = db.getOrderReceivedSKUData(headerDataList.get(i).getSub_category_id(), categoryId, headerDataList.get(i).getBrand_id(), null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, store_flag_hide);
|
||||
@@ -403,7 +401,96 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
else{
|
||||
|
||||
}
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
for (MSL_AvailabilityStockFacingGetterSetter item : childDataList) {
|
||||
|
||||
String qty = item.getFacing();
|
||||
|
||||
if (qty != null &&
|
||||
!qty.isEmpty() &&
|
||||
!qty.equals("0") &&
|
||||
!qty.equals("0.0")) {
|
||||
filteredChildList.add(item);
|
||||
}
|
||||
}
|
||||
if (!filteredChildList.isEmpty()) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
hashMapListChildData.put(
|
||||
headerDataList.get(i),
|
||||
filteredChildList
|
||||
);
|
||||
}
|
||||
// hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
}*/
|
||||
if (headerDataList.size() > 0) {
|
||||
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
|
||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> filteredChildList =
|
||||
new ArrayList<>();
|
||||
|
||||
childDataList = new ArrayList<>();
|
||||
|
||||
if (country_id.equals("7") || country_id.equals("8")) {
|
||||
|
||||
childDataList = db.getOrderReceivedSKUData(
|
||||
headerDataList.get(i).getSub_category_id(),
|
||||
categoryId,
|
||||
headerDataList.get(i).getBrand_id(),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_STOREWISE,
|
||||
store_flag_hide
|
||||
);
|
||||
|
||||
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
|
||||
childDataList = db.getOrderReceivedSKUData(
|
||||
headerDataList.get(i).getSub_category_id(),
|
||||
categoryId,
|
||||
headerDataList.get(i).getBrand_id(),
|
||||
keyAccount_id,
|
||||
storeType_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADHOC,
|
||||
store_flag_hide
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
childDataList = db.getOrderReceivedSKUData(
|
||||
headerDataList.get(i).getSub_category_id(),
|
||||
categoryId,
|
||||
headerDataList.get(i).getBrand_id(),
|
||||
keyAccount_id,
|
||||
storeType_id,
|
||||
class_id,
|
||||
store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK,
|
||||
store_flag_hide
|
||||
);
|
||||
}
|
||||
|
||||
for (MSL_AvailabilityStockFacingGetterSetter item : childDataList) {
|
||||
String qty = item.getFacing();
|
||||
if (qty != null &&
|
||||
!qty.isEmpty() &&
|
||||
!qty.equals("0") &&
|
||||
!qty.equals("0.0")) {
|
||||
|
||||
filteredChildList.add(item);
|
||||
}
|
||||
}
|
||||
if (!filteredChildList.isEmpty()) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
hashMapListChildData.put(
|
||||
headerDataList.get(i),
|
||||
filteredChildList
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +556,6 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
}
|
||||
txt_categoryHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
|
||||
|
||||
|
||||
if (!checkflag) {
|
||||
if (checkHeaderArray.contains(groupPosition)) {
|
||||
card_view.setCardBackgroundColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
@@ -533,12 +619,12 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
|
||||
holder.poqtyTV = (TextView) convertView.findViewById(R.id.poqtyTV);
|
||||
holder.txt_mbq = (TextView) convertView.findViewById(R.id.txt_mbq);
|
||||
holder.orderqtyTV = (TextView) convertView.findViewById(R.id.orderqtyTV);
|
||||
holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available);
|
||||
holder.facing = (EditText) convertView.findViewById(R.id.ed_facing);
|
||||
holder.facing.setFilters(new InputFilter[]{new OrderStatusDetailActivity.DecimalDigitsInputFilter(3, 1)});
|
||||
holder.stock = (EditText) convertView.findViewById(R.id.ed_stock);
|
||||
holder.ed_pricing = (EditText) convertView.findViewById(R.id.ed_pricing);
|
||||
|
||||
holder.facing_view = convertView.findViewById(R.id.facing_view);
|
||||
holder.stock_view = convertView.findViewById(R.id.stock_view);
|
||||
holder.pricing_view = convertView.findViewById(R.id.pricing_view);
|
||||
@@ -548,61 +634,8 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
}
|
||||
|
||||
holder.poqtyTV.setText(context.getString(R.string.po_qty) + ":"+childData.getOrderqty());
|
||||
// holder.poqtyTV.setText("PO QTY" + ":"+childData.getOrderqty());
|
||||
// uae facing hide
|
||||
/*if (store_flag_hide.equals("1")) {
|
||||
holder.facing.setVisibility(View.GONE);
|
||||
holder.facing_view.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.facing.setVisibility(View.VISIBLE);
|
||||
holder.facing_view.setVisibility(View.VISIBLE);
|
||||
}*/
|
||||
//usk
|
||||
/* if (childData.getPricing().equals("0")) {
|
||||
holder.ed_pricing.setVisibility(View.GONE);
|
||||
holder.pricing_view.setVisibility(View.GONE);
|
||||
holder.ed_pricing.setId(childPosition);
|
||||
holder.pricing_view.setId(childPosition);
|
||||
} else {
|
||||
holder.ed_pricing.setVisibility(View.VISIBLE);
|
||||
holder.pricing_view.setVisibility(View.VISIBLE);
|
||||
holder.ed_pricing.setId(childPosition);
|
||||
holder.pricing_view.setId(childPosition);
|
||||
}*/
|
||||
|
||||
holder.orderqtyTV.setText(context.getString(R.string.order_qty) + ":"+childData.getOrderqty());
|
||||
holder.txt_skuName.setText(childData.getSku());
|
||||
// holder.txt_mbq.setText(childData.getMbq());
|
||||
|
||||
/* if (childData.getCompany_id().equals("1") && childData.getMust_have().equals("1")) {
|
||||
holder.lin_category.setBackgroundColor(getResources().getColor(R.color.colorOrange));
|
||||
|
||||
//holder.txt_mbq.setVisibility(View.VISIBLE);
|
||||
holder.toggle_available.setVisibility(View.VISIBLE);
|
||||
// holder.facing.setVisibility(View.VISIBLE);
|
||||
if (country_id.equals("6")) {
|
||||
holder.stock.setVisibility(View.VISIBLE);
|
||||
holder.stock_view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (childData.getToggleValue().equals("1")) {
|
||||
holder.stock.setVisibility(View.GONE);
|
||||
holder.stock_view.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.stock.setVisibility(View.VISIBLE);
|
||||
holder.stock_view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
holder.lin_category.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
// holder.txt_mbq.setVisibility(View.GONE);
|
||||
holder.toggle_available.setVisibility(View.GONE);
|
||||
// holder.facing.setVisibility(View.VISIBLE);
|
||||
holder.stock.setVisibility(View.GONE);
|
||||
holder.stock_view.setVisibility(View.GONE);
|
||||
}*/
|
||||
|
||||
if (childData.getCompany_id().equals("1")) {
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
} else {
|
||||
@@ -626,12 +659,8 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
} else {
|
||||
finalHolder.stock.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/*childData.setStock("");
|
||||
childData.setFacing("");*/
|
||||
} else {
|
||||
/* childData.setStock("");
|
||||
childData.setFacing("");*/
|
||||
}
|
||||
else {
|
||||
childData.setToggleValue("0");
|
||||
finalHolder.stock.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -991,7 +1020,7 @@ public class OrderStatusDetailActivity extends AppCompatActivity{
|
||||
}
|
||||
public class ViewHolder {
|
||||
CardView cardView;
|
||||
TextView txt_skuName, txt_mbq,poqtyTV;
|
||||
TextView txt_skuName, txt_mbq,poqtyTV,orderqtyTV;
|
||||
ToggleButton toggle_available;
|
||||
LinearLayout lin_category;
|
||||
EditText facing, stock, ed_pricing;
|
||||
|
||||
+2
-4
@@ -77,8 +77,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, store_flag_str;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
String str = CommonString.getImagesFolder(context),
|
||||
path = "", _pathforcheck = "", img = "";
|
||||
String str = "", path = "", _pathforcheck = "", img = "";
|
||||
int child_position = -1;
|
||||
Uri outputFileUri;
|
||||
String gallery_package = "";
|
||||
@@ -100,6 +99,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
context = this;
|
||||
str = CommonString.getImagesFolder(context);
|
||||
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
|
||||
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
|
||||
view_promo_sku = findViewById(R.id.view_promo_sku);
|
||||
@@ -203,8 +203,6 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
cd.setImage_promotion("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
cd.setIn_stock("-1");
|
||||
img_addPromotion.setClickable(false);
|
||||
|
||||
+11
-14
@@ -138,25 +138,22 @@ public class ChangePasswordActivity extends AppCompatActivity implements View.On
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
switch (id){
|
||||
case R.id.img_info:
|
||||
if (id == R.id.img_info) {
|
||||
|
||||
Dialog dialog = new Dialog(ChangePasswordActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.password_rule_dialog);
|
||||
dialog.show();
|
||||
Dialog dialog = new Dialog(ChangePasswordActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.password_rule_dialog);
|
||||
dialog.show();
|
||||
|
||||
break;
|
||||
} else if (id == R.id.btn_submit) {
|
||||
|
||||
case R.id.btn_submit:
|
||||
if (isValid()) {
|
||||
// your code here
|
||||
}
|
||||
|
||||
if(isValid()){
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boolean isValid(){
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.password;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -56,12 +58,12 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
@@ -76,23 +78,25 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cpm.com.gskmtorange.GetterSetter.PD_CONFIGURATION;
|
||||
import cpm.com.gskmtorange.LoginActivity;
|
||||
import cpm.com.gskmtorange.MainActivity;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeItem;
|
||||
import cpm.com.gskmtorange.NoticeResponse;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.autoupdate.AutoUpdateActivity;
|
||||
import cpm.com.gskmtorange.blurlockview.BlurLockView;
|
||||
import cpm.com.gskmtorange.blurlockview.Directions.HideType;
|
||||
import cpm.com.gskmtorange.blurlockview.Directions.ShowType;
|
||||
import cpm.com.gskmtorange.blurlockview.Eases.EaseType;
|
||||
import cpm.com.gskmtorange.blurlockview.Password;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeboardGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
|
||||
|
||||
public class MPinActivity extends AppCompatActivity implements View.OnClickListener, BlurLockView.OnPasswordInputListener, BlurLockView.OnLeftButtonClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPasswordInputListener, BlurLockView.OnLeftButtonClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
BlurLockView blurLockView;
|
||||
ImageView imageView1;
|
||||
String pin = "";
|
||||
@@ -110,9 +114,9 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
private static final int MY_PERMISSIONS_REQUEST_LOCATION = 11;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_READ = 12;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_WRITE = 14;
|
||||
|
||||
private static final int PERMISSION_ALL = 99;
|
||||
|
||||
|
||||
GoogleApiClient mGoogleApiClient;
|
||||
private static int UPDATE_INTERVAL = 200; // 5 sec
|
||||
private static int FATEST_INTERVAL = 100; // 1 sec
|
||||
@@ -306,17 +310,11 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
|
||||
LocationCallback locationCallback = new LocationCallback() {
|
||||
@Override
|
||||
public void onLocationResult(LocationResult locationResult) {
|
||||
if (locationResult != null) {
|
||||
if (locationResult == null) {
|
||||
return;
|
||||
}
|
||||
//Showing the latitude, longitude and accuracy on the home screen.
|
||||
for (Location location : locationResult.getLocations()) {
|
||||
lat = location.getLatitude();
|
||||
lon = location.getLongitude();
|
||||
// Log.e("latitude_inside",location.getLatitude() + "," +location.getLongitude());
|
||||
}
|
||||
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||
//Showing the latitude, longitude and accuracy on the home screen.
|
||||
for (Location location : locationResult.getLocations()) {
|
||||
lat = location.getLatitude();
|
||||
lon = location.getLongitude();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -350,7 +348,13 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
userId = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||
password = preferences.getString(CommonString.KEY_PASSWORD, "");
|
||||
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Correct", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -406,18 +410,6 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
pin = remainingPassword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.image_1:
|
||||
/* blurLockView.show(
|
||||
getIntent().getIntExtra("SHOW_DURATION", 1000),
|
||||
getShowType(getIntent().getIntExtra("SHOW_DIRECTION", 0)),
|
||||
getEaseType(getIntent().getIntExtra("SHOW_EASE_TYPE", 30)));
|
||||
blurLockView.setType(Password.TEXT, true);*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
@@ -463,153 +455,6 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int downsamepleFactor;
|
||||
|
||||
private ShowType getShowType(int p) {
|
||||
ShowType showType = ShowType.FROM_TOP_TO_BOTTOM;
|
||||
switch (p) {
|
||||
case 0:
|
||||
showType = ShowType.FROM_TOP_TO_BOTTOM;
|
||||
break;
|
||||
case 1:
|
||||
showType = ShowType.FROM_RIGHT_TO_LEFT;
|
||||
break;
|
||||
case 2:
|
||||
showType = ShowType.FROM_BOTTOM_TO_TOP;
|
||||
break;
|
||||
case 3:
|
||||
showType = ShowType.FROM_LEFT_TO_RIGHT;
|
||||
break;
|
||||
case 4:
|
||||
showType = ShowType.FADE_IN;
|
||||
break;
|
||||
}
|
||||
return showType;
|
||||
}
|
||||
|
||||
private HideType getHideType(int p) {
|
||||
HideType hideType = HideType.FROM_TOP_TO_BOTTOM;
|
||||
switch (p) {
|
||||
case 0:
|
||||
hideType = HideType.FROM_TOP_TO_BOTTOM;
|
||||
break;
|
||||
case 1:
|
||||
hideType = HideType.FROM_RIGHT_TO_LEFT;
|
||||
break;
|
||||
case 2:
|
||||
hideType = HideType.FROM_BOTTOM_TO_TOP;
|
||||
break;
|
||||
case 3:
|
||||
hideType = HideType.FROM_LEFT_TO_RIGHT;
|
||||
break;
|
||||
case 4:
|
||||
hideType = HideType.FADE_OUT;
|
||||
break;
|
||||
}
|
||||
return hideType;
|
||||
}
|
||||
|
||||
private EaseType getEaseType(int p) {
|
||||
EaseType easeType = EaseType.Linear;
|
||||
switch (p) {
|
||||
case 0:
|
||||
easeType = EaseType.EaseInSine;
|
||||
break;
|
||||
case 1:
|
||||
easeType = EaseType.EaseOutSine;
|
||||
break;
|
||||
case 2:
|
||||
easeType = EaseType.EaseInOutSine;
|
||||
break;
|
||||
case 3:
|
||||
easeType = EaseType.EaseInQuad;
|
||||
break;
|
||||
case 4:
|
||||
easeType = EaseType.EaseOutQuad;
|
||||
break;
|
||||
case 5:
|
||||
easeType = EaseType.EaseInOutQuad;
|
||||
break;
|
||||
case 6:
|
||||
easeType = EaseType.EaseInCubic;
|
||||
break;
|
||||
case 7:
|
||||
easeType = EaseType.EaseOutCubic;
|
||||
break;
|
||||
case 8:
|
||||
easeType = EaseType.EaseInOutCubic;
|
||||
break;
|
||||
case 9:
|
||||
easeType = EaseType.EaseInQuart;
|
||||
break;
|
||||
case 10:
|
||||
easeType = EaseType.EaseOutQuart;
|
||||
break;
|
||||
case 11:
|
||||
easeType = EaseType.EaseInOutQuart;
|
||||
break;
|
||||
case 12:
|
||||
easeType = EaseType.EaseInQuint;
|
||||
break;
|
||||
case 13:
|
||||
easeType = EaseType.EaseOutQuint;
|
||||
break;
|
||||
case 14:
|
||||
easeType = EaseType.EaseInOutQuint;
|
||||
break;
|
||||
case 15:
|
||||
easeType = EaseType.EaseInExpo;
|
||||
break;
|
||||
case 16:
|
||||
easeType = EaseType.EaseOutExpo;
|
||||
break;
|
||||
case 17:
|
||||
easeType = EaseType.EaseInOutExpo;
|
||||
break;
|
||||
case 18:
|
||||
easeType = EaseType.EaseInCirc;
|
||||
break;
|
||||
case 19:
|
||||
easeType = EaseType.EaseOutCirc;
|
||||
break;
|
||||
case 20:
|
||||
easeType = EaseType.EaseInOutCirc;
|
||||
break;
|
||||
case 21:
|
||||
easeType = EaseType.EaseInBack;
|
||||
break;
|
||||
case 22:
|
||||
easeType = EaseType.EaseOutBack;
|
||||
break;
|
||||
case 23:
|
||||
easeType = EaseType.EaseInOutBack;
|
||||
break;
|
||||
case 24:
|
||||
easeType = EaseType.EaseInElastic;
|
||||
break;
|
||||
case 25:
|
||||
easeType = EaseType.EaseOutElastic;
|
||||
break;
|
||||
case 26:
|
||||
easeType = EaseType.EaseInOutElastic;
|
||||
break;
|
||||
case 27:
|
||||
easeType = EaseType.EaseInBounce;
|
||||
break;
|
||||
case 28:
|
||||
easeType = EaseType.EaseOutBounce;
|
||||
break;
|
||||
case 29:
|
||||
easeType = EaseType.EaseInOutBounce;
|
||||
break;
|
||||
case 30:
|
||||
easeType = EaseType.Linear;
|
||||
break;
|
||||
}
|
||||
return easeType;
|
||||
}
|
||||
|
||||
private class AuthenticateTask extends AsyncTask<Void, Void, String> {
|
||||
private Dialog dialog;
|
||||
|
||||
@@ -639,131 +484,160 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
|
||||
try {
|
||||
|
||||
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
|
||||
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]" + userId + "[/USER_ID]" + "[PASSWORD]" + password + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context) + "[/IN_TIME]" + "[LATITUDE]" + lat + "[/LATITUDE]" + "[LONGITUDE]" + lon + "[/LONGITUDE]" + "[APP_VERSION]" + app_ver + "[/APP_VERSION]" + "[ATT_MODE]OnLine[/ATT_MODE]" + "[NETWORK_STATUS]" + "LoginStatus" + "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]";
|
||||
|
||||
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]" + userId + "[/USER_ID]" + "[PASSWORD]" + password + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context) + "[/IN_TIME]" + "[LATITUDE]" + lat + "[/LATITUDE]" + "[LONGITUDE]" + lon + "[/LONGITUDE]" + "[APP_VERSION]" + app_ver+"-T3" + "[/APP_VERSION]" + "[ATT_MODE]OnLine[/ATT_MODE]" + "[NETWORK_STATUS]" + "LoginStatus" + "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]";
|
||||
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_LOGIN);
|
||||
request.addProperty("onXML", userauth_xml);
|
||||
|
||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN, envelope);
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
showAlert(CommonString.MESSAGE_FAILURE);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_FAILURE));
|
||||
} else if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
showAlert(CommonString.MESSAGE_FALSE);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_FALSE));
|
||||
} else if (result.toString().equalsIgnoreCase(CommonString.KEY_CHANGED)) {
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
showAlert(CommonString.MESSAGE_CHANGED);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_CHANGED));
|
||||
} else {
|
||||
|
||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
XmlPullParser xpp = factory.newPullParser();
|
||||
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
final FailureGetterSetter failureGetterSetter = XMLHandlers.failureXMLHandler(xpp, eventType);
|
||||
|
||||
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
showAlert(CommonString.METHOD_LOGIN + failureGetterSetter.getErrorMsg());
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
showAlert(CommonString.METHOD_LOGIN + failureGetterSetter.getErrorMsg());
|
||||
});
|
||||
} else {
|
||||
|
||||
try {
|
||||
// For String source
|
||||
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
lgs = XMLHandlers.loginXMLHandler(xpp, eventType);
|
||||
//PD_CONFIGURATION
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userId);
|
||||
request.addProperty("Type", "PD_CONFIGURATION");
|
||||
request.addProperty("cultureid", "1");
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
result = envelope.getResponse();
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
PD_CONFIGURATION pdConfiguration = XMLHandlers.PDConfigXMLHandler(xpp);
|
||||
Log.e("PD_CONFIGURATION_RESULT", result.toString());
|
||||
// PUT IN PREFERENCES
|
||||
if (pdConfiguration.getPROJECT_ID() != null && !pdConfiguration.getPROJECT_ID().isEmpty()) {
|
||||
editor.putString(CommonString.KEY_PD_PROJECT_Id, pdConfiguration.getPROJECT_ID().get(0));
|
||||
editor.putString(CommonString.KEY_PD_USER_Id, pdConfiguration.getUSER_ID().get(0));
|
||||
} else {
|
||||
return CommonString.KEY_FAILURE;
|
||||
}
|
||||
|
||||
} catch (XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
//Mer_NoticeBoard
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userId);
|
||||
request.addProperty("Type", "Mer_NoticeBoard");
|
||||
request.addProperty("cultureid", "1");
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
result = envelope.getResponse();
|
||||
|
||||
factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(false);
|
||||
|
||||
Log.e("Noticeboard_Result", result.toString());
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
NoticeboardGetterSetter noticeboardGetterSetter1 = XMLHandlers.Noticeboard_XMLHandler(xpp,eventType);
|
||||
Log.e("noticeboardGetterSetter1", noticeboardGetterSetter1.toString());
|
||||
// PUT IN PREFERENCES
|
||||
if (noticeboardGetterSetter1.getNoticeBoardId() != null && !noticeboardGetterSetter1.getNoticeBoardId().isEmpty()) {
|
||||
List<NoticeItem> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < noticeboardGetterSetter1.getNoticeBoardId().size(); i++) {
|
||||
|
||||
NoticeItem item = new NoticeItem(
|
||||
safe(noticeboardGetterSetter1.getNoticeBoardId(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticThumnail_Path(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticeLink_Thumbnail(), i),
|
||||
safe(noticeboardGetterSetter1.getNoticeLink_FullPage(), i),
|
||||
safe(noticeboardGetterSetter1.getFullPageTarget(), i)
|
||||
);
|
||||
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
NoticeResponse response = new NoticeResponse(list);
|
||||
|
||||
Gson gson = new GsonBuilder()
|
||||
.disableHtmlEscaping()
|
||||
.setPrettyPrinting()
|
||||
.create();
|
||||
|
||||
String noticeJson = gson.toJson(response);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putString("NOTICEBOARD_DATA", noticeJson);
|
||||
editor.apply();
|
||||
|
||||
} else {
|
||||
return CommonString.KEY_FAILURE;
|
||||
}
|
||||
|
||||
} catch (XmlPullParserException | IOException e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
|
||||
// PUT IN PREFERENCES
|
||||
editor.putString(CommonString.KEY_USERNAME, userId);
|
||||
editor.putString(CommonString.KEY_PASSWORD, password);
|
||||
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
|
||||
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
|
||||
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
|
||||
//editor.putString(CommonString.KEY_DATE, "01/25/2019");
|
||||
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
|
||||
editor.commit();
|
||||
setDataFromSharedPreferences(lgs);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, userId);
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
|
||||
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data");
|
||||
bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
return CommonString.KEY_SUCCESS;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
showAlert(CommonString.MESSAGE_EXCEPTION);
|
||||
}
|
||||
});
|
||||
|
||||
runOnUiThread(() -> showAlert(CommonString.MESSAGE_EXCEPTION));
|
||||
} catch (IOException e) {
|
||||
counter++;
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
if (counter < 3) {
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
showAlert(getString(R.string.nonetwork));
|
||||
counter = 1;
|
||||
@@ -780,7 +654,7 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
initializePDSDK(context, userId);
|
||||
initializePDSDK(context, preferences.getString(CommonString.KEY_PD_PROJECT_Id, ""), preferences.getString(CommonString.KEY_PD_USER_Id, "").isEmpty() ? userId : preferences.getString(CommonString.KEY_PD_USER_Id, ""));
|
||||
if (preferences.getString(CommonString.KEY_VERSION, "").equals(Integer.toString(versionCode))) {
|
||||
setLanguageDataFromSharedPreferences();
|
||||
Intent in = new Intent(context, MainActivity.class);
|
||||
@@ -794,10 +668,8 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ArrayList<String> language, culture_id, notice_url;
|
||||
@@ -1039,7 +911,14 @@ public class MPinActivity extends AppCompatActivity implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
private void initializePDSDK(Context context, String _userId) {
|
||||
CommonUtils.INSTANCE.initializePDSDK(context, _userId);
|
||||
private void initializePDSDK(Context context, String projectId, String _userId) {
|
||||
CommonUtils.INSTANCE.initializePDSDK(context, projectId, _userId);
|
||||
}
|
||||
|
||||
private String safe(ArrayList<String> list, int index) {
|
||||
if (list == null || list.size() <= index || list.get(index) == null) {
|
||||
return "";
|
||||
}
|
||||
return list.get(index).trim();
|
||||
}
|
||||
}
|
||||
|
||||
+21
-26
@@ -253,40 +253,35 @@ public class StoreDetailFragment extends Fragment implements View.OnClickListene
|
||||
public void onClick(View v) {
|
||||
|
||||
int id = v.getId();
|
||||
switch (id) {
|
||||
if (id == R.id.img_camera1) {
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
|
||||
case R.id.img_camera1:
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
startCameraActivity(1);
|
||||
|
||||
startCameraActivity(1);
|
||||
break;
|
||||
} else if (id == R.id.img_camera2) {
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
|
||||
case R.id.img_camera2:
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
startCameraActivity(2);
|
||||
|
||||
startCameraActivity(2);
|
||||
break;
|
||||
} else if (id == R.id.img_camera3) {
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
|
||||
case R.id.img_camera3:
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
startCameraActivity(3);
|
||||
|
||||
startCameraActivity(3);
|
||||
break;
|
||||
} else if (id == R.id.img_camera4) {
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
|
||||
case R.id.img_camera4:
|
||||
_pathforcheck = "Pharma_MSL_Top_Image_" + store_id + "_" + visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") + ".jpg";
|
||||
path = str + _pathforcheck;
|
||||
|
||||
startCameraActivity(4);
|
||||
break;
|
||||
startCameraActivity(4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,8 @@ import retrofit.Call;
|
||||
import retrofit.http.Body;
|
||||
import retrofit.http.POST;
|
||||
|
||||
/**
|
||||
* Created by jeevanp on 05-10-2017.
|
||||
*/
|
||||
|
||||
public interface PostApiForFile {
|
||||
@POST("Uploadimages")
|
||||
Call<String> getUploadImage(@Body RequestBody reqesBody);
|
||||
Call<String> getUploadImage(@Body RequestBody reqestBody);
|
||||
}
|
||||
|
||||
+16
-25
@@ -1,22 +1,13 @@
|
||||
package cpm.com.gskmtorange.retrofit;
|
||||
|
||||
|
||||
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
import com.squareup.okhttp.ResponseBody;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import retrofit.Converter;
|
||||
|
||||
|
||||
/**
|
||||
* Created by jeevanp on 19-05-2017.
|
||||
*/
|
||||
|
||||
public class StringConverterFactory implements Converter.Factory {
|
||||
public StringConverterFactory() {
|
||||
}
|
||||
@@ -31,24 +22,24 @@ public class StringConverterFactory implements Converter.Factory {
|
||||
}
|
||||
|
||||
class StringConverter implements Converter<String> {
|
||||
private static final MediaType PLAIN_TEXT = MediaType.parse("text/plain; charset=UTF-8");
|
||||
private static final MediaType PLAIN_TEXT = MediaType.parse("text/plain; charset=UTF-8");
|
||||
|
||||
@Override
|
||||
public String fromBody(ResponseBody body) throws IOException {
|
||||
return new String(body.bytes());
|
||||
}
|
||||
@Override
|
||||
public String fromBody(ResponseBody body) throws IOException {
|
||||
return new String(body.bytes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestBody toBody(String value) {
|
||||
return RequestBody.create(PLAIN_TEXT, convertToBytes(value));
|
||||
}
|
||||
@Override
|
||||
public RequestBody toBody(String value) {
|
||||
return RequestBody.create(PLAIN_TEXT, convertToBytes(value));
|
||||
}
|
||||
|
||||
private static byte[] convertToBytes(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
private static byte[] convertToBytes(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cpm.com.gskmtorange.service;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -20,9 +21,9 @@ import com.google.firebase.messaging.RemoteMessage;
|
||||
import cpm.com.gskmtorange.MainActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
|
||||
@SuppressLint("MissingFirebaseInstanceTokenRefresh")
|
||||
public class FCMNotificationService extends FirebaseMessagingService {
|
||||
|
||||
String TAG ="FCM Notification";
|
||||
String TAG = "FCM Notification";
|
||||
|
||||
public FCMNotificationService() {
|
||||
|
||||
@@ -31,23 +32,13 @@ public class FCMNotificationService extends FirebaseMessagingService {
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
// ...
|
||||
|
||||
// TODO(developer): Handle FCM messages here.
|
||||
// Not getting messages here? See why this may be: https://goo.gl/39bRNJ
|
||||
Log.d(TAG, "From: " + remoteMessage.getFrom());
|
||||
|
||||
// Check if message contains a data payload.
|
||||
if (remoteMessage.getData().size() > 0) {
|
||||
if (!remoteMessage.getData().isEmpty()) {
|
||||
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
|
||||
|
||||
if (/* Check if data needs to be processed by long running job */ true) {
|
||||
// For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.
|
||||
// scheduleJob();
|
||||
} else {
|
||||
// Handle message within 10 seconds
|
||||
// handleNow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if message contains a notification payload.
|
||||
@@ -63,23 +54,7 @@ public class FCMNotificationService extends FirebaseMessagingService {
|
||||
/**
|
||||
* Schedule a job using FirebaseJobDispatcher.
|
||||
*/
|
||||
private void scheduleJob() {
|
||||
// [START dispatch_job]
|
||||
/* FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
|
||||
Job myJob = dispatcher.newJobBuilder()
|
||||
.setService(MyJobService.class)
|
||||
.setTag("my-job-tag")
|
||||
.build();
|
||||
dispatcher.schedule(myJob);*/
|
||||
// [END dispatch_job]
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle time allotted to BroadcastReceivers.
|
||||
*/
|
||||
private void handleNow() {
|
||||
Log.d(TAG, "Short lived task is done.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and show a simple notification containing the received FCM message.
|
||||
@@ -90,10 +65,10 @@ public class FCMNotificationService extends FirebaseMessagingService {
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
|
||||
PendingIntent.FLAG_ONE_SHOT);
|
||||
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
String channelId = getString(R.string.default_notification_channel_id);
|
||||
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
NotificationCompat.Builder notificationBuilder =
|
||||
new NotificationCompat.Builder(this, channelId)
|
||||
.setSmallIcon(R.drawable.save_icon)
|
||||
@@ -114,6 +89,6 @@ public class FCMNotificationService extends FirebaseMessagingService {
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
|
||||
notificationManager.notify(0, notificationBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
+10
-14
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.storeinmap;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
@@ -10,6 +12,7 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
@@ -56,34 +59,23 @@ public class StoreListRouteActivity extends FragmentActivity implements OnMapRea
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_store_list_route);
|
||||
storelist = (ArrayList<StoreBean>)getIntent().getSerializableExtra(CommonString.KEY_STORE_LIST);
|
||||
|
||||
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
|
||||
mapFragment.getMapAsync(this);
|
||||
color_list.add("#f44336");
|
||||
color_list.add("#1e88e5");
|
||||
color_list.add("#2e7d32");
|
||||
color_list.add("#ab47bc");
|
||||
color_list.add("#ffcc80");
|
||||
color_list.add("#fdd835");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||
* we just add a marker near Sydney, Australia.
|
||||
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||
* installed Google Play services and returned to the app.
|
||||
*/
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
showRoute(global_index);
|
||||
}
|
||||
|
||||
@@ -102,6 +94,10 @@ public class StoreListRouteActivity extends FragmentActivity implements OnMapRea
|
||||
Bitmap bm = tv.getDrawingCache();
|
||||
lat = Double.parseDouble(storelist.get(index).getLATITUDE());
|
||||
lon = Double.parseDouble(storelist.get(index).getLONGITUDE());
|
||||
/*lat = 28.5275;
|
||||
lon = 77.2781;*/
|
||||
|
||||
Log.e("directiondata",lat +","+lon);
|
||||
LatLng loc = new LatLng(lat, lon);
|
||||
|
||||
mMap.addMarker(new MarkerOptions().position(loc).anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
||||
|
||||
+147
-322
@@ -6,7 +6,6 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -24,11 +23,10 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import com.google.android.gms.appindexing.Action;
|
||||
import com.google.android.gms.appindexing.AppIndex;
|
||||
import com.google.android.gms.appindexing.Thing;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.location.LocationListener;
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationCallback;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
import com.google.android.gms.location.LocationResult;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
@@ -40,9 +38,7 @@ import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -57,122 +53,136 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
|
||||
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback {
|
||||
|
||||
private Context context;
|
||||
private GoogleMap mMap;
|
||||
StoreBean store;
|
||||
LatLng origin, destination;
|
||||
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
|
||||
private GoogleApiClient mGoogleApiClient;
|
||||
private LocationRequest mLocationRequest;
|
||||
private static int UPDATE_INTERVAL = 500; // 5 sec
|
||||
private static int FATEST_INTERVAL = 100; // 1 sec
|
||||
private static int DISPLACEMENT = 5; // 10 meters
|
||||
private Location mLastLocation;
|
||||
double latitude = 0.0;
|
||||
double longitude = 0.0;
|
||||
Boolean markerflag = true;
|
||||
private StoreBean store;
|
||||
private LatLng origin, destination;
|
||||
|
||||
private FusedLocationProviderClient fusedLocationClient;
|
||||
private LocationRequest locationRequest;
|
||||
private LocationCallback locationCallback;
|
||||
|
||||
private static final int LOCATION_PERMISSION_REQUEST = 1001;
|
||||
|
||||
FloatingActionButton fab_cancel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_store_route);
|
||||
fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);
|
||||
context = this;
|
||||
fab_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
fab_cancel = findViewById(R.id.fab_cancel);
|
||||
fab_cancel.setOnClickListener(v -> {
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
});
|
||||
|
||||
store = (StoreBean) getIntent().getSerializableExtra(CommonString.KEY_STORE_LIST);
|
||||
/*store.setLATITUDE("28.5420901");
|
||||
store.setLONGITUDE("77.2430997");*/
|
||||
/*store.setLATITUDE("28.544055");
|
||||
store.setLONGITUDE("77.264060");*/
|
||||
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||
|
||||
locationRequest = LocationRequest.create()
|
||||
.setInterval(2000) // 2 sec
|
||||
.setFastestInterval(1000) // 1 sec
|
||||
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
|
||||
locationCallback = new LocationCallback() {
|
||||
@Override
|
||||
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||
if (locationResult.getLastLocation() != null) {
|
||||
Location loc = locationResult.getLastLocation();
|
||||
updateMapWithCurrentLocation(loc);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
|
||||
if (checkPlayServices()) {
|
||||
|
||||
// Building the GoogleApi client
|
||||
buildGoogleApiClient();
|
||||
|
||||
createLocationRequest();
|
||||
if (mapFragment != null) {
|
||||
mapFragment.getMapAsync(this);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkPlayServices() {
|
||||
int resultCode = GooglePlayServicesUtil
|
||||
.isGooglePlayServicesAvailable(this);
|
||||
if (resultCode != ConnectionResult.SUCCESS) {
|
||||
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
|
||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
||||
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
||||
} else {
|
||||
Toast.makeText(context, getResources().getString(R.string.notsuppoted)
|
||||
, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
finish();
|
||||
}
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
// Enable zoom controls for user
|
||||
mMap.getUiSettings().setZoomControlsEnabled(true);
|
||||
|
||||
// Request permissions
|
||||
if (checkLocationPermission()) {
|
||||
startLocationUpdates();
|
||||
fusedLocationClient.getLastLocation()
|
||||
.addOnSuccessListener(this, location -> {
|
||||
if (location != null) {
|
||||
updateMapWithCurrentLocation(location); // show instantly with last known location
|
||||
} else {
|
||||
Toast.makeText(this, "Waiting for current location...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
/* if (store != null) {
|
||||
LatLng storeLoc = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(storeLoc, 15));
|
||||
}*/
|
||||
}
|
||||
|
||||
private boolean checkLocationPermission() {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
||||
LOCATION_PERMISSION_REQUEST
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected synchronized void buildGoogleApiClient() {
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||
.addConnectionCallbacks(this)
|
||||
.addOnConnectionFailedListener(this)
|
||||
.addApi(LocationServices.API).build();
|
||||
}
|
||||
|
||||
|
||||
protected void createLocationRequest() {
|
||||
mLocationRequest = new LocationRequest();
|
||||
mLocationRequest.setInterval(UPDATE_INTERVAL);
|
||||
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
|
||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
|
||||
}
|
||||
|
||||
protected void startLocationUpdates() {
|
||||
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
|
||||
|
||||
private void startLocationUpdates() {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||
* we just add a marker near Sydney, Australia.
|
||||
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||
* installed Google Play services and returned to the app.
|
||||
*/
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
private void updateMapWithCurrentLocation(Location location) {
|
||||
double latitude = location.getLatitude();
|
||||
double longitude = location.getLongitude();
|
||||
|
||||
origin = new LatLng(latitude, longitude);
|
||||
destination = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||
|
||||
// Show markers
|
||||
StoreBean currentStore = new StoreBean();
|
||||
currentStore.setLATITUDE(latitude + "");
|
||||
currentStore.setLONGITUDE(longitude + "");
|
||||
currentStore.setSTORE_NAME("Current Location");
|
||||
showMarker(currentStore, R.layout.current_marker_view);
|
||||
|
||||
showMarker(store, R.layout.marker_view);
|
||||
|
||||
// Move camera to fit both points
|
||||
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||
builder.include(origin);
|
||||
builder.include(destination);
|
||||
mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 100));
|
||||
|
||||
// Fetch and draw route
|
||||
String url = getUrl(origin, destination);
|
||||
new FetchUrl().execute(url);
|
||||
|
||||
// Stop updates once we get location
|
||||
fusedLocationClient.removeLocationUpdates(locationCallback);
|
||||
}
|
||||
|
||||
public void showMarker(double lat, double lon) {
|
||||
// Add a marker and move the camera
|
||||
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(R.layout.marker_view, null, false);
|
||||
|
||||
TextView desc = (TextView) tv.findViewById(R.id.tv_desc);
|
||||
public void showMarker(StoreBean store, int layout_resource) {
|
||||
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(layout_resource, null, false);
|
||||
TextView desc = tv.findViewById(R.id.tv_desc);
|
||||
desc.setText(store.getSTORE_NAME());
|
||||
|
||||
tv.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
|
||||
@@ -180,302 +190,117 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
||||
tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight());
|
||||
|
||||
tv.setDrawingCacheEnabled(true);
|
||||
tv.buildDrawingCache();
|
||||
Bitmap bm = tv.getDrawingCache();
|
||||
|
||||
LatLng loc = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||
mMap.addMarker(new MarkerOptions().position(loc).anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
||||
mMap.addMarker(new MarkerOptions()
|
||||
.position(loc)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
||||
}
|
||||
|
||||
private String getUrl(LatLng origin, LatLng dest) {
|
||||
|
||||
// Origin of route
|
||||
String str_origin = "origin=" + origin.latitude + "," + origin.longitude;
|
||||
|
||||
// Destination of route
|
||||
String str_dest = "destination=" + dest.latitude + "," + dest.longitude;
|
||||
|
||||
|
||||
// Sensor enabled
|
||||
String sensor = "sensor=false";
|
||||
|
||||
// Building the parameters to the web service
|
||||
String parameters = str_origin + "&" + str_dest + "&" + sensor;
|
||||
|
||||
// Output format
|
||||
String parameters = str_origin + "&" + str_dest + "&sensor=false";
|
||||
String output = "json";
|
||||
|
||||
// Building the url to the web service
|
||||
String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters+"&key=AIzaSyCPo-giwVv5h8AzsbE1IDRsFsPHjVlCm5A";
|
||||
|
||||
|
||||
return url;
|
||||
return "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters + "&key=AIzaSyCPo-giwVv5h8AzsbE1IDRsFsPHjVlCm5A";
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to download json data from url
|
||||
*/
|
||||
private String downloadUrl(String strUrl) throws IOException {
|
||||
String data = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream iStream = null;
|
||||
HttpURLConnection urlConnection = null;
|
||||
try {
|
||||
URL url = new URL(strUrl);
|
||||
|
||||
// Creating an http connection to communicate with url
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// Connecting to url
|
||||
urlConnection.connect();
|
||||
|
||||
// Reading data from url
|
||||
iStream = urlConnection.getInputStream();
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(iStream));
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
String line = "";
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
|
||||
data = sb.toString();
|
||||
Log.d("downloadUrl", data.toString());
|
||||
br.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception", e.toString());
|
||||
Log.e("Exception", e.toString());
|
||||
} finally {
|
||||
iStream.close();
|
||||
urlConnection.disconnect();
|
||||
if (iStream != null) iStream.close();
|
||||
if (urlConnection != null) urlConnection.disconnect();
|
||||
}
|
||||
return data;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(@Nullable Bundle bundle) {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mLastLocation != null) {
|
||||
latitude = mLastLocation.getLatitude();
|
||||
longitude = mLastLocation.getLongitude();
|
||||
|
||||
mMap.setMyLocationEnabled(true);
|
||||
|
||||
origin = new LatLng(latitude, longitude);
|
||||
destination = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||
|
||||
StoreBean store1 = new StoreBean();
|
||||
store1.setLATITUDE(latitude+"");
|
||||
store1.setLONGITUDE(longitude+"");
|
||||
store1.setSTORE_NAME("Current Location");
|
||||
showMarker(store1, R.layout.current_marker_view);
|
||||
|
||||
showMarker(store, R.layout.marker_view);
|
||||
|
||||
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||
builder.include(new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE())));
|
||||
builder.include(new LatLng(latitude, longitude));
|
||||
//mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 48));
|
||||
mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 48));
|
||||
|
||||
//destination = new LatLng(mapLat[1], mapLon[1]);
|
||||
/*mMap.moveCamera(CameraUpdateFactory.newLatLng(origin));
|
||||
mMap.animateCamera(CameraUpdateFactory.zoomTo(17));*/
|
||||
|
||||
//new GetDirection().execute();
|
||||
// Getting URL to the Google Directions API
|
||||
String url = getUrl(origin, destination);
|
||||
Log.d("onMapClick", url.toString());
|
||||
FetchUrl FetchUrl = new FetchUrl();
|
||||
|
||||
// Start downloading json data from Google Directions API
|
||||
FetchUrl.execute(url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (mRequestingLocationUpdates) {
|
||||
startLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionSuspended(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
|
||||
}
|
||||
|
||||
public void showMarker(StoreBean store, int layout_resource){
|
||||
// Add a marker of latest location and move the camera
|
||||
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(layout_resource, null, false);
|
||||
|
||||
TextView desc = (TextView) tv.findViewById(R.id.tv_desc);
|
||||
desc.setText(store.getSTORE_NAME());
|
||||
|
||||
tv.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
|
||||
tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight());
|
||||
|
||||
tv.setDrawingCacheEnabled(true);
|
||||
tv.buildDrawingCache();
|
||||
Bitmap bm = tv.getDrawingCache();
|
||||
LatLng loc = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||
mMap.addMarker(new MarkerOptions().position(loc).anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void onStart() {
|
||||
super.onStart();// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
mGoogleApiClient.connect();
|
||||
if (mGoogleApiClient != null) {
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
// AppIndex.AppIndexApi.start(mGoogleApiClient, getIndexApiAction());
|
||||
}
|
||||
|
||||
/**
|
||||
* ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
* See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
*/
|
||||
public Action getIndexApiAction() {
|
||||
Thing object = new Thing.Builder()
|
||||
.setName("GeoTag Page") // TODO: Define a title for the content shown.
|
||||
// TODO: Make sure this auto-generated URL is correct.
|
||||
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
|
||||
.build();
|
||||
return new Action.Builder(Action.TYPE_VIEW)
|
||||
.setObject(object)
|
||||
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
|
||||
.build();
|
||||
}
|
||||
|
||||
// Fetches data from url passed
|
||||
// AsyncTask to fetch directions
|
||||
private class FetchUrl extends AsyncTask<String, Void, String> {
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... url) {
|
||||
|
||||
// For storing data from web service
|
||||
String data = "";
|
||||
|
||||
try {
|
||||
// Fetching the data from web service
|
||||
data = downloadUrl(url[0]);
|
||||
Log.d("Background Task data", data.toString());
|
||||
} catch (Exception e) {
|
||||
Log.d("Background Task", e.toString());
|
||||
return downloadUrl(url[0]);
|
||||
} catch (IOException e) {
|
||||
Log.e("Background Task", e.toString());
|
||||
return "";
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
ParserTask parserTask = new ParserTask();
|
||||
|
||||
// Invokes the thread for parsing the JSON data
|
||||
parserTask.execute(result);
|
||||
|
||||
Log.d("DirectionsResponse", result);
|
||||
new ParserTask().execute(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to parse the Google Places in JSON format
|
||||
*/
|
||||
private class ParserTask extends AsyncTask<String, Integer, List<List<HashMap<String, String>>>> {
|
||||
|
||||
// Parsing the data in non-ui thread
|
||||
@Override
|
||||
protected List<List<HashMap<String, String>>> doInBackground(String... jsonData) {
|
||||
|
||||
JSONObject jObject;
|
||||
List<List<HashMap<String, String>>> routes = null;
|
||||
|
||||
try {
|
||||
jObject = new JSONObject(jsonData[0]);
|
||||
Log.d("ParserTask",jsonData[0].toString());
|
||||
JSONObject jObject = new JSONObject(jsonData[0]);
|
||||
DataParser parser = new DataParser();
|
||||
Log.d("ParserTask", parser.toString());
|
||||
|
||||
// Starts parsing data
|
||||
routes = parser.parse(jObject);
|
||||
Log.d("ParserTask","Executing routes");
|
||||
Log.d("ParserTask",routes.toString());
|
||||
|
||||
return parser.parse(jObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("ParserTask",e.toString());
|
||||
e.printStackTrace();
|
||||
Log.e("ParserTask", e.toString());
|
||||
return null;
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
// Executes in UI thread, after the parsing process
|
||||
@Override
|
||||
protected void onPostExecute(List<List<HashMap<String, String>>> result) {
|
||||
if (result == null) return;
|
||||
|
||||
ArrayList<LatLng> points;
|
||||
PolylineOptions lineOptions = null;
|
||||
|
||||
// Traversing through all the routes
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
for (List<HashMap<String, String>> path : result) {
|
||||
points = new ArrayList<>();
|
||||
lineOptions = new PolylineOptions();
|
||||
|
||||
// Fetching i-th route
|
||||
List<HashMap<String, String>> path = result.get(i);
|
||||
|
||||
// Fetching all the points in i-th route
|
||||
for (int j = 0; j < path.size(); j++) {
|
||||
HashMap<String, String> point = path.get(j);
|
||||
|
||||
for (HashMap<String, String> point : path) {
|
||||
double lat = Double.parseDouble(point.get("lat"));
|
||||
double lng = Double.parseDouble(point.get("lng"));
|
||||
LatLng position = new LatLng(lat, lng);
|
||||
|
||||
points.add(position);
|
||||
points.add(new LatLng(lat, lng));
|
||||
}
|
||||
|
||||
// Adding all the points in the route to LineOptions
|
||||
lineOptions.addAll(points);
|
||||
lineOptions.width(12);
|
||||
lineOptions.color(Color.parseColor("#5ac614"));
|
||||
|
||||
Log.d("onPostExecute","onPostExecute lineoptions decoded");
|
||||
|
||||
}
|
||||
|
||||
// Drawing polyline in the Google Map for the i-th route
|
||||
if(lineOptions != null) {
|
||||
if (lineOptions != null) {
|
||||
mMap.addPolyline(lineOptions);
|
||||
}
|
||||
else {
|
||||
Log.d("onPostExecute","without Polylines drawn");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == LOCATION_PERMISSION_REQUEST) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
startLocationUpdates();
|
||||
} else {
|
||||
Toast.makeText(this, "Location permission required", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+68
-33
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -14,15 +16,12 @@ import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -48,6 +47,8 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CompetitonPromoGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||
@@ -121,7 +122,13 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
Path = CommonString.getImagesFolder(context);
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
//start upload
|
||||
new UploadTask(this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String UploadImage(String path, String folder_name) throws Exception {
|
||||
@@ -168,7 +175,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
|
||||
|
||||
Object result = envelope.getResponse();
|
||||
@@ -267,7 +274,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -350,7 +357,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + coverage_service, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -413,7 +420,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -475,7 +482,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -522,7 +529,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -567,7 +574,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -632,7 +639,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
}
|
||||
@@ -689,7 +696,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -742,7 +749,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -820,7 +827,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -875,7 +882,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -975,7 +982,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1105,7 +1112,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1156,7 +1163,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1254,7 +1261,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1306,7 +1313,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1353,7 +1360,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1396,7 +1403,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1445,7 +1452,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1494,7 +1501,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1565,7 +1572,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1638,7 +1645,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1704,7 +1711,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1755,7 +1762,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1800,7 +1807,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
|
||||
@@ -1810,6 +1817,34 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
data.name = getString(R.string.ir_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
////IRPDVisibility-Upload Data
|
||||
String irPD_visi_xmlData = "";
|
||||
onXML = "";
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visi_data = db.getIrPDVisibilityforUpload(coverageList.get(i).getStoreId(), coverageList.get(i).getVisitDate());
|
||||
if (ir_visi_data != null && !ir_visi_data.isEmpty()) {
|
||||
for (int j = 0; j < ir_visi_data.size(); j++) {
|
||||
onXML = "[IR_VISIBILITY_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + ir_visi_data.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + ir_visi_data.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + ir_visi_data.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_VISIBILITY_IMAGES]" + ir_visi_data.get(j).getSubCategoryCamera2() + "[/IR_VISIBILITY_IMAGES]" + "[/IR_VISIBILITY_DATA]";
|
||||
irPD_visi_xmlData = irPD_visi_xmlData + onXML;
|
||||
}
|
||||
final String irpd_xml = "[DATA]" + irPD_visi_xmlData + "[/DATA]";
|
||||
Log.e("irpd_visi_xml_data", irPD_visi_xmlData);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", irpd_xml);
|
||||
request.addProperty("KEYS", "IRPD_VISIBILITY_DATA_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
}
|
||||
data.value = 72;
|
||||
data.name = getString(R.string.ir_visibility_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
String visit_xml = "";
|
||||
onXML = "";
|
||||
ArrayList<Visit_Type_Master_GetterSetter> visittypelist = db.getUploadedVisitType(coverageList.get(i).getStoreId());
|
||||
@@ -1839,7 +1874,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
@@ -1875,7 +1910,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + status_service, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -12,16 +14,13 @@ import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.MultipartBuilder;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import com.squareup.okhttp.Protocol;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
@@ -46,16 +45,11 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.MainActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.retrofit.PostApiForFile;
|
||||
import cpm.com.gskmtorange.retrofit.StringConverterFactory;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
|
||||
import retrofit.GsonConverterFactory;
|
||||
import retrofit.Retrofit;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 4/5/2018.
|
||||
*/
|
||||
|
||||
public class UploadImageWithRetrofit {
|
||||
RequestBody body1;
|
||||
private Retrofit adapter;
|
||||
@@ -124,15 +118,18 @@ public class UploadImageWithRetrofit {
|
||||
foldername = "CounterFeitImages";
|
||||
} else if (file[i].getName().contains("POImage")) {//added 15.04.2019
|
||||
foldername = "POImages";
|
||||
} else if (file[i].getName().contains("_IRPDIMG-")) {//added 15.04.2019
|
||||
foldername = "IRPD_Image";
|
||||
} else {
|
||||
}
|
||||
else if (file[i].getName().contains("_IRPDIMG-")) {//added 15.04.2019
|
||||
foldername = "IR_Images";
|
||||
}
|
||||
else if (file[i].getName().contains("_IRPD_VISI_IMG-")) {
|
||||
foldername = "IR_VisibilityImages";
|
||||
}
|
||||
else {
|
||||
foldername = "Bulkimages";
|
||||
}
|
||||
|
||||
filename = file[i].getName();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,13 +138,10 @@ public class UploadImageWithRetrofit {
|
||||
if (finalFile == null) {
|
||||
finalFile = originalFile;
|
||||
}
|
||||
|
||||
OkHttpClient okHttpClient = new OkHttpClient();
|
||||
// okHttpClient.setProtocols(Arrays.asList(Protocol.HTTP_1_1));
|
||||
okHttpClient.setConnectTimeout(20, TimeUnit.SECONDS);
|
||||
okHttpClient.setWriteTimeout(20, TimeUnit.SECONDS);
|
||||
okHttpClient.setReadTimeout(20, TimeUnit.SECONDS);
|
||||
// MediaType mediaType = MediaType.parse("text/plain");
|
||||
|
||||
RequestBody photo = RequestBody.create(MediaType.parse("application/octet-stream"), finalFile);
|
||||
body1 = new MultipartBuilder()
|
||||
@@ -174,7 +168,6 @@ public class UploadImageWithRetrofit {
|
||||
uploadedFiles++;
|
||||
} else {
|
||||
status = 0;
|
||||
//uploadedFiles = 0;
|
||||
}
|
||||
if (status == 0) {
|
||||
pd.dismiss();
|
||||
@@ -199,13 +192,16 @@ public class UploadImageWithRetrofit {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
if (totalFiles == uploadedFiles) {
|
||||
//region Coverage upload status Data
|
||||
new StatusUpload().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new StatusUpload().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (JsonSyntaxException e) {
|
||||
e.fillInStackTrace();
|
||||
@@ -292,10 +288,8 @@ public class UploadImageWithRetrofit {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
pd.dismiss();
|
||||
if (totalFiles == uploadedFiles) {
|
||||
//region Coverage upload status Data
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package cpm.com.gskmtorange.utils;
|
||||
import com.squareup.okhttp.ConnectionSpec;
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import com.squareup.okhttp.Request;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
import com.squareup.okhttp.Response;
|
||||
import com.squareup.okhttp.TlsVersion;
|
||||
import org.ksoap2.HeaderProperty;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.transport.ServiceConnection;
|
||||
import org.ksoap2.transport.Transport;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class OkHttpTransportSE extends Transport {
|
||||
|
||||
private final String url;
|
||||
private final OkHttpClient client;
|
||||
|
||||
public OkHttpTransportSE(String url) {
|
||||
this(url, 60000); // default 60s timeout
|
||||
}
|
||||
|
||||
public OkHttpTransportSE(String url, int timeout) {
|
||||
super(url, timeout);
|
||||
this.url = url;
|
||||
|
||||
client = new OkHttpClient();
|
||||
|
||||
// Force TLS 1.2
|
||||
ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
|
||||
.tlsVersions(TlsVersion.TLS_1_2,
|
||||
TlsVersion.TLS_1_1,
|
||||
TlsVersion.TLS_1_0)
|
||||
.build();
|
||||
|
||||
client.setConnectionSpecs(Collections.singletonList(spec));
|
||||
client.setConnectTimeout(timeout, TimeUnit.MILLISECONDS);
|
||||
client.setReadTimeout(timeout, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List call(String soapAction, SoapEnvelope envelope, List headers)
|
||||
throws IOException, XmlPullParserException {
|
||||
return call(soapAction, envelope, headers, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServiceConnection getServiceConnection() throws IOException {
|
||||
return null; // not used with OkHttp
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HeaderProperty> call(String soapAction, SoapEnvelope envelope, List headers, File outputFile)
|
||||
throws IOException, XmlPullParserException {
|
||||
|
||||
if (soapAction == null) {
|
||||
soapAction = "";
|
||||
}
|
||||
|
||||
byte[] requestData = this.createRequestData(envelope, "UTF-8");
|
||||
this.requestDump = this.debug ? new String(requestData) : null;
|
||||
this.responseDump = null;
|
||||
|
||||
// Build request
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("User-Agent", "ksoap2-android/2.6.0+");
|
||||
|
||||
if (envelope.version == SoapEnvelope.VER12) {
|
||||
builder.addHeader("Content-Type", "application/soap+xml;charset=utf-8");
|
||||
} else {
|
||||
builder.addHeader("Content-Type", "text/xml;charset=utf-8");
|
||||
builder.addHeader("SOAPAction", soapAction); // Match HttpTransportSE
|
||||
}
|
||||
|
||||
// Add custom headers if any
|
||||
if (headers != null) {
|
||||
for (Object h : headers) {
|
||||
HeaderProperty hp = (HeaderProperty) h;
|
||||
if (hp.getKey() != null && hp.getValue() != null) {
|
||||
builder.addHeader(hp.getKey(), hp.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
builder.post(RequestBody.create(MediaType.parse("text/xml; charset=utf-8"), requestData));
|
||||
|
||||
// Execute request
|
||||
Response response = client.newCall(builder.build()).execute();
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("HTTP request failed, code: " + response.code());
|
||||
}
|
||||
|
||||
// Collect response headers
|
||||
List<HeaderProperty> retHeaders = new ArrayList<>();
|
||||
for (String name : response.headers().names()) {
|
||||
retHeaders.add(new HeaderProperty(name, response.header(name)));
|
||||
}
|
||||
// Parse SOAP response
|
||||
parseResponse(envelope, response.body().byteStream());
|
||||
return retHeaders;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cpm.com.gskmtorange.utils
|
||||
|
||||
// ScoreItem.kt
|
||||
sealed class ScoreItem {
|
||||
data class OverallScore(
|
||||
val osa: String,
|
||||
val msl: String,
|
||||
val posm: String,
|
||||
val sosSku: String,
|
||||
val sosBrand: String
|
||||
) : ScoreItem()
|
||||
|
||||
data class CategoryScore(
|
||||
val categoryName: String,
|
||||
val msl: String,
|
||||
val posm: String,
|
||||
val sosSku: String,
|
||||
val sosBrand: String,
|
||||
val brandDetails: List<Pair<String, String>> // BrandName to Value
|
||||
) : ScoreItem()
|
||||
|
||||
data class ImageItem(
|
||||
val url: String
|
||||
) : ScoreItem()
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cpm.com.gskmtorange.utils;
|
||||
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TLSSocketFactory extends SSLSocketFactory {
|
||||
private final SSLSocketFactory delegate;
|
||||
|
||||
public TLSSocketFactory() {
|
||||
this.delegate = (SSLSocketFactory) SSLSocketFactory.getDefault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDefaultCipherSuites() {
|
||||
return delegate.getDefaultCipherSuites();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return delegate.getSupportedCipherSuites();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException {
|
||||
return enableModernTLS(delegate.createSocket(s, host, port, autoClose));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(String host, int port) throws IOException {
|
||||
return enableModernTLS(delegate.createSocket(host, port));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException {
|
||||
return enableModernTLS(delegate.createSocket(host, port, localHost, localPort));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(InetAddress host, int port) throws IOException {
|
||||
return enableModernTLS(delegate.createSocket(host, port));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
|
||||
return enableModernTLS(delegate.createSocket(address, port, localAddress, localPort));
|
||||
}
|
||||
|
||||
private Socket enableModernTLS(Socket socket) {
|
||||
if (socket instanceof SSLSocket) {
|
||||
SSLSocket sslSocket = (SSLSocket) socket;
|
||||
|
||||
// Supported protocols on this device
|
||||
String[] supported = sslSocket.getSupportedProtocols();
|
||||
|
||||
// Collect TLSv1.2 and TLSv1.3 if available
|
||||
List<String> enabled = new ArrayList<>();
|
||||
for (String proto : supported) {
|
||||
if ("TLSv1.2".equals(proto) || "TLSv1.3".equals(proto)) {
|
||||
enabled.add(proto);
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled.isEmpty()) {
|
||||
sslSocket.setEnabledProtocols(enabled.toArray(new String[0]));
|
||||
}
|
||||
|
||||
// Debug log
|
||||
System.out.println("Enabled protocols: " + Arrays.toString(sslSocket.getEnabledProtocols()));
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
}
|
||||
+15
@@ -25,6 +25,16 @@ public class MSL_AvailabilityStockFacingGetterSetter implements Serializable{
|
||||
String company_id;
|
||||
String must_have;
|
||||
|
||||
public String getOrder_qty() {
|
||||
return order_qty;
|
||||
}
|
||||
|
||||
public void setOrder_qty(String order_qty) {
|
||||
this.order_qty = order_qty;
|
||||
}
|
||||
|
||||
String order_qty ="";
|
||||
|
||||
public String getPOID() {
|
||||
return POID;
|
||||
}
|
||||
@@ -268,4 +278,9 @@ public class MSL_AvailabilityStockFacingGetterSetter implements Serializable{
|
||||
this.warehouseStock = warehouseStock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getSku();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Master_Storelist_PDA_GetterSetter {
|
||||
String table_master_storelist_pda;
|
||||
ArrayList<String> StoreId = new ArrayList<>();
|
||||
ArrayList<String> channel = new ArrayList<>();
|
||||
ArrayList<String> format = new ArrayList<>();
|
||||
ArrayList<String> region = new ArrayList<>();
|
||||
ArrayList<String> bay_type = new ArrayList<>();
|
||||
ArrayList<String> no_of_bays = new ArrayList<>();
|
||||
ArrayList<String> category = new ArrayList<>();
|
||||
ArrayList<String> user_id = new ArrayList<>();
|
||||
ArrayList<String> Active = new ArrayList<>();
|
||||
ArrayList<String> ASMArea = new ArrayList<>();
|
||||
ArrayList<String> EmployeeName = new ArrayList<>();
|
||||
ArrayList<String> DesignationName = new ArrayList<>();
|
||||
ArrayList<String> SupervisorId = new ArrayList<>();
|
||||
ArrayList<String> Supervisor = new ArrayList<>();
|
||||
ArrayList<String> StoreCode = new ArrayList<>();
|
||||
ArrayList<String> ChainId = new ArrayList<>();
|
||||
ArrayList<String> StoreTypeId = new ArrayList<>();
|
||||
ArrayList<String> SOName = new ArrayList<>();
|
||||
|
||||
public ArrayList<String> getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region.add(region);
|
||||
}
|
||||
|
||||
public String getTable_master_storelist_pda() {
|
||||
return table_master_storelist_pda;
|
||||
}
|
||||
|
||||
public void setTable_master_storelist_pda(String table_master_storelist_pda) {
|
||||
this.table_master_storelist_pda = table_master_storelist_pda;
|
||||
}
|
||||
|
||||
public ArrayList<String> getStoreId() {
|
||||
return StoreId;
|
||||
}
|
||||
|
||||
public void setStoreId(String storeId) {
|
||||
this.StoreId.add(storeId);
|
||||
}
|
||||
|
||||
public ArrayList<String> getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public void setChannel(String channel) {
|
||||
this.channel.add(channel);
|
||||
}
|
||||
|
||||
public ArrayList<String> getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public void setFormat(String format) {
|
||||
this.format.add(format);
|
||||
}
|
||||
|
||||
public ArrayList<String> getBay_type() {
|
||||
return bay_type;
|
||||
}
|
||||
|
||||
public void setBay_type(String bay_type) {
|
||||
this.bay_type.add(bay_type);
|
||||
}
|
||||
|
||||
public ArrayList<String> getNo_of_bays() {
|
||||
return no_of_bays;
|
||||
}
|
||||
|
||||
public void setNo_of_bays(String no_of_bays) {
|
||||
this.no_of_bays.add(no_of_bays);
|
||||
}
|
||||
|
||||
public ArrayList<String> getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category.add(category);
|
||||
}
|
||||
|
||||
public ArrayList<String> getUser_id() {
|
||||
return user_id;
|
||||
}
|
||||
|
||||
public void setUser_id(String user_id) {
|
||||
this.user_id.add(user_id);
|
||||
}
|
||||
|
||||
public ArrayList<String> getActive() {
|
||||
return Active;
|
||||
}
|
||||
|
||||
public void setActive(String active) {
|
||||
this.Active.add(active);
|
||||
}
|
||||
|
||||
public ArrayList<String> getASMArea() {
|
||||
return ASMArea;
|
||||
}
|
||||
|
||||
public void setASMArea(String ASMArea) {
|
||||
this.ASMArea.add(ASMArea);
|
||||
}
|
||||
|
||||
public ArrayList<String> getEmployeeName() {
|
||||
return EmployeeName;
|
||||
}
|
||||
|
||||
public void setEmployeeName(String employeeName) {
|
||||
this.EmployeeName.add(employeeName);
|
||||
}
|
||||
|
||||
public ArrayList<String> getDesignationName() {
|
||||
return DesignationName;
|
||||
}
|
||||
|
||||
public void setDesignationName(String designationName) {
|
||||
this.DesignationName.add(designationName);
|
||||
}
|
||||
|
||||
public ArrayList<String> getSupervisorId() {
|
||||
return SupervisorId;
|
||||
}
|
||||
|
||||
public void setSupervisorId(String supervisorId) {
|
||||
this.SupervisorId.add(supervisorId);
|
||||
}
|
||||
|
||||
public ArrayList<String> getSupervisor() {
|
||||
return Supervisor;
|
||||
}
|
||||
|
||||
public void setSupervisor(String supervisor) {
|
||||
this.Supervisor.add(supervisor);
|
||||
}
|
||||
|
||||
public ArrayList<String> getStoreCode() {
|
||||
return StoreCode;
|
||||
}
|
||||
|
||||
public void setStoreCode(String storeCode) {
|
||||
this.StoreCode.add(storeCode);
|
||||
}
|
||||
|
||||
public ArrayList<String> getChainId() {
|
||||
return ChainId;
|
||||
}
|
||||
|
||||
public void setChainId(String chainId) {
|
||||
this.ChainId.add(chainId);
|
||||
}
|
||||
|
||||
public ArrayList<String> getStoreTypeId() {
|
||||
return StoreTypeId;
|
||||
}
|
||||
|
||||
public void setStoreTypeId(String storeTypeId) {
|
||||
this.StoreTypeId.add(storeTypeId);
|
||||
}
|
||||
|
||||
public ArrayList<String> getSOName() {
|
||||
return SOName;
|
||||
}
|
||||
|
||||
public void setSOName(String SOName) {
|
||||
this.SOName.add(SOName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
public class NoticeItem {
|
||||
String NoticeBoardId;
|
||||
String NoticThumnail_Path;
|
||||
String NoticeLink_Thumbnail;
|
||||
|
||||
String NoticeLink_FullPage;
|
||||
String FullPageTarget;
|
||||
|
||||
public NoticeItem(String id, String path, String thumb, String full, String target) {
|
||||
this.NoticeBoardId = id;
|
||||
this.NoticThumnail_Path = path;
|
||||
this.NoticeLink_Thumbnail = thumb;
|
||||
this.NoticeLink_FullPage = full;
|
||||
this.FullPageTarget = target;
|
||||
}
|
||||
|
||||
public String getNoticeBoardId() {
|
||||
return NoticeBoardId;
|
||||
}
|
||||
|
||||
public void setNoticeBoardId(String noticeBoardId) {
|
||||
NoticeBoardId = noticeBoardId;
|
||||
}
|
||||
|
||||
public String getNoticThumnail_Path() {
|
||||
return NoticThumnail_Path;
|
||||
}
|
||||
|
||||
public void setNoticThumnail_Path(String noticThumnail_Path) {
|
||||
NoticThumnail_Path = noticThumnail_Path;
|
||||
}
|
||||
|
||||
public String getNoticeLink_Thumbnail() {
|
||||
return NoticeLink_Thumbnail;
|
||||
}
|
||||
|
||||
public void setNoticeLink_Thumbnail(String noticeLink_Thumbnail) {
|
||||
NoticeLink_Thumbnail = noticeLink_Thumbnail;
|
||||
}
|
||||
|
||||
public String getNoticeLink_FullPage() {
|
||||
return NoticeLink_FullPage;
|
||||
}
|
||||
|
||||
public void setNoticeLink_FullPage(String noticeLink_FullPage) {
|
||||
NoticeLink_FullPage = noticeLink_FullPage;
|
||||
}
|
||||
|
||||
public String getFullPageTarget() {
|
||||
return FullPageTarget;
|
||||
}
|
||||
|
||||
public void setFullPageTarget(String fullPageTarget) {
|
||||
FullPageTarget = fullPageTarget;
|
||||
}
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NoticeboardGetterSetter {
|
||||
String table_mer_noticeboard_detailer;
|
||||
ArrayList<String> NoticeBoardId = new ArrayList<>();
|
||||
ArrayList<String> NoticThumnail_Path = new ArrayList<>();
|
||||
ArrayList<String> NoticeLink_Thumbnail = new ArrayList<>();
|
||||
ArrayList<String> NoticeLink_FullPage = new ArrayList<>();
|
||||
ArrayList<String> FullPageTarget = new ArrayList<>();
|
||||
|
||||
public String getTable_mer_noticeboard_detailer() {
|
||||
return table_mer_noticeboard_detailer;
|
||||
}
|
||||
|
||||
public void setTable_mer_noticeboard_detailer(String table_mer_noticeboard_detailer) {
|
||||
this.table_mer_noticeboard_detailer = table_mer_noticeboard_detailer;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNoticeBoardId() {
|
||||
return NoticeBoardId;
|
||||
}
|
||||
|
||||
public void setNoticeBoardId(String NoticeBoardId) {
|
||||
this.NoticeBoardId.add(NoticeBoardId);
|
||||
}
|
||||
|
||||
public ArrayList<String> getNoticThumnail_Path() {
|
||||
return NoticThumnail_Path;
|
||||
}
|
||||
|
||||
public void setNoticThumnail_Path(String NoticThumnail_Path) {
|
||||
this.NoticThumnail_Path.add(NoticThumnail_Path);
|
||||
}
|
||||
|
||||
public ArrayList<String> getNoticeLink_Thumbnail() {
|
||||
return NoticeLink_Thumbnail;
|
||||
}
|
||||
|
||||
public void setNoticeLink_Thumbnail(String NoticeLink_Thumbnail) {
|
||||
this.NoticeLink_Thumbnail.add(NoticeLink_Thumbnail);
|
||||
}
|
||||
|
||||
public ArrayList<String> getNoticeLink_FullPage() {
|
||||
return NoticeLink_FullPage;
|
||||
}
|
||||
|
||||
public void setNoticeLink_FullPage(String NoticeLink_FullPage) {
|
||||
this.NoticeLink_FullPage.add(NoticeLink_FullPage);
|
||||
}
|
||||
|
||||
public ArrayList<String> getFullPageTarget() {
|
||||
return FullPageTarget;
|
||||
}
|
||||
|
||||
public void setFullPageTarget(String FullPageTarget) {
|
||||
this.FullPageTarget.add(FullPageTarget);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,26 @@ public class TableBean {
|
||||
public static String MAPPING_DISPLAY_CHECKLIST;
|
||||
public static String NON_WORKING_REASON;
|
||||
public static String MAPPING_PROMOTION;
|
||||
public static String Master_StoreList_PDA;
|
||||
public static String NoticeboardData;
|
||||
|
||||
public static String getNoticeboardData() {
|
||||
return NoticeboardData;
|
||||
}
|
||||
|
||||
public static void setNoticeboardData(String noticeboardData) {
|
||||
NoticeboardData = noticeboardData;
|
||||
}
|
||||
|
||||
public static String getMaster_StoreList_PDA() {
|
||||
return Master_StoreList_PDA;
|
||||
}
|
||||
|
||||
public static void setMaster_StoreList_PDA(String master_StoreList_PDA) {
|
||||
Master_StoreList_PDA = master_StoreList_PDA;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getCategoryWiseSos() {
|
||||
return CATEGORY_WISE_SOS;
|
||||
@@ -39,6 +59,7 @@ public class TableBean {
|
||||
public static String MAPPING_SUB_CATEGORY_IMAGE_ALLOW;
|
||||
public static String SKUGROUP_MASTER;
|
||||
|
||||
|
||||
//YSY
|
||||
public static String MAPPING_CATEGORY_IMAGE_ALLOW;
|
||||
public static String MAPPING_COUNTRYWISE_PLANOGRAM;
|
||||
@@ -56,6 +77,18 @@ public class TableBean {
|
||||
public static String Table_PROMOTION_TYPE_MASTER;
|
||||
public static String Table_ORDER_RECEIVED_STATUS;
|
||||
|
||||
|
||||
|
||||
public static String Table_Master_PDA_STORE_LIST;
|
||||
|
||||
public static String getTable_Master_PDA_STORE_LIST() {
|
||||
return Table_Master_PDA_STORE_LIST;
|
||||
}
|
||||
|
||||
public static void setTable_Master_PDA_STORE_LIST(String table_Master_PDA_STORE_LIST) {
|
||||
Table_Master_PDA_STORE_LIST = table_Master_PDA_STORE_LIST;
|
||||
}
|
||||
|
||||
public static String getTable_VISIT_TYPE_STATUS() {
|
||||
return Table_VISIT_TYPE_STATUS;
|
||||
}
|
||||
@@ -66,6 +99,7 @@ public class TableBean {
|
||||
|
||||
public static String Table_VISIT_TYPE_STATUS;
|
||||
|
||||
|
||||
public static String getTable_ORDER_RECEIVED_STATUS() {
|
||||
return Table_ORDER_RECEIVED_STATUS;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import cpm.com.gskmtorange.GetterSetter.PD_CONFIGURATION;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ADDITIONAL_DISPLAY_MASTERGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.AdditionalQuestiongetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
@@ -33,11 +34,13 @@ import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockStorewiseGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingSubCategoryImageAllowGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Master_Storelist_PDA_GetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoCameraDataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoCameraLastVisitGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NonT2pReasonGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingSubReasonGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NoticeboardGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Order_Received_Status_GetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.POGQuestionGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.PROMOTION_TYPE_MASTERGetterSetter;
|
||||
@@ -357,6 +360,7 @@ public class XMLHandlers {
|
||||
category.setPD_SUB_CATEGORY_CODE(xpp.nextText());
|
||||
}
|
||||
}
|
||||
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException e) {
|
||||
@@ -1796,4 +1800,142 @@ public class XMLHandlers {
|
||||
return visittype;
|
||||
}
|
||||
|
||||
public static Master_Storelist_PDA_GetterSetter Master_Storelist_PDA_XMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
Master_Storelist_PDA_GetterSetter masterStorelistPda = new Master_Storelist_PDA_GetterSetter();
|
||||
try {
|
||||
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG) {
|
||||
if (xpp.getName().equals("META_DATA")) {
|
||||
masterStorelistPda.setTable_master_storelist_pda(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("StoreId")) {
|
||||
masterStorelistPda.setStoreId(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("channel")) {
|
||||
masterStorelistPda.setChannel(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("format")) {
|
||||
masterStorelistPda.setFormat(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("region")) {
|
||||
masterStorelistPda.setRegion(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("bay_type")) {
|
||||
masterStorelistPda.setBay_type(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("no_of_bays")) {
|
||||
masterStorelistPda.setNo_of_bays(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("category")) {
|
||||
masterStorelistPda.setCategory(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("user_id")) {
|
||||
masterStorelistPda.setUser_id(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("Active")) {
|
||||
masterStorelistPda.setActive(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("ASMArea")) {
|
||||
masterStorelistPda.setASMArea(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("EmployeeName")) {
|
||||
masterStorelistPda.setEmployeeName(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("DesignationName")) {
|
||||
masterStorelistPda.setDesignationName(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("SupervisorId")) {
|
||||
masterStorelistPda.setSupervisorId(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("Supervisor")) {
|
||||
masterStorelistPda.setSupervisor(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("StoreCode")) {
|
||||
masterStorelistPda.setStoreCode(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("ChainId")) {
|
||||
masterStorelistPda.setChainId(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("StoreTypeId")) {
|
||||
masterStorelistPda.setStoreTypeId(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("SOName")) {
|
||||
masterStorelistPda.setSOName(xpp.nextText());
|
||||
}
|
||||
}
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return masterStorelistPda;
|
||||
}
|
||||
|
||||
|
||||
public static NoticeboardGetterSetter Noticeboard_XMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
NoticeboardGetterSetter noticeboardGetterSetter = new NoticeboardGetterSetter();
|
||||
try {
|
||||
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG) {
|
||||
if (xpp.getName().equals("META_DATA")) {
|
||||
noticeboardGetterSetter.setTable_mer_noticeboard_detailer(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("NoticeBoardId")) {
|
||||
noticeboardGetterSetter.setNoticeBoardId(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("NoticThumnail_Path")) {
|
||||
noticeboardGetterSetter.setNoticThumnail_Path(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("NoticeLink_Thumbnail")) {
|
||||
noticeboardGetterSetter.setNoticeLink_Thumbnail(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("NoticeLink_FullPage")) {
|
||||
noticeboardGetterSetter.setNoticeLink_FullPage(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("FullPageTarget")) {
|
||||
noticeboardGetterSetter.setFullPageTarget(xpp.nextText());
|
||||
}
|
||||
}
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return noticeboardGetterSetter;
|
||||
}
|
||||
|
||||
// JCP XML HANDLER
|
||||
public static PD_CONFIGURATION PDConfigXMLHandler(XmlPullParser xpp) {
|
||||
PD_CONFIGURATION jcpGetterSetter = new PD_CONFIGURATION();
|
||||
|
||||
try {
|
||||
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG) {
|
||||
|
||||
if (xpp.getName().equals("PROJECT_ID")) {
|
||||
jcpGetterSetter.setPROJECT_ID(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("USER_ID")) {
|
||||
jcpGetterSetter.setUSER_ID(xpp.nextText());
|
||||
}
|
||||
}
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException | IOException e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
|
||||
return jcpGetterSetter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
|
||||
<solid android:color="@color/green"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
|
||||
<solid android:color="#BDBDBD"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,4 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dot_active" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/dot_inactive"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/white"/>
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/colorPrimary"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,3 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="16dp"/>
|
||||
</shape>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user