1 Commits

Author SHA1 Message Date
ravik 42f787bb63 Initial commit 2026-05-19 07:42:16 +00:00
991 changed files with 2 additions and 106412 deletions
-9
View File
@@ -1,9 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>
-1749
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="GSKMTOrange">
<State />
</entry>
</value>
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="GSKMTOrange">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>
-13
View File
@@ -1,13 +0,0 @@
<?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>
-20
View File
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-21" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/GSKMTOrange" />
<option value="$PROJECT_DIR$/library" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.22" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
-52
View File
@@ -1,52 +0,0 @@
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_daily_data_menu.xml" value="0.11277173913043478" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_login.xml" value="0.25" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_msl__availability.xml" value="0.115625" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_msl__availability_stock_facing.xml" value="0.11197916666666667" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_order_confirm.xml" value="0.2" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_order_status_detail.xml" value="0.22" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_order_taking.xml" value="0.2" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_visit_type_status.xml" value="0.11875" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_daily_main_menu.xml" value="0.13697916666666668" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_msl__availability_stock_facing.xml" value="0.11197916666666667" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_order_status_detail.xml" value="0.17" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_order_taking.xml" value="0.11197916666666667" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_store_wise_performance.xml" value="0.11302083333333333" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/contentcatgoryadpterlayout.xml" value="0.10833333333333334" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/contentorderstatus.xml" value="0.16302083333333334" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/daily_main_menu_row.xml" value="0.15416666666666667" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_category_wise_performance.xml" value="0.1390625" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_msl_availability_stock_facing_child.xml" value="0.16" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_msl_availability_stock_facing_header.xml" value="0.2" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_order_received_status_child.xml" value="0.2" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_order_status_child.xml" value="0.17" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_order_taking.xml" value="0.128125" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/item_order_taking_child.xml" value="0.2" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/order_status_item_layout.xml" value="0.33" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/storelist.xml" value="0.11875" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/storelist_child.xml" value="0.159375" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/storelistfablayout.xml" value="0.11875" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/visitstatuslist.xml" value="0.11875" />
<entry key="..\:/Jeevan_Sir_Projects/GSKORANGEV2-JORDANTTTTT/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/visittypelist_child.xml" value="0.159375" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_audit.xml" value="0.14990942028985507" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/activity_main.xml" value="0.20416666666666666" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/audit_question_list_item.xml" value="0.30676552363299353" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_audit.xml" value="0.14990942028985507" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/content_t2_pcompliance.xml" value="0.20416666666666666" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/t2p_sku_dialog_layout.xml" value="0.20416666666666666" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/layout/t2pbranddialoglayout.xml" value="0.20416666666666666" />
<entry key="..\:/Upendra-Projects/GSKORANGEV2-JORDAN/GSKMTOrange/src/main/res/menu/activity_main_drawer.xml" value="0.20416666666666666" />
</map>
</option>
</component>
<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>
</project>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.main.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/GSKMTOrange/GSKORANGEV2-JORDAN.GSKMTOrange.unitTest.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.iml" filepath="$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.main.iml" filepath="$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/library/GSKORANGEV2-JORDAN.library.unitTest.iml" />
</modules>
</component>
</project>
-758
View File
@@ -1,758 +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="34" />
<option name="brand" value="Sony" />
<option name="codename" value="A402SO" />
<option name="id" value="A402SO" />
<option name="manufacturer" value="Sony" />
<option name="name" value="Xperia 10" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2520" />
</PersistentDeviceSelectionData>
<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="OP535DL1" />
<option name="id" value="OP535DL1" />
<option name="manufacturer" value="OnePlus" />
<option name="name" value="CPH2409" />
<option name="screenDensity" value="401" />
<option name="screenX" value="1080" />
<option name="screenY" value="2412" />
</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="samsung" />
<option name="codename" value="a14m" />
<option name="id" value="a14m" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-A145R" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2408" />
</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="a15x" />
<option name="id" value="a15x" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="A15 5G" />
<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="a16x" />
<option name="id" value="a16x" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="A16 5G" />
<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="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="35" />
<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="34" />
<option name="brand" value="samsung" />
<option name="codename" value="b6q" />
<option name="id" value="b6q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Flip 6" />
<option name="screenDensity" value="340" />
<option name="screenX" value="1080" />
<option name="screenY" value="2640" />
</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="35" />
<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="35" />
<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="motorola" />
<option name="codename" value="dubai" />
<option name="id" value="dubai" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="edge 30" />
<option name="screenDensity" value="405" />
<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="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="35" />
<option name="brand" value="motorola" />
<option name="codename" value="eqe" />
<option name="id" value="eqe" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="edge 50 pro" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1220" />
<option name="screenY" value="2712" />
</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="motorola" />
<option name="codename" value="fogos" />
<option name="id" value="fogos" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="moto g34 5G" />
<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="gta9pwifi" />
<option name="id" value="gta9pwifi" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-X210" />
<option name="screenDensity" value="240" />
<option name="screenX" value="1200" />
<option name="screenY" value="1920" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="33" />
<option name="brand" value="samsung" />
<option name="codename" value="gts7lwifi" />
<option name="id" value="gts7lwifi" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-T870" />
<option name="screenDensity" value="340" />
<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="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="samsung" />
<option name="codename" value="gts9wifi" />
<option name="id" value="gts9wifi" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-X710" />
<option name="screenDensity" value="340" />
<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="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="35" />
<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="34" />
<option name="brand" value="motorola" />
<option name="codename" value="lion" />
<option name="id" value="lion" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="moto g04" />
<option name="screenDensity" value="280" />
<option name="screenX" value="720" />
<option name="screenY" value="1612" />
</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="34" />
<option name="brand" value="motorola" />
<option name="codename" value="lyriq" />
<option name="id" value="lyriq" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="edge 40" />
<option name="screenDensity" value="400" />
<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="manaus" />
<option name="id" value="manaus" />
<option name="manufacturer" value="Motorola" />
<option name="name" value="edge 40 neo" />
<option name="screenDensity" value="400" />
<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="35" />
<option name="brand" value="samsung" />
<option name="codename" value="pa3q" />
<option name="id" value="pa3q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S25 Ultra" />
<option name="screenDensity" value="600" />
<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="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="35" />
<option name="brand" value="google" />
<option name="codename" value="tegu" />
<option name="id" value="tegu" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 9a" />
<option name="screenDensity" value="420" />
<option name="screenX" value="1080" />
<option name="screenY" value="2424" />
</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>
<PersistentDeviceSelectionData>
<option name="api" value="35" />
<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>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="xcover7" />
<option name="id" value="xcover7" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-G556B" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2408" />
</PersistentDeviceSelectionData>
</list>
</option>
</component>
</project>
-17
View File
@@ -1,17 +0,0 @@
<?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
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
-1
View File
@@ -1 +0,0 @@
/build
-165
View File
@@ -1,165 +0,0 @@
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(35)
useLibrary 'org.apache.http.legacy'
namespace "cpm.com.gskmtorange"
lintOptions {
checkReleaseBuilds false
disable 'MissingTranslation'
abortOnError false
}
configurations {
// all*.exclude module: 'okio'
// 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 {
applicationId "cpm.com.gskmtorange"
minSdkVersion 24
targetSdk(34)
// For Lebanon
/* versionCode 1
versionName "1.0"*/
//For Egypt
/*versionCode 35
versionName "4.6"*/
//For UAE
/* versionCode 30
versionName "4.2"*/
//For Turkey
/* versionCode 34
versionName "4.6"*/
//For Turkey
/*versionCode 32
versionName "4.4"*/
//For KSA
/* versionCode 31
versionName "4.3"*/
// aading price facing
/* versionCode 27
versionName "3.8"*/
//sa
/* versionCode 28
versionName "3.9"*/
//Kenya
/* versionCode 2
versionName "1.1"*/
//kenya-lite
/* versionCode 2
versionName "1.1"*/
//nigeria
/*versionCode 1
versionName "1.0"*/
//For jordan
/* versionCode 8
versionName "1.7"*/
//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"*/
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
debuggable true
signingConfig signingConfigs.config
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
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.2-jar-with-dependencies.jar')
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.12.0'
implementation project(path: ':library')
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.activity:activity:1.10.1'
implementation 'androidx.appcompat:appcompat:1.7.1'
testImplementation 'junit:junit:4.13.2'
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:33.14.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-messaging'
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.squareup.okhttp3:okhttp:4.12.0'
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.core:core-splashscreen:1.0.1"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'org.jetbrains.kotlin.android'
-39
View File
@@ -1,39 +0,0 @@
{
"project_info": {
"project_number": "310038602345",
"project_id": "gskorangev2",
"storage_bucket": "gskorangev2.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:310038602345:android:dab7010946bd056dd1f8f8",
"android_client_info": {
"package_name": "cpm.com.gskmtorange"
}
},
"oauth_client": [
{
"client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDg2pgsaB0sWKD9pAF7mb9DSk8ec5rX7uI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
-17
View File
@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in E:\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Binary file not shown.
-21
View File
@@ -1,21 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "cpm.com.gskmtorange",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 31,
"versionName": "4.3",
"outputFile": "GSKMTOrange-release.apk"
}
],
"elementType": "File",
"minSdkVersionForDexing": 24
}
@@ -1,26 +0,0 @@
package cpm.com.gskmtorange;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cpm.com.gskmtorange", appContext.getPackageName());
}
}
@@ -1,26 +0,0 @@
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=F4:46:9C:04:7D:FD:3B:33:B1:A3:4B:8C:38:BD:77:0C:D4:36:98:E5%3Bcpm.com.gskmtorange
You can also add your credentials to an existing key, using these values:
Package name:
F4:46:9C:04:7D:FD:3B:33:B1:A3:4B:8C:38:BD:77:0C:D4:36:98:E5
SHA-1 certificate fingerprint:
F4:46:9C:04:7D:FD:3B:33:B1:A3:4B:8C:38:BD:77:0C:D4:36:98:E5
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
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">AIzaSyCs2VZqLl4OgStAraUHr8012cUc7vf3Uo8</string>
</resources>
-453
View File
@@ -1,453 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cpm.com.gskmtorange">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="an[droid.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:supportsRtl">
<activity
android:name=".gsk_dailyentry.StockEntryActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.VisitTypeStatusActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="Ad hoc - Visit Type"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".gsk_dailyentry.OrderStatusDetailActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.OrderConfirmActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.OrderTakingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.NewStockDataActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_new_stock_data"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.CounterfeitIndicatorWebActivity"
android:label="@string/title_activity_counterfeit_indicator_web"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.StockPricingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_stock_pricing"
android:theme="@style/AppTheme.NoActionBar" />
<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" />
<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" />
<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" />
<activity
android:name=".password.MPinActivity"
android:label="@string/title_activity_mpin"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<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" />
<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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_login"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".MainActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/main_menu_activity_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".autoupdate.AutoUpdateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".SelectLanguageActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_select_language"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".download.DownloadActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<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" />
<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" />
<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" />
<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" />
<!--
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD02po19go2JMhXJeAnKDiZSiNloPsWqzI" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
-->
<activity
android:name=".dailyentry.T2PComplianceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" /> <!-- 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" />
<activity
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.DailyDataMenuActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.Stock_FacingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.PromoComplianceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<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 -->
<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" />
<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" />
<activity
android:name=".upload.UploadActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_upload"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.SettingsActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_settings"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.CheckoutActivity"
android:label="@string/title_activity_checkout"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.ServiceActivity"
android:label="@string/title_activity_service"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".upload.PreviousDataUploadActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_upload"
android:screenOrientation="portrait" />
<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" />
<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" />
<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" />
<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" />
<activity
android:name=".gsk_dailyentry.MSL_Availability_StockFacingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.FutureJCPActivity"
android:label=""
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<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" />
<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" />
<activity
android:name=".dailyentry.PlanogramPDFActivity"
android:label="@string/category_performance_PLANOGRAM"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.StockDataActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_stock_data"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.AuditActivity"
android:label="@string/audit"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<service
android:name=".service.FCMNotificationService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity
android:name=".dailyentry.POGQuestionsActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_pogquestions"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<!--
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".storeinmap.StoreListMapActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_store_list_map"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".storeinmap.StoreListRouteActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_store_list_route"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".storeinmap.StoreRouteActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_store_route"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.MessageActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_message"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.ConversationActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_conversation"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.CoachingVisitActivity"
android:label="@string/title_activity_coaching_visit"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.CoachingVisitStoreActivity"
android:label="@string/title_activity_coaching_visit_store"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.DeliveryCallActivity"
android:label="@string/delivery_call"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.DeliveryCallAddStoreActivity"
android:label="@string/delivery_call"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.AdditionalPromoSKUwiseActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_additional_promo_skuwise"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".dailyentry.CompetitionPromoActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/competition_promotion"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

@@ -1,46 +0,0 @@
package cpm.com.gskmtorange;
import android.content.Context;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class AppUtils {
public static File getInternalDirectory(Context context, String folderName) {
File dir = context.getExternalFilesDir("");
File file = new File(dir, folderName);
if (!file.exists()) {
file.mkdirs();
}
return file;
}
public static File getFile(Context context, String fileName, String folderName) {
File dir = getInternalDirectory(context, folderName);
if (fileName == null || fileName.isEmpty()) {
return dir;
} else {
return new File(dir, fileName);
}
}
public static void saveByteArrayToFile(byte[] byteArray, String fileName) throws IOException {
try (FileOutputStream fileOutputStream = new FileOutputStream(fileName)) {
fileOutputStream.write(byteArray);
}
}
public static void clearMyFiles(Context activity, String folderName) {
File[] files = getInternalDirectory(activity, folderName).listFiles();
if (files != null) {
for (File file : files) {
file.delete();
}
}
}
public static File getExterDir(Context context) {
return context.getExternalFilesDir("");
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,266 +0,0 @@
package cpm.com.gskmtorange.GeoTag;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
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.download.DownloadActivity;
/**
* Created by ashishc on 27-12-2016.
*/
public class GeoTagStoreList extends AppCompatActivity implements View.OnClickListener {
private SharedPreferences preferences;
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
String date, visit_status;
GSKOrangeDB db;
// ListView list;
ValueAdapter adapter;
RecyclerView recyclerView;
private SharedPreferences.Editor editor = null;
LinearLayout parent_linear, nodata_linear;
LinearLayout linearlay;
FloatingActionButton fab;
Toolbar toolbar;
private Context context;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.geotagstorelistfab);
//list = (ListView) findViewById(R.id.list_id);
recyclerView = (RecyclerView) findViewById(R.id.drawer_layout_recycle);
linearlay = (LinearLayout) findViewById(R.id.no_data_lay);
// nodata_linear = (LinearLayout) findViewById(R.id.no_data_lay);
//parent_linear = (LinearLayout) findViewById(R.id.parent_linear);
fab = (FloatingActionButton) findViewById(R.id.fab);
context = this;
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
db = new GSKOrangeDB(GeoTagStoreList.this);
db.open();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent in = new Intent(context, DownloadActivity.class);
startActivity(in);
finish();
}
});
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
if (storelist.size() > 0) {
adapter = new ValueAdapter(context, storelist);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
} else {
recyclerView.setVisibility(View.INVISIBLE);
linearlay.setVisibility(View.VISIBLE);
fab.setVisibility(View.VISIBLE);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
/* Intent intent = new Intent(GeoTagStoreList.this, MainActivity.class);
startActivity(intent);*/
GeoTagStoreList.this.finish();
}
public class ValueAdapter extends RecyclerView.Adapter<ValueAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<StoreBean> data = Collections.emptyList();
public ValueAdapter(Context context, List<StoreBean> data) {
inflator = LayoutInflater.from(context);
this.data = data;
}
@Override
public ValueAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.geotagstorelist, parent, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final ValueAdapter.MyViewHolder viewHolder, final int position) {
final StoreBean current = data.get(position);
//viewHolder.txt.setText(current.txt);
viewHolder.txt.setText(current.getSTORE_NAME());
viewHolder.txt_storeAddress.setText(current.getADDRESS());
if (current.getGEO_TAG().equalsIgnoreCase("Y")) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.geopin);
} else if (current.getGEO_TAG().equalsIgnoreCase("D")) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
} else if (current.getGEO_TAG().equalsIgnoreCase("U")) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick);
} else if (current.getGEO_TAG().equalsIgnoreCase("P")) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
} else {
viewHolder.imageview.setVisibility(View.INVISIBLE);
}
viewHolder.relativelayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (current.getGEO_TAG().equalsIgnoreCase("Y")) {
Snackbar.make(v, R.string.title_geo_tag_activity_geo_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getGEO_TAG().equalsIgnoreCase("D")) {
Snackbar.make(v, R.string.title_geo_tag_activity_geo_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getGEO_TAG().equalsIgnoreCase("U")) {
Snackbar.make(v, R.string.title_geo_tag_activity_upload_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getGEO_TAG().equalsIgnoreCase("P")) {
Snackbar.make(v, R.string.title_geo_tag_activity_geo_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else {
// PUT IN PREFERENCES
editor = preferences.edit();
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.commit();
Intent in = new Intent(GeoTagStoreList.this, GeoTagActivity.class);
startActivity(in);
finish();
}
}
});
}
@Override
public int getItemCount() {
return data.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView txt, txt_storeAddress;
ImageView icon;
RelativeLayout relativelayout;
ImageView imageview;
public MyViewHolder(View itemView) {
super(itemView);
txt = (TextView) itemView.findViewById(R.id.geolistviewxml_storename);
relativelayout = (RelativeLayout) itemView.findViewById(R.id.relativelayout);
imageview = (ImageView) itemView.findViewById(R.id.imageView1);
txt_storeAddress = (TextView) itemView.findViewById(R.id.txt_storeAddress);
}
}
}
/*public List<StoreBean> getdata() {
List<StoreBean> data = new ArrayList<>();
storelist = db.getStoreData(date);
StoreBean storelistdata = new StoreBean();
for (int i = 0; i < storelist.size(); i++) {
storelistdata.setSTORE_NAME(storelist.get(0).getSTORE_NAME());
data.add(storelistdata);
}
return data;
}*/
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
@Override
protected void onResume() {
super.onResume();
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_store_geotag));
}
}
@@ -1,254 +0,0 @@
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;
public String getCOMMON_ID() {
return COMMON_ID;
}
public void setCOMMON_ID(String COMMON_ID) {
this.COMMON_ID = COMMON_ID;
}
String COMMON_ID;
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
String categoryId;
public String getStock_flag() {
return stock_flag;
}
public void setStock_flag(String stock_flag) {
this.stock_flag = stock_flag;
}
public String getSku_name() {
return sku_name;
}
public void setSku_name(String sku_name) {
this.sku_name = sku_name;
}
public String getProcess_id() {
return process_id;
}
public void setProcess_id(String process_id) {
this.process_id = process_id;
}
public String getSku_id() {
return sku_id;
}
public void setSku_id(String sku_id) {
this.sku_id = sku_id;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getImage_url() {
return image_url;
}
public void setImage_url(String image_url) {
this.image_url = image_url;
}
public String getUnique_id() {
return unique_id;
}
public void setUnique_id(String unique_id) {
this.unique_id = unique_id;
}
public String getKEY_ID() {
return KEY_ID;
}
public void setKEY_ID(String kEY_ID) {
KEY_ID = kEY_ID;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public String getQuestion_id() {
return question_id;
}
public void setQuestion_id(String question_id) {
this.question_id = question_id;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public String getStock_count() {
return stock_count;
}
public void setStock_count(String stock_count) {
this.stock_count = stock_count;
}
public String getStore_id() {
return store_id;
}
public void setStore_id(String store_id) {
this.store_id = store_id;
}
public String getCamera1() {
return camera1;
}
public void setCamera1(String camera1) {
this.camera1 = camera1;
}
public String getCamera2() {
return camera2;
}
public void setCamera2(String camera2) {
this.camera2 = camera2;
}
public String getCamera3() {
return camera3;
}
public void setCamera3(String camera3) {
this.camera3 = camera3;
}
public String getDisplay_id() {
return Display_id;
}
public void setDisplay_id(String display_id) {
Display_id = display_id;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public String getBrand_id() {
return brand_id;
}
public void setBrand_id(String brand_id) {
this.brand_id = brand_id;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getTrg_quantity() {
return trg_quantity;
}
public void setTrg_quantity(String trg_quantity) {
this.trg_quantity = trg_quantity;
}
public String getImage1() {
return image1;
}
public void setImage1(String image1) {
this.image1 = image1;
}
public String getImage2() {
return image2;
}
public void setImage2(String image2) {
this.image2 = image2;
}
public String getImage3() {
return image3;
}
public void setImage3(String image3) {
this.image3 = image3;
}
public String getBEFORE_QTY() {
return BEFORE_QTY;
}
public void setBEFORE_QTY(String bEFORE_QTY) {
BEFORE_QTY = bEFORE_QTY;
}
public String getAFTER_QTY() {
return AFTER_QTY;
}
public void setAFTER_QTY(String aFTER_QTY) {
AFTER_QTY = aFTER_QTY;
}
}
@@ -1,122 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
import java.util.ArrayList;
/**
* Created by ashishc on 09-01-2017.
*/
public class AddittionalGetterSetter {
public String getBrand() {
return Brand;
}
public void setBrand(String brand) {
Brand = brand;
}
public String getBrand_id() {
return Brand_id;
}
public void setBrand_id(String brand_id) {
Brand_id = brand_id;
}
public String getSku() {
return Sku;
}
public void setSku(String sku) {
Sku = sku;
}
public String getSku_id() {
return Sku_id;
}
public void setSku_id(String sku_id) {
Sku_id = sku_id;
}
public String getStore_id() {
return Store_id;
}
public void setStore_id(String store_id) {
Store_id = store_id;
}
public String getImage() {
return Image;
}
public void setImage(String image) {
Image = image;
}
String Brand,Brand_id,Sku,Sku_id,Store_id,Image="";
String Image2="";
public String getImage3() {
return Image3;
}
public void setImage3(String image3) {
Image3 = image3;
}
public String getImage2() {
return Image2;
}
public void setImage2(String image2) {
Image2 = image2;
}
String Image3="";
public String getKey_id() {
return key_id;
}
public void setKey_id(String key_id) {
this.key_id = key_id;
}
String key_id;
public String getBtn_toogle() {
return btn_toogle;
}
public void setBtn_toogle(String btn_toogle) {
this.btn_toogle = btn_toogle;
}
String btn_toogle;
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
String categoryId;
ArrayList<AdditionalDialogGetterSetter> skuDialogList = new ArrayList<>();
public ArrayList<AdditionalDialogGetterSetter> getSkuDialogList() {
return skuDialogList;
}
public void setSkuDialogList(ArrayList<AdditionalDialogGetterSetter> skuDialogList) {
this.skuDialogList = skuDialogList;
}
}
@@ -1,84 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
import java.util.ArrayList;
/**
* Created by ashishc on 07-02-2017.
*/
public class BrandAvabilityGetterSetter {
String BRAND_ID;
String BRAND;
String keyAccount_id;
String class_id;
String categoryId;
public String getStore_id() {
return store_id;
}
public void setStore_id(String store_id) {
this.store_id = store_id;
}
String store_id;
public String getStoreType_id() {
return storeType_id;
}
public void setStoreType_id(String storeType_id) {
this.storeType_id = storeType_id;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getClass_id() {
return class_id;
}
public void setClass_id(String class_id) {
this.class_id = class_id;
}
public String getKeyAccount_id() {
return keyAccount_id;
}
public void setKeyAccount_id(String keyAccount_id) {
this.keyAccount_id = keyAccount_id;
}
String storeType_id;
public String getBRAND() {
return BRAND;
}
public void setBRAND(String BRAND) {
this.BRAND = BRAND;
}
public String getBRAND_ID() {
return BRAND_ID;
}
public void setBRAND_ID(String BRAND_ID) {
this.BRAND_ID = BRAND_ID;
}
}
@@ -1,173 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
/**
* Created by ashishc on 20-02-2017.
*/
public class CategoryPictureGetterSetter {
String CategoryImage1="";
String CategoryImage2="";
String CategoryImage3="";
String CategoryImage4="";
String image_allow = "0";
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
String categoryId;
public String getCOMMON_ID() {
return COMMON_ID;
}
public void setCOMMON_ID(String COMMON_ID) {
this.COMMON_ID = COMMON_ID;
}
String COMMON_ID;
public String getKEY_ID() {
return KEY_ID;
}
public void setKEY_ID(String KEY_ID) {
this.KEY_ID = KEY_ID;
}
String KEY_ID;
public String getCamera_allow() {
return camera_allow;
}
public void setCamera_allow(String camera_allow) {
this.camera_allow = camera_allow;
}
public String getClass_id() {
return class_id;
}
public void setClass_id(String class_id) {
this.class_id = class_id;
}
public String getStore_type_id() {
return store_type_id;
}
public void setStore_type_id(String store_type_id) {
this.store_type_id = store_type_id;
}
public String getKey_account_id() {
return key_account_id;
}
public void setKey_account_id(String key_account_id) {
this.key_account_id = key_account_id;
}
String camera_allow,class_id,store_type_id,key_account_id;
public String getStore_ID() {
return Store_ID;
}
public void setStore_ID(String store_ID) {
Store_ID = store_ID;
}
String Store_ID;
String SubCategoryCamera1;
String SUB_CATEGORY_ID;
public String getSUB_CATEGORY() {
return SUB_CATEGORY;
}
public void setSUB_CATEGORY(String SUB_CATEGORY) {
this.SUB_CATEGORY = SUB_CATEGORY;
}
public String getSUB_CATEGORY_ID() {
return SUB_CATEGORY_ID;
}
public void setSUB_CATEGORY_ID(String SUB_CATEGORY_ID) {
this.SUB_CATEGORY_ID = SUB_CATEGORY_ID;
}
String SUB_CATEGORY;
public String getSubCategoryCamera1() {
return SubCategoryCamera1;
}
public void setSubCategoryCamera1(String subCategoryCamera1) {
SubCategoryCamera1 = subCategoryCamera1;
}
public String getSubCategoryCamera2() {
return SubCategoryCamera2;
}
public void setSubCategoryCamera2(String subCategoryCamera2) {
SubCategoryCamera2 = subCategoryCamera2;
}
String SubCategoryCamera2;
public String getCategoryImage2() {
return CategoryImage2;
}
public void setCategoryImage2(String categoryImage2) {
CategoryImage2 = categoryImage2;
}
public String getCategoryImage1() {
return CategoryImage1;
}
public void setCategoryImage1(String categoryImage1) {
CategoryImage1 = categoryImage1;
}
public String getCategoryImage3() {
return CategoryImage3;
}
public void setCategoryImage3(String categoryImage3) {
CategoryImage3 = categoryImage3;
}
public String getCategoryImage4() {
return CategoryImage4;
}
public void setCategoryImage4(String categoryImage4) {
CategoryImage4 = categoryImage4;
}
public String getImage_allow() {
return image_allow;
}
public void setImage_allow(String image_allow) {
this.image_allow = image_allow;
}
}
@@ -1,110 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
public class ChatMessageGetterSetter {
String REC_ID, CHAT_ID, MESSAGE, MESSAGEDATE , SENDERID, SENDER, RECEIVERID, RECEIVER, COMMENTDATE, COMMENT, STOREID, ORDERID, SENDER_USERID;
public String getREC_ID() {
return REC_ID;
}
public void setREC_ID(String REC_ID) {
this.REC_ID = REC_ID;
}
public String getCHAT_ID() {
return CHAT_ID;
}
public void setCHAT_ID(String CHAT_ID) {
this.CHAT_ID = CHAT_ID;
}
public String getMESSAGE() {
return MESSAGE;
}
public void setMESSAGE(String MESSAGE) {
this.MESSAGE = MESSAGE;
}
public String getMESSAGEDATE() {
return MESSAGEDATE;
}
public void setMESSAGEDATE(String MESSAGEDATE) {
this.MESSAGEDATE = MESSAGEDATE;
}
public String getSENDERID() {
return SENDERID;
}
public void setSENDERID(String SENDERID) {
this.SENDERID = SENDERID;
}
public String getSENDER() {
return SENDER;
}
public void setSENDER(String SENDER) {
this.SENDER = SENDER;
}
public String getRECEIVERID() {
return RECEIVERID;
}
public void setRECEIVERID(String RECEIVERID) {
this.RECEIVERID = RECEIVERID;
}
public String getRECEIVER() {
return RECEIVER;
}
public void setRECEIVER(String RECEIVER) {
this.RECEIVER = RECEIVER;
}
public String getCOMMENTDATE() {
return COMMENTDATE;
}
public void setCOMMENTDATE(String COMMENTDATE) {
this.COMMENTDATE = COMMENTDATE;
}
public String getCOMMENT() {
return COMMENT;
}
public void setCOMMENT(String COMMENT) {
this.COMMENT = COMMENT;
}
public String getSTOREID() {
return STOREID;
}
public void setSTOREID(String STOREID) {
this.STOREID = STOREID;
}
public String getORDERID() {
return ORDERID;
}
public void setORDERID(String ORDERID) {
this.ORDERID = ORDERID;
}
public String getSENDER_USERID() {
return SENDER_USERID;
}
public void setSENDER_USERID(String SENDER_USERID) {
this.SENDER_USERID = SENDER_USERID;
}
}
@@ -1,31 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
public class CoachingVisitGetterSetter {
String emp_id, img_path = "";
boolean exists;
public String getEmp_id() {
return emp_id;
}
public void setEmp_id(String emp_id) {
this.emp_id = emp_id;
}
public String getImg_path() {
return img_path;
}
public void setImg_path(String img_path) {
this.img_path = img_path;
}
public boolean isExists() {
return exists;
}
public void setExists(boolean exists) {
this.exists = exists;
}
}
@@ -1,102 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
import android.widget.TextView;
import java.io.Serializable;
public class OrderReceivedStatus implements Serializable {
//TextView sys_gen_poTV,storepoTV,podateTV,lineItemTV,statusTV;
String sys_gen_po="";
String storepo="";
String podate="";
String lineItem="";
String status="";
int SKU_ID;
int ORDERQTY;
int CATEGORY_ID;
int POID;
public int getPOID() {
return POID;
}
public void setPOID(int POID) {
this.POID = POID;
}
public int getStoreid() {
return Storeid;
}
public void setStoreid(int storeid) {
Storeid = storeid;
}
int Storeid;
public int getSKU_ID() {
return SKU_ID;
}
public void setSKU_ID(int SKU_ID) {
this.SKU_ID = SKU_ID;
}
public int getORDERQTY() {
return ORDERQTY;
}
public void setORDERQTY(int ORDERQTY) {
this.ORDERQTY = ORDERQTY;
}
public int getCATEGORY_ID() {
return CATEGORY_ID;
}
public void setCATEGORY_ID(int CATEGORY_ID) {
this.CATEGORY_ID = CATEGORY_ID;
}
public String getSys_gen_po() {
return sys_gen_po;
}
public void setSys_gen_po(String sys_gen_po) {
this.sys_gen_po = sys_gen_po;
}
public String getStorepo() {
return storepo;
}
public void setStorepo(String storepo) {
this.storepo = storepo;
}
public String getPodate() {
return podate;
}
public void setPodate(String podate) {
this.podate = podate;
}
public String getLineItem() {
return lineItem;
}
public void setLineItem(String lineItem) {
this.lineItem = lineItem;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
@@ -1,194 +0,0 @@
package cpm.com.gskmtorange.GetterSetter;
import java.io.Serializable;
/**
* Created by ashishc on 29-12-2016.
*/
public class StoreBean implements Serializable{
String STORE_ID;
String EMP_ID;
String KEYACCOUNT;
String STORE_NAME;
String ADDRESS;
String CITY;
String STORETYPE;
String CLASSIFICATION;
String KEYACCOUNT_ID;
String STORETYPE_ID;
String CLASS_ID;
String VISIT_DATE;
String CAMERA_ALLOW;
String UPLOAD_STATUS;
String LATITUDE;
String LONGITUDE;
String POG_TYPE_ID;
public String getFACING_HIDE() {
return FACING_HIDE;
}
public void setFACING_HIDE(String FACING_HIDE) {
this.FACING_HIDE = FACING_HIDE;
}
String FACING_HIDE;
public String getSTORE_ID() {
return STORE_ID;
}
public void setSTORE_ID(String STORE_ID) {
this.STORE_ID = STORE_ID;
}
public String getEMP_ID() {
return EMP_ID;
}
public void setEMP_ID(String EMP_ID) {
this.EMP_ID = EMP_ID;
}
public String getKEYACCOUNT() {
return KEYACCOUNT;
}
public void setKEYACCOUNT(String KEYACCOUNT) {
this.KEYACCOUNT = KEYACCOUNT;
}
public String getSTORE_NAME() {
return STORE_NAME;
}
public void setSTORE_NAME(String STORE_NAME) {
this.STORE_NAME = STORE_NAME;
}
public String getADDRESS() {
return ADDRESS;
}
public void setADDRESS(String ADDRESS) {
this.ADDRESS = ADDRESS;
}
public String getCITY() {
return CITY;
}
public void setCITY(String CITY) {
this.CITY = CITY;
}
public String getSTORETYPE() {
return STORETYPE;
}
public void setSTORETYPE(String STORETYPE) {
this.STORETYPE = STORETYPE;
}
public String getCLASSIFICATION() {
return CLASSIFICATION;
}
public void setCLASSIFICATION(String CLASSIFICATION) {
this.CLASSIFICATION = CLASSIFICATION;
}
public String getKEYACCOUNT_ID() {
return KEYACCOUNT_ID;
}
public void setKEYACCOUNT_ID(String KEYACCOUNT_ID) {
this.KEYACCOUNT_ID = KEYACCOUNT_ID;
}
public String getSTORETYPE_ID() {
return STORETYPE_ID;
}
public void setSTORETYPE_ID(String STORETYPE_ID) {
this.STORETYPE_ID = STORETYPE_ID;
}
public String getCLASS_ID() {
return CLASS_ID;
}
public void setCLASS_ID(String CLASS_ID) {
this.CLASS_ID = CLASS_ID;
}
public String getVISIT_DATE() {
return VISIT_DATE;
}
public void setVISIT_DATE(String VISIT_DATE) {
this.VISIT_DATE = VISIT_DATE;
}
public String getCAMERA_ALLOW() {
return CAMERA_ALLOW;
}
public void setCAMERA_ALLOW(String CAMERA_ALLOW) {
this.CAMERA_ALLOW = CAMERA_ALLOW;
}
public String getUPLOAD_STATUS() {
return UPLOAD_STATUS;
}
public void setUPLOAD_STATUS(String UPLOAD_STATUS) {
this.UPLOAD_STATUS = UPLOAD_STATUS;
}
public String getCHECKOUT_STATUS() {
return CHECKOUT_STATUS;
}
public void setCHECKOUT_STATUS(String CHECKOUT_STATUS) {
this.CHECKOUT_STATUS = CHECKOUT_STATUS;
}
public String getGEO_TAG() {
return GEO_TAG;
}
public void setGEO_TAG(String GEO_TAG) {
this.GEO_TAG = GEO_TAG;
}
String CHECKOUT_STATUS;
String GEO_TAG ;
public String getLATITUDE() {
return LATITUDE;
}
public void setLATITUDE(String LATITUDE) {
this.LATITUDE = LATITUDE;
}
public String getLONGITUDE() {
return LONGITUDE;
}
public void setLONGITUDE(String LONGITUDE) {
this.LONGITUDE = LONGITUDE;
}
public String getPOG_TYPE_ID() {
return POG_TYPE_ID;
}
public void setPOG_TYPE_ID(String POG_TYPE_ID) {
this.POG_TYPE_ID = POG_TYPE_ID;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,863 +0,0 @@
package cpm.com.gskmtorange;
import android.Manifest;
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.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
//import com.crashlytics.android.Crashlytics;
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 com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.util.ArrayList;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.dailyentry.CounterfeitIndicatorWebActivity;
import cpm.com.gskmtorange.dailyentry.DeliveryCallActivity;
import cpm.com.gskmtorange.dailyentry.FutureJCPActivity;
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.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;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private Context context;
WebView webView;
ImageView imageView;
String date, visit_status;
private SharedPreferences preferences = null;
GSKOrangeDB db;
String user_name, country_id, user_type;
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
View headerView;
ArrayList<CoverageBean> coverageList;
String error_msg;
Toolbar toolbar;
NavigationView navigationView;
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10;
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;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
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);
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);
webView.setWebViewClient(new MyWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
if (!url.equals("")) {
webView.loadUrl(url);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, navigationView, false);
TextView tv_username = (TextView) headerView.findViewById(R.id.nav_user_name);
//tv_usertype = (TextView) headerView.findViewById(R.id.nav_user_type);
ImageView img_change_password = (ImageView) headerView.findViewById(R.id.img_change_password);
tv_username.setText(user_name);
//tv_usertype.setText(user_type);
img_change_password.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent in = new Intent(context, ChangePasswordActivity.class);
startActivity(in);
}
});
navigationView.addHeaderView(headerView);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
protected void onResume() {
super.onResume();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.main_menu_activity_name));
db.open();
//usk
navigationView = (NavigationView) findViewById(R.id.nav_view);
// get menu from navigationView
Menu menu = navigationView.getMenu();
// find MenuItem you want to change
MenuItem nav_route_plan = menu.findItem(R.id.nav_route_plan);
nav_route_plan.setTitle(getResources().getString(R.string.menu_daily_route_plan));
MenuItem nav_route_plan1 = menu.findItem(R.id.nav_download);
nav_route_plan1.setTitle(getResources().getString(R.string.menu_daily_download));
MenuItem nav_route_plan2 = menu.findItem(R.id.nav_upload);
nav_route_plan2.setTitle(getResources().getString(R.string.menu_upload_data));
MenuItem nav_route_plan3 = menu.findItem(R.id.nav_geotag);
nav_route_plan3.setTitle(getResources().getString(R.string.menu_geotag));
MenuItem nav_route_plan4 = menu.findItem(R.id.nav_deviation);
nav_route_plan4.setTitle(getResources().getString(R.string.menu_deviation_data));
MenuItem nav_route_plan5 = menu.findItem(R.id.nav_delivery_call);
nav_route_plan5.setTitle(getResources().getString(R.string.delivery_call));
MenuItem nav_route_plan6 = menu.findItem(R.id.nav_future_jcp);
nav_route_plan6.setTitle(getResources().getString(R.string.future_route_plan));
MenuItem nav_route_plan7 = menu.findItem(R.id.nav_planogram);
nav_route_plan7.setTitle(getResources().getString(R.string.category_performance_PLANOGRAM));
MenuItem nav_route_plan8 = menu.findItem(R.id.nav_pharmacy_stores);
nav_route_plan8.setTitle(getResources().getString(R.string.pharma_stores));
MenuItem nav_route_plan9 = menu.findItem(R.id.nav_additional_stores);
nav_route_plan9.setTitle(getResources().getString(R.string.additional_stores));
MenuItem nav_route_plan10 = menu.findItem(R.id.nav_additional_adhoc_stores);
nav_route_plan10.setTitle(getResources().getString(R.string.additional_adhoc_stores));
MenuItem nav_route_plan11 = menu.findItem(R.id.nav_counterfeit_indicator);
nav_route_plan11.setTitle(getResources().getString(R.string.title_activity_counterfeit_indicator_web));
MenuItem nav_route_plan12 = menu.findItem(R.id.nav_exit);
nav_route_plan12.setTitle(getResources().getString(R.string.menu_exit));
MenuItem nav_route_plan13 = menu.findItem(R.id.nav_setting);
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));
/*//Deviation - Ad hoc Stores - enable
ArrayList<ConfigurationContrywiseGetterSetter> configuration_data = db.getConfigurationData(country_id);
if(configuration_data.size()>0){
if(configuration_data.get(0).getADHOC_REPORTING().get(0).equals("1")){
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_deviation).setVisible(true);
}
if(configuration_data.get(0).getPDF_ALLOW().get(0).equals("1")){
Menu nav_Menu = navigatsyncStateionView.getMenu();
nav_Menu.findItem(R.id.nav_planogram).setVisible(true);
}
}*/
//Enable disable According to Configuration
ArrayList<ConfigurationMasterGetterSetter> configurationData = db.getConfigurationMasterData(country_id);
if (configurationData.size() > 0) {
for (int i = 0; i < configurationData.size(); i++) {
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("ADHOC REPORTING") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_deviation).setVisible(true);
}
//temp remove it
/*Menu nav_Menu1 = navigationView.getMenu();
nav_Menu1.findItem(R.id.nav_deviation).setVisible(true);*/
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("PDF ALLOW") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_planogram).setVisible(true);
}
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("DELIVERY CALLS") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_delivery_call).setVisible(true);
}
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("ADDITIONAL STORE") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_additional_stores).setVisible(true);
}
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("PHARMA STORE") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_pharmacy_stores).setVisible(true);
}
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("COUNTERFEIT INDICATORS") &&
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
Menu nav_Menu = navigationView.getMenu();
nav_Menu.findItem(R.id.nav_counterfeit_indicator).setVisible(true);
}
}
}
coverageList = db.getCoverageData(date, null);
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
}
@Override
public void onBackPressed() {
super.onBackPressed();
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
// super.onBackPressed();
}
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_route_plan) {
Intent in_jcp = new Intent(this, StoreListActivity.class);
in_jcp.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_JCP);
startActivity(in_jcp);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_download) {
downloadMethod();
//checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
} else if (id == R.id.nav_upload) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.want_to_upload)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.open();
if (checkNetIsAvailable()) {
//Alert need to change this check so than user can work on Adhoc even having no JCP
//storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
if (db.getSKUMasterData(null).size() == 0) {
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
} else {
if (coverageList.size() == 0) {
Snackbar.make(webView, R.string.no_data_for_upload, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
} else {
if (isStoreCheckedIn() && isValid()) {
Intent i = new Intent(getBaseContext(), UploadActivity.class);
startActivity(i);
//finish();
} else {
Snackbar.make(webView, error_msg, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
}
}
}
} else {
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
}
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alert = builder.create();
alert.show();
} else if (id == R.id.nav_geotag) {
if (storelist.size() > 0) {
Intent startDownload = new Intent(this, GeoTagStoreList.class);
startActivity(startDownload);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else {
Snackbar.make(headerView, R.string.title_store_list_download_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
} else if (id == R.id.nav_exit) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.want_to_exit)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
/* Intent startDownload = new Intent(this, LoginActivity.class);
startActivity(startDownload);*/
ActivityCompat.finishAffinity(MainActivity.this);
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alert = builder.create();
alert.show();
} else if (id == R.id.nav_setting) {
Intent startDownload = new Intent(this, SettingsActivity.class);
startActivity(startDownload);
finish();
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
//startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
} else if (id == R.id.nav_services) {
Intent startservice = new Intent(this, ServiceActivity.class);
startActivity(startservice);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_future_jcp) {
Intent startDownload = new Intent(this, FutureJCPActivity.class);
startActivity(startDownload);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_planogram) {
if (checkNetIsAvailable()) {
Intent planogram_pdf = new Intent(this, PlanogramPDFActivity.class);
startActivity(planogram_pdf);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else {
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
}
} else if (id == R.id.nav_deviation) {
db.open();
if (db.getSKUMasterData(null).size() == 0) {
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
} else {
Intent in = new Intent(this, StoreListActivity.class);
in.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_DEVIATION);
startActivity(in);
// overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
} else if (id == R.id.nav_delivery_call) {
Intent in = new Intent(this, DeliveryCallActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_pharmacy_stores) {
/*Intent in = new Intent(this, PharmaActivity.class);
startActivity(in);*/
Intent in = new Intent(this, StoreListActivity.class);
in.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_PHARMA);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_additional_stores) {
db.open();
if (db.getSKUMasterData(null).size() == 0) {
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
} else {
Intent in = new Intent(this, StoreListActivity.class);
in.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_ADDITIONAL);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
} else if (id == R.id.nav_additional_adhoc_stores) {
db.open();
if (db.getSKUMasterData(null).size() == 0) {
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
} else {
Intent in = new Intent(this, StoreListActivity.class);
in.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_ADDITIONAL_ADHOC);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
} else if (id == R.id.nav_counterfeit_indicator) {
Intent intent = new Intent(this, CounterfeitIndicatorWebActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
/* progress.setVisibility(View.GONE);
WebViewActivity.this.progress.setProgress(100);*/
imageView.setVisibility(View.INVISIBLE);
webView.setVisibility(View.VISIBLE);
super.onPageFinished(view, url);
view.clearCache(true);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
/* progress.setVisibility(View.VISIBLE);
WebViewActivity.this.progress.setProgress(0);*/
super.onPageStarted(view, url, favicon);
}
}
public boolean checkNetIsAvailable() {
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();
return isConnected;
}
public boolean isStoreCheckedIn() {
boolean result_flag = true;
for (int i = 0; i < coverageList.size(); i++) {
String status = coverageList.get(i).getStatus();
if (status.equals(CommonString.KEY_INVALID) || status.equals(CommonString.KEY_VALID)) {
result_flag = false;
error_msg = getResources().getString(R.string.title_store_list_checkout_current);
break;
}
}
return result_flag;
}
public boolean isValid() {
boolean flag = false;
String storestatus = "";
for (int i = 0; i < coverageList.size(); i++) {
StoreBean store_data = db.getSpecificStoreData(date, coverageList.get(i).getStoreId(), coverageList.get(i).getFlag_from());
storestatus = store_data.getUPLOAD_STATUS();
String coverage_status = store_data.getCHECKOUT_STATUS();
if (!storestatus.equalsIgnoreCase(CommonString.KEY_U) && !storestatus.equalsIgnoreCase(CommonString.KEY_UN)) {
if ((coverage_status.equalsIgnoreCase(CommonString.KEY_Y) || storestatus.equalsIgnoreCase(CommonString.KEY_P) ||
storestatus.equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE))) {
flag = true;
break;
}
}
}
if (!flag)
error_msg = getResources().getString(R.string.no_data_for_upload);
return flag;
}
public boolean isPreviousValid(String visit_date) {
boolean isvalid = false;
ArrayList<CoverageBean> coverage_list = db.getPreviousCoverageData(visit_date, null);
for (int i = 0; i < coverage_list.size(); i++) {
StoreBean storeData = db.getSpecificStoreData(coverage_list.get(i).getVisitDate(), coverage_list.get(i).getStoreId(), coverage_list.get(i).getFlag_from());
if (storeData.getSTORE_ID() != null) {
if (!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U) && !storeData.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN) && (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) || storeData.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P))) {
isvalid = true;
break;
}
}
}
return isvalid;
}
void checkPermissionCamera(String permission) {
boolean permission_flag = false;
// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
Manifest.permission.CAMERA)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed; request the permission
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CAMERA},
10);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
} else {
// Permission has already been granted
}
}
void checkAppPermission(String permission, int requestCode) {
boolean permission_flag = false;
// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(MainActivity.this,
permission)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
permission)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
showOnPermissiondenied(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA, 1);
} else {
// No explanation needed; request the permission
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{permission},
requestCode);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
} else {
// Permission has already been granted
if (requestCode == MY_PERMISSIONS_REQUEST_CAMERA) {
checkAppPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_WRITE);
} else if (requestCode == MY_PERMISSIONS_REQUEST_STORAGE_WRITE) {
checkAppPermission(Manifest.permission.READ_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_READ);
} 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();
}*/
downloadMethod();
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_CAMERA: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
checkAppPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_WRITE);
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
// finish();
showOnPermissiondenied(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA, 1);
}
//return;
}
break;
case MY_PERMISSIONS_REQUEST_STORAGE_WRITE: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
checkAppPermission(Manifest.permission.READ_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_READ);
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
// finish();
showOnPermissiondenied(Manifest.permission.WRITE_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_WRITE, 1);
}
//return;
}
break;
case MY_PERMISSIONS_REQUEST_STORAGE_READ: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
checkAppPermission(Manifest.permission.ACCESS_FINE_LOCATION, MY_PERMISSIONS_REQUEST_LOCATION);
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
// finish();
showOnPermissiondenied(Manifest.permission.READ_EXTERNAL_STORAGE, MY_PERMISSIONS_REQUEST_STORAGE_READ, 1);
}
//return;
}
break;
case MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
showOnPermissiondenied(Manifest.permission.ACCESS_FINE_LOCATION, MY_PERMISSIONS_REQUEST_LOCATION, 1);
}
//return;
}
break;
// other 'case' lines to check for other
// permissions this app might request.
}
}
void showOnPermissiondenied(final String permissionsRequired, final int request_code, final int check) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Need Multiple Permissions");
builder.setMessage("This app needs Camera, Storage and Location permissions.");
builder.setPositiveButton("Grant", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
if (check == 0) {
checkAppPermission(permissionsRequired, request_code);
} else {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{permissionsRequired},
request_code);
}
}
});
/* builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
finish();
}
});*/
builder.show();
}
//for download
public void downloadMethod() {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.want_to_download)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (checkNetIsAvailable()) {
boolean previousflag = false;
if (db.isPreviousCoverageDataFilled(date)) {
if (isPreviousValid(date)) {
previousflag = true;
} else {
db.deletePreviousCoverageData(date);
}
}
if (previousflag) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(getResources().getString(R.string.previous_data_upload)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent in = new Intent(context, PreviousDataUploadActivity.class);
startActivity(in);
//finish();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
Intent in = new Intent(context, DownloadActivity.class);
startActivity(in);
}
} else {
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
}
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
@@ -1,98 +0,0 @@
package cpm.com.gskmtorange;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
public class MovableFloatingActionButton extends FloatingActionButton implements View.OnTouchListener {
private final static float CLICK_DRAG_TOLERANCE = 10; // Often, there will be a slight, unintentional, drag when the user taps the FAB, so we need to account for this.
private float downRawX, downRawY;
private float dX, dY;
public MovableFloatingActionButton(Context context) {
super(context);
init();
}
public MovableFloatingActionButton(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MovableFloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
setOnTouchListener(this);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
int action = motionEvent.getAction();
if (action == MotionEvent.ACTION_DOWN) {
downRawX = motionEvent.getRawX();
downRawY = motionEvent.getRawY();
dX = view.getX() - downRawX;
dY = view.getY() - downRawY;
return true; // Consumed
}
else if (action == MotionEvent.ACTION_MOVE) {
int viewWidth = view.getWidth();
int viewHeight = view.getHeight();
View viewParent = (View)view.getParent();
int parentWidth = viewParent.getWidth();
int parentHeight = viewParent.getHeight();
float newX = motionEvent.getRawX() + dX;
newX = Math.max(0, newX); // Don't allow the FAB past the left hand side of the parent
newX = Math.min(parentWidth - viewWidth, newX); // Don't allow the FAB past the right hand side of the parent
float newY = motionEvent.getRawY() + dY;
newY = Math.max(0, newY); // Don't allow the FAB past the top of the parent
newY = Math.min(parentHeight - viewHeight, newY); // Don't allow the FAB past the bottom of the parent
view.animate()
.x(newX)
.y(newY)
.setDuration(0)
.start();
return true; // Consumed
}
else if (action == MotionEvent.ACTION_UP) {
float upRawX = motionEvent.getRawX();
float upRawY = motionEvent.getRawY();
float upDX = upRawX - downRawX;
float upDY = upRawY - downRawY;
if (Math.abs(upDX) < CLICK_DRAG_TOLERANCE && Math.abs(upDY) < CLICK_DRAG_TOLERANCE) { // A click
return performClick();
}
else { // A drag
return true; // Consumed
}
}
else {
return super.onTouchEvent(motionEvent);
}
}
}
@@ -1,122 +0,0 @@
package cpm.com.gskmtorange;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.Locale;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.password.MPinActivity;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
Button btn_lang_1, btn_lang_2;
private Context context;
private SharedPreferences preferences = null;
private SharedPreferences.Editor editor = null;
LoginGetterSetter login_data;
ArrayList<String> language, culture_id;
boolean selected_flag = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_language);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
btn_lang_1 = (Button) findViewById(R.id.btn_language_one);
btn_lang_2 = (Button) findViewById(R.id.btn_language_two);
login_data = (LoginGetterSetter) getIntent().getSerializableExtra(CommonString.KEY_LOGIN_DATA);
language = login_data.getCULTURE_NAME();
culture_id = login_data.getCULTURE_ID();
setDataFromSharedPreferences(login_data);
if (language.size() > 1) {
btn_lang_1.setText(language.get(0));
btn_lang_2.setText(language.get(1));
btn_lang_1.setOnClickListener(this);
btn_lang_2.setOnClickListener(this);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (selected_flag) {
/* Intent intent = new Intent(getBaseContext(),
MainActivity.class);
intent.putExtra(CommonString.KEY_LOGIN_DATA, login_data);
startActivity(intent);
finish();*/
Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in);
finish();
} else {
Snackbar.make(view, getString(R.string.select_language), Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}
});
}
@Override
public void onClick(View view) {
int id = view.getId();
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();
} 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) {
Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit();
}
}
@@ -1,149 +0,0 @@
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.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;
public class SplashScreenActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 3000;
LinearLayout linearLayout;
private Context context;
private SharedPreferences preferences = null;
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}
/**
* Called when the activity is first created.
*/
@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());
}
return null;
}
}
@@ -1,99 +0,0 @@
package cpm.com.gskmtorange.adapter;
import android.content.ClipData;
import android.os.Build;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.listener.DragListener;
import cpm.com.gskmtorange.listener.Listener;
import cpm.com.gskmtorange.xmlGetterSetter.NoCameraDataGetterSetter;
public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListViewHolder>
implements View.OnTouchListener {
private List<NoCameraDataGetterSetter> list;
private Listener listener;
public ListAdapter(List<NoCameraDataGetterSetter> list, Listener listener) {
this.list = list;
this.listener = listener;
}
@Override
public ListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(
parent.getContext()).inflate(R.layout.brand_item_top_item, parent, false);
return new ListViewHolder(view);
}
@Override
public void onBindViewHolder(ListViewHolder holder, int position) {
holder.text.setText(list.get(position).getSKUGROUP_NAME());
holder.linear_parent.setTag(position);
holder.linear_parent.setOnTouchListener(this);
holder.linear_parent.setOnDragListener(new DragListener(listener));
}
@Override
public int getItemCount() {
return list.size();
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
ClipData data = ClipData.newPlainText("", "");
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
v.startDragAndDrop(data, shadowBuilder, v, 0);
} else {
v.startDrag(data, shadowBuilder, v, 0);
}
return true;
}
return false;
}
public List<NoCameraDataGetterSetter> getList() {
return list;
}
void updateList(List<NoCameraDataGetterSetter> list) {
this.list = list;
}
public DragListener getDragInstance() {
if (listener != null) {
return new DragListener(listener);
} else {
Log.e("ListAdapter", "Listener wasn't initialized!");
return null;
}
}
class ListViewHolder extends RecyclerView.ViewHolder {
TextView text;
LinearLayout linear_parent;
ListViewHolder(View itemView) {
super(itemView);
text = (TextView) itemView.findViewById(R.id.tv_brand);
linear_parent = (LinearLayout) itemView.findViewById(R.id.linear_parent);
}
}
}
@@ -1,148 +0,0 @@
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;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.listener.DragListener;
import cpm.com.gskmtorange.listener.Listener;
import cpm.com.gskmtorange.xmlGetterSetter.NoCameraDataGetterSetter;
/**
* Created by yadavendras on 17-10-2017.
*/
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<NoCameraDataGetterSetter> data = Collections.emptyList();
private Listener listener;
RecyclerView rec;
public MyAdapter(Context context, List<NoCameraDataGetterSetter> data, Listener listener, RecyclerView rec) {
inflator = LayoutInflater.from(context);
this.data = data;
this.listener = listener;
this.rec = rec;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflator.inflate(R.layout.brand_item, parent, false);
MyAdapter.MyViewHolder holder = new MyAdapter.MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
final NoCameraDataGetterSetter current = data.get(position);
if(current.getSKUGROUP_ID()!=null){
if(current.getSKUGROUP_ID().equals("-1")){
holder.parent_card.setVisibility(View.INVISIBLE);
}
else {
holder.parent_card.setVisibility(View.VISIBLE);
}
LinearLayout.LayoutParams lprams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
int width;
if(current.isVertical()){
width = current.getFacing()* CommonString.UNIT_VERTICAL;
}
else {
width = current.getFacing()* CommonString.UNIT_HORIZONTAL;
}
lprams.width = width;
lprams.setMargins(2,0,0,0);
holder.parent_card.setLayoutParams(lprams);
}
final String name = current.getSKUGROUP_NAME();
holder.name.setText(name);
holder.tv_facing.setText(current.getFacing()+"");
holder.linear_parent.setTag(position);
//holder.linear_parent.getLayoutParams().width = 100;
//holder.linear_parent.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
holder.linear_parent.setOnDragListener(new DragListener(listener));
holder.linear_parent.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
//Blank item cannot be edited or deleted
if(!current.getSKUGROUP_ID().equals("-1")){
listener.deleteItem(view, position, rec,current);
}
return false;
}
});
}
public DragListener getDragInstance() {
if (listener != null) {
return new DragListener(listener);
} else {
Log.e("ListAdapter", "Listener wasn't initialized!");
return null;
}
}
@Override
public int getItemCount() {
return data.size();
}
public List<NoCameraDataGetterSetter> getList() {
return data;
}
public void updateList(List<NoCameraDataGetterSetter> list) {
this.data = list;
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView name;
TextView tv_facing;
LinearLayout linear_parent;
CardView parent_card;
public MyViewHolder(View itemView) {
super(itemView);
name = (TextView) itemView.findViewById(R.id.tv_brand);
tv_facing = (TextView) itemView.findViewById(R.id.tv_facing);
linear_parent = (LinearLayout) itemView.findViewById(R.id.linear_parent);
parent_card = (CardView) itemView.findViewById(R.id.parent_card);
}
}
}
@@ -1,289 +0,0 @@
package cpm.com.gskmtorange.autoupdate;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.Locale;
import cpm.com.gskmtorange.LoginActivity;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
public class AutoUpdateActivity extends AppCompatActivity {
private Context context;
String versionCode;
int length;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private Data data;
String path = "", p, s;
ProgressBar progressBar;
private boolean status;
private SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Intent intent = getIntent();
context = this;
path = intent.getStringExtra(CommonString.KEY_PATH);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Parinaam");
builder.setMessage(getString(R.string.new_update_available))
.setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(AutoUpdateActivity.this);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
/*new File(
"/data/data/com.cpm.gsk_mt/databases/GTMT_DATABASE")
.delete();*/
new DownloadTask(AutoUpdateActivity.this).execute();
}
});
AlertDialog alert = builder.create();
alert.show();
}
private class DownloadTask extends AsyncTask<Void, Data, String> {
private Context context;
DownloadTask(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom_layout);
dialog.setTitle("Download");
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
percentage = (TextView) dialog.findViewById(R.id.percentage);
message = (TextView) dialog.findViewById(R.id.message);
}
@Override
protected String doInBackground(Void... params) {
try {
data = new Data();
data.name = "Downloading Application";
publishProgress(data);
versionCode = getPackageManager().getPackageInfo(
getPackageName(), 0).versionName;
data.name = "Upgrading Version : " + versionCode;
publishProgress(data);
// download application
URL url = new URL(path);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
// c.setDoOutput(true);
c.getResponseCode();
c.connect();
length = c.getContentLength();
String size = new DecimalFormat("##.##")
.format((double) ((double) length / 1024) / 1024)
+ " MB";
Log.e("appsize",size);
/*String PATH = Environment.getExternalStorageDirectory()
+ "/download/";*/
String PATH = CommonString.getApkFolder(context);
File file = new File(PATH);
// file.mkdirs();
File outputFile = new File(file, "app.apk");
FileOutputStream fos = new FileOutputStream(outputFile);
InputStream is = c.getInputStream();
int bytes = 0;
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is.read(buffer)) != -1) {
bytes = (bytes + len1);
s = new DecimalFormat("##.##")
.format((double) ((double) (bytes / 1024)) / 1024);
p = s.length() == 3 ? s + "0" : s;
p = p + " MB";
data.value = (int) ((double) (((double) bytes) / length) * 100);
data.name = "Download " + p + "/" + size;
publishProgress(data);
fos.write(buffer, 0, len1);
}
fos.close();
is.close();
return CommonString.KEY_SUCCESS;
} catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block
/* final AlertMessage message = new AlertMessage(
AutoUpdateActivity.this,
AlertMessage.MESSAGE_EXCEPTION, "download", e);*/
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
} catch (MalformedURLException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
} catch (IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
showAlert(CommonString.MESSAGE_SOCKETEXCEPTION);
}
});
} catch (Exception e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
}
return "";
}
@Override
protected void onProgressUpdate(Data... values) {
// TODO Auto-generated method stub
pb.setProgress(values[0].value);
percentage.setText(values[0].value + "%");
message.setText(values[0].name);
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
dialog.dismiss();
if (result.equals(CommonString.KEY_SUCCESS)) {
File toInstall = new File(CommonString.getApkFolder(context) + "app.apk");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Uri apkUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", toInstall);
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
} else {
Uri apkUri = Uri.fromFile(toInstall);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
AutoUpdateActivity.this.finish();
}
}
}
class Data {
int value;
String name;
}
public void showAlert(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(AutoUpdateActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
@@ -1,241 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import cpm.com.gskmtorange.R;
/**
* Created by Weiping on 2016/3/16.
*/
public class BigButtonView extends FrameLayout {
private FrameLayout frameLayout;
private View clickEffect;
private TextView text;
private TextView subText;
private String textString = "";
private String subTextString = "";
private ObjectAnimator clickEffectAnimator;
private int duration = 500;
private OnPressListener onPressListener;
public BigButtonView(Context context) {
this(context, null);
}
public BigButtonView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.big_button_view, this, true);
Resources resources = getResources();
frameLayout = (FrameLayout)findViewById(R.id.frame_layout);
text = (TextView)findViewById(R.id.text);
text.setText(textString);
text.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_text_color));
text.setTextSize(resources.getInteger(R.integer.default_big_button_text_size));
subText = (TextView)findViewById(R.id.sub_text);
subText.setText(subTextString);
subText.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_sub_text_color));
subText.setTextSize(resources.getInteger(R.integer.default_big_button_sub_text_size));
clickEffect = findViewById(R.id.click_effect);
clickEffect.setAlpha(0);
clickEffectAnimator = ObjectAnimator.ofFloat(clickEffect, "alpha", 1f, 0f);
clickEffectAnimator.setDuration(duration);
}
/**
* Set the listener, for returning what happened to BlurLockView.
*
* @param onPressListener OnPressListener.
*/
public void setOnPressListener(OnPressListener onPressListener) {
this.onPressListener = onPressListener;
}
/**
* Set the width of the button.
*
* @param width Width, in pixels.
*/
public void setWidth(int width) {
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
layoutParams.width = width;
frameLayout.setLayoutParams(layoutParams);
}
/**
* Set the height of the button.
*
* @param height Height, in pixels.
*/
public void setHeight(int height) {
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
layoutParams.height = height;
frameLayout.setLayoutParams(layoutParams);
}
/**
* Set the resource of background.
*
* @param resourceId ResourceId.
*/
public void setBackground(int resourceId) {
frameLayout.setBackgroundResource(resourceId);
}
/**
* Set the resource of click effect.
*
* @param resourceId ResourceId.
*/
public void setEffect(int resourceId) {
clickEffect.setBackgroundResource(resourceId);
}
/**
* Set the duration of the effect.
*
* @param duration Duration, in ms.
*/
public void setEffectDuration(int duration) {
this.duration = duration;
}
/**
* Set the text size of the main text.
*
* @param size Text size, in sp.
*/
public void setTextSize(int size) {
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
}
/**
* Set the text size of the sub text.
*
* @param size Text size, in sp.
*/
public void setSubTextSize(int size) {
subText.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
}
/**
* Set the text color of main text.
*
* @param color Color.
*/
public void setTextColor(int color) {
text.setTextColor(color);
}
/**
* Set the text color of sub text.
*
* @param color Color.
*/
public void setSubTextColor(int color) {
subText.setTextColor(color);
}
/**
* Set font of button.
*
* @param typeFace New font.
*/
public void setTypeFace(Typeface typeFace) {
text.setTypeface(typeFace);
subText.setTypeface(typeFace);
}
/**
* Set the string of the text.
*
* @param textString The new string.
*/
public void setText(String textString) {
this.textString = textString;
if (text != null) text.setText(textString);
}
/**
* Set the string of the sub text.
*
* @param subTextString The new string.
*/
public void setSubText(String subTextString) {
this.subTextString = subTextString;
if (subText != null) subText.setText(subTextString);
}
/**
* Set the visibility of sub textview.
*
* @param visibility The visibility.
*/
public void setSubTextVisibility(int visibility) {
if (visibility == GONE) {
text.setGravity(Gravity.CENTER);
} else {
text.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
}
subText.setVisibility(visibility);
}
/**
* Perform the click effect.
*
* @param event MotionEvent.
* @return
*/
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
if (onPressListener != null) onPressListener.onPress(textString);
clickEffectAnimator.cancel();
clickEffect.setAlpha(1);
break;
case MotionEvent.ACTION_UP:
clickEffectAnimator.start();
break;
default:break;
}
return super.dispatchTouchEvent(event);
}
/**
* Clear the animation.
*/
public void clearAnimation() {
if (clickEffect.getAlpha() == 1) {
clickEffectAnimator.cancel();
clickEffectAnimator.start();
}
}
public interface OnPressListener {
void onPress(String string);
}
}
@@ -1,871 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import java.util.Stack;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.blurlockview.Directions.HideType;
import cpm.com.gskmtorange.blurlockview.Directions.ShowType;
import cpm.com.gskmtorange.blurlockview.Eases.EaseType;
/**
* Created by Weiping on 2016/3/16.
*/
public class BlurLockView extends FrameLayout
implements
BigButtonView.OnPressListener,
SmallButtonView.OnPressListener {
private final char CHARS[][] = {
{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'},
{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'},
{ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L' },
{ 'Z', 'X', 'C', 'V', 'B', 'N', 'M' }
};
private Password type = Password.NUMBER;
private int passwordLength = 4;
private String correctPassword = null;
private int incorrectInputTimes = 0;
private Typeface typeface;
private boolean animationIsPlaying = false;
public boolean isIs_Password_Check_Mode() {
return is_Password_Check_Mode;
}
public void setIs_Password_Check_Mode(boolean is_Password_Check_Mode) {
this.is_Password_Check_Mode = is_Password_Check_Mode;
}
private boolean is_Password_Check_Mode = false;
private Stack<String> passwordStack = null;
private TextView title;
private Indicator indicator;
private BigButtonView[] bigButtonViews;
private SmallButtonView[][] smallButtonViews;
private BlurView mBlurView;
private TextView leftButton;
private TextView rightButton;
private OnLeftButtonClickListener onLeftButtonClickListener;
private OnPasswordInputListener onPasswordInputListener;
public BlurLockView(Context context) {
this(context, null);
}
public BlurLockView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
/**
* Init.
*/
private void init() {
// number password
LayoutInflater.from(getContext()).inflate(R.layout.number_lock_view, this, true);
bigButtonViews = new BigButtonView[10];
bigButtonViews[0] = (BigButtonView)findViewById(R.id.button_0);
bigButtonViews[1] = (BigButtonView)findViewById(R.id.button_1);
bigButtonViews[2] = (BigButtonView)findViewById(R.id.button_2);
bigButtonViews[3] = (BigButtonView)findViewById(R.id.button_3);
bigButtonViews[4] = (BigButtonView)findViewById(R.id.button_4);
bigButtonViews[5] = (BigButtonView)findViewById(R.id.button_5);
bigButtonViews[6] = (BigButtonView)findViewById(R.id.button_6);
bigButtonViews[7] = (BigButtonView)findViewById(R.id.button_7);
bigButtonViews[8] = (BigButtonView)findViewById(R.id.button_8);
bigButtonViews[9] = (BigButtonView)findViewById(R.id.button_9);
String[] texts = getResources().getStringArray(R.array.default_big_button_text);
String[] subTexts = getResources().getStringArray(R.array.default_big_button_sub_text);
for (int i = 0; i < 10; i++) {
bigButtonViews[i].setOnPressListener(this);
bigButtonViews[i].setText(texts[i]);
//bigButtonViews[i].setSubText(subTexts[i]);
}
bigButtonViews[0].setSubTextVisibility(View.GONE);
bigButtonViews[1].setSubTextVisibility(View.INVISIBLE);
// text password
smallButtonViews = new SmallButtonView[4][10];
// get screen width
Display display = ((Activity)getContext()).getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int buttonHorizontalMargin = 6;
int buttonVerticalMargin = 24;
int buttonWidth = (width - 11 * buttonHorizontalMargin) / 10;
// add buttons to lines
LinearLayout line1 = (LinearLayout)findViewById(R.id.line_1);
for (int i = 0; i < 10; i++) {
smallButtonViews[0][i] = new SmallButtonView(getContext());
smallButtonViews[0][i].setOnPressListener(this);
smallButtonViews[0][i].setText(CHARS[0][i] + "");
smallButtonViews[0][i].setWidth(buttonWidth);
smallButtonViews[0][i].setHeight(buttonWidth);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
buttonWidth,
buttonWidth
);
if (i == 0)
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
else if (i == 9)
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
else
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
line1.addView(smallButtonViews[0][i], params);
}
LinearLayout line2 = (LinearLayout)findViewById(R.id.line_2);
for (int i = 0; i < 10; i++) {
smallButtonViews[1][i] = new SmallButtonView(getContext());
smallButtonViews[1][i].setOnPressListener(this);
smallButtonViews[1][i].setText(CHARS[1][i] + "");
smallButtonViews[1][i].setWidth(buttonWidth);
smallButtonViews[1][i].setHeight(buttonWidth);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
buttonWidth,
buttonWidth
);
if (i == 0)
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
else if (i == 9)
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
else
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
line2.addView(smallButtonViews[1][i], params);
}
LinearLayout line3 = (LinearLayout)findViewById(R.id.line_3);
for (int i = 0; i < 9; i++) {
smallButtonViews[2][i] = new SmallButtonView(getContext());
smallButtonViews[2][i].setOnPressListener(this);
smallButtonViews[2][i].setText(CHARS[2][i] + "");
smallButtonViews[2][i].setWidth(buttonWidth);
smallButtonViews[2][i].setHeight(buttonWidth);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
buttonWidth,
buttonWidth
);
if (i == 0)
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
else if (i == 8)
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
else
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
line3.addView(smallButtonViews[2][i], params);
}
LinearLayout line4 = (LinearLayout)findViewById(R.id.line_4);
for (int i = 0; i < 7; i++) {
smallButtonViews[3][i] = new SmallButtonView(getContext());
smallButtonViews[3][i].setOnPressListener(this);
smallButtonViews[3][i].setText(CHARS[3][i] + "");
smallButtonViews[3][i].setWidth(buttonWidth);
smallButtonViews[3][i].setHeight(buttonWidth);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
buttonWidth,
buttonWidth
);
if (i == 0)
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
else if (i == 6)
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
else
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
line4.addView(smallButtonViews[3][i], params);
}
passwordStack = new Stack<>();
mBlurView = (BlurView)findViewById(R.id.blurview);
mBlurView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
Resources resources = getResources();
indicator = (Indicator)findViewById(R.id.indicator);
indicator.setPasswordLength(passwordLength);
title = (TextView)findViewById(R.id.title);
title.setTextColor(ContextCompat.getColor(getContext(), R.color.default_title_text_color));
title.setTextSize(resources.getInteger(R.integer.default_title_text_size));
leftButton = (TextView)findViewById(R.id.left_button);
leftButton.setTextColor(ContextCompat.getColor(getContext(), R.color.default_left_button_text_color));
leftButton.setTextSize(resources.getInteger(R.integer.default_left_button_text_size));
leftButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onLeftButtonClickListener != null) onLeftButtonClickListener.onClick();
}
});
rightButton = (TextView)findViewById(R.id.right_button);
rightButton.setTextColor(ContextCompat.getColor(getContext(), R.color.default_right_button_text_color));
rightButton.setTextSize(resources.getInteger(R.integer.default_right_button_text_size));
rightButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (passwordStack.size() > 0) {
passwordStack.pop();
indicator.delete();
if (onPasswordInputListener != null){
StringBuilder nowPassword = new StringBuilder("");
for (String s : passwordStack) {
nowPassword.append(s);
}
onPasswordInputListener.clear(nowPassword.toString());
}
}
}
});
}
/**
* Show the text keyboard smoothly or not.
*
* @param smoothly Smoothly or not.
*/
private void showText(boolean smoothly) {
if (animationIsPlaying) return;
animationIsPlaying = true;
if (smoothly) {
ObjectAnimator.ofFloat(findViewById(R.id.layout_123), "alpha", 1f, 0f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.layout_456), "alpha", 1f, 0f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.layout_789), "alpha", 1f, 0f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.button_0), "alpha", 1f, 0f)
.setDuration(500).start();
ObjectAnimator showAnimator =
ObjectAnimator.ofFloat(findViewById(R.id.text_layout), "alpha", 0f, 1f);
showAnimator.setDuration(500).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
findViewById(R.id.text_layout).setVisibility(VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
findViewById(R.id.layout_123).setVisibility(INVISIBLE);
findViewById(R.id.layout_456).setVisibility(INVISIBLE);
findViewById(R.id.layout_789).setVisibility(INVISIBLE);
findViewById(R.id.button_0).setVisibility(INVISIBLE);
animationIsPlaying = false;
}
});
showAnimator.start();
} else {
findViewById(R.id.layout_123).setVisibility(INVISIBLE);
findViewById(R.id.layout_456).setVisibility(INVISIBLE);
findViewById(R.id.layout_789).setVisibility(INVISIBLE);
findViewById(R.id.button_0).setVisibility(INVISIBLE);
findViewById(R.id.text_layout).setVisibility(VISIBLE);
animationIsPlaying = false;
}
}
/**
* Show the number keyboard smoothly or not.
*
* @param smoothly Smoothly or not.
*/
private void showNumber(boolean smoothly) {
if (animationIsPlaying) return;
animationIsPlaying = true;
if (smoothly) {
ObjectAnimator.ofFloat(findViewById(R.id.layout_123), "alpha", 0f, 1f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.layout_456), "alpha", 0f, 1f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.layout_789), "alpha", 0f, 1f)
.setDuration(500).start();
ObjectAnimator.ofFloat(findViewById(R.id.button_0), "alpha", 0f, 1f)
.setDuration(500).start();
ObjectAnimator showAnimator =
ObjectAnimator.ofFloat(findViewById(R.id.text_layout), "alpha", 1f, 0f);
showAnimator.setDuration(500).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
findViewById(R.id.layout_123).setVisibility(VISIBLE);
findViewById(R.id.layout_456).setVisibility(VISIBLE);
findViewById(R.id.layout_789).setVisibility(VISIBLE);
findViewById(R.id.button_0).setVisibility(VISIBLE);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
findViewById(R.id.text_layout).setVisibility(INVISIBLE);
animationIsPlaying = false;
}
});
showAnimator.start();
} else {
findViewById(R.id.layout_123).setVisibility(VISIBLE);
findViewById(R.id.layout_456).setVisibility(VISIBLE);
findViewById(R.id.layout_789).setVisibility(VISIBLE);
findViewById(R.id.button_0).setVisibility(VISIBLE);
findViewById(R.id.text_layout).setVisibility(INVISIBLE);
animationIsPlaying = false;
}
}
/**
* Set the view that need to be blurred.
*
* @param blurredView The view.
*/
public void setBlurredView(View blurredView) {
mBlurView.setBlurredView(blurredView);
}
/**
* Set the listener.
*
* @param onLeftButtonClickListener Listener.
*/
public void setOnLeftButtonClickListener(OnLeftButtonClickListener onLeftButtonClickListener) {
this.onLeftButtonClickListener = onLeftButtonClickListener;
}
/**
* Set the listener.
*
* @param onPasswordInputListener Listener.
*/
public void setOnPasswordInputListener(OnPasswordInputListener onPasswordInputListener) {
this.onPasswordInputListener = onPasswordInputListener;
}
/**
* From the button views.
*
* @param string The string from button views.
*/
@Override
public void onPress(String string) {
if (correctPassword == null) {
throw new RuntimeException("The correct password has NOT been set!");
}
if (passwordStack.size() >= passwordLength) return;
passwordStack.push(string);
indicator.add();
StringBuilder nowPassword = new StringBuilder("");
for (String s : passwordStack) {
nowPassword.append(s);
}
String nowPasswordString = nowPassword.toString();
if (correctPassword.equals(nowPasswordString)) {
// correct password
if (onPasswordInputListener != null)
onPasswordInputListener.correct(nowPasswordString);
} else {
if (correctPassword.length() > nowPasswordString.length()) {
// input right now
if (onPasswordInputListener != null)
onPasswordInputListener.input(nowPasswordString);
} else {
// incorrect password
if (onPasswordInputListener != null)
onPasswordInputListener.incorrect(nowPasswordString);
if(is_Password_Check_Mode){
// perform the clear animation
incorrectInputTimes++;
indicator.clear();
passwordStack.clear();
}
}
}
}
/**
* Prevent click 2 or above buttons at the same time.
*
* @param event
* @return
*/
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (event.getPointerCount() > 1) {
if (Password.NUMBER.equals(type)) {
for (int i = 0; i < bigButtonViews.length; i++) bigButtonViews[i].clearAnimation();
} else if (Password.TEXT.equals(type)) {
for (int i = 0; i < smallButtonViews.length; i++) {
for (int j = 0; j < smallButtonViews[i].length; j++) {
if (smallButtonViews[i][j] != null) smallButtonViews[i][j].clearAnimation();
}
}
}
return true;
}
return super.dispatchTouchEvent(event);
}
/**
* Set big buttons' background.
*
* @param id
*/
public void setBigButtonViewsBackground(int id) {
for (int i = 0; i < 10; i++) bigButtonViews[i].setBackground(id);
}
/**
* Set big buttons' click effect.
*
* @param id
*/
public void setBigButtonViewsClickEffect(int id) {
for (int i = 0; i < 10; i++) bigButtonViews[i].setEffect(id);
}
/**
* Set the click effect duration.
*
* @param duration
*/
public void setBigButtonViewsClickEffectDuration(int duration) {
for (int i = 0; i < 10; i++) bigButtonViews[i].setEffectDuration(duration);
}
/**
* Set small buttons' background.
*
* @param id
*/
public void setSmallButtonViewsBackground(int id) {
for (int i = 0; i < smallButtonViews.length; i++)
for (int j = 0; j < smallButtonViews[i].length; j++)
if (smallButtonViews[i][j] != null)
smallButtonViews[i][j].setBackground(id);
}
/**
* Set small buttons' click effect.
*
* @param id
*/
public void setSmallButtonViewsClickEffect(int id) {
for (int i = 0; i < smallButtonViews.length; i++)
for (int j = 0; j < smallButtonViews[i].length; j++)
if (smallButtonViews[i][j] != null)
smallButtonViews[i][j].setEffect(id);
}
/**
* Set the click effect duration.
*
* @param duration
*/
public void setSmallButtonViewsClickEffectDuration(int duration) {
for (int i = 0; i < smallButtonViews.length; i++)
for (int j = 0; j < smallButtonViews[i].length; j++)
if (smallButtonViews[i][j] != null)
smallButtonViews[i][j].setEffectDuration(duration);
}
/**
* Set all the fonts.
*
* @param typeface
*/
public void setTypeface(Typeface typeface) {
this.typeface = typeface;
if (type.equals(Password.NUMBER)) {
for (int i = 0; i < 10; i++) bigButtonViews[i].setTypeFace(typeface);
} else if (type.equals(Password.TEXT)) {
for (int i = 0; i < smallButtonViews.length; i++)
for (int j = 0; j < smallButtonViews[i].length; j++)
if (smallButtonViews[i][j] != null)
smallButtonViews[i][j].setTypeFace(typeface);
}
title.setTypeface(typeface);
leftButton.setTypeface(typeface);
rightButton.setTypeface(typeface);
}
/**
* Set all the text color.
*
* @param color
*/
public void setTextColor(int color) {
if (type.equals(Password.NUMBER)) {
for (int i = 0; i < 10; i++) {
bigButtonViews[i].setTextColor(color);
bigButtonViews[i].setSubTextColor(color);
}
} else if (type.equals(Password.TEXT)) {
for (int i = 0; i < smallButtonViews.length; i++)
for (int j = 0; j < smallButtonViews[i].length; j++)
if (smallButtonViews[i][j] != null)
smallButtonViews[i][j].setTextColor(color);
}
title.setTextColor(color);
leftButton.setTextColor(color);
rightButton.setTextColor(color);
}
/**
* Set the length of the password.
* Default length is 4.
*
* @param passwordLength
*/
public void setPasswordLength(int passwordLength) {
this.passwordLength = passwordLength;
indicator.setPasswordLength(passwordLength);
passwordStack.clear();
correctPassword = null;
}
/**
* Get the password type.
*
* @return
*/
public Password getType() {
return type;
}
/**
* Set the password type.
*
* @param type Number or text.
*/
public void setType(Password type, boolean smoothly) {
if (animationIsPlaying) return;
this.type = type;
indicator.clear();
passwordStack.clear();
if (Password.NUMBER.equals(type)) {
showNumber(smoothly);
} else if (Password.TEXT.equals(type)) {
showText(smoothly);
}
}
/**
* Set the title text.
*
* @param string
*/
public void setTitle(String string) {
title.setText(string);
}
/**
* Set the text of left button.
*
* @param string
*/
public void setLeftButton(String string) {
leftButton.setText(string);
}
/**
* Set the text of right button.
*
* @param string
*/
public void setRightButton(String string) {
rightButton.setText(string);
}
/**
* Set the target password.
*
* @param correctPassword The target password.
*/
public void setCorrectPassword(String correctPassword) {
setPasswordLength(correctPassword.length());
this.correctPassword = correctPassword;
}
/**
* You can use this to reset the incorrect input times.
*
* @param incorrectInputTimes The incorrect input times.
*/
public void setIncorrectInputTimes(int incorrectInputTimes) {
this.incorrectInputTimes = incorrectInputTimes;
}
/**
* Return the incorrect input times.
*
* @return Incorrect input times.
*/
public int getIncorrectInputTimes() {
return incorrectInputTimes;
}
/**
* Invalidate the blur view.
*/
public void update() {
mBlurView.invalidate();
}
/**
* Show this BlurLockView.
*
* @param duration Duration, in ms.
* @param showType Direction, in ShowType.
* @param easeType Ease type, in EaseType.
*/
public void show(int duration, ShowType showType, EaseType easeType) {
if (animationIsPlaying) return;
animationIsPlaying = true;
indicator.clear();
passwordStack.clear();
ObjectAnimator animator = null;
setVisibility(VISIBLE);
if (showType.equals(ShowType.FROM_TOP_TO_BOTTOM)) {
animator = ObjectAnimator.ofFloat(this, "translationY",
getTranslationY() - getHeight(),
getTranslationY());
} else if (showType.equals(ShowType.FROM_RIGHT_TO_LEFT)) {
animator = ObjectAnimator.ofFloat(this, "translationX",
getTranslationX() + getWidth(),
getTranslationX());
} else if (showType.equals(ShowType.FROM_BOTTOM_TO_TOP)) {
animator = ObjectAnimator.ofFloat(this, "translationY",
getTranslationY() + getHeight(),
getTranslationY());
} else if (showType.equals(ShowType.FROM_LEFT_TO_RIGHT)) {
animator = ObjectAnimator.ofFloat(this, "translationX",
getTranslationX() - getWidth(),
getTranslationX());
} else if (showType.equals(ShowType.FADE_IN)) {
animator = ObjectAnimator.ofFloat(this, "alpha",
0,
1);
}
animator.setDuration(duration);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
update();
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animationIsPlaying = false;
}
});
animator.setInterpolator(InterpolatorFactory.getInterpolator(easeType));
animator.start();
}
/**
* Hide this BlurLockView.
*
* @param duration Duration, in ms.
* @param hideType Direction, in HideType.
* @param easeType Ease type, in EaseType.
*/
public void hide(int duration, HideType hideType, EaseType easeType) {
if (animationIsPlaying) return;
animationIsPlaying = true;
ObjectAnimator animator = null;
final float originalX = getTranslationX();
final float originalY = getTranslationY();
if (hideType.equals(HideType.FROM_TOP_TO_BOTTOM)) {
animator = ObjectAnimator.ofFloat(this, "translationY",
getTranslationY(),
getTranslationY() + getHeight());
} else if (hideType.equals(HideType.FROM_RIGHT_TO_LEFT)) {
animator = ObjectAnimator.ofFloat(this, "translationX",
getTranslationX(),
getTranslationX() - getWidth());
} else if (hideType.equals(HideType.FROM_BOTTOM_TO_TOP)) {
animator = ObjectAnimator.ofFloat(this, "translationY",
getTranslationY(),
getTranslationY() - getHeight());
} else if (hideType.equals(HideType.FROM_LEFT_TO_RIGHT)) {
animator = ObjectAnimator.ofFloat(this, "translationX",
getTranslationX(),
getTranslationX() + getWidth());
} else if (hideType.equals(HideType.FADE_OUT)) {
animator = ObjectAnimator.ofFloat(this, "alpha",
1,
0);
}
animator.setDuration(duration);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
update();
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
setVisibility(INVISIBLE);
setTranslationX(originalX);
setTranslationY(originalY);
setAlpha(1);
animationIsPlaying = false;
}
});
animator.setInterpolator(InterpolatorFactory.getInterpolator(easeType));
animator.start();
}
public interface OnPasswordInputListener {
void correct(String inputPassword);
void incorrect(String inputPassword);
void input(String inputPassword);
void clear(String remainingPassword);
}
public interface OnLeftButtonClickListener {
void onClick();
}
/**
* Get the title.
* @return
*/
public TextView getTitle() {
return title;
}
/**
* Get the left button.
* @return
*/
public TextView getLeftButton() {
return leftButton;
}
/**
* Get the right button.
* @return
*/
public TextView getRightButton() {
return rightButton;
}
/**
* Get the numbers.
* @return
*/
public BigButtonView[] getBigButtonViews() {
return bigButtonViews;
}
/**
* Get the texts.
* @return
*/
public SmallButtonView[][] getSmallButtonViews() {
return smallButtonViews;
}
/**
* Set the blur radius.
*/
public void setBlurRadius(int blurRadius) {
mBlurView.setBlurRadius(blurRadius);
update();
}
/**
* Get the blur radius.
* @return
*/
public int getBlurRadius() {
return mBlurView.getBlurRadius();
}
/**
* Set the downsample factor.
* @param downsampleFactor
*/
public void setDownsampleFactor(int downsampleFactor) {
mBlurView.setDownsampleFactor(downsampleFactor);
update();
}
/**
* Get the downsample factor.
* @return
*/
public int getDownsampleFactor() {
return mBlurView.getDownsampleFactor();
}
/**
* Set the overlay color.
* @param color
*/
public void setOverlayColor(int color) {
mBlurView.setOverlayColor(color);
update();
}
/**
* Get the overlay color.
* @return
*/
public int getOverlayColor() {
return mBlurView.getmOverlayColor();
}
}
@@ -1,194 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.util.AttributeSet;
import android.view.View;
import cpm.com.gskmtorange.R;
/**
* Created by Weiping on 2016/3/16.
*/
public class BlurView extends View {
private int mBlurRadius;
private int mDownsampleFactor;
private int mOverlayColor;
private View mBlurredView;
private int mBlurredViewWidth, mBlurredViewHeight;
private boolean mDownsampleFactorChanged;
private Bitmap mBitmapToBlur, mBlurredBitmap;
private Canvas mBlurringCanvas;
private RenderScript mRenderScript;
private ScriptIntrinsicBlur mBlurScript;
private Allocation mBlurInput, mBlurOutput;
public BlurView(Context context) {
this(context, null);
}
public BlurView(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = getResources();
final int defaultBlurRadius = res.getInteger(R.integer.default_blur_radius);
final int defaultDownsampleFactor = res.getInteger(R.integer.default_downsample_factor);
final int defaultOverlayColor = res.getColor(R.color.default_overlay_color);
initializeRenderScript(context);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BlurView);
setBlurRadius(a.getInt(R.styleable.BlurView_blurRadius, defaultBlurRadius));
setDownsampleFactor(a.getInt(R.styleable.BlurView_downsampleFactor,
defaultDownsampleFactor));
setOverlayColor(a.getColor(R.styleable.BlurView_overlayColor, defaultOverlayColor));
a.recycle();
}
public void setBlurredView(View blurredView) {
mBlurredView = blurredView;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (mBlurredView != null) {
if (prepare()) {
// If the background of the blurred view is a color drawable, we use it to clear
// the blurring canvas, which ensures that edges of the child views are blurred
// as well; otherwise we clear the blurring canvas with a transparent color.
if (mBlurredView.getBackground() != null && mBlurredView.getBackground() instanceof ColorDrawable) {
mBitmapToBlur.eraseColor(((ColorDrawable) mBlurredView.getBackground()).getColor());
} else {
mBitmapToBlur.eraseColor(Color.TRANSPARENT);
}
int[] mBlurredViewXY = new int[2];
mBlurredView.getLocationOnScreen(mBlurredViewXY);
int[] mBlurringViewXY = new int[2];
getLocationOnScreen(mBlurringViewXY);
mBlurredView.draw(mBlurringCanvas);
blur();
canvas.save();
// modify here to get the correct bitmap when the blurring view is in a parent
canvas.translate(mBlurredViewXY[0] - mBlurringViewXY[0], mBlurredViewXY[1] - mBlurringViewXY[1]);
canvas.scale(mDownsampleFactor, mDownsampleFactor);
canvas.drawBitmap(mBlurredBitmap, 0, 0, null);
canvas.restore();
}
canvas.drawColor(mOverlayColor);
}
}
public void setBlurRadius(int radius) {
mBlurRadius = radius;
mBlurScript.setRadius(mBlurRadius);
}
public int getBlurRadius() {
return mBlurRadius;
}
public void setDownsampleFactor(int factor) {
if (factor <= 0) {
throw new IllegalArgumentException("Downsample factor must be greater than 0.");
}
if (mDownsampleFactor != factor) {
mDownsampleFactor = factor;
mDownsampleFactorChanged = true;
}
}
public int getDownsampleFactor() {
return mDownsampleFactor;
}
public void setOverlayColor(int color) {
mOverlayColor = color;
}
public int getmOverlayColor() {
return mOverlayColor;
}
private void initializeRenderScript(Context context) {
mRenderScript = RenderScript.create(context);
mBlurScript = ScriptIntrinsicBlur.create(mRenderScript, Element.U8_4(mRenderScript));
}
protected boolean prepare() {
final int width = mBlurredView.getWidth();
final int height = mBlurredView.getHeight();
if (mBlurringCanvas == null || mDownsampleFactorChanged
|| mBlurredViewWidth != width || mBlurredViewHeight != height) {
mDownsampleFactorChanged = false;
mBlurredViewWidth = width;
mBlurredViewHeight = height;
int scaledWidth = width / mDownsampleFactor;
int scaledHeight = height / mDownsampleFactor;
// The following manipulation is to avoid some RenderScript artifacts at the edge.
scaledWidth = scaledWidth - scaledWidth % 4 + 4;
scaledHeight = scaledHeight - scaledHeight % 4 + 4;
if (mBlurredBitmap == null
|| mBlurredBitmap.getWidth() != scaledWidth
|| mBlurredBitmap.getHeight() != scaledHeight) {
mBitmapToBlur = Bitmap.createBitmap(scaledWidth, scaledHeight,
Bitmap.Config.ARGB_8888);
if (mBitmapToBlur == null) {
return false;
}
mBlurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight,
Bitmap.Config.ARGB_8888);
if (mBlurredBitmap == null) {
return false;
}
}
mBlurringCanvas = new Canvas(mBitmapToBlur);
mBlurringCanvas.scale(1f / mDownsampleFactor, 1f / mDownsampleFactor);
mBlurInput = Allocation.createFromBitmap(mRenderScript, mBitmapToBlur,
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
mBlurOutput = Allocation.createTyped(mRenderScript, mBlurInput.getType());
}
return true;
}
protected void blur() {
mBlurInput.copyFrom(mBitmapToBlur);
mBlurScript.setInput(mBlurInput);
mBlurScript.forEach(mBlurOutput);
mBlurOutput.copyTo(mBlurredBitmap);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mRenderScript != null) {
mRenderScript.destroy();
}
}
}
@@ -1,20 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Directions;
/**
* Created by Weiping on 2016/3/17.
*/
public enum HideType {
FROM_TOP_TO_BOTTOM(0),
FROM_RIGHT_TO_LEFT(1),
FROM_BOTTOM_TO_TOP(2),
FROM_LEFT_TO_RIGHT(3),
FADE_OUT(4);
int type;
HideType(int type) {
this.type = type;
}
}
@@ -1,20 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Directions;
/**
* Created by Weiping on 2016/3/17.
*/
public enum ShowType {
FROM_TOP_TO_BOTTOM(0),
FROM_RIGHT_TO_LEFT(1),
FROM_BOTTOM_TO_TOP(2),
FROM_LEFT_TO_RIGHT(3),
FADE_IN(4);
int type;
ShowType(int type) {
this.type = type;
}
}
@@ -1,87 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import cpm.com.gskmtorange.R;
/**
* Created by Weiping on 2016/3/17.
*/
public class Dot extends FrameLayout {
private View selected;
private View unselected;
private ObjectAnimator selectedAnimator;
private ObjectAnimator unselectedAnimator;
private boolean isSelected = false;
public Dot(Context context) {
this(context, null);
}
public Dot(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.dot_view, this, true);
selected = findViewById(R.id.selected);
unselected = findViewById(R.id.unselected);
clear();
}
/**
* Set this dot to selected or not.
*
* @param isSelected Selected or not.
*/
public void setSelected(boolean isSelected) {
if (!(this.isSelected ^ isSelected)) return;
this.isSelected = isSelected;
if (isSelected) {
// change to selected
selected.setAlpha(0);
unselected.setAlpha(1);
if (selectedAnimator != null) selectedAnimator.cancel();
if (unselectedAnimator != null) unselectedAnimator.cancel();
selectedAnimator = ObjectAnimator.ofFloat(selected, "alpha", 0f, 1f);
selectedAnimator.setDuration(300);
selectedAnimator.start();
unselectedAnimator = ObjectAnimator.ofFloat(unselected, "alpha", 1f, 0f);
unselectedAnimator.setDuration(300);
unselectedAnimator.start();
} else {
// change to unselected
selected.setAlpha(1);
unselected.setAlpha(0);
if (selectedAnimator != null) selectedAnimator.cancel();
if (unselectedAnimator != null) unselectedAnimator.cancel();
selectedAnimator = ObjectAnimator.ofFloat(selected, "alpha", 1f, 0f);
selectedAnimator.setDuration(300);
selectedAnimator.start();
unselectedAnimator = ObjectAnimator.ofFloat(unselected, "alpha", 0f, 1f);
unselectedAnimator.setDuration(300);
unselectedAnimator.start();
}
}
/**
* Clear the dot.
*/
public void clear() {
selected.setAlpha(0);
unselected.setAlpha(1);
}
}
@@ -1,82 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
import android.graphics.PointF;
/**
* Created by Weiping on 2016/3/3.
*/
public abstract class CubicBezier {
private PointF start;
private PointF end;
private PointF a = new PointF();
private PointF b = new PointF();
private PointF c = new PointF();
/**
* init the 4 values of the cubic-bezier
* @param startX x of start
* @param startY y of start
* @param endX x of end
* @param endY y of end
*/
public void init(float startX, float startY, float endX, float endY) {
setStart(new PointF(startX, startY));
setEnd(new PointF(endX, endY));
}
public void init(double startX, double startY, double endX, double endY) {
init((float) startX, (float) startY, (float) endX, (float) endY);
}
public float getOffset(float offset) {
return getBezierCoordinateY(getXForTime(offset));
}
private float getBezierCoordinateY(float time) {
c.y = 3 * start.y;
b.y = 3 * (end.y - start.y) - c.y;
a.y = 1 - c.y - b.y;
return time * (c.y + time * (b.y + time * a.y));
}
private float getXForTime(float time) {
float x = time;
float z;
for (int i = 1; i < 14; i++) {
z = getBezierCoordinateX(x) - time;
if (Math.abs(z) < 1e-3) {
break;
}
x -= z / getXDerivate(x);
}
return x;
}
private float getXDerivate(float t) {
return c.x + t * (2 * b.x + 3 * a.x * t);
}
private float getBezierCoordinateX(float time) {
c.x = 3 * start.x;
b.x = 3 * (end.x - start.x) - c.x;
a.x = 1 - c.x - b.x;
return time * (c.x + time * (b.x + time * a.x));
}
public PointF getStart() {
return start;
}
public void setStart(PointF start) {
this.start = start;
}
public PointF getEnd() {
return end;
}
public void setEnd(PointF end) {
this.end = end;
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInBack extends CubicBezier {
public EaseInBack() {
init(0.6, -0.28, 0.735, 0.045);
}
}
@@ -1,32 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInBounce extends CubicBezier {
public EaseInBounce() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
return c - easeOutBounce(d-t, 0, c, d) + b;
}
private float easeOutBounce(float t, float b, float c, float d) {
if ((t/=d) < (1/2.75f)) {
return c*(7.5625f*t*t) + b;
} else if (t < (2/2.75f)) {
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
} else {
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
}
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInCirc extends CubicBezier {
public EaseInCirc() {
init(0.6, 0.04, 0.98, 0.335);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInCubic extends CubicBezier {
public EaseInCubic() {
init(0.55, 0.055, 0.675, 0.19);
}
}
@@ -1,24 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInElastic extends CubicBezier {
public EaseInElastic() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
if (t==0) return b; if ((t/=d)==1) return b+c;
float p=d*.3f;
float a=c;
float s=p/4;
return -(a*(float) Math.pow(2,10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )) + b;
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInExpo extends CubicBezier {
public EaseInExpo() {
init(0.95, 0.05, 0.795, 0.035);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutBack extends CubicBezier {
public EaseInOutBack() {
init(0.68, -0.55, 0.265, 1.55);
}
}
@@ -1,39 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutBounce extends CubicBezier {
public EaseInOutBounce() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
if (t < d / 2)
return easeInBounce(t * 2, 0, c, d) * .5f + b;
else
return easeOutBounce(t * 2 - d, 0, c, d) * .5f + c * .5f + b;
}
private float easeInBounce(float t, float b, float c, float d) {
return c - easeOutBounce(d - t, 0, c, d) + b;
}
private float easeOutBounce(float t, float b, float c, float d) {
if ((t/=d) < (1/2.75f)) {
return c*(7.5625f*t*t) + b;
} else if (t < (2/2.75f)) {
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
} else {
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
}
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutCirc extends CubicBezier {
public EaseInOutCirc() {
init(0.785, 0.135, 0.15, 0.86);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutCubic extends CubicBezier {
public EaseInOutCubic() {
init(0.645, 0.045, 0.355, 1);
}
}
@@ -1,25 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutElastic extends CubicBezier {
public EaseInOutElastic() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
if (t==0) return b; if ((t/=d/2)==2) return b+c;
float p=d*(.3f*1.5f);
float a=c;
float s=p/4;
if (t < 1) return -.5f*(a*(float) Math.pow(2,10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )) + b;
return a*(float) Math.pow(2,-10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )*.5f + c + b;
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutExpo extends CubicBezier {
public EaseInOutExpo() {
init(1, 0, 0, 1);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutQuad extends CubicBezier {
public EaseInOutQuad() {
init(0.455, 0.03, 0.515, 0.955);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutQuart extends CubicBezier {
public EaseInOutQuart() {
init(0.77, 0, 0.175, 1);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutQuint extends CubicBezier {
public EaseInOutQuint() {
init(0.86, 0, 0.07, 1);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInOutSine extends CubicBezier {
public EaseInOutSine() {
init(0.445, 0.05, 0.55, 0.95);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInQuad extends CubicBezier {
public EaseInQuad() {
init(0.55, 0.085, 0.68, 0.53);
}
}
@@ -1,12 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInQuart extends CubicBezier {
public EaseInQuart() {
init(0.895, 0.03, 0.685, 0.22);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInQuint extends CubicBezier {
public EaseInQuint() {
init(0.755, 0.05, 0.855, 0.06);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseInSine extends CubicBezier {
public EaseInSine() {
init(0.47, 0, 0.745, 0.715);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutBack extends CubicBezier {
public EaseOutBack() {
init(0.175, 0.885, 0.32, 1.275);
}
}
@@ -1,27 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutBounce extends CubicBezier {
public EaseOutBounce() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
if ((t/=d) < (1/2.75f)) {
return c*(7.5625f*t*t) + b;
} else if (t < (2/2.75f)) {
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
} else {
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
}
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutCirc extends CubicBezier {
public EaseOutCirc() {
init(0.075, 0.82, 0.165, 1);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutCubic extends CubicBezier {
public EaseOutCubic() {
init(0.215, 0.61, 0.355, 1);
}
}
@@ -1,25 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutElastic extends CubicBezier {
public EaseOutElastic() {
}
public float getOffset(float t) {
float b = 0;
float c = 1;
float d = 1;
if (t==0) return b; if ((t/=d)==1) return b+c;
float p=d*.3f;
float a=c;
float s=p/4;
return (a*(float) Math.pow(2,-10*t) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p ) + c + b);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutExpo extends CubicBezier {
public EaseOutExpo() {
init(0.19, 1, 0.22, 1);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutQuad extends CubicBezier {
public EaseOutQuad() {
init(0.25, 0.46, 0.45, 0.94);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutQuart extends CubicBezier {
public EaseOutQuart() {
init(0.165, 0.84, 0.44, 1);
}
}
@@ -1,14 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutQuint extends CubicBezier {
public EaseOutQuint() {
init(0.23, 1, 0.32, 1);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class EaseOutSine extends CubicBezier {
public EaseOutSine() {
init(0.39, 0.575, 0.565, 1);
}
}
@@ -1,70 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public enum EaseType {
EaseInSine(EaseInSine.class),
EaseOutSine(EaseOutSine.class),
EaseInOutSine(EaseInOutSine.class),
EaseInQuad(EaseInQuad.class),
EaseOutQuad(EaseOutQuad.class),
EaseInOutQuad(EaseInOutQuad.class),
EaseInCubic(EaseInCubic.class),
EaseOutCubic(EaseOutCubic.class),
EaseInOutCubic(EaseInOutCubic.class),
EaseInQuart(EaseInQuart.class),
EaseOutQuart(EaseOutQuart.class),
EaseInOutQuart(EaseInOutQuart.class),
EaseInQuint(EaseInQuint.class),
EaseOutQuint(EaseOutQuint.class),
EaseInOutQuint(EaseInOutQuint.class),
EaseInExpo(EaseInExpo.class),
EaseOutExpo(EaseOutExpo.class),
EaseInOutExpo(EaseInOutExpo.class),
EaseInCirc(EaseInCirc.class),
EaseOutCirc(EaseOutCirc.class),
EaseInOutCirc(EaseInOutCirc.class),
EaseInBack(EaseInBack.class),
EaseOutBack(EaseOutBack.class),
EaseInOutBack(EaseInOutBack.class),
EaseInElastic(EaseInElastic.class),
EaseOutElastic(EaseOutElastic.class),
EaseInOutElastic(EaseInOutElastic.class),
EaseInBounce(EaseInBounce.class),
EaseOutBounce(EaseOutBounce.class),
EaseInOutBounce(EaseInOutBounce.class),
Linear(Linear.class);
private Class easingType;
/**
* ease animation helps to make the movement more real
* @param easingType
*/
EaseType(Class easingType) {
this.easingType = easingType;
}
public float getOffset(float offset) {
try {
return ((CubicBezier) easingType.getConstructor().newInstance()).getOffset(offset);
} catch (Exception e) {
e.printStackTrace();
throw new Error("CubicBezier init error.");
}
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.blurlockview.Eases;
/**
* Created by Weiping on 2016/3/3.
*/
public class Linear extends CubicBezier {
public Linear() {
init(0, 0, 1, 1);
}
}
@@ -1,69 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import cpm.com.gskmtorange.R;
/**
* Created by Weiping on 2016/3/17.
*/
public class Indicator extends LinearLayout {
private Dot[] dots;
private int number = 0;
public Indicator(Context context) {
super(context);
}
public Indicator(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setPasswordLength(int length) {
removeAllViews();
dots = new Dot[length];
for(int i = 0; i < length; i++) {
Dot view = new Dot(getContext());
view.setBackgroundResource(R.drawable.indicator_background);
LayoutParams params = new LayoutParams(
30,
30
);
params.setMargins(20, 10, 20, 10);
addView(view, params);
dots[i] = view;
}
}
/**
* Add a dot.
*/
public void add() {
if (number == dots.length) return;
dots[number++].setSelected(true);
}
/**
* Delete a dot.
*/
public void delete() {
if (number == 0) return;
dots[--number].setSelected(false);
}
/**
* Clear all dots.
*/
public void clear() {
number = 0;
for (int i = 0; i < dots.length; i++) dots[i].setSelected(false);
}
}
@@ -1,31 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.view.animation.Interpolator;
import cpm.com.gskmtorange.blurlockview.Eases.EaseType;
/**
* Created by Weiping on 2016/3/17.
*/
public class InterpolatorFactory {
public static BLVInterpolator getInterpolator(EaseType easeType) {
return new BLVInterpolator(easeType);
}
public static class BLVInterpolator implements Interpolator {
private EaseType easeType;
public BLVInterpolator(EaseType easeType) {
this.easeType = easeType;
}
@Override
public float getInterpolation(float input) {
return easeType.getOffset(input);
}
}
}
@@ -1,17 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
/**
* Created by Weiping on 2016/3/17.
*/
public enum Password {
NUMBER(0),
TEXT(1);
private int type;
private Password(int type) {
this.type = type;
}
}
@@ -1,196 +0,0 @@
package cpm.com.gskmtorange.blurlockview;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import cpm.com.gskmtorange.R;
/**
* Created by Weiping on 2016/3/16.
*/
public class SmallButtonView extends FrameLayout {
private FrameLayout frameLayout;
private View clickEffect;
private TextView text;
private String textString = "";
private ObjectAnimator clickEffectAnimator;
private int duration = 500;
private OnPressListener onPressListener;
public SmallButtonView(Context context) {
this(context, null);
}
public SmallButtonView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.small_button_view, this, true);
Resources resources = getResources();
frameLayout = (FrameLayout)findViewById(R.id.frame_layout);
text = (TextView)findViewById(R.id.text);
text.setText(textString);
text.setTextColor(ContextCompat.getColor(context, R.color.default_small_button_text_color));
text.setTextSize(resources.getInteger(R.integer.default_small_button_text_size));
clickEffect = findViewById(R.id.click_effect);
clickEffect.setAlpha(0);
clickEffectAnimator = ObjectAnimator.ofFloat(clickEffect, "alpha", 1f, 0f);
clickEffectAnimator.setDuration(duration);
}
/**
* Set the listener, for returning what happened to BlurLockView.
*
* @param onPressListener OnPressListener.
*/
public void setOnPressListener(OnPressListener onPressListener) {
this.onPressListener = onPressListener;
}
/**
* Set the width of the button.
*
* @param width Width, in pixels.
*/
public void setWidth(int width) {
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
layoutParams.width = width;
frameLayout.setLayoutParams(layoutParams);
layoutParams = clickEffect.getLayoutParams();
layoutParams.width = width;
clickEffect.setLayoutParams(layoutParams);
}
/**
* Set the height of the button.
*
* @param height Height, in pixels.
*/
public void setHeight(int height) {
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
layoutParams.height = height;
frameLayout.setLayoutParams(layoutParams);
layoutParams = clickEffect.getLayoutParams();
layoutParams.height = height;
clickEffect.setLayoutParams(layoutParams);
}
/**
* Set the resource of background.
*
* @param resourceId ResourceId.
*/
public void setBackground(int resourceId) {
frameLayout.setBackgroundResource(resourceId);
}
/**
* Set the resource of click effect.
*
* @param resourceId ResourceId.
*/
public void setEffect(int resourceId) {
clickEffect.setBackgroundResource(resourceId);
}
/**
* Set the duration of the effect.
*
* @param duration Duration, in ms.
*/
public void setEffectDuration(int duration) {
this.duration = duration;
}
/**
* Set the text size of the main text.
*
* @param size Text size, in sp.
*/
public void setTextSize(int size) {
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
}
/**
* Set the text color of main text.
*
* @param color Color.
*/
public void setTextColor(int color) {
text.setTextColor(color);
}
/**
* Set font of button.
*
* @param typeFace New font.
*/
public void setTypeFace(Typeface typeFace) {
text.setTypeface(typeFace);
}
/**
* Set the string of the text.
*
* @param textString The new string.
*/
public void setText(String textString) {
this.textString = textString;
if (text != null) text.setText(textString);
}
/**
* Perform the click effect.
*
* @param event MotionEvent.
* @return
*/
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
if (onPressListener != null) onPressListener.onPress(textString);
clickEffectAnimator.cancel();
clickEffect.setAlpha(1);
break;
case MotionEvent.ACTION_UP:
clickEffectAnimator.start();
break;
default:break;
}
return super.dispatchTouchEvent(event);
}
/**
* Clear the animation.
*/
public void clearAnimation() {
if (clickEffect.getAlpha() == 1) {
clickEffectAnimator.cancel();
clickEffectAnimator.start();
}
}
public interface OnPressListener {
void onPress(String string);
}
}
@@ -1,13 +0,0 @@
package cpm.com.gskmtorange.comparators;
import java.util.Comparator;
import cpm.com.gskmtorange.GetterSetter.StoreBean;
public class StatusCompare implements Comparator<StoreBean> {
@Override
public int compare(StoreBean o1, StoreBean o2) {
return o1.getUPLOAD_STATUS().compareTo(o2.getUPLOAD_STATUS());
}
}
@@ -1,217 +0,0 @@
package cpm.com.gskmtorange.constant;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.preference.PreferenceManager;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
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;
if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ENGLISH)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ENGLISH;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KSA)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_TURKISH)) {
lang = CommonString.KEY_RETURE_LANGUAGE_TURKISH;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)) {
lang = CommonString.KEY_RETURE_LANGUAGE_UAE_ARABIC;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_OMAN)) {
lang = CommonString.KEY_RETURE_LANGUAGE_OMAN;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_EGYPT)) {
lang = CommonString.KEY_RETURN_LANGUAGE_EGYPT;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_JORDAN)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KUWAIT)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_BAHRAIN)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
} else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_OMAN)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
}
else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_QATAR)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
}
else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LIBIYA)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
}
else if (language.equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LEBANON)) {
lang = CommonString.KEY_RETURE_LANGUAGE_ARABIC_KSA;
}
else {
lang = CommonString.KEY_RETURN_LANGUAGE_DEFAULT;
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
public static String getCurrentTimeWithLanguage(Context context) {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Calendar m_cal = Calendar.getInstance();
String cdate = formatter.format(m_cal.getTime());
//SharedPreferences preferences = preferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KSA)
////aDDED NEW COUNTRY FOR TIME BY JP
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KUWAIT)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_BAHRAIN)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_OMAN)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_QATAR)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LEBANON)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_LIBIYA)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_JORDAN)
|| preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_EGYPT)) {
cdate = arabicToenglish(cdate);
}
return cdate;
}
private static String arabicToenglish(String number) {
char[] chars = new char[number.length()];
for (int i = 0; i < number.length(); i++) {
char ch = number.charAt(i);
if (ch >= 0x0660 && ch <= 0x0669)
ch -= 0x0660 - '0';
else if (ch >= 0x06f0 && ch <= 0x06F9)
ch -= 0x06f0 - '0';
chars[i] = ch;
}
return new String(chars);
}
/* private static String arabicToenglish(String number) {
String abc ="";
try {
abc = new String(number.getBytes("UTF-8"), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
char[] chars = new char[abc.length()];
for (int i = 0; i < abc.length(); i++) {
char ch = abc.charAt(i);
if (ch >= 0x0660 && ch <= 0x0669)
ch -= 0x0660 - '0';
else if (ch >= 0x06f0 && ch <= 0x06F9)
ch -= 0x06f0 - '0';
chars[i] = ch;
}
return new String(chars);
}*/
public static void setScaledImage(ImageView imageView, final String path) {
final ImageView iv = imageView;
ViewTreeObserver viewTreeObserver = iv.getViewTreeObserver();
viewTreeObserver.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
iv.getViewTreeObserver().removeOnPreDrawListener(this);
int imageViewHeight = iv.getMeasuredHeight();
int imageViewWidth = iv.getMeasuredWidth();
iv.setImageBitmap(decodeSampledBitmapFromPath(path, imageViewWidth, imageViewHeight));
return true;
}
});
}
private static Bitmap decodeSampledBitmapFromPath(String path, int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds = true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
//BitmapFactory.decodeResource(res, resId, options);
BitmapFactory.decodeFile(path, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(path, options);
}
private static int calculateInSampleSize(
BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
while ((halfHeight / inSampleSize) > reqHeight
&& (halfWidth / inSampleSize) > reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
public static void showAlertDialog(final Context context, String msg) {
final DialogCallbackListener[] mListener = new DialogCallbackListener[1];
try {
// Instantiate the NoticeDialogListener so we can send events to the host
mListener[0] = (DialogCallbackListener) context;
} catch (ClassCastException e) {
Activity activity = (Activity) context;
// The activity doesn't implement the interface, throw exception
throw new ClassCastException(activity.getClass() + " must implement DialogCallbackListener");
}
final boolean[] flag = new boolean[1];
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setTitle(context.getResources().getString(R.string.dialog_title));
// set dialog message
alertDialogBuilder.setMessage(msg)
.setCancelable(false)
.setPositiveButton(context.getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener[0].onSelect(true);
dialog.cancel();
}
})
.setNegativeButton(context.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
mListener[0].onSelect(false);
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
}
File diff suppressed because it is too large Load Diff
@@ -1,902 +0,0 @@
package cpm.com.gskmtorange.dailyentry;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.text.method.DigitsKeyListener;
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.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
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.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.PromoComplianceSkuwiseGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SelectGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
private Context context;
GSKOrangeDB db;
String store_id, visit_date, username, intime, date;
String categoryName, categoryId;
String sub_category = "", sub_category_id = "0", brand = "", brand_id = "0", sku = "", sku_id = "0", discount = "", price = "", _pathforcheck = "", _path = "", img_str = "", country_id;
private SharedPreferences preferences;
Spinner spinner_sub_category_list, spinner_brand_list, spinner_sku_list, sp_flasher;
ArrayList<MSL_AvailabilityStockFacingGetterSetter> sub_category_list;
ArrayList<BrandMasterGetterSetter> brand_list = new ArrayList<>();
ArrayList<SkuMasterGetterSetter> sku_list = new ArrayList<>();
Toolbar toolbar;
FloatingActionButton fab_save, fab_add;
ArrayList<PromoComplianceSkuwiseGetterSetter> exists_data = new ArrayList<>();
ArrayList<PromoComplianceSkuwiseGetterSetter> added_promo_list = new ArrayList<>();
RecyclerView rec_added_promo;
EditText et_discount, et_price;
String gallery_package = "";
Uri outputFileUri;
ImageView img_cam;
boolean isdata_added = false, isExists = true, is_camera_compulsory = false;
LinearLayout lin_parent;
PromoAdapter promoAdapter;
int price_flasher_available = -1;
ToggleButton btntoggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_additional_promo_skuwise);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(getResources().getString(R.string.title_activity_promo_compliance));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
spinner_sub_category_list = (Spinner) findViewById(R.id.sp_sub_category);
spinner_brand_list = (Spinner) findViewById(R.id.sp_brand);
spinner_sku_list = (Spinner) findViewById(R.id.sp_sku);
sp_flasher = (Spinner) findViewById(R.id.sp_flasher);
fab_save = (FloatingActionButton) findViewById(R.id.fab);
fab_add = (FloatingActionButton) findViewById(R.id.fab_add);
rec_added_promo = (RecyclerView) findViewById(R.id.rec_added_promo_skuwise);
et_discount = (EditText) findViewById(R.id.et_discount);
et_price = (EditText) findViewById(R.id.et_price);
img_cam = (ImageView) findViewById(R.id.img_promotion_add);
lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo);
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
et_price.setKeyListener(DigitsKeyListener.getInstance(false, true));
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
db = new GSKOrangeDB(AdditionalPromoSKUwiseActivity.this);
db.open();
//Enable camera compulsory According to Configuration
ArrayList<ConfigurationMasterGetterSetter> configurationData = db.getConfigurationMasterData(country_id);
if (configurationData.size() > 0) {
for (int i = 0; i < configurationData.size(); i++) {
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("ADDITIONAL_PROMO_SKUWISE_IMAGE_MANDATORY") && configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
is_camera_compulsory = true;
}
}
}
if (is_camera_compulsory) {
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
}
//Promo SKU List
exists_data = db.getPromoComplianceSkuwiseExistsAfterData(store_id, categoryId);
if (exists_data.size() > 0) {
isExists = exists_data.get(0).isExists();
if (exists_data.get(0).isExists()) {
added_promo_list = db.getPromoComplianceSkuwiseAfterData(store_id, categoryId);
} else {
fab_add.hide();//.setVisibility(View.GONE);
added_promo_list.clear();
if (promoAdapter != null) {
promoAdapter.list.clear();
promoAdapter.notifyDataSetChanged();
}
lin_parent.setVisibility(View.GONE);
}
}
btntoggle.setChecked(isExists);
if (added_promo_list.size() > 0) {
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter);
}
sub_category_list = db.getSubCategoryMasterSKUwise(categoryId);
MSL_AvailabilityStockFacingGetterSetter sub_category = new MSL_AvailabilityStockFacingGetterSetter();
String str = getResources().getString(R.string.select);
sub_category.setSub_category(str);
sub_category_list.add(0, sub_category);
CustomSubCategoryAdapter adapter = new CustomSubCategoryAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_spinner_item, sub_category_list);
spinner_sub_category_list.setAdapter(adapter);
spinner_sub_category_list.setOnItemSelectedListener(this);
ArrayList<SelectGetterSetter> ans_list = new ArrayList<>();
SelectGetterSetter select = new SelectGetterSetter();
select.setAns(getString(R.string.select));
select.setAns_id(0);
ans_list.clear();
ans_list.add(select);
select = new SelectGetterSetter();
select.setAns(getString(R.string.yes));
select.setAns_id(1);
ans_list.add(select);
select = new SelectGetterSetter();
select.setAns(getString(R.string.no));
select.setAns_id(2);
ans_list.add(select);
CustomSpinnerAdapter ansAdapter = new CustomSpinnerAdapter(AdditionalPromoSKUwiseActivity.this, R.layout.custom_t2p_spinner_item, ans_list);
sp_flasher.setAdapter(ansAdapter);
sp_flasher.setOnItemSelectedListener(this);
fab_add.setOnClickListener(this);
fab_save.setOnClickListener(this);
img_cam.setOnClickListener(this);
btntoggle.setOnClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
toolbar.setTitle(getResources().getString(R.string.title_activity_promo_compliance));
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
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();
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);
spinner_brand_list.setAdapter(adapter);
spinner_brand_list.setOnItemSelectedListener(this);
} else {
clearBrandSpinner();
}
} else if (parent.getId() == R.id.sp_brand) {
if (position != 0) {
brand = brand_list.get(position).getBRAND().get(0);
brand_id = brand_list.get(position).getBRAND_ID().get(0);
sku_list = db.getSKUMasterNewData(brand_id);
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);
spinner_sku_list.setAdapter(adapter);
spinner_sku_list.setOnItemSelectedListener(this);
} else {
clearSkuSpinner();
}
} else if (parent.getId() == 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);
}
} else if (parent.getId() == R.id.sp_flasher) {
if (position == 0) {
price_flasher_available = -1;
} else if (position == 1) {
price_flasher_available = 1;
} else if (position == 2) {
price_flasher_available = 0;
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
void clearBrandSpinner() {
brand_list.clear();
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);
spinner_brand_list.setAdapter(adapter);
spinner_brand_list.setOnItemSelectedListener(this);
}
void clearSkuSpinner() {
sku_list.clear();
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);
spinner_sku_list.setAdapter(adapter);
spinner_sku_list.setOnItemSelectedListener(this);
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.fab) {
boolean valid_flag = true;
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);
}
isdata_added = true;
}
} else if (id == 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);
} else if (id == R.id.btntoggle) {
isExists = btntoggle.isChecked();
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();
rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter);
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) {
btntoggle.setChecked(true);
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
}
}
}
private void startCameraActivity(int pos) {
try {
Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
/* Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);*/
//temp value in case camera is gallery app above jellybean
String packag = list.get(n).loadLabel(packageManager).toString();
if (packag.equalsIgnoreCase("Gallery") || packag.equalsIgnoreCase("Galeri") || packag.equalsIgnoreCase("الاستوديو")) {
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
//startActivityForResult(intent, 1);
startActivityForResult(intent, pos);
//startActivityForResult(intent, position);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
//startActivityForResult(intent, 0);
startActivityForResult(intent, pos);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(CommonString.getImagesFolder(context) + _pathforcheck).exists()) {
img_cam.setBackgroundResource(R.mipmap.camera_green);
img_str = _pathforcheck;
_pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
public class CustomBrandAdapter extends ArrayAdapter<String> {
private Activity activity;
private ArrayList data;
BrandMasterGetterSetter tempValues = null;
LayoutInflater inflater;
/*************
* CustomBrandAdapter Constructor
*****************/
public CustomBrandAdapter(AdditionalPromoSKUwiseActivity 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 = (BrandMasterGetterSetter) 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.getBRAND().get(0));
}
return row;
}
}
public class CustomSkuAdapter extends ArrayAdapter<String> {
private Activity activity;
private ArrayList data;
SkuMasterGetterSetter tempValues = null;
LayoutInflater inflater;
/*************
* CustomSkuAdapter Constructor
*****************/
public CustomSkuAdapter(AdditionalPromoSKUwiseActivity 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 = (SkuMasterGetterSetter) 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().get(0));
}
return row;
}
}
public class CustomSubCategoryAdapter extends ArrayAdapter<String> {
private Activity activity;
private ArrayList data;
MSL_AvailabilityStockFacingGetterSetter tempValues = null;
LayoutInflater inflater;
/*************
* CustomSubCategoryAdapter Constructor
*****************/
public CustomSubCategoryAdapter(AdditionalPromoSKUwiseActivity 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 PromoAdapter extends RecyclerView.Adapter<PromoAdapter.ViewHolder> {
private ArrayList<PromoComplianceSkuwiseGetterSetter> list;
public PromoAdapter(ArrayList<PromoComplianceSkuwiseGetterSetter> promoList) {
list = promoList;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_added_promo, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final PromoComplianceSkuwiseGetterSetter mItem = list.get(position);
holder.tv_sub_category.setText(getString(R.string.sub_category) + " - " + mItem.getSub_category());
holder.tv_brand.setText(getString(R.string.brand) + " - " + mItem.getBrand());
holder.tv_sku.setText(getString(R.string.sku) + " - " + mItem.getSku());
holder.tv_discount_val.setText(getString(R.string.discount_value) + " - " + mItem.getDiscount_value());
holder.tv_price.setText(getString(R.string.price) + " - " + mItem.getPrice());
String exists = "";
if (mItem.getPrice_flasher() == 1) {
exists = getString(R.string.yes);
} else {
exists = getString(R.string.no);
}
holder.tv_promo_flasher_exists.setText(" - " + exists);
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView tv_sub_category, tv_brand, tv_sku, tv_discount_val, tv_price, tv_promo_flasher_exists;
public ViewHolder(View view) {
super(view);
mView = view;
tv_sub_category = (TextView) mView.findViewById(R.id.tv_sub_category);
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
tv_sku = (TextView) mView.findViewById(R.id.tv_sku);
tv_discount_val = (TextView) mView.findViewById(R.id.tv_discount);
tv_price = (TextView) mView.findViewById(R.id.tv_price);
tv_promo_flasher_exists = (TextView) mView.findViewById(R.id.tv_promo_flasher_exists);
}
}
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
ischanged();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
ischanged();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
void ischanged() {
if (isdata_added) {
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) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
} else {
super.onBackPressed();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}
public class CustomSpinnerAdapter extends ArrayAdapter<String> {
SelectGetterSetter tempValues = null;
LayoutInflater inflater;
private Activity activity;
private ArrayList data;
/*************
* CustomAdapter Constructor
*****************/
public CustomSpinnerAdapter(AdditionalPromoSKUwiseActivity 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 = (SelectGetterSetter) data.get(position);
TextView label = (TextView) row.findViewById(R.id.tv_text);
if (position == 0) {
// Default selected Spinner item
label.setText(getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
label.setText(tempValues.getAns());
}
return row;
}
}
}
@@ -1,802 +0,0 @@
package cpm.com.gskmtorange.dailyentry;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.text.InputFilter;
import android.text.InputType;
import android.text.Spanned;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
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 com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.AdditionalQuestiongetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class AuditActivity extends AppCompatActivity {
private Context context;
List<Integer> checkHeaderArray = new ArrayList<>();
boolean checkflag = true;
private SharedPreferences preferences;
String categoryName, categoryId, Error_Message = "", pathforcheck = "", _path = "", str, img_str = "", img_str2 = "";
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, store_flag_str, country_id = "";
GSKOrangeDB db;
ArrayList<AuditDataGetterSetter> question_list = new ArrayList<>(), childListData;
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> hashMapAnsListChildData;
AnswerAdapter questionAdapter;
RecyclerView recyclerView;
Uri outputFileUri;
String gallery_package = "";
int child_position = -1;
String error_msg = "";
Toolbar toolbar;
LinearLayout no_data_lay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audit);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
no_data_lay = (LinearLayout) findViewById(R.id.no_data_lay);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null);
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
toolbar.setTitle(getResources().getString(R.string.audit));
str = CommonString.getImagesFolder(context);
recyclerView = (RecyclerView) findViewById(R.id.list);
db = new GSKOrangeDB(this);
db.open();
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
//Header
question_list = db.getAfterSaveAuditQuestionAnswerData(store_id, categoryId);
if (question_list.size() == 0) {
question_list = getAuditQnsRemoved();
}
hashMapAnsListChildData = new HashMap<>();
childListData = new ArrayList<>();
if (question_list.size() > 0) {
String select = getString(R.string.title_activity_select_dropdown);
// Adding child data
for (int i = 0; i < question_list.size(); i++) {
childListData = db.getAuditAnswerData(question_list.get(i).getQUESTION_ID(), categoryId, storeType_id, select);
ArrayList<AuditDataGetterSetter> answerList = new ArrayList<>();
for (int j = 0; j < childListData.size(); j++) {
answerList.add(childListData.get(j));
}
hashMapAnsListChildData.put(question_list.get(i), answerList); // Header, Child data
}
questionAdapter = new AnswerAdapter(question_list, hashMapAnsListChildData);
recyclerView.setAdapter(questionAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
} else {
no_data_lay.setVisibility(View.VISIBLE);
fab.hide();//setVisibility(View.GONE);
recyclerView.setVisibility(View.GONE);
}
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener()
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
{
if (dy > 0 && fab.isShown())
{
fab.hide();
}
if (dy < 0 && !fab.isShown())
{
fab.show();
}
}
/* @Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState)
{
if (newState == RecyclerView.SCROLL_STATE_IDLE)
{
fab.show();
}
super.onScrollStateChanged(recyclerView, newState);
}*/
});
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (question_list.size() > 0) {
recyclerView.clearFocus();
if (validateData(question_list)) {
db.saveAuditQuestionAnswerData(question_list, store_id, categoryId);
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
} else {
questionAdapter.notifyDataSetChanged();
Snackbar.make(recyclerView, error_msg, Snackbar.LENGTH_SHORT).show();
}
} else {
Snackbar.make(recyclerView, getString(R.string.NodataAvailable), Snackbar.LENGTH_SHORT).show();
}
}
});
}
ArrayList<AuditDataGetterSetter> getAuditQnsRemoved() {
boolean t2p_flag = false;
boolean flag_t2p_mapping;
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
} 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;
break;
}
}
}
}
if (!t2p_flag) {
if (db.additionalVisibilitydata(store_id, categoryId)) {
ArrayList<AddittionalGetterSetter> additionalList = db.getAdditionalMainStock(store_id, categoryId);
for (int i = 0; i < additionalList.size(); i++) {
if (additionalList.get(i).getBtn_toogle().equals("1")) {
t2p_flag = true;
break;
}
}
}
}
ArrayList<AuditDataGetterSetter> question_list = db.getAuditCategoryWise(categoryId, storeType_id);
Iterator<AuditDataGetterSetter> iterator = question_list.iterator();
while (iterator.hasNext()) {
AuditDataGetterSetter item = iterator.next(); // must be called before you can call iterator.remove()
// Check condition
if (!item.getKEYACCOUNT_ID().equals("0") && !item.getKEYACCOUNT_ID().equals(keyAccount_id)) {
iterator.remove();
} else if (!item.getCHECK_TYPE().equals("NA") && item.getCHECK_TYPE().equals("T2P")) {
if (!t2p_flag) {
iterator.remove();
}
}
}
return question_list;
}
@Override
protected void onResume() {
super.onResume();
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.audit));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
if (question_list.size() > 0) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AuditActivity.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) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
} else {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
if (question_list.size() > 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(AuditActivity.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) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
})
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}
public class DecimalDigitsInputFilter implements InputFilter {
Pattern mPattern;
public DecimalDigitsInputFilter(int digitsBeforeZero, int digitsAfterZero) {
mPattern = Pattern.compile("[0-9]{0," + (digitsBeforeZero - 1) + "}+((\\.[0-9]{0," + (digitsAfterZero - 1) + "})?)||(\\.)?");
}
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
Matcher matcher = mPattern.matcher(dest);
if (!matcher.matches())
return "";
return null;
}
}
class AnswerAdapter extends RecyclerView.Adapter<AnswerAdapter.ViewHolder> {
ArrayList<AuditDataGetterSetter> questionList;
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> answerHashMap;
public AnswerAdapter(ArrayList<AuditDataGetterSetter> questionList,
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> answerHashMap) {
this.questionList = questionList;
this.answerHashMap = answerHashMap;
}
public AnswerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.audit_question_list_item, parent, false);
return new ViewHolder(view);
}
public void onBindViewHolder(final AnswerAdapter.ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
holder.data = questionList.get(position);
holder.txt_question.setText(holder.data.getQUESTION());
holder.txt_question.setId(position);
// Log.e("mandate_data",holder.data.getCAMERA_ALLOW()+","+holder.data.getCAMERA_MANDATORY() + "," + holder.data.getQUESTION_ID());
ArrayList<AuditDataGetterSetter> ans_list = answerHashMap.get(holder.data);
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown")) {
holder.sp_auditAnswer.setVisibility(View.VISIBLE);
holder.sp_auditAnswer.setId(position);
holder.edt_answer.setVisibility(View.GONE);
holder.edt_answer.setId(position);
}
else if (holder.data.getANSWER_TYPE().equalsIgnoreCase("TEXTBOX")) {
int maxLength = Integer.parseInt(holder.data.getMaxlength());
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(maxLength);
holder.edt_answer.setFilters(fArray);
holder.edt_answer.setInputType(InputType.TYPE_CLASS_TEXT);
holder.edt_answer.setVisibility(View.VISIBLE);
holder.edt_answer.setId(position);
if (country_id.equals("4")) {
holder.edt_answer.setHint(R.string.pls_fill_stock_count);
holder.edt_answer.setId(position);
}
holder.sp_auditAnswer.setVisibility(View.GONE);
holder.sp_auditAnswer.setId(position);
} else if (holder.data.getANSWER_TYPE().equalsIgnoreCase("DECIMAL")) {
int maxLength = Integer.parseInt(holder.data.getMaxlength());
holder.edt_answer.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
holder.edt_answer.setFilters(new InputFilter[]{new DecimalDigitsInputFilter(maxLength, 2)});
holder.edt_answer.setVisibility(View.VISIBLE);
holder.edt_answer.setId(position);
if (country_id.equals("4")) {
holder.edt_answer.setHint(R.string.pls_fill_stock_count);
}
holder.sp_auditAnswer.setVisibility(View.GONE);
holder.sp_auditAnswer.setId(position);
} else if (holder.data.getANSWER_TYPE().equalsIgnoreCase("NUMBER")) {
int maxLength = Integer.parseInt(holder.data.getMaxlength());
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(maxLength);
holder.edt_answer.setFilters(fArray);
holder.edt_answer.setInputType(InputType.TYPE_CLASS_NUMBER);
holder.edt_answer.setVisibility(View.VISIBLE);
holder.edt_answer.setId(position);
if (country_id.equals("4")) {
holder.edt_answer.setHint(R.string.pls_fill_stock_count);
}
holder.sp_auditAnswer.setVisibility(View.GONE);
holder.sp_auditAnswer.setId(position);
}
if (holder.data.getCAMERA_ALLOW().equals("1")) {
holder.parent_cam_layout.setVisibility(View.VISIBLE);
holder.parent_cam_layout.setId(position);
} else {
holder.parent_cam_layout.setVisibility(View.GONE);
holder.parent_cam_layout.setId(position);
}
//text
if (holder.data.getREMARK_ALLOW().equals("1")) {
holder.edt_text.setVisibility(View.VISIBLE);
holder.edt_text.setId(position);
holder.txt_leval.setVisibility(View.VISIBLE);
holder.txt_leval.setText(holder.data.getREMARK_LEVEL());
holder.txt_leval.setId(position);
} else {
holder.edt_text.setVisibility(View.GONE);
holder.edt_text.setId(position);
holder.txt_leval.setVisibility(View.GONE);
holder.txt_leval.setId(position);
}
holder.sp_auditAnswer.setAdapter(new AnswerSpinnerAdapter(AuditActivity.this, R.layout.custom_spinner_item, ans_list));
final ArrayList<AuditDataGetterSetter> finalAns_list = ans_list;
holder.sp_auditAnswer.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
AuditDataGetterSetter ans = finalAns_list.get(position);
holder.data.setANSWER_ID(ans.getANSWER_ID());
holder.data.setANSWER(ans.getANSWER());
holder.data.setCAMERA_ALLOW(ans.getCAMERA_ALLOW());
holder.data.setREMARK_ALLOW(ans.getREMARK_ALLOW());
holder.data.setREMARK_LEVEL(ans.getREMARK_LEVEL());
holder.data.setCAMERA_MANDATORY(ans.getCAMERA_MANDATORY());
Log.e("mandate_data",holder.data.getCAMERA_ALLOW() + ","+ holder.data.getCAMERA_MANDATORY());
//text
if (holder.data.getREMARK_ALLOW().equals("1")) {
holder.edt_text.setVisibility(View.VISIBLE);
holder.txt_leval.setVisibility(View.VISIBLE);
holder.txt_leval.setText(holder.data.getREMARK_LEVEL());
} else {
holder.edt_text.setVisibility(View.GONE);
holder.txt_leval.setVisibility(View.GONE);
holder.data.setTXT_REMARK("");
}
if (holder.data.getCAMERA_ALLOW().equals("1")) {
holder.parent_cam_layout.setVisibility(View.VISIBLE);
if (ans.getNO_OF_CAMERA().equals("2")) {
holder.img_cam2.setVisibility(View.VISIBLE);
} else {
holder.img_cam2.setVisibility(View.GONE);
}
} else {
holder.parent_cam_layout.setVisibility(View.GONE);
if (holder.data.getCAM_IMAGE() != null && holder.data.getCAM_IMAGE().equals("")) {
if (new File(str + holder.data.getCAM_IMAGE()).exists()) {
new File(str + holder.data.getCAM_IMAGE()).delete();
}
}
if (holder.data.getCAM_IMAGE2() != null && holder.data.getCAM_IMAGE2().equals("")) {
if (new File(str + holder.data.getCAM_IMAGE2()).exists()) {
new File(str + holder.data.getCAM_IMAGE2()).delete();
}
}
holder.data.setCAM_IMAGE("");
holder.data.setCAM_IMAGE2("");
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
holder.img_cam2.setBackgroundResource(R.mipmap.camera_orange);
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
holder.img_cam.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pathforcheck = store_id + "AuditAnsPic" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context)+ pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position;
startCameraActivity(0);
}
});
holder.img_cam2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pathforcheck = store_id + "AuditAnsPic2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context)+ pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position;
startCameraActivity(1);
}
});
holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("NUMBER")) {
holder.data.setANSWER_ID("0");
holder.data.setANSWER(((EditText) v).getText().toString().replaceFirst("^0+.(?!$)", ""));
} else {
holder.data.setANSWER_ID("0");
holder.data.setANSWER(((EditText) v).getText().toString().replaceAll("[&^<>{}'$]", ""));
}
}
}
});
//set remark
holder.edt_text.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
holder.data.setTXT_REMARK(((EditText) v).getText().toString().replaceAll("[&^<>{}'$]", ""));
}
}
});
for (int i = 0; i < ans_list.size(); i++) {
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown")
&& ans_list.get(i).getANSWER_ID().equals(holder.data.getANSWER_ID())) {
holder.sp_auditAnswer.setSelection(i);
break;
}
}
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("TEXTBOX")
|| holder.data.getANSWER_TYPE().equalsIgnoreCase("DECIMAL")
|| holder.data.getANSWER_TYPE().equalsIgnoreCase("NUMBER")) {
holder.edt_answer.setText(holder.data.getANSWER());
holder.edt_answer.setId(position);
}
//set text
if (holder.data.getREMARK_ALLOW().equalsIgnoreCase("1")) {
holder.edt_text.setText(holder.data.getTXT_REMARK());
holder.edt_text.setId(position);
}
if (!img_str.equals("")) {
if (child_position == position) {
holder.data.setCAM_IMAGE(img_str);
img_str = "";
child_position = -1;
}
}
if (!img_str2.equals("")) {
if (child_position == position) {
holder.data.setCAM_IMAGE2(img_str2);
img_str2 = "";
child_position = -1;
}
}
if (holder.data.getCAM_IMAGE().equals("")) {
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
holder.img_cam.setId(position);
} else {
holder.img_cam.setBackgroundResource(R.mipmap.camera_green);
holder.img_cam.setId(position);
}
if (holder.data.getCAM_IMAGE2().equals("")) {
holder.img_cam2.setBackgroundResource(R.mipmap.camera_orange);
holder.img_cam2.setId(position);
} else {
holder.img_cam2.setBackgroundResource(R.mipmap.camera_green);
holder.img_cam2.setId(position);
}
if (!checkflag) {
if (checkHeaderArray.contains(position)) {
holder.card_view.setBackgroundColor(getResources().getColor(R.color.red));
holder.card_view.setId(position);
} else {
holder.card_view.setBackgroundColor(getResources().getColor(R.color.white));
holder.card_view.setId(position);
}
}
}
@Override
public int getItemCount() {
return questionList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView txt_question, txt_leval;
public final Spinner sp_auditAnswer;
public final EditText edt_answer, edt_text;
public final ImageView img_cam, img_cam2;
public final RelativeLayout parent_cam_layout;
CardView card_view;
AuditDataGetterSetter data;
public ViewHolder(View view) {
super(view);
mView = view;
txt_leval = (TextView) view.findViewById(R.id.txt_leval);
txt_question = (TextView) view.findViewById(R.id.txt_question);
sp_auditAnswer = (Spinner) view.findViewById(R.id.sp_auditAnswer);
card_view = (CardView) view.findViewById(R.id.card_view);
edt_text = (EditText) view.findViewById(R.id.edt_text);
edt_answer = (EditText) view.findViewById(R.id.edt_answer);
img_cam = (ImageView) view.findViewById(R.id.img_cam);
img_cam2 = (ImageView) view.findViewById(R.id.img_cam2);
parent_cam_layout = (RelativeLayout) view.findViewById(R.id.parent_cam_layout);
}
}
}
public class AnswerSpinnerAdapter extends ArrayAdapter<AuditDataGetterSetter> {
List<AuditDataGetterSetter> list;
Context context;
int resourceId;
public AnswerSpinnerAdapter(Context context, int resourceId, ArrayList<AuditDataGetterSetter> list) {
super(context, resourceId, list);
this.context = context;
this.list = list;
this.resourceId = resourceId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
view = inflater.inflate(resourceId, parent, false);
AuditDataGetterSetter cm = list.get(position);
TextView txt_spinner = (TextView) view.findViewById(R.id.tv_text);
txt_spinner.setText(list.get(position).getANSWER());
return view;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view = convertView;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
view = inflater.inflate(resourceId, parent, false);
AuditDataGetterSetter cm = list.get(position);
TextView txt_spinner = (TextView) view.findViewById(R.id.tv_text);
txt_spinner.setText(cm.getANSWER());
return view;
}
}
boolean validateData(ArrayList<AuditDataGetterSetter> data) {
//boolean flag = true;
checkHeaderArray.clear();
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getANSWER_TYPE().equalsIgnoreCase("TEXTBOX") && data.get(i).getANSWER().equalsIgnoreCase("")
|| data.get(i).getANSWER_TYPE().equalsIgnoreCase("DECIMAL") && data.get(i).getANSWER().equalsIgnoreCase("")
|| data.get(i).getANSWER_TYPE().equalsIgnoreCase("NUMBER") && data.get(i).getANSWER().equalsIgnoreCase("")) {
error_msg = getString(R.string.pls_answer_all_qns);
checkflag = false;
} else if (data.get(i).getANSWER_TYPE().equalsIgnoreCase("DROPDOWN") && data.get(i).getANSWER_ID().equalsIgnoreCase("0")) {
error_msg = getString(R.string.pls_answer_all_qns);
checkflag = false;
} else if (data.get(i).getCAMERA_ALLOW().equals("1") && data.get(i).getCAMERA_MANDATORY().equals("1") && data.get(i).getCAM_IMAGE().equals("")) {
error_msg = getString(R.string.click_image);
checkflag = false;
} else if (data.get(i).getCAMERA_ALLOW().equals("1") && data.get(i).getCAMERA_MANDATORY().equals("1")
&& data.get(i).getNO_OF_CAMERA().equals("2") && data.get(i).getCAM_IMAGE2().equals("")) {
error_msg = getString(R.string.click_image);
checkflag = false;
//text
} else if (data.get(i).getREMARK_ALLOW().equals("1") && data.get(i).getTXT_REMARK().equals("")) {
error_msg = getString(R.string.pleaseenterRemarks);
checkflag = false;
} else {
checkflag = true;
}
if (checkflag == false) {
if (!checkHeaderArray.contains(i)) {
checkHeaderArray.add(i);
}
break;
}
}
return checkflag;
}
protected void startCameraActivity(int code) {
try {
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
//temp value in case camera is gallery app above jellybean
String packag = list.get(n).loadLabel(packageManager).toString();
if (packag.equalsIgnoreCase("Gallery") || packag.equalsIgnoreCase("Galeri") || packag.equalsIgnoreCase("الاستوديو")) {
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
//com.android.gallery3d
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, code);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
startActivityForResult(intent, code);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (pathforcheck != null && !pathforcheck.equals("")) {
if (new File(str + pathforcheck).exists()) {
if (requestCode == 0) {
img_str = pathforcheck;
} else {
img_str2 = pathforcheck;
}
pathforcheck = "";
questionAdapter.notifyDataSetChanged();
}
}
}
}
}
@@ -1,643 +0,0 @@
package cpm.com.gskmtorange.dailyentry;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Random;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryImagesAllowed;
public class CategoryPicture extends AppCompatActivity {
private Context context;
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId;
ImageView im1, im2, im3, im4;
ListView listview;
String store_id, date, intime, img_str1 = "", img_str2 = "", img_str3 = "", img_str4 = "", togglevalue = "1", CATEGORY_ID, camera_allow, store_type_id, class_id, key_account_id, country_id, store_flag_str;
private SharedPreferences preferences;
Uri outputFileUri;
String gallery_package = "";
GSKOrangeDB db;
ArrayList<CategoryPictureGetterSetter> adddata = new ArrayList<CategoryPictureGetterSetter>();
int Adapterposition;
ArrayList<CategoryPictureGetterSetter> listdat = new ArrayList<CategoryPictureGetterSetter>();
CategoryAdapter adapteradditional;
Toolbar toolbar;
ArrayList<CategoryImagesAllowed> categoryImagesAllowed = new ArrayList<>();
boolean editFlag = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_picture);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
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);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
date = preferences.getString(CommonString.KEY_DATE, null);
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
str = CommonString.getImagesFolder(context);
db = new GSKOrangeDB(CategoryPicture.this);
db.open();
im1 = (ImageView) findViewById(R.id.image1);
im2 = (ImageView) findViewById(R.id.image2);
im3 = (ImageView) findViewById(R.id.image3);
im4 = (ImageView) findViewById(R.id.image4);
listview = (ListView) findViewById(R.id.listview);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
adddata = db.getCategoryPictureData(store_id, categoryId);
categoryImagesAllowed = db.getCategoryPictureAllowedData(categoryId);
if (categoryImagesAllowed.size() > 0) {
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam1(), im1);
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im2);
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im3);
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam3(), im4);
}
if (adddata.size() != 0) {
String key_id = adddata.get(0).getKEY_ID();
listdat = db.getCategoryPictureListData(store_id, categoryId, key_id);
String image1 = adddata.get(0).getCategoryImage1();
String image2 = adddata.get(0).getCategoryImage2();
String image3 = adddata.get(0).getCategoryImage3();
String image4 = adddata.get(0).getCategoryImage4();
if (image1 != null && !image1.equals("")) {
im1.setImageResource(R.mipmap.camera_green);
img_str1 = image1;
}
if (image2 != null && !image2.equals("")) {
im2.setImageResource(R.mipmap.camera_green);
img_str2 = image2;
}
if (image3 != null && !image3.equals("")) {
im3.setImageResource(R.mipmap.camera_green);
img_str3 = image3;
}
if (image4 != null && !image4.equals("")) {
im4.setImageResource(R.mipmap.camera_green);
img_str4 = image4;
}
} else {
if (country_id.equals("7")||country_id.equals("8") ||country_id.equals("11")|| country_id.equals("17")) {
listdat = db.getCategoryPicturedata(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
listdat = db.getCategoryPicturedata(categoryId, key_account_id, store_type_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
} else {
listdat = db.getCategoryPicturedata(categoryId, key_account_id, store_type_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
}
}
adapteradditional = new CategoryPicture.CategoryAdapter(CategoryPicture.this, listdat);
listview.setAdapter(adapteradditional);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
final CategoryPictureGetterSetter CP = new CategoryPictureGetterSetter();
CP.setCategoryImage1(img_str1);
CP.setCategoryImage2(img_str2);
CP.setCategoryImage3(img_str3);
CP.setCategoryImage4(img_str4);
CP.setStore_ID(store_id);
CP.setCamera_allow(camera_allow);
if (validateData(CP, listdat)) {
db.open();
db.InsertCategoryPictureData(CP, listdat, categoryId);
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
} 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(new View.OnClickListener() {
@Override
public void onClick(View 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(new View.OnClickListener() {
@Override
public void onClick(View 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(new View.OnClickListener() {
@Override
public void onClick(View view) {
_pathforcheck4 = store_id + "CategoryPicture4" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context)+ _pathforcheck4;
intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
}
});
}
private static String arabicToenglish(String number) {
char[] chars = new char[number.length()];
for (int i = 0; i < number.length(); i++) {
char ch = number.charAt(i);
if (ch >= 0x0660 && ch <= 0x0669)
ch -= 0x0660 - '0';
else if (ch >= 0x06f0 && ch <= 0x06F9)
ch -= 0x06f0 - '0';
chars[i] = ch;
}
return new String(chars);
}
public String getCurrentTimeNotUsed() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
String cdate = formatter.format(m_cal.getTime());
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)) {
cdate = arabicToenglish(cdate);
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_JORDAN)) {
cdate = arabicToenglish(cdate);
}
return cdate;
}
protected void startCameraActivity() {
try {
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
//temp value in case camera is gallery app above jellybean
String packag = list.get(n).loadLabel(packageManager).toString();
if (packag.equalsIgnoreCase("Gallery") || packag.equalsIgnoreCase("Galeri") || packag.equalsIgnoreCase("الاستوديو")) {
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
//com.android.gallery3d
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, 0);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
startActivityForResult(intent, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
editFlag = true;
if (_pathforcheck1 != null && !_pathforcheck1.equals("")) {
if (new File(str + _pathforcheck1).exists()) {
im1.setImageResource(R.mipmap.camera_green);
img_str1 = _pathforcheck1;
_pathforcheck1 = "";
}
}
if (_pathforcheck2 != null && !_pathforcheck2.equals("")) {
if (new File(str + _pathforcheck2).exists()) {
im2.setImageResource(R.mipmap.camera_green);
img_str2 = _pathforcheck2;
_pathforcheck2 = "";
}
}
if (_pathforcheck3 != null && !_pathforcheck3.equals("")) {
if (new File(str + _pathforcheck3).exists()) {
im3.setImageResource(R.mipmap.camera_green);
img_str3 = _pathforcheck3;
_pathforcheck3 = "";
}
}
if (_pathforcheck4 != null && !_pathforcheck4.equals("")) {
if (new File(str + _pathforcheck4).exists()) {
im4.setImageResource(R.mipmap.camera_green);
img_str4 = _pathforcheck4;
_pathforcheck4 = "";
}
}
if (Camerapath1 != null && !Camerapath1.equals("")) {
if (new File(str + Camerapath1).exists()) {
listdat.get(Adapterposition).setSubCategoryCamera1(Camerapath1);
Camerapath1 = "";
listview.invalidateViews();
}
}
if (Camerapath2 != null && !Camerapath2.equals("")) {
if (new File(str + Camerapath2).exists()) {
listdat.get(Adapterposition).setSubCategoryCamera2(Camerapath2);
Camerapath2 = "";
listview.invalidateViews();
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
public class CategoryAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private Context mcontext;
private ArrayList<CategoryPictureGetterSetter> list;
public CategoryAdapter(Activity activity, ArrayList<CategoryPictureGetterSetter> list1) {
mInflater = LayoutInflater.from(getBaseContext());
mcontext = activity;
list = list1;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position1) {
return position1;
}
@Override
public long getItemId(int position1) {
return position1;
}
class ViewHolder {
TextView brand, qty_bought, display;
Button camera1, camera2, delete;
}
@Override
public View getView(final int position1, View convertView, ViewGroup parent) {
final CategoryPicture.CategoryAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater
.inflate(R.layout.contentcatgoryadpterlayout, null);
holder = new CategoryPicture.CategoryAdapter.ViewHolder();
holder.brand = (TextView) convertView.findViewById(R.id.textviewname);
holder.camera1 = (Button) convertView.findViewById(R.id.button3);
holder.camera2 = (Button) convertView.findViewById(R.id.cameranew);
convertView.setTag(holder);
} else {
holder = (CategoryPicture.CategoryAdapter.ViewHolder) convertView.getTag();
}
holder.camera1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID()+ date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
/* if(CommonFunctions.getCurrentTimeWithLanguage(mcontext).replace(":", "").contains("????")){
Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID()+ date.replace("/", "") + new Random().nextInt(999999) + ".jpg";
}
else{
Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID()+ date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(mcontext).replace(":", "") + ".jpg";
}*/
Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID()+ date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(mcontext).replace(":", "") + ".jpg";
Adapterposition = position1;
// Log.e("Camimage",Camerapath1);
_path = CommonString.getImagesFolder(context)+ Camerapath1;
// intime = CommonFunctions.getCurrentTimeWithLanguage(context);
intime = CommonFunctions.getCurrentTimeWithLanguage(mcontext);
startCameraActivity();
listview.invalidateViews();
}
});
holder.camera2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(listdat.get(position1).getImage_allow().equals("1") && listdat.get(position1).getSubCategoryCamera1().equalsIgnoreCase("")){
Snackbar.make(listview,R.string.first_click_compulsory_image,Snackbar.LENGTH_LONG).show();
}
else {
// Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(mcontext).replace(":", "") + ".jpg";
Adapterposition = position1;
_path = CommonString.getImagesFolder(context)+ Camerapath2;
intime = CommonFunctions.getCurrentTimeWithLanguage(mcontext);
// intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
listview.invalidateViews();
}
}
});
holder.brand.setText(list.get(position1).getSUB_CATEGORY().toString());
if (!listdat.get(position1).getSubCategoryCamera1().equalsIgnoreCase("")) {
holder.camera1.setBackgroundResource(R.mipmap.camera_green);
} else if (listdat.get(position1).getImage_allow().equals("1")) {
holder.camera1.setBackgroundResource(R.drawable.camera_orange_star_green);
} else {
holder.camera1.setBackgroundResource(R.mipmap.camera_orange);
}
if (!listdat.get(position1).getSubCategoryCamera2().equalsIgnoreCase("")) {
holder.camera2.setBackgroundResource(R.mipmap.camera_green);
} else {
holder.camera2.setBackgroundResource(R.mipmap.camera_orange);
}
holder.brand.setId(position1);
return convertView;
}
}
boolean validateData(CategoryPictureGetterSetter data, ArrayList<CategoryPictureGetterSetter> list) {
boolean flag = true;
if (categoryImagesAllowed.size() > 0) {
if (categoryImagesAllowed.get(0).isImg_cam1()) {
if (data.getCategoryImage1().equals("")) {
flag = false;
}
}
if (flag) {
if (categoryImagesAllowed.get(0).isImg_cam2()) {
if (data.getCategoryImage2().equals("")) {
flag = false;
}
}
}
if (flag) {
if (categoryImagesAllowed.get(0).isImg_cam3()) {
if (data.getCategoryImage3().equals("")) {
flag = false;
}
}
}
if (flag) {
if (categoryImagesAllowed.get(0).isImg_cam4()) {
if (data.getCategoryImage4().equals("")) {
flag = false;
}
}
}
}
if (flag) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getImage_allow().equals("1")) {
String imageu = list.get(i).getSubCategoryCamera1();
if (imageu.equalsIgnoreCase("")) {
flag = false;
break;
}
}
}
}
return flag;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
showDataLossAlert();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
void showDataLossAlert() {
if (editFlag) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CategoryPicture.this);
builder.setTitle("Parinaam");
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
})
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
} else {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
showDataLossAlert();
}
@Override
protected void onResume() {
super.onResume();
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture));
}
public void setCamAllowImage(boolean isAllowed, ImageView img_cam) {
if (isAllowed) {
img_cam.setImageResource(R.drawable.camera_orange_star_green);
} else {
img_cam.setImageResource(R.mipmap.camera_orange);
}
}
}
@@ -1,339 +0,0 @@
package cpm.com.gskmtorange.dailyentry;
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.Calendar;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.download.DownloadActivity;
public class CheckoutActivity extends AppCompatActivity {
private Context context;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private String username, visit_date, store_id, store_intime, store_flag_str;
private Data data;
private SharedPreferences preferences = null;
GSKOrangeDB db;
String userId, culture_id;
CoverageBean coverageBean;
String lat, lon, checkOutImagePath = "";
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_checkout);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
db = new GSKOrangeDB(this);
db.open();
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
checkOutImagePath = getIntent().getStringExtra(CommonString.KEY_CHECKOUT_IMAGE);
lat = getIntent().getStringExtra(CommonString.KEY_LATITUDE);
lon = getIntent().getStringExtra(CommonString.KEY_LONGITUDE);
coverageBean = db.getCoverageSpecificData(visit_date, store_id);
/*lat = coverageBean.getLatitude();
lon = coverageBean.getLongitude();
if (lat == null || lat.equals("")) {
lat = "0.0";
}
if (lon == null || lon.equals("")) {
lon = "0.0";
}*/
/* FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});*/
new BackgroundTask(CheckoutActivity.this).execute();
}
private class BackgroundTask extends AsyncTask<Void, Data, String> {
private Context context;
BackgroundTask(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle(getString(R.string.title_activity_checkout));
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
percentage = (TextView) dialog.findViewById(R.id.percentage);
message = (TextView) dialog.findViewById(R.id.message);
}
@SuppressWarnings("deprecation")
@Override
protected String doInBackground(Void... params) {
try {
//String result = "";
data = new Data();
data.value = 20;
data.name = "Checked out Data Uploading";
publishProgress(data);
String onXML =
"[STORE_CHECK_OUT_STATUS]"
+ "[USER_ID]" + username + "[/USER_ID]"
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
+ "[LATITUDE]" + lat + "[/LATITUDE]"
+ "[LOGITUDE]" + lon + "[/LOGITUDE]"
+ "[CHECKOUT_DATE]" + visit_date + "[/CHECKOUT_DATE]"
+ "[CHECK_OUTTIME]" + CommonFunctions.getCurrentTimeWithLanguage(context) + "[/CHECK_OUTTIME]"
+ "[CHECK_INTIME]" + coverageBean.getInTime() + "[/CHECK_INTIME]"
+ "[CREATED_BY]" + username + "[/CREATED_BY]"
+ "[/STORE_CHECK_OUT_STATUS]";
final String sos_xml = "[DATA]" + onXML + "[/DATA]";
String service;
if(store_flag_str.equals(CommonString.FROM_ADDITIONAL) || store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC)){
service = CommonString.METHOD_UPLOAD_CHECKOUT_STATUS_ADDITIONAL;
}
else if(store_flag_str.equals(CommonString.FROM_PHARMA)){
service = CommonString.METHOD_UPLOAD_CHECKOUT_STATUS_PHARMA;
}
else{
service = CommonString.METHOD_UPLOAD_CHECKOUT_STATUS;
}
SoapObject request = new SoapObject(CommonString.NAMESPACE, service);
request.addProperty("onXML", sos_xml);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + service, envelope);
Object result = (Object) envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return service;
}
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
return service;
}
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
return service;
}
data.value = 100;
data.name = "Checkout Done";
publishProgress(data);
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(context), CommonString.KEY_Y, checkOutImagePath);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, "");
editor.putString(CommonString.KEY_STORE_NAME, "");
editor.putString(CommonString.KEY_VISIT_DATE, "");
editor.putString(CommonString.KEY_CAMERA_ALLOW, "");
editor.putString(CommonString.KEY_CHECKOUT_STATUS, "");
editor.putString(CommonString.KEY_CLASS_ID, "");
editor.putString(CommonString.KEY_EMP_ID, "");
editor.putString(CommonString.KEY_GEO_TAG, "");
editor.putString(CommonString.KEY_KEYACCOUNT_ID, "");
editor.putString(CommonString.KEY_STORETYPE_ID, "");
editor.putString(CommonString.KEY_UPLOAD_STATUS, "");
editor.commit();
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;
}
db.updateCheckoutStatus(store_id, CommonString.KEY_Y, table);
} else {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return service;
}
}
return CommonString.KEY_SUCCESS;
} catch (MalformedURLException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
} catch (IOException e) {
// counter++;
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_SOCKETEXCEPTION);
// TODO Auto-generated method stub
}
});
} catch (Exception e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
}
return "";
}
@Override
protected void onProgressUpdate(Data... values) {
// TODO Auto-generated method stub
pb.setProgress(values[0].value);
percentage.setText(values[0].value + "%");
message.setText(values[0].name);
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
dialog.dismiss();
if (result.equals(CommonString.KEY_SUCCESS)) {
showAlert(getString(R.string.checkout_successful));
} else if (!result.equals("")) {
Toast.makeText(context, "Network Error Try Again", Toast.LENGTH_SHORT).show();
finish();
}
}
}
class Data {
int value;
String name;
}
@Override
protected void onResume() {
super.onResume();
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_checkout));
}
private static String arabicToenglish(String number) {
char[] chars = new char[number.length()];
for (int i = 0; i < number.length(); i++) {
char ch = number.charAt(i);
if (ch >= 0x0660 && ch <= 0x0669)
ch -= 0x0660 - '0';
else if (ch >= 0x06f0 && ch <= 0x06F9)
ch -= 0x06f0 - '0';
chars[i] = ch;
}
return new String(chars);
}
public String getCurrentTimeNotUsed() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
String cdate = formatter.format(m_cal.getTime());
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)) {
cdate = arabicToenglish(cdate);
}
else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_JORDAN)) {
cdate = arabicToenglish(cdate);
}
return cdate;
}
public void showAlert(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(CheckoutActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
@@ -1,414 +0,0 @@
package cpm.com.gskmtorange.dailyentry;
import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Toast;
//import com.crashlytics.android.Crashlytics;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import com.androidbuts.multispinnerfilter.KeyPairBoolData;
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;
import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CoachingVisitGetterSetter;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SupervisorListGetterSetter;
public class CoachingVisitActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
private Context context;
private GSKOrangeDB database;
ArrayList<SupervisorListGetterSetter> supervisorList;
private Spinner exist_spinner; //supervisor_spinner;
private ArrayAdapter<CharSequence> exist_adapter, supervisor_adapter;
int coaching_visit;
LinearLayout linear_supervisor;
ImageView img_cam;
FloatingActionButton fab_next, fab_save;
String emp_id;
protected String _pathforcheck = "", _path, image_name = "", str, country_id, store_flag_str;
String visit_date, store_id, username;
private SharedPreferences preferences;
String gallery_package = "";
Uri outputFileUri;
boolean saved_flag = false, update_flag = false;
ArrayList<CoachingVisitGetterSetter> coachingVisitdata;
boolean coaching_visit_camera_flag = false;
MultiSpinnerSearch multi_spinner_supervisor;
ArrayList<String> selectedSupervisorList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_coaching_visit);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
linear_supervisor = (LinearLayout) findViewById(R.id.linear_supervisor);
exist_spinner = (Spinner) findViewById(R.id.spinner_coaching_visit);
//supervisor_spinner = (Spinner) findViewById(R.id.spinner_supervisor);
img_cam = (ImageView) findViewById(R.id.img_cam);
multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_coaching_visit));
str = CommonString.getImagesFolder(context);
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
username = preferences.getString(CommonString.KEY_USERNAME, "");
visit_date = preferences.getString(CommonString.KEY_DATE, null);
//store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
fab_next = (FloatingActionButton) findViewById(R.id.fab);
fab_save = (FloatingActionButton) findViewById(R.id.fab_save);
database = new GSKOrangeDB(this);
database.open();
coachingVisitdata = database.getCoachingVisitData(store_id);
//Enable disable According to Configuration
ArrayList<ConfigurationMasterGetterSetter> configurationData = database.getConfigurationMasterData(country_id);
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")) {
coaching_visit_camera_flag = true;
break;
}
}
}
if (coaching_visit_camera_flag) {
img_cam.setVisibility(View.VISIBLE);
} else {
img_cam.setVisibility(View.GONE);
}
supervisorList = database.getSupervisorListData();
exist_adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
String select_str = getResources().getString(R.string.select);
exist_adapter.add(select_str);
exist_adapter.add(getResources().getString(R.string.yes));
exist_adapter.add(getResources().getString(R.string.no));
exist_spinner.setAdapter(exist_adapter);
exist_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
exist_spinner.setOnItemSelectedListener(this);
if (coachingVisitdata.size() != 0) {
update_flag = true;
fab_save.hide();//setVisibility(View.GONE);
fab_next.show();//setVisibility(View.VISIBLE);
if (coachingVisitdata.get(0).isExists()) {
exist_spinner.setSelection(1);
} else {
exist_spinner.setSelection(2);
}
exist_spinner.setEnabled(false);
}
fab_next.setOnClickListener(this);
fab_save.setOnClickListener(this);
img_cam.setOnClickListener(this);
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (parent.getId() == R.id.spinner_coaching_visit) {
if (position != 0) {
if (!update_flag) {
fab_save.show(); //setVisibility(View.VISIBLE);
if (position == 1) {
linear_supervisor.setVisibility(View.VISIBLE);
coaching_visit = 1;
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());
}
}
}
});
} 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);
}
} else if (parent.getId() == R.id.multi_spinner_supervisor) {
// Commented-out code from original
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.img_cam) {
_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);
}
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);
}
} 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) {
String emp_id = "0";
for (int i = 0; i < supervisorList.size(); i++) {
if (supervisorList.get(i).getSUPERVISOR().get(0).equalsIgnoreCase(name)) {
emp_id = supervisorList.get(i).getEMP_ID().get(0);
break;
}
}
return emp_id;
}
protected void startCameraActivity() {
try {
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
//temp value in case camera is gallery app above jellybean
String packag = list.get(n).loadLabel(packageManager).toString();
if (packag.equalsIgnoreCase("Gallery") || packag.equalsIgnoreCase("Galeri") || packag.equalsIgnoreCase("الاستوديو")) {
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
//com.android.gallery3d
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, 0);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
startActivityForResult(intent, 0);
} catch (Exception e) {
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
// Crashlytics.logException(e.getCause());
//Crashlytics.logException(new Exception(e.getCause()));
e.printStackTrace();
}
}
@SuppressLint("MissingSuperCall")
@SuppressWarnings("deprecation")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img_cam.setImageDrawable(getResources().getDrawable(R.mipmap.camera_green));
image_name = _pathforcheck;
_pathforcheck = "";
}
}
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
return super.onOptionsItemSelected(item);
}
}

Some files were not shown because too many files have changed in this diff Show More