Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41b1254a66 | |||
| 76e4fca075 | |||
| da5d6cc1b3 | |||
| bc00a42ffd | |||
| 991846d75a | |||
| d2f8f317ae | |||
| a04e0db9d5 | |||
| 741480e66e | |||
| 251a713be6 | |||
| 1af132ab36 |
Generated
+1
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="AppInsightsSettings">
|
<component name="AppInsightsSettings">
|
||||||
|
<option name="selectedTabId" value="Firebase Crashlytics" />
|
||||||
<option name="tabSettings">
|
<option name="tabSettings">
|
||||||
<map>
|
<map>
|
||||||
<entry key="Android Vitals">
|
<entry key="Android Vitals">
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="17" />
|
<bytecodeTargetLevel target="21" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Generated
+13
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DeviceTable">
|
||||||
|
<option name="columnSorters">
|
||||||
|
<list>
|
||||||
|
<ColumnSorterState>
|
||||||
|
<option name="column" value="Name" />
|
||||||
|
<option name="order" value="ASCENDING" />
|
||||||
|
</ColumnSorterState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="17" />
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|||||||
Generated
+8
-2
@@ -1,10 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="ms-17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
<option name="id" value="Android" />
|
<option name="id" value="Android" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="VisualizationToolProject">
|
||||||
|
<option name="state">
|
||||||
|
<ProjectState>
|
||||||
|
<option name="scale" value="0.67" />
|
||||||
|
</ProjectState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
+3
-2
@@ -3,6 +3,8 @@ apply plugin: 'com.android.library'
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +18,7 @@ ext {
|
|||||||
PUBLISH_VERSION_CODE = 11
|
PUBLISH_VERSION_CODE = 11
|
||||||
SUPPORT_VERSION = '25.3.1'
|
SUPPORT_VERSION = '25.3.1'
|
||||||
TARGET_SDK = 35
|
TARGET_SDK = 35
|
||||||
MIN_SDK = 24
|
MIN_SDK = 23
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -35,7 +37,6 @@ android {
|
|||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ Sources JAR
|
// ✅ Sources JAR
|
||||||
|
|||||||
@@ -13,3 +13,9 @@
|
|||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
# Android build outputs
|
||||||
|
*.apk
|
||||||
|
*.aab
|
||||||
|
/build
|
||||||
|
/app/build
|
||||||
|
|||||||
+14
-13
@@ -3,17 +3,16 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
apply plugin: 'com.google.firebase.crashlytics'
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
apply plugin: 'org.jetbrains.kotlin.android'
|
apply plugin: 'org.jetbrains.kotlin.android'
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace("com.cpm.lorealbaautomation")
|
namespace("com.cpm.lorealbaautomation")
|
||||||
compileSdk(35)
|
compileSdk(35)
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 29
|
minSdkVersion 23
|
||||||
applicationId "com.cpm.lorealbaautomation"
|
applicationId "com.cpm.lorealbaautomation"
|
||||||
//noinspection OldTargetApi
|
//noinspection OldTargetApi
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 20
|
versionCode 23
|
||||||
versionName "2.9"
|
versionName "3.1"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -21,7 +20,6 @@ android {
|
|||||||
abiFilters.add("armeabi-v7a")
|
abiFilters.add("armeabi-v7a")
|
||||||
abiFilters.add("arm64-v8a")
|
abiFilters.add("arm64-v8a")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
config {
|
config {
|
||||||
@@ -33,16 +31,17 @@ android {
|
|||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
buildConfigField "boolean", "LOG_ENABLED", "true"
|
//buildConfigField "boolean", "LOG_ENABLED", "true"
|
||||||
debuggable true
|
debuggable false
|
||||||
minifyEnabled true
|
minifyEnabled false
|
||||||
shrinkResources true
|
shrinkResources false
|
||||||
signingConfig signingConfigs.config
|
signingConfig signingConfigs.config
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
firebaseCrashlytics {
|
firebaseCrashlytics {
|
||||||
mappingFileUploadEnabled false // or false if you want to disable
|
mappingFileUploadEnabled false // or false if you want to disable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 👇 Add this block to force override
|
// 👇 Add this block to force override
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,12 +72,14 @@ dependencies {
|
|||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
|
||||||
implementation 'org.jetbrains:annotations-java5:15.0'
|
implementation 'org.jetbrains:annotations-java5:15.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
//noinspection GradleDependency
|
||||||
|
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
|
||||||
|
//noinspection GradleDependency
|
||||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
|
||||||
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
|
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
|
||||||
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
|
||||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -11,8 +11,8 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 20,
|
"versionCode": 23,
|
||||||
"versionName": "2.9",
|
"versionName": "3.1",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -658,6 +658,14 @@
|
|||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustPan"
|
||||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".dailyactivity.BaAssessmentActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
|
android:windowSoftInputMode="adjustPan"
|
||||||
|
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||||
|
|
||||||
<!-- <meta-data
|
<!-- <meta-data
|
||||||
android:name="com.google.android.geo.API_KEY"
|
android:name="com.google.android.geo.API_KEY"
|
||||||
android:value="AIzaSyAJIqKPhsyYTp6WnM387Fri4nLJo4-mOvc"
|
android:value="AIzaSyAJIqKPhsyYTp6WnM387Fri4nLJo4-mOvc"
|
||||||
@@ -670,16 +678,18 @@
|
|||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.file provider"
|
android:authorities="${applicationId}.fileprovider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true"
|
android:grantUriPermissions="true"
|
||||||
tools:replace="android:authorities">
|
tools:replace="android:authorities">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/provider_paths"
|
android:resource="@xml/provider_paths"
|
||||||
tools:replace="android:resource" />
|
tools:replace="android:resource" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.MyFirebaseMessagingService"
|
android:name=".service.MyFirebaseMessagingService"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -31,7 +34,6 @@ import java.net.URL;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class AutoUpdateActivity extends AppCompatActivity {
|
public class AutoUpdateActivity extends AppCompatActivity {
|
||||||
private static final int PERMISSION_ALL = 99;
|
|
||||||
private Dialog dialog;
|
private Dialog dialog;
|
||||||
private ProgressBar pb;
|
private ProgressBar pb;
|
||||||
private TextView percentage, message;
|
private TextView percentage, message;
|
||||||
@@ -150,19 +152,30 @@ public class AutoUpdateActivity extends AppCompatActivity {
|
|||||||
File toInstall = new File(CommonString.getLorealBaApkFolder(context) + "app.apk");
|
File toInstall = new File(CommonString.getLorealBaApkFolder(context) + "app.apk");
|
||||||
Uri apkUri;
|
Uri apkUri;
|
||||||
Intent intent;
|
Intent intent;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
apkUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", toInstall);
|
apkUri = FileProvider.getUriForFile(context,
|
||||||
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
BuildConfig.APPLICATION_ID + ".fileprovider",
|
||||||
intent.setData(apkUri);
|
toInstall);
|
||||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
||||||
|
intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
context.startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
apkUri = Uri.fromFile(toInstall);
|
apkUri = Uri.fromFile(toInstall);
|
||||||
intent = new Intent(Intent.ACTION_VIEW);
|
intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
// Optional: close the updater activity gracefully
|
||||||
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||||
|
((Activity) context).finishAffinity();
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -808,6 +808,7 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.e("finalList", "DealerB"+finalList.toString() );
|
||||||
if (!finalList.isEmpty()) {
|
if (!finalList.isEmpty()) {
|
||||||
Intent intentu = new Intent(context, Downloader.class);
|
Intent intentu = new Intent(context, Downloader.class);
|
||||||
intentu.putExtra(CommonString.KEY_UPLOADIMAGE, "1");
|
intentu.putExtra(CommonString.KEY_UPLOADIMAGE, "1");
|
||||||
|
|||||||
@@ -266,7 +266,6 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("ObsoleteSdkInt")
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
private void AttempLogin() {
|
private void AttempLogin() {
|
||||||
try {
|
try {
|
||||||
@@ -280,7 +279,6 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
|
|||||||
loading = ProgressDialog.show(IMEILoginActivity.this, "Processing", "Please wait...", false, false);
|
loading = ProgressDialog.show(IMEILoginActivity.this, "Processing", "Please wait...", false, false);
|
||||||
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
|
||||||
jsonObject.put("OSVersion", os_version);
|
jsonObject.put("OSVersion", os_version);
|
||||||
jsonObject.put("Manufacturer", manufacturer);
|
jsonObject.put("Manufacturer", manufacturer);
|
||||||
jsonObject.put("ModelNumber", model);
|
jsonObject.put("ModelNumber", model);
|
||||||
@@ -302,9 +300,8 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
|
|||||||
jsonObject.put("IMEINumber1", "0");
|
jsonObject.put("IMEINumber1", "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String jsonString = jsonObject.toString();
|
String jsonString = jsonObject.toString();
|
||||||
Log.e("jsonlogindata", jsonString);
|
Log.e("jsonString",jsonString);
|
||||||
try {
|
try {
|
||||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout
|
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout
|
||||||
(CommonString.TIMEOUT, TimeUnit.SECONDS).connectTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).build();
|
(CommonString.TIMEOUT, TimeUnit.SECONDS).connectTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).build();
|
||||||
@@ -322,12 +319,12 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
|
|||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
data = response.body().string();
|
data = response.body().string();
|
||||||
data = data.substring(1, data.length() - 1).replace("\\", "");
|
data = data.substring(1, data.length() - 1).replace("\\", "");
|
||||||
|
Log.e("jsonString",data);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
final CounterDeviceLoginGetterSetter userObject = gson.fromJson(data, CounterDeviceLoginGetterSetter.class);
|
final CounterDeviceLoginGetterSetter userObject = gson.fromJson(data, CounterDeviceLoginGetterSetter.class);
|
||||||
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||||
AlertandMessages.showAlertCounterlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
|
AlertandMessages.showAlertCounterlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
|
|
||||||
if (loading != null && loading.isShowing()) {
|
if (loading != null && loading.isShowing()) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.cpm.lorealbaautomation;
|
||||||
|
|
||||||
|
import static com.google.android.gms.location.Priority.PRIORITY_HIGH_ACCURACY;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationRequest;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
|
import com.google.android.gms.location.LocationCallback;
|
||||||
|
import com.google.android.gms.location.LocationResult;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.android.gms.location.Priority;
|
||||||
|
|
||||||
|
|
||||||
|
public class LocationEngine {
|
||||||
|
|
||||||
|
public interface LocationResultListener {
|
||||||
|
void onLocationReady(Location location, float accuracy);
|
||||||
|
void onFailure(String msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
private final FusedLocationProviderClient fusedClient;
|
||||||
|
|
||||||
|
private LocationCallback locationCallback;
|
||||||
|
|
||||||
|
private Location bestLocation = null;
|
||||||
|
private float bestAccuracy = Float.MAX_VALUE;
|
||||||
|
|
||||||
|
private Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
public LocationEngine(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
fusedClient = LocationServices.getFusedLocationProviderClient(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start(LocationResultListener listener) {
|
||||||
|
|
||||||
|
com.google.android.gms.location.LocationRequest request = new com.google.android.gms.location.LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 2000L)
|
||||||
|
.setMinUpdateIntervalMillis(1000L)
|
||||||
|
.setMaxUpdateDelayMillis(3000L)
|
||||||
|
.setWaitForAccurateLocation(true) // Optional, improves first fix
|
||||||
|
.build();
|
||||||
|
|
||||||
|
/* LocationRequest request = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 2000L) // 👈 IMPORTANT
|
||||||
|
.setMinUpdateIntervalMillis(1000L)
|
||||||
|
.setMaxUpdateDelayMillis(3000L)
|
||||||
|
.setWaitForAccurateLocation(true)
|
||||||
|
.build();*/
|
||||||
|
|
||||||
|
locationCallback = new LocationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLocationResult(@NonNull LocationResult result) {
|
||||||
|
|
||||||
|
for (Location location : result.getLocations()) {
|
||||||
|
|
||||||
|
if (location == null) continue;
|
||||||
|
|
||||||
|
float accuracy = location.getAccuracy();
|
||||||
|
|
||||||
|
// 🔥 Track best location always
|
||||||
|
if (accuracy < bestAccuracy) {
|
||||||
|
bestAccuracy = accuracy;
|
||||||
|
bestLocation = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("LocationEngine",
|
||||||
|
"Lat: " + location.getLatitude()
|
||||||
|
+ " Lng: " + location.getLongitude()
|
||||||
|
+ " Acc: " + accuracy);
|
||||||
|
|
||||||
|
// ✅ Accept good or stable location
|
||||||
|
if (accuracy <= 80) {
|
||||||
|
stop();
|
||||||
|
listener.onLocationReady(location, accuracy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ActivityCompat.checkSelfPermission(context,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
|
listener.onFailure("Permission not granted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fusedClient.requestLocationUpdates(request, locationCallback, Looper.getMainLooper());
|
||||||
|
|
||||||
|
// ⏱ Timeout fallback (VERY IMPORTANT)
|
||||||
|
handler.postDelayed(() -> {
|
||||||
|
|
||||||
|
if (bestLocation != null) {
|
||||||
|
Log.d("LocationEngine", "Using fallback location");
|
||||||
|
|
||||||
|
listener.onLocationReady(bestLocation, bestAccuracy);
|
||||||
|
} else {
|
||||||
|
listener.onFailure("Unable to fetch location");
|
||||||
|
}
|
||||||
|
|
||||||
|
stop();
|
||||||
|
|
||||||
|
}, 8000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
if (locationCallback != null) {
|
||||||
|
fusedClient.removeLocationUpdates(locationCallback);
|
||||||
|
}
|
||||||
|
handler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -462,7 +462,6 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "Mapping_JourneyPlan":
|
case "Mapping_JourneyPlan":
|
||||||
Log.d("JSON_DATA", data);
|
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
|
|||||||
@@ -101,12 +101,14 @@ public class AlertandMessages {
|
|||||||
Snackbar.make(Objects.requireNonNull(((Activity) context).getCurrentFocus()), message, Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(Objects.requireNonNull(((Activity) context).getCurrentFocus()), message, Snackbar.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void backpressedAlert(final Activity activity) {
|
public static void closeApp(final Activity activity, String str) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle("Alert");
|
builder.setTitle("Alert");
|
||||||
builder.setMessage("Do you want to exit? Filled data will be lost").setCancelable(false)
|
builder.setMessage(str).setCancelable(false)
|
||||||
.setPositiveButton("Ok", (dialog, id) -> activity.finish());
|
.setPositiveButton("Ok", (dialog, id) -> {
|
||||||
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
|
dialog.dismiss();
|
||||||
|
activity.finishAffinity();
|
||||||
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class CommonString {
|
|||||||
public static final String LorealPromo_Folder = "LorealPromoOffers";
|
public static final String LorealPromo_Folder = "LorealPromoOffers";
|
||||||
public static final String LorealBaApkFolder = "LorealBaApkFolder";
|
public static final String LorealBaApkFolder = "LorealBaApkFolder";
|
||||||
|
|
||||||
|
public static String BA_ASSESSMENT_URL ="https://careaudit.parinaam.in?";
|
||||||
|
|
||||||
public static String getLorealBaApkFolder(Context context) {
|
public static String getLorealBaApkFolder(Context context) {
|
||||||
return AppUtils.getInternalDirectory(context, LorealBaApkFolder).getAbsolutePath() + "/";
|
return AppUtils.getInternalDirectory(context, LorealBaApkFolder).getAbsolutePath() + "/";
|
||||||
}
|
}
|
||||||
@@ -119,6 +121,7 @@ public class CommonString {
|
|||||||
public static final String TABLE_COVERAGE_DATA = "COVERAGE_DATA";
|
public static final String TABLE_COVERAGE_DATA = "COVERAGE_DATA";
|
||||||
public static final String Key_Download_Status = "Download_Status";
|
public static final String Key_Download_Status = "Download_Status";
|
||||||
public static final String MESSAGE_CHANGED = "Invalid UserId Or Password / Password Has Been Changed.";
|
public static final String MESSAGE_CHANGED = "Invalid UserId Or Password / Password Has Been Changed.";
|
||||||
|
public static final String MESSAGE_LOCKED = "User ID is blocked. Please contact your supervisor";
|
||||||
public static final String MESSAGE_LOGIN_NO_DATA = "Data mapping error.";
|
public static final String MESSAGE_LOGIN_NO_DATA = "Data mapping error.";
|
||||||
public static final String Table_Sale_Tracking = "SALE_TRACKING_TABLE";
|
public static final String Table_Sale_Tracking = "SALE_TRACKING_TABLE";
|
||||||
public static final String Table_Applyeid_Promotion = "APPLYED_PROMOTION_TABLE";
|
public static final String Table_Applyeid_Promotion = "APPLYED_PROMOTION_TABLE";
|
||||||
@@ -1026,6 +1029,7 @@ public class CommonString {
|
|||||||
public static final String MANUALINWARD_DMS_NEWPRODUCT = "MANUALINWARD_DMS_NEWPRODUCT";
|
public static final String MANUALINWARD_DMS_NEWPRODUCT = "MANUALINWARD_DMS_NEWPRODUCT";
|
||||||
public static final String CONSUMERSALE = "CONSUMERSALE";
|
public static final String CONSUMERSALE = "CONSUMERSALE";
|
||||||
public static final String SKINGENIUS = "SKINGENIUS";
|
public static final String SKINGENIUS = "SKINGENIUS";
|
||||||
|
public static final String KEY_LOCKOUT = "LOCKOUT";
|
||||||
public static final String OPEN_SKINGENIUS = "OPEN_SKINGENIUS";
|
public static final String OPEN_SKINGENIUS = "OPEN_SKINGENIUS";
|
||||||
public static final String OPEN_MAYBELLINE = "OPEN_MAYBELLINE";
|
public static final String OPEN_MAYBELLINE = "OPEN_MAYBELLINE";
|
||||||
public static final String CONSUMERRETURN = "CONSUMERRETURN";
|
public static final String CONSUMERRETURN = "CONSUMERRETURN";
|
||||||
|
|||||||
+33
-3
@@ -171,6 +171,7 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
if (clicked_flag) {
|
if (clicked_flag) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).setMessage(CommonString.ONBACK_ALERT_MESSAGE).setCancelable(false).setPositiveButton("Ok",
|
AlertDialog.Builder builder = new AlertDialog.Builder(context).setMessage(CommonString.ONBACK_ALERT_MESSAGE).setCancelable(false).setPositiveButton("Ok",
|
||||||
(dialog, id) -> {
|
(dialog, id) -> {
|
||||||
@@ -873,8 +874,38 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
|
|||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setFilter(int filterType, Spinner dialog_spin) {
|
public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
|
List<ProductMaster> filteredList = new ArrayList<>();
|
||||||
|
|
||||||
|
switch (filterType) {
|
||||||
|
case FILTER_FOR_BRAND:
|
||||||
|
filteredList = filterListForBrand(dialog_product_list, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_SUB_BRAND:
|
||||||
|
filteredList = filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_REFERENCE_NAME:
|
||||||
|
filteredList = filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
filteredList = dialog_product_list;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare display strings
|
||||||
|
List<String> displayList = new ArrayList<>();
|
||||||
|
displayList.add("- Select Product -"); // default item
|
||||||
|
for (ProductMaster product : filteredList) {
|
||||||
|
displayList.add(product.getProductName() + " - (MRP-" + product.getMrp() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set adapter
|
||||||
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
|
dialog_sku_adapter.addAll(displayList);
|
||||||
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
|
}
|
||||||
|
/*public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
if (filterType == FILTER_FOR_BRAND) {
|
if (filterType == FILTER_FOR_BRAND) {
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
dialog_sku_adapter.add("- Select Product -");
|
||||||
@@ -920,9 +951,8 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
|
|||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.invalidate();
|
dialog_spin.invalidate();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
final int CLEAR_FILTER = 0;
|
final int CLEAR_FILTER = 0;
|
||||||
final int FILTER_FOR_BRAND = 1;
|
final int FILTER_FOR_BRAND = 1;
|
||||||
|
|||||||
+239
-151
@@ -16,6 +16,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@@ -48,9 +49,11 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.cardview.widget.CardView;
|
import androidx.cardview.widget.CardView;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.cpm.lorealbaautomation.gsonGetterSetter.PromotionMaster;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.zxing.integration.android.IntentIntegrator;
|
import com.google.zxing.integration.android.IntentIntegrator;
|
||||||
@@ -96,6 +99,7 @@ import okhttp3.ResponseBody;
|
|||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
|
|
||||||
public class ConsumerUserDetailsActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
|
public class ConsumerUserDetailsActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
|
||||||
String dialog_invoiceType = "Saleable", dialog_brand_Id = "", dialog_sub_brand_Id = "", dialog_reference_Id = "", product_name = "",
|
String dialog_invoiceType = "Saleable", dialog_brand_Id = "", dialog_sub_brand_Id = "", dialog_reference_Id = "", product_name = "",
|
||||||
product_Id = "0", product_mrp = "0", CounterId, visit_date,
|
product_Id = "0", product_mrp = "0", CounterId, visit_date,
|
||||||
@@ -266,7 +270,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
if (flag_for_consumer_Update != null && flag_for_consumer_Update.equals("1")) {
|
if (flag_for_consumer_Update != null && flag_for_consumer_Update.equals("1")) {
|
||||||
edt_mobile_no.setEnabled(false);
|
edt_mobile_no.setEnabled(false);
|
||||||
mobile_checkbox.setEnabled(false);
|
mobile_checkbox.setEnabled(false);
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.gray));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.gray));
|
||||||
rl_term_condition.setEnabled(false);
|
rl_term_condition.setEnabled(false);
|
||||||
mobile_checkbox.setEnabled(false);
|
mobile_checkbox.setEnabled(false);
|
||||||
edt_email_address.setEnabled(false);
|
edt_email_address.setEnabled(false);
|
||||||
@@ -304,55 +308,55 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
|
|
||||||
//for demo perpose button
|
//for demo perpose button
|
||||||
if (!selected_list.get(0).getDemo_given_str().isEmpty() && selected_list.get(0).getDemo_given_str().equalsIgnoreCase("Yes")) {
|
if (!selected_list.get(0).getDemo_given_str().isEmpty() && selected_list.get(0).getDemo_given_str().equalsIgnoreCase("Yes")) {
|
||||||
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
promotion_btn_first.setTextColor(getResources().getColor(R.color.white));
|
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
promotion_btn_second.setTextColor(getResources().getColor(R.color.grayfor_login));
|
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
demo_given_str = "Yes";
|
demo_given_str = "Yes";
|
||||||
} else {
|
} else {
|
||||||
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
|
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
|
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
demo_given_str = "No";
|
demo_given_str = "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
/////For Skin Genious
|
/////For Skin Genious
|
||||||
if (!selected_list.get(0).getSkin_genius_str().isEmpty() && selected_list.get(0).getSkin_genius_str().equalsIgnoreCase("Yes")) {
|
if (!selected_list.get(0).getSkin_genius_str().isEmpty() && selected_list.get(0).getSkin_genius_str().equalsIgnoreCase("Yes")) {
|
||||||
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
skingn_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
skingn_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
skin_genius_str = "Yes";
|
skin_genius_str = "Yes";
|
||||||
} else {
|
} else {
|
||||||
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
|
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
skin_genius_str = "No";
|
skin_genius_str = "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
/////For Maybelline VTO
|
/////For Maybelline VTO
|
||||||
if (!selected_list.get(0).getMaybelline_vto_str().isEmpty() && selected_list.get(0).getMaybelline_vto_str().equalsIgnoreCase("Yes")) {
|
if (!selected_list.get(0).getMaybelline_vto_str().isEmpty() && selected_list.get(0).getMaybelline_vto_str().equalsIgnoreCase("Yes")) {
|
||||||
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
maybelline_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
maybelline_vto = "Yes";
|
maybelline_vto = "Yes";
|
||||||
} else {
|
} else {
|
||||||
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
|
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
maybelline_vto = "No";
|
maybelline_vto = "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!selected_list.get(0).getProduct_sold_str().isEmpty() && selected_list.get(0).getProduct_sold_str().equalsIgnoreCase("Yes")) {
|
if (!selected_list.get(0).getProduct_sold_str().isEmpty() && selected_list.get(0).getProduct_sold_str().equalsIgnoreCase("Yes")) {
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
card_layout_scan.setVisibility(View.VISIBLE);
|
card_layout_scan.setVisibility(View.VISIBLE);
|
||||||
card_layout_title.setVisibility(View.VISIBLE);
|
card_layout_title.setVisibility(View.VISIBLE);
|
||||||
drawer_layout_recycle_store.setVisibility(View.VISIBLE);
|
drawer_layout_recycle_store.setVisibility(View.VISIBLE);
|
||||||
@@ -361,10 +365,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
img_visble.setVisibility(View.VISIBLE);
|
img_visble.setVisibility(View.VISIBLE);
|
||||||
text_user_nm.setText(selected_list.get(0).getCustomer_name() + " Customer - " + CommonFunctions.removed_special_char(edt_customer));
|
text_user_nm.setText(selected_list.get(0).getCustomer_name() + " Customer - " + CommonFunctions.removed_special_char(edt_customer));
|
||||||
} else {
|
} else {
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
card_layout_scan.setVisibility(View.GONE);
|
card_layout_scan.setVisibility(View.GONE);
|
||||||
card_layout_title.setVisibility(View.GONE);
|
card_layout_title.setVisibility(View.GONE);
|
||||||
drawer_layout_recycle_store.setVisibility(View.GONE);
|
drawer_layout_recycle_store.setVisibility(View.GONE);
|
||||||
@@ -407,27 +411,27 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
drawer_layout_recycle_store.setLayoutManager(new LinearLayoutManager(context));
|
drawer_layout_recycle_store.setLayoutManager(new LinearLayoutManager(context));
|
||||||
} else {
|
} else {
|
||||||
selected_list = new ArrayList<>();
|
selected_list = new ArrayList<>();
|
||||||
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
|
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
|
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
///for Sale Genius
|
///for Sale Genius
|
||||||
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
|
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
///for Maybelline VTO
|
///for Maybelline VTO
|
||||||
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
|
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
maybelline_vto = "No";
|
maybelline_vto = "No";
|
||||||
skin_genius_str = "No";
|
skin_genius_str = "No";
|
||||||
@@ -508,7 +512,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
mobile_checkbox.setEnabled(false);
|
mobile_checkbox.setEnabled(false);
|
||||||
edt_email_address.setEnabled(false);
|
edt_email_address.setEnabled(false);
|
||||||
edt_email_address.setText("");
|
edt_email_address.setText("");
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.gray));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.gray));
|
||||||
rl_term_condition.setEnabled(false);
|
rl_term_condition.setEnabled(false);
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -539,6 +543,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingSuperCall")
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (clicked_flag) {
|
if (clicked_flag) {
|
||||||
@@ -700,12 +705,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
edt_mobile_no.setText("0000000000");
|
edt_mobile_no.setText("0000000000");
|
||||||
rl_otp.setVisibility(View.GONE);
|
rl_otp.setVisibility(View.GONE);
|
||||||
edt_mobile_no.setEnabled(false);
|
edt_mobile_no.setEnabled(false);
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.gray));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.gray));
|
||||||
} else {
|
} else {
|
||||||
edt_mobile_no.setText("");
|
edt_mobile_no.setText("");
|
||||||
no_mobile_no_flag = false;
|
no_mobile_no_flag = false;
|
||||||
edt_mobile_no.setEnabled(true);
|
edt_mobile_no.setEnabled(true);
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.blue));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.blue));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (view.getId() == R.id.no_name_checkbox) {
|
} else if (view.getId() == R.id.no_name_checkbox) {
|
||||||
@@ -912,10 +917,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
promotion_btn_first.setTextColor(getResources().getColor(R.color.white));
|
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
promotion_btn_second.setTextColor(getResources().getColor(R.color.grayfor_login));
|
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
demo_given_str = "Yes";
|
demo_given_str = "Yes";
|
||||||
if (response_term_condition.equals("1")) {
|
if (response_term_condition.equals("1")) {
|
||||||
rl_demo_img.setVisibility(View.VISIBLE);
|
rl_demo_img.setVisibility(View.VISIBLE);
|
||||||
@@ -926,7 +931,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
//////open demo image layout
|
//////open demo image layout
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///for Skin Genius
|
///for Skin Genius
|
||||||
@@ -940,10 +944,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
skingn_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
skingn_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
skin_genius_str = "Yes";
|
skin_genius_str = "Yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,10 +964,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
maybelline_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
maybelline_vto = "Yes";
|
maybelline_vto = "Yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -977,13 +981,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
|
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
skin_genius_str = "No";
|
skin_genius_str = "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Maybelline VTO No
|
///Maybelline VTO No
|
||||||
@@ -997,10 +1000,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
|
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
maybelline_vto = "No";
|
maybelline_vto = "No";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1014,15 +1017,15 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
|
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
|
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
|
|
||||||
demo_given_str = "No";
|
demo_given_str = "No";
|
||||||
str_img_demo_no_sale = "";
|
str_img_demo_no_sale = "";
|
||||||
@@ -1040,10 +1043,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
} else if (!edt_email_address.getText().toString().isEmpty() && !CommonFunctions.isValidEmail(edt_email_address.getText().toString())) {
|
||||||
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
|
||||||
} else {
|
} else {
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
card_layout_scan.setVisibility(View.GONE);
|
card_layout_scan.setVisibility(View.GONE);
|
||||||
card_layout_title.setVisibility(View.GONE);
|
card_layout_title.setVisibility(View.GONE);
|
||||||
drawer_layout_recycle_store.setVisibility(View.GONE);
|
drawer_layout_recycle_store.setVisibility(View.GONE);
|
||||||
@@ -1068,10 +1071,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
sale_btn_yes.setTextColor(getResources().getColor(R.color.white));
|
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
sale_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
|
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
card_layout_scan.setVisibility(View.VISIBLE);
|
card_layout_scan.setVisibility(View.VISIBLE);
|
||||||
card_layout_title.setVisibility(View.VISIBLE);
|
card_layout_title.setVisibility(View.VISIBLE);
|
||||||
drawer_layout_recycle_store.setVisibility(View.VISIBLE);
|
drawer_layout_recycle_store.setVisibility(View.VISIBLE);
|
||||||
@@ -1552,7 +1555,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
if (_pathforcheck != null && !_pathforcheck.isEmpty()) {
|
if (_pathforcheck != null && !_pathforcheck.isEmpty()) {
|
||||||
if (new File(CommonString.getImagesFolder(context) + _pathforcheck).exists()) {
|
if (new File(CommonString.getImagesFolder(context) + _pathforcheck).exists()) {
|
||||||
convertBitmap(CommonString.getImagesFolder(context) + _pathforcheck);
|
convertBitmap(CommonString.getImagesFolder(context) + _pathforcheck);
|
||||||
img_only_demo.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
|
img_only_demo.setImageDrawable(ContextCompat.getDrawable(context,R.mipmap.camera_bsd));
|
||||||
str_img_demo_no_sale = _pathforcheck;
|
str_img_demo_no_sale = _pathforcheck;
|
||||||
_pathforcheck = "";
|
_pathforcheck = "";
|
||||||
}
|
}
|
||||||
@@ -2581,12 +2584,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
setProductSpinnerData(productList, dialog_product_spin);
|
setProductSpinnerData(productList, dialog_product_spin);
|
||||||
db.open();
|
db.open();
|
||||||
dialog_product_list = db.getproduct_masterlist("T_StockSummary", visit_date, CounterId, from);
|
dialog_product_list = db.getproduct_masterlist("T_StockSummary", visit_date, CounterId, from);
|
||||||
btn_invoice_type_saleable.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
btn_invoice_type_saleable.setTextColor(getResources().getColor(R.color.white));
|
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
});
|
});
|
||||||
|
|
||||||
btn_invoice_type_sample.setOnClickListener(view -> {
|
btn_invoice_type_sample.setOnClickListener(view -> {
|
||||||
@@ -2604,12 +2607,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
setSubBrandSpinnerData(subbrandList, dialog_sub_brand_spin);
|
setSubBrandSpinnerData(subbrandList, dialog_sub_brand_spin);
|
||||||
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
|
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
|
||||||
setProductSpinnerData(productList, dialog_product_spin);
|
setProductSpinnerData(productList, dialog_product_spin);
|
||||||
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.white));
|
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
btn_invoice_type_saleable.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_saleable.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
db.open();
|
db.open();
|
||||||
dialog_product_list = db.getproduct_masterlist(dialog_invoiceType, visit_date, CounterId, from);
|
dialog_product_list = db.getproduct_masterlist(dialog_invoiceType, visit_date, CounterId, from);
|
||||||
|
|
||||||
@@ -2630,12 +2633,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
setSubBrandSpinnerData(subbrandList, dialog_sub_brand_spin);
|
setSubBrandSpinnerData(subbrandList, dialog_sub_brand_spin);
|
||||||
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
|
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
|
||||||
setProductSpinnerData(productList, dialog_product_spin);
|
setProductSpinnerData(productList, dialog_product_spin);
|
||||||
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
|
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
|
||||||
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.white));
|
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||||
btn_invoice_type_saleable.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_saleable.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
|
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
|
||||||
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.grayfor_login));
|
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
|
||||||
db.open();
|
db.open();
|
||||||
dialog_product_list = db.getproduct_masterlist(dialog_invoiceType, visit_date, CounterId, from);
|
dialog_product_list = db.getproduct_masterlist(dialog_invoiceType, visit_date, CounterId, from);
|
||||||
});
|
});
|
||||||
@@ -2910,7 +2913,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFilter(int filterType, Spinner dialog_spin) {
|
/*public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
try {
|
try {
|
||||||
if (filterType == FILTER_FOR_BRAND) {
|
if (filterType == FILTER_FOR_BRAND) {
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
@@ -2975,8 +2978,54 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
|
try {
|
||||||
|
List<ProductMaster> filteredList = new ArrayList<>();
|
||||||
|
|
||||||
|
// Filter once based on type
|
||||||
|
switch (filterType) {
|
||||||
|
case FILTER_FOR_BRAND:
|
||||||
|
filteredList = filterListForBrand(dialog_product_list, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_SUB_BRAND:
|
||||||
|
filteredList = filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_REFERENCE_NAME:
|
||||||
|
filteredList = filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id, dialog_invoiceType);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
filteredList = dialog_product_list;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare display strings
|
||||||
|
List<String> displayList = new ArrayList<>();
|
||||||
|
displayList.add("- Select Product -"); // default item
|
||||||
|
|
||||||
|
boolean isSampleOrGWP = dialog_invoiceType.equalsIgnoreCase("Sample") || dialog_invoiceType.equalsIgnoreCase("GWP");
|
||||||
|
|
||||||
|
for (ProductMaster product : filteredList) {
|
||||||
|
if (isSampleOrGWP) {
|
||||||
|
displayList.add(product.getProductName() + " - Type-" + dialog_invoiceType);
|
||||||
|
} else {
|
||||||
|
displayList.add(product.getProductName() + " - (MRP-" + product.getMrp() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set adapter efficiently
|
||||||
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
|
dialog_sku_adapter.addAll(displayList);
|
||||||
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
|
|
||||||
|
dialog_spin.invalidate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final int CLEAR_FILTER = 0;
|
final int CLEAR_FILTER = 0;
|
||||||
final int FILTER_FOR_BRAND = 1;
|
final int FILTER_FOR_BRAND = 1;
|
||||||
final int FILTER_FOR_SUB_BRAND = 2;
|
final int FILTER_FOR_SUB_BRAND = 2;
|
||||||
@@ -3149,7 +3198,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
response_term_condition = "0";
|
response_term_condition = "0";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.blue));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.blue));
|
||||||
rl_term_condition.setEnabled(true);
|
rl_term_condition.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3180,7 +3229,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
List<ConsumerTermsConditionAccept> dataresponce = reportbaAvailabilityGetterSetter.getConsumerTermsConditionAccept();
|
List<ConsumerTermsConditionAccept> dataresponce = reportbaAvailabilityGetterSetter.getConsumerTermsConditionAccept();
|
||||||
if (dataresponce.get(0).getTermsConditionAccept()) {
|
if (dataresponce.get(0).getTermsConditionAccept()) {
|
||||||
response_term_condition = "1";
|
response_term_condition = "1";
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.gray));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.gray));
|
||||||
rl_term_condition.setEnabled(false);
|
rl_term_condition.setEnabled(false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -3214,7 +3263,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (!response_term_condition.isEmpty() && !response_term_condition.equals("0")) {
|
if (!response_term_condition.isEmpty() && !response_term_condition.equals("0")) {
|
||||||
rl_term_condition.setTextColor(getResources().getColor(R.color.gray));
|
rl_term_condition.setTextColor(ContextCompat.getColor(context,R.color.gray));
|
||||||
rl_term_condition.setEnabled(false);
|
rl_term_condition.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3363,10 +3412,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
|
|
||||||
if (flag_worth) {
|
if (flag_worth) {
|
||||||
header_txt.setText("Applicable Worth Promotions");
|
header_txt.setText("Applicable Worth Promotions");
|
||||||
rl_changes_color.setBackgroundColor(getResources().getColor(R.color.dashboard_less_ach));
|
rl_changes_color.setBackgroundColor(ContextCompat.getColor(context,R.color.dashboard_less_ach));
|
||||||
} else {
|
} else {
|
||||||
header_txt.setText("Applicable Product Promotions");
|
header_txt.setText("Applicable Product Promotions");
|
||||||
rl_changes_color.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
rl_changes_color.setBackgroundColor(ContextCompat.getColor(context,R.color.colorPrimary));
|
||||||
}
|
}
|
||||||
|
|
||||||
////show product selected
|
////show product selected
|
||||||
@@ -3374,7 +3423,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
recycl_promotion.setLayoutManager(new LinearLayoutManager(context));
|
recycl_promotion.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
|
||||||
cancet_btn.setOnClickListener(view -> {
|
cancet_btn.setOnClickListener(view -> {
|
||||||
purposeDialog.dismiss();
|
|
||||||
added_prmo_products.clear();
|
added_prmo_products.clear();
|
||||||
if (purposeDialog != null && purposeDialog.isShowing()) {
|
if (purposeDialog != null && purposeDialog.isShowing()) {
|
||||||
purposeDialog.dismiss();
|
purposeDialog.dismiss();
|
||||||
@@ -3383,11 +3431,9 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
|
|
||||||
btn_add.setOnClickListener(view -> {
|
btn_add.setOnClickListener(view -> {
|
||||||
try {
|
try {
|
||||||
purposeDialog.dismiss();
|
|
||||||
if (purposeDialog != null && purposeDialog.isShowing()) {
|
if (purposeDialog != null && purposeDialog.isShowing()) {
|
||||||
purposeDialog.dismiss();
|
purposeDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag_worth) {
|
if (flag_worth) {
|
||||||
if (!added_prmo_products.isEmpty()) {
|
if (!added_prmo_products.isEmpty()) {
|
||||||
selected_list.addAll(added_prmo_products);
|
selected_list.addAll(added_prmo_products);
|
||||||
@@ -3795,7 +3841,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
invoiceGetterSetter.setDiscounted_value_productwise(new DecimalFormat("##.##").format(calculate_per_productwise));
|
invoiceGetterSetter.setDiscounted_value_productwise(new DecimalFormat("##.##").format(calculate_per_productwise));
|
||||||
invoiceGetterSetter.setScan_ean_code_or_enterd_ean_code(qualified_products1.get(l).getScan_ean_code_or_enterd_ean_code());
|
invoiceGetterSetter.setScan_ean_code_or_enterd_ean_code(qualified_products1.get(l).getScan_ean_code_or_enterd_ean_code());
|
||||||
|
|
||||||
applyeid_products.add(invoiceGetterSetter);
|
applyeid_products.add(invoiceGetterSetter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3895,7 +3940,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else {
|
} else {
|
||||||
calculate_per_productwise = (total_valueper_productwise * getentityValue) / 100;
|
calculate_per_productwise = (total_valueper_productwise * getentityValue) / 100;
|
||||||
}
|
}
|
||||||
//test("promodata", String.valueOf(calculate_per_productwise));
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
@@ -4283,13 +4327,17 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
protected void remove_added_promo_index() {
|
protected void remove_added_promo_index() {
|
||||||
try {
|
try {
|
||||||
if (!selected_list.isEmpty()) {
|
if (!selected_list.isEmpty()) {
|
||||||
Iterator<InvoiceGetterSetter> it = selected_list.iterator();
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // API 24+
|
||||||
while (it.hasNext()) {
|
selected_list.removeIf(InvoiceGetterSetter::isPromo_flag);
|
||||||
InvoiceGetterSetter name = it.next();
|
} else {
|
||||||
if (name.isPromo_flag()) {
|
// Fallback for SDK 23 and below
|
||||||
it.remove();
|
Iterator<InvoiceGetterSetter> iterator = selected_list.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
InvoiceGetterSetter item = iterator.next();
|
||||||
|
if (item.isPromo_flag()) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Do something
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -4299,14 +4347,15 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
|
|
||||||
protected void remove_added_promo_fromtemp(String promoId) {
|
protected void remove_added_promo_fromtemp(String promoId) {
|
||||||
try {
|
try {
|
||||||
if (!added_prmo_products.isEmpty()) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
Iterator<InvoiceGetterSetter> it = added_prmo_products.iterator();
|
added_prmo_products.removeIf(item -> promoId.equals(item.getPromotion_Id()));
|
||||||
while (it.hasNext()) {
|
} else {
|
||||||
InvoiceGetterSetter name = it.next();
|
Iterator<InvoiceGetterSetter> iterator = added_prmo_products.iterator();
|
||||||
if (promoId.equals(name.getPromotion_Id())) {
|
while (iterator.hasNext()) {
|
||||||
it.remove();
|
InvoiceGetterSetter item = iterator.next();
|
||||||
|
if (promoId.equals(item.getPromotion_Id())) {
|
||||||
|
iterator.remove();
|
||||||
}
|
}
|
||||||
// Do something
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -4362,7 +4411,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
|
|
||||||
close_white.setOnClickListener(view -> {
|
close_white.setOnClickListener(view -> {
|
||||||
purposeDialog.dismiss();
|
|
||||||
if (purposeDialog != null && purposeDialog.isShowing()) {
|
if (purposeDialog != null && purposeDialog.isShowing()) {
|
||||||
purposeDialog.dismiss();
|
purposeDialog.dismiss();
|
||||||
}
|
}
|
||||||
@@ -4514,8 +4562,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
////for product promotion
|
////for product promotion
|
||||||
db.open();
|
db.open();
|
||||||
ArrayList<MasterPromotion> promoMaster = db.getPromotionMaster(true);
|
ArrayList<MasterPromotion> promoMaster = db.getPromotionMaster(true);
|
||||||
// //test("promosize", String.valueOf(promoMaster.size()));
|
|
||||||
|
|
||||||
if (!promoMaster.isEmpty()) {
|
if (!promoMaster.isEmpty()) {
|
||||||
final ArrayList<MasterPromotion> validPromoList = new ArrayList<>();
|
final ArrayList<MasterPromotion> validPromoList = new ArrayList<>();
|
||||||
for (int x = 0; x < promoMaster.size(); x++) {
|
for (int x = 0; x < promoMaster.size(); x++) {
|
||||||
@@ -4528,13 +4574,11 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
boolean flag_for_and = true;
|
boolean flag_for_and = true;
|
||||||
for (int q = 0; q < promoAndList.size(); q++) {
|
for (int q = 0; q < promoAndList.size(); q++) {
|
||||||
db.open();
|
db.open();
|
||||||
int product_countfor_and = db.getPromotiongetProductforAndPromo(promoAndList.get(q).getId(),
|
int product_countfor_and = db.getPromotiongetProductforAndPromo(promoAndList.get(q).getId(), promoAndList.get(q).getPromoId().toString(), true, username, visit_date, CounterId);
|
||||||
promoAndList.get(q).getPromoId().toString(), true, username, visit_date, CounterId);
|
|
||||||
////checking AND promo itemcount
|
////checking AND promo itemcount
|
||||||
if (product_countfor_and >= promoAndList.get(q).getItemCount()) {
|
if (product_countfor_and >= promoAndList.get(q).getItemCount()) {
|
||||||
db.open();
|
db.open();
|
||||||
db.update_temp_promo_apply_definitionfor_andpromo(promoAndList.get(q).getId(), CounterId, username,
|
db.update_temp_promo_apply_definitionfor_andpromo(promoAndList.get(q).getId(), CounterId, username, promoAndList.get(q).getPromoId(), visit_date);
|
||||||
promoAndList.get(q).getPromoId(), visit_date);
|
|
||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
flag_for_and = false;
|
flag_for_and = false;
|
||||||
@@ -4542,7 +4586,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag_for_and) {
|
if (flag_for_and) {
|
||||||
//////--------insert all AND Promo data to Apply Definition.Table...-----------
|
//////--------insert all AND Promo data to Apply Definition.Table...-----------
|
||||||
db.open();
|
db.open();
|
||||||
@@ -4553,17 +4596,22 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
int product_count = db.getPromotiongetProductall(promoMaster.get(x), true, username, visit_date, CounterId);
|
int product_count = db.getPromotiongetProductall(promoMaster.get(x), true, username, visit_date, CounterId);
|
||||||
//test("product_count", String.valueOf(product_count));
|
String promoSetEntityValues = promoMaster.get(x).getPromotionSetEntityValue();
|
||||||
if (product_count > 0) {
|
if (product_count > 0) {
|
||||||
if (product_count >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
|
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
|
||||||
db.open();
|
db.open();
|
||||||
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
validPromoList.add(promoMaster.get(x));
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
} else {
|
||||||
|
if (!promoSetEntityValues.contains("|") && product_count >= Integer.parseInt(promoSetEntityValues)) {
|
||||||
|
db.open();
|
||||||
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validPromoList.isEmpty()) {
|
if (!validPromoList.isEmpty()) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (dialog != null && dialog.isShowing()) {
|
if (dialog != null && dialog.isShowing()) {
|
||||||
@@ -4571,7 +4619,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
}
|
}
|
||||||
show_promotion_skuwise_dialog(context, selected_list, validPromoList, false);
|
show_promotion_skuwise_dialog(context, selected_list, validPromoList, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
///finish
|
///finish
|
||||||
checkPromoWorth(promoMaster);
|
checkPromoWorth(promoMaster);
|
||||||
@@ -4606,7 +4653,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag_for_and) {
|
if (flag_for_and) {
|
||||||
//////--------insert all AND Promo data to Apply Definition.Table...-----------
|
//////--------insert all AND Promo data to Apply Definition.Table...-----------
|
||||||
db.open();
|
db.open();
|
||||||
@@ -4617,12 +4663,19 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
||||||
//test("product_count", String.valueOf(product_count));
|
//Log.e("product_count", String.valueOf(product_count));
|
||||||
|
String promoSetEntityValues = promoMaster.get(x).getPromotionSetEntityValue();
|
||||||
if (product_count > 0) {
|
if (product_count > 0) {
|
||||||
if (product_count >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
|
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
|
||||||
db.open();
|
db.open();
|
||||||
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
validPromoList.add(promoMaster.get(x));
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
} else {
|
||||||
|
if (!promoSetEntityValues.contains("|") && product_count >= Integer.parseInt(promoSetEntityValues)) {
|
||||||
|
db.open();
|
||||||
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4717,11 +4770,18 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
||||||
|
String promoSetEntityValues = promoMaster.get(x).getPromotionSetEntityValue();
|
||||||
if (product_count > 0) {
|
if (product_count > 0) {
|
||||||
if (product_count >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
|
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
|
||||||
db.open();
|
db.open();
|
||||||
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
validPromoList.add(promoMaster.get(x));
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
} else {
|
||||||
|
if (!promoSetEntityValues.contains("|") && product_count >= Integer.parseInt(promoSetEntityValues)) {
|
||||||
|
db.open();
|
||||||
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4813,12 +4873,18 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
int product_count = db.getPromotiongetProductall(promoMaster.get(x), false, username, visit_date, CounterId);
|
||||||
//test("Productcount", String.valueOf(product_count));
|
String promoSetEntityValues = promoMaster.get(x).getPromotionSetEntityValue();
|
||||||
if (product_count > 0) {
|
if (product_count > 0) {
|
||||||
if (product_count >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
|
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
|
||||||
db.open();
|
db.open();
|
||||||
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
validPromoList.add(promoMaster.get(x));
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
} else {
|
||||||
|
if (!promoSetEntityValues.contains("|") && product_count >= Integer.parseInt(promoSetEntityValues)) {
|
||||||
|
db.open();
|
||||||
|
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
|
||||||
|
validPromoList.add(promoMaster.get(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4907,5 +4973,27 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
|
|||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCostInRange(String range, int totalCost, MasterPromotion promo) {
|
||||||
|
if (range == null || range.trim().isEmpty()) {
|
||||||
|
return false; // No range provided
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] parts = range.split("\\|");
|
||||||
|
if (parts.length != 2) {
|
||||||
|
return false; // Invalid format
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int min = Integer.parseInt(parts[0].trim());
|
||||||
|
int max = Integer.parseInt(parts[1].trim());
|
||||||
|
boolean flg = totalCost >= min && totalCost <= max;
|
||||||
|
Log.e("Testing------1", min + " -- " + max + "\n" + flg);
|
||||||
|
return flg;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
e.fillInStackTrace();
|
||||||
|
return false; // Invalid number format
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
for (File value : file) arrayFiles.add(value.getName());
|
for (File value : file) arrayFiles.add(value.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return arrayFiles;
|
return arrayFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +238,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void getQuizProfileData() {
|
void getQuizProfileData() {
|
||||||
hashMapAnsListChildData = new HashMap<>();
|
hashMapAnsListChildData = new HashMap<>();
|
||||||
childListData = new ArrayList<>();
|
childListData = new ArrayList<>();
|
||||||
@@ -359,7 +357,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
expandableListView.clearFocus();
|
expandableListView.clearFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1047,7 +1044,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
|
|||||||
round_img_pic.setImageBitmap(bitmp);
|
round_img_pic.setImageBitmap(bitmp);
|
||||||
}
|
}
|
||||||
} else if (!baProfileListData.isEmpty() && baProfileListData.get(0).getProfilePic() != null && !baProfileListData.get(0).getProfilePic().isEmpty()) {
|
} else if (!baProfileListData.isEmpty() && baProfileListData.get(0).getProfilePic() != null && !baProfileListData.get(0).getProfilePic().isEmpty()) {
|
||||||
Picasso.with(context).load(baProfileListData.get(0).getProfilePic()).networkPolicy(NetworkPolicy.NO_CACHE).into(round_img_pic);
|
Picasso.with(context).load(baProfileListData.get(0).getProfilePic()).networkPolicy(NetworkPolicy.NO_CACHE).placeholder(R.mipmap.profile_image).into(round_img_pic);
|
||||||
} else {
|
} else {
|
||||||
bitmp = BitmapFactory.decodeResource(getResources(), R.mipmap.profile_image);
|
bitmp = BitmapFactory.decodeResource(getResources(), R.mipmap.profile_image);
|
||||||
round_img_pic.setImageBitmap(bitmp);
|
round_img_pic.setImageBitmap(bitmp);
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.cpm.lorealbaautomation.dailyactivity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import com.cpm.lorealbaautomation.Database.Lorealba_Database;
|
||||||
|
import com.cpm.lorealbaautomation.R;
|
||||||
|
import com.cpm.lorealbaautomation.constant.CommonFunctions;
|
||||||
|
import com.cpm.lorealbaautomation.constant.CommonString;
|
||||||
|
import com.cpm.lorealbaautomation.delegates.PrefHelper;
|
||||||
|
import com.cpm.lorealbaautomation.gsonGetterSetter.JourneyPlan;
|
||||||
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.journeyapps.barcodescanner.BarcodeEncoder;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
public class BaAssessmentActivity extends AppCompatActivity {
|
||||||
|
private ImageView qrImage;
|
||||||
|
private Lorealba_Database db;
|
||||||
|
JourneyPlan jcp_Object = new JourneyPlan();
|
||||||
|
|
||||||
|
@SuppressLint("MissingInflatedId")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_ba_assessment);
|
||||||
|
SharedPreferences preferences = PrefHelper.getPrefs(this);
|
||||||
|
String date = preferences.getString(CommonString.KEY_DATE, "");
|
||||||
|
String username = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||||
|
String counter_id = preferences.getString(CommonString.KEY_COUNTER_ID, "");
|
||||||
|
String couter_code = preferences.getString(CommonString.KEY_COUNTER_CODE, "");
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
qrImage = findViewById(R.id.qrImage);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
if (!CommonFunctions.isTablet(this)) {
|
||||||
|
toolbar.setTitleTextAppearance(this, R.style.changestext_sizefor_mobile);
|
||||||
|
}
|
||||||
|
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
db = new Lorealba_Database(this);
|
||||||
|
db.open();
|
||||||
|
jcp_Object = db.getBIDfromJCP(username, counter_id);
|
||||||
|
setTitle("BA Assessment - " + date);
|
||||||
|
String link = CommonString.BA_ASSESSMENT_URL + "c=" + couter_code + "&u=" + username;
|
||||||
|
Log.e("link", link);
|
||||||
|
generateQRCode(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
db.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
this.finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateQRCode(String text) {
|
||||||
|
try {
|
||||||
|
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||||
|
Bitmap bitmap = barcodeEncoder.encodeBitmap(
|
||||||
|
text,
|
||||||
|
BarcodeFormat.QR_CODE,
|
||||||
|
400,
|
||||||
|
400
|
||||||
|
);
|
||||||
|
qrImage.setImageBitmap(bitmap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.fillInStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
-11
@@ -784,17 +784,42 @@ public class ConsumerReturnActivity extends AppCompatActivity implements View.On
|
|||||||
|
|
||||||
|
|
||||||
public void setFilter(int filterType, Spinner dialog_spin) {
|
public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
|
List<ProductMaster> filteredList = new ArrayList<>();
|
||||||
|
switch (filterType) {
|
||||||
|
case FILTER_FOR_BRAND:
|
||||||
|
filteredList = filterListForBrand(dialog_product_list, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_SUB_BRAND:
|
||||||
|
filteredList = filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id);
|
||||||
|
break;
|
||||||
|
case FILTER_FOR_REFERENCE_NAME:
|
||||||
|
filteredList = filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
filteredList = dialog_product_list;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Prepare display strings
|
||||||
|
List<String> displayList = new ArrayList<>();
|
||||||
|
displayList.add("- Select Product -"); // default item
|
||||||
|
for (ProductMaster product : filteredList) {
|
||||||
|
displayList.add(product.getProductName() + " - (MRP-" + product.getMrp() + ")");
|
||||||
|
}
|
||||||
|
// Set adapter
|
||||||
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
|
dialog_sku_adapter.addAll(displayList);
|
||||||
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
|
}
|
||||||
|
/*public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
if (filterType == FILTER_FOR_BRAND) {
|
if (filterType == FILTER_FOR_BRAND) {
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
dialog_sku_adapter.add("- Select Product -");
|
||||||
|
|
||||||
for (int i = 0; i < filterListForBrand(dialog_product_list, dialog_brand_Id).size(); i++) {
|
for (int i = 0; i < filterListForBrand(dialog_product_list, dialog_brand_Id).size(); i++) {
|
||||||
dialog_sku_adapter.add(filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getProductName() + " - (MRP-" + filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getMrp().toString() + ")");
|
dialog_sku_adapter.add(filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getProductName() + " - (MRP-" + filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getMrp().toString() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
|
||||||
} else if (filterType == FILTER_FOR_SUB_BRAND) {
|
} else if (filterType == FILTER_FOR_SUB_BRAND) {
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
dialog_sku_adapter.add("- Select Product -");
|
||||||
@@ -805,31 +830,24 @@ public class ConsumerReturnActivity extends AppCompatActivity implements View.On
|
|||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
} else if (filterType == FILTER_FOR_REFERENCE_NAME) {
|
} else if (filterType == FILTER_FOR_REFERENCE_NAME) {
|
||||||
|
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
dialog_sku_adapter.add("- Select Product -");
|
||||||
|
|
||||||
for (int i = 0; i < filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).size(); i++) {
|
for (int i = 0; i < filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).size(); i++) {
|
||||||
dialog_sku_adapter.add(filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getProductName() + " - (MRP-" + filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getMrp().toString() + ")");
|
dialog_sku_adapter.add(filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getProductName() + " - (MRP-" + filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getMrp().toString() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
dialog_sku_adapter.add("- Select Product -");
|
||||||
|
|
||||||
for (int i = 0; i < dialog_product_list.size(); i++) {
|
for (int i = 0; i < dialog_product_list.size(); i++) {
|
||||||
dialog_sku_adapter.add(dialog_product_list.get(i).getProductName() + " - (MRP-" + dialog_product_list.get(i).getMrp().toString() + ")");
|
dialog_sku_adapter.add(dialog_product_list.get(i).getProductName() + " - (MRP-" + dialog_product_list.get(i).getMrp().toString() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.invalidate();
|
dialog_spin.invalidate();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
final int CLEAR_FILTER = 0;
|
final int CLEAR_FILTER = 0;
|
||||||
final int FILTER_FOR_BRAND = 1;
|
final int FILTER_FOR_BRAND = 1;
|
||||||
|
|||||||
+6
-2
@@ -91,6 +91,10 @@ public class CounterImageActivity extends AppCompatActivity implements
|
|||||||
db = new Lorealba_Database(context);
|
db = new Lorealba_Database(context);
|
||||||
db.open();
|
db.open();
|
||||||
validateuidata();
|
validateuidata();
|
||||||
|
if (!db.isBaProfileFilled(counter_id, username, user_type) && db.getSaveServerData(null, username).isEmpty()) {
|
||||||
|
// Only show if BOTH are false
|
||||||
|
showAlertProfile(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getLastLocation() {
|
private void getLastLocation() {
|
||||||
@@ -456,11 +460,11 @@ public class CounterImageActivity extends AppCompatActivity implements
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
db.open();
|
db.open();
|
||||||
checkgpsEnableDevice();
|
checkgpsEnableDevice();
|
||||||
if (!db.isBaProfileFilled(counter_id, username, user_type)) {
|
/*if (!db.isBaProfileFilled(counter_id, username, user_type)) {
|
||||||
showAlertProfile(context);
|
showAlertProfile(context);
|
||||||
} else if (db.getSaveServerData(null, username).isEmpty()) {
|
} else if (db.getSaveServerData(null, username).isEmpty()) {
|
||||||
showAlertProfile(context);
|
showAlertProfile(context);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkgpsEnableDevice() {
|
private void checkgpsEnableDevice() {
|
||||||
|
|||||||
+29
-44
@@ -763,12 +763,14 @@ public class ManualInWardStockActivity extends AppCompatActivity implements View
|
|||||||
flag_filter_by_edt = false;
|
flag_filter_by_edt = false;
|
||||||
try {
|
try {
|
||||||
dialog_brand_Id = adapterView.getSelectedItem().toString();
|
dialog_brand_Id = adapterView.getSelectedItem().toString();
|
||||||
|
Log.d("spinner_error", dialog_brand_Id);
|
||||||
setFilter(FILTER_FOR_BRAND, dialog_product_spin);
|
setFilter(FILTER_FOR_BRAND, dialog_product_spin);
|
||||||
setSubBrandSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "SubBrandName", "SubBrandId",
|
setSubBrandSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "SubBrandName", "SubBrandId",
|
||||||
"BrandName", null, visit_date, counter_id, false, null), dialog_sub_brand_spin);
|
"BrandName", null, visit_date, counter_id, false, null), dialog_sub_brand_spin);
|
||||||
setReferenceSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "ReferenceName", "ReferenceId",
|
setReferenceSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "ReferenceName", "ReferenceId",
|
||||||
"BrandName", null, visit_date, counter_id, false, null), dialog_franchise_spin);
|
"BrandName", null, visit_date, counter_id, false, null), dialog_franchise_spin);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.d("spinner_ex", e.getMessage());
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -936,53 +938,36 @@ public class ManualInWardStockActivity extends AppCompatActivity implements View
|
|||||||
|
|
||||||
|
|
||||||
public void setFilter(int filterType, Spinner dialog_spin) {
|
public void setFilter(int filterType, Spinner dialog_spin) {
|
||||||
if (filterType == FILTER_FOR_BRAND) {
|
List<ProductMaster> filteredList = new ArrayList<>();
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
|
||||||
|
|
||||||
for (int i = 0; i < filterListForBrand(dialog_product_list, dialog_brand_Id).size(); i++) {
|
// Filter only once based on type
|
||||||
dialog_sku_adapter.add(filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getProductName() + " - (MRP-" + filterListForBrand(dialog_product_list, dialog_brand_Id).get(i).getMrp().toString() + ")");
|
switch (filterType) {
|
||||||
}
|
case FILTER_FOR_BRAND:
|
||||||
|
filteredList = filterListForBrand(dialog_product_list, dialog_brand_Id);
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
break;
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
case FILTER_FOR_SUB_BRAND:
|
||||||
|
filteredList = filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id);
|
||||||
} else if (filterType == FILTER_FOR_SUB_BRAND) {
|
break;
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
case FILTER_FOR_REFERENCE_NAME:
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
filteredList = filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id);
|
||||||
|
break;
|
||||||
for (int i = 0; i < filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).size(); i++) {
|
default:
|
||||||
dialog_sku_adapter.add(filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).get(i).getProductName() + " - (MRP-" +
|
filteredList = dialog_product_list;
|
||||||
filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).get(i).getMrp().toString() + ")");
|
break;
|
||||||
}
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
|
||||||
} else if (filterType == FILTER_FOR_REFERENCE_NAME) {
|
|
||||||
|
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
|
||||||
|
|
||||||
for (int i = 0; i < filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).size(); i++) {
|
|
||||||
dialog_sku_adapter.add(filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getProductName() +
|
|
||||||
" - (MRP-" + filterListForReferencename(dialog_product_list, dialog_reference_Id, dialog_brand_Id, dialog_sub_brand_Id).get(i).getMrp().toString() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
|
||||||
dialog_sku_adapter.add("- Select Product -");
|
|
||||||
|
|
||||||
for (int i = 0; i < dialog_product_list.size(); i++) {
|
|
||||||
dialog_sku_adapter.add(dialog_product_list.get(i).getProductName() + " - (MRP-" + dialog_product_list.get(i).getMrp().toString() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog_spin.setAdapter(dialog_sku_adapter);
|
|
||||||
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_spin.invalidate();
|
// Prepare display strings
|
||||||
|
List<String> displayList = new ArrayList<>();
|
||||||
|
displayList.add("- Select Product -"); // default item
|
||||||
|
for (ProductMaster product : filteredList) {
|
||||||
|
displayList.add(product.getProductName() + " - (MRP-" + product.getMrp() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set adapter
|
||||||
|
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
|
||||||
|
dialog_sku_adapter.addAll(displayList);
|
||||||
|
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
|
||||||
|
dialog_spin.setAdapter(dialog_sku_adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+48
-67
@@ -8,6 +8,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -145,7 +146,6 @@ public class SkinGeniusScreenshotActivity extends AppCompatActivity implements V
|
|||||||
@SuppressLint("NonConstantResourceId")
|
@SuppressLint("NonConstantResourceId")
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
if (v.getId() == R.id.img_cam_selfie) {
|
if (v.getId() == R.id.img_cam_selfie) {
|
||||||
browseDocuments();
|
browseDocuments();
|
||||||
} else if (v.getId() == R.id.save_skin_genius) {
|
} else if (v.getId() == R.id.save_skin_genius) {
|
||||||
@@ -183,81 +183,62 @@ public class SkinGeniusScreenshotActivity extends AppCompatActivity implements V
|
|||||||
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void browseDocuments() {
|
private void browseDocuments() {
|
||||||
String[] mimeTypes =
|
|
||||||
{"application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
||||||
"image/jpeg",
|
|
||||||
"image/jpg", "image/png"};
|
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
intent.setType("*/*");
|
intent.setType("image/*");
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
startActivityForResult(Intent.createChooser(intent, "Choose Skin Genius Screenshot"), FILE_PICKER_CODE);
|
startActivityForResult(
|
||||||
|
Intent.createChooser(intent, "Choose Skin Genius Screenshot"),
|
||||||
|
FILE_PICKER_CODE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
// TODO Auto-generated method stub
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
if (requestCode == FILE_PICKER_CODE) {
|
|
||||||
Uri uri = data.getData();
|
|
||||||
assert uri != null;
|
|
||||||
String uriString = uri.toString();
|
|
||||||
String displayName = null;
|
|
||||||
|
|
||||||
if (uriString.startsWith("content://")) {
|
if (requestCode == FILE_PICKER_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
try (Cursor cursor = getContentResolver().query(uri, null, null, null, null)) {
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
Uri uri = data.getData();
|
||||||
displayName = CounterId + username.replace(".", "") + "-SkinGenius-" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
if (uri == null) return;
|
||||||
}
|
|
||||||
}
|
String displayName =
|
||||||
} else if (uriString.startsWith("file://")) {
|
CounterId +
|
||||||
displayName = CounterId + username.replace(".", "") + "-SkinGenius-" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
username.replace(".", "") +
|
||||||
|
"-SkinGenius-" +
|
||||||
|
visit_date.replace("/", "") + "_" +
|
||||||
|
getCurrentTime().replace(":", "") +
|
||||||
|
".jpg";
|
||||||
|
|
||||||
|
File targetFile = new File(CommonString.getImagesFolder(this), displayName);
|
||||||
|
|
||||||
|
try (
|
||||||
|
InputStream inputStream = getContentResolver().openInputStream(uri);
|
||||||
|
OutputStream outputStream = new FileOutputStream(targetFile)
|
||||||
|
) {
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
File sourceLocation = null;
|
img_str = displayName;
|
||||||
sourceLocation = FileUtils.getFile(context, uri);
|
|
||||||
File targetLocation = new File(CommonString.getImagesFolder(context) + displayName);
|
if (targetFile.exists()) {
|
||||||
if (sourceLocation != null) {
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
InputStream in = null;
|
options.inSampleSize = 2; // prevent OOM
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
Bitmap bitmap = BitmapFactory.decodeFile(
|
||||||
in = Files.newInputStream(sourceLocation.toPath());
|
targetFile.getAbsolutePath(), options
|
||||||
} else {
|
);
|
||||||
in = new FileInputStream(sourceLocation);
|
img_cam.setImageBitmap(bitmap);
|
||||||
}
|
img_clicked.setVisibility(View.GONE);
|
||||||
OutputStream out = null;
|
img_cam.setVisibility(View.VISIBLE);
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
||||||
out = Files.newOutputStream(targetLocation.toPath());
|
|
||||||
} else out = new FileOutputStream(targetLocation);
|
|
||||||
// Copy the bits from instream to outstream
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int len;
|
|
||||||
while ((len = in.read(buf)) > 0) {
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
out.close();
|
|
||||||
img_str = displayName;
|
|
||||||
if (new File(CommonString.getImagesFolder(context) + img_str).exists()) {
|
|
||||||
try {
|
|
||||||
Bitmap bmp = convertBitmap(CommonString.getImagesFolder(context) + img_str);
|
|
||||||
img_cam.setImageBitmap(bmp);
|
|
||||||
} catch (OutOfMemoryError ex) {
|
|
||||||
CommonFunctions.setScaledImage(img_cam, CommonString.getImagesFolder(context) + img_str);
|
|
||||||
}
|
|
||||||
img_clicked.setVisibility(View.GONE);
|
|
||||||
img_cam.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
AlertandMessages.showToastMsg(context, "Unable to retrieve the path. Please try again");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.fillInStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.fillInStackTrace();
|
||||||
|
AlertandMessages.showToastMsg(this, "Image load failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+242
-69
@@ -2,7 +2,6 @@ package com.cpm.lorealbaautomation.dailyactivity;
|
|||||||
|
|
||||||
import static com.cpm.lorealbaautomation.constant.CommonFunctions.checkNetIsAvailable;
|
import static com.cpm.lorealbaautomation.constant.CommonFunctions.checkNetIsAvailable;
|
||||||
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCurrentTime;
|
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCurrentTime;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -11,13 +10,10 @@ import android.app.ProgressDialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationManager;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
@@ -27,7 +23,6 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -35,20 +30,16 @@ import android.view.View;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.gms.common.api.ResolvableApiException;
|
import com.cpm.lorealbaautomation.Database.Lorealba_Database;
|
||||||
|
import com.cpm.lorealbaautomation.LocationEngine;
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
import com.google.android.gms.location.LocationCallback;
|
import com.google.android.gms.location.LocationCallback;
|
||||||
import com.google.android.gms.location.LocationRequest;
|
|
||||||
import com.google.android.gms.location.LocationResult;
|
|
||||||
import com.google.android.gms.location.LocationServices;
|
import com.google.android.gms.location.LocationServices;
|
||||||
import com.google.android.gms.location.LocationSettingsRequest;
|
|
||||||
import com.google.android.gms.location.Priority;
|
|
||||||
import com.google.android.gms.location.SettingsClient;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.cpm.lorealbaautomation.BuildConfig;
|
import com.cpm.lorealbaautomation.BuildConfig;
|
||||||
import com.cpm.lorealbaautomation.Database.Lorealba_Database;
|
|
||||||
import com.cpm.lorealbaautomation.DealarBoardActivity;
|
import com.cpm.lorealbaautomation.DealarBoardActivity;
|
||||||
import com.cpm.lorealbaautomation.R;
|
import com.cpm.lorealbaautomation.R;
|
||||||
import com.cpm.lorealbaautomation.constant.AlertandMessages;
|
import com.cpm.lorealbaautomation.constant.AlertandMessages;
|
||||||
@@ -95,13 +86,17 @@ import retrofit2.Response;
|
|||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
public class StoreImageActivity extends AppCompatActivity implements View.OnClickListener {
|
public class StoreImageActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
private static final int PERMISSION_ALL = 99;
|
private static final int PERMISSION_ALL = 99;
|
||||||
private Button btn_save;
|
private Button btn_save;
|
||||||
private ImageView img_cam, img_clicked;
|
private ImageView img_cam, img_clicked;
|
||||||
private String _pathforcheck, _path, str, img_str, selfie_imge, visit_date, username, counter_id, userType;
|
private String _pathforcheck, _path, str, img_str, selfie_imge, visit_date, username, counter_id, userType;
|
||||||
private Lorealba_Database db;
|
private Lorealba_Database db;
|
||||||
|
private LocationEngine locationEngine;
|
||||||
private Runnable run;
|
private Runnable run;
|
||||||
|
private boolean isGeoTagAlertShown = false;
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
private ProgressDialog loading;
|
private ProgressDialog loading;
|
||||||
private Retrofit adapter;
|
private Retrofit adapter;
|
||||||
@@ -113,11 +108,14 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
private FusedLocationProviderClient fusedLocationClient = null;
|
private FusedLocationProviderClient fusedLocationClient = null;
|
||||||
private LocationCallback locationCallback = null;
|
private LocationCallback locationCallback = null;
|
||||||
private SharedPreferences.Editor editor = null;
|
private SharedPreferences.Editor editor = null;
|
||||||
|
private boolean isLocationFetching = false;
|
||||||
|
private ProgressBar locationLoader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_store_image);
|
setContentView(R.layout.activity_store_image);
|
||||||
|
locationEngine = new LocationEngine(this);
|
||||||
db = new Lorealba_Database(this);
|
db = new Lorealba_Database(this);
|
||||||
db.open();
|
db.open();
|
||||||
SharedPreferences preferences = PrefHelper.getPrefs(this);
|
SharedPreferences preferences = PrefHelper.getPrefs(this);
|
||||||
@@ -126,6 +124,13 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||||
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
||||||
img_clicked = (ImageView) findViewById(R.id.img_cam_selfie);
|
img_clicked = (ImageView) findViewById(R.id.img_cam_selfie);
|
||||||
|
locationLoader = findViewById(R.id.locationLoader);
|
||||||
|
locationLoader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
getWindow().setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
|
||||||
|
);
|
||||||
btn_save = (Button) findViewById(R.id.btn_save_selfie);
|
btn_save = (Button) findViewById(R.id.btn_save_selfie);
|
||||||
toolbar = findViewById(R.id.toolbar);
|
toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@@ -165,9 +170,8 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndRequestPermissions();
|
checkAndRequestPermissions();
|
||||||
getLastLocation();
|
fetchLocationAndCheckGeoFence();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkdates() {
|
private void checkdates() {
|
||||||
@@ -205,7 +209,6 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.img_cam_selfie) {
|
if (id == R.id.img_cam_selfie) {
|
||||||
clickFlag = true;
|
clickFlag = true;
|
||||||
_pathforcheck = counter_id + "_Counter_Selfie_img_" + username + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
_pathforcheck = counter_id + "_Counter_Selfie_img_" + username + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
@@ -330,11 +333,9 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
StoreImageActivity.this.finish();
|
StoreImageActivity.this.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AttempBaCoverage(final ProgressDialog loading, Context context) {
|
private void AttempBaCoverage(final ProgressDialog loading, Context context) {
|
||||||
try {
|
try {
|
||||||
getMid();
|
getMid();
|
||||||
@@ -545,8 +546,7 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/// checking GeoFencing
|
/// checking GeoFencing
|
||||||
getLastLocation();
|
fetchLocationAndCheckGeoFence();
|
||||||
checkingGeoFencing(getMid());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,14 +557,13 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
success_geoTag = true;
|
success_geoTag = true;
|
||||||
}
|
}
|
||||||
if (!success_geoTag) {
|
if (!success_geoTag) {
|
||||||
getLastLocation();
|
fetchLocationAndCheckGeoFence();
|
||||||
checkingGeoFencing(getMid());
|
|
||||||
}
|
}
|
||||||
checkgpsEnableDevice();
|
// checkgpsEnableDevice();
|
||||||
getMid();
|
getMid();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkgpsEnableDevice() {
|
/*private void checkgpsEnableDevice() {
|
||||||
if (!hasGPSDevice(this)) {
|
if (!hasGPSDevice(this)) {
|
||||||
Toast.makeText(this, "Gps not Supported", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Gps not Supported", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -579,35 +578,71 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enableLocationSettings() {
|
private void enableLocationSettings() {
|
||||||
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, // priority
|
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
|
||||||
5000 // intervalMillis: 5 seconds
|
.setMinUpdateIntervalMillis(3000)
|
||||||
).setMinUpdateIntervalMillis(3000) // fastest interval
|
.setMaxUpdateDelayMillis(6000)
|
||||||
|
.setMinUpdateDistanceMeters(0f)// Optional batching
|
||||||
|
.setWaitForAccurateLocation(true) // Optional, improves first fix
|
||||||
.build();
|
.build();
|
||||||
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest).setAlwaysShow(true); // show dialog if GPS is off
|
|
||||||
|
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
|
||||||
|
.addLocationRequest(locationRequest)
|
||||||
|
.setAlwaysShow(true); // Show dialog if GPS is off
|
||||||
|
|
||||||
SettingsClient settingsClient = LocationServices.getSettingsClient(this);
|
SettingsClient settingsClient = LocationServices.getSettingsClient(this);
|
||||||
settingsClient.checkLocationSettings(builder.build()).addOnSuccessListener(locationSettingsResponse -> {
|
settingsClient.checkLocationSettings(builder.build())
|
||||||
// All location settings are satisfied. You can request location updates here.
|
.addOnSuccessListener(locationSettingsResponse -> {
|
||||||
}).addOnFailureListener(e -> {
|
// All location settings are satisfied, start updates
|
||||||
if (e instanceof ResolvableApiException) {
|
startLocationUpdates(locationRequest);
|
||||||
try {
|
})
|
||||||
ResolvableApiException resolvable = (ResolvableApiException) e;
|
.addOnFailureListener(e -> {
|
||||||
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
|
if (e instanceof ResolvableApiException) {
|
||||||
} catch (IntentSender.SendIntentException sendEx) {
|
try {
|
||||||
// Ignore the error.
|
ResolvableApiException resolvable = (ResolvableApiException) e;
|
||||||
sendEx.fillInStackTrace();
|
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
|
||||||
|
} catch (IntentSender.SendIntentException sendEx) {
|
||||||
|
sendEx.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startLocationUpdates(LocationRequest locationRequest) {
|
||||||
|
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
|
|
||||||
|
locationCallback = new LocationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||||
|
if (locationResult == null) return;
|
||||||
|
|
||||||
|
for (Location location : locationResult.getLocations()) {
|
||||||
|
if (location != null) {
|
||||||
|
if(location.getAccuracy()<80){
|
||||||
|
lat = location.getLatitude();
|
||||||
|
lon = location.getLongitude();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Don't forget permissions check
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// Request permissions if not granted
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean hasGPSDevice(Context context) {
|
private boolean hasGPSDevice(Context context) {
|
||||||
final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||||
if (mgr == null) return false;
|
if (mgr == null) return false;
|
||||||
final List<String> providers = mgr.getAllProviders();
|
final List<String> providers = mgr.getAllProviders();
|
||||||
if (providers == null) return false;
|
if (providers == null) return false;
|
||||||
return providers.contains(LocationManager.GPS_PROVIDER);
|
return providers.contains(LocationManager.GPS_PROVIDER);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void DownloadJCP(final Context context, final ProgressDialog loading) {
|
private void DownloadJCP(final Context context, final ProgressDialog loading) {
|
||||||
try {
|
try {
|
||||||
@@ -641,9 +676,9 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (jcpObject != null && db.insertJCPData(jcpObject)) {
|
if (jcpObject != null && db.insertJCPData(jcpObject)) {
|
||||||
|
Log.d("jcpdatanew","jcp data inserted");
|
||||||
/// checking GeoFencing
|
/// checking GeoFencing
|
||||||
getLastLocation();
|
fetchLocationAndCheckGeoFence();
|
||||||
checkingGeoFencing(getMid());
|
|
||||||
AlertandMessages.showToastMsg(context, "Journey Plan Download Successfully.");
|
AlertandMessages.showToastMsg(context, "Journey Plan Download Successfully.");
|
||||||
JourneyPlan jcp = db.getBIDfromJCP(username, counter_id);
|
JourneyPlan jcp = db.getBIDfromJCP(username, counter_id);
|
||||||
if (jcp != null && jcp.getCheckout() != null && !jcp.getCheckout().isEmpty() && jcp.getCheckout().equals("Y")) {
|
if (jcp != null && jcp.getCheckout() != null && !jcp.getCheckout().isEmpty() && jcp.getCheckout().equals("Y")) {
|
||||||
@@ -799,7 +834,7 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
boolean allPermissionsGranted = Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.CAMERA)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_NETWORK_STATE)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_COARSE_LOCATION)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_FINE_LOCATION)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.READ_PHONE_STATE));
|
boolean allPermissionsGranted = Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.CAMERA)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_NETWORK_STATE)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_COARSE_LOCATION)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.ACCESS_FINE_LOCATION)) && Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.READ_PHONE_STATE));
|
||||||
|
|
||||||
if (allPermissionsGranted) {
|
if (allPermissionsGranted) {
|
||||||
getLastLocation();
|
fetchLocationAndCheckGeoFence();
|
||||||
} else {
|
} else {
|
||||||
//test("", "Some permissions are not granted ask again ");
|
//test("", "Some permissions are not granted ask again ");
|
||||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_NETWORK_STATE) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_COARSE_LOCATION) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_PHONE_STATE)) {
|
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_NETWORK_STATE) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_COARSE_LOCATION) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_PHONE_STATE)) {
|
||||||
@@ -825,32 +860,139 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getLastLocation() {
|
private void fetchLocationAndCheckGeoFence() {
|
||||||
|
if (isLocationFetching) return; // prevent multiple calls
|
||||||
|
isLocationFetching = true;
|
||||||
|
|
||||||
|
locationLoader.setVisibility(View.VISIBLE);
|
||||||
|
getWindow().setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
|
||||||
|
);
|
||||||
|
|
||||||
|
locationEngine.start(new LocationEngine.LocationResultListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationReady(Location location, float accuracy) {
|
||||||
|
isLocationFetching = false;
|
||||||
|
|
||||||
|
locationLoader.setVisibility(View.GONE);
|
||||||
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||||
|
|
||||||
|
lat = location.getLatitude();
|
||||||
|
lon = location.getLongitude();
|
||||||
|
|
||||||
|
Log.d("GeoFence", "Lat: " + lat + ", Lon: " + lon + ", Acc: " + accuracy);
|
||||||
|
|
||||||
|
// 🔥 Pass accuracy also
|
||||||
|
checkingGeoFencing(getMid(), accuracy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String msg) {
|
||||||
|
isLocationFetching = false;
|
||||||
|
|
||||||
|
locationLoader.setVisibility(View.GONE);
|
||||||
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||||
|
Toast.makeText(StoreImageActivity.this, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*private void fetchLocationAndCheckGeoFence() {
|
||||||
if (fusedLocationClient == null) {
|
if (fusedLocationClient == null) {
|
||||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
}
|
}
|
||||||
// fastest interval
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000).setMinUpdateIntervalMillis(3000) // fastest interval
|
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
.build();
|
// Request permissions if not granted
|
||||||
locationCallback = new LocationCallback() {
|
checkAndRequestPermissions();
|
||||||
@Override
|
return;
|
||||||
public void onLocationResult(@NonNull LocationResult locationResult) {
|
}
|
||||||
for (Location location : locationResult.getLocations()) {
|
// First, try to get the last known location
|
||||||
|
fusedLocationClient.fetchLocationAndCheckGeoFence()
|
||||||
|
.addOnSuccessListener(location -> {
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
lat = location.getLatitude();
|
lat = location.getLatitude();
|
||||||
lon = location.getLongitude();
|
lon = location.getLongitude();
|
||||||
Log.d("Location", "Lat: " + lat + ", Lng: " + lon);
|
checkingGeoFencing(getMid());
|
||||||
|
} else {
|
||||||
|
// No last known location, request updates for a new one
|
||||||
|
requestNewLocation();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.addOnFailureListener(e -> {
|
||||||
|
// Fallback: explicit request for a new location
|
||||||
|
requestNewLocation();
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*private void requestNewLocation() {
|
||||||
|
|
||||||
|
LocationRequest locationRequest = new LocationRequest.Builder(
|
||||||
|
Priority.PRIORITY_HIGH_ACCURACY, 2000)
|
||||||
|
.setMinUpdateIntervalMillis(1000)
|
||||||
|
.setMaxUpdateDelayMillis(3000)
|
||||||
|
.setMinUpdateDistanceMeters(0f)
|
||||||
|
.setWaitForAccurateLocation(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
locationCallback = new LocationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||||
|
|
||||||
|
for (Location location : locationResult.getLocations()) {
|
||||||
|
|
||||||
|
if (location != null) {
|
||||||
|
|
||||||
|
float accuracy = location.getAccuracy();
|
||||||
|
|
||||||
|
Log.d("Location", "Lat: " + location.getLatitude()
|
||||||
|
+ ", Lng: " + location.getLongitude()
|
||||||
|
+ ", Accuracy: " + accuracy);
|
||||||
|
|
||||||
|
// 🎯 IMPORTANT: Accept only accurate location
|
||||||
|
if (accuracy <= 80) {
|
||||||
|
|
||||||
|
lat = location.getLatitude();
|
||||||
|
lon = location.getLongitude();
|
||||||
|
|
||||||
|
Log.d("Location", "Accurate location received ✅");
|
||||||
|
|
||||||
|
checkingGeoFencing(getMid(),accuracy);
|
||||||
|
|
||||||
|
stopLocationUpdates(); // stop after good fix
|
||||||
|
break;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.d("Location", "Waiting for better accuracy...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED &&
|
||||||
// Request permissions if not granted
|
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
|
checkAndRequestPermissions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
|
|
||||||
}
|
fusedLocationClient.requestLocationUpdates(
|
||||||
|
locationRequest,
|
||||||
|
locationCallback,
|
||||||
|
Looper.getMainLooper()
|
||||||
|
);
|
||||||
|
|
||||||
|
// ⏱ OPTIONAL: timeout (avoid infinite wait)
|
||||||
|
new android.os.Handler().postDelayed(() -> {
|
||||||
|
Log.d("Location", "Timeout reached ⏳");
|
||||||
|
stopLocationUpdates();
|
||||||
|
}, 10000); // 10 seconds max
|
||||||
|
}*/
|
||||||
|
|
||||||
private void stopLocationUpdates() {
|
private void stopLocationUpdates() {
|
||||||
if (fusedLocationClient != null && locationCallback != null) {
|
if (fusedLocationClient != null && locationCallback != null) {
|
||||||
@@ -861,27 +1003,44 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
stopLocationUpdates();
|
// stopLocationUpdates();
|
||||||
if (loading != null && loading.isShowing()) {
|
if (loading != null && loading.isShowing()) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkingGeoFencing(JourneyPlan jcp) {
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
stopLocationUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void checkingGeoFencing(JourneyPlan jcp, float accuracy) {
|
||||||
if (jcp != null && jcp.getBID() != null) {
|
if (jcp != null && jcp.getBID() != null) {
|
||||||
if (jcp.getGeoTag() != null && !jcp.getGeoTag().equalsIgnoreCase(CommonString.KEY_N) && jcp.getGeoFencingAllow() != null && jcp.getGeoFencingAllow() == 1) {
|
if (jcp.getGeoTag() != null && !jcp.getGeoTag().equalsIgnoreCase(CommonString.KEY_N) && jcp.getGeoFencingAllow() != null && jcp.getGeoFencingAllow() == 1) {
|
||||||
int distance = jcp.getGeoFencingRadius() != null ? jcp.getGeoFencingRadius() : 0;
|
int distance = jcp.getGeoFencingRadius() != null ? jcp.getGeoFencingRadius() : 0;
|
||||||
int current_dist_from_store_using_lat = 0;
|
int current_dist_from_store_using_lat = 0;
|
||||||
|
|
||||||
|
Log.d("latdata", lat + "," + lon + "," + jcp.getLatitude() + "," + jcp.getLongitude());
|
||||||
if (jcp.getLatitude() != 0.0 && jcp.getLongitude() != 0.0 && jcp.getGeoFencingRadius() != 0 && lat != 0.0 && lon != 0.0) {
|
if (jcp.getLatitude() != 0.0 && jcp.getLongitude() != 0.0 && jcp.getGeoFencingRadius() != 0 && lat != 0.0 && lon != 0.0) {
|
||||||
current_dist_from_store_using_lat = DistanceUtils.calculateDistanceInMeters(lat, lon, jcp.getLatitude(), jcp.getLongitude());
|
current_dist_from_store_using_lat = DistanceUtils.calculateDistanceInMeters(lat, lon, jcp.getLatitude(), jcp.getLongitude());
|
||||||
|
int adjustedDistance = current_dist_from_store_using_lat - (int) accuracy;
|
||||||
|
Log.d("GeoFence", "Actual: " + current_dist_from_store_using_lat +
|
||||||
|
" Accuracy: " + accuracy +
|
||||||
|
" Adjusted: " + adjustedDistance);
|
||||||
Log.d("TagLoc", "Radius " + distance + "\nCurrent dist " + current_dist_from_store_using_lat);
|
Log.d("TagLoc", "Radius " + distance + "\nCurrent dist " + current_dist_from_store_using_lat);
|
||||||
if (current_dist_from_store_using_lat > distance) {
|
// if (current_dist_from_store_using_lat > distance) {
|
||||||
|
if (adjustedDistance > distance) {
|
||||||
String msg = getString(R.string.you_need_to_be_within) + " " + distance + " metres " + getString(R.string.you_need_to_be_in_the_store) +
|
String msg = getString(R.string.you_need_to_be_within) + " " + distance + " metres " + getString(R.string.you_need_to_be_in_the_store) +
|
||||||
"\n\n" + getString(R.string.distance_from_the_store) + " " + current_dist_from_store_using_lat + " " + getString(R.string.meters);
|
"\n\n" + getString(R.string.distance_from_the_store) + " " + current_dist_from_store_using_lat + " " + getString(R.string.meters);
|
||||||
|
if (isFinishing() || isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(getResources().getString(R.string.alert));
|
builder.setTitle(getResources().getString(R.string.alert));
|
||||||
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
|
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
|
||||||
dialog1.cancel();
|
dialog1.dismiss();
|
||||||
finishAffinity();
|
finishAffinity();
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
@@ -889,18 +1048,32 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
if (isFinishing() || isDestroyed()) {
|
||||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
return;
|
||||||
builder.setMessage(getString(R.string.first_geotag_the_store)).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
|
}
|
||||||
dialog1.cancel();
|
db.open();
|
||||||
success_geoTag = false;
|
Log.d("jcpdata", jcp.getGeoTag());
|
||||||
Intent in = new Intent(this, GeoTaggingActivity.class);
|
if (jcp.getGeoTag() != null && !jcp.getGeoTag().equalsIgnoreCase(CommonString.KEY_Y) && !isGeoTagAlertShown) {
|
||||||
startActivity(in);
|
isGeoTagAlertShown = true;
|
||||||
});
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
AlertDialog alert = builder.create();
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
alert.show();
|
builder.setMessage(getString(R.string.first_geotag_the_store))
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
|
||||||
|
dialog1.dismiss();
|
||||||
|
success_geoTag = false;
|
||||||
|
isGeoTagAlertShown = false; // Reset the flag if needed for future
|
||||||
|
Intent in = new Intent(this, GeoTaggingActivity.class);
|
||||||
|
startActivity(in);
|
||||||
|
// Optionally start geo tagging activity here
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,10 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.Spanned;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -72,7 +69,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
@@ -355,9 +351,9 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
jsonObject.put("IMEINumber1", "0");
|
jsonObject.put("IMEINumber1", "0");
|
||||||
jsonObject.put("IMEINumber2", "0");
|
jsonObject.put("IMEINumber2", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
String jsonString = jsonObject.toString();
|
String jsonString = jsonObject.toString();
|
||||||
|
// Log.e("loginjson", jsonString);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout(CommonString.TIMEOUT,
|
OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout(CommonString.TIMEOUT,
|
||||||
@@ -382,6 +378,11 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
} else if (data != null && data.contains("Changed")) {
|
} else if (data != null && data.contains("Changed")) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_CHANGED);
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_CHANGED);
|
||||||
|
} else if (data != null && data.contains("Lockout")) {
|
||||||
|
loading.dismiss();
|
||||||
|
editor.putBoolean(CommonString.KEY_LOCKOUT + userId + visitdate, true);
|
||||||
|
editor.commit();
|
||||||
|
AlertandMessages.closeApp((Activity) context, CommonString.MESSAGE_LOCKED);
|
||||||
} else if (data != null && data.contains("No data")) {
|
} else if (data != null && data.contains("No data")) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_LOGIN_NO_DATA);
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_LOGIN_NO_DATA);
|
||||||
@@ -458,7 +459,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.show();
|
builder.show();
|
||||||
} else {
|
} else {
|
||||||
Intent in = new Intent(getApplicationContext(), PinViewActivity.class);
|
Intent in = new Intent(getApplicationContext(), PinViewActivity.class);
|
||||||
@@ -477,7 +477,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
finish();
|
finish();
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
@@ -489,20 +488,17 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_NO_RESPONSE_SERVER);
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_NO_RESPONSE_SERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION);
|
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
@@ -526,11 +522,9 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (PackageManager.NameNotFoundException | JSONException e) {
|
} catch (PackageManager.NameNotFoundException | JSONException e) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
|
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ public class Downloader extends JobIntentService {
|
|||||||
}
|
}
|
||||||
storeDetail.put(jsonObject);
|
storeDetail.put(jsonObject);
|
||||||
}
|
}
|
||||||
|
Log.d("uploadProfiledata",storeDetail.toString());
|
||||||
JSONObject jsonFinalObject = new JSONObject();
|
JSONObject jsonFinalObject = new JSONObject();
|
||||||
jsonFinalObject.put("MID", mid);
|
jsonFinalObject.put("MID", mid);
|
||||||
jsonFinalObject.put("Keys", "BaProfileData");
|
jsonFinalObject.put("Keys", "BaProfileData");
|
||||||
@@ -664,7 +665,7 @@ public class Downloader extends JobIntentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.e("finalList", "Downloader"+finalList.toString());
|
||||||
if (!finalList.isEmpty()) {
|
if (!finalList.isEmpty()) {
|
||||||
filename = "";
|
filename = "";
|
||||||
for (int i = 0; i < finalList.size(); i++) {
|
for (int i = 0; i < finalList.size(); i++) {
|
||||||
@@ -708,10 +709,8 @@ public class Downloader extends JobIntentService {
|
|||||||
} else {
|
} else {
|
||||||
foldername = "BulkUpload";
|
foldername = "BulkUpload";
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = finalList.get(i);
|
filename = finalList.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,8 +758,10 @@ public class Downloader extends JobIntentService {
|
|||||||
UploadImageRecursive();
|
UploadImageRecursive();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.e("finalList", "Downloader"+e.toString());
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
} catch (OutOfMemoryError error) {
|
} catch (OutOfMemoryError error) {
|
||||||
|
Log.e("finalList", "Downloader"+error.toString());
|
||||||
statusforimage[0] = -1;
|
statusforimage[0] = -1;
|
||||||
error.fillInStackTrace();
|
error.fillInStackTrace();
|
||||||
}
|
}
|
||||||
@@ -768,15 +769,15 @@ public class Downloader extends JobIntentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
|
Log.e("finalList", "Downloader"+t.toString());
|
||||||
if (t instanceof IOException || t instanceof SocketTimeoutException || t instanceof SocketException) {
|
if (t instanceof IOException || t instanceof SocketTimeoutException || t instanceof SocketException) {
|
||||||
statusforimage[0] = -1;
|
statusforimage[0] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (JsonSyntaxException e) {
|
|
||||||
e.fillInStackTrace();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.e("finalList", "Downloader"+e.toString());
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,9 +72,8 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
user_type = preferences.getString(CommonString.KEY_USER_TYPE, "");
|
user_type = preferences.getString(CommonString.KEY_USER_TYPE, "");
|
||||||
((DealarBoardActivity) requireActivity()).setBaMenuRefreshListener(value -> {
|
((DealarBoardActivity) requireActivity()).setBaMenuRefreshListener(value -> {
|
||||||
// Set the adapter
|
// Set the adapter
|
||||||
if (view instanceof RecyclerView) {
|
if (view instanceof RecyclerView recyclerView) {
|
||||||
Context context = view.getContext();
|
Context context = view.getContext();
|
||||||
RecyclerView recyclerView = (RecyclerView) view;
|
|
||||||
recyclerView.setAdapter(new MyAdaperForIcon(context, getdata(value), value));
|
recyclerView.setAdapter(new MyAdaperForIcon(context, getdata(value), value));
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
||||||
}
|
}
|
||||||
@@ -85,7 +84,7 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
|
|
||||||
public List<NavMenuItemGetterSetter> getdata(String value) {
|
public List<NavMenuItemGetterSetter> getdata(String value) {
|
||||||
List<NavMenuItemGetterSetter> data = new ArrayList<>();
|
List<NavMenuItemGetterSetter> data = new ArrayList<>();
|
||||||
int groomed_img = 0, consumer_interaction = 0, consumer_return = 0, break_mangment = 0, ba_training = 0, leave_mangment = 0, ba_survey = 0, ba_skin_genius = 0;
|
int groomed_img = 0, consumer_interaction = 0, consumer_return = 0, break_mangment = 0, ba_training = 0, leave_mangment = 0, ba_survey = 0,ba_assessment=0, ba_skin_genius = 0;
|
||||||
db.open();
|
db.open();
|
||||||
String saleable_status = db.getStatus(CommonString.KEY_SaleableStatus, counterId);
|
String saleable_status = db.getStatus(CommonString.KEY_SaleableStatus, counterId);
|
||||||
if (value.equals("1")) {
|
if (value.equals("1")) {
|
||||||
@@ -98,6 +97,7 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
leave_mangment = R.mipmap.leave_m_grey;
|
leave_mangment = R.mipmap.leave_m_grey;
|
||||||
}
|
}
|
||||||
ba_survey = R.mipmap.ba_survey;
|
ba_survey = R.mipmap.ba_survey;
|
||||||
|
ba_assessment = R.mipmap.ba_assessment;
|
||||||
ba_skin_genius = R.mipmap.vto_grey;
|
ba_skin_genius = R.mipmap.vto_grey;
|
||||||
|
|
||||||
} else if (value.equals("2")) {
|
} else if (value.equals("2")) {
|
||||||
@@ -110,6 +110,7 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
ba_training = R.mipmap.training;
|
ba_training = R.mipmap.training;
|
||||||
ba_survey = R.mipmap.ba_survey;
|
ba_survey = R.mipmap.ba_survey;
|
||||||
|
ba_assessment = R.mipmap.ba_assessment;
|
||||||
ba_skin_genius = R.mipmap.vto_grey;
|
ba_skin_genius = R.mipmap.vto_grey;
|
||||||
} else {
|
} else {
|
||||||
db.open();
|
db.open();
|
||||||
@@ -131,9 +132,11 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
leave_mangment = R.mipmap.leave_management;
|
leave_mangment = R.mipmap.leave_management;
|
||||||
}
|
}
|
||||||
ba_survey = R.mipmap.ba_survey;
|
ba_survey = R.mipmap.ba_survey;
|
||||||
|
ba_assessment = R.mipmap.ba_assessment;
|
||||||
|
|
||||||
|
|
||||||
} else if (db.isGroomedChecked(counterId, username, visit_date).equalsIgnoreCase("Amber")) {
|
}
|
||||||
|
else if (db.isGroomedChecked(counterId, username, visit_date).equalsIgnoreCase("Amber")) {
|
||||||
if (complete) {
|
if (complete) {
|
||||||
consumer_return = R.mipmap.consumer_return;
|
consumer_return = R.mipmap.consumer_return;
|
||||||
consumer_interaction = R.mipmap.consumer_interaction;
|
consumer_interaction = R.mipmap.consumer_interaction;
|
||||||
@@ -150,6 +153,7 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
leave_mangment = R.mipmap.leave_management;
|
leave_mangment = R.mipmap.leave_management;
|
||||||
}
|
}
|
||||||
ba_survey = R.mipmap.ba_survey;
|
ba_survey = R.mipmap.ba_survey;
|
||||||
|
ba_assessment = R.mipmap.ba_assessment;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (complete) {
|
if (complete) {
|
||||||
@@ -169,15 +173,16 @@ public class BAdvisorMenuFragment extends Fragment {
|
|||||||
leave_mangment = R.mipmap.leave_management;
|
leave_mangment = R.mipmap.leave_management;
|
||||||
}
|
}
|
||||||
ba_survey = R.mipmap.ba_survey;
|
ba_survey = R.mipmap.ba_survey;
|
||||||
|
ba_assessment = R.mipmap.ba_assessment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] img = {groomed_img, consumer_interaction, consumer_return, break_mangment, ba_training, ba_survey, ba_skin_genius};
|
int[] img = {groomed_img, consumer_interaction, consumer_return, break_mangment, ba_training, ba_survey,ba_assessment, ba_skin_genius};
|
||||||
String[] name = {"Grooming Image", "Consumer Interaction", "Consumer Return", "Break Management", "Training", "BA Survey", "VTO"};
|
String[] name = {"Grooming Image", "Consumer Interaction", "Consumer Return", "Break Management", "Training", "BA Survey","BA Assessment", "VTO"};
|
||||||
|
|
||||||
if (user_type != null && user_type.equalsIgnoreCase(CommonString.TAG_FROM_BA)) {
|
if (user_type != null && user_type.equalsIgnoreCase(CommonString.TAG_FROM_BA)) {
|
||||||
name = new String[]{"Grooming Image", "Consumer Interaction", "Consumer Return", "Break Management", "Leave Management", "Training", "BA Survey", "VTO"};
|
name = new String[]{"Grooming Image", "Consumer Interaction", "Consumer Return", "Break Management", "Leave Management", "Training", "BA Survey", "BA Assessment","VTO"};
|
||||||
img = new int[]{groomed_img, consumer_interaction, consumer_return, break_mangment, leave_mangment, ba_training, ba_survey, ba_skin_genius};
|
img = new int[]{groomed_img, consumer_interaction, consumer_return, break_mangment, leave_mangment, ba_training, ba_survey,ba_assessment, ba_skin_genius};
|
||||||
}
|
}
|
||||||
for (int i = 0; i < img.length; i++) {
|
for (int i = 0; i < img.length; i++) {
|
||||||
NavMenuItemGetterSetter recData = new NavMenuItemGetterSetter();
|
NavMenuItemGetterSetter recData = new NavMenuItemGetterSetter();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.cpm.lorealbaautomation.constant.AlertandMessages;
|
|||||||
import com.cpm.lorealbaautomation.constant.CommonString;
|
import com.cpm.lorealbaautomation.constant.CommonString;
|
||||||
import com.cpm.lorealbaautomation.consumeractivity.ConsumerIntractionDetailActivity;
|
import com.cpm.lorealbaautomation.consumeractivity.ConsumerIntractionDetailActivity;
|
||||||
import com.cpm.lorealbaautomation.dailyactivity.BASurveyListActivity;
|
import com.cpm.lorealbaautomation.dailyactivity.BASurveyListActivity;
|
||||||
|
import com.cpm.lorealbaautomation.dailyactivity.BaAssessmentActivity;
|
||||||
import com.cpm.lorealbaautomation.dailyactivity.ConsumerReturnActivity;
|
import com.cpm.lorealbaautomation.dailyactivity.ConsumerReturnActivity;
|
||||||
import com.cpm.lorealbaautomation.dailyactivity.CounterImageActivity;
|
import com.cpm.lorealbaautomation.dailyactivity.CounterImageActivity;
|
||||||
import com.cpm.lorealbaautomation.dailyactivity.CounterProfileActivity;
|
import com.cpm.lorealbaautomation.dailyactivity.CounterProfileActivity;
|
||||||
@@ -178,6 +179,8 @@ public class MyAdaperForIcon extends RecyclerView.Adapter<MyAdaperForIcon.ViewHo
|
|||||||
db.deleteBASurveyData(counter_id, visit_date);
|
db.deleteBASurveyData(counter_id, visit_date);
|
||||||
}
|
}
|
||||||
context.startActivity(new Intent(context, BASurveyListActivity.class).putExtra("SurveyType", "BA"));
|
context.startActivity(new Intent(context, BASurveyListActivity.class).putExtra("SurveyType", "BA"));
|
||||||
|
} else if (current.getIconImg() == R.mipmap.ba_assessment) {
|
||||||
|
context.startActivity(new Intent(context, BaAssessmentActivity.class));
|
||||||
} else if (current.getIconImg() == R.mipmap.survey) {
|
} else if (current.getIconImg() == R.mipmap.survey) {
|
||||||
db.open();
|
db.open();
|
||||||
JourneyPlan jcp_Object = db.getBIDfromJCP(username, counter_id);
|
JourneyPlan jcp_Object = db.getBIDfromJCP(username, counter_id);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import androidx.appcompat.widget.Toolbar;
|
|||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.cpm.lorealbaautomation.LocationEngine;
|
||||||
import com.google.android.gms.common.api.ResolvableApiException;
|
import com.google.android.gms.common.api.ResolvableApiException;
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
import com.google.android.gms.location.LocationCallback;
|
import com.google.android.gms.location.LocationCallback;
|
||||||
@@ -106,48 +107,105 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
|
||||||
geocoder = new Geocoder(this);
|
geocoder = new Geocoder(this);
|
||||||
declaration();
|
declaration();
|
||||||
fab.setOnClickListener(view -> {
|
/*fab.setOnClickListener(view -> {
|
||||||
try {
|
try {
|
||||||
startLocationUpdates();
|
|
||||||
if (!img_str.isEmpty()) {
|
if (!img_str.isEmpty()) {
|
||||||
if (db.InsertSTOREgeotag(jcpGetset.getStoreId().toString(), counter_id, jcpGetset.getBID().toString(), username, latitude, longitude, img_str) > 0) {
|
startLocationUpdates(true);
|
||||||
img_str = "";
|
|
||||||
db.updateStatus(jcpGetset.getStoreId().toString(), jcpGetset.getCounterId().toString(),
|
|
||||||
jcpGetset.getBID().toString(), CommonString.KEY_Y, latitude, longitude);
|
|
||||||
new GeoTagUpload().execute();
|
|
||||||
} else {
|
|
||||||
AlertandMessages.showToastMsg(context, "Error in saving Geotag");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
AlertandMessages.showToastMsg(view.getContext(), getResources().getString(R.string.takeimage));
|
AlertandMessages.showToastMsg(view.getContext(), getResources().getString(R.string.takeimage));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
|
});*/
|
||||||
|
fab.setOnClickListener(view -> {
|
||||||
|
try {
|
||||||
|
if (!img_str.isEmpty()) {
|
||||||
|
|
||||||
|
LocationEngine engine = new LocationEngine(this);
|
||||||
|
|
||||||
|
engine.start(new LocationEngine.LocationResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onLocationReady(Location location, float accuracy) {
|
||||||
|
|
||||||
|
// ✅ Validate location
|
||||||
|
if (location == null) {
|
||||||
|
AlertandMessages.showToastMsg(context, "Unable to fetch location,Please try later");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ Accuracy check (important for geofencing)
|
||||||
|
if (accuracy > 80) {
|
||||||
|
AlertandMessages.showToastMsg(context, "Fetching accurate location, please wait...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
latitude = location.getLatitude();
|
||||||
|
longitude = location.getLongitude();
|
||||||
|
// ✅ Lat/Lng validation
|
||||||
|
if (latitude == 0.0 || longitude == 0.0) {
|
||||||
|
AlertandMessages.showToastMsg(context, "Invalid location, please try again");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("GeoTag", "Acc: " + accuracy +","+ latitude + ","+longitude);
|
||||||
|
updateMapWithLocation(latitude, longitude);
|
||||||
|
|
||||||
|
// 🔥 Save geotag
|
||||||
|
if (db.InsertSTOREgeotag(
|
||||||
|
jcpGetset.getStoreId().toString(),
|
||||||
|
counter_id,
|
||||||
|
jcpGetset.getBID().toString(),
|
||||||
|
username,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
img_str) > 0) {
|
||||||
|
|
||||||
|
if (checkNetIsAvailable(context)) {
|
||||||
|
new GeoTagUpload().execute();
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(context, getString(R.string.nonetwork));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(context, "Error in saving Geotag");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String msg) {
|
||||||
|
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(view.getContext(), getString(R.string.takeimage));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
camera_fab.setOnClickListener(view -> {
|
camera_fab.setOnClickListener(view -> {
|
||||||
try {
|
try {
|
||||||
if (checkNetIsAvailable(view.getContext())) {
|
if (latitude != 0.0 && longitude != 0.0) {
|
||||||
if (latitude != 0.0 && longitude != 0.0) {
|
_pathforcheck = jcpGetset.getStoreId().toString() + "-" + jcpGetset.getCounterId().toString() +
|
||||||
_pathforcheck = jcpGetset.getStoreId().toString() + "-" + jcpGetset.getCounterId().toString() +
|
"-" + jcpGetset.getBID().toString() + "_GeoTag-" + jcpGetset.getVisitDate().replace("/", "")
|
||||||
"-" + jcpGetset.getBID().toString() + "_GeoTag-" + jcpGetset.getVisitDate().replace("/", "")
|
+ "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
+ "_" + getCurrentTime().replace(":", "") + ".jpg";
|
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
||||||
_path = CommonString.getImagesFolder(context) + _pathforcheck;
|
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
|
||||||
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
|
|
||||||
} else {
|
|
||||||
AlertandMessages.showToastMsg(context, "Please wait for location");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
AlertandMessages.showToastMsg(context, getResources().getString(R.string.nonetwork));
|
AlertandMessages.showToastMsg(context, "Please wait for location");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ||
|
||||||
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION)
|
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
ActivityCompat.requestPermissions(this, new String[]{
|
||||||
ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION);
|
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
|
}, LOCATION_PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
locationCallback = new LocationCallback() {
|
locationCallback = new LocationCallback() {
|
||||||
@Override
|
@Override
|
||||||
@@ -167,7 +225,6 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
if (distance > 10) {
|
if (distance > 10) {
|
||||||
previousLatitude = latitude;
|
previousLatitude = latitude;
|
||||||
previousLongitude = longitude;
|
previousLongitude = longitude;
|
||||||
|
|
||||||
updateMapWithLocation(latitude, longitude);
|
updateMapWithLocation(latitude, longitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,24 +233,86 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
private void startLocationUpdates(boolean save) {
|
||||||
private void startLocationUpdates() {
|
LocationRequest locationRequest = new LocationRequest.Builder(
|
||||||
@SuppressLint("VisibleForTests") LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
|
Priority.PRIORITY_HIGH_ACCURACY, 2000)
|
||||||
.setMinUpdateIntervalMillis(1000)
|
.setMinUpdateIntervalMillis(1000)
|
||||||
|
.setMaxUpdateDelayMillis(3000)
|
||||||
|
.setWaitForAccurateLocation(true)
|
||||||
.build();
|
.build();
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
|
||||||
|
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
|
fusedLocationClient.requestLocationUpdates(
|
||||||
|
locationRequest,
|
||||||
|
new LocationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||||
|
|
||||||
|
for (Location location : locationResult.getLocations()) {
|
||||||
|
|
||||||
|
if (location != null) {
|
||||||
|
|
||||||
|
float accuracy = location.getAccuracy();
|
||||||
|
|
||||||
|
Log.d("Location", "Accuracy: " + accuracy);
|
||||||
|
|
||||||
|
// ✅ Only accept good accuracy
|
||||||
|
latitude = location.getLatitude();
|
||||||
|
longitude = location.getLongitude();
|
||||||
|
Log.d("Location", "Accuracy: " + accuracy +","+ latitude +","+ longitude);
|
||||||
|
|
||||||
|
previousLatitude = latitude;
|
||||||
|
previousLongitude = longitude;
|
||||||
|
if (save){
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if (db.InsertSTOREgeotag(jcpGetset.getStoreId().toString(), counter_id, jcpGetset.getBID().toString(), username, latitude, longitude, img_str) > 0) {
|
||||||
|
if (checkNetIsAvailable(context)) {
|
||||||
|
new GeoTagUpload().execute();
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(context, getResources().getString(R.string.nonetwork));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(context, "Error in saving Geotag");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
updateMapWithLocation(latitude, longitude);
|
||||||
|
stopLocationUpdates(); // stop after good fix
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Looper.getMainLooper()
|
||||||
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1001);
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||||
|
LOCATION_PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void stopLocationUpdates() {
|
||||||
|
if (fusedLocationClient != null && locationCallback != null) {
|
||||||
|
fusedLocationClient.removeLocationUpdates(locationCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
stopLocationUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMapWithLocation(double lat, double lon) {
|
private void updateMapWithLocation(double lat, double lon) {
|
||||||
if (geocoder != null && mMap != null) {
|
if (geocoder != null && mMap != null) {
|
||||||
Log.e("jeevanp", "" + lat);
|
Log.e("jeevanp", "" + lat);
|
||||||
String address = "";
|
String address = "";
|
||||||
try {
|
try {
|
||||||
|
|
||||||
List<Address> addressList = geocoder.getFromLocation(lat, lon, 1);
|
List<Address> addressList = geocoder.getFromLocation(lat, lon, 1);
|
||||||
if (addressList != null && !addressList.isEmpty()) {
|
if (addressList != null && !addressList.isEmpty()) {
|
||||||
address = addressList.get(0).getAddressLine(0);
|
address = addressList.get(0).getAddressLine(0);
|
||||||
@@ -232,48 +351,108 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapReady(@NonNull GoogleMap googleMap) {
|
public void onMapReady(@NonNull GoogleMap googleMap) {
|
||||||
|
|
||||||
mMap = googleMap;
|
mMap = googleMap;
|
||||||
|
|
||||||
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||||
mMap.getUiSettings().setZoomControlsEnabled(true);
|
mMap.getUiSettings().setZoomControlsEnabled(true);
|
||||||
mMap.getUiSettings().setCompassEnabled(true);
|
mMap.getUiSettings().setCompassEnabled(true);
|
||||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(22.5726, 88.3639), 15));
|
|
||||||
// Enable My Location layer
|
// ❌ REMOVE this (causes 0,0 jump)
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
|
// mMap.moveCamera(...)
|
||||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
mMap.setMyLocationEnabled(true); // ✅ this shows blue dot
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
mMap.getUiSettings().setMyLocationButtonEnabled(true); // ✅ this shows the GPS icon
|
== PackageManager.PERMISSION_GRANTED ||
|
||||||
startLocationUpdates();
|
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||||
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
|
mMap.setMyLocationEnabled(true);
|
||||||
|
mMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||||
|
|
||||||
|
// ✅ Use LocationEngine instead
|
||||||
|
fetchMapLocation();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// request permission
|
|
||||||
ActivityCompat.requestPermissions(this,
|
ActivityCompat.requestPermissions(this,
|
||||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
new String[]{
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
|
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
|
},
|
||||||
LOCATION_PERMISSION_REQUEST_CODE);
|
LOCATION_PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fetchMapLocation() {
|
||||||
|
|
||||||
|
LocationEngine engine = new LocationEngine(this);
|
||||||
|
|
||||||
|
engine.start(new LocationEngine.LocationResultListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationReady(Location location, float accuracy) {
|
||||||
|
|
||||||
|
if (location == null) return;
|
||||||
|
|
||||||
|
// 🎯 Optional: accuracy check
|
||||||
|
if (accuracy > 80) {
|
||||||
|
Log.d("Map", "Waiting for better accuracy...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
latitude = location.getLatitude();
|
||||||
|
longitude = location.getLongitude();
|
||||||
|
|
||||||
|
previousLatitude = latitude;
|
||||||
|
previousLongitude = longitude;
|
||||||
|
|
||||||
|
Log.d("Map", "Lat: " + latitude + ", Lng: " + longitude + ", Acc: " + accuracy);
|
||||||
|
|
||||||
|
updateMapWithLocation(latitude, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String msg) {
|
||||||
|
Toast.makeText(GeoTaggingActivity.this, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) {
|
if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) {
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
boolean locationGranted = false;
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
for (int i = 0; i < grantResults.length; i++) {
|
||||||
mMap.setMyLocationEnabled(true);
|
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
|
||||||
mMap.getUiSettings().setMyLocationButtonEnabled(true);
|
locationGranted = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (locationGranted) {
|
||||||
|
if (mMap != null) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
|
||||||
|
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
mMap.setMyLocationEnabled(true);
|
||||||
|
mMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startLocationUpdates(false);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Location permissions are required for geotagging", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
checkgpsEnableDevice();
|
// checkgpsEnableDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
startLocationUpdates();
|
startLocationUpdates(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,9 +506,6 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
if (mapFragment != null) {
|
if (mapFragment != null) {
|
||||||
mapFragment.getMapAsync(this);
|
mapFragment.getMapAsync(this);
|
||||||
}
|
}
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||||
} catch (PackageManager.NameNotFoundException ignored) {
|
} catch (PackageManager.NameNotFoundException ignored) {
|
||||||
@@ -363,14 +539,12 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
@Override
|
@Override
|
||||||
protected String doInBackground(Void... params) {
|
protected String doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
// uploading Geotag
|
|
||||||
uploadflag = false;
|
|
||||||
geotaglist = db.getinsertGeotaggingData(jcpGetset.getStoreId().toString(), counter_id, username, CommonString.KEY_N);
|
geotaglist = db.getinsertGeotaggingData(jcpGetset.getStoreId().toString(), counter_id, username, CommonString.KEY_N);
|
||||||
if (!geotaglist.isEmpty()) {
|
if (!geotaglist.isEmpty()) {
|
||||||
String jsonString2 = getString();
|
String jsonString2 = getString();
|
||||||
Log.e("jsonString2", jsonString2);
|
// Log.e("jsonString2", jsonString2);
|
||||||
String result = upload.downloadDataUniversal(jsonString2);
|
String result = upload.downloadDataUniversal(jsonString2);
|
||||||
Log.e("jsonString2", result);
|
// Log.e("jsonString2", result);
|
||||||
if (result.equalsIgnoreCase(CommonString.MESSAGE_NO_RESPONSE_SERVER)) {
|
if (result.equalsIgnoreCase(CommonString.MESSAGE_NO_RESPONSE_SERVER)) {
|
||||||
uploadflag = false;
|
uploadflag = false;
|
||||||
throw new SocketTimeoutException();
|
throw new SocketTimeoutException();
|
||||||
@@ -423,7 +597,7 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
@NonNull
|
@NonNull
|
||||||
private JSONObject getJsonObject(int j) throws JSONException {
|
private JSONObject getJsonObject(int j) throws JSONException {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("UserId",username);
|
obj.put("UserId", username);
|
||||||
obj.put("StoreId", geotaglist.get(j).getStoreid());
|
obj.put("StoreId", geotaglist.get(j).getStoreid());
|
||||||
obj.put("CounterId", geotaglist.get(j).getCounterId());
|
obj.put("CounterId", geotaglist.get(j).getCounterId());
|
||||||
obj.put("bID", geotaglist.get(j).getBid());
|
obj.put("bID", geotaglist.get(j).getBid());
|
||||||
@@ -440,7 +614,8 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if (result != null && result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (result != null && result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
db.open();
|
db.open();
|
||||||
if (db.updateInsertedGeoTagStatus(jcpGetset.getStoreId().toString(), counter_id, username, CommonString.KEY_Y) > 0) {
|
if (db.updateInsertedGeoTagStatus(jcpGetset.getStoreId().toString(), counter_id, username, CommonString.KEY_Y) > 0
|
||||||
|
&& db.updateStatus(jcpGetset.getStoreId().toString(), jcpGetset.getCounterId().toString(), jcpGetset.getBID().toString(), CommonString.KEY_Y, latitude, longitude) > 0) {
|
||||||
img_str = "";
|
img_str = "";
|
||||||
AlertandMessages.showToastMsg(context, "Geotag Saved Successfully");
|
AlertandMessages.showToastMsg(context, "Geotag Saved Successfully");
|
||||||
finish();
|
finish();
|
||||||
@@ -469,19 +644,17 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enableLocationSettings() {
|
private void enableLocationSettings() {
|
||||||
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, // priority
|
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
|
||||||
5000 // intervalMillis: 5 seconds
|
.setMinUpdateIntervalMillis(3000)
|
||||||
).setMinUpdateIntervalMillis(3000) // fastest interval
|
|
||||||
.build();
|
.build();
|
||||||
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest).setAlwaysShow(true); // show dialog if GPS is off
|
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest).setAlwaysShow(true);
|
||||||
|
|
||||||
SettingsClient settingsClient = LocationServices.getSettingsClient(this);
|
SettingsClient settingsClient = LocationServices.getSettingsClient(this);
|
||||||
settingsClient.checkLocationSettings(builder.build()).addOnSuccessListener(locationSettingsResponse -> {
|
settingsClient.checkLocationSettings(builder.build()).addOnSuccessListener(locationSettingsResponse -> {
|
||||||
// All location settings are satisfied. You can request location updates here.
|
// All location settings are satisfied. You can request location updates here.
|
||||||
}).addOnFailureListener(e -> {
|
}).addOnFailureListener(e -> {
|
||||||
if (e instanceof ResolvableApiException) {
|
if (e instanceof ResolvableApiException resolvable) {
|
||||||
try {
|
try {
|
||||||
ResolvableApiException resolvable = (ResolvableApiException) e;
|
|
||||||
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
|
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
|
||||||
} catch (IntentSender.SendIntentException sendEx) {
|
} catch (IntentSender.SendIntentException sendEx) {
|
||||||
// Ignore the error.
|
// Ignore the error.
|
||||||
|
|||||||
@@ -99,16 +99,7 @@ public class MPinActivity extends AppCompatActivity implements
|
|||||||
blurLockView.setTypeface(getTypeface());
|
blurLockView.setTypeface(getTypeface());
|
||||||
blurLockView.setOnLeftButtonClickListener(this);
|
blurLockView.setOnLeftButtonClickListener(this);
|
||||||
blurLockView.setOnPasswordInputListener(this);
|
blurLockView.setOnPasswordInputListener(this);
|
||||||
|
|
||||||
//blurLockView.setType(getPasswordType(), false);
|
|
||||||
//blurLockView.setPasswordLength(4);
|
|
||||||
|
|
||||||
/* blurLockView.show(
|
|
||||||
getIntent().getIntExtra("SHOW_DURATION", 1000),
|
|
||||||
getShowType(getIntent().getIntExtra("SHOW_DIRECTION", 0)),
|
|
||||||
getEaseType(getIntent().getIntExtra("SHOW_EASE_TYPE", 30)));*/
|
|
||||||
blurLockView.setType(Password.NUMBER, true);
|
blurLockView.setType(Password.NUMBER, true);
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -171,10 +162,6 @@ public class MPinActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
int incorrect_times = blurLockView.getIncorrectInputTimes();
|
int incorrect_times = blurLockView.getIncorrectInputTimes();
|
||||||
if (++incorrect_times >= 3) {
|
if (++incorrect_times >= 3) {
|
||||||
/*Toast.makeText(this,
|
|
||||||
R.string.error_incorrect_password,
|
|
||||||
Toast.LENGTH_SHORT).show();*/
|
|
||||||
|
|
||||||
Snackbar snackbar = Snackbar.make(blurLockView, "Incorrect MPin limit reached", Snackbar.LENGTH_INDEFINITE);
|
Snackbar snackbar = Snackbar.make(blurLockView, "Incorrect MPin limit reached", Snackbar.LENGTH_INDEFINITE);
|
||||||
View view = snackbar.getView();
|
View view = snackbar.getView();
|
||||||
/*TextView tv = (TextView)view.findViewById(android.support.design.R.id.snackbar_text);
|
/*TextView tv = (TextView)view.findViewById(android.support.design.R.id.snackbar_text);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import android.location.LocationManager;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
@@ -81,7 +82,6 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
public class
|
public class
|
||||||
PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
private String counterId = "";
|
private String counterId = "";
|
||||||
private final String visitdate = "";
|
|
||||||
private String Update_Visit_Date;
|
private String Update_Visit_Date;
|
||||||
private String userType;
|
private String userType;
|
||||||
Pinview pinview_confirm, pinview_start;
|
Pinview pinview_confirm, pinview_start;
|
||||||
@@ -141,9 +141,12 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
getDeviceName();
|
getDeviceName();
|
||||||
getLastLocation();
|
getLastLocation();
|
||||||
|
if (preferences.getBoolean(CommonString.KEY_LOCKOUT + user_id + visit_date, false)) {
|
||||||
|
AlertandMessages.closeApp((Activity) context, CommonString.MESSAGE_LOCKED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkAndRequestPermissions() {
|
private void checkAndRequestPermissions() {
|
||||||
int CAMERA = ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA);
|
int CAMERA = ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA);
|
||||||
int ACCESS_NETWORK_STATE = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_NETWORK_STATE);
|
int ACCESS_NETWORK_STATE = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
int ACCESS_COARSE_LOCATION = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
|
int ACCESS_COARSE_LOCATION = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||||
@@ -172,9 +175,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
|
|
||||||
if (!listPermissionsNeeded.isEmpty()) {
|
if (!listPermissionsNeeded.isEmpty()) {
|
||||||
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_ALL);
|
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_ALL);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDialogOK(String message, DialogInterface.OnClickListener okListener) {
|
private void showDialogOK(String message, DialogInterface.OnClickListener okListener) {
|
||||||
@@ -364,7 +365,6 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
os_version = Build.VERSION.RELEASE;
|
os_version = Build.VERSION.RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("NonConstantResourceId")
|
@SuppressLint("NonConstantResourceId")
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -384,7 +384,13 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
} else if (!allLoginData.isEmpty() && allLoginData.get(0).getMpin() != null && !pinview_confirm.getValue().equalsIgnoreCase(allLoginData.get(0).getMpin())) {
|
} else if (!allLoginData.isEmpty() && allLoginData.get(0).getMpin() != null && !pinview_confirm.getValue().equalsIgnoreCase(allLoginData.get(0).getMpin())) {
|
||||||
AlertandMessages.showToastMsg(context, "Your MPIN Does Not Match From Inserted Database");
|
AlertandMessages.showToastMsg(context, "Your MPIN Does Not Match From Inserted Database");
|
||||||
} else {
|
} else {
|
||||||
if (IS_PASSWORD_CHECK && Update_Visit_Date != null && Update_Visit_Date.equals("1")) {
|
if (CommonFunctions.checkNetIsAvailable(context)) {
|
||||||
|
AttempLogin();
|
||||||
|
} else {
|
||||||
|
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_INTERNET_NOT_AVALABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*if (IS_PASSWORD_CHECK && Update_Visit_Date != null && Update_Visit_Date.equals("1")) {
|
||||||
if (CommonFunctions.checkNetIsAvailable(context)) {
|
if (CommonFunctions.checkNetIsAvailable(context)) {
|
||||||
AttempLogin();
|
AttempLogin();
|
||||||
} else {
|
} else {
|
||||||
@@ -441,8 +447,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
|
||||||
|
|
||||||
} else if (v.getId() == R.id.btn_clear) {
|
} else if (v.getId() == R.id.btn_clear) {
|
||||||
hideKeyboard(this);
|
hideKeyboard(this);
|
||||||
@@ -482,12 +487,11 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
|
|
||||||
private void AttempLogin() {
|
private void AttempLogin() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
loading = ProgressDialog.show(context, "Processing", "Please wait...", false, false);
|
loading = ProgressDialog.show(context, "Processing", "Please wait...", false, false);
|
||||||
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("UserName", user_id);
|
jsonObject.put("UserName", user_id);
|
||||||
jsonObject.put("Password", allLoginData.get(0).getPassword());
|
jsonObject.put("Password", allLoginData.get(0).getPassword().trim());
|
||||||
jsonObject.put("CounterId", counterId);
|
jsonObject.put("CounterId", counterId);
|
||||||
jsonObject.put("Latitude", lat);
|
jsonObject.put("Latitude", lat);
|
||||||
jsonObject.put("Longitude", lon);
|
jsonObject.put("Longitude", lon);
|
||||||
@@ -518,6 +522,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String jsonString = jsonObject.toString();
|
String jsonString = jsonObject.toString();
|
||||||
|
Log.d("pinviewjson", jsonString);
|
||||||
try {
|
try {
|
||||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).
|
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).
|
||||||
writeTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).connectTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).build();
|
writeTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).connectTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).build();
|
||||||
@@ -542,6 +547,11 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
} else if (data_Login.contains("No data")) {
|
} else if (data_Login.contains("No data")) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_LOGIN_NO_DATA);
|
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_LOGIN_NO_DATA);
|
||||||
|
} else if (data_Login.contains("Lockout")) {
|
||||||
|
loading.dismiss();
|
||||||
|
editor.putBoolean(CommonString.KEY_LOCKOUT + user_id + visit_date, true);
|
||||||
|
editor.commit();
|
||||||
|
AlertandMessages.closeApp((Activity) context, CommonString.MESSAGE_LOCKED);
|
||||||
} else if (data_Login.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
} else if (data_Login.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||||
AlertandMessages.showAlertlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
|
AlertandMessages.showAlertlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
@@ -587,7 +597,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
loginGetterSetter = new LoginGetterSetter();
|
loginGetterSetter = new LoginGetterSetter();
|
||||||
loginGetterSetter.setUserId(user_id);
|
loginGetterSetter.setUserId(user_id);
|
||||||
loginGetterSetter.setPassword(allLoginData.get(0).getPassword());
|
loginGetterSetter.setPassword(allLoginData.get(0).getPassword());
|
||||||
loginGetterSetter.setVisitDate(visitdate);
|
loginGetterSetter.setVisitDate(visit_date);
|
||||||
loginGetterSetter.setUserType(userType);
|
loginGetterSetter.setUserType(userType);
|
||||||
if (data_login_Tym != null) {
|
if (data_login_Tym != null) {
|
||||||
loginGetterSetter.setUserLoginTym(data_login_Tym.getLoginTime().get(0).getLoginTime());
|
loginGetterSetter.setUserLoginTym(data_login_Tym.getLoginTime().get(0).getLoginTime());
|
||||||
@@ -610,6 +620,12 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
builder.show();
|
builder.show();
|
||||||
} else {
|
} else {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
|
Toast.makeText(context,"Success",Toast.LENGTH_SHORT).show();
|
||||||
|
editor.putString(user_id, pinview_confirm.getValue());
|
||||||
|
editor.putString(CommonString.KEY_USERNAME, user_id.toLowerCase());
|
||||||
|
editor.commit();
|
||||||
|
db.open();
|
||||||
|
db.updateLoginMpnData(user_id, pinview_confirm.getValue());
|
||||||
if (!allLoginData.isEmpty()) {
|
if (!allLoginData.isEmpty()) {
|
||||||
if (allLoginData.get(0).getImg().isEmpty()) {
|
if (allLoginData.get(0).getImg().isEmpty()) {
|
||||||
startActivity(new Intent(context, StoreImageActivity.class));
|
startActivity(new Intent(context, StoreImageActivity.class));
|
||||||
@@ -622,6 +638,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
|
|||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
|
//Toast.makeText(context,"Success",Toast.LENGTH_SHORT).show();
|
||||||
Intent in = new Intent(context, DealarBoardActivity.class);
|
Intent in = new Intent(context, DealarBoardActivity.class);
|
||||||
startActivity(in);
|
startActivity(in);
|
||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
|
|||||||
@@ -355,7 +355,6 @@ public class ReportDayWiseActivity extends AppCompatActivity {
|
|||||||
if (loading != null && loading.isShowing()) {
|
if (loading != null && loading.isShowing()) {
|
||||||
loading.dismiss();
|
loading.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
call_adapter(context);
|
call_adapter(context);
|
||||||
} else if (!data.contains("No Data")) {
|
} else if (!data.contains("No Data")) {
|
||||||
if (loading != null && loading.isShowing()) {
|
if (loading != null && loading.isShowing()) {
|
||||||
|
|||||||
+21
-20
@@ -89,7 +89,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.pd = pd;
|
this.pd = pd;
|
||||||
preferences = PrefHelper.getPrefs(context);
|
preferences = PrefHelper.getPrefs(context);
|
||||||
editor = preferences.edit();
|
editor = preferences.edit();
|
||||||
date = preferences.getString(CommonString.KEY_DATE, "");
|
date = preferences.getString(CommonString.KEY_DATE, "");
|
||||||
counterId = preferences.getString(CommonString.KEY_COUNTER_ID, "");
|
counterId = preferences.getString(CommonString.KEY_COUNTER_ID, "");
|
||||||
@@ -144,7 +144,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
} else {
|
} else {
|
||||||
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
|
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
Log.d("JSON_DATA",data);
|
Log.d("JSON_DATA", data);
|
||||||
new MyLoader(context, finalKeyName, data).execute();
|
new MyLoader(context, finalKeyName, data).execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
|
|
||||||
case "Mapping_JourneyPlan":
|
case "Mapping_JourneyPlan":
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
Log.d("JSON_DATA",data);
|
Log.d("JSON_DATA", data);
|
||||||
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
|
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
|
||||||
@@ -425,6 +425,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
AlertandMessages.showToastMsg(context, "Master_Posm data not saved");
|
AlertandMessages.showToastMsg(context, "Master_Posm data not saved");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
db.open();
|
||||||
|
db.delete_table_data("Master_Posm");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -438,6 +441,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
AlertandMessages.showToastMsg(context, "InwardSales PO Data not saved");
|
AlertandMessages.showToastMsg(context, "InwardSales PO Data not saved");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
db.open();
|
||||||
|
db.delete_table_data("InwardSales_PO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -490,6 +496,8 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new java.lang.Exception();
|
throw new java.lang.Exception();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
db.delete_table_data("T_StockSummary");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -506,8 +514,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
db.open();
|
db.open();
|
||||||
db.delete_table_data("T_CounterInvoice");
|
db.delete_table_data("T_CounterInvoice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Master_NonVisibility":
|
case "Master_NonVisibility":
|
||||||
@@ -526,7 +532,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "Master_NonStockReason":
|
case "Master_NonStockReason":
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
masterNonStockReasonObj = new Gson().fromJson(data, MasterNonStockReasonGetterSetter.class);
|
masterNonStockReasonObj = new Gson().fromJson(data, MasterNonStockReasonGetterSetter.class);
|
||||||
@@ -540,7 +545,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
db.delete_table_data("Master_NonStockReason");
|
db.delete_table_data("Master_NonStockReason");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//jp
|
//jp
|
||||||
case "Master_SkinType":
|
case "Master_SkinType":
|
||||||
@@ -579,6 +583,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
AlertandMessages.showToastMsg(context, "Master_Profile not saved");
|
AlertandMessages.showToastMsg(context, "Master_Profile not saved");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
db.open();
|
||||||
|
db.delete_table_data("Master_Profile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -609,10 +616,8 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
throw new java.lang.Exception();
|
throw new java.lang.Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "Master_TermsCondition":
|
case "Master_TermsCondition":
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
termConditionObject = new Gson().fromJson(data, MasterProfileQuestionGetterSetter.class);
|
termConditionObject = new Gson().fromJson(data, MasterProfileQuestionGetterSetter.class);
|
||||||
@@ -834,7 +839,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
db.delete_table_data("Report_Top10Volume");
|
db.delete_table_data("Report_Top10Volume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Report_Top10Value":
|
case "Report_Top10Value":
|
||||||
@@ -882,6 +886,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "Master_PromoOffers":
|
case "Master_PromoOffers":
|
||||||
|
Log.e("Master_PromoOffers",data);
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
masterPromoOfferObject = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
|
masterPromoOfferObject = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
@@ -1600,7 +1605,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
TesterCounter testerCounter = new Gson().fromJson(data, TesterCounter.class);
|
TesterCounter testerCounter = new Gson().fromJson(data, TesterCounter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (testerCounter != null && testerCounter.getReportTesterCounter()!=null && !db.insertTesterCounter(testerCounter)) {
|
if (testerCounter != null && testerCounter.getReportTesterCounter() != null && !db.insertTesterCounter(testerCounter)) {
|
||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
AlertandMessages.showToastMsg(context, "Report_TesterCounter not saved");
|
AlertandMessages.showToastMsg(context, "Report_TesterCounter not saved");
|
||||||
}
|
}
|
||||||
@@ -1806,7 +1811,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "T_LeaveLedgerSummary":
|
case "T_LeaveLedgerSummary":
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
ResponseResult leaveLedger = new Gson().fromJson(data, ResponseResult.class);
|
ResponseResult leaveLedger = new Gson().fromJson(data, ResponseResult.class);
|
||||||
db.open();
|
db.open();
|
||||||
@@ -1823,7 +1828,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
|
|
||||||
case "Mapping_AppRestrictedKPI":
|
case "Mapping_AppRestrictedKPI":
|
||||||
if (!data.contains("No Data")) {
|
if (!data.contains("No Data")) {
|
||||||
MasterBAProfileGetterSetter mappingAppRestrictedKPIGetterSetter = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
|
MasterBAProfileGetterSetter mappingAppRestrictedKPIGetterSetter = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (mappingAppRestrictedKPIGetterSetter != null && !db.insertMappingAppRestrictedKPI(mappingAppRestrictedKPIGetterSetter)) {
|
if (mappingAppRestrictedKPIGetterSetter != null && !db.insertMappingAppRestrictedKPI(mappingAppRestrictedKPIGetterSetter)) {
|
||||||
AlertandMessages.showToastMsg(context, "Mapping_AppRestrictedKPI data not saved");
|
AlertandMessages.showToastMsg(context, "Mapping_AppRestrictedKPI data not saved");
|
||||||
@@ -1919,7 +1924,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
editor.putInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + date, 0);
|
editor.putInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + date, 0);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
int incorrect_tStockSummery = preferences.getInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + date, 0);
|
int incorrect_tStockSummery = preferences.getInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + date, 0);
|
||||||
if (incorrect_tStockSummery != 0) {
|
if (incorrect_tStockSummery != 0) {
|
||||||
if (incorrect_tStockSummery == 1) {
|
if (incorrect_tStockSummery == 1) {
|
||||||
@@ -1963,7 +1967,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
}
|
}
|
||||||
@@ -1987,12 +1990,10 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int len1 = 0;
|
int len1 = 0;
|
||||||
|
|
||||||
while ((len1 = is1.read(buffer)) != -1) {
|
while ((len1 = is1.read(buffer)) != -1) {
|
||||||
bytes = (bytes + len1);
|
bytes = (bytes + len1);
|
||||||
fos.write(buffer, 0, len1);
|
fos.write(buffer, 0, len1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fos.close();
|
fos.close();
|
||||||
is1.close();
|
is1.close();
|
||||||
}
|
}
|
||||||
@@ -2058,7 +2059,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
} else {
|
} else {
|
||||||
data_global[0] = data;
|
data_global[0] = data;
|
||||||
if (finalKeyName.equalsIgnoreCase("Table_Structure")) {
|
if (finalKeyName.equalsIgnoreCase("Table_Structure")) {
|
||||||
Log.d("JSON_DATA",data);
|
Log.d("JSON_DATA", data);
|
||||||
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
|
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
tableStructureObj = new Gson().fromJson(data, TableStructureGetterSetter.class);
|
tableStructureObj = new Gson().fromJson(data, TableStructureGetterSetter.class);
|
||||||
@@ -2076,7 +2077,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
baListObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
baListObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (baListObject != null && !db.insertBalistData(baListObject)) {
|
if (baListObject != null && !db.insertBalistData(baListObject)) {
|
||||||
AlertandMessages.showSnackbarMsg(context, "Ba List data not saved");
|
AlertandMessages.showToastMsg(context, "Ba List data not saved");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new java.lang.Exception();
|
throw new java.lang.Exception();
|
||||||
@@ -2088,7 +2089,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
|
|||||||
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
db.open();
|
db.open();
|
||||||
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
|
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
|
||||||
AlertandMessages.showSnackbarMsg(context, "JCP data not saved");
|
AlertandMessages.showToastMsg(context, "JCP data not saved");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,52 +74,6 @@ public class RetrofitMethod {
|
|||||||
pd.setMessage("Uploading images");
|
pd.setMessage("Uploading images");
|
||||||
pd.show();
|
pd.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UploadBackup(final String filename, String foldername, String folderPath) {
|
|
||||||
try {
|
|
||||||
status = 0;
|
|
||||||
final File finalFile = new File(folderPath + filename);
|
|
||||||
isvalid = false;
|
|
||||||
adapter = new Retrofit.Builder()
|
|
||||||
.baseUrl(CommonString.URL)
|
|
||||||
.addConverterFactory(new StringConverterFactory())
|
|
||||||
.build();
|
|
||||||
PostApi api = adapter.create(PostApi.class);
|
|
||||||
Call<String> call = api.getUploadDataBaseBackup(body1);
|
|
||||||
call.enqueue(new Callback<String>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResponse(Response<String> response) {
|
|
||||||
if (response.isSuccess() && response.body().contains("Success")) {
|
|
||||||
finalFile.delete();
|
|
||||||
pd.dismiss();
|
|
||||||
AlertandMessages.showToastMsg(context, context.getString(R.string.data_uploaded_successfully));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
pd.dismiss();
|
|
||||||
AlertandMessages.showAlert((Activity) context, context.getString(R.string.database_not_uploaded), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable t) {
|
|
||||||
if (t instanceof IOException || t instanceof SocketTimeoutException || t instanceof SocketException) {
|
|
||||||
pd.dismiss();
|
|
||||||
AlertandMessages.showAlert((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION, true);
|
|
||||||
} else {
|
|
||||||
pd.dismiss();
|
|
||||||
AlertandMessages.showAlert((Activity) context, context.getString(R.string.errordatabase_not_uploaded), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.fillInStackTrace();
|
|
||||||
pd.dismiss();
|
|
||||||
AlertandMessages.showAlert((Activity) context, CommonString.MESSAGE_EXCEPTION, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getParsedDate(String filename) {
|
String getParsedDate(String filename) {
|
||||||
String testfilename = filename;
|
String testfilename = filename;
|
||||||
testfilename = testfilename.substring(testfilename.indexOf("-") + 1);
|
testfilename = testfilename.substring(testfilename.indexOf("-") + 1);
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.cpm.lorealbaautomation.retrofit;
|
package com.cpm.lorealbaautomation.retrofit;
|
||||||
|
|
||||||
import com.squareup.okhttp.MediaType;
|
import com.squareup.okhttp.MediaType;
|
||||||
import com.squareup.okhttp.RequestBody;
|
import com.squareup.okhttp.RequestBody;
|
||||||
import com.squareup.okhttp.ResponseBody;
|
import com.squareup.okhttp.ResponseBody;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import retrofit.Converter;
|
import retrofit.Converter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,11 +38,7 @@ class StringConverter implements Converter<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] convertToBytes(String string) {
|
private static byte[] convertToBytes(String string) {
|
||||||
try {
|
return string.getBytes(StandardCharsets.UTF_8);
|
||||||
return string.getBytes("UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cpm.lorealbaautomation.timer;
|
package com.cpm.lorealbaautomation.timer;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -47,10 +48,8 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
public class TimerActivity extends AppCompatActivity {
|
public class TimerActivity extends AppCompatActivity {
|
||||||
String process_data_Status = "", visit_date, username, counter_id;
|
String process_data_Status = "", visit_date, username, counter_id;
|
||||||
SharedPreferences preferences = null;
|
SharedPreferences preferences = null;
|
||||||
SharedPreferences.Editor editor = null;
|
|
||||||
Lorealba_Database db;
|
Lorealba_Database db;
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
TimerTask timerTask;
|
TimerTask timerTask;
|
||||||
//we are going to use a handler to be able to run in our TimerTask
|
//we are going to use a handler to be able to run in our TimerTask
|
||||||
@@ -140,15 +139,15 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
private void checkwait_status(Context context) {
|
private void checkwait_status(Context context) {
|
||||||
db.open();
|
db.open();
|
||||||
if (db.isCheck_Old_Product(visit_date)) {
|
if (db.isCheck_Old_Product(visit_date)) {
|
||||||
check_data_managing_status(context, CommonString.Key_Download_Status);
|
check_data_managing_status(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void check_data_managing_status(final Context context, String service_name) {
|
private void check_data_managing_status(final Context context) {
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("Downloadtype", service_name);
|
jsonObject.put("Downloadtype", CommonString.Key_Download_Status);
|
||||||
jsonObject.put("Username", "");
|
jsonObject.put("Username", "");
|
||||||
jsonObject.put("Param1", counter_id);
|
jsonObject.put("Param1", counter_id);
|
||||||
jsonObject.put("Param2", "");
|
jsonObject.put("Param2", "");
|
||||||
@@ -162,7 +161,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
Retrofit adapter = new Retrofit.Builder().baseUrl(CommonString.URL).client(okHttpClient).addConverterFactory(GsonConverterFactory.create()).build();
|
Retrofit adapter = new Retrofit.Builder().baseUrl(CommonString.URL).client(okHttpClient).addConverterFactory(GsonConverterFactory.create()).build();
|
||||||
PostApi api = adapter.create(PostApi.class);
|
PostApi api = adapter.create(PostApi.class);
|
||||||
Call<ResponseBody> call = api.getTabjournePlan(jsonData);
|
Call<ResponseBody> call = api.getTabjournePlan(jsonData);
|
||||||
call.enqueue(new Callback<ResponseBody>() {
|
call.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
|
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
|
||||||
ResponseBody responseBody = response.body();
|
ResponseBody responseBody = response.body();
|
||||||
@@ -174,14 +173,13 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
data = data.substring(1, data.length() - 1).replace("\\", "");
|
data = data.substring(1, data.length() - 1).replace("\\", "");
|
||||||
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||||
process_data_Status = "";
|
process_data_Status = "";
|
||||||
AlertandMessages.showToastMsg((Activity) context, CommonString.KEY_FAILURE + " Please try again ");
|
AlertandMessages.showToastMsg(context, CommonString.KEY_FAILURE + " Please try again ");
|
||||||
|
|
||||||
} else if (!data.contains("No Data")) {
|
} else if (!data.contains("No Data")) {
|
||||||
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
|
||||||
if (jcpObject != null && jcpObject.getDownloadStatus() != null) {
|
if (jcpObject != null && jcpObject.getDownloadStatus() != null) {
|
||||||
process_data_Status = jcpObject.getDownloadStatus().get(0).getDownloadStatus().trim();
|
process_data_Status = jcpObject.getDownloadStatus().get(0).getDownloadStatus().trim();
|
||||||
if (process_data_Status.equalsIgnoreCase("Wait")) {
|
if (!process_data_Status.equalsIgnoreCase("Wait")) {
|
||||||
} else {
|
|
||||||
///finsh
|
///finsh
|
||||||
stoptimertask();
|
stoptimertask();
|
||||||
startActivity(new Intent(context, DealarBoardActivity.class));
|
startActivity(new Intent(context, DealarBoardActivity.class));
|
||||||
@@ -196,7 +194,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
process_data_Status = "";
|
process_data_Status = "";
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
AlertandMessages.showToastMsg((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
|
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
process_data_Status = "";
|
process_data_Status = "";
|
||||||
@@ -207,7 +205,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
|
||||||
process_data_Status = "";
|
process_data_Status = "";
|
||||||
AlertandMessages.showToastMsg((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION);
|
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_SOCKETEXCEPTION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,7 +226,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
db.open();
|
db.open();
|
||||||
if (db.isCheck_Old_Product(visit_date)) {
|
if (db.isCheck_Old_Product(visit_date)) {
|
||||||
if (process_data_Status != null && !process_data_Status.equals("") && process_data_Status.equalsIgnoreCase("Download")) {
|
if (process_data_Status != null && !process_data_Status.isEmpty() && process_data_Status.equalsIgnoreCase("Download")) {
|
||||||
///finsh
|
///finsh
|
||||||
startActivity(new Intent(context, DealarBoardActivity.class));
|
startActivity(new Intent(context, DealarBoardActivity.class));
|
||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
@@ -238,6 +236,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("MissingSuperCall")
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
// super.onBackPressed();
|
// super.onBackPressed();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -70,6 +71,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
|
import retrofit.Converter;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
@@ -1841,7 +1843,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
@SuppressLint("NonConstantResourceId")
|
@SuppressLint("NonConstantResourceId")
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
if (view.getId() == R.id.img_manual_dataupload) {
|
if (view.getId() == R.id.img_manual_dataupload) {
|
||||||
if (CommonFunctions.checkNetIsAvailable(context)) {
|
if (CommonFunctions.checkNetIsAvailable(context)) {
|
||||||
masterList = db.getmasterTransaction(visit_date, counter_Id, true);
|
masterList = db.getmasterTransaction(visit_date, counter_Id, true);
|
||||||
@@ -1864,8 +1865,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
} else {
|
} else {
|
||||||
AlertandMessages.showToastMsg(context, getString(R.string.nonetwork));
|
AlertandMessages.showToastMsg(context, getString(R.string.nonetwork));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (view.getId() == R.id.img_manual_imageupload) {
|
} else if (view.getId() == R.id.img_manual_imageupload) {
|
||||||
if (CommonFunctions.checkNetIsAvailable(context)) {
|
if (CommonFunctions.checkNetIsAvailable(context)) {
|
||||||
upload_imagewithfolder();
|
upload_imagewithfolder();
|
||||||
@@ -1922,6 +1921,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.e("finalList", finalList.toString());
|
||||||
if (!finalList.isEmpty()) {
|
if (!finalList.isEmpty()) {
|
||||||
filename = "";
|
filename = "";
|
||||||
for (int i = 0; i < finalList.size(); i++) {
|
for (int i = 0; i < finalList.size(); i++) {
|
||||||
@@ -1966,7 +1966,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
} else {
|
} else {
|
||||||
foldername = "BulkUpload";
|
foldername = "BulkUpload";
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = finalList.get(i);
|
filename = finalList.get(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1999,6 +1998,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(retrofit.Response<String> response) {
|
public void onResponse(retrofit.Response<String> response) {
|
||||||
try {
|
try {
|
||||||
|
Log.e("finalList", response.toString());
|
||||||
if (response.code() == 200 && response.message().equalsIgnoreCase("OK") && response.isSuccess() && response.body().contains("Success")) {
|
if (response.code() == 200 && response.message().equalsIgnoreCase("OK") && response.isSuccess() && response.body().contains("Success")) {
|
||||||
if (finalFilename.contains("_counter_img_two_") || finalFilename.contains("_counter_img_one_") || finalFilename.contains("_cp_img_one_") || finalFilename.contains("_cp_img_two_") || finalFilename.contains("_groomed_img_mrng_") || finalFilename.contains("_groomed_img_noon_") || finalFilename.contains("_groomed_img_evning_")) {
|
if (finalFilename.contains("_counter_img_two_") || finalFilename.contains("_counter_img_one_") || finalFilename.contains("_cp_img_one_") || finalFilename.contains("_cp_img_two_") || finalFilename.contains("_groomed_img_mrng_") || finalFilename.contains("_groomed_img_noon_") || finalFilename.contains("_groomed_img_evning_")) {
|
||||||
db.open();
|
db.open();
|
||||||
@@ -2006,7 +2006,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
} else {
|
} else {
|
||||||
finalFile1.delete();
|
finalFile1.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
statusforimage[0] = 1;
|
statusforimage[0] = 1;
|
||||||
uploadedFiles[0]++;
|
uploadedFiles[0]++;
|
||||||
} else {
|
} else {
|
||||||
@@ -2015,7 +2014,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
if (statusforimage[0] == 0) {
|
if (statusforimage[0] == 0) {
|
||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
AlertandMessages.showAlertlogin((Activity) context, "Image not uploaded.Please try again." + "\n" + uploadedFiles + " images uploaded out of " + totalFiles);
|
AlertandMessages.showAlertlogin((Activity) context, "Image not uploaded.Please try again." + "\n" + uploadedFiles + " images uploaded out of " + totalFiles);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (totalFiles == uploadedFiles[0]) {
|
if (totalFiles == uploadedFiles[0]) {
|
||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
@@ -2026,6 +2024,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Log.e("finalList", e.toString());
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
statusforimage[0] = -1;
|
statusforimage[0] = -1;
|
||||||
pd.dismiss();
|
pd.dismiss();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.app.ProgressDialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -53,6 +54,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
|
import retrofit.Converter;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
@@ -1854,6 +1856,7 @@ public class UploadKeyData extends AppCompatActivity implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.e("finalList", finalList.toString());
|
||||||
if (!finalList.isEmpty()) {
|
if (!finalList.isEmpty()) {
|
||||||
filename = "";
|
filename = "";
|
||||||
for (int i = 0; i < finalList.size(); i++) {
|
for (int i = 0; i < finalList.size(); i++) {
|
||||||
@@ -1993,6 +1996,7 @@ public class UploadKeyData extends AppCompatActivity implements View.OnClickList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingSuperCall")
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (clicked_flag) {
|
if (clicked_flag) {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".dailyactivity.BaAssessmentActivity">
|
||||||
|
|
||||||
|
<!-- APP BAR -->
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:titleTextAppearance="@style/Toolbar.TitleTextPhone"/>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<!-- CONTENT BELOW TOOLBAR -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/contentLayout"
|
||||||
|
layout="@layout/content_ba_assessment"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/grey_background"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:context=".dailyactivity.BaAssessmentActivity"
|
||||||
|
tools:showIn="@layout/activity_ba_assessment">
|
||||||
|
|
||||||
|
<!-- CENTER CONTAINER -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="24dp"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<!-- QR CODE -->
|
||||||
|
<!-- ROUNDED CORNER QR CARD -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="5dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/qrImage"
|
||||||
|
android:layout_width="320dp"
|
||||||
|
android:layout_height="320dp"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:contentDescription="QR Code" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- SPACE -->
|
||||||
|
<!-- TEXT -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Scan this QR code\n to start BA Assessment"
|
||||||
|
android:textSize="@dimen/text_size_16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
android:layout_height="@dimen/hieght_180dp"
|
android:layout_height="@dimen/hieght_180dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:visibility="visible"
|
||||||
android:layout_margin="@dimen/custom_margin"
|
android:layout_margin="@dimen/custom_margin"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@mipmap/profile_image" />
|
android:src="@mipmap/profile_image" />
|
||||||
|
|||||||
@@ -25,6 +25,13 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/locationLoader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_selfie"
|
android:id="@+id/img_selfie"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".dailyactivity.BaAssessmentActivity">
|
||||||
|
|
||||||
|
<!-- APP BAR -->
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:titleTextAppearance="@style/Toolbar.TitleTextPhone"/>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<!-- CONTENT BELOW TOOLBAR -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/contentLayout"
|
||||||
|
layout="@layout/content_ba_assessment"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/grey_background"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:context=".dailyactivity.BaAssessmentActivity"
|
||||||
|
tools:showIn="@layout/activity_ba_assessment">
|
||||||
|
|
||||||
|
<!-- CENTER CONTAINER -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="24dp"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<!-- QR CODE -->
|
||||||
|
<!-- ROUNDED CORNER QR CARD -->
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
app:cardElevation="5dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/qrImage"
|
||||||
|
android:layout_width="320dp"
|
||||||
|
android:layout_height="320dp"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:contentDescription="QR Code" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!-- SPACE -->
|
||||||
|
<!-- TEXT -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Scan this QR code\n to start BA Assessment"
|
||||||
|
android:textSize="@dimen/text_size_16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
android:layout_height="@dimen/hieght_130dp"
|
android:layout_height="@dimen/hieght_130dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:visibility="visible"
|
||||||
android:layout_margin="@dimen/custom_margin"
|
android:layout_margin="@dimen/custom_margin"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@mipmap/profile_image" />
|
android:src="@mipmap/profile_image" />
|
||||||
|
|||||||
@@ -25,6 +25,13 @@
|
|||||||
android:layout_margin="@dimen/margin_30dp"
|
android:layout_margin="@dimen/margin_30dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/locationLoader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_selfie"
|
android:id="@+id/img_selfie"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:weightSum="10">
|
android:weightSum="10">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
<androidx.cardview.widget.CardView
|
||||||
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/report_cardview"
|
android:id="@+id/report_cardview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -1,4 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<external-path name="external_files" path="."/>
|
<!-- Example: give access to files in the app's cache or files directory -->
|
||||||
|
<external-files-path
|
||||||
|
name="external_files"
|
||||||
|
path="." />
|
||||||
|
|
||||||
|
<!-- or internal -->
|
||||||
|
<files-path
|
||||||
|
name="internal_files"
|
||||||
|
path="." />
|
||||||
</paths>
|
</paths>
|
||||||
@@ -4,7 +4,7 @@ android {
|
|||||||
namespace("com.androidbuts.multispinnerfilter")
|
namespace("com.androidbuts.multispinnerfilter")
|
||||||
compileSdk(35)
|
compileSdk(35)
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 24
|
minSdkVersion 23
|
||||||
targetSdk(35)
|
targetSdk(35)
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
i/classes_global-synthetics
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
i/classes_global-synthetics
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
o/classes
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
i/classes_dex
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
i/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
o/debug
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
i/classes_global-synthetics
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
o/classes
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
i/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
i/debug_dex
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
o/classes
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
o/classes
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
i/classes_dex
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
o/out
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user