mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
1
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/.gitignore
vendored
Normal file
1
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
122
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/build.gradle
Normal file
122
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/build.gradle
Normal file
|
@ -0,0 +1,122 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
lintOptions {
|
||||
disable 'MissingTranslation'
|
||||
checkReleaseBuilds false
|
||||
abortOnError false
|
||||
}
|
||||
// change with your msmkey storeFile
|
||||
signingConfigs {
|
||||
msmkey {
|
||||
keyAlias 'aitmsskey'
|
||||
keyPassword 'AdIns2020'
|
||||
storeFile file('keystore2020.jks')
|
||||
storePassword 'AdIns2020'
|
||||
}
|
||||
}
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '29.0.2'
|
||||
defaultConfig {
|
||||
applicationId "com.adins.mss.odr"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 7898
|
||||
versionName "3.2.0.0-$versionCode"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
multiDexEnabled true
|
||||
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
archivesBaseName = "MSSODR-$versionName"
|
||||
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
includeCompileClasspath false
|
||||
}
|
||||
}
|
||||
}
|
||||
dexOptions {
|
||||
javaMaxHeapSize "5g"
|
||||
}
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
shrinkResources false
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.msmkey
|
||||
}
|
||||
}
|
||||
flavorDimensions "default"
|
||||
productFlavors {
|
||||
product {
|
||||
applicationId "com.adins.mss.odr"
|
||||
versionCode 7898
|
||||
dimension "default"
|
||||
versionName "3.2.0.0-$versionCode-P"
|
||||
buildConfigField "boolean", "IS_DEV", "false"
|
||||
buildConfigField "boolean", "IS_DBENCRYPT", "true"
|
||||
buildConfigField "boolean", "IS_BYPASSROOT", "false"
|
||||
buildConfigField "String", "IS_FLAVORS", "\"PRODUCT\""
|
||||
}
|
||||
trial {
|
||||
applicationId "com.adins.mss.odr.trial"
|
||||
versionCode 7898
|
||||
dimension "default"
|
||||
versionName "3.2.0.0-$versionCode-P"
|
||||
buildConfigField "boolean", "IS_DEV", "false"
|
||||
buildConfigField "boolean", "IS_DBENCRYPT", "true"
|
||||
buildConfigField "boolean", "IS_BYPASSROOT", "false"
|
||||
buildConfigField "String", "IS_FLAVORS", "\"TRIAL\""
|
||||
}
|
||||
cloud {
|
||||
applicationId "com.adins.mss.odr.cloud"
|
||||
versionCode 7898
|
||||
dimension "default"
|
||||
versionName "3.2.0.0-$versionCode-P"
|
||||
buildConfigField "boolean", "IS_DEV", "false"
|
||||
buildConfigField "boolean", "IS_DBENCRYPT", "true"
|
||||
buildConfigField "boolean", "IS_BYPASSROOT", "false"
|
||||
buildConfigField "String", "IS_FLAVORS", "\"PRODUCT\""
|
||||
}
|
||||
clouddev {
|
||||
applicationId "com.adins.mss.odr.cloud.dev"
|
||||
versionCode 7250
|
||||
dimension "default"
|
||||
versionName "3.2.0.0-$versionCode-D"
|
||||
buildConfigField "boolean", "IS_DEV", "true"
|
||||
buildConfigField "boolean", "IS_DBENCRYPT", "false"
|
||||
buildConfigField "boolean", "IS_BYPASSROOT", "true"
|
||||
buildConfigField "String", "IS_FLAVORS", "\"DEVELOPER\""
|
||||
}
|
||||
cloudtrial {
|
||||
applicationId "com.adins.mss.odr.cloud.trial"
|
||||
versionCode 7250
|
||||
dimension "default"
|
||||
versionName "3.2.0.0-$versionCode-P"
|
||||
buildConfigField "boolean", "IS_DEV", "false"
|
||||
buildConfigField "boolean", "IS_DBENCRYPT", "true"
|
||||
buildConfigField "boolean", "IS_BYPASSROOT", "false"
|
||||
buildConfigField "String", "IS_FLAVORS", "\"TRIAL\""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':mssbase')
|
||||
implementation('androidx.appcompat:appcompat:1.0.0')
|
||||
implementation 'com.google.firebase:firebase-messaging:20.2.4'
|
||||
implementation 'com.google.firebase:firebase-core:17.5.0'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.5.0'
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
|
||||
implementation 'com.google.firebase:firebase-perf:19.0.8'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||
implementation 'com.github.bumptech.glide:glide:3.7.0'
|
||||
implementation 'net.zetetic:android-database-sqlcipher:3.5.1'
|
||||
}
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'com.google.firebase.firebase-perf'
|
|
@ -0,0 +1,585 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "814888014770",
|
||||
"firebase_url": "https://aitmss-1fd04.firebaseio.com",
|
||||
"project_id": "aitmss-1fd04",
|
||||
"storage_bucket": "aitmss-1fd04.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:30c443717ea63b1d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-3mnsl7ja8ddiuv5sl5gqfvij9cm973na.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll",
|
||||
"certificate_hash": "b07630f358413826df1dceeff13dec3cc7642e36"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-o9drphjl20de1nbt9bd1tbuj08musiis.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll",
|
||||
"certificate_hash": "edf00b52879e51d97f85961fd196240bbd316220"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-1crpacj0ttvkjeimakn6qe6pmhu3qeq7.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-lqni1uhtl2omhj2ghl8ennrlpdtgchgi.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll",
|
||||
"certificate_hash": "781f237f99355c079785379c9bb39d0c6f036fba"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:5c334278ae3d4dbd",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:62ea46ede52e350b",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:6168d59a3ce39f25",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-5f1768ika3hs4ttrek8jmkmf5rahfi1l.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy",
|
||||
"certificate_hash": "b07630f358413826df1dceeff13dec3cc7642e36"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-6jbu06k8ntt610ah06be2q8fmf8g49u6.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy",
|
||||
"certificate_hash": "edf00b52879e51d97f85961fd196240bbd316220"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-nr69qi0ku9cgok5co187apdpgs0at6ie.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-34mdd9bo2goldi5a5hoeh4iup8nvcdvk.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy",
|
||||
"certificate_hash": "781f237f99355c079785379c9bb39d0c6f036fba"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:4c9a50b93d56ebef",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:48590bba4365ec2d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-itt09df2ovn47an5rearlf1kh8ljp5tt.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr",
|
||||
"certificate_hash": "b07630f358413826df1dceeff13dec3cc7642e36"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-09lnve4i7o6ml5436v128stk0jfu5vug.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr",
|
||||
"certificate_hash": "edf00b52879e51d97f85961fd196240bbd316220"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-52el593n7dc31cgu431kiqes2qijklie.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-76sm9sf0veuhc96gtiqkdinju9b4al6d.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr",
|
||||
"certificate_hash": "781f237f99355c079785379c9bb39d0c6f036fba"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:75bff1874bc58298",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:41ac49e3a1067b63",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:0056a18df222e269",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:2ce43e2402f184a7",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.mma"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:81af48a318e62233",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.mma.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:4394bdce086fcfcc",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.mma.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:814888014770:android:7314503471868713",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.base"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-51c5dehkiu9o90j7rdq9ke6fvlvaomtc.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.base",
|
||||
"certificate_hash": "781f237f99355c079785379c9bb39d0c6f036fba"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-aqe9bq2rc57suvnangenhpfai77f4j2u.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.base",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC6ybt31nRknv-l0dzR69vZZGPoSeHkAm8"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyDmV5RbC4xQFgzhTUAQMHUSbtFdl8wduII"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "814888014770-qgllsrlpktvi162r6uqae4on3qtg0ap2.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
Binary file not shown.
BIN
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/msmkey
Normal file
BIN
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/msmkey
Normal file
Binary file not shown.
205
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/proguard-rules.pro
vendored
Normal file
205
MSS/BaseProject/Android/branches/BAFMCS_V3/mssodr/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,205 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\gigin.ginanjar\AppData\Local\Android\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 *;
|
||||
#}
|
||||
|
||||
|
||||
-optimizationpasses 5
|
||||
|
||||
#When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
|
||||
-dontusemixedcaseclassnames
|
||||
|
||||
#Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
|
||||
-dontskipnonpubliclibraryclasses
|
||||
|
||||
#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
|
||||
-dontpreverify
|
||||
|
||||
#Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
|
||||
-verbose
|
||||
|
||||
#The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
|
||||
#To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
|
||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||
|
||||
#To repackage classes on a single package
|
||||
-repackageclasses ''
|
||||
|
||||
#Uncomment if using annotations to keep them.
|
||||
-keepattributes *Annotation*, Override
|
||||
-keepattributes Signature
|
||||
-keepattributes EnclosingMethod
|
||||
-keepattributes InnerClasses
|
||||
|
||||
-dontwarn javax.script.**
|
||||
-dontwarn org.apache.commons.logging.**
|
||||
-dontwarn java.beans.**
|
||||
-dontwarn okio.**
|
||||
-dontwarn com.androidquery.auth.TwitterHandle
|
||||
-dontwarn org.bouncycastle.**
|
||||
|
||||
-keep class javax.** {*;}
|
||||
-keep class org.apache.commons.logging.** {*;}
|
||||
-keep class java.beans.** {*;}
|
||||
-keep class org.apache.commons.jexl2.** {*;}
|
||||
-keep class org.bouncycastle.** {*;}
|
||||
-keep class okio.** {*;}
|
||||
-keep class oauth.signpost.** {*;}
|
||||
-keep class org.apache.log4j.Logger {*;}
|
||||
-keep class java.nio.** {*;}
|
||||
-keep class junit..** {*;}
|
||||
-keep class oauth.signpost.commonshttp.** {*;}
|
||||
-keep class net.sqlcipher.** {
|
||||
*;
|
||||
}
|
||||
|
||||
#Keep classes that are referenced on the AndroidManifest
|
||||
#-keep public class * extends androidx.fragment.app.Fragment
|
||||
-keep public class * extends androidx.appcompat.app.AppCompatActivity
|
||||
-keep public class * extends com.adins.mss.base.MssFragmentActivity
|
||||
-keep public class * extends androidx.fragment.app.Fragment
|
||||
-keep public class * extends androidx.fragment.app.FragmentActivity
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends com.adins.mss.foundation.http.MssRequestType
|
||||
-keep public class * extends com.adins.mss.foundation.http.MssResponseType
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
-keep class com.adins.**.*Request
|
||||
-keep class com.adins.**.*Response
|
||||
-keep class android.** { *; }
|
||||
-keep class com.google.** { *; }
|
||||
#To remove debug logs:
|
||||
-assumenosideeffects class android.util.Log {
|
||||
public static *** d(...);
|
||||
public static *** v(...);
|
||||
public static *** e(...);
|
||||
public static *** i(...);
|
||||
}
|
||||
|
||||
#To avoid changing names of methods invoked on layout's onClick.
|
||||
# Uncomment and add specific method names if using onClick on layouts
|
||||
-keepclassmembers class * {
|
||||
public void onClickButton(android.view.View);
|
||||
}
|
||||
|
||||
#Maintain java native methods
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
#To maintain custom components names that are used on layouts XML.
|
||||
#Uncomment if having any problem with the approach below
|
||||
#-keep public class custom.components.package.and.name.**
|
||||
|
||||
#To maintain custom components names that are used on layouts XML:
|
||||
-keep public class * extends android.view.View {
|
||||
public <init>(android.content.Context);
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
public void set*(...);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
#Maintain enums
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
|
||||
#Keep the R
|
||||
-keepclassmembers class **.R$* {
|
||||
public static <fields>;
|
||||
}
|
||||
|
||||
#Keep Interface
|
||||
-keep interface * {*;}
|
||||
-keep class sun.misc.Unsafe { *; }
|
||||
|
||||
###### ADDITIONAL OPTIONS NOT USED NORMALLY
|
||||
|
||||
#To keep callback calls. Uncomment if using any
|
||||
#http://proguard.sourceforge.net/index.html#/manual/examples.html#callback
|
||||
#-keep class mypackage.MyCallbackClass {
|
||||
# void myCallbackMethod(java.lang.String);
|
||||
#}
|
||||
|
||||
#Uncomment if using Serializable
|
||||
-keepclassmembers class * implements java.io.Serializable {
|
||||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||
private void writeObject(java.io.ObjectOutputStream);
|
||||
private void readObject(java.io.ObjectInputStream);
|
||||
java.lang.Object writeReplace();
|
||||
java.lang.Object readResolve();
|
||||
}
|
||||
|
||||
-keep class * implements java.io.Serializable {
|
||||
public protected <fields>;
|
||||
}
|
||||
|
||||
#Keep fields for Gson transactions
|
||||
-keep public class * extends com.adins.mss.foundation.http.MssRequestType{
|
||||
<fields>;
|
||||
}
|
||||
-keep public class * extends com.adins.mss.foundation.http.MssResponseType{
|
||||
<fields>;
|
||||
}
|
||||
-keep public class * extends com.adins.mss.foundation.http.KeyValue{
|
||||
<fields>;
|
||||
}
|
||||
|
||||
-ignorewarnings
|
||||
|
||||
|
||||
#Keep Class For MSS
|
||||
|
||||
-keep class com.adins.mss.dao.** {*;}
|
||||
-keep class com.adins.mss.base.login.DefaultLoginModel
|
||||
-keep public class com.gadberry.** {*;}
|
||||
|
||||
-keep public class com.adins.mss.base.authentication.AuthenticationResultBean{
|
||||
<fields>;
|
||||
}
|
||||
|
||||
-keep public class com.adins.mss.foundation.formatter.DateFormatter{
|
||||
public <methods>;
|
||||
}
|
||||
|
||||
-keep public class com.adins.mss.logger.Logger{
|
||||
public <methods>;
|
||||
}
|
||||
|
||||
-keep class com.androidquery.AQuery {
|
||||
public protected <methods>;
|
||||
public protected <fields>;
|
||||
}
|
||||
|
||||
-keep class com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences {*;}
|
||||
-keep public class com.adins.mss.foundation.UserHelp.** {*;}
|
|
@ -0,0 +1,13 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "446222152141",
|
||||
"firebase_url": "https://aitmss-cloud.firebaseio.com",
|
||||
"project_id": "aitmss-cloud",
|
||||
"storage_bucket": "aitmss-cloud.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:7314503471868713",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.base"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:82ba9047a008c046",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-buravk7m2l0j6o2tosr7mn717ukam7lo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:cecbb11fe64bc4f1",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d9573a5a957ef4f0",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:b65468a6c10b3f97",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-r44n3f9ci2g7cveohplqgt5hi3gri0b5.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d722cab582795d44",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:338f8c2ea2872c21",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-ikq3or8fefog8m9uiqboih3uc7r23epo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:0b9842b47415ffc9",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "446222152141",
|
||||
"firebase_url": "https://aitmss-cloud.firebaseio.com",
|
||||
"project_id": "aitmss-cloud",
|
||||
"storage_bucket": "aitmss-cloud.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:7314503471868713",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.base"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:82ba9047a008c046",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-buravk7m2l0j6o2tosr7mn717ukam7lo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:cecbb11fe64bc4f1",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d9573a5a957ef4f0",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:b65468a6c10b3f97",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-r44n3f9ci2g7cveohplqgt5hi3gri0b5.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d722cab582795d44",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:338f8c2ea2872c21",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-ikq3or8fefog8m9uiqboih3uc7r23epo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:0b9842b47415ffc9",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "446222152141",
|
||||
"firebase_url": "https://aitmss-cloud.firebaseio.com",
|
||||
"project_id": "aitmss-cloud",
|
||||
"storage_bucket": "aitmss-cloud.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:7314503471868713",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.base"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:82ba9047a008c046",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-buravk7m2l0j6o2tosr7mn717ukam7lo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:cecbb11fe64bc4f1",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d9573a5a957ef4f0",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.coll.cloud.trial"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:b65468a6c10b3f97",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-r44n3f9ci2g7cveohplqgt5hi3gri0b5.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:d722cab582795d44",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.odr.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:338f8c2ea2872c21",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-ikq3or8fefog8m9uiqboih3uc7r23epo.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud",
|
||||
"certificate_hash": "e831f754571d0287b1577c64c2f9da80dca8a28d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:446222152141:android:0b9842b47415ffc9",
|
||||
"android_client_info": {
|
||||
"package_name": "com.adins.mss.svy.cloud.dev"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "446222152141-llmcc27vignp2jas7f71rb1sva69e62j.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC3a4yfB1rBSHTlMlGarmHKkoeRj9f44MY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.adins.mss.odr"
|
||||
android:installLocation="internalOnly">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<!-- External storage for caching. -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<!-- My Location -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true"/>
|
||||
|
||||
<application
|
||||
android:supportsRtl="true"
|
||||
android:name="com.adins.mss.main.MSMApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon_launcher_lead_in"
|
||||
android:logo="@drawable/logo_mss"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/CustomTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
<service
|
||||
android:name="com.services.MOApplicationRunningService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver android:name="com.services.MOApplicationRunningService$UserLogoutReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.adins.mss.action_USER_LOGOUT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name=".MOLoginActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.base.ServerLinkActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_server_link"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.DeveloperOptionActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_developer_option"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".MOSynchronizeActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".NewMOMainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".news.NewsChildActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/CustomTheme"></activity>
|
||||
<activity
|
||||
android:name=".news.NewsContentActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name=".accounts.AccountsListActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".accounts.AccountResultActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".accounts.OpportunityDetailActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.image.ViewImageActivity"
|
||||
android:launchMode="singleTop" />
|
||||
<activity android:name="com.soundcloud.android.crop.CropImageActivity" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.timeline.comment.activity.CommentActivity"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.dynamicform.DynamicFormActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:parentActivityName=".NewMOMainActivity"
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".NewMOMainActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.ResultOrderActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.update.ResultUpdateActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.update.OrderCancelActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.camerainapp.CameraActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.timeline.MapsViewer"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.ChangePasswordActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.image.CroppingImageActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity android:name="com.adins.mss.base.PrintActivity" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.todolist.form.ViewMapActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.questiongenerator.form.LocationTagingView"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.questiongenerator.form.FingerDrawingActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.todolist.form.AllHeaderViewerActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
android:value="false" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.maps.v2.API_KEY"
|
||||
android:value="AIzaSyA2V50uQBKw5_w2f3BEEbcNkmwofZyt-Io" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<service android:name="com.tracking.LocationTrackingService" />
|
||||
<service android:name="com.services.AutoSendImageService" />
|
||||
<service android:name="com.services.AutoSendTaskService" />
|
||||
<service android:name="com.services.NotificationService" />
|
||||
|
||||
<service android:name="com.services.FirebaseMessagingService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name="com.services.RefreshToken">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,146 @@
|
|||
# Target URL
|
||||
#url_main=http://app.ad-ins.com/adimobile/msswebservicessit/services/m/
|
||||
#url_main=http://app.ad-ins.com/adimobile/msswebservicesdemo/services/m/
|
||||
url_main=http://mss-sit-svr.ad-ins.com:8080/msswebservicessit/services/m/
|
||||
|
||||
#------------------------
|
||||
url_serv_sync=user/sync
|
||||
url_serv_location_history=user/updatelocationhistory
|
||||
url_submit_track=user/updatelocationhistory
|
||||
url_check_update=user/checkupdate
|
||||
url_login=user/login
|
||||
url_update_fcm=user/updatefcm
|
||||
url_changepassword=user/changepassword
|
||||
url_get_absensi=user/absensi
|
||||
|
||||
#------------------------
|
||||
|
||||
url_syncparam=sync/syncParam
|
||||
url_sync_file=sync/datafiles
|
||||
url_submitlastsync=sync/submitLastSync
|
||||
url_syncparam_constraint=sync/syncParamConstraint
|
||||
url_sync_rv_numbers=sync/syncRV
|
||||
|
||||
#------------------------
|
||||
|
||||
url_get_questionset=form/questionset
|
||||
url_get_verification=form/retrieveVerificationForm
|
||||
url_get_image=form/getimages
|
||||
url_get_scheme=form/retrieveForm
|
||||
|
||||
#------------------------
|
||||
|
||||
url_get_tasklist=task/retrievetasklist
|
||||
url_get_svyperformance=task/surveyperformance
|
||||
url_get_lookup=task/getUserAssign
|
||||
url_get_list_reassignment=task/getHeaderTaskList
|
||||
url_get_detail_reassignment=task/getDetailTask
|
||||
url_get_list_assignment=task/getHeaderTaskList
|
||||
url_get_detail_assignment=task/getDetailTask
|
||||
url_get_detail_order=task/getDetailTask
|
||||
url_get_detail_task=task/getDetailTask
|
||||
url_get_list_verification=task/getverificationtasklist
|
||||
url_get_list_approval=task/getapprovaltasklist
|
||||
url_get_reportsummary=task/reportsummary
|
||||
url_get_newsheader=task/contentnews
|
||||
url_get_newscontent=task/contentnews
|
||||
url_get_list_cancelorder=task/cancelorder
|
||||
url_get_detail_cancelorder=task/cancelorder
|
||||
url_get_cancelorder=task/cancelorder
|
||||
url_get_lookup_answer=task/luOnline
|
||||
url_get_recapitulate=task/getRecapitulation
|
||||
url_refreshtask=task/refreshtask
|
||||
url_senddepositreport=task/depositreport
|
||||
url_submittask=task/submittask
|
||||
url_submit_assign=task/submitTaskChange
|
||||
url_submitopenreadtask=task/updatereadopentask
|
||||
url_submitverificationtask=task/submitverificationtask
|
||||
url_submitapprovaltask=task/submitappprovaltask
|
||||
url_updatecashonhand=task/updatecashonhand
|
||||
url_checkorder=task/checkorder
|
||||
url_check_order_rejected=task/reviewTask
|
||||
url_get_summaryGoLive=task/summaryGoLive
|
||||
#------------------------
|
||||
|
||||
url_get_paymenthistory=collection/paymenthistory/retrievepaymenthistory
|
||||
url_get_installmentschedule=collection/installschedule/retrieveinsschedule
|
||||
url_retriececollectiontask=collection/collectionhistory/retrievecollectionhistory
|
||||
url_get_collectionhistory=collection/getCollectionHistory
|
||||
url_get_closing_task=collection/task/closingtask
|
||||
url_get_task_log=collection/task/getTaskLog
|
||||
url_submit_print_count=collection/task/SubmitPrintCount
|
||||
url_submit_rv_number=collection/task/submitrvnumber
|
||||
|
||||
#------------------------
|
||||
url_upload_avatar=user/updateavatar
|
||||
url_get_account=marketing/account/getaccount
|
||||
url_get_opportunity=marketing/oppor/getoppor
|
||||
url_get_opportunity_detail=marketing/oppor/getoppordetail
|
||||
url_get_followup=marketing/followup/getfollowup
|
||||
url_do_followup=marketing/followup/dofollowup
|
||||
url_get_catalogue_header=marketing/catalogue/getheader
|
||||
url_get_catalogue_pdf=marketing/catalogue/getpdf
|
||||
url_get_catalogue_promo=marketing/catalogue/getpromo
|
||||
url_get_contact=marketing/contact/getcontact
|
||||
url_get_product_contact=marketing/contact/getproductcontact
|
||||
url_get_mktperformance=marketing/task/mktperformance
|
||||
url_submittask_mma=marketing/task/submittaskmma
|
||||
url_get_mkt_performance=marketing/task/mktperformance
|
||||
url_get_product=marketing/product/getproduct
|
||||
url_get_product_detail=marketing/product/getProductDetail
|
||||
url_get_product_image=marketing/product/getImageProduct
|
||||
|
||||
#------------------------
|
||||
|
||||
url_get_contentnews=getContentNews
|
||||
url_serv_tracking=tracking
|
||||
url_serv_personalization=person
|
||||
url_get_task=gettask
|
||||
url_submit_dkcp=task/submitDkcp
|
||||
|
||||
#------------------------
|
||||
|
||||
#Loyalti
|
||||
url_get_detailkompetisi=user/getdetailcompetition
|
||||
url_get_logo=user/geticoncompetition
|
||||
url_loyalty_detail_point=user/detailpoint
|
||||
|
||||
#------------------------
|
||||
|
||||
#CR external db
|
||||
save_path=/aitmss/data/
|
||||
use_external_storage=false
|
||||
|
||||
#------------------------
|
||||
|
||||
encrypt=false
|
||||
decrypt=false
|
||||
is_developer=true
|
||||
is_developer_mode=false
|
||||
is_bypass_developer=false
|
||||
can_access_developer_mode=true
|
||||
is_secure_connection=false
|
||||
is_required_access_token=true
|
||||
client_id=android
|
||||
use_own_camera=true
|
||||
is_bypassroot = false
|
||||
enable_user_help = true
|
||||
enable_loc_permission_ui = false
|
||||
disable_acra = true
|
||||
|
||||
application=MO
|
||||
max_log=10
|
||||
log_age=0
|
||||
default_max_lenght=100
|
||||
thumb_width=240
|
||||
thumb_height=360
|
||||
camera_quality=1
|
||||
|
||||
interval_tracking=6000
|
||||
interval_autosend=6000
|
||||
interval_gps_timeout=6000
|
||||
change_uuid=false
|
||||
divider_uuid=-
|
||||
|
||||
#printer device. 0 - > PrintActivity, 1 -> Main_activity1
|
||||
printer_device=Sato@0,Enibit@1,Winson@1,Epson@1,Woosim@1,Bixolon / Gowell@0
|
|
@ -0,0 +1,105 @@
|
|||
package com.adins.mss.main;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
|
||||
import com.adins.mss.base.AppContext;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.config.ConfigFileReader;
|
||||
import com.adins.mss.odr.BuildConfig;
|
||||
import com.adins.mss.odr.NewMOMainActivity;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ACRAConfiguration;
|
||||
import org.acra.ACRAConfigurationException;
|
||||
import org.acra.ReportField;
|
||||
import org.acra.ReportingInteractionMode;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Created by wendy.ac on 10/02/20109.
|
||||
*/
|
||||
|
||||
public class MSMApplication extends AppContext {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getApplicationContext();
|
||||
|
||||
final ACRAConfiguration config = new ACRAConfiguration();
|
||||
if (BuildConfig.FLAVOR.contains("prod")) {
|
||||
config.setFormUri("http://app.ad-ins.com:5984/acra-aitmss-prod/_design/acra-storage/_update/report");
|
||||
} else {
|
||||
config.setFormUri("http://app.ad-ins.com:5984/acra-aitmss-dev/_design/acra-storage/_update/report");
|
||||
}
|
||||
// else {
|
||||
// config.setFormUri("http://app.ad-ins.com:5984/acra-wfimoscs-dev/_design/acra-storage/_update/report");
|
||||
// }
|
||||
config.setReportType(org.acra.sender.HttpSender.Type.JSON);
|
||||
config.setHttpMethod(org.acra.sender.HttpSender.Method.PUT);
|
||||
config.setFormUriBasicAuthLogin("admin");
|
||||
config.setFormUriBasicAuthPassword("12345");
|
||||
ReportField[] customReportContent = {
|
||||
ReportField.APP_VERSION_CODE,
|
||||
ReportField.APP_VERSION_NAME,
|
||||
ReportField.ANDROID_VERSION,
|
||||
ReportField.INSTALLATION_ID,
|
||||
ReportField.PACKAGE_NAME,
|
||||
ReportField.REPORT_ID,
|
||||
ReportField.BUILD,
|
||||
ReportField.STACK_TRACE,
|
||||
ReportField.AVAILABLE_MEM_SIZE,
|
||||
ReportField.TOTAL_MEM_SIZE,
|
||||
ReportField.SETTINGS_SECURE,
|
||||
ReportField.DISPLAY,
|
||||
ReportField.CUSTOM_DATA,
|
||||
ReportField.SHARED_PREFERENCES
|
||||
};
|
||||
config.setCustomReportContent(customReportContent);
|
||||
|
||||
//disable acra => set acra custom preference sesuai app.properties
|
||||
Properties properties = ConfigFileReader.propertiesFromFile(this, GlobalData.PROPERTY_FILENAME);
|
||||
boolean disableAcra = Boolean.parseBoolean(properties.getProperty(GlobalData.PROP_DISABLE_ACRA));
|
||||
Global.ACRA_DISABLED = disableAcra;
|
||||
String acraCustomPrefName = "ACRACUSTOMPREF";
|
||||
SharedPreferences acracustompref = getSharedPreferences(acraCustomPrefName, Context.MODE_PRIVATE);
|
||||
acracustompref.edit().putBoolean(ACRA.PREF_DISABLE_ACRA,disableAcra).commit();
|
||||
|
||||
config.setSharedPreferenceName(acraCustomPrefName);
|
||||
config.setSharedPreferenceMode(Context.MODE_PRIVATE);
|
||||
|
||||
try {
|
||||
config.setMode(ReportingInteractionMode.TOAST);
|
||||
} catch (ACRAConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
config.setResToastText(R.string.toast_crash);
|
||||
|
||||
ACRA.init(this, config);
|
||||
|
||||
//setting firebase crashlytic instance
|
||||
FirebaseApp.initializeApp(this);
|
||||
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
|
||||
FireCrash.setInstance(FirebaseCrashlytics.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getHomeClass() {
|
||||
return NewMOMainActivity.class;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @TargetApi(Build.VERSION_CODES.N)
|
||||
// protected void attachBaseContext(Context newBase) {
|
||||
// super.attachBaseContext(LocaleHelper.onAttach(newBase));
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.mikepenz.aboutlibraries.entity.Library;
|
||||
import com.mikepenz.aboutlibraries.entity.License;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ChangeLog {
|
||||
public static ArrayList<Library> library = new ArrayList<Library>();
|
||||
|
||||
public ChangeLog(Context context) {
|
||||
String authorLogv2_0_0 = "AdIns";
|
||||
String appNameLogv2_0_0 = "MSSODR";
|
||||
int buildVersion = Global.BUILD_VERSION;
|
||||
License licenseLogv2_0_0 = new License();
|
||||
licenseLogv2_0_0.setLicenseName("Apache Version 2.0");
|
||||
|
||||
library.add(0, new Library("06/06/2015", appNameLogv2_0_0, context.getString(R.string.changelog_v200),
|
||||
"2.0.0.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("06/01/2016", appNameLogv2_0_0, context.getString(R.string.changelog_v210),
|
||||
"2.1.0.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("01/06/2016", appNameLogv2_0_0, context.getString(R.string.changelog_v220),
|
||||
"2.2.0.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("06/12/2016", appNameLogv2_0_0, context.getString(R.string.changelog_v230),
|
||||
"2.3.0.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("15/12/2016", appNameLogv2_0_0, context.getString(R.string.changelog_v2310),
|
||||
"2.3.1.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("19/01/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2320),
|
||||
"2.3.2.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("07/03/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2330),
|
||||
"2.3.3.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("04/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2340),
|
||||
"2.3.4.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("08/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2350),
|
||||
"2.3.5.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("09/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2360),
|
||||
"2.3.6.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("12/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2370),
|
||||
"2.3.7.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("15/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2380),
|
||||
"2.3.8.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("16/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2390),
|
||||
"2.3.9.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("17/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23100),
|
||||
"2.3.10.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("22/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23110),
|
||||
"2.3.11.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("23/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23120),
|
||||
"2.3.12.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("24/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23130),
|
||||
"2.3.13.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("26/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23140),
|
||||
"2.3.14.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("29/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23150),
|
||||
"2.3.15.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("30/05/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23160),
|
||||
"2.3.16.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("02/06/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23170),
|
||||
"2.3.17.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("06/06/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23180),
|
||||
"2.3.18.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("07/06/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v23190),
|
||||
"2.3.19.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("07/07/2017", appNameLogv2_0_0, context.getString(R.string.changelog_v2400),
|
||||
"2.4.0.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("04/03/2020", appNameLogv2_0_0, context.getString(R.string.changelog_v3110),
|
||||
"3.1.1.0", licenseLogv2_0_0, buildVersion));
|
||||
library.add(0, new Library("04/27/2020", appNameLogv2_0_0, context.getString(R.string.changelog_v3120),
|
||||
"3.1.2.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("05/27/2020", appNameLogv2_0_0, context.getString(R.string.changelog_v3130),
|
||||
"3.1.3.0", licenseLogv2_0_0, buildVersion));
|
||||
|
||||
library.add(0, new Library("01/10/2020", appNameLogv2_0_0, context.getString(R.string.changelog_v3140),
|
||||
"3.1.4.0", licenseLogv2_0_0, buildVersion));
|
||||
}
|
||||
|
||||
public static ArrayList<Library> getChangeLog(Context context) {
|
||||
library = new ArrayList<Library>();
|
||||
new ChangeLog(context);
|
||||
|
||||
return library;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,433 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.UserHelp.UserHelp;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.odr.tool.Constants;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.adins.mss.constant.Global.SHOW_USERHELP_DELAY_DEFAULT;
|
||||
|
||||
|
||||
public class CheckOrderActivity extends Fragment implements OnClickListener, OnItemSelectedListener{
|
||||
|
||||
class DateClickListener implements View.OnClickListener {
|
||||
private final EditText mTarget;
|
||||
private final Context mContext;
|
||||
|
||||
public DateClickListener(Context context, EditText target) {
|
||||
mContext = context;
|
||||
mTarget = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DatePickerDialog dialog = new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||
mTarget.setText(dayOfMonth + "/" + Tool.appendZeroForDateTime(monthOfYear, true) + "/" + year);
|
||||
}
|
||||
}, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public static final String keyCustName = "EXTRA_CUST_NAME_KEY";
|
||||
protected EditText txtStartDate;
|
||||
protected EditText txtEndDate;
|
||||
protected EditText txtNomorOrder;
|
||||
protected Spinner spinnerSearch;
|
||||
private EditText txtNamaCustomer;
|
||||
private String[] isiSearchBy;
|
||||
private Button btnSearch;
|
||||
private ImageView btnStartDate;
|
||||
private ImageView btnEndDate;
|
||||
private RelativeLayout byDateLayout;
|
||||
private LinearLayout byNomorLayout;
|
||||
protected View view;
|
||||
private LinearLayout byNamaLayout, container;
|
||||
private FirebaseAnalytics screenName;
|
||||
private com.google.android.material.bottomnavigation.BottomNavigationView bottomNav;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
bottomNav.getMenu().findItem(com.adins.mss.odr.R.id.taskListNav).setEnabled(true);
|
||||
Utility.freeMemory();
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
view = inflater.inflate(R.layout.check_order, container, false);
|
||||
getActivity().setTitle(R.string.title_mn_checkorder);
|
||||
txtStartDate = (EditText)view.findViewById(R.id.txtStartDate);
|
||||
txtEndDate = (EditText)view.findViewById(R.id.txtEndDate);
|
||||
txtNomorOrder = (EditText)view.findViewById(R.id.txtNomorOrder);
|
||||
txtNamaCustomer = (EditText) view.findViewById(R.id.txtCustomerName);
|
||||
btnSearch = (Button)view.findViewById(R.id.btnSearchOrder);
|
||||
btnStartDate =(ImageView)view.findViewById(R.id.btnStartDate);
|
||||
btnEndDate=(ImageView)view.findViewById(R.id.btnEndDate);
|
||||
spinnerSearch=(Spinner)view.findViewById(R.id.cbSearchBy);
|
||||
byDateLayout=(RelativeLayout) view.findViewById(R.id.byDate);
|
||||
byNomorLayout=(LinearLayout) view.findViewById(R.id.byNoOrder);
|
||||
byNamaLayout = (LinearLayout) view.findViewById(R.id.byCustName);
|
||||
bottomNav = getActivity().findViewById(com.adins.mss.odr.R.id.bottomNav);
|
||||
|
||||
btnStartDate.setOnClickListener(new DateClickListener(getActivity(), txtStartDate));
|
||||
btnEndDate.setOnClickListener(new DateClickListener(getActivity(), txtEndDate));
|
||||
|
||||
btnSearch.setOnClickListener(this);
|
||||
|
||||
this.container = view.findViewById(R.id.container);
|
||||
this.container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(CheckOrderActivity.this.getActivity(),CheckOrderActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
}
|
||||
});
|
||||
isiSearchBy = this.getResources().getStringArray(R.array.cbSearchBy);
|
||||
// ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(
|
||||
// getActivity(), R.array.cbSearchBy,
|
||||
// R.layout.spinner_style);
|
||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), R.layout.spinner_style, R.id.text_spin, getResources().getStringArray(R.array.cbSearchBy)) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
|
||||
textView.setTextColor(Color.WHITE);
|
||||
|
||||
return textView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
|
||||
textView.setTextColor(Color.BLACK);
|
||||
|
||||
return textView;
|
||||
}
|
||||
};
|
||||
|
||||
// ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), R.layout.spinner_style, R.id.text_spin, R.array.cbSearchBy){
|
||||
//
|
||||
// @Override
|
||||
// public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
//
|
||||
// textView.setTextColor(Color.WHITE);
|
||||
//
|
||||
// return textView;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public View getDropDownView(int position, View convertView, ViewGroup parent){
|
||||
// // Cast the drop down items (popup items) as text view
|
||||
// TextView tv = (TextView) super.getDropDownView(position,convertView,parent);
|
||||
//
|
||||
// // Set the text color of drop down items
|
||||
// tv.setTextColor(Color.RED);
|
||||
//
|
||||
// // If this item is selected item
|
||||
//// if(position == mSelectedIndex){
|
||||
//// // Set spinner selected popup item's text color
|
||||
//// tv.setTextColor(Color.BLUE);
|
||||
//// }
|
||||
//
|
||||
// // Return the modified view
|
||||
// return tv;
|
||||
// }
|
||||
// };
|
||||
|
||||
spinnerSearch.setAdapter(adapter);
|
||||
spinnerSearch.setOnItemSelectedListener(this);
|
||||
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_check_order), null);
|
||||
bottomNav.getMenu().findItem(com.adins.mss.odr.R.id.taskListNav).setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
Global.haveLogin = 1;
|
||||
}
|
||||
|
||||
protected void disableCheckOrderBtn(){
|
||||
bottomNav.getMenu().findItem(com.adins.mss.odr.R.id.taskListNav).setEnabled(true);
|
||||
}
|
||||
|
||||
protected Intent getNextActivityIntent(){
|
||||
// return new Intent(getActivity().getApplicationContext(), ResultActivity.class);
|
||||
bottomNav.getMenu().findItem(com.adins.mss.odr.R.id.taskListNav).setEnabled(true);
|
||||
return new Intent(getActivity().getApplicationContext(), ResultOrderActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
int id = v.getId();
|
||||
if(id==R.id.btnSearchOrder){
|
||||
StringBuffer errorMessage = new StringBuffer();
|
||||
if (spinnerSearch.getSelectedItemPosition()==0) {
|
||||
if (txtStartDate.getText().toString().length()==0){
|
||||
errorMessage.append(getString(R.string.start_date_required));
|
||||
}
|
||||
if(txtEndDate.getText().toString().length()==0){
|
||||
errorMessage.append(getString(R.string.end_date_required));
|
||||
}
|
||||
try {
|
||||
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||
Date sDate,eDate;
|
||||
long sLong = 0;
|
||||
long eLong=0;
|
||||
try {
|
||||
sDate = f.parse(txtStartDate.getText().toString());
|
||||
eDate = f.parse(txtEndDate.getText().toString());
|
||||
eDate.setHours(23);
|
||||
eDate.setMinutes(59);
|
||||
eDate.setSeconds(59);
|
||||
sLong = sDate.getTime();
|
||||
eLong = eDate.getTime();
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
long milisecond=eLong-sLong;
|
||||
if(milisecond>604799000){
|
||||
errorMessage.append(getString(R.string.data_range_not_allowed));
|
||||
}
|
||||
else if(milisecond<0){
|
||||
errorMessage.append(getString(R.string.input_not_valid));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
} else if (spinnerSearch.getSelectedItemPosition() == 1) {
|
||||
if(txtNomorOrder.getText().toString().length()==0){
|
||||
errorMessage.append(getString(R.string.nomor_order_rewuired));
|
||||
}
|
||||
} else if (spinnerSearch.getSelectedItemPosition() == 2) {
|
||||
if(txtNamaCustomer.getText().toString().length() == 0) {
|
||||
errorMessage.append(getString(R.string.cust_name_required));
|
||||
} else if (txtNamaCustomer.getText().toString().length() < 3){
|
||||
errorMessage.append(getString(R.string.cust_name_minimun_required));
|
||||
}
|
||||
}
|
||||
if(errorMessage!=null&&errorMessage.length()>0){
|
||||
Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
Intent nextActivity = getNextActivityIntent();
|
||||
|
||||
nextActivity.putExtra("startDate", txtStartDate.getText().toString());
|
||||
nextActivity.putExtra("endDate", txtEndDate.getText().toString());
|
||||
nextActivity.putExtra("nomorOrder", txtNomorOrder.getText().toString());
|
||||
nextActivity.putExtra(keyCustName, txtNamaCustomer.getText().toString());
|
||||
|
||||
startActivity(nextActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View v, int position,
|
||||
long id) {
|
||||
long itemSearchBy = spinnerSearch.getItemIdAtPosition(position);
|
||||
if (itemSearchBy == 1){
|
||||
byDateLayout.setVisibility(View.GONE);
|
||||
byNomorLayout.setVisibility(View.VISIBLE);
|
||||
byNamaLayout.setVisibility(View.GONE);
|
||||
} else if (itemSearchBy == 0){
|
||||
byDateLayout.setVisibility(View.VISIBLE);
|
||||
byNomorLayout.setVisibility(View.GONE);
|
||||
byNamaLayout.setVisibility(View.GONE);
|
||||
} else if (itemSearchBy == 2) {
|
||||
byDateLayout.setVisibility(View.GONE);
|
||||
byNomorLayout.setVisibility(View.GONE);
|
||||
byNamaLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
txtStartDate.setText("");
|
||||
txtEndDate.setText("");
|
||||
txtNamaCustomer.setText("");
|
||||
txtNomorOrder.setText("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if(item.getItemId() == R.id.mnGuide){
|
||||
if(!Global.BACKPRESS_RESTRICTION) {
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(CheckOrderActivity.this.getActivity(), CheckOrderActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(CheckOrderActivity.this.getActivity(), CheckOrderActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public class DatePickerDialogCustom extends DialogFragment{
|
||||
|
||||
int id;
|
||||
String startDate ="";
|
||||
String endDate ="";
|
||||
private DatePickerDialog.OnDateSetListener mStartDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear,
|
||||
int dayOfMonth) {
|
||||
String month = Tool.appendZeroForDateTime(monthOfYear, true);
|
||||
startDate = dayOfMonth + "/" + month + "/" + year;
|
||||
txtStartDate.setText(startDate);
|
||||
|
||||
}
|
||||
};
|
||||
private DatePickerDialog.OnDateSetListener mEndDateSetListener =
|
||||
new DatePickerDialog.OnDateSetListener() {
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear,
|
||||
int dayOfMonth) {
|
||||
String month = Tool.appendZeroForDateTime(monthOfYear, true);
|
||||
endDate = dayOfMonth + "/" + month + "/" + year;
|
||||
txtEndDate.setText(endDate);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String key = getArguments().getString(Constants.KEY_DATE);
|
||||
int id=0;
|
||||
if(key.equals(Constants.KEY_START_DATE))
|
||||
id = getArguments().getInt(Constants.KEY_START_DATE);
|
||||
else if(key.equals(Constants.KEY_END_DATE))
|
||||
id = getArguments().getInt(Constants.KEY_END_DATE);
|
||||
|
||||
return DatePickerDialog(id);
|
||||
}
|
||||
|
||||
public Dialog DatePickerDialog(int id){
|
||||
Date sysdate =new Date(System.currentTimeMillis());
|
||||
DatePickerDialog datePicker = null;
|
||||
String sdt = Formatter.formatDate(sysdate, "dd/MM/yyyy");
|
||||
String[] temp1 = sdt.split("/");
|
||||
final int DayOfMonth = Integer.parseInt(temp1[0]);
|
||||
final int Month = Integer.parseInt((temp1[1])) - 1;
|
||||
final int Year = Integer.parseInt(temp1[2]);
|
||||
if (id==Constants.START_DATE_DIALOG_ID) {
|
||||
datePicker = new DatePickerDialog(getActivity(), mStartDateSetListener, Year, Month, DayOfMonth)
|
||||
{
|
||||
@Override
|
||||
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
|
||||
{
|
||||
if (year > Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (monthOfYear > Month && year == Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (dayOfMonth > DayOfMonth && year == Year && monthOfYear == Month)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (id==Constants.END_DATE_DIALOG_ID) {
|
||||
|
||||
datePicker = new DatePickerDialog(getActivity(), mEndDateSetListener, Year, Month, DayOfMonth)
|
||||
{
|
||||
@Override
|
||||
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
|
||||
{
|
||||
|
||||
if (year > Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (monthOfYear > Month && year == Year)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
if (dayOfMonth > DayOfMonth && year == Year && monthOfYear == Month)
|
||||
view.updateDate(Year, Month, DayOfMonth);
|
||||
}
|
||||
};
|
||||
}
|
||||
return datePicker;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by winy.firdasari on 20/01/2015.
|
||||
*/
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
|
||||
private Context _context;
|
||||
private List<String> _listDataHeader; // header titles
|
||||
// child data in format of header title, child title
|
||||
private HashMap<String, List<String>> _listDataChild;
|
||||
|
||||
public ExpandableListAdapter(Context context, List<String> listDataHeader,
|
||||
HashMap<String, List<String>> listChildData) {
|
||||
this._context = context;
|
||||
this._listDataHeader = listDataHeader;
|
||||
this._listDataChild = listChildData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosititon) {
|
||||
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
|
||||
.get(childPosititon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
return childPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(int groupPosition, final int childPosition,
|
||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
|
||||
final String childText = (String) getChild(groupPosition, childPosition);
|
||||
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) this._context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.result_order_list_item, null);
|
||||
}
|
||||
|
||||
TextView txtListChild = (TextView) convertView
|
||||
.findViewById(R.id.txtStatusOrder);
|
||||
|
||||
txtListChild.setText(childText);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
|
||||
.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGroup(int groupPosition) {
|
||||
return this._listDataHeader.get(groupPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
return this._listDataHeader.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded,
|
||||
View convertView, ViewGroup parent) {
|
||||
String headerTitle = (String) getGroup(groupPosition);
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) this._context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.result_order_list, null);
|
||||
}
|
||||
|
||||
TextView lblListHeader = (TextView) convertView
|
||||
.findViewById(R.id.txtOrderList);
|
||||
lblListHeader.setTypeface(null, Typeface.BOLD);
|
||||
lblListHeader.setText(headerTitle);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JsonRequestNews extends MssRequestType{
|
||||
|
||||
@SerializedName("uuid_mobile_content_h")
|
||||
String uuid_mobile_content_h;
|
||||
@SerializedName("listContentHeader")
|
||||
List<MobileContentH> listContentHeader;
|
||||
|
||||
public List<MobileContentH> getListContentHeader() {
|
||||
return listContentHeader;
|
||||
}
|
||||
public void setListContentHeader(List<MobileContentH> listContentHeader) {
|
||||
this.listContentHeader = listContentHeader;
|
||||
}
|
||||
public String getuuid_mobile_content_h(){
|
||||
return uuid_mobile_content_h;
|
||||
}
|
||||
public void setuuid_mobile_content_h(String uuid_mobile_content_h){
|
||||
this.uuid_mobile_content_h = uuid_mobile_content_h;
|
||||
}
|
||||
// public class ContentHeader extends ContentHeaderBean{
|
||||
// public ContentHeader(MobileContentH contentH){
|
||||
// super(contentH);
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.LoginActivity;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.dynamictheme.DynamicTheme;
|
||||
import com.adins.mss.base.dynamictheme.ThemeLoader;
|
||||
import com.adins.mss.base.login.DefaultLoginModel;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.security.storepreferences.ObscuredSharedPreferences;
|
||||
import com.adins.mss.odr.login.MODefaultLoginModel;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MOLoginActivity extends LoginActivity implements ThemeLoader.ColorSetLoaderCallback{
|
||||
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
//instantiate theme loader
|
||||
themeLoader = new ThemeLoader(this);
|
||||
|
||||
defaultConfig = new HashMap<>();
|
||||
defaultConfig.put("cipher_unsupported_device", Global.SQLITE_CIPHER_UNSUPPORTED);
|
||||
this.fetchConfig();
|
||||
|
||||
PackageInfo pInfo = null;
|
||||
String sqliteCipherException;
|
||||
String deviceModel = Build.MODEL;
|
||||
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
|
||||
try {
|
||||
sqliteCipherException = GlobalData.getSharedGlobalData().getRemoteConfig().getString("cipher_unsupported_device");
|
||||
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
Global.APP_VERSION = pInfo.versionName;
|
||||
Global.BUILD_VERSION = pInfo.versionCode;
|
||||
Global.IS_DEV = BuildConfig.IS_DEV;
|
||||
Global.FLAVORS = BuildConfig.IS_FLAVORS;
|
||||
Global.IS_BYPASSROOT = BuildConfig.IS_BYPASSROOT;
|
||||
Global.IS_DBENCRYPT = (!sqliteCipherException.contains(deviceModel)) && BuildConfig.IS_DBENCRYPT;
|
||||
} catch (PackageManager.NameNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
if (Global.AUTOLOGIN_ENABLE) {
|
||||
NewMainActivity.setMainMenuClass(NewMOMainActivity.class);
|
||||
ObscuredSharedPreferences sharedPref = ObscuredSharedPreferences.getPrefs(getApplicationContext(),
|
||||
"GlobalData", Context.MODE_PRIVATE);
|
||||
hasLogged = sharedPref.getBoolean("HAS_LOGGED", false);
|
||||
if(hasLogged && GlobalData.getSharedGlobalData().getUser() != null){
|
||||
super.onCreate(savedInstanceState);
|
||||
NewMainActivity.InitializeGlobalDataIfError(getApplicationContext());
|
||||
//check theme config.
|
||||
String uuidUser = GlobalData.getSharedGlobalData().getUser() == null ? sharedPref.getString("UUID_USER", "") : GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
GeneralParameter generalParameter = GeneralParameterDataAccess.getOne(this,
|
||||
uuidUser,
|
||||
Global.GS_THEME_CONFIG_ORDER);
|
||||
|
||||
if(generalParameter != null){
|
||||
String urlConfig = generalParameter.getGs_value();
|
||||
themeLoader.loadThemeFromUrl(urlConfig,this);
|
||||
}
|
||||
else {//go to main activity
|
||||
Intent intent = new Intent(getApplicationContext(), NewMOMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
else {//load directly login page and load saved theme
|
||||
super.onCreate(savedInstanceState);
|
||||
logo.setImageResource(com.adins.mss.base.R.drawable.icon_lead_in);
|
||||
loadSavedTheme();
|
||||
}
|
||||
}else {//load directly login page and load saved theme
|
||||
super.onCreate(savedInstanceState);
|
||||
logo.setImageResource(com.adins.mss.base.R.drawable.icon_lead_in);
|
||||
loadSavedTheme();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSavedTheme(){
|
||||
if(themeLoader != null){
|
||||
themeLoader.loadSavedColorSet(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultLoginModel getNewDefaultLoginModel(Context context) {
|
||||
return new MODefaultLoginModel(this);
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this,getString(R.string.screen_name_odr_login),null);
|
||||
|
||||
defaultConfig = new HashMap<>();
|
||||
defaultConfig.put("cipher_unsupported_device", Global.SQLITE_CIPHER_UNSUPPORTED);
|
||||
this.fetchConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHasLoaded(DynamicTheme dynamicTheme, boolean needUpdate) {//callback load from server
|
||||
Intent intent = new Intent(getApplicationContext(), NewMOMainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHasLoaded(DynamicTheme dynamicTheme) {//callback load from local db
|
||||
if(dynamicTheme != null && dynamicTheme.getThemeItemList().size() > 0){
|
||||
applyColorTheme(dynamicTheme);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,452 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.adins.mss.base.ChangePasswordFragment;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuHelper;
|
||||
import com.adins.mss.base.tasklog.TaskLogImpl;
|
||||
import com.adins.mss.base.timeline.MenuAdapter;
|
||||
import com.adins.mss.base.timeline.MenuModel;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.StatusTabFragment;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.odr.assignment.OrderAssignmentTask;
|
||||
import com.adins.mss.odr.news.NewsHeaderTask;
|
||||
import com.adins.mss.odr.simulasi.CreditSimulationActivity;
|
||||
import com.services.MainServices;
|
||||
import com.services.NotificationThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MOMainMenuActivity extends MainMenuActivity {
|
||||
|
||||
public static MenuModel mnTimeline;
|
||||
public static MenuModel mnNewOdr;
|
||||
public static MenuModel mnCheckOdr;
|
||||
public static MenuModel mnCreditSimulation;
|
||||
public static MenuModel mnOdrAssignment;
|
||||
public static MenuModel mnOdrReAssignment;
|
||||
public static MenuModel mnUpdateOdr;
|
||||
public static MenuModel mnAbsentI;
|
||||
public static MenuModel mnAbsentO;
|
||||
public static MenuModel mnNews;
|
||||
public static MenuModel mnExit;
|
||||
public static MenuModel mnAbout;
|
||||
public static MenuModel mnSynchronize;
|
||||
public static MenuModel mnStgProfile;
|
||||
public static MenuModel mnChangePassword;
|
||||
public static int flag_edit = 0;
|
||||
public static boolean inAbsent = false;
|
||||
public Intent RunNotificationNewsService;
|
||||
Fragment fragment;
|
||||
ChangePasswordFragment fragmentChgPwd;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListLeft;
|
||||
|
||||
@Override
|
||||
protected ArrayList<MenuModel> getModels() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
ArrayList<MenuModel> models = new ArrayList<MenuModel>();
|
||||
MenuModel titleGroup1 = new MenuModel(getString(R.string.title_mn_main_menu));
|
||||
titleGroup1.isGroupHeader();
|
||||
MenuModel titleGroup2 = new MenuModel(getString(R.string.title_mn_other));
|
||||
titleGroup2.isGroupHeader();
|
||||
|
||||
mnTimeline = new MenuModel(R.drawable.ic_home, getString(R.string.title_mn_home), null);
|
||||
models.add(titleGroup1);
|
||||
models.add(mnTimeline);
|
||||
List<String> mainMenuTitle = getMainMenuTitle();
|
||||
List<Integer> mainMenuIcon = getMainMenuIcon();
|
||||
for (int i = 0; i < mainMenuTitle.size(); i++) {
|
||||
if (mainMenuTitle.get(i).equalsIgnoreCase(getString(R.string.title_mn_tasklist))) {
|
||||
mnTaskList = new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), "0");
|
||||
models.add(mnTaskList);
|
||||
} else if (getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_log))) {
|
||||
mnLog = new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), "0");
|
||||
models.add(mnLog);
|
||||
} else {
|
||||
models.add(new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), null));
|
||||
}
|
||||
}
|
||||
|
||||
models.add(titleGroup2);
|
||||
List<String> otherMenuTitle = getOtherMenuTitle();
|
||||
List<Integer> otherMenuIcon = getOtherMenuIcon();
|
||||
// mnChangePassword = new MenuModel(R.drawable.ic_changepassword,getString(R.string.title_mn_changepassword), null);
|
||||
// models.add(mnChangePassword);
|
||||
for (int i = 0; i < otherMenuTitle.size(); i++) {
|
||||
models.add(new MenuModel(otherMenuIcon.get(i), otherMenuTitle.get(i), null));
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
this.allMenu.add(models.get(i).getTitle());
|
||||
}
|
||||
|
||||
this.models = models;
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitleGroup() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Order";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
super.onCreate(savedInstanceState);
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 1);
|
||||
mDrawerLayout = findViewById(R.id.drawer_layout);
|
||||
mDrawerListLeft = findViewById(R.id.left_drawer);
|
||||
menuAdapter = new MenuAdapter(this, getModels(), R.drawable.activated_background_indicator);
|
||||
mDrawerListLeft.setAdapter(menuAdapter);
|
||||
|
||||
mDrawerListLeft.setOnItemClickListener(this);
|
||||
|
||||
//setcounter
|
||||
try {
|
||||
long newsCounter = News.getCounterNews(this);
|
||||
long logCounter = TaskLogImpl.getCounterLog(this);
|
||||
long taskListCounter = ToDoList.getCounterTaskList(this);
|
||||
|
||||
// MOMainMenuActivity.mnNews.setCounter(String.valueOf(newsCounter));
|
||||
mnLog.setCounter(String.valueOf(logCounter));
|
||||
mnTaskList.setCounter(String.valueOf(taskListCounter));
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
goTimeline(1);
|
||||
Global.positionStack.push(1);
|
||||
}
|
||||
|
||||
/*System.out.println("Before start RunNotificationNewsService");
|
||||
RunNotificationNewsService = new Intent(this, NotificationNewsService.class);
|
||||
startService(RunNotificationNewsService);
|
||||
System.out.println("Start RunNotificationNewsService");*/
|
||||
try {
|
||||
actionFromNotif(getIntent());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionFromNotif(Intent intent) {
|
||||
try {
|
||||
String action = intent.getAction();
|
||||
if (action != null) {
|
||||
if (action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)) {
|
||||
gotoTaskList(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
actionFromNotif(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Global.syncIntent = new Intent(getApplicationContext(), MOSynchronizeActivity.class);
|
||||
if (MainMenuActivity.getMss() == null) {
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
// NotificationService.mss = mss;
|
||||
MainServices.mainClass = mss;
|
||||
}
|
||||
MainMenuActivity.setMainMenuClass(MOMainMenuActivity.class);
|
||||
try {
|
||||
final long logCounter = TaskLogImpl.getCounterLog(this);
|
||||
final long taskListCounter = ToDoList.getCounterTaskList(this);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mnLog.setCounter(String.valueOf(logCounter));
|
||||
mnTaskList.setCounter(String.valueOf(taskListCounter));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
getActionBar().removeAllTabs();
|
||||
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, final int position,
|
||||
long id) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onItemClick(parent, view, position, id);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getString(R.string.title_mn_changepassword).equalsIgnoreCase(allMenu.get(position))) {
|
||||
gotoChangePassword();
|
||||
}
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(this, MOSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
//bong 10 apr 15 - menjaga saat change password tidak dapat lihat menu
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
if (fragmentChgPwd != null) {
|
||||
if (fragmentChgPwd.isVisible()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
//bong 7 apr 15 disabled onBackpressed on fragment
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// TODO Auto-generated method stub
|
||||
if (fragmentChgPwd != null) {
|
||||
if (fragmentChgPwd.isVisible()) {
|
||||
if (GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")) {
|
||||
ChangePasswordFragment.onBackPressed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void gotoChangePassword() {
|
||||
fragment = new ChangePasswordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ChangePasswordFragment.AS_ACTIVITY, false);
|
||||
fragment.setArguments(args);
|
||||
if (GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1") ||
|
||||
GlobalData.getSharedGlobalData().getUser().getPwd_exp().equals("1")) {
|
||||
fragmentChgPwd = (ChangePasswordFragment) fragment;
|
||||
fragmentChgPwd.setArguments(args);
|
||||
}
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Fragment getChgPassFragment() {
|
||||
// TODO Auto-generated method stub
|
||||
return fragmentChgPwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void goTimeline(int position) {
|
||||
// TimelineModel.status_fragment=new StatusSectionFragment();
|
||||
super.goTimeline(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNewTask(int position) {
|
||||
// GetSchemeTask task = new GetSchemeTask(this, new MONewTaskActivity(), true);
|
||||
// task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCheckOrder(int position) {
|
||||
fragment = new CheckOrderActivity();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCreditSimulation(int position) {
|
||||
fragment = new CreditSimulationActivity();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCancelOrder(int position) {
|
||||
fragment = new OrderFilterActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_CANCEL_ORDER);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoTaskList(int position) {
|
||||
fragment = new StatusTabFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPromo(int position) {
|
||||
NewsHeaderTask task = new NewsHeaderTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNews(int position) {
|
||||
NewsHeaderTask task = new NewsHeaderTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoAbout() {
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 1);
|
||||
super.gotoAbout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyPerformance(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerification(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApproval(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderAssignment(int position) {
|
||||
OrderAssignmentTask task = new OrderAssignmentTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderReassignment(int position) {
|
||||
fragment = new OrderFilterActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_ORDER_REASSIGNMENT);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyAssignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyReassignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoReportSummary(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoDepositReport(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPaymentHistory(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoInstallmentSchedule(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoClosingTask(int position) {
|
||||
|
||||
}
|
||||
|
||||
public void showNotAvailableMenu(int position) {
|
||||
MainMenuHelper.showNotAvailableMenuDialog(MOMainMenuActivity.this, allMenu.get(position));
|
||||
Global.positionStack.pop();
|
||||
mDrawerListLeft.setItemChecked(Global.positionStack.lastElement(), true);
|
||||
setTitle(models.get(Global.positionStack.lastElement()).getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerificationByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApprovalByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.dialogfragments.NewTaskDialog;
|
||||
import com.adins.mss.base.todo.form.NewTaskAdapter;
|
||||
import com.adins.mss.base.todolist.DoList;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Scheme;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MONewTaskActivity extends NewTaskDialog {
|
||||
private DoList list;
|
||||
private List<Scheme> objects;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewTaskAdapter getNewTaskAdapter() {
|
||||
list = new DoList(getActivity());
|
||||
if (Global.isNewlead) {
|
||||
objects = list.getMarketingListScheme();
|
||||
} else {
|
||||
objects = list.getOrderListScheme();
|
||||
}
|
||||
|
||||
return new NewTaskAdapter(getActivity(), objects);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.adins.mss.base.SynchronizeActivity;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.Trace;
|
||||
|
||||
public class MOSynchronizeActivity extends SynchronizeActivity{
|
||||
|
||||
private Trace synchronizeOrdTrace;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected Intent getIntentMainMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(this, NewMOMainActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
synchronizeOrdTrace = FirebasePerformance.getInstance().newTrace(getString(R.string.synchronize_trace_order));
|
||||
activity = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this,getString(com.adins.mss.base.R.string.screen_name_odr_synchronize),null);
|
||||
synchronizeOrdTrace.start();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
synchronizeOrdTrace.stop();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
public class MainActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,345 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.mainmenu.NewMenuItem;
|
||||
import com.adins.mss.base.timeline.NewTimelineFragment;
|
||||
import com.adins.mss.base.todo.form.GetSchemeTask;
|
||||
import com.adins.mss.base.todolist.form.NewToDoListTabFragment;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.odr.accounts.GetAccount;
|
||||
import com.adins.mss.odr.catalogue.api.GetPromo;
|
||||
import com.adins.mss.odr.followup.FragmentFollowUpSearch;
|
||||
import com.adins.mss.odr.marketingreport.MarketingReportFragment;
|
||||
import com.adins.mss.odr.news.NewsHeaderTask;
|
||||
import com.adins.mss.odr.opportunities.FragmentOpportunities;
|
||||
import com.adins.mss.odr.products.FragmentProduct;
|
||||
import com.adins.mss.base.loyalti.mypointdashboard.DashboardMyPoint;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.services.ForegroundServiceNotification;
|
||||
import com.services.MOApplicationRunningService;
|
||||
import com.services.MainServices;
|
||||
import com.services.NotificationThread;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by Wendy.Alexander on 02/10/2019.
|
||||
*/
|
||||
public class NewMOMainActivity extends NewMainActivity {
|
||||
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
NewMainActivity.setMss(this.getClass());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
navigation = findViewById(com.adins.mss.base.R.id.bottomNav);
|
||||
navigation.getMenu().findItem(R.id.taskListNav).setTitle("Check Order");
|
||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
|
||||
navCounter = findViewById(com.adins.mss.base.R.id.counter);
|
||||
navCounter.setVisibility(View.INVISIBLE);
|
||||
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 1);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
Fragment frag = new NewTimelineFragment();
|
||||
FragmentTransaction trans = fragmentManager.beginTransaction();
|
||||
trans.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
||||
trans.add(com.adins.mss.base.R.id.content_frame, frag);
|
||||
trans.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try {
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
if (null == locale) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
}
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this, getString(R.string.screen_name_odr_main_menu), null);
|
||||
|
||||
if (Global.REDIRECT_TIMELINE.equals(Global.getREDIRECT())) {
|
||||
super.openTimeline();
|
||||
Global.setREDIRECT(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ForegroundServiceNotification.isServiceAvailable(this, MOApplicationRunningService.class)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(getLocationServiceIntent());
|
||||
} else {
|
||||
startService(getLocationServiceIntent());
|
||||
}
|
||||
}
|
||||
|
||||
Global.syncIntent = new Intent(getApplicationContext(), MOSynchronizeActivity.class);
|
||||
if (NewMainActivity.getMss() == null) {
|
||||
NewMainActivity.setMss(this.getClass());
|
||||
MainServices.mainClass = mss;
|
||||
}
|
||||
NewMainActivity.setMainMenuClass(NewMOMainActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent getLocationServiceIntent() {
|
||||
//Location service turned off for MO, Application Running Notification instead
|
||||
return new Intent(this, MOApplicationRunningService.class);
|
||||
}
|
||||
|
||||
protected void actionFromNotif(Intent intent) {
|
||||
try {
|
||||
String action = intent.getAction();
|
||||
if (action != null) {
|
||||
if (action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)) {
|
||||
if (Global.PLAN_TASK_ENABLED) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.mn_plantask));
|
||||
} else {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_tasklist));
|
||||
}
|
||||
|
||||
Fragment fragment1 = new NewToDoListTabFragment();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commitAllowingStateLoss();
|
||||
} else if (action.equals(Global.MAINMENU_NOTIFICATION_KEY)) {
|
||||
gotoTimeline();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
actionFromNotif(intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
return new Intent(this, MOSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ApplicationMenu(NewMenuItem menuItem) {
|
||||
super.ApplicationMenu(menuItem);
|
||||
Global.isNewlead = false;
|
||||
if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_newlead))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_newlead));
|
||||
gotoNewLead();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_account))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_account));
|
||||
gotoAccount();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_followup))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_followup));
|
||||
gotoFollowUp();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_marketingreport))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_marketingreport));
|
||||
gotoMktReport();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_catalogue))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_catalogue));
|
||||
gotoCatalogue();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_products))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_products));
|
||||
gotoProducts();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_opportunities))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_opportunities));
|
||||
gotoOpportunities();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_cancelorder))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_cancelorder));
|
||||
gotoCancelOrder();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_checkorder))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_checkorder));
|
||||
gotoCheckOrder();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_promo))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_promo));
|
||||
gotoPromo();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(com.adins.mss.base.R.string.title_mn_neworder))) {
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_neworder));
|
||||
gotoNewTask();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_dashboard))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_dashboard));
|
||||
goToDashboardMyPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoOpportunities() {
|
||||
fragment = new FragmentOpportunities();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale,
|
||||
com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoNewLead() {
|
||||
Global.isNewlead = true;
|
||||
GetSchemeTask task = new GetSchemeTask(this, new MONewTaskActivity(), true);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoTimeline() {
|
||||
super.gotoTimeline();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoAbout() {
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(this), 1);
|
||||
super.gotoAbout();
|
||||
}
|
||||
|
||||
protected void gotoAccount() {
|
||||
GetAccount task = new GetAccount(this);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
protected void gotoFollowUp() {
|
||||
fragment = new FragmentFollowUpSearch();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale,
|
||||
com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoMktReport() {
|
||||
fragment = new MarketingReportFragment();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale,
|
||||
com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoCatalogue() {
|
||||
GetPromo task = new GetPromo(this);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
private void gotoProducts() {
|
||||
fragment = new FragmentProduct();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale,
|
||||
com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoCancelOrder() {
|
||||
fragment = new OrderFilterActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_CANCEL_ORDER);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction
|
||||
.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoCheckOrder() {
|
||||
fragment = new CheckOrderActivity();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction
|
||||
.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoNewTask() {
|
||||
Global.isNewlead = false;
|
||||
GetSchemeTask task = new GetSchemeTask(this, new MONewTaskActivity(), true);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
protected void gotoPromo() {
|
||||
NewsHeaderTask task = new NewsHeaderTask(this, getResources().getString(R.string.progressWait), getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
protected void goToDashboardMyPoint(){
|
||||
fragment = new DashboardMyPoint();
|
||||
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale,
|
||||
R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
if (Global.BACKPRESS_RESTRICTION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = menuItem.getItemId();
|
||||
if (i == com.adins.mss.base.R.id.timelineNav) {
|
||||
gotoTimeline();
|
||||
return true;
|
||||
} else if (i == com.adins.mss.base.R.id.menuNav) {
|
||||
gotoMainMenu();
|
||||
return true;
|
||||
} else if (i == com.adins.mss.base.R.id.taskListNav) {
|
||||
gotoCheckOrder();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,154 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.UserHelp.UserHelp;
|
||||
import com.adins.mss.odr.reassignment.OrderReassignmentResult;
|
||||
import com.adins.mss.odr.update.ResultUpdateActivity;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import static com.adins.mss.constant.Global.SHOW_USERHELP_DELAY_DEFAULT;
|
||||
|
||||
public class OrderFilterActivity extends CheckOrderActivity{
|
||||
private int taskType;
|
||||
private Spinner cbSearchByStatus;
|
||||
private String[] contentStatusFilter;
|
||||
private TextView labelSearchByStatus;
|
||||
private RelativeLayout layoutFilterByStatus;
|
||||
private Bundle mArguments;
|
||||
private LinearLayout container;
|
||||
private FirebaseAnalytics screenName;
|
||||
// private View view;
|
||||
public OrderFilterActivity() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
setHasOptionsMenu(true);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
mArguments = getArguments();
|
||||
taskType = mArguments.getInt(Global.BUND_KEY_TASK_TYPE, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
// if(taskType==Global.TASK_CANCEL_ORDER){
|
||||
// addStatusFilter();
|
||||
// }
|
||||
|
||||
this.container = view.findViewById(R.id.container);
|
||||
this.container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(OrderFilterActivity.this.getActivity(),OrderFilterActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void addStatusFilter() {
|
||||
labelSearchByStatus = (TextView)view.findViewById(R.id.lblSearchByStatus);
|
||||
cbSearchByStatus = (Spinner)view.findViewById(R.id.cbSearcrByStatus);
|
||||
layoutFilterByStatus = (RelativeLayout)view.findViewById(R.id.filterByStatus);
|
||||
labelSearchByStatus.setVisibility(View.VISIBLE);
|
||||
layoutFilterByStatus.setVisibility(View.VISIBLE);
|
||||
ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource
|
||||
(getActivity(), R.array.cbSearchByStatus,R.layout.spinner_style);
|
||||
cbSearchByStatus.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getNextActivityIntent() {
|
||||
Intent intent =null;
|
||||
if(taskType==Global.TASK_CANCEL_ORDER){
|
||||
intent = new Intent(getActivity(), ResultUpdateActivity.class);
|
||||
intent.putExtra(Global.BUND_KEY_TASK_TYPE, taskType);
|
||||
// int selectedItemPosition = cbSearchByStatus.getSelectedItemPosition();
|
||||
// String keySearchBy = "";
|
||||
// if(0==selectedItemPosition){
|
||||
// keySearchBy = "ALL";
|
||||
// }else if(1==selectedItemPosition){
|
||||
// keySearchBy = "OnSurvey";
|
||||
// }else if(2==selectedItemPosition){
|
||||
// keySearchBy = "OnCA";
|
||||
// }
|
||||
//
|
||||
// intent.putExtra("status", keySearchBy);
|
||||
}else if(taskType==Global.TASK_ORDER_REASSIGNMENT){
|
||||
intent = new Intent(getActivity(), OrderReassignmentResult.class);
|
||||
intent.putExtra(Global.BUND_KEY_TASK_TYPE, taskType);
|
||||
}
|
||||
|
||||
return intent;
|
||||
}
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
// getActivity().getActionBar().removeAllTabs();
|
||||
if(taskType==Global.TASK_CANCEL_ORDER){
|
||||
getActivity().setTitle(getString(R.string.title_mn_cancelorder));
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_cancel_order), null);
|
||||
disableCheckOrderBtn();
|
||||
}
|
||||
else if(taskType==Global.TASK_ORDER_REASSIGNMENT){
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_order_reassignment), null);
|
||||
getActivity().setTitle(getString(R.string.title_mn_orderreassign));
|
||||
}
|
||||
// getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
if(item.getItemId() == R.id.mnGuide){
|
||||
if(!Global.BACKPRESS_RESTRICTION) {
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(OrderFilterActivity.this.getActivity(), OrderFilterActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (!UserHelp.isActive)
|
||||
UserHelp.showAllUserHelp(OrderFilterActivity.this.getActivity(), OrderFilterActivity.this.getClass().getSimpleName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,383 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.model.JsonRequestCheckOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.adins.mss.odr.CheckOrderActivity.keyCustName;
|
||||
|
||||
/**
|
||||
* Created by winy.firdasari on 20/01/2015.
|
||||
*/
|
||||
public class ResultOrderActivity extends Activity {
|
||||
private static String url = GlobalData.getSharedGlobalData().getURL_CHECKORDER();
|
||||
|
||||
protected String getUsedURL(){
|
||||
return GlobalData.getSharedGlobalData().getURL_CHECKORDER();
|
||||
}
|
||||
|
||||
ExpandableListAdapter listAdapter;
|
||||
|
||||
protected ExpandableListView expListView;
|
||||
protected List<String> listDataHeader;
|
||||
protected HashMap<String, List<String>> listDataChild;
|
||||
protected String startDate;
|
||||
protected String endDate;
|
||||
protected String orderNumber;
|
||||
protected String flag;
|
||||
private String custName;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
setContentView(R.layout.result_order_layout);
|
||||
initialize();
|
||||
new ResultOrderTask().execute();
|
||||
}
|
||||
|
||||
protected void initialize() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Intent i = getIntent();
|
||||
// Receiving the Data
|
||||
String mStartDate = i.getStringExtra("startDate");
|
||||
String mEndDate = i.getStringExtra("endDate");
|
||||
String mNomorOrder = i.getStringExtra("nomorOrder");
|
||||
String mCustName = i.getStringExtra(keyCustName);
|
||||
String newflag = i.getStringExtra("flag");
|
||||
|
||||
ResultOrderActivity.url = getUsedURL();
|
||||
|
||||
//jika memilih order by No Order
|
||||
if(null != mNomorOrder && !mNomorOrder.equalsIgnoreCase("")){
|
||||
orderNumber=mNomorOrder;
|
||||
flag=Global.FLAG_BY_ORDERNUMBER;
|
||||
}
|
||||
|
||||
//jika memilih order by date
|
||||
else if (null != mStartDate && !mStartDate.equalsIgnoreCase("")) {
|
||||
startDate = mStartDate;
|
||||
endDate = mEndDate;
|
||||
flag = Global.FLAG_BY_DATE;
|
||||
} else if (null != mCustName && !mCustName.equalsIgnoreCase("")) {
|
||||
custName = mCustName;
|
||||
flag = Global.FLAG_BY_CUSTOMER_NAME;
|
||||
}
|
||||
|
||||
if(newflag!=null){
|
||||
flag = newflag;
|
||||
}
|
||||
|
||||
if ("orderTracking".equalsIgnoreCase(flag)) {
|
||||
startDate = "1";
|
||||
endDate = "1";
|
||||
orderNumber = "1";
|
||||
custName = "1";
|
||||
}
|
||||
|
||||
expListView = (ExpandableListView) findViewById(R.id.resultOrderlist);
|
||||
|
||||
// Listview Group click listener
|
||||
expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v,
|
||||
int groupPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group expanded listener
|
||||
expListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
listDataHeader.get(groupPosition) + " " + getString(R.string.expanded),
|
||||
Toast.LENGTH_SHORT);
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group collasped listener
|
||||
expListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
@Override
|
||||
public void onGroupCollapse(int groupPosition) {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
listDataHeader.get(groupPosition) + " " + getString(R.string.collapsed),
|
||||
Toast.LENGTH_SHORT);
|
||||
}
|
||||
});
|
||||
|
||||
// Listview on child click listener
|
||||
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v,
|
||||
int groupPosition, int childPosition, long id) {
|
||||
|
||||
Toast.makeText(
|
||||
getApplicationContext(),
|
||||
listDataHeader.get(groupPosition)
|
||||
+ " : "
|
||||
+ listDataChild.get(
|
||||
listDataHeader.get(groupPosition)).get(
|
||||
childPosition), Toast.LENGTH_SHORT);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getDataFromURL(String url) throws IOException {
|
||||
String resp = null;
|
||||
try {
|
||||
List<NameValuePair> param = generateRequestParam();
|
||||
|
||||
JsonRequestCheckOrder requestCheckOrder = new JsonRequestCheckOrder();
|
||||
requestCheckOrder.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
// requestCheckOrder.addItemToUnstructured(new KeyValue("imei", GlobalData.getSharedGlobalData().getImei()), false);
|
||||
if(param.get(3).getValue().equals(Global.FLAG_BY_DATE)){
|
||||
requestCheckOrder.setStartDate(param.get(0).getValue());
|
||||
requestCheckOrder.setEndDate(param.get(1).getValue());
|
||||
}
|
||||
else if(param.get(3).getValue().equals(Global.FLAG_BY_ORDERNUMBER)){
|
||||
requestCheckOrder.setOrderNumber(param.get(2).getValue());
|
||||
}
|
||||
else if (null != custName && !custName.equalsIgnoreCase("")) {
|
||||
requestCheckOrder.setCustomerName(custName);
|
||||
}
|
||||
else if(param.get(3).getValue().equals(Global.FLAG_FOR_CANCELORDER)){
|
||||
if(param.get(2).getValue().equals("1")){
|
||||
requestCheckOrder.setStartDate(param.get(0).getValue());
|
||||
requestCheckOrder.setEndDate(param.get(1).getValue());
|
||||
}else{
|
||||
requestCheckOrder.setOrderNumber(param.get(2).getValue());
|
||||
}
|
||||
// requestCheckOrder.setFlag(param.get(3).getValue());
|
||||
// requestCheckOrder.setStatus(param.get(4).getValue());
|
||||
}
|
||||
else if(param.get(3).getValue().equals(Global.FLAG_FOR_ORDERREASSIGNMENT)){
|
||||
if(param.get(2).getValue().equals("1")){
|
||||
requestCheckOrder.setStartDate(param.get(0).getValue());
|
||||
requestCheckOrder.setEndDate(param.get(1).getValue());
|
||||
}else{
|
||||
requestCheckOrder.setOrderNumber(param.get(2).getValue());
|
||||
}
|
||||
requestCheckOrder.setFlag(param.get(3).getValue());
|
||||
}
|
||||
|
||||
String json = GsonHelper.toJson(requestCheckOrder);
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(ResultOrderActivity.this, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null != serverResult && serverResult.isOK()) {
|
||||
resp = serverResult.getResult();
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
||||
resp=e.getMessage();
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
protected List<NameValuePair> generateRequestParam() throws ParseException {
|
||||
String sdtSDate = "1";
|
||||
String sdtEDate = "1";
|
||||
if(startDate==null||endDate==null||"".equalsIgnoreCase(startDate)||"".equalsIgnoreCase(endDate)
|
||||
||"1".equalsIgnoreCase(startDate)||"1".equalsIgnoreCase(endDate)){
|
||||
|
||||
}else{
|
||||
//convert format date biar bisa di tranlate di DB servernya
|
||||
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||
|
||||
Date sDate,eDate;
|
||||
sDate = f.parse(startDate);
|
||||
eDate = f.parse(endDate);
|
||||
sdtSDate = Formatter.formatDate(sDate, Global.DATE_STR_FORMAT_GSON);
|
||||
sdtEDate = Formatter.formatDate(eDate, Global.DATE_STR_FORMAT_GSON);
|
||||
}
|
||||
|
||||
|
||||
List<NameValuePair> param = new ArrayList<NameValuePair>();
|
||||
// String userId = ApplicationBean.getInstance().getUserId();
|
||||
param.add(new BasicNameValuePair("startdate", sdtSDate));
|
||||
param.add(new BasicNameValuePair("enddate", sdtEDate));
|
||||
param.add(new BasicNameValuePair("ordernumber", orderNumber));
|
||||
param.add(new BasicNameValuePair("flag", flag));
|
||||
// param.add(new BasicNameValuePair("userid", userId ));
|
||||
return param;
|
||||
}
|
||||
|
||||
protected void processServerResponse(String result) {
|
||||
|
||||
listDataHeader = new ArrayList<String>();
|
||||
listDataChild = new HashMap<String, List<String>>();
|
||||
|
||||
try {
|
||||
JsonResponseServer resultOrder = GsonHelper.fromJson(result, JsonResponseServer.class);
|
||||
List<ResponseServer> responseServers = resultOrder.getListResponseServer();
|
||||
if(responseServers!=null&&responseServers.size()>0){
|
||||
for(int i=0;i<resultOrder.getListResponseServer().size();i++){
|
||||
ResponseServer responseServer = responseServers.get(i);
|
||||
|
||||
String orderNo = responseServer.getKey();
|
||||
String customerName = responseServer.getValue();
|
||||
|
||||
listDataHeader.add(orderNo+" - "+customerName);
|
||||
List<ResponseServer> SubResultOrder = responseServer.getSubListResponseServer();
|
||||
List<String> statusOrder = new ArrayList<String>();
|
||||
for(int ii = 0; ii < SubResultOrder.size(); ii++){
|
||||
ResponseServer subResponseServer = SubResultOrder.get(ii);
|
||||
statusOrder.add(subResponseServer.getValue());
|
||||
}
|
||||
|
||||
listDataChild.put(listDataHeader.get(i), statusOrder);
|
||||
listAdapter = new ExpandableListAdapter(ResultOrderActivity.this, listDataHeader, listDataChild);
|
||||
expListView.setAdapter(listAdapter);
|
||||
}
|
||||
}else{
|
||||
String message;
|
||||
if(resultOrder.getStatus().getMessage()!=null){
|
||||
message = getString(R.string.data_not_found)+" " +resultOrder.getStatus().getMessage();
|
||||
}else{
|
||||
message = getString(R.string.data_not_found);
|
||||
}
|
||||
final NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(this);
|
||||
builder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(message)
|
||||
.withButton1Text(getString(R.string.btnOk))
|
||||
.isCancelable(false)
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
builder.dismiss();
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
final NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(this);
|
||||
builder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(getApplicationContext().getString(R.string.request_error))
|
||||
.withButton1Text(getString(R.string.btnOk))
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
builder.dismiss();
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
private class ResultOrderTask extends AsyncTask<String, Void, String> {
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage = null;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(ResultOrderActivity.this,
|
||||
"", getString(R.string.progressWait), true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... arg0) {
|
||||
|
||||
String result = null;
|
||||
if(Tool.isInternetconnected(getApplicationContext())){
|
||||
try {
|
||||
result = ResultOrderActivity.this.getDataFromURL(url);
|
||||
} catch (IOException ioe) {
|
||||
// TODO Auto-generated catch block
|
||||
ioe.printStackTrace();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {}
|
||||
|
||||
errMessage = ioe.getMessage();
|
||||
}
|
||||
}else{
|
||||
result = getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
|
||||
if (progressDialog!=null&&progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
if(GlobalData.isRequireRelogin()){
|
||||
return;
|
||||
}
|
||||
if(null != result) {
|
||||
if (getString(R.string.no_internet_connection).equals(result)) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(ResultOrderActivity.this);
|
||||
builder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(getString(R.string.no_internet_connection))
|
||||
.show();
|
||||
} else {
|
||||
processServerResponse(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.sync.DefaultSynchronizeScheme;
|
||||
import com.adins.mss.foundation.sync.Synchronize;
|
||||
import com.adins.mss.foundation.sync.Synchronize.SynchronizeListener;
|
||||
import com.adins.mss.foundation.sync.SynchronizeItem;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SynchronizeActivity extends Activity implements SynchronizeListener, Runnable, OnClickListener{
|
||||
|
||||
ProgressBar progressBar;
|
||||
TextView progressLabel;
|
||||
|
||||
File file = this.getDatabasePath("msm").getParentFile();
|
||||
String DB_PATH = file +"/";
|
||||
|
||||
Synchronize synchronize;
|
||||
public SynchronizeActivity(){
|
||||
|
||||
}
|
||||
|
||||
public void startSync(){
|
||||
synchronize = new Synchronize();
|
||||
synchronize.setSynchronizeScheme(new DefaultSynchronizeScheme());
|
||||
synchronize.setListener(this);
|
||||
|
||||
//TODO Bikin Task Buat Gabungin ke UI
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.synchronize_layout);
|
||||
|
||||
progressBar = (ProgressBar)findViewById(R.id.progressBar1);
|
||||
progressLabel = (TextView) findViewById(R.id.progressLabel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
synchronize.startSynchronize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progressUpdated(float values) {
|
||||
// TODO Auto-generated method stub
|
||||
float progress = values;
|
||||
int progressInt = (int) progress;
|
||||
updateProgressBar(progressInt);
|
||||
}
|
||||
|
||||
protected void updateProgressBar(int progress){
|
||||
progressBar.setProgress(progress);
|
||||
progressLabel.setText("Progress : " + progress + "%");
|
||||
}
|
||||
@Override
|
||||
public void synchronizeFailed(SynchronizeItem arg0,
|
||||
HttpConnectionResult arg1, int arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
|
||||
import com.adins.mss.base.todo.form.GetSchemeTask;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.odr.MONewTaskActivity;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.AccountButtonAdapter;
|
||||
import com.adins.mss.odr.accounts.adapter.AccountButtonOpportunitiesAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/27/2018.
|
||||
*/
|
||||
|
||||
public class AccountDetailFragment extends Fragment {
|
||||
private String uuidAccount;
|
||||
private Account account;
|
||||
private EditText txtAddress;
|
||||
private EditText txtPhone1;
|
||||
private EditText txtPhone2;
|
||||
private EditText txtPhone3;
|
||||
private Button btnNewProspect;
|
||||
ExpandableRecyclerView qRecyclerView;
|
||||
public static AccountButtonAdapter buttonOppAdapter;
|
||||
//private ExpandableListView btnRecyclerViewOpportunities;
|
||||
List<String> listDataHeader;
|
||||
HashMap<String, List<String>> listDataChild;
|
||||
AccountButtonOpportunitiesAdapter listAdapter;
|
||||
// public static AdapterBaru questionAdapter;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_account_detail, container, false);
|
||||
Bundle bundle = getArguments();
|
||||
|
||||
String uuidAccount = bundle.getString("uuidAccount");
|
||||
account = AccountDataAccess.getOne(getActivity(), uuidAccount);
|
||||
|
||||
txtAddress = (EditText) view.findViewById(R.id.txtAddressAccDetail);
|
||||
txtPhone1 = (EditText) view.findViewById(R.id.txtNumber1Acc);
|
||||
txtPhone2 = (EditText) view.findViewById(R.id.txtNumber2Acc);
|
||||
txtPhone3 = (EditText) view.findViewById(R.id.txtNumber3Acc);
|
||||
btnNewProspect = (Button) view.findViewById(R.id.btnNewProspectAcc);
|
||||
// btnRecyclerViewOpportunities = (ExpandableListView) view.findViewById(R.id.btnRecyclerViewOpportunitiesAcc);
|
||||
|
||||
txtAddress.setText(account.getAccount_address());
|
||||
txtPhone1.setText(account.getAccount_phone_1());
|
||||
|
||||
if (account.getAccount_phone_2() != null && !account.getAccount_phone_2().isEmpty())
|
||||
txtPhone2.setText(account.getAccount_phone_2());
|
||||
|
||||
//if (account.getAccount_phone_3() != null && !account.getAccount_phone_3().isEmpty())
|
||||
// txtPhone3.setText(account.getAccount_phone_3());
|
||||
|
||||
btnNewProspect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
GetSchemeTask task = new GetSchemeTask(getActivity(), new MONewTaskActivity(), true);
|
||||
task.execute();
|
||||
}
|
||||
});
|
||||
|
||||
// questionAdapter = new QuestionViewAdapter(getActivity(), qRecyclerView, listOfQuestionGroup, listOfQuestionBean, this);
|
||||
// btnRecyclerViewOpportunities.setAdapter(questionAdapter);
|
||||
|
||||
// preparing list data
|
||||
prepareListData();
|
||||
|
||||
listAdapter = new AccountButtonOpportunitiesAdapter(getActivity(), listDataHeader, listDataChild);
|
||||
|
||||
// setting list adapter
|
||||
// btnRecyclerViewOpportunities.setAdapter(listAdapter);
|
||||
//
|
||||
// // Listview Group click listener
|
||||
// btnRecyclerViewOpportunities.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean onGroupClick(ExpandableListView parent, View v,
|
||||
// int groupPosition, long id) {
|
||||
// // Toast.makeText(getApplicationContext(),
|
||||
// // "Group Clicked " + listDataHeader.get(groupPosition),
|
||||
// // Toast.LENGTH_SHORT).show();
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // Listview Group expanded listener
|
||||
// btnRecyclerViewOpportunities.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void onGroupExpand(int groupPosition) {
|
||||
// Toast.makeText(getActivity(),
|
||||
// listDataHeader.get(groupPosition) + " Expanded",
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // Listview Group collasped listener
|
||||
// btnRecyclerViewOpportunities.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void onGroupCollapse(int groupPosition) {
|
||||
// Toast.makeText(getActivity(),
|
||||
// listDataHeader.get(groupPosition) + " Collapsed",
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // Listview on child click listener
|
||||
// btnRecyclerViewOpportunities.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean onChildClick(ExpandableListView parent, View v,
|
||||
// int groupPosition, int childPosition, long id) {
|
||||
// // TODO Auto-generated method stub
|
||||
// Toast.makeText(
|
||||
// getActivity(),
|
||||
// listDataHeader.get(groupPosition)
|
||||
// + " : "
|
||||
// + listDataChild.get(
|
||||
// listDataHeader.get(groupPosition)).get(
|
||||
// childPosition), Toast.LENGTH_SHORT)
|
||||
// .show();
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
|
||||
if (view instanceof RelativeLayout) {
|
||||
Context context = view.getContext();
|
||||
qRecyclerView = (ExpandableRecyclerView) view.findViewById(R.id.btnOpportunities);
|
||||
|
||||
int duration = getResources().getInteger(com.adins.mss.base.R.integer.scroll_duration);
|
||||
qRecyclerView.setLayoutManager(new ScrollingLinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false, duration));
|
||||
|
||||
|
||||
// buttonOppAdapter = new AccountButtonAdapter(getActivity(), qRecyclerView, listOfQuestionBean, this);
|
||||
qRecyclerView.setAdapter(buttonOppAdapter);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void prepareListData() {
|
||||
listDataHeader = new ArrayList<String>();
|
||||
listDataChild = new HashMap<String, List<String>>();
|
||||
listDataHeader.add("Opportunities");
|
||||
|
||||
List<String> nowShowing = new ArrayList<String>();
|
||||
nowShowing.add("The Conjuring");
|
||||
nowShowing.add("Despicable Me 2");
|
||||
nowShowing.add("Turbo");
|
||||
nowShowing.add("Grown Ups 2");
|
||||
nowShowing.add("Red 2");
|
||||
nowShowing.add("The Wolverine");
|
||||
|
||||
listDataChild.put(listDataHeader.get(0), nowShowing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.header_mn_account_detail));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class AccountDetailTabFragment extends Fragment {
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private TextView txtName;
|
||||
private TextView txtAddress;
|
||||
private TextView txtPhone1;
|
||||
private TextView txtPhone2;
|
||||
private ImageView image;
|
||||
private byte[] bitmapArray;
|
||||
|
||||
public AccountDetailTabFragment(FragmentActivity activity, Account account) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.account_detail_tab, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
txtName = (TextView) view.findViewById(R.id.txtName);
|
||||
txtAddress = (TextView) view.findViewById(R.id.txtAddress);
|
||||
txtPhone1 = (TextView) view.findViewById(R.id.txtPhone1);
|
||||
txtPhone2 = (TextView) view.findViewById(R.id.txtPhone2);
|
||||
image = (ImageView) view.findViewById(R.id.accImage);
|
||||
|
||||
txtName.setText(account.getAccount_name());
|
||||
txtAddress.setText(account.getAccount_address());
|
||||
txtPhone1.setText(account.getAccount_phone_1());
|
||||
|
||||
if (account.getAccount_phone_2() == null && account.getAccount_phone_2().isEmpty())
|
||||
txtPhone2.setText("-");
|
||||
else
|
||||
txtPhone2.setText(account.getAccount_phone_2());
|
||||
|
||||
final String lat = account.getAccount_latitude();
|
||||
final String lng = account.getAccount_longitude();
|
||||
|
||||
try {
|
||||
String image_url = "https://maps.googleapis.com/maps/api/staticmap?center="+lat+","+lng+"&zoom=15&size=720x300&maptype=roadmap&markers=color:green%7Clabel:I%7C"+lat+","+lng;
|
||||
|
||||
// ImageLoader imgLoader = new ImageLoader(activity);
|
||||
Bitmap bitmap = getBitmapFromURL(image_url);
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, stream);
|
||||
|
||||
bitmapArray = stream.toByteArray();
|
||||
|
||||
Bitmap bm = null;
|
||||
if(bitmapArray!=null){
|
||||
try {
|
||||
bm = Utils.byteToBitmap(bitmapArray);
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
if (bm != null)
|
||||
image.setImageBitmap(bm);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
|
||||
image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Uri url = Uri.parse("https://www.google.com/maps/dir/?api=1&destination="+lat+","+lng);
|
||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, url);
|
||||
// mapIntent.setPackage("com.google.android.apps.maps");
|
||||
startActivity(mapIntent);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public static Bitmap getBitmapFromURL(String src) {
|
||||
try {
|
||||
URL url = new URL(src);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.connect();
|
||||
InputStream input = connection.getInputStream();
|
||||
Bitmap myBitmap = BitmapFactory.decodeStream(input);
|
||||
return myBitmap;
|
||||
} catch (IOException e) {
|
||||
// Log exception
|
||||
return null;
|
||||
} catch (RuntimeException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().setTitle(getString(R.string.title_mn_account));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.location.LocationTrackingManager;
|
||||
import com.adins.mss.foundation.location.UpdateMenuIcon;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.github.jjobes.slidedatetimepicker.SlidingTabLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class AccountResultActivity extends AppCompatActivity {
|
||||
|
||||
private ViewPager mViewPager;
|
||||
private ViewPagerAdapter mViewPagerAdapter;
|
||||
private SlidingTabLayout mSlidingTabLayout;
|
||||
private Account account;
|
||||
private ArrayList<String> productContact;
|
||||
public LocationTrackingManager manager;
|
||||
public static FragmentManager fragmentManager;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(R.menu.main_menu, menu);
|
||||
mainMenu = menu;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
updateMenuIcon(Global.isGPS);
|
||||
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public static void updateMenuIcon(boolean isGPS) {
|
||||
UpdateMenuIcon uItem = new UpdateMenuIcon();
|
||||
uItem.updateGPSIcon(mainMenu);
|
||||
}
|
||||
|
||||
private static Menu mainMenu;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == com.adins.mss.base.R.id.mnGPS) {
|
||||
if (Global.LTM != null) {
|
||||
if (Global.LTM.getIsConnected()) {
|
||||
Global.LTM.removeLocationListener();
|
||||
Global.LTM.connectLocationClient();
|
||||
} else {
|
||||
StartLocationTracking();
|
||||
}
|
||||
Animation a = AnimationUtils.loadAnimation(this, com.adins.mss.base.R.anim.gps_rotate);
|
||||
findViewById(com.adins.mss.base.R.id.mnGPS).startAnimation(a);
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
String uuidAccount = bundle.getString(Global.BUND_KEY_ACCOUNT_ID);
|
||||
account = AccountDataAccess.getOne(getApplicationContext(), uuidAccount);
|
||||
productContact = bundle.getStringArrayList(Global.BUND_KEY_PRODUCT_ID);
|
||||
|
||||
setContentView(R.layout.account_result_activity);
|
||||
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
|
||||
setupViews();
|
||||
initViewPager();
|
||||
initTabs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(com.adins.mss.base.R.id.toolbar);
|
||||
toolbar.setTitle(getString(com.adins.mss.base.R.string.title_mn_account));
|
||||
toolbar.setTitleTextColor(getResources().getColor(com.adins.mss.base.R.color.fontColorWhite));
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
private void initTabs() {
|
||||
mSlidingTabLayout.setTabText(0, getResources().getString(R.string.tabDetail));
|
||||
mSlidingTabLayout.setTabText(1, getResources().getString(R.string.tabContact));
|
||||
mSlidingTabLayout.setTabText(2, getResources().getString(R.string.tabOppor));
|
||||
}
|
||||
|
||||
private void initViewPager() {
|
||||
mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
mViewPager.setAdapter(mViewPagerAdapter);
|
||||
|
||||
mSlidingTabLayout.setCustomTabView(R.layout.custom_tab_tasklist, R.id.tabTextTaskList);
|
||||
mSlidingTabLayout.setSelectedIndicatorColors(ContextCompat.getColor(this, R.color.tv_white),
|
||||
ContextCompat.getColor(this, R.color.tv_white));
|
||||
mSlidingTabLayout.setDividerColors(ContextCompat.getColor(this, R.color.tv_white),
|
||||
ContextCompat.getColor(this, R.color.tv_white));
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
}
|
||||
|
||||
private void setupViews() {
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.slidingTabLayout);
|
||||
mViewPager.setCurrentItem(0, true);
|
||||
}
|
||||
|
||||
private class ViewPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public ViewPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Fragment fragment = null;
|
||||
switch (position) {
|
||||
case 0:
|
||||
fragment = new AccountDetailTabFragment(AccountResultActivity.this, account);
|
||||
break;
|
||||
case 1:
|
||||
fragment = new ContactTabFragment(AccountResultActivity.this, account, productContact);
|
||||
break;
|
||||
case 2:
|
||||
fragment = new OpportunityTabFragment(AccountResultActivity.this, account);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void StartLocationTracking() {
|
||||
try {
|
||||
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
GeneralParameter gp_distance = GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), Global.GS_DISTANCE_TRACKING);
|
||||
try {
|
||||
if (gp_distance != null) {
|
||||
int distanceTracking = Integer.parseInt(gp_distance.getGs_value());
|
||||
if (distanceTracking != 0) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(Integer.parseInt(GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM13_DIST").getGs_value()));
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(50);
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
|
||||
if (Global.LTM == null) {
|
||||
Global.LTM = manager;
|
||||
} else {
|
||||
try {
|
||||
Global.LTM = null;
|
||||
Global.LTM = manager;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.location.LocationTrackingManager;
|
||||
import com.adins.mss.foundation.location.UpdateMenuIcon;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.AccountListAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/16/2017.
|
||||
*/
|
||||
|
||||
public class AccountsListActivity extends AppCompatActivity {
|
||||
|
||||
private ArrayList<String> uuidAccounts;
|
||||
private List<Account> accountList;
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private RecyclerView.Adapter adapter;
|
||||
public LocationTrackingManager manager;
|
||||
public static FragmentManager fragmentManager;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(com.adins.mss.base.R.menu.main_menu, menu);
|
||||
mainMenu = menu;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
updateMenuIcon(Global.isGPS);
|
||||
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public static void updateMenuIcon(boolean isGPS) {
|
||||
UpdateMenuIcon uItem = new UpdateMenuIcon();
|
||||
uItem.updateGPSIcon(mainMenu);
|
||||
}
|
||||
|
||||
private static Menu mainMenu;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == com.adins.mss.base.R.id.mnGPS) {
|
||||
if (Global.LTM != null) {
|
||||
if (Global.LTM.getIsConnected()) {
|
||||
Global.LTM.removeLocationListener();
|
||||
Global.LTM.connectLocationClient();
|
||||
} else {
|
||||
StartLocationTracking();
|
||||
}
|
||||
Animation a = AnimationUtils.loadAnimation(this, com.adins.mss.base.R.anim.gps_rotate);
|
||||
findViewById(com.adins.mss.base.R.id.mnGPS).startAnimation(a);
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
uuidAccounts = new ArrayList<>();
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
uuidAccounts = bundle.getStringArrayList(Global.BUND_KEY_ACCOUNT_ID);
|
||||
|
||||
setContentView(R.layout.new_account_list_activity);
|
||||
|
||||
list = (RecyclerView) findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(getApplicationContext());
|
||||
list.setLayoutManager(layoutManager);
|
||||
|
||||
accountList = new ArrayList<>();
|
||||
if (uuidAccounts != null) {
|
||||
for (String uuid : uuidAccounts) {
|
||||
Account account = AccountDataAccess.getOne(getApplicationContext(), uuid);
|
||||
accountList.add(account);
|
||||
}
|
||||
}
|
||||
|
||||
adapter = new AccountListAdapter(AccountsListActivity.this, accountList);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(com.adins.mss.base.R.id.toolbar);
|
||||
toolbar.setTitle(getString(com.adins.mss.base.R.string.title_mn_account));
|
||||
toolbar.setTitleTextColor(getResources().getColor(com.adins.mss.base.R.color.fontColorWhite));
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void StartLocationTracking() {
|
||||
try {
|
||||
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
GeneralParameter gp_distance = GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), Global.GS_DISTANCE_TRACKING);
|
||||
try {
|
||||
if (gp_distance != null) {
|
||||
int distanceTracking = Integer.parseInt(gp_distance.getGs_value());
|
||||
if (distanceTracking != 0) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(Integer.parseInt(GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM13_DIST").getGs_value()));
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(50);
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
|
||||
if (Global.LTM == null) {
|
||||
Global.LTM = manager;
|
||||
} else {
|
||||
try {
|
||||
Global.LTM = null;
|
||||
Global.LTM = manager;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.db.dataaccess.ProductDataAccess;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.ContactListAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class ContactTabFragment extends Fragment {
|
||||
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
public ContactListAdapter adapter;
|
||||
private String uuidAccount;
|
||||
private List<Product> listProduct = new ArrayList<>();
|
||||
private ArrayList<String> uuidProducts = new ArrayList<>();
|
||||
|
||||
public ContactTabFragment(FragmentActivity activity, Account account, ArrayList<String> products) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
this.uuidProducts = products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.account_contact_tab, container, false);
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(activity);
|
||||
list.setLayoutManager(layoutManager);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
// listContact = ContactDataAccess.getAllByAccount(activity, account.getUuid_account());
|
||||
if (uuidProducts != null) {
|
||||
for (String uuid : uuidProducts) {
|
||||
Product product = ProductDataAccess.getOne(getActivity(), uuid);
|
||||
listProduct.add(product);
|
||||
}
|
||||
}
|
||||
|
||||
adapter = new ContactListAdapter(getActivity(), account, listProduct);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getActivity().setTitle(getString(R.string.title_mn_account));
|
||||
|
||||
adapter = new ContactListAdapter(activity, account, listProduct);
|
||||
list.setAdapter(adapter);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.AccountListAdapter;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/27/2018.
|
||||
*/
|
||||
|
||||
public class FragmentAccountList extends Fragment {
|
||||
private ArrayList<String> uuidAccounts;
|
||||
private List<Account> accountList;
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private RecyclerView.Adapter adapter;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_new_account_list, container, false);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
uuidAccounts = new ArrayList<>();
|
||||
Bundle bundle = getArguments();
|
||||
uuidAccounts = bundle.getStringArrayList(Global.BUND_KEY_ACCOUNT_ID);
|
||||
accountList = new ArrayList<>();
|
||||
if (uuidAccounts != null) {
|
||||
for (String uuid : uuidAccounts) {
|
||||
Account account = AccountDataAccess.getOne(getActivity(), uuid);
|
||||
accountList.add(account);
|
||||
}
|
||||
}
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.accountList);
|
||||
layoutManager = new LinearLayoutManager(getActivity());
|
||||
list.setLayoutManager(layoutManager);
|
||||
adapter = new AccountListAdapter(getActivity(), accountList);
|
||||
list.setAdapter(adapter);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_account_list), null);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_account));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// mIndicator.cleanup();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,360 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.ProductDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchRequest;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/15/2017.
|
||||
*/
|
||||
|
||||
public class FragmentAccountsSearch extends Fragment {
|
||||
|
||||
private AppCompatSpinner spinnerAccount;
|
||||
private AppCompatSpinner spinnerProduct;
|
||||
private AppCompatSpinner spinnerStatus;
|
||||
private Button btnSearch;
|
||||
private List<Account> accountList;
|
||||
private List<Product> productList;
|
||||
private String[] statusList;
|
||||
private String tempAccount;
|
||||
private String tempProduct;
|
||||
private String tempStatus;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.new_fragment_account_search, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
spinnerAccount = (AppCompatSpinner) view.findViewById(R.id.spinnerAccount);
|
||||
spinnerProduct = (AppCompatSpinner) view.findViewById(R.id.spinnerProduct);
|
||||
spinnerStatus = (AppCompatSpinner) view.findViewById(R.id.spinnerStatus);
|
||||
btnSearch = (Button) view.findViewById(R.id.btnSearch);
|
||||
|
||||
accountList = new ArrayList<>();
|
||||
accountList.clear();
|
||||
setAllAccountSpinner();
|
||||
List<Account> listAcc = AccountDataAccess.getAll(getActivity());
|
||||
if (listAcc != null)
|
||||
accountList.addAll(listAcc);
|
||||
AccountAdapter accountSpinner = new AccountAdapter(getContext(), R.layout.spinner_style2, accountList);
|
||||
spinnerAccount.setAdapter(accountSpinner);
|
||||
|
||||
productList = new ArrayList<>();
|
||||
productList.clear();
|
||||
setAllProductSpinner();
|
||||
List<Product> listProd = ProductDataAccess.getAll(getContext());
|
||||
if (listProd != null)
|
||||
productList.addAll(listProd);
|
||||
ProductAdapter productSpinner = new ProductAdapter(getContext(), R.layout.spinner_style2, productList);
|
||||
spinnerProduct.setAdapter(productSpinner);
|
||||
|
||||
statusList = getActivity().getResources().getStringArray(R.array.dropdownAccountStatus);
|
||||
StatusAdapter statusSpinner = new StatusAdapter(getContext(), R.layout.spinner_style2, statusList);
|
||||
spinnerStatus.setAdapter(statusSpinner);
|
||||
|
||||
btnSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Account account = (Account) spinnerAccount.getSelectedItem();
|
||||
Product product = (Product) spinnerProduct.getSelectedItem();
|
||||
|
||||
tempStatus = spinnerStatus.getSelectedItem().toString();
|
||||
if (tempStatus.equalsIgnoreCase(getString(R.string.allStatus)))
|
||||
tempStatus = "";
|
||||
tempAccount = account.getUuid_account();
|
||||
tempProduct = product.getUuid_product();
|
||||
|
||||
try {
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
doSearch(tempAccount, tempProduct, tempStatus);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setAllAccountSpinner() {
|
||||
Account accountDummy = new Account();
|
||||
accountDummy.setUuid_account("");
|
||||
accountDummy.setAccount_name("All Account");
|
||||
|
||||
accountList.add(0, accountDummy);
|
||||
}
|
||||
|
||||
private void setAllProductSpinner() {
|
||||
Product productDummy = new Product();
|
||||
productDummy.setUuid_product("");
|
||||
productDummy.setProduct_name("All Product");
|
||||
|
||||
productList.add(0, productDummy);
|
||||
}
|
||||
|
||||
private void doSearch(final String account, final String product, final String status) throws ParseException, IOException {
|
||||
new AsyncTask<Void, Void, ArrayList<String>>() {
|
||||
final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||
String errMessage;
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||
progress.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<String> doInBackground(Void... params) {
|
||||
AccountsSearchRequest request = new AccountsSearchRequest();
|
||||
request.setUuid_account(account);
|
||||
request.setUuid_product(product);
|
||||
request.setUuid_status(status);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_ACCOUNT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
AccountsSearchResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, AccountsSearchResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Account> listAccounts = response.getListAccount();
|
||||
if (listAccounts != null && listAccounts.size() != 0) {
|
||||
for(Account acc : listAccounts){
|
||||
result.add(acc.getUuid_account());
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.server_down);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<String> result) {
|
||||
if(getActivity()!=null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(getActivity().getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(getActivity(), AccountsListActivity.class);
|
||||
Bundle extra = new Bundle();
|
||||
extra.putStringArrayList(Global.BUND_KEY_ACCOUNT_ID, result);
|
||||
intent.putExtras(extra);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(R.string.title_mn_account));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
public class StatusAdapter extends ArrayAdapter<String> {
|
||||
private Context context;
|
||||
private String[] values;
|
||||
|
||||
public StatusAdapter(Context context, int resource, String[] objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.length;
|
||||
}
|
||||
|
||||
public String getItem(int position) {
|
||||
return values[position];
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values[position]);
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values[position]);
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class AccountAdapter extends ArrayAdapter<Account> {
|
||||
private Context context;
|
||||
private List<Account> values;
|
||||
|
||||
public AccountAdapter(Context context, int resource, List<Account> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Account getItem(int position) {
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getAccount_name());
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getAccount_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProductAdapter extends ArrayAdapter<Product> {
|
||||
private Context context;
|
||||
private List<Product> values;
|
||||
|
||||
public ProductAdapter(Context context, int resource, List<Product> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Product getItem(int position) {
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getProduct_name());
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getProduct_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchRequest;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/27/2018.
|
||||
*/
|
||||
|
||||
public class GetAccount extends AsyncTask<Void, Void, ArrayList<String>>{
|
||||
private FragmentActivity activity;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
public GetAccount(FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<String> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
AccountsSearchRequest request = new AccountsSearchRequest();
|
||||
request.setUuid_account("");
|
||||
request.setUuid_product("");
|
||||
request.setUuid_status("");
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_ACCOUNT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
AccountsSearchResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, AccountsSearchResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Account> listAccounts = response.getListAccount();
|
||||
if (listAccounts != null && listAccounts.size() != 0) {
|
||||
for(Account acc : listAccounts){
|
||||
result.add(acc.getUuid_account());
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<String> result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
Fragment fragment = new FragmentAccountList();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putStringArrayList(Global.BUND_KEY_ACCOUNT_ID, result);
|
||||
fragment.setArguments(bundle);
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Contact;
|
||||
import com.adins.mss.foundation.db.dataaccess.ContactDataAccess;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.LoadContactRequest;
|
||||
import com.adins.mss.odr.accounts.api.LoadContactResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/20/2017.
|
||||
*/
|
||||
|
||||
public class LoadContact extends AsyncTask<Void, Void, List<Contact>> {
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private String uuidAccount;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private List<Contact> result = new ArrayList<Contact>();
|
||||
private String uuid;
|
||||
|
||||
public LoadContact(FragmentActivity activity, Account account, String uuid) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Contact> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
uuidAccount = account.getUuid_account();
|
||||
LoadContactRequest request = new LoadContactRequest();
|
||||
request.setUuid_account(uuidAccount);
|
||||
request.setUuid_product(uuid);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CONTACT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadContactResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadContactResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Contact> contactList = response.getListContact();
|
||||
ContactDataAccess.clean(activity);
|
||||
|
||||
if (contactList != null && contactList.size() != 0) {
|
||||
result = response.getListContact();
|
||||
if (result != null){
|
||||
for (Contact temp : result) {
|
||||
String uuidContact = Tool.getUUID();
|
||||
String uuidAccount = account.getUuid_account();
|
||||
Date dtm_crt = Tool.getSystemDateTime();
|
||||
Contact contact = new Contact(uuidContact, temp.getContact_name(), temp.getContact_dept(), temp.getContact_phone(), temp.getContact_email(), uuidAccount, dtm_crt);
|
||||
ContactDataAccess.add(activity, contact);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Contact> contacts) {
|
||||
super.onPostExecute(contacts);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Contact contact = new Contact();
|
||||
for (Contact temp : contacts) {
|
||||
contact = temp;
|
||||
break;
|
||||
}
|
||||
DialogManager.showDetailContact(activity, contact);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.db.dataaccess.GroupTaskDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.LoadOpportunityResponse;
|
||||
import com.adins.mss.odr.accounts.api.LoadProductContactRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/20/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunity extends AsyncTask<Void, Void, List<GroupTask>> {
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private String uuidAccount;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private List<GroupTask> result = new ArrayList<GroupTask>();
|
||||
|
||||
public LoadOpportunity(FragmentActivity activity, Account account) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
@Override
|
||||
protected List<GroupTask> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
uuidAccount = account.getUuid_account();
|
||||
LoadProductContactRequest request = new LoadProductContactRequest();
|
||||
request.setUuid_account(uuidAccount);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_OPPORTUNITY();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadOpportunityResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadOpportunityResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<GroupTask> groupTaskList = response.getListOppor();
|
||||
if (groupTaskList != null && groupTaskList.size() != 0) {
|
||||
result = groupTaskList;
|
||||
for (GroupTask temp : groupTaskList) {
|
||||
GroupTask gt = GroupTaskDataAccess.getOneHeader(activity, temp.getGroup_task_id());
|
||||
if (gt != null) {
|
||||
gt.setLast_status(temp.getLast_status());
|
||||
gt.setDtm_crt(temp.getDtm_crt());
|
||||
GroupTaskDataAccess.addOrReplace(activity, gt);
|
||||
} else {
|
||||
temp.setUuid_group_task(Tool.getUUID());
|
||||
temp.setUuid_account(uuidAccount);
|
||||
temp.setDtm_crt(Tool.getSystemDateTime());
|
||||
GroupTaskDataAccess.add(activity, temp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<GroupTask> groupTasks) {
|
||||
super.onPostExecute(groupTasks);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
LoadProductContact loadProductContact = new LoadProductContact(activity, account);
|
||||
loadProductContact.execute();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.LoadOpportunityDetailRequest;
|
||||
import com.adins.mss.odr.accounts.api.LoadOpportunityDetailResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/21/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunityDetail extends AsyncTask<Void, Void, List<TaskH>> {
|
||||
private FragmentActivity activity;
|
||||
private GroupTask groupTask;
|
||||
private String groupTaskId;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private List<TaskH> result = new ArrayList<TaskH>();
|
||||
|
||||
public LoadOpportunityDetail(FragmentActivity activity, GroupTask groupTask) {
|
||||
this.activity = activity;
|
||||
this.groupTask = groupTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TaskH> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
groupTaskId = groupTask.getGroup_task_id();
|
||||
LoadOpportunityDetailRequest request = new LoadOpportunityDetailRequest();
|
||||
request.setGroup_task_id(groupTaskId);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_OPPORTUNITY_DETAIL();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadOpportunityDetailResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadOpportunityDetailResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<TaskH> taskHList = response.getListOpporDetail();
|
||||
if (taskHList != null && taskHList.size() != 0) {
|
||||
result = taskHList;
|
||||
for (TaskH temp : taskHList) {
|
||||
TaskH task = TaskHDataAccess.getOneHeader(activity, temp.getUuid_task_h());
|
||||
if (task != null) {
|
||||
TaskHDataAccess.addOrReplace(activity, temp);
|
||||
} else {
|
||||
// temp.setUuid_task_h(Tool.getUUID());
|
||||
temp.setDtm_crt(Tool.getSystemDateTime());
|
||||
TaskHDataAccess.add(activity, temp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<TaskH> taskHs) {
|
||||
super.onPostExecute(taskHs);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
ArrayList<String> taskTodo = new ArrayList<>();
|
||||
ArrayList<String> taskHistory = new ArrayList<>();
|
||||
for (TaskH task : taskHs) {
|
||||
if (task.getSubmit_date() != null && !task.getSubmit_date().equals(""))
|
||||
taskHistory.add(task.getUuid_task_h());
|
||||
else
|
||||
taskTodo.add(task.getUuid_task_h());
|
||||
}
|
||||
|
||||
Intent intent = new Intent(activity, OpportunityDetailActivity.class);
|
||||
Bundle extra = new Bundle();
|
||||
extra.putString(Global.BUND_KEY_GROUPTASK_ID, groupTaskId);
|
||||
extra.putStringArrayList("taskTodo", taskTodo);
|
||||
extra.putStringArrayList("taskHistory", taskHistory);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtras(extra);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.LoadProductContactRequest;
|
||||
import com.adins.mss.odr.accounts.api.LoadProductContactResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 12/19/2017.
|
||||
*/
|
||||
|
||||
public class LoadProductContact extends AsyncTask<Void, Void, ArrayList<String>> {
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private String uuidAccount;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
public LoadProductContact(FragmentActivity activity, Account account) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
@Override
|
||||
protected ArrayList<String> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
uuidAccount = account.getUuid_account();
|
||||
LoadProductContactRequest request = new LoadProductContactRequest();
|
||||
request.setUuid_account(uuidAccount);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_PRODUCT_CONTACT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadProductContactResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadProductContactResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Product> productList = response.getListProduct();
|
||||
|
||||
if (productList != null && productList.size() != 0) {
|
||||
for (Product product : productList) {
|
||||
result.add(product.getUuid_product());
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<String> products) {
|
||||
super.onPostExecute(products);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
String accountId = account.getUuid_account();
|
||||
Intent intent = new Intent(activity, AccountResultActivity.class);
|
||||
Bundle extra = new Bundle();
|
||||
extra.putString(Global.BUND_KEY_ACCOUNT_ID, accountId);
|
||||
extra.putStringArrayList(Global.BUND_KEY_PRODUCT_ID, products);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtras(extra);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.GroupTaskDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.TaskHDataAccess;
|
||||
import com.adins.mss.foundation.location.LocationTrackingManager;
|
||||
import com.adins.mss.foundation.location.UpdateMenuIcon;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.ActivityTodoAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/21/2017.
|
||||
*/
|
||||
|
||||
public class OpportunityDetailActivity extends AppCompatActivity {
|
||||
|
||||
public LocationTrackingManager manager;
|
||||
private TextView headerId;
|
||||
private TextView headerStatus;
|
||||
private TextView headerProduct;
|
||||
private RecyclerView listTodo;
|
||||
private RecyclerView listHistory;
|
||||
private RecyclerView.LayoutManager lmTodo;
|
||||
private RecyclerView.LayoutManager lmHistory;
|
||||
private ActivityTodoAdapter todoAdapter;
|
||||
private ActivityTodoAdapter historyAdapter;
|
||||
private List<TaskH> todo = new ArrayList<>();
|
||||
private List<TaskH> history = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater menuInflater = getMenuInflater();
|
||||
menuInflater.inflate(R.menu.main_menu, menu);
|
||||
mainMenu = menu;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
updateMenuIcon(Global.isGPS);
|
||||
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public static void updateMenuIcon(boolean isGPS) {
|
||||
UpdateMenuIcon uItem = new UpdateMenuIcon();
|
||||
uItem.updateGPSIcon(mainMenu);
|
||||
}
|
||||
|
||||
private static Menu mainMenu;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == com.adins.mss.base.R.id.mnGPS) {
|
||||
if (Global.LTM != null) {
|
||||
if (Global.LTM.getIsConnected()) {
|
||||
Global.LTM.removeLocationListener();
|
||||
Global.LTM.connectLocationClient();
|
||||
} else {
|
||||
StartLocationTracking();
|
||||
}
|
||||
Animation a = AnimationUtils.loadAnimation(this, com.adins.mss.base.R.anim.gps_rotate);
|
||||
findViewById(com.adins.mss.base.R.id.mnGPS).startAnimation(a);
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.opportunity_detail_activity);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
String groupTaskId = bundle.getString(Global.BUND_KEY_GROUPTASK_ID);
|
||||
List<String> taskTodo = bundle.getStringArrayList("taskTodo");
|
||||
List<String> taskHistory = bundle.getStringArrayList("taskHistory");
|
||||
GroupTask groupTask = GroupTaskDataAccess.getOneHeader(getApplicationContext(), groupTaskId);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(getString(R.string.title_mn_account));
|
||||
toolbar.setTitleTextColor(getResources().getColor(R.color.fontColorWhite));
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
headerId = (TextView) findViewById(R.id.headerId);
|
||||
headerStatus = (TextView) findViewById(R.id.headerStatus);
|
||||
headerProduct = (TextView) findViewById(R.id.headerProduct);
|
||||
listTodo = (RecyclerView) findViewById(R.id.listTodo);
|
||||
listHistory = (RecyclerView) findViewById(R.id.listHistory);
|
||||
lmTodo = new LinearLayoutManager(this);
|
||||
lmHistory = new LinearLayoutManager(this);
|
||||
listTodo.setLayoutManager(lmTodo);
|
||||
listHistory.setLayoutManager(lmHistory);
|
||||
|
||||
headerId.setText(groupTask.getGroup_task_id());
|
||||
headerStatus.setText(groupTask.getLast_status());
|
||||
headerProduct.setText(groupTask.getProduct_name());
|
||||
|
||||
if (taskTodo != null) {
|
||||
for (int i = taskTodo.size()-1; i >= 0; i--) {
|
||||
TaskH task = TaskHDataAccess.getOneHeader(getApplicationContext(), taskTodo.get(i));
|
||||
todo.add(task);
|
||||
}
|
||||
|
||||
}
|
||||
if (taskHistory != null) {
|
||||
for (int i = taskHistory.size()-1; i >= 0; i--) {
|
||||
TaskH task = TaskHDataAccess.getOneHeader(getApplicationContext(), taskHistory.get(i));
|
||||
history.add(task);
|
||||
}
|
||||
}
|
||||
|
||||
if (todo != null) {
|
||||
todoAdapter = new ActivityTodoAdapter(this, todo);
|
||||
listTodo.setAdapter(todoAdapter);
|
||||
}
|
||||
if (history != null) {
|
||||
historyAdapter = new ActivityTodoAdapter(this, history);
|
||||
listHistory.setAdapter(historyAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void StartLocationTracking() {
|
||||
try {
|
||||
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
GeneralParameter gp_distance = GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), Global.GS_DISTANCE_TRACKING);
|
||||
try {
|
||||
if (gp_distance != null) {
|
||||
int distanceTracking = Integer.parseInt(gp_distance.getGs_value());
|
||||
if (distanceTracking != 0) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(Integer.parseInt(GeneralParameterDataAccess.getOne(getApplicationContext(), GlobalData.getSharedGlobalData().getUser().getUuid_user(), "PRM13_DIST").getGs_value()));
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
manager = new LocationTrackingManager(tm, lm, getApplicationContext());
|
||||
manager.setMinimalDistanceChangeLocation(50);
|
||||
manager.setMinimalTimeChangeLocation(5);
|
||||
manager.applyLocationListener(getApplicationContext());
|
||||
}
|
||||
|
||||
if (Global.LTM == null) {
|
||||
Global.LTM = manager;
|
||||
} else {
|
||||
try {
|
||||
Global.LTM = null;
|
||||
Global.LTM = manager;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.adins.mss.odr.accounts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.db.dataaccess.GroupTaskDataAccess;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.adapter.OpportunityListAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class OpportunityTabFragment extends Fragment {
|
||||
private FragmentActivity activity;
|
||||
private Account account;
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private RecyclerView.Adapter adapter;
|
||||
private String uuidAccount;
|
||||
private List<GroupTask> groupTasks;
|
||||
|
||||
public OpportunityTabFragment(FragmentActivity activity, Account account) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public OpportunityTabFragment(FragmentActivity activity, List<GroupTask> groupTasks) {
|
||||
this.activity = activity;
|
||||
this.groupTasks = groupTasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.account_contact_tab, container, false);
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(activity);
|
||||
list.setLayoutManager(layoutManager);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
uuidAccount = account.getUuid_account();
|
||||
groupTasks = GroupTaskDataAccess.getAllByAccount(activity, uuidAccount);
|
||||
|
||||
adapter = new OpportunityListAdapter(activity, groupTasks);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
//
|
||||
// setRetainInstance(true);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().setTitle(getString(R.string.title_mn_account));
|
||||
|
||||
adapter = new OpportunityListAdapter(activity, groupTasks);
|
||||
list.setAdapter(adapter);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
|
||||
import com.adins.mss.base.dynamicform.form.ScrollingLinearLayoutManager;
|
||||
import com.adins.mss.base.dynamicform.form.questions.OnQuestionClickListener;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/30/2018.
|
||||
*/
|
||||
|
||||
public class AccountButtonAdapter extends ExpandableRecyclerView.Adapter<RecyclerView.ViewHolder, ButtonOpportunityViewHolder, LeadHistory, String> {
|
||||
private static final int FADE_DURATION = 300; // in milliseconds
|
||||
private final LinkedHashMap<String, List<LeadHistory>> mValues;
|
||||
private final List<String> mGroups;
|
||||
private final FragmentActivity mActivity;
|
||||
private final int VIEW_TYPE_LOADING = 999;
|
||||
public ScrollingLinearLayoutManager linearLayoutManager;
|
||||
public ExpandableRecyclerView mRecyclerView;
|
||||
private OnQuestionClickListener mListener;
|
||||
|
||||
public AccountButtonAdapter(FragmentActivity activity, ExpandableRecyclerView recyclerView, LinkedHashMap<String, List<LeadHistory>> items, OnQuestionClickListener listener){
|
||||
mActivity=activity;
|
||||
mValues=items;
|
||||
mListener=listener;
|
||||
mGroups=new ArrayList<>();
|
||||
mGroups.add("Opportunities");
|
||||
mRecyclerView=recyclerView;
|
||||
}
|
||||
@Override
|
||||
public int getGroupItemCount() {
|
||||
return mGroups.size()-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildItemCount(int group) {
|
||||
return mValues.get(mGroups.get(group)).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupItem(int position) {
|
||||
return mGroups.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeadHistory getChildItem(int group, int position) {
|
||||
return mValues.get(getGroupItem(group)).get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ButtonOpportunityViewHolder onCreateGroupViewHolder(ViewGroup parent) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_groupbutton, parent, false);
|
||||
return new ButtonOpportunityViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindGroupViewHolder(ButtonOpportunityViewHolder holder, int group) {
|
||||
super.onBindGroupViewHolder(holder, group);
|
||||
String qGroup = "";
|
||||
try {
|
||||
qGroup = getGroupItem(group);
|
||||
}catch (Exception e){}
|
||||
|
||||
holder.bind(qGroup);
|
||||
setFadeAnimation(holder.itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LeadHistoryHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_lead, parent, false);
|
||||
return new LeadHistoryHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildItemViewType(int group, int position) {
|
||||
int viewType=1;
|
||||
return getChildItem(group, position) == null ? VIEW_TYPE_LOADING : viewType;
|
||||
}
|
||||
|
||||
public void onBindChildViewHolder(RecyclerView.ViewHolder mHolder, int group, int position) {
|
||||
super.onBindChildViewHolder(mHolder, group, position);
|
||||
final LeadHistoryHolder holder = (LeadHistoryHolder) mHolder;
|
||||
holder.bind(getChildItem(group, position));
|
||||
setFadeAnimation(mHolder.itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
|
||||
super.onViewDetachedFromWindow(holder);
|
||||
holder.itemView.clearAnimation();
|
||||
}
|
||||
|
||||
private void setFadeAnimation(View view) {
|
||||
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim.setDuration(FADE_DURATION);
|
||||
view.startAnimation(anim);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/28/2018.
|
||||
*/
|
||||
|
||||
public class AccountButtonOpportunitiesAdapter extends BaseExpandableListAdapter {
|
||||
|
||||
private Context _context;
|
||||
private List<String> _listDataHeader; // header titles
|
||||
// child data in format of header title, child title
|
||||
private HashMap<String, List<String>> _listDataChild;
|
||||
|
||||
public AccountButtonOpportunitiesAdapter(Context context, List<String> listDataHeader,
|
||||
HashMap<String, List<String>> listChildData) {
|
||||
this._context = context;
|
||||
this._listDataHeader = listDataHeader;
|
||||
this._listDataChild = listChildData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosititon) {
|
||||
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
|
||||
.get(childPosititon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
return childPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(int groupPosition, final int childPosition,
|
||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
|
||||
final String childText = (String) getChild(groupPosition, childPosition);
|
||||
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) this._context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.list_lead, null);
|
||||
}
|
||||
|
||||
TextView txtListChild = (TextView) convertView
|
||||
.findViewById(R.id.txtProductAcc);
|
||||
|
||||
txtListChild.setText(childText);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
|
||||
.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGroup(int groupPosition) {
|
||||
return this._listDataHeader.get(groupPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
return this._listDataHeader.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded,
|
||||
View convertView, ViewGroup parent) {
|
||||
String headerTitle = (String) getGroup(groupPosition);
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) this._context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.list_groupbutton, null);
|
||||
}
|
||||
|
||||
TextView lblListHeader = (TextView) convertView
|
||||
.findViewById(R.id.lblListHeader);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.AccountDetailFragment;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class AccountListAdapter extends RecyclerView.Adapter<AccountListAdapter.AccountListViewHolder> {
|
||||
|
||||
private static FragmentActivity activity;
|
||||
private List<Account> accounts;
|
||||
protected Fragment fragment;
|
||||
|
||||
public AccountListAdapter(FragmentActivity activity, List<Account> accounts) {
|
||||
this.activity = activity;
|
||||
this.accounts = accounts;
|
||||
}
|
||||
|
||||
public class AccountListViewHolder extends RecyclerView.ViewHolder {
|
||||
public String phoneNumber;
|
||||
public final View mView;
|
||||
public Account mItem;
|
||||
public final TextView txtName;
|
||||
public final TextView txtInitial;
|
||||
public final ImageButton btnCall;
|
||||
|
||||
public AccountListViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
mView = itemView;
|
||||
txtName = (TextView) itemView.findViewById(R.id.txtName);
|
||||
txtInitial = (TextView) itemView.findViewById(R.id.txtThumbnailCircle);
|
||||
btnCall = (ImageButton) itemView.findViewById(R.id.callButtonAccount);
|
||||
}
|
||||
|
||||
public void bind(Account account) {
|
||||
mItem = account;
|
||||
txtName.setText(account.getAccount_name());
|
||||
txtInitial.setText(initial(account.getAccount_name()));
|
||||
|
||||
if(account.getAccount_phone_1()!=null){
|
||||
phoneNumber=account.getAccount_phone_1();
|
||||
btnCall.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (ActivityCompat.checkSelfPermission(btnCall.getContext(),
|
||||
android.Manifest.permission.CALL_PHONE)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||
callIntent.setData(Uri.parse("tel:"+phoneNumber));
|
||||
activity.startActivity(callIntent);
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(activity, new String[]{android.Manifest.permission.CALL_PHONE}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
btnCall.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(activity,"This customer does not have any registered phone number",Toast.LENGTH_SHORT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.new_account_list_item, parent, false);
|
||||
AccountListViewHolder viewHolder = new AccountListViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final AccountListViewHolder holder, final int position) {
|
||||
holder.mItem = accounts.get(position);
|
||||
holder.bind(accounts.get(position));
|
||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openDetail(accounts.get(position));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (accounts == null || accounts.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return accounts.size();
|
||||
}
|
||||
|
||||
public void openDetail(Account account) {
|
||||
fragment = new AccountDetailFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("uuidAccount", account.getUuid_account());
|
||||
fragment.setArguments(bundle);
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
private String initial(String initial) {
|
||||
Pattern p = Pattern.compile("((^| )[A-Za-z])");
|
||||
Matcher m = p.matcher(initial);
|
||||
StringBuilder init = new StringBuilder();
|
||||
int counter =0;
|
||||
while (m.find() && counter<2) {
|
||||
init.append(m.group().trim());
|
||||
counter++;
|
||||
}
|
||||
|
||||
return init.toString().toUpperCase();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/21/2017.
|
||||
*/
|
||||
|
||||
public class ActivityTodoAdapter extends RecyclerView.Adapter<ActivityTodoAdapter.ActivityTodoViewholder> {
|
||||
private static FragmentActivity activity;
|
||||
private List<TaskH> listTask;
|
||||
|
||||
public ActivityTodoAdapter(FragmentActivity activity, List<TaskH> listTask) {
|
||||
this.activity = activity;
|
||||
this.listTask = listTask;
|
||||
}
|
||||
|
||||
public class ActivityTodoViewholder extends RecyclerView.ViewHolder {
|
||||
public final TextView txtId;
|
||||
public final TextView txtDate;
|
||||
public final TextView txtStatus;
|
||||
public final TextView txtNotes;
|
||||
|
||||
public ActivityTodoViewholder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
txtId = (TextView) itemView.findViewById(R.id.txtId);
|
||||
txtDate = (TextView) itemView.findViewById(R.id.txtDate);
|
||||
txtStatus = (TextView) itemView.findViewById(R.id.txtStatus);
|
||||
txtNotes = (TextView) itemView.findViewById(R.id.txtNotes);
|
||||
}
|
||||
|
||||
public void bind(TaskH taskH) {
|
||||
txtId.setText(taskH.getTask_id());
|
||||
txtStatus.setText(taskH.getStatus_code());
|
||||
txtNotes.setText(taskH.getNotes());
|
||||
|
||||
String str_dtm_crt = "";
|
||||
Date date;
|
||||
|
||||
if (taskH.getSubmit_date() == null) {
|
||||
if (taskH.getPts_date() != null)
|
||||
date = taskH.getPts_date();
|
||||
else
|
||||
date = taskH.getAssignment_date();
|
||||
|
||||
if (date != null)
|
||||
str_dtm_crt = Formatter.formatDate(date, Global.DATE_STR_FORMAT5);
|
||||
|
||||
txtStatus.setVisibility(View.GONE );
|
||||
} else {
|
||||
date = taskH.getSubmit_date();
|
||||
if (date != null)
|
||||
str_dtm_crt = Formatter.formatDate(date, Global.DATE_TIMESEC_TIMELINE_FORMAT_OLD);
|
||||
}
|
||||
|
||||
txtDate.setText(str_dtm_crt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityTodoViewholder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.opportunity_detail_item, parent, false);
|
||||
ActivityTodoViewholder viewHolder = new ActivityTodoViewholder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ActivityTodoViewholder holder, int position) {
|
||||
holder.bind(listTask.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (listTask == null || listTask.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return listTask.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/30/2018.
|
||||
*/
|
||||
|
||||
public class ButtonOpportunityViewHolder extends ExpandableRecyclerView.GroupViewHolder {
|
||||
public TextView text;
|
||||
private boolean expanded;
|
||||
|
||||
public ButtonOpportunityViewHolder(View view){
|
||||
super(view);
|
||||
text = (TextView) itemView.findViewById(R.id.lblListHeader);
|
||||
}
|
||||
|
||||
public void bind(String questioGroupName){
|
||||
setText(questioGroupName);
|
||||
}
|
||||
public void expand() {
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(200);
|
||||
animator.start();
|
||||
expanded = true;
|
||||
}
|
||||
|
||||
public void collapse() {
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(200);
|
||||
animator.start();
|
||||
expanded = false;
|
||||
}
|
||||
|
||||
public void setExpanded(boolean expanded) {
|
||||
this.expanded = expanded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExpanded() {
|
||||
return expanded;
|
||||
}
|
||||
|
||||
public void setText(String t) {
|
||||
text.setText(t);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text.getText().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.Contact;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.LoadContact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class ContactListAdapter extends RecyclerView.Adapter<ContactListAdapter.ContactListViewHolder> {
|
||||
|
||||
private static FragmentActivity activity;
|
||||
private List<Product> productList;
|
||||
private Account account;
|
||||
|
||||
public ContactListAdapter(FragmentActivity activity, Account account, List<Product> productList) {
|
||||
this.activity = activity;
|
||||
this.account = account;
|
||||
this.productList = productList;
|
||||
}
|
||||
|
||||
public class ContactListViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final TextView txtProduct;
|
||||
|
||||
public ContactListViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = itemView;
|
||||
txtProduct = (TextView) itemView.findViewById(R.id.txtProduct);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContactListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.productc_contact_list_item, parent, false);
|
||||
ContactListViewHolder viewHolder = new ContactListViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ContactListViewHolder holder, final int position) {
|
||||
holder.txtProduct.setText(productList.get(position).getProduct_name());
|
||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// showDetail(activity, productList.get(position));
|
||||
LoadContact task = new LoadContact(activity, account, productList.get(position).getUuid_product());
|
||||
task.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (productList == null || productList.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return productList.size();
|
||||
}
|
||||
|
||||
private void showDetail(FragmentActivity activity, Contact contact) {
|
||||
final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.Dialog_NoTitle)
|
||||
.setView(R.layout.dialog_contact_detail)
|
||||
.create();
|
||||
dialog.setCancelable(true);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();
|
||||
wmlp.gravity = Gravity.BOTTOM;
|
||||
wmlp.windowAnimations = R.style.DialogAnimation;
|
||||
dialog.show();
|
||||
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
TextView contactName = (TextView) dialog.findViewById(R.id.txtName);
|
||||
TextView contactDept = (TextView) dialog.findViewById(R.id.txtDepartment);
|
||||
TextView contactPhone = (TextView) dialog.findViewById(R.id.txtPhone);
|
||||
TextView contactEmail = (TextView) dialog.findViewById(R.id.txtEmail);
|
||||
|
||||
contactName.setText(contact.getContact_name());
|
||||
contactDept.setText(contact.getContact_dept());
|
||||
contactPhone.setText(contact.getContact_phone());
|
||||
contactEmail.setText(contact.getContact_email());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/30/2018.
|
||||
*/
|
||||
|
||||
public class LeadHistory {
|
||||
private String leadStatus;
|
||||
private String leadProduct;
|
||||
private String leadLastDate;
|
||||
|
||||
public LeadHistory(String leadStatus, String leadProduct, String leadLastDate) {
|
||||
this.leadStatus = leadStatus;
|
||||
this.leadProduct = leadProduct;
|
||||
this.leadLastDate = leadLastDate;
|
||||
}
|
||||
|
||||
public String getLeadStatus() {
|
||||
return leadStatus;
|
||||
}
|
||||
|
||||
public void setLeadStatus(String leadStatus) {
|
||||
this.leadStatus = leadStatus;
|
||||
}
|
||||
|
||||
public String getLeadProduct() {
|
||||
return leadProduct;
|
||||
}
|
||||
|
||||
public void setLeadProduct(String leadProduct) {
|
||||
this.leadProduct = leadProduct;
|
||||
}
|
||||
|
||||
public String getLeadLastDate() {
|
||||
return leadLastDate;
|
||||
}
|
||||
|
||||
public void setLeadLastDate(String leadLastDate) {
|
||||
this.leadLastDate = leadLastDate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/30/2018.
|
||||
*/
|
||||
|
||||
public class LeadHistoryDetail {
|
||||
private String leadHistoryDate;
|
||||
private String leadHistoryProduct;
|
||||
private String leadCommVia;
|
||||
private String leadHistoryNotes;
|
||||
|
||||
public LeadHistoryDetail(String leadHistoryDate, String leadHistoryProduct, String leadCommVia, String leadHistoryNotes) {
|
||||
this.leadHistoryDate = leadHistoryDate;
|
||||
this.leadHistoryProduct = leadHistoryProduct;
|
||||
this.leadCommVia = leadCommVia;
|
||||
this.leadHistoryNotes = leadHistoryNotes;
|
||||
}
|
||||
|
||||
public String getLeadHistoryDate() {
|
||||
return leadHistoryDate;
|
||||
}
|
||||
|
||||
public void setLeadHistoryDate(String leadHistoryDate) {
|
||||
this.leadHistoryDate = leadHistoryDate;
|
||||
}
|
||||
|
||||
public String getLeadHistoryProduct() {
|
||||
return leadHistoryProduct;
|
||||
}
|
||||
|
||||
public void setLeadHistoryProduct(String leadHistoryProduct) {
|
||||
this.leadHistoryProduct = leadHistoryProduct;
|
||||
}
|
||||
|
||||
public String getLeadCommVia() {
|
||||
return leadCommVia;
|
||||
}
|
||||
|
||||
public void setLeadCommVia(String leadCommVia) {
|
||||
this.leadCommVia = leadCommVia;
|
||||
}
|
||||
|
||||
public String getLeadHistoryNotes() {
|
||||
return leadHistoryNotes;
|
||||
}
|
||||
|
||||
public void setLeadHistoryNotes(String leadHistoryNotes) {
|
||||
this.leadHistoryNotes = leadHistoryNotes;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.libs.nineoldandroids.view.ViewHelper;
|
||||
import com.adins.mss.base.dynamicform.form.questions.viewholder.ExpandableRecyclerView;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
/**
|
||||
* Created by muhammad.aap on 11/30/2018.
|
||||
*/
|
||||
|
||||
public class LeadHistoryHolder extends ExpandableRecyclerView.GroupViewHolder {
|
||||
public ImageView expandedIndicator;
|
||||
public TextView text;
|
||||
public TextView text2;
|
||||
public TextView text3;
|
||||
private boolean expanded;
|
||||
|
||||
public LeadHistoryHolder(View view){
|
||||
super(view);
|
||||
expandedIndicator = (ImageView) itemView.findViewById(R.id.leadHistoryExpandedIndicator);
|
||||
text = (TextView) itemView.findViewById(R.id.txtStatusTaskAcc);
|
||||
text2 = (TextView) itemView.findViewById(R.id.txtProductAcc);
|
||||
text3 = (TextView) itemView.findViewById(R.id.txtDateAcc);
|
||||
}
|
||||
|
||||
public void bind(LeadHistory leadHistory){
|
||||
setText(leadHistory.getLeadStatus());
|
||||
setText2(leadHistory.getLeadProduct());
|
||||
setText3(leadHistory.getLeadLastDate());
|
||||
}
|
||||
public void expand() {
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(200);
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
ViewHelper.setRotation(expandedIndicator, 180 * (float) (animation.getAnimatedValue()));
|
||||
expandedIndicator.postInvalidate();
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
expanded = true;
|
||||
}
|
||||
|
||||
public void collapse() {
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(200);
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
ViewHelper.setRotation(expandedIndicator, 180 * (float) (animation.getAnimatedValue()));
|
||||
expandedIndicator.postInvalidate();
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
expanded = false;
|
||||
}
|
||||
|
||||
public void setExpanded(boolean expanded) {
|
||||
ViewHelper.setRotation(expandedIndicator, expanded ? 180 : 0);
|
||||
this.expanded = expanded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExpanded() {
|
||||
return expanded;
|
||||
}
|
||||
|
||||
public void setText(String t) {
|
||||
text.setText(t);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text.getText().toString();
|
||||
}
|
||||
|
||||
public void setText2(String t) {
|
||||
text2.setText(t);
|
||||
}
|
||||
|
||||
public String getText2() {
|
||||
return text2.getText().toString();
|
||||
}
|
||||
|
||||
public void setText3(String t) {
|
||||
text3.setText(t);
|
||||
}
|
||||
|
||||
public String getText3() {
|
||||
return text3.getText().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.adins.mss.odr.accounts.adapter;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.LoadOpportunityDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class OpportunityListAdapter extends RecyclerView.Adapter<OpportunityListAdapter.OpportunityListViewHolder> {
|
||||
private static FragmentActivity activity;
|
||||
private List<GroupTask> groupTasks;
|
||||
|
||||
public OpportunityListAdapter(FragmentActivity activity, List<GroupTask> groupTasks) {
|
||||
this.activity = activity;
|
||||
this.groupTasks = groupTasks;
|
||||
}
|
||||
|
||||
public class OpportunityListViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final TextView txtId;
|
||||
public final TextView txtStatus;
|
||||
public final TextView txtProduct;
|
||||
|
||||
public OpportunityListViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = itemView;
|
||||
txtId = (TextView) itemView.findViewById(R.id.txtId);
|
||||
txtStatus = (TextView) itemView.findViewById(R.id.txtStatus);
|
||||
txtProduct = (TextView) itemView.findViewById(R.id.txtProduct);
|
||||
}
|
||||
|
||||
public void bind(GroupTask groupTask) {
|
||||
txtId.setText(groupTask.getGroup_task_id());
|
||||
txtStatus.setText(groupTask.getLast_status());
|
||||
txtProduct.setText(groupTask.getProduct_name());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpportunityListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.opportunity_list_item, parent, false);
|
||||
OpportunityListViewHolder viewHolder = new OpportunityListViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(OpportunityListViewHolder holder, final int position) {
|
||||
holder.bind(groupTasks.get(position));
|
||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LoadOpportunityDetail request = new LoadOpportunityDetail(activity, groupTasks.get(position));
|
||||
request.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (groupTasks == null || groupTasks.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return groupTasks.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/16/2017.
|
||||
*/
|
||||
|
||||
public class AccountsSearchRequest extends MssRequestType {
|
||||
|
||||
@SerializedName("uuid_account")
|
||||
private String uuid_account;
|
||||
@SerializedName("uuid_product")
|
||||
private String uuid_product;
|
||||
@SerializedName("uuid_status")
|
||||
private String uuid_status;
|
||||
|
||||
public String getUuid_account() {
|
||||
return uuid_account;
|
||||
}
|
||||
|
||||
public String getUuid_product() {
|
||||
return uuid_product;
|
||||
}
|
||||
|
||||
public void setUuid_product(String uuid_product) {
|
||||
this.uuid_product = uuid_product;
|
||||
}
|
||||
|
||||
public String getUuid_status() {
|
||||
return uuid_status;
|
||||
}
|
||||
|
||||
public void setUuid_status(String uuid_status) {
|
||||
this.uuid_status = uuid_status;
|
||||
}
|
||||
|
||||
public void setUuid_account(String uuid_account) {
|
||||
this.uuid_account = uuid_account;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/16/2017.
|
||||
*/
|
||||
|
||||
public class AccountsSearchResponse extends MssResponseType {
|
||||
|
||||
@SerializedName("listAccount")
|
||||
List<Account> listAccount;
|
||||
|
||||
public List<Account> getListAccount() {
|
||||
return listAccount;
|
||||
}
|
||||
|
||||
public void setListAccount(List<Account> listAccount) {
|
||||
this.listAccount = listAccount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class LoadContactRequest extends MssRequestType {
|
||||
@SerializedName("uuid_account")
|
||||
private String uuid_account;
|
||||
|
||||
@SerializedName("uuid_product")
|
||||
private String uuid_product;
|
||||
|
||||
public String getUuid_account() {
|
||||
return uuid_account;
|
||||
}
|
||||
|
||||
public void setUuid_account(String uuid_account) {
|
||||
this.uuid_account = uuid_account;
|
||||
}
|
||||
|
||||
public String getUuid_product() {
|
||||
return uuid_product;
|
||||
}
|
||||
|
||||
public void setUuid_product(String uuid_product) {
|
||||
this.uuid_product = uuid_product;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.Contact;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class LoadContactResponse extends MssResponseType {
|
||||
|
||||
@SerializedName("listContact")
|
||||
List<Contact> listContact;
|
||||
|
||||
public List<Contact> getListContact() {
|
||||
return listContact;
|
||||
}
|
||||
|
||||
public void setListContact(List<Contact> listContact) {
|
||||
this.listContact = listContact;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/21/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunityDetailRequest extends MssRequestType {
|
||||
@SerializedName("group_task_id")
|
||||
private String group_task_id;
|
||||
|
||||
public String getGroup_task_id() {
|
||||
return group_task_id;
|
||||
}
|
||||
|
||||
public void setGroup_task_id(String group_task_id) {
|
||||
this.group_task_id = group_task_id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/21/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunityDetailResponse extends MssResponseType {
|
||||
@SerializedName("listOpporDetail")
|
||||
List<TaskH> listOpporDetail;
|
||||
|
||||
public List<TaskH> getListOpporDetail() {
|
||||
return listOpporDetail;
|
||||
}
|
||||
|
||||
public void setListOpporDetail(List<TaskH> listOpporDetail) {
|
||||
this.listOpporDetail = listOpporDetail;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class LoadOpportunityResponse extends MssResponseType {
|
||||
@SerializedName("listOppor")
|
||||
private List<GroupTask> listOppor;
|
||||
|
||||
public List<GroupTask> getListOppor() {
|
||||
return listOppor;
|
||||
}
|
||||
|
||||
public void setListOppor(List<GroupTask> listOppor) {
|
||||
this.listOppor = listOppor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 12/19/2017.
|
||||
*/
|
||||
|
||||
public class LoadProductContactRequest extends MssRequestType {
|
||||
@SerializedName("uuid_account")
|
||||
private String uuid_account;
|
||||
|
||||
public String getUuid_account() {
|
||||
return uuid_account;
|
||||
}
|
||||
|
||||
public void setUuid_account(String uuid_account) {
|
||||
this.uuid_account = uuid_account;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.accounts.api;
|
||||
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 12/19/2017.
|
||||
*/
|
||||
|
||||
public class LoadProductContactResponse extends MssResponseType {
|
||||
@SerializedName("listProduct")
|
||||
private List<Product> listProduct;
|
||||
|
||||
public List<Product> getListProduct() {
|
||||
return listProduct;
|
||||
}
|
||||
|
||||
public void setListProduct(List<Product> listProduct) {
|
||||
this.listProduct = listProduct;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Keep;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.model.JsonRequestDetailOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.androidquery.AQuery;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LookupAssignment extends Activity{
|
||||
AQuery query ;
|
||||
OrderAssignmentAdapter adapter;
|
||||
List<ResponseServer> responseServer;
|
||||
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.default_listview);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
query = new AQuery(this);
|
||||
query.id(android.R.id.list).itemClicked(this, "itemClick");
|
||||
String flag = getIntent().getStringExtra(Global.BUND_KEY_TASK);
|
||||
String uuid_task_h = getIntent().getStringExtra(Global.BUND_KEY_UUID_TASKH);
|
||||
new GetRequestDataLookup(uuid_task_h,flag).execute();
|
||||
}
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try {
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
if (null == locale) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
}
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
@Keep
|
||||
public void itemClick(AdapterView<?> parent, View v, int position, long id){
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Global.BUND_KEY_ASSIGNEE_ID, responseServer.get(position).getKey());
|
||||
intent.putExtra(Global.BUND_KEY_ASSIGNEE_VALUE, responseServer.get(position).getValue());
|
||||
intent.putExtra(Global.BUND_KEY_ASSIGNEE_JOB, responseServer.get(position).getFlag());
|
||||
setResult(Global.REQUEST_CODE_LOOKUP, intent);
|
||||
finish();
|
||||
}
|
||||
private class GetRequestDataLookup extends AsyncTask<Void, Void, JsonResponseServer> {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage = null;
|
||||
private String uuid_task_h;
|
||||
private String flag;
|
||||
|
||||
public GetRequestDataLookup(String uuid_task_h, String flag) {
|
||||
this.flag = flag;
|
||||
this.uuid_task_h=uuid_task_h;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(LookupAssignment.this,
|
||||
"", getString(R.string.progressWait), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonResponseServer doInBackground(Void... params) {
|
||||
String result = null;
|
||||
|
||||
JsonRequestDetailOrder request = new JsonRequestDetailOrder();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
request.setUuid_task_h(uuid_task_h);
|
||||
request.setFlag(flag);
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_LOOKUP();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getApplicationContext(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json);
|
||||
result = serverResult.getResult();
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
JsonResponseServer response =null;
|
||||
try {
|
||||
response = GsonHelper.fromJson(result, JsonResponseServer.class);
|
||||
} catch (Exception e) {
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(JsonResponseServer result){
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if(errMessage!=null){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(LookupAssignment.this);
|
||||
dialogBuilder.withTitle(getString(R.string.error_capital))
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
}
|
||||
else if(result==null){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(LookupAssignment.this);
|
||||
dialogBuilder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
}else{
|
||||
if(result.getStatus().getCode()==0){
|
||||
responseServer = result.getListResponseServer();
|
||||
adapter = new OrderAssignmentAdapter(getApplicationContext(), responseServer, true);
|
||||
query.id(android.R.id.list).adapter(adapter);
|
||||
}else{
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(LookupAssignment.this);
|
||||
dialogBuilder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(result.getStatus().getMessage())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.androidquery.AQuery;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderAssignmentActivity extends Fragment {
|
||||
|
||||
protected View view;
|
||||
protected AQuery query;
|
||||
protected List<TaskH> allObjects;
|
||||
protected List<TaskH> objects;
|
||||
protected JsonResponseServer results;
|
||||
private List<ResponseServer> responseServer;
|
||||
private Bundle mArguments;
|
||||
protected OrderAssignmentAdapter adapter;
|
||||
private FirebaseAnalytics screenName;
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
super.onAttach(activity);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
mArguments = getArguments();
|
||||
getActivity().getActionBar().setTitle(getString(R.string.title_mn_orderassign));
|
||||
results = (JsonResponseServer) mArguments.getSerializable("resultJson");
|
||||
responseServer = results.getListResponseServer();
|
||||
adapter = new OrderAssignmentAdapter(getActivity(), responseServer,false);
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_order_assignment), null);
|
||||
getActivity().getActionBar().setTitle(getString(R.string.title_mn_orderassign));
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
if (view != null) {
|
||||
ViewGroup parent = (ViewGroup) view.getParent();
|
||||
if (parent != null)
|
||||
parent.removeView(view);
|
||||
}
|
||||
try {
|
||||
view = inflater.inflate(R.layout.newtask_layout, container, false);
|
||||
query = new AQuery(view);
|
||||
query.id(android.R.id.list).adapter(adapter);
|
||||
query.id(android.R.id.list).itemClicked(this, "itemClick");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return view;
|
||||
}
|
||||
@Keep
|
||||
public void itemClick(AdapterView<?> parent, View v, int position, long id){
|
||||
String nomorOrder = responseServer.get(position).getKey();
|
||||
String uuid_task_h = responseServer.get(position).getFlag();
|
||||
gotoDetailData(nomorOrder, uuid_task_h);
|
||||
}
|
||||
private void gotoDetailData(String nomorOrder,String uuid_task_h) {
|
||||
Intent intent = new Intent(getActivity(), OrderAssignmentResult.class);
|
||||
intent.putExtra(Global.BUND_KEY_ORDERNO, nomorOrder);
|
||||
intent.putExtra(Global.BUND_KEY_TASK_TYPE, Global.TASK_ORDER_ASSIGNMENT);
|
||||
intent.putExtra(Global.BUND_KEY_UUID_TASKH, uuid_task_h);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import com.adins.mss.dao.TaskH;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderAssignmentAdapter extends ArrayAdapter<ResponseServer>{
|
||||
private Context context;
|
||||
private List<TaskH> objects;
|
||||
private List<ResponseServer> responseServer;
|
||||
private boolean isLookup = false;
|
||||
AQuery query;
|
||||
|
||||
public OrderAssignmentAdapter(Context context, List<ResponseServer> objects, boolean isLookup) {
|
||||
super(context, R.layout.orderassignment_item_layout, objects);
|
||||
this.context = context;
|
||||
this.responseServer = objects;
|
||||
this.isLookup=isLookup;
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return responseServer.size();
|
||||
}
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.orderassignment_item_layout, parent, false);
|
||||
}
|
||||
query = new AQuery(convertView);
|
||||
ResponseServer header = responseServer.get(position);
|
||||
if(isLookup){
|
||||
if(header.getKey()!=null)
|
||||
query.id(R.id.txtNoOrder).text(header.getFlag());
|
||||
}else{
|
||||
if(header.getKey()!=null)
|
||||
query.id(R.id.txtNoOrder).text(header.getKey());
|
||||
}
|
||||
query.id(R.id.txtCustomerName).text(header.getValue());
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.timeline.MapsViewer;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.model.JsonRequestDetailOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.adins.mss.odr.model.JsonResponseServer.ResponseServer;
|
||||
import com.adins.mss.odr.tool.ImageThumbnail;
|
||||
import com.adins.mss.odr.tool.getImageTask;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class OrderAssignmentResult extends Activity implements OnClickListener{
|
||||
String nomorOrder;
|
||||
TableLayout detailTable;
|
||||
Button btnLookupCMO;
|
||||
Button btnSubmit;
|
||||
RelativeLayout bottomLayout;
|
||||
int taskType;
|
||||
String flag;
|
||||
String uuid_task_h;
|
||||
TextView txtCMO;
|
||||
TextView txtNotes;
|
||||
Map<ImageThumbnail, String> thumbnailMapping = new HashMap<ImageThumbnail, String>();
|
||||
List<ResponseServer> list;
|
||||
String assignId;
|
||||
public static ImageThumbnail targetThumbnail = null;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
setContentView(R.layout.orderassignment_result_layout);
|
||||
nomorOrder = getIntent().getExtras().getString(Global.BUND_KEY_ORDERNO);
|
||||
taskType = getIntent().getExtras().getInt(Global.BUND_KEY_TASK_TYPE);
|
||||
uuid_task_h = getIntent().getExtras().getString(Global.BUND_KEY_UUID_TASKH);
|
||||
flag = flagParamForType(taskType);
|
||||
initialize();
|
||||
new GetRequestDataDetail(nomorOrder, flag).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this, getString(R.string.screen_name_order_assignment_result), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try {
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
if (null == locale) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
}
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
private String flagParamForType(int taskType2) {
|
||||
switch (taskType) {
|
||||
case Global.TASK_ORDER_ASSIGNMENT:
|
||||
return "assign";
|
||||
case Global.TASK_ORDER_REASSIGNMENT:
|
||||
return "reassign";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
protected void initialize() {
|
||||
// TODO Auto-generated method stub
|
||||
detailTable = (TableLayout)findViewById(R.id.orderDetailTable);
|
||||
btnLookupCMO = (Button)findViewById(R.id.btnLookupCMO);
|
||||
btnSubmit = (Button)findViewById(R.id.btnSubmit);
|
||||
txtCMO = (TextView)findViewById(R.id.txtCMO);
|
||||
txtNotes = (TextView)findViewById(R.id.txtNotes);
|
||||
bottomLayout = (RelativeLayout)findViewById(R.id.Bottomlayout);
|
||||
}
|
||||
|
||||
public class GetRequestDataDetail extends AsyncTask<Void, Void, String> {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage = null;
|
||||
private String flag;
|
||||
private String nomorOrder;
|
||||
|
||||
public GetRequestDataDetail(String nomorOrder, String flag) {
|
||||
this.nomorOrder = nomorOrder;
|
||||
this.flag = flag;
|
||||
}
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(OrderAssignmentResult.this,
|
||||
"", getString(R.string.progressWait), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
String result = null;
|
||||
JsonRequestDetailOrder request = new JsonRequestDetailOrder();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
// request.setNomor_order(this.nomorOrder);
|
||||
request.setUuid_task_h(uuid_task_h);
|
||||
// request.setFlag(this.flag);
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DETAIL_ORDER();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getApplicationContext(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
// result = "{\"listResponseServer\":[{\"key\":\"Nama\",\"value\":\"Gigin Gnanjar\",\"flag\":\"0\"},{\"key\":\"Alamat\",\"value\":\"Kebon Jeruk\",\"flag\":\"0\"},{\"key\":\"Foto Rumah\",\"value\":\"123456\",\"flag\":\"1\"},{\"key\":\"Location\",\"value\":\"-6.198076,106.763137\",\"flag\":\"2\"}],\"status\":{\"code\":0}}";
|
||||
result = serverResult.getResult();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(String result){
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if("".equals(result)){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getApplicationContext());
|
||||
dialogBuilder.withTitle(getString(R.string.info_capital))
|
||||
.withMessage(getString(R.string.msgUnavaibleLocationCheckIn))
|
||||
.show();
|
||||
}else{
|
||||
loadDataDetailFromServer(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void loadDataDetailFromServer(String result){
|
||||
|
||||
int no =1;
|
||||
LayoutParams lpSpace =new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||
LayoutParams lpQuestion =new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.25f);
|
||||
LayoutParams lpNo =new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0.4f);
|
||||
|
||||
try {
|
||||
JsonResponseServer resultOrder = GsonHelper.fromJson(result, JsonResponseServer.class);
|
||||
list = resultOrder.getListResponseServer();
|
||||
for(ResponseServer responseServer : list){
|
||||
String question = responseServer.getKey();
|
||||
String answer = responseServer.getValue();
|
||||
String flag = responseServer.getFlag();
|
||||
|
||||
LinearLayout row = new LinearLayout(this);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
|
||||
if (no%2 == 0) row.setBackgroundResource(R.color.tv_normal);
|
||||
else row.setBackgroundColor(Color.WHITE);
|
||||
|
||||
TextView lblNo = new TextView(this);
|
||||
lblNo.setText(no+ ". ");
|
||||
lblNo.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
lblNo.setLayoutParams(lpNo);
|
||||
row.addView(lblNo);
|
||||
|
||||
TextView lblQuestion = new TextView(this);
|
||||
lblQuestion.setText(question);
|
||||
lblQuestion.setLayoutParams(lpQuestion);
|
||||
row.addView(lblQuestion);
|
||||
|
||||
TextView lblSpace = new TextView(this);
|
||||
lblSpace.setText(" : ");
|
||||
lblSpace.setLayoutParams(lpSpace);
|
||||
row.addView(lblSpace);
|
||||
if(flag.equals(Global.FLAG_FOR_IMAGE)){
|
||||
int w = 200;//GlobalData.getSharedGlobalData().getThumbnailWidth();
|
||||
int h = 160;//GlobalData.getSharedGlobalData().getThumbnailHeight();
|
||||
int density = getResources().getDisplayMetrics().densityDpi;
|
||||
if(density==DisplayMetrics.DENSITY_LOW){
|
||||
w = 80;
|
||||
h = 50;
|
||||
}else if(density==DisplayMetrics.DENSITY_MEDIUM){
|
||||
w = 120;
|
||||
h = 90;
|
||||
}
|
||||
final ImageThumbnail thumb = new ImageThumbnail(this, w, h);
|
||||
thumb.setOnClickListener(this);
|
||||
thumb.setLayoutParams(lpQuestion);
|
||||
thumbnailMapping.put(thumb, answer);
|
||||
row.addView(thumb);
|
||||
}else if(flag.equals(Global.FLAG_FOR_LOCATION)){
|
||||
final ImageThumbnail thumb = new ImageThumbnail(this, 90, 90);
|
||||
thumb.setImageResource(R.drawable.ic_absent);
|
||||
thumb.setOnClickListener(this);
|
||||
thumb.setLayoutParams(lpQuestion);
|
||||
thumbnailMapping.put(thumb, answer);
|
||||
row.addView(thumb);
|
||||
}else{
|
||||
TextView lblAnswer = new TextView(this);
|
||||
lblAnswer.setText(answer);
|
||||
lblAnswer.setLayoutParams(lpQuestion);
|
||||
row.addView(lblAnswer);
|
||||
}
|
||||
detailTable.addView(row);
|
||||
no++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
public void doSubmit(View view){
|
||||
if(txtCMO.getText().toString()!=null){
|
||||
String notes = txtNotes.getText().toString();
|
||||
SubmitAssignTask task = new SubmitAssignTask(this, notes, uuid_task_h, assignId, flag);
|
||||
task.execute();
|
||||
}else{
|
||||
Toast.makeText(getApplicationContext(), getString(R.string.select_cmo),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
public void doLookupCMO(View view){
|
||||
Intent intent = new Intent(this, LookupAssignment.class);
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString(Global.BUND_KEY_TASK, flag);
|
||||
extras.putString(Global.BUND_KEY_UUID_TASKH, uuid_task_h);
|
||||
intent.putExtras(extras);
|
||||
startActivityForResult(intent, Global.REQUEST_CODE_LOOKUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == Global.REQUEST_CODE_LOOKUP){ //it's the one we request from the beginning
|
||||
String value = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_VALUE);
|
||||
assignId = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_ID);
|
||||
String job = data.getStringExtra(Global.BUND_KEY_ASSIGNEE_JOB);
|
||||
txtCMO.setText(job+" - "+value);
|
||||
txtCMO.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageThumbnail imgThumbnail = null;
|
||||
try {
|
||||
imgThumbnail = (ImageThumbnail) v;
|
||||
if (imgThumbnail.getResultImg() != null){
|
||||
try {
|
||||
Bitmap image = Utils.byteToBitmap(imgThumbnail.getResultImg());
|
||||
DialogManager.showImageDialog(this, image);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
String fieldKey = thumbnailMapping.get(v);
|
||||
String[] latLng = Tool.split(fieldKey, ",");
|
||||
if(latLng.length>1){
|
||||
String lat=latLng[0];
|
||||
String lng=latLng[1];
|
||||
Intent intent = new Intent(this, MapsViewer.class);
|
||||
intent.putExtra("latitude", lat);
|
||||
intent.putExtra("longitude", lng);
|
||||
startActivity(intent);
|
||||
}else{
|
||||
if (nomorOrder != null && !"".equals(nomorOrder)){
|
||||
targetThumbnail = (ImageThumbnail)v; //store thumbnail for further reference after connection finish
|
||||
|
||||
List<NameValuePair> params = new ArrayList<NameValuePair>();
|
||||
params.add(new BasicNameValuePair(Global.BUND_KEY_UUID_TASKH, uuid_task_h));
|
||||
params.add(new BasicNameValuePair(Global.BUND_KEY_QUESTIONID, fieldKey));
|
||||
new getImageTask(this,params).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this, getString(R.string.path_no_received), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.User;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.model.JsonRequestCheckOrder;
|
||||
import com.adins.mss.odr.model.JsonResponseServer;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
public class OrderAssignmentTask extends AsyncTask<Void, Void, JsonResponseServer> {
|
||||
private ProgressDialog progressDialog;
|
||||
private Context context;
|
||||
private String messageWait;
|
||||
private String messageEmpty;
|
||||
private String errMessage = null;
|
||||
private FragmentActivity fragmentActivity;
|
||||
private int contentFrame;
|
||||
private User user = GlobalData.getSharedGlobalData().getUser();
|
||||
public OrderAssignmentTask(FragmentActivity fragmentActivity, String messageWait, String messageEmpty,int contentFrame){
|
||||
this.context=fragmentActivity;
|
||||
this.fragmentActivity = fragmentActivity;
|
||||
this.messageWait = messageWait;
|
||||
this.messageEmpty = messageEmpty;
|
||||
this.contentFrame = contentFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(context, "", messageWait, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonResponseServer doInBackground(Void... params) {
|
||||
String resp = null;
|
||||
|
||||
JsonRequestCheckOrder requestCheckOrder = new JsonRequestCheckOrder();
|
||||
requestCheckOrder.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
requestCheckOrder.setFlag(Global.FLAG_FOR_ORDERASSIGNMENT);
|
||||
String json = GsonHelper.toJson(requestCheckOrder);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_LIST_ASSIGNMENT();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(fragmentActivity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
|
||||
resp = serverResult.getResult();
|
||||
// resp = "{\"listResponseServer\":[{\"key\":\"123456789\",\"value\":\"Gigin\",\"flag\":\"7134135-1498451-18392\"},{\"key\":\"123456456\",\"value\":\"Bangkit\",\"flag\":\"\"},{\"key\":\"123454321\",\"value\":\"Ichsan\",\"flag\":\"\"}],\"status\":{\"code\":0}}";
|
||||
JsonResponseServer result = null;
|
||||
try {
|
||||
result = GsonHelper.fromJson(resp, JsonResponseServer.class);
|
||||
if(result.getStatus().getCode()!=0){
|
||||
errMessage=result.getStatus().getMessage();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonResponseServer result) {
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (errMessage != null) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(fragmentActivity);
|
||||
dialogBuilder.withTitle("ERROR")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
}
|
||||
else if (result == null){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(fragmentActivity);
|
||||
dialogBuilder.withTitle("INFO")
|
||||
.withMessage(messageEmpty)
|
||||
.show();
|
||||
}
|
||||
else{
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("resultJson",result);
|
||||
Fragment fragment = new OrderAssignmentActivity();
|
||||
fragment.setArguments(bundle);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(contentFrame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.adins.mss.odr.assignment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.dynamicform.JsonResponseSubmitTask;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.model.JsonRequestSubmitAssign;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
public class SubmitAssignTask extends AsyncTask<Void, Void, String> {
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage = null;
|
||||
private Activity activity;
|
||||
String uuid_task_h;
|
||||
String assignId;
|
||||
String flag;
|
||||
String notes;
|
||||
public SubmitAssignTask(Activity activity, String notes, String uuid_task_h, String assignId, String flag){
|
||||
this.activity=activity;
|
||||
this.uuid_task_h= uuid_task_h;
|
||||
this.assignId= assignId;
|
||||
this.flag= flag;
|
||||
this.notes=notes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(com.adins.mss.base.R.string.progressWait), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
String result = null;
|
||||
|
||||
JsonRequestSubmitAssign request = new JsonRequestSubmitAssign();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
request.setFlag(flag);
|
||||
request.setUuid_user(assignId);
|
||||
request.setUuid_task_h(uuid_task_h);
|
||||
request.setNotes(notes);
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_SUBMIT_ASSIGN();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
String resp = null;
|
||||
resp = serverResult.getResult();
|
||||
JsonResponseSubmitTask response ;
|
||||
try {
|
||||
response = GsonHelper.fromJson(resp, JsonResponseSubmitTask.class);
|
||||
if(response.getStatus().getCode()==0){
|
||||
result=response.getResult();
|
||||
}else{
|
||||
errMessage=response.getStatus().getMessage();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result=resp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
if (progressDialog.isShowing()){
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (errMessage != null) {
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity);
|
||||
dialogBuilder.withTitle(activity.getString(com.adins.mss.base.R.string.error_capital))
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
}
|
||||
else if (result.equals("Success")){
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity);
|
||||
dialogBuilder.withTitle(activity.getString(com.adins.mss.base.R.string.success))
|
||||
.withMessage(activity.getString(com.adins.mss.base.R.string.task_submitted))
|
||||
.isCancelable(false)
|
||||
.withButton1Text(activity.getString(com.adins.mss.base.R.string.btnOk))
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
else{
|
||||
NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(activity);
|
||||
dialogBuilder.withTitle(activity.getString(com.adins.mss.base.R.string.warning_capital))
|
||||
.withMessage(result)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.adins.mss.odr.catalogue;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.Catalogue;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.catalogue.api.LoadPdf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class CatalogueListAdapter extends RecyclerView.Adapter<CatalogueListAdapter.CatalogueViewHolder>{
|
||||
private FragmentActivity activity;
|
||||
private List<Catalogue> objects;
|
||||
|
||||
public CatalogueListAdapter(FragmentActivity activity, List<Catalogue> objects) {
|
||||
this.activity = activity;
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
public class CatalogueViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
private TextView txtName;
|
||||
private TextView txtDesc;
|
||||
|
||||
public CatalogueViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = itemView;
|
||||
txtName = (TextView) itemView.findViewById(R.id.txtName);
|
||||
txtDesc = (TextView) itemView.findViewById(R.id.txtDesc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatalogueViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.catalogue_list_item, parent, false);
|
||||
CatalogueViewHolder viewHolder = new CatalogueViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(CatalogueViewHolder holder, final int position) {
|
||||
holder.txtName.setText(objects.get(position).getCatalogue_name());
|
||||
holder.txtDesc.setText(objects.get(position).getCatalogue_desc());
|
||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LoadPdf task = new LoadPdf(activity, objects.get(position).getUuid_mkt_catalogue());
|
||||
task.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (objects == null || objects.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return objects.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package com.adins.mss.odr.catalogue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.dao.Catalogue;
|
||||
import com.adins.mss.dao.MobileContentD;
|
||||
import com.adins.mss.foundation.db.dataaccess.CatalogueDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.MobileContentDDataAccess;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.catalogue.imageslider.FragmentSlider;
|
||||
import com.adins.mss.odr.catalogue.imageslider.SliderIndicator;
|
||||
import com.adins.mss.odr.catalogue.imageslider.SliderPagerAdapter;
|
||||
import com.adins.mss.odr.catalogue.imageslider.SliderView;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class FragmentCatalogue extends Fragment {
|
||||
private List<MobileContentD> promoList;
|
||||
private List<Catalogue> catalogueList;
|
||||
|
||||
private SliderView sliderView;
|
||||
private SliderPagerAdapter mAdapter;
|
||||
private SliderIndicator mIndicator;
|
||||
private LinearLayout mLinearLayout;
|
||||
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private CatalogueListAdapter adapter;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
setHasOptionsMenu(true);
|
||||
promoList = MobileContentDDataAccess.getAllContent(context);
|
||||
catalogueList = CatalogueDataAccess.getAll(context);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
View view = inflater.inflate(R.layout.fragment_catalogue, container, false);
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.catalogueList);
|
||||
layoutManager = new LinearLayoutManager(getActivity());
|
||||
list.setLayoutManager(layoutManager);
|
||||
adapter = new CatalogueListAdapter(getActivity(), catalogueList);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
sliderView = (SliderView) view.findViewById(R.id.sliderView);
|
||||
mLinearLayout = (LinearLayout) view.findViewById(R.id.pagesContainer);
|
||||
|
||||
setupSlider();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_promo_catalogue), null);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_catalogue));
|
||||
}
|
||||
|
||||
private void setupSlider() {
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
if (promoList != null && promoList.size() != 0) {
|
||||
sliderView.setDurationScroll(800);
|
||||
sliderView.isVerticalScrollBarEnabled();
|
||||
for (MobileContentD content : promoList) {
|
||||
fragments.add(FragmentSlider.newInstance(content.getContent()));
|
||||
}
|
||||
} else {
|
||||
sliderView.setDurationScroll(0);
|
||||
Bitmap noPromo = BitmapFactory.decodeResource(getResources(), R.drawable.nopromotion);
|
||||
byte[] temp = Utils.bitmapToByte(noPromo);
|
||||
fragments.add(FragmentSlider.newInstance(temp));
|
||||
}
|
||||
// fragments.add(FragmentSlider.newInstance("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTHN2Mp-hEWSIUMgLVdnUwaP0V5x9dvpluFd8zsq0EMhzCQfsek"));
|
||||
// fragments.add(FragmentSlider.newInstance("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcYsl7qSRTZI9zw7DnYxiGfv9foj6s7OpKek121ZFziqWGWjNi"));
|
||||
// fragments.add(FragmentSlider.newInstance("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQDEtJebJpj6EPoFzeaeMb1WdqyyawvyMpB59sMkdfW2HH0BXYp"));
|
||||
|
||||
mAdapter = new SliderPagerAdapter(getFragmentManager(), fragments);
|
||||
sliderView.setAdapter(mAdapter);
|
||||
mIndicator = new SliderIndicator(getContext(), mLinearLayout, sliderView, R.drawable.indicator_circle, true);
|
||||
mIndicator.setPageCount(fragments.size());
|
||||
try {
|
||||
mIndicator.show();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// mIndicator.cleanup();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.adins.mss.odr.catalogue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.foundation.db.dataaccess.MobileContentHDataAccess;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class FragmentPromotion extends Fragment {
|
||||
private List<MobileContentH> promoList;
|
||||
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private PromoListAdapter adapter;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
setHasOptionsMenu(true);
|
||||
promoList = MobileContentHDataAccess.getAll(context, GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_promo, container, false);
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.promoList);
|
||||
layoutManager = new LinearLayoutManager(getActivity());
|
||||
list.setLayoutManager(layoutManager);
|
||||
adapter = new PromoListAdapter(getActivity(), promoList);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle("PROMOTIONS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package com.adins.mss.odr.catalogue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.StrictMode;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.MobileContentD;
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.foundation.db.dataaccess.MobileContentDDataAccess;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.catalogue.imageslider.SliderIndicator;
|
||||
import com.adins.mss.odr.news.NewsContentAdapter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.VIBRATOR_SERVICE;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class PromoListAdapter extends RecyclerView.Adapter<PromoListAdapter.PromoViewHolder>{
|
||||
private FragmentActivity activity;
|
||||
private List<MobileContentH> objectsH;
|
||||
|
||||
public PromoListAdapter(FragmentActivity activity, List<MobileContentH> objects) {
|
||||
this.activity = activity;
|
||||
this.objectsH = objects;
|
||||
}
|
||||
|
||||
public class PromoViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
private ImageView imageShare;
|
||||
private ImageView image;
|
||||
private TextView txtDesc;
|
||||
private TextView txtName;
|
||||
private ViewPager viewPager;
|
||||
private NewsContentAdapter adapter;
|
||||
private SliderIndicator mIndicator;
|
||||
private LinearLayout mLinearLayout;
|
||||
|
||||
public PromoViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mView = itemView;
|
||||
// image = (ImageView) itemView.findViewById(R.id.imgPromo);
|
||||
imageShare = (ImageView) itemView.findViewById(R.id.imgShare);
|
||||
txtDesc = (TextView) itemView.findViewById(R.id.txtDesc);
|
||||
txtName = (TextView) itemView.findViewById(R.id.txtName);
|
||||
viewPager = (ViewPager) itemView.findViewById(R.id.newsImage);
|
||||
mLinearLayout = (LinearLayout) itemView.findViewById(R.id.pagesContainer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.promo_list_item, parent, false);
|
||||
PromoViewHolder viewHolder = new PromoViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final PromoViewHolder holder, final int position) {
|
||||
// final Bitmap imagePromo = Utils.byteToBitmap(objectsH.get(position).getContent());
|
||||
// holder.image.setImageBitmap(imagePromo);
|
||||
String desc = objectsH.get(position).getContent_description();
|
||||
String name = objectsH.get(position).getContent_name();
|
||||
if(objectsH.get(position).getUuid_mobile_content_h()!=null){
|
||||
List<MobileContentD> detailList = MobileContentDDataAccess.getAll(activity, objectsH.get(position).getUuid_mobile_content_h());
|
||||
setupContent(holder, detailList);
|
||||
}
|
||||
|
||||
holder.txtName.setText(name);
|
||||
holder.txtDesc.setText(desc);
|
||||
holder.imageShare.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
((Vibrator) activity.getSystemService(VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(150,10));
|
||||
} else {
|
||||
((Vibrator) activity.getSystemService(VIBRATOR_SERVICE)).vibrate(150);
|
||||
}
|
||||
|
||||
int position = holder.viewPager.getCurrentItem();
|
||||
MobileContentD content = holder.adapter.objects.get(position);
|
||||
|
||||
// Get access to the URI for the bitmap
|
||||
Bitmap imagePromo = Utils.byteToBitmap(content.getContent());
|
||||
Uri bmpUri = getLocalBitmapUri(imagePromo);
|
||||
if (bmpUri != null) {
|
||||
// Construct a ShareIntent with link to image
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
|
||||
shareIntent.setType("image/*");
|
||||
// Launch sharing dialog for image
|
||||
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
||||
StrictMode.setVmPolicy(builder.build());
|
||||
activity.startActivity(Intent.createChooser(shareIntent, "Share Image"));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (objectsH == null || objectsH.size() == 0)
|
||||
return 0;
|
||||
else
|
||||
return objectsH.size();
|
||||
}
|
||||
|
||||
public Uri getLocalBitmapUri(Bitmap bitmapImage) {
|
||||
// Extract Bitmap from ImageView drawable
|
||||
Bitmap bmp = bitmapImage;
|
||||
// Store image to default external storage directory
|
||||
Uri bmpUri = null;
|
||||
try {
|
||||
// Use methods on Context to access package-specific directories on external storage.
|
||||
// This way, you don't need to request external read/write permission.
|
||||
// See https://youtu.be/5xVh-7ywKpE?t=25m25s
|
||||
File file = new File(this.activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".jpg");
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
|
||||
out.close();
|
||||
// **Warning:** This will fail for API >= 24, use a FileProvider as shown below instead.
|
||||
bmpUri = Uri.fromFile(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bmpUri;
|
||||
}
|
||||
|
||||
private void setupContent(PromoViewHolder holder, List<MobileContentD> detailList) {
|
||||
|
||||
holder.adapter = new NewsContentAdapter(activity, detailList);
|
||||
holder.viewPager.setAdapter(holder.adapter);
|
||||
|
||||
holder.mIndicator = new SliderIndicator(activity, holder.mLinearLayout, holder.viewPager, R.drawable.indicator_circle, false);
|
||||
holder.mIndicator.setPageCount(detailList.size());
|
||||
try {
|
||||
holder.mIndicator.show();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Catalogue;
|
||||
import com.adins.mss.foundation.db.dataaccess.CatalogueDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.catalogue.FragmentPromotion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class GetCatalogue extends AsyncTask<Void, Void, List<Catalogue>> {
|
||||
private FragmentActivity activity;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private List<Catalogue> result = new ArrayList<Catalogue>();
|
||||
|
||||
public GetCatalogue(FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Catalogue> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
MssRequestType request = new MssRequestType();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CATALOGUE_HEADER();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GetCatalogueResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, GetCatalogueResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<Catalogue> list = response.getListProductCatalogue();
|
||||
if (list != null && list.size() != 0) {
|
||||
result = list;
|
||||
CatalogueDataAccess.addOrReplace(activity, list);
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Catalogue> result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
Fragment fragment = new FragmentPromotion();
|
||||
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import com.adins.mss.dao.Catalogue;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/30/2017.
|
||||
*/
|
||||
|
||||
public class GetCatalogueResponse extends MssResponseType {
|
||||
@SerializedName("listProductCatalog")
|
||||
private List<Catalogue> listProductCatalogue;
|
||||
|
||||
public List<Catalogue> getListProductCatalogue() {
|
||||
return listProductCatalogue;
|
||||
}
|
||||
|
||||
public void setListProductCatalogue(List<Catalogue> listProductCatalogue) {
|
||||
this.listProductCatalogue = listProductCatalogue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.MobileContentD;
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.foundation.db.dataaccess.MobileContentDDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.MobileContentHDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.adins.mss.foundation.image.Utils;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class GetPromo extends AsyncTask<Void, Void, List<PromoCatalogBean>> {
|
||||
private FragmentActivity activity;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private List<PromoCatalogBean> result = new ArrayList<PromoCatalogBean>();
|
||||
|
||||
public GetPromo(FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PromoCatalogBean> doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
MssRequestType request = new MssRequestType();
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CATALOGUE_PROMO();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GetPromoResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, GetPromoResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage = e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<PromoCatalogBean> list = response.getListImage();
|
||||
if (list != null && list.size() != 0) {
|
||||
MobileContentDDataAccess.clean(activity);
|
||||
MobileContentHDataAccess.clean(activity);
|
||||
result = list;
|
||||
for (PromoCatalogBean bean : result) {
|
||||
String uuid = bean.getUuidMobileContentD();
|
||||
byte[] img = Utils.base64ToByte(bean.getContent());
|
||||
|
||||
MobileContentH tempHeader = new MobileContentH();
|
||||
tempHeader.setUuid_mobile_content_h(bean.getUuidMobileContentH());
|
||||
tempHeader.setContent_name(bean.getContentName());
|
||||
tempHeader.setContent_description(bean.getContentDescription());
|
||||
tempHeader.setUuid_user(GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
MobileContentHDataAccess.addOrReplace(activity, tempHeader);
|
||||
|
||||
MobileContentD tempData = new MobileContentD();
|
||||
tempData.setUuid_mobile_content_d(uuid);
|
||||
tempData.setContent(img);
|
||||
tempData.setUuid_mobile_content_h(bean.getUuidMobileContentH());
|
||||
MobileContentDDataAccess.addOrReplace(activity, tempData);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<PromoCatalogBean> result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
GetCatalogue task = new GetCatalogue(activity);
|
||||
task.execute();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class GetPromoResponse extends MssResponseType {
|
||||
@SerializedName("listImage")
|
||||
private List<PromoCatalogBean> listImage;
|
||||
|
||||
public List<PromoCatalogBean> getListImage() {
|
||||
return listImage;
|
||||
}
|
||||
|
||||
public void setListImage(List<PromoCatalogBean> listValue) {
|
||||
this.listImage = listImage;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.core.content.FileProvider;
|
||||
import android.util.Base64;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.BuildConfig;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/30/2017.
|
||||
*/
|
||||
|
||||
public class LoadPdf extends AsyncTask<Void, Void, String> {
|
||||
private FragmentActivity activity;
|
||||
private ProgressDialog progressDialog;
|
||||
private String errMessage;
|
||||
private String result;
|
||||
private String uuid;
|
||||
|
||||
public LoadPdf(FragmentActivity activity, String uuid) {
|
||||
this.activity = activity;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progressDialog = ProgressDialog.show(activity, "", activity.getString(R.string.contact_server), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
if (Tool.isInternetconnected(activity)) {
|
||||
LoadPdfRequest request = new LoadPdfRequest();
|
||||
request.setUuidCatalogue(uuid);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_CATALOGUE_PDF();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(activity, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LoadPdfResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, LoadPdfResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
result = response.getCataloguePdf();
|
||||
if (result != null && !result.isEmpty()) {
|
||||
// Catalogue catalogue = CatalogueDataAccess.getOne(activity, uuid);
|
||||
// catalogue.setCatalogue_file(result);
|
||||
// CatalogueDataAccess.addOrReplace(activity, catalogue);
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.server_down);
|
||||
}
|
||||
} else {
|
||||
errMessage = activity.getString(R.string.no_internet_connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(activity.getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(activity);
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(activity, errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
GetFilePathAndStatus filepath = getFile(result, "catalogue", "pdf");
|
||||
File file = new File(filepath.filePath);
|
||||
Uri uri;
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
uri = FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".fileprovider", file);
|
||||
} else
|
||||
uri = Uri.fromFile(file);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.setDataAndType(uri, "application/pdf");
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static GetFilePathAndStatus getFile(String base64, String filename, String extension){
|
||||
GetFilePathAndStatus getFilePathAndStatus = new GetFilePathAndStatus();
|
||||
|
||||
try(FileOutputStream os = new FileOutputStream(getReportPath(filename,extension), false)) {
|
||||
byte[] pdfAsBytes = Base64.decode(base64, 0);
|
||||
os.write(pdfAsBytes);
|
||||
os.flush();
|
||||
getFilePathAndStatus.filStatus = true;
|
||||
getFilePathAndStatus.filePath = getReportPath(filename, extension);
|
||||
return getFilePathAndStatus;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
getFilePathAndStatus.filStatus = false;
|
||||
getFilePathAndStatus.filePath = getReportPath(filename, extension);
|
||||
return getFilePathAndStatus;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getReportPath(String filename,String extension) {
|
||||
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "ParentFolder/Report");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String uriSting = (file.getAbsolutePath() + "/" + filename + "."+extension);
|
||||
return uriSting;
|
||||
|
||||
}
|
||||
public static class GetFilePathAndStatus{
|
||||
public boolean filStatus;
|
||||
public String filePath;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/30/2017.
|
||||
*/
|
||||
|
||||
public class LoadPdfRequest extends MssRequestType {
|
||||
@SerializedName("uuid_mkt_catalogue")
|
||||
private String uuidCatalogue;
|
||||
|
||||
public String getUuidCatalogue() {
|
||||
return uuidCatalogue;
|
||||
}
|
||||
|
||||
public void setUuidCatalogue(String uuidCatalogue) {
|
||||
this.uuidCatalogue = uuidCatalogue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/30/2017.
|
||||
*/
|
||||
|
||||
public class LoadPdfResponse extends MssResponseType {
|
||||
@SerializedName("catalogue_file")
|
||||
private String cataloguePdf;
|
||||
|
||||
public String getCataloguePdf() {
|
||||
return cataloguePdf;
|
||||
}
|
||||
|
||||
public void setCataloguePdf(String cataloguePdf) {
|
||||
this.cataloguePdf = cataloguePdf;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.adins.mss.odr.catalogue.api;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PromoCatalogBean{
|
||||
@SerializedName("uuid_mobile_content_d") private String uuidMobileContentD;
|
||||
@SerializedName("uuid_mobile_content_h") private String uuidMobileContentH;
|
||||
@SerializedName("content_name") private String contentName;
|
||||
@SerializedName("content_description") private String contentDescription;
|
||||
@SerializedName("content") private String content;
|
||||
|
||||
public String getUuidMobileContentD() {
|
||||
return uuidMobileContentD;
|
||||
}
|
||||
public void setUuidMobileContentD(String uuidMobileContentD) {
|
||||
this.uuidMobileContentD = uuidMobileContentD;
|
||||
}
|
||||
public String getUuidMobileContentH() {
|
||||
return uuidMobileContentH;
|
||||
}
|
||||
public void setUuidMobileContentH(String uuidMobileContentH) {
|
||||
this.uuidMobileContentH = uuidMobileContentH;
|
||||
}
|
||||
public String getContentName() {
|
||||
return contentName;
|
||||
}
|
||||
public void setContentName(String contentName) {
|
||||
this.contentName = contentName;
|
||||
}
|
||||
public String getContentDescription() {
|
||||
return contentDescription;
|
||||
}
|
||||
public void setContentDescription(String contentDescription) {
|
||||
this.contentDescription = contentDescription;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.adins.mss.odr.catalogue.imageslider;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.adins.mss.odr.R;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class FragmentSlider extends Fragment {
|
||||
private static final String ARG_PARAM1 = "params";
|
||||
|
||||
private String imageUrls;
|
||||
|
||||
public FragmentSlider() {
|
||||
}
|
||||
|
||||
public static FragmentSlider newInstance(byte[] params) {
|
||||
FragmentSlider fragment = new FragmentSlider();
|
||||
Bundle args = new Bundle();
|
||||
args.putByteArray(ARG_PARAM1, params);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// imageUrls = getArguments().getString(ARG_PARAM1);
|
||||
View view = inflater.inflate(R.layout.fragment_slider_item, container, false);
|
||||
ImageView image = (ImageView) view.findViewById(R.id.img);
|
||||
|
||||
byte[] tempImage = getArguments().getByteArray(ARG_PARAM1);
|
||||
// Bitmap bm = null;
|
||||
// if(tempImage != null){
|
||||
// try {
|
||||
// bm = Utils.byteToBitmap(tempImage);
|
||||
// } catch (Exception e) { }
|
||||
// }
|
||||
if (tempImage != null)
|
||||
Glide.with(getActivity()).load(tempImage).into(image);
|
||||
|
||||
// image.setImageBitmap(bm);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.adins.mss.odr.catalogue.imageslider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Handler;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class SliderIndicator implements ViewPager.OnPageChangeListener {
|
||||
private Context mContext;
|
||||
private LinearLayout mContainer;
|
||||
private int mDrawable;
|
||||
private int mSpacing;
|
||||
private int mSize;
|
||||
private ViewPager mViewPager;
|
||||
private int mPageCount;
|
||||
private int mInitialPage = 0;
|
||||
private boolean isAutomaticSlide = false;
|
||||
|
||||
private int defaultSizeInDp = 12;
|
||||
private int defaultSpacingInDp = 12;
|
||||
|
||||
public SliderIndicator(Context context, LinearLayout containerView, ViewPager viewPager, int drawableRes, boolean isAutomaticSlide) {
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("context cannot be null");
|
||||
} else if (containerView == null) {
|
||||
throw new IllegalArgumentException("containerView cannot be null");
|
||||
} else if (viewPager == null) {
|
||||
throw new IllegalArgumentException("ViewPager cannot be null");
|
||||
} else if (viewPager.getAdapter() == null) {
|
||||
throw new IllegalArgumentException("ViewPager does not have an adapter set on it.");
|
||||
}
|
||||
mContext = context;
|
||||
mContainer = containerView;
|
||||
mDrawable = drawableRes;
|
||||
mViewPager = viewPager;
|
||||
this.isAutomaticSlide = isAutomaticSlide;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
mPageCount = pageCount;
|
||||
}
|
||||
|
||||
public void setInitialPage(int page) {
|
||||
mInitialPage = page;
|
||||
}
|
||||
|
||||
public void setDrawable(int drawable) {
|
||||
mDrawable = drawable;
|
||||
}
|
||||
|
||||
public void setSpacingRes(int spacingRes) {
|
||||
mSpacing = spacingRes;
|
||||
}
|
||||
|
||||
public void setSize(int dimenRes) {
|
||||
mSize = dimenRes;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
initIndicators();
|
||||
setIndicatorAsSelected(mInitialPage);
|
||||
if(isAutomaticSlide){
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
mViewPager.setCurrentItem(1, true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}, 2500);
|
||||
}
|
||||
}
|
||||
|
||||
private void initIndicators() {
|
||||
if (mContainer == null || mPageCount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mViewPager.addOnPageChangeListener(this);
|
||||
Resources res = mContext.getResources();
|
||||
mContainer.removeAllViews();
|
||||
for (int i = 0; i < mPageCount; i++) {
|
||||
View view = new View(mContext);
|
||||
int dimen = mSize != 0 ? res.getDimensionPixelSize(mSize) : ((int) res.getDisplayMetrics().density * defaultSizeInDp);
|
||||
int margin = mSpacing != 0 ? res.getDimensionPixelSize(mSpacing) : ((int) res.getDisplayMetrics().density * defaultSpacingInDp);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(dimen, dimen);
|
||||
lp.setMargins(i == 0 ? 0 : margin, 0, 0, 0);
|
||||
view.setLayoutParams(lp);
|
||||
view.setBackgroundResource(mDrawable);
|
||||
view.setSelected(i == 0);
|
||||
mContainer.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void setIndicatorAsSelected(int index) {
|
||||
if (mContainer == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < mContainer.getChildCount(); i++) {
|
||||
View view = mContainer.getChildAt(i);
|
||||
try {
|
||||
view.setSelected(i == index);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
int index = position % mPageCount;
|
||||
setIndicatorAsSelected(index);
|
||||
final int moveTo = position + 1;
|
||||
if(isAutomaticSlide){
|
||||
try {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
mViewPager.setCurrentItem(moveTo, true);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
}, 2500);
|
||||
}catch (Exception e){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
mViewPager.clearOnPageChangeListeners();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.adins.mss.odr.catalogue.imageslider;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class SliderPagerAdapter extends FragmentStatePagerAdapter {
|
||||
private static final String TAG = "SliderPagerAdapter";
|
||||
|
||||
List<Fragment> mFrags = new ArrayList<>();
|
||||
|
||||
public SliderPagerAdapter(FragmentManager fm, List<Fragment> frags) {
|
||||
super(fm);
|
||||
mFrags = frags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
int index = position % mFrags.size();
|
||||
return FragmentSlider.newInstance(mFrags.get(index).getArguments().getByteArray("params"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
super.destroyItem(container, position, object);
|
||||
mFrags.remove(object);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.adins.mss.odr.catalogue.imageslider;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.Scroller;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class SliderView extends ViewPager {
|
||||
public static final int DEFAULT_SCROLL_DURATION = 200;
|
||||
public static final int SLIDE_MODE_SCROLL_DURATION = 1000;
|
||||
|
||||
public SliderView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public SliderView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setDurationScroll(DEFAULT_SCROLL_DURATION);
|
||||
// this.setOnTouchListener(new OnTouchListener() {
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void setDurationScroll(int millis) {
|
||||
try {
|
||||
Class<?> viewpager = ViewPager.class;
|
||||
Field scroller = viewpager.getDeclaredField("mScroller");
|
||||
scroller.setAccessible(true);
|
||||
scroller.set(this, new OwnScroller(getContext(), millis));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class OwnScroller extends Scroller {
|
||||
|
||||
private int durationScrollMillis = 1;
|
||||
|
||||
public OwnScroller(Context context, int durationScroll) {
|
||||
super(context, new DecelerateInterpolator());
|
||||
this.durationScrollMillis = durationScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScroll(int startX, int startY, int dx, int dy, int duration) {
|
||||
super.startScroll(startX, startY, dx, dy, durationScrollMillis);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.adins.mss.odr.common;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 3/4/2015.
|
||||
*/
|
||||
public class Dialogger {
|
||||
public static void error(Context context, Exception ex, String extraReason) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle("Error")
|
||||
.setMessage(ex.getMessage() + "\r\n" + extraReason)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.adins.mss.odr.common;
|
||||
|
||||
import android.content.Context;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 3/5/2015.
|
||||
*/
|
||||
public class Generator {
|
||||
public static String generateBatchId(Context context) {
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
return
|
||||
GlobalData.getSharedGlobalData().getUser().getLogin_id() +
|
||||
now.get(Calendar.YEAR) +
|
||||
(now.get(Calendar.MONTH) + 1) +
|
||||
now.get(Calendar.DAY_OF_MONTH) +
|
||||
PersistentCounter.getAndIncrement(context, "batchId");
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.adins.mss.odr.common;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 3/5/2015.
|
||||
*/
|
||||
public class PersistentCounter {
|
||||
public static int getAndIncrement(Context context, String name) {
|
||||
File dir = context.getDir("persistentcounter", Context.MODE_PRIVATE);
|
||||
File file = new File(dir, name);
|
||||
|
||||
int base = 0;
|
||||
if (file.exists()) {
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(file));){
|
||||
String line = reader.readLine();
|
||||
base = Integer.parseInt(line);
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try(BufferedWriter writer = new BufferedWriter(new FileWriter(file));) {
|
||||
|
||||
writer.write(String.valueOf(base + 1));
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
public static int get(Context context, String name) {
|
||||
File dir = context.getDir("persistentcounter", Context.MODE_PRIVATE);
|
||||
File file = new File(dir, name);
|
||||
|
||||
BufferedReader reader = null;
|
||||
int base = 0;
|
||||
if (file.exists()) {
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(file));
|
||||
String line = reader.readLine();
|
||||
base = Integer.parseInt(line);
|
||||
} catch (Exception ex) {
|
||||
return 0;
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return base;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.adins.mss.odr.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by Aditya Purwa on 3/4/2015.
|
||||
*/
|
||||
public class Toaster {
|
||||
|
||||
public static void error(Context context, Exception ex, String extraReason) {
|
||||
Toast.makeText(context, "Error occurred: " + ex.getMessage() + " - " + extraReason, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void warning(Context context, String reason) {
|
||||
Toast.makeText(context, reason, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.adins.mss.odr.followup;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.odr.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class FollowUpAdapter extends RecyclerView.Adapter<FollowUpAdapter.FollowUpViewHolder> {
|
||||
private Context context;
|
||||
private List<GroupTask> groupTasks;
|
||||
private final OnCheckedListener onCheckedListener;
|
||||
|
||||
public FollowUpAdapter(Context context, OnCheckedListener listener, List<GroupTask> groupTasks) {
|
||||
this.context = context;
|
||||
this.groupTasks = groupTasks;
|
||||
onCheckedListener = listener;
|
||||
}
|
||||
|
||||
public class FollowUpViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView txtId;
|
||||
private TextView txtAccount;
|
||||
private TextView txtStatus;
|
||||
private TextView txtProduct;
|
||||
private TextView txtProjectNett;
|
||||
public CheckBox checkBox;
|
||||
public final View mView;
|
||||
|
||||
public FollowUpViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
mView = itemView;
|
||||
txtId = (TextView) itemView.findViewById(R.id.txtId);
|
||||
txtAccount = (TextView) itemView.findViewById(R.id.txtAccount);
|
||||
txtStatus = (TextView) itemView.findViewById(R.id.txtStatus);
|
||||
txtProduct = (TextView) itemView.findViewById(R.id.txtProduct);
|
||||
txtProjectNett = (TextView) itemView.findViewById(R.id.txtProjectNett);
|
||||
checkBox = (CheckBox) itemView.findViewById(R.id.checkbox);
|
||||
}
|
||||
|
||||
public void bind(GroupTask task) {
|
||||
Account account = AccountDataAccess.getOne(context, task.getUuid_account());
|
||||
|
||||
txtId.setText(task.getGroup_task_id());
|
||||
txtAccount.setText(account.getAccount_name());
|
||||
txtStatus.setText(task.getLast_status());
|
||||
txtProduct.setText(task.getProduct_name());
|
||||
txtProjectNett.setText(Tool.separateThousand(task.getProject_nett()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FollowUpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.followup_list_item, parent, false);
|
||||
FollowUpViewHolder viewHolder = new FollowUpViewHolder(v);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(FollowUpViewHolder holder, final int position) {
|
||||
holder.bind(groupTasks.get(position));
|
||||
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (onCheckedListener != null) {
|
||||
if (isChecked) {
|
||||
onCheckedListener.onChecked(groupTasks.get(position).getGroup_task_id());
|
||||
} else {
|
||||
onCheckedListener.onUnchecked(groupTasks.get(position).getGroup_task_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return groupTasks.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package com.adins.mss.odr.followup;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.todolist.form.TaskListTask;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.followup.api.DoFollowUpRequest;
|
||||
import com.adins.mss.odr.followup.api.DoFollowUpResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class FragmentFollowUpResult extends Fragment implements OnCheckedListener {
|
||||
private Context context;
|
||||
private List<GroupTask> groupTasks;
|
||||
private RecyclerView list;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private FollowUpAdapter adapter;
|
||||
private Button btnRequest;
|
||||
private List<String> groupTaskId;
|
||||
|
||||
public List<String> getGroupTaskId() {
|
||||
return groupTaskId;
|
||||
}
|
||||
|
||||
public void setGroupTaskId(List<String> groupTaskId) {
|
||||
this.groupTaskId = groupTaskId;
|
||||
}
|
||||
|
||||
public FragmentFollowUpResult(Context context, List<GroupTask> groupTasks) {
|
||||
this.context = context;
|
||||
this.groupTasks = groupTasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_followup_result, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
list = (RecyclerView) view.findViewById(R.id.list);
|
||||
layoutManager = new LinearLayoutManager(getActivity());
|
||||
list.setLayoutManager(layoutManager);
|
||||
adapter = new FollowUpAdapter(context, FragmentFollowUpResult.this, groupTasks);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
btnRequest = (Button) view.findViewById(R.id.btnRequest);
|
||||
btnRequest.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getGroupTaskId() != null && getGroupTaskId().size() != 0)
|
||||
doFollowUp(getGroupTaskId());
|
||||
else {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(getString(R.string.msgNoneSelected))
|
||||
.show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
groupTaskId = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_followup));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
public void doFollowUp(final List<String> groupTaskId) {
|
||||
new AsyncTask<Void, Void, String>() {
|
||||
final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||
String errMessage;
|
||||
String result;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||
progress.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
DoFollowUpRequest request = new DoFollowUpRequest();
|
||||
request.setGroupTaskId(groupTaskId);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_DO_FOLLOWUP();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
DoFollowUpResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, DoFollowUpResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
result = response.getResult();
|
||||
if (result == null) {
|
||||
errMessage = getActivity().getString(R.string.no_result_from_server);
|
||||
} else {
|
||||
if (result.equalsIgnoreCase("success")) {
|
||||
result = "success";
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.msgFollowupFailed);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.server_down);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
if (getActivity() != null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(getActivity().getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
if (result.equalsIgnoreCase("success")) {
|
||||
try {
|
||||
final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialogBuilder.withTitle(getActivity().getString(R.string.title_mn_followup))
|
||||
.withMessage(getActivity().getString(R.string.requestSent))
|
||||
.withButton1Text(getActivity().getString(R.string.btnOk))
|
||||
.setButton1Click(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
dialogBuilder.dismiss();
|
||||
// Fragment fragment1 = new PriorityTabFragment();
|
||||
// FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
// transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
// transaction.replace(com.adins.mss.base.R.id.content_frame, fragment1);
|
||||
// transaction.addToBackStack(null);
|
||||
// transaction.commitAllowingStateLoss();
|
||||
TaskListTask task = new TaskListTask(getActivity(), getActivity().getString(R.string.progressWait),
|
||||
getActivity().getString(R.string.msgNoTaskList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.msgFollowupFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChecked(String groupTask) {
|
||||
groupTaskId = getGroupTaskId();
|
||||
groupTaskId.add(groupTask);
|
||||
setGroupTaskId(groupTaskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnchecked(String groupTask) {
|
||||
groupTaskId = getGroupTaskId();
|
||||
groupTaskId.remove(groupTask);
|
||||
setGroupTaskId(groupTaskId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,369 @@
|
|||
package com.adins.mss.odr.followup;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Account;
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.dao.Product;
|
||||
import com.adins.mss.foundation.db.dataaccess.AccountDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.ProductDataAccess;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.accounts.api.AccountsSearchRequest;
|
||||
import com.adins.mss.odr.followup.api.GetFollowUpResponse;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class
|
||||
FragmentFollowUpSearch extends Fragment {
|
||||
|
||||
private AppCompatSpinner spinnerAccount;
|
||||
private AppCompatSpinner spinnerProduct;
|
||||
private AppCompatSpinner spinnerStatus;
|
||||
private Button btnSearch;
|
||||
private List<Account> accountList;
|
||||
private List<Product> productList;
|
||||
private String[] statusList;
|
||||
private String tempAccount;
|
||||
private String tempProduct;
|
||||
private String tempStatus;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
return inflater.inflate(R.layout.new_fragment_account_search, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
spinnerAccount = (AppCompatSpinner) view.findViewById(R.id.spinnerAccount);
|
||||
spinnerProduct = (AppCompatSpinner) view.findViewById(R.id.spinnerProduct);
|
||||
spinnerStatus = (AppCompatSpinner) view.findViewById(R.id.spinnerStatus);
|
||||
btnSearch = (Button) view.findViewById(R.id.btnSearch);
|
||||
|
||||
btnSearch.setText(getString(R.string.reqOppor));
|
||||
|
||||
accountList = new ArrayList<>();
|
||||
accountList.clear();
|
||||
setAllAccountSpinner();
|
||||
List<Account> listAcc = AccountDataAccess.getAll(getActivity());
|
||||
if (listAcc != null)
|
||||
accountList.addAll(listAcc);
|
||||
AccountAdapter accountSpinner = new AccountAdapter(getContext(), R.layout.spinner_style2, accountList);
|
||||
spinnerAccount.setAdapter(accountSpinner);
|
||||
|
||||
productList = new ArrayList<>();
|
||||
productList.clear();
|
||||
setAllProductSpinner();
|
||||
List<Product> listProd = ProductDataAccess.getAll(getContext());
|
||||
if (listProd != null)
|
||||
productList.addAll(listProd);
|
||||
ProductAdapter productSpinner = new ProductAdapter(getContext(), R.layout.spinner_style2, productList);
|
||||
spinnerProduct.setAdapter(productSpinner);
|
||||
|
||||
statusList = getActivity().getResources().getStringArray(R.array.dropdownAccountStatus);
|
||||
StatusAdapter statusSpinner = new StatusAdapter(getContext(), R.layout.spinner_style2, statusList);
|
||||
spinnerStatus.setAdapter(statusSpinner);
|
||||
|
||||
btnSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Account account = (Account) spinnerAccount.getSelectedItem();
|
||||
Product product = (Product) spinnerProduct.getSelectedItem();
|
||||
|
||||
tempStatus = spinnerStatus.getSelectedItem().toString();
|
||||
if (tempStatus.equalsIgnoreCase(getString(R.string.allStatus)))
|
||||
tempStatus = "";
|
||||
tempAccount = account.getUuid_account();
|
||||
tempProduct = product.getUuid_product();
|
||||
|
||||
try {
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
doSearch(tempAccount, tempProduct, tempStatus);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setAllAccountSpinner() {
|
||||
Account accountDummy = new Account();
|
||||
accountDummy.setUuid_account("");
|
||||
accountDummy.setAccount_name("All Account");
|
||||
|
||||
accountList.add(0, accountDummy);
|
||||
}
|
||||
|
||||
private void setAllProductSpinner() {
|
||||
Product productDummy = new Product();
|
||||
productDummy.setUuid_product("");
|
||||
productDummy.setProduct_name("All Product");
|
||||
|
||||
productList.add(0, productDummy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_follow_up), null);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_followup));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
private void doSearch(final String account, final String product, final String status) throws ParseException, IOException {
|
||||
new AsyncTask<Void, Void, List<GroupTask>>() {
|
||||
final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||
String errMessage;
|
||||
List<GroupTask> result = new ArrayList<GroupTask>();
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||
progress.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<GroupTask> doInBackground(Void... params) {
|
||||
AccountsSearchRequest request = new AccountsSearchRequest();
|
||||
request.setUuid_account(account);
|
||||
request.setUuid_product(product);
|
||||
request.setUuid_status(status);
|
||||
request.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_FOLLOWUP();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GetFollowUpResponse response = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
response = GsonHelper.fromJson(responseBody, GetFollowUpResponse.class);
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
List<GroupTask> groupTaskList = response.getListFollowUp();
|
||||
if (groupTaskList != null && groupTaskList.size() != 0) {
|
||||
result = groupTaskList;
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.no_data_from_server);
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.server_down);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<GroupTask> result) {
|
||||
if(getActivity()!=null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (errMessage != null) {
|
||||
if (errMessage.equals(getActivity().getString(R.string.no_data_from_server))) {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(errMessage)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Fragment fragment = new FragmentFollowUpResult(getContext(), result);
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
public class StatusAdapter extends ArrayAdapter<String> {
|
||||
private Context context;
|
||||
private String[] values;
|
||||
|
||||
public StatusAdapter(Context context, int resource, String[] objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.length;
|
||||
}
|
||||
|
||||
public String getItem(int position) {
|
||||
return values[position];
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values[position]);
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values[position]);
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class AccountAdapter extends ArrayAdapter<Account> {
|
||||
private Context context;
|
||||
private List<Account> values;
|
||||
|
||||
public AccountAdapter(Context context, int resource, List<Account> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Account getItem(int position) {
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getAccount_name());
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getAccount_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProductAdapter extends ArrayAdapter<Product> {
|
||||
private Context context;
|
||||
private List<Product> values;
|
||||
|
||||
public ProductAdapter(Context context, int resource, List<Product> objects) {
|
||||
super(context, resource, objects);
|
||||
this.context = context;
|
||||
this.values = objects;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Product getItem(int position) {
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style2, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getProduct_name());
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.spinner_style, parent, false);
|
||||
TextView label = (TextView) view.findViewById(R.id.text_spin);
|
||||
label.setText(values.get(position).getProduct_name());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.adins.mss.odr.followup;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/27/2017.
|
||||
*/
|
||||
|
||||
public interface OnCheckedListener {
|
||||
void onChecked(String groupTask);
|
||||
void onUnchecked(String groupTask);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.adins.mss.odr.followup.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class DoFollowUpRequest extends MssRequestType {
|
||||
@SerializedName("group_task_id")
|
||||
private List<String> groupTaskId;
|
||||
|
||||
public List<String> getGroupTaskId() {
|
||||
return groupTaskId;
|
||||
}
|
||||
|
||||
public void setGroupTaskId(List<String> groupTaskId) {
|
||||
this.groupTaskId = groupTaskId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.adins.mss.odr.followup.api;
|
||||
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class DoFollowUpResponse extends MssResponseType {
|
||||
@SerializedName("result")
|
||||
private String result;
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.followup.api;
|
||||
|
||||
import com.adins.mss.dao.GroupTask;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/24/2017.
|
||||
*/
|
||||
|
||||
public class GetFollowUpResponse extends MssResponseType {
|
||||
@SerializedName("listFollowUp")
|
||||
private List<GroupTask> listFollowUp;
|
||||
|
||||
public List<GroupTask> getListFollowUp() {
|
||||
return listFollowUp;
|
||||
}
|
||||
|
||||
public void setListFollowUp(List<GroupTask> listFollowUp) {
|
||||
this.listFollowUp = listFollowUp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.adins.mss.odr.login;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.login.DefaultLoginModel;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.odr.ChangeLog;
|
||||
import com.adins.mss.odr.MOSynchronizeActivity;
|
||||
|
||||
public class MODefaultLoginModel extends DefaultLoginModel{
|
||||
|
||||
public MODefaultLoginModel(Context context) {
|
||||
super(context);
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
//bong 29 apr 15 - set Global intent to go to synhronize after force change password
|
||||
Global.syncIntent = new Intent(getContext(), MOSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getBuildNumber() {
|
||||
int c = Global.BUILD_VERSION;//ChangeLog.getChangeLog().get(0).getBuildVersion();
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getContext()), 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(getContext(), MOSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,367 @@
|
|||
package com.adins.mss.odr.marketingreport;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.KeyValue;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
class DateClickListener implements View.OnClickListener {
|
||||
private final EditText mTarget;
|
||||
private final Context mContext;
|
||||
|
||||
public DateClickListener(Context context, EditText target) {
|
||||
mContext = context;
|
||||
mTarget = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DatePickerDialog dialog = new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||
mTarget.setText(dayOfMonth + "/" + Tool.appendZeroForDateTime(monthOfYear, true) + "/" + year);
|
||||
}
|
||||
}, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public class MarketingReportFragment extends Fragment {
|
||||
|
||||
ImageButton buttonSelectDate;
|
||||
EditText editDate;
|
||||
AppCompatSpinner spinnerCategory;
|
||||
private EditText editStartDate;
|
||||
private EditText editEndDate;
|
||||
private ImageButton buttonSelectStartDate;
|
||||
private ImageButton buttonSelectEndDate;
|
||||
private AppCompatSpinner spinnerMonth;
|
||||
private Button buttonSearch;
|
||||
private int activeSearchMode;
|
||||
private ListView listResult;
|
||||
private String[] cbSearchBy;
|
||||
private String[] cbSearchByMonth;
|
||||
private CardView layout;
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
return inflater.inflate(R.layout.fragment_marketing_report, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_product_page), null);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.search).setVisibility(View.GONE);
|
||||
getActivity().findViewById(com.adins.mss.base.R.id.spinner).setVisibility(View.GONE);
|
||||
getActivity().setTitle(getString(com.adins.mss.base.R.string.title_mn_marketingreport));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
listResult = (ListView) view.findViewById(R.id.resultListView);
|
||||
layout = (CardView) view.findViewById(R.id.resultLayout);
|
||||
|
||||
buttonSelectDate = (ImageButton) view.findViewById(R.id.btnDate);
|
||||
buttonSelectStartDate = (ImageButton) view.findViewById(R.id.btnStartDate);
|
||||
buttonSelectEndDate = (ImageButton) view.findViewById(R.id.btnEndDate);
|
||||
buttonSearch = (Button) view.findViewById(R.id.btnSearchOrder);
|
||||
|
||||
editDate = (EditText) view.findViewById(R.id.txtDateDay);
|
||||
editStartDate = (EditText) view.findViewById(R.id.txtStartDate);
|
||||
editEndDate = (EditText) view.findViewById(R.id.txtEndDate);
|
||||
|
||||
spinnerMonth = (AppCompatSpinner) view.findViewById(R.id.cbSearchByMonth);
|
||||
spinnerCategory = (AppCompatSpinner) view.findViewById(R.id.cbSearchBy);
|
||||
|
||||
cbSearchBy = this.getResources().getStringArray(R.array.cbSearchBy);
|
||||
|
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.cbSearchBy,
|
||||
R.layout.spinner_search_layout);
|
||||
adapter.setDropDownViewResource(R.layout.spinner_style);
|
||||
|
||||
spinnerCategory.setAdapter(adapter);
|
||||
|
||||
cbSearchByMonth = this.getResources().getStringArray(R.array.cbSearchByMonth);
|
||||
|
||||
Calendar monthCalendar = Calendar.getInstance();
|
||||
int maximumMonth = monthCalendar.get(Calendar.MONTH);
|
||||
|
||||
String[] months = getActivity().getResources().getStringArray(R.array.cbSearchByMonth);
|
||||
|
||||
ArrayList<String> availableMonths = new ArrayList<String>();
|
||||
availableMonths.addAll(Arrays.asList(months).subList(0, maximumMonth + 1));
|
||||
|
||||
ArrayAdapter<String> monthAdapter = new ArrayAdapter<String>(getActivity(), R.layout.spinner_style2, availableMonths);
|
||||
monthAdapter.setDropDownViewResource(R.layout.spinner_style);
|
||||
|
||||
spinnerMonth.setAdapter(monthAdapter);
|
||||
|
||||
spinnerCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
invalidateForm(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
buttonSelectDate.setOnClickListener(new DateClickListener(getActivity(), editDate));
|
||||
buttonSelectStartDate.setOnClickListener(new DateClickListener(getActivity(), editStartDate));
|
||||
buttonSelectEndDate.setOnClickListener(new DateClickListener(getActivity(), editEndDate));
|
||||
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MarketingSearchRequest request = new MarketingSearchRequest();
|
||||
|
||||
try {
|
||||
if (Tool.isInternetconnected(getActivity())) {
|
||||
executeSearch(request,editDate.getText().toString(), spinnerMonth.getSelectedItemPosition(),editStartDate.getText().toString(), editEndDate.getText().toString());
|
||||
} else {
|
||||
NiftyDialogBuilder builder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
builder.withTitle("INFO")
|
||||
.withMessage(getString(R.string.no_internet_connection))
|
||||
.show();
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void executeSearch(MarketingSearchRequest request, final String date, final int month, final String startDate, final String endDate) throws ParseException, IOException {
|
||||
new AsyncTask<Void, Void, MarketingSearchResponse>(){
|
||||
final ProgressDialog progress = new ProgressDialog(getActivity());
|
||||
String errMessage;
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress.setMessage(getActivity().getString(R.string.contact_server));
|
||||
progress.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MarketingSearchResponse doInBackground(Void... params) {
|
||||
try {
|
||||
MarketingSearchRequest searchRequest = new MarketingSearchRequest();
|
||||
searchRequest.setUuidUser(GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
searchRequest.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
try {
|
||||
if (activeSearchMode == 0) {
|
||||
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||
Date date1 = f.parse(date);
|
||||
searchRequest.setDate1(date1);
|
||||
}
|
||||
if (activeSearchMode == 1) {
|
||||
SimpleDateFormat f = new SimpleDateFormat(Global.DATE_STR_FORMAT);
|
||||
Date sDate, eDate;
|
||||
long sLong = 0;
|
||||
long eLong = 0;
|
||||
try {
|
||||
sDate = f.parse(startDate);
|
||||
searchRequest.setDate1(sDate);
|
||||
eDate = f.parse(endDate);
|
||||
eDate.setHours(23);
|
||||
eDate.setMinutes(59);
|
||||
eDate.setSeconds(59);
|
||||
searchRequest.setDate2(eDate);
|
||||
sLong = sDate.getTime();
|
||||
eLong = eDate.getTime();
|
||||
} catch (ParseException e) {
|
||||
errMessage = getActivity().getString(R.string.enter_valid_date);
|
||||
return null;
|
||||
}
|
||||
long milisecond = eLong - sLong;
|
||||
if (milisecond > 604799000) {
|
||||
errMessage = getActivity().getString(R.string.data_range_not_allowed);
|
||||
return null;
|
||||
} else if (milisecond < 0) {
|
||||
errMessage = getActivity().getString(R.string.input_not_valid);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
if (activeSearchMode == 2) {
|
||||
searchRequest.setMonth(String.valueOf(month + 1));
|
||||
}
|
||||
} catch (ParseException parseEx) {
|
||||
errMessage = getActivity().getString(R.string.enter_valid_date);
|
||||
return null;
|
||||
}
|
||||
|
||||
String json = GsonHelper.toJson(searchRequest);
|
||||
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_MKTPERFORMANCE();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(getActivity(), encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
try {
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarketingSearchResponse serverResponse = null;
|
||||
if (serverResult != null && serverResult.isOK()) {
|
||||
try {
|
||||
String responseBody = serverResult.getResult();
|
||||
serverResponse = GsonHelper.fromJson(responseBody, MarketingSearchResponse.class);
|
||||
|
||||
} catch (Exception e) {
|
||||
if(Global.IS_DEV) {
|
||||
e.printStackTrace();
|
||||
errMessage=e.getMessage();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errMessage = getActivity().getString(R.string.server_down);
|
||||
}
|
||||
|
||||
return serverResponse;
|
||||
} catch (Exception e) {
|
||||
errMessage = e.getMessage();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(final MarketingSearchResponse serverResponse) {
|
||||
super.onPostExecute(serverResponse);
|
||||
if(getActivity()!=null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (errMessage != null) {
|
||||
Toast.makeText(getActivity(), errMessage, Toast.LENGTH_SHORT).show();
|
||||
} else if (serverResponse != null && serverResponse.getListKeyValue() != null) {
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
MarketingReportFragment.this.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listResult.setAdapter(new SearchResultListAdapter(getActivity(), serverResponse.getListKeyValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void invalidateForm(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
showSearchForm(R.id.byDay);
|
||||
break;
|
||||
case 1:
|
||||
showSearchForm(R.id.byEstimatedDate);
|
||||
break;
|
||||
case 2:
|
||||
showSearchForm(R.id.byMonth);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.activeSearchMode = position;
|
||||
}
|
||||
|
||||
private void showSearchForm(int id) {
|
||||
View byDay = getView().findViewById(R.id.byDay);
|
||||
View byRange = getView().findViewById(R.id.byEstimatedDate);
|
||||
View byMonth = getView().findViewById(R.id.byMonth);
|
||||
|
||||
byDay.setVisibility(View.GONE);
|
||||
byRange.setVisibility(View.GONE);
|
||||
byMonth.setVisibility(View.GONE);
|
||||
|
||||
View active = getView().findViewById(id);
|
||||
active.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
class SearchResultListAdapter extends ArrayAdapter<KeyValue> {
|
||||
|
||||
public SearchResultListAdapter(Context context) {
|
||||
super(context, R.layout.view_surveyor_search_result);
|
||||
}
|
||||
|
||||
public SearchResultListAdapter(Context context, KeyValue[] values) {
|
||||
super(context, R.layout.view_surveyor_search_result, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.view_surveyor_search_result, parent, false);
|
||||
}
|
||||
TextView label = (TextView) convertView.findViewById(R.id.taskLabel);
|
||||
TextView value = (TextView) convertView.findViewById(R.id.taskValue);
|
||||
|
||||
KeyValue item = getItem(position);
|
||||
label.setText(item.getKey());
|
||||
value.setText(item.getValue());
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.adins.mss.odr.marketingreport;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class MarketingSearchRequest extends MssRequestType {
|
||||
@SerializedName("date1")
|
||||
private Date date1;
|
||||
@SerializedName("date2")
|
||||
private Date date2;
|
||||
@SerializedName("month")
|
||||
private String month;
|
||||
@SerializedName("uuid_user")
|
||||
private String uuidUser;
|
||||
|
||||
public String getUuidUser() {
|
||||
return uuidUser;
|
||||
}
|
||||
|
||||
public void setUuidUser(String uuidUser) {
|
||||
this.uuidUser = uuidUser;
|
||||
}
|
||||
|
||||
public Date getDate1() {
|
||||
return date1;
|
||||
}
|
||||
|
||||
public void setDate1(Date date1) {
|
||||
this.date1 = date1;
|
||||
}
|
||||
|
||||
public Date getDate2() {
|
||||
return date2;
|
||||
}
|
||||
|
||||
public void setDate2(Date date2) {
|
||||
this.date2 = date2;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.adins.mss.odr.marketingreport;
|
||||
|
||||
import com.adins.mss.foundation.http.KeyValue;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/28/2017.
|
||||
*/
|
||||
|
||||
public class MarketingSearchResponse extends MssResponseType {
|
||||
@SerializedName("listKeyValue")
|
||||
private KeyValue[] listKeyValue;
|
||||
|
||||
public KeyValue[] getListKeyValue() {
|
||||
return listKeyValue;
|
||||
}
|
||||
|
||||
public void setListKeyValue(KeyValue[] listKeyValue) {
|
||||
this.listKeyValue = listKeyValue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.adins.mss.odr.model;
|
||||
|
||||
import com.adins.mss.dao.TaskD;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JsonGetVerification extends MssResponseType {
|
||||
@SerializedName("listTaskD")
|
||||
private List<TaskD> listTaskD;
|
||||
|
||||
public List<TaskD> getListTaskD() {
|
||||
return listTaskD;
|
||||
}
|
||||
|
||||
public void setListTaskD(List<TaskD> listTaskD) {
|
||||
this.listTaskD = listTaskD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.adins.mss.odr.model;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author gigin.ginanjar
|
||||
*/
|
||||
public class JsonRequestCheckOrder extends MssRequestType {
|
||||
@SerializedName("order_number")
|
||||
String order_number;
|
||||
@SerializedName("start_date")
|
||||
String start_date;
|
||||
@SerializedName("end_date")
|
||||
String end_date;
|
||||
@SerializedName("status")
|
||||
String status;
|
||||
@SerializedName("flag")
|
||||
String flag;
|
||||
@SerializedName("customer_name")
|
||||
String customer_name;
|
||||
|
||||
/**
|
||||
* Gets the flag
|
||||
*/
|
||||
public String getFlag() {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag
|
||||
*/
|
||||
public void setFlag(String value) {
|
||||
this.flag = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the orderNumber
|
||||
*/
|
||||
public String getOrderNumber() {
|
||||
return this.order_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the orderNumber
|
||||
*/
|
||||
public void setOrderNumber(String value) {
|
||||
this.order_number = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the startDate
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return this.start_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the startDate
|
||||
*/
|
||||
public void setStartDate(String value) {
|
||||
this.start_date = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the endDate
|
||||
*/
|
||||
public String getEndDate() {
|
||||
return this.end_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the endDate
|
||||
*/
|
||||
public void setEndDate(String value) {
|
||||
this.end_date = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status
|
||||
*/
|
||||
public void setStatus(String value) {
|
||||
this.status = value;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customer_name;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customer_name) {
|
||||
this.customer_name = customer_name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.adins.mss.odr.model;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class JsonRequestDetailOrder extends MssRequestType {
|
||||
/**
|
||||
* Property flag
|
||||
*/
|
||||
@SerializedName("flag")
|
||||
String flag;
|
||||
|
||||
/**
|
||||
* Property nomor_order
|
||||
*/
|
||||
@SerializedName("nomor_order")
|
||||
String nomor_order;
|
||||
|
||||
@SerializedName("uuid_task_h")
|
||||
String uuid_task_h;
|
||||
|
||||
/**
|
||||
* Property question_id
|
||||
*/
|
||||
@SerializedName("question_id")
|
||||
String question_id;
|
||||
|
||||
/**
|
||||
* Gets the uuid_task_h
|
||||
*/
|
||||
public String getUuid_task_h() {
|
||||
return this.uuid_task_h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uuid_task_h
|
||||
*/
|
||||
public void setUuid_task_h(String value) {
|
||||
this.uuid_task_h = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flag
|
||||
*/
|
||||
public String getFlag() {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the flag
|
||||
*/
|
||||
public void setFlag(String value) {
|
||||
this.flag = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nomor_order
|
||||
*/
|
||||
public String getNomor_order() {
|
||||
return this.nomor_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nomor_order
|
||||
*/
|
||||
public void setNomor_order(String value) {
|
||||
this.nomor_order = value;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue