Compare commits

...

10 Commits

Author SHA1 Message Date
ravik 41b1254a66 Initial commit 2026-05-15 15:58:13 +05:30
ravik 76e4fca075 geofence_updated_code 2026-03-28 18:10:00 +05:30
jeevanp da5d6cc1b3 added qr-code generator in ba-assessment 2025-12-30 12:46:09 +05:30
jeevanp bc00a42ffd Added BA assessment and fixed baskinGss 2025-12-19 17:53:54 +05:30
jeevanp 991846d75a Added BA assessment and fixed baskinGss 2025-12-19 17:10:22 +05:30
ravik d2f8f317ae minsdkversion23 2025-09-26 19:00:47 +05:30
ravik a04e0db9d5 updated_code 2025-09-26 17:47:51 +05:30
ravik 741480e66e lockout_preference 2025-09-12 18:18:45 +05:30
ravik 251a713be6 lockedUser 2025-09-09 18:44:36 +05:30
ravik 1af132ab36 Geotag and Geofence Changes 2025-08-06 15:04:27 +05:30
730 changed files with 78178 additions and 953 deletions
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="selectedTabId" value="Firebase Crashlytics" />
<option name="tabSettings">
<map>
<entry key="Android Vitals">
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
<bytecodeTargetLevel target="21" />
</component>
</project>
+13
View File
@@ -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>
+1 -1
View File
@@ -6,7 +6,7 @@
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="17" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
+8 -2
View File
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.67" />
</ProjectState>
</option>
</component>
</project>
+3 -2
View File
@@ -3,6 +3,8 @@ apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
@@ -16,7 +18,7 @@ ext {
PUBLISH_VERSION_CODE = 11
SUPPORT_VERSION = '25.3.1'
TARGET_SDK = 35
MIN_SDK = 24
MIN_SDK = 23
}
android {
@@ -35,7 +37,6 @@ android {
lintOptions {
abortOnError false
}
}
// ✅ Sources JAR
+6
View File
@@ -13,3 +13,9 @@
.externalNativeBuild
.cxx
local.properties
# Android build outputs
*.apk
*.aab
/build
/app/build
+14 -13
View File
@@ -3,17 +3,16 @@ apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'org.jetbrains.kotlin.android'
android {
namespace("com.cpm.lorealbaautomation")
compileSdk(35)
defaultConfig {
minSdkVersion 29
minSdkVersion 23
applicationId "com.cpm.lorealbaautomation"
//noinspection OldTargetApi
targetSdk 34
versionCode 20
versionName "2.9"
versionCode 23
versionName "3.1"
multiDexEnabled true
useLibrary 'org.apache.http.legacy'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -21,7 +20,6 @@ android {
abiFilters.add("armeabi-v7a")
abiFilters.add("arm64-v8a")
}
}
signingConfigs {
config {
@@ -33,16 +31,17 @@ android {
}
buildTypes {
release {
buildConfigField "boolean", "LOG_ENABLED", "true"
debuggable true
minifyEnabled true
shrinkResources true
//buildConfigField "boolean", "LOG_ENABLED", "true"
debuggable false
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.config
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
firebaseCrashlytics {
mappingFileUploadEnabled false // or false if you want to disable
}
}
// 👇 Add this block to force override
}
@@ -73,12 +72,14 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.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.retrofit2:converter-gson:2.9.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
implementation 'de.hdodenhof:circleimageview:3.1.0'
BIN
View File
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 20,
"versionName": "2.9",
"versionCode": 23,
"versionName": "3.1",
"outputFile": "app-release.apk"
}
],
+11 -1
View File
@@ -658,6 +658,14 @@
android:windowSoftInputMode="adjustPan"
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
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyAJIqKPhsyYTp6WnM387Fri4nLJo4-mOvc"
@@ -670,16 +678,18 @@
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.file provider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"
tools:replace="android:resource" />
</provider>
<service
android:name=".service.MyFirebaseMessagingService"
android:exported="false">
@@ -14,6 +14,9 @@ import android.os.Build;
import android.os.Bundle;
import androidx.core.content.FileProvider;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Handler;
import android.os.Looper;
import android.view.Window;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -31,7 +34,6 @@ import java.net.URL;
import java.text.DecimalFormat;
public class AutoUpdateActivity extends AppCompatActivity {
private static final int PERMISSION_ALL = 99;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
@@ -150,19 +152,30 @@ public class AutoUpdateActivity extends AppCompatActivity {
File toInstall = new File(CommonString.getLorealBaApkFolder(context) + "app.apk");
Uri apkUri;
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
apkUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", toInstall);
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
apkUri = FileProvider.getUriForFile(context,
BuildConfig.APPLICATION_ID + ".fileprovider",
toInstall);
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 {
apkUri = Uri.fromFile(toInstall);
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.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()) {
Intent intentu = new Intent(context, Downloader.class);
intentu.putExtra(CommonString.KEY_UPLOADIMAGE, "1");
@@ -266,7 +266,6 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
}
}
@SuppressLint("ObsoleteSdkInt")
private void AttempLogin() {
try {
@@ -280,7 +279,6 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
loading = ProgressDialog.show(IMEILoginActivity.this, "Processing", "Please wait...", false, false);
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
JSONObject jsonObject = new JSONObject();
jsonObject.put("OSVersion", os_version);
jsonObject.put("Manufacturer", manufacturer);
jsonObject.put("ModelNumber", model);
@@ -302,9 +300,8 @@ public class IMEILoginActivity extends AppCompatActivity implements GoogleApiCli
jsonObject.put("IMEINumber1", "0");
}
}
String jsonString = jsonObject.toString();
Log.e("jsonlogindata", jsonString);
Log.e("jsonString",jsonString);
try {
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout
(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;
data = response.body().string();
data = data.substring(1, data.length() - 1).replace("\\", "");
Log.e("jsonString",data);
Gson gson = new Gson();
final CounterDeviceLoginGetterSetter userObject = gson.fromJson(data, CounterDeviceLoginGetterSetter.class);
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
AlertandMessages.showAlertCounterlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
loading.dismiss();
if (loading != null && loading.isShowing()) {
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;
case "Mapping_JourneyPlan":
Log.d("JSON_DATA", data);
if (!data.contains("No Data")) {
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
@@ -101,12 +101,14 @@ public class AlertandMessages {
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);
builder.setTitle("Alert");
builder.setMessage("Do you want to exit? Filled data will be lost").setCancelable(false)
.setPositiveButton("Ok", (dialog, id) -> activity.finish());
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
builder.setMessage(str).setCancelable(false)
.setPositiveButton("Ok", (dialog, id) -> {
dialog.dismiss();
activity.finishAffinity();
});
AlertDialog alert = builder.create();
alert.show();
}
@@ -14,6 +14,8 @@ public class CommonString {
public static final String LorealPromo_Folder = "LorealPromoOffers";
public static final String LorealBaApkFolder = "LorealBaApkFolder";
public static String BA_ASSESSMENT_URL ="https://careaudit.parinaam.in?";
public static String getLorealBaApkFolder(Context context) {
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 Key_Download_Status = "Download_Status";
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 Table_Sale_Tracking = "SALE_TRACKING_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 CONSUMERSALE = "CONSUMERSALE";
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_MAYBELLINE = "OPEN_MAYBELLINE";
public static final String CONSUMERRETURN = "CONSUMERRETURN";
@@ -171,6 +171,7 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
@Override
public void onBackPressed() {
super.onBackPressed();
if (clicked_flag) {
AlertDialog.Builder builder = new AlertDialog.Builder(context).setMessage(CommonString.ONBACK_ALERT_MESSAGE).setCancelable(false).setPositiveButton("Ok",
(dialog, id) -> {
@@ -873,8 +874,38 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
}
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) {
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
dialog_sku_adapter.add("- Select Product -");
@@ -920,9 +951,8 @@ public class ConsumerReturnReplaceProductActivity extends AppCompatActivity impl
dialog_spin.setAdapter(dialog_sku_adapter);
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
}
dialog_spin.invalidate();
}
}*/
final int CLEAR_FILTER = 0;
final int FILTER_FOR_BRAND = 1;
@@ -16,6 +16,7 @@ import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -48,9 +49,11 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.cpm.lorealbaautomation.gsonGetterSetter.PromotionMaster;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.gson.Gson;
import com.google.zxing.integration.android.IntentIntegrator;
@@ -96,6 +99,7 @@ import okhttp3.ResponseBody;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
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 = "",
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")) {
edt_mobile_no.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);
mobile_checkbox.setEnabled(false);
edt_email_address.setEnabled(false);
@@ -304,55 +308,55 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
//for demo perpose button
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.setTextColor(getResources().getColor(R.color.white));
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
promotion_btn_second.setTextColor(getResources().getColor(R.color.grayfor_login));
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.white));
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
demo_given_str = "Yes";
} else {
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
demo_given_str = "No";
}
/////For Skin Genious
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.setTextColor(getResources().getColor(R.color.white));
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
skingn_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
skin_genius_str = "Yes";
} else {
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
skin_genius_str = "No";
}
/////For Maybelline VTO
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.setTextColor(getResources().getColor(R.color.white));
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
maybelline_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
maybelline_vto = "Yes";
} else {
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
maybelline_vto = "No";
}
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.setTextColor(getResources().getColor(R.color.white));
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
card_layout_scan.setVisibility(View.VISIBLE);
card_layout_title.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);
text_user_nm.setText(selected_list.get(0).getCustomer_name() + " Customer - " + CommonFunctions.removed_special_char(edt_customer));
} else {
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
card_layout_scan.setVisibility(View.GONE);
card_layout_title.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));
} else {
selected_list = new ArrayList<>();
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
///for Sale Genius
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
///for Maybelline VTO
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
maybelline_vto = "No";
skin_genius_str = "No";
@@ -508,7 +512,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
mobile_checkbox.setEnabled(false);
edt_email_address.setEnabled(false);
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);
});
@@ -539,6 +543,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
return super.onOptionsItemSelected(item);
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
if (clicked_flag) {
@@ -700,12 +705,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
edt_mobile_no.setText("0000000000");
rl_otp.setVisibility(View.GONE);
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 {
edt_mobile_no.setText("");
no_mobile_no_flag = false;
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) {
@@ -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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
promotion_btn_first.setTextColor(getResources().getColor(R.color.white));
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
promotion_btn_second.setTextColor(getResources().getColor(R.color.grayfor_login));
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.white));
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
demo_given_str = "Yes";
if (response_term_condition.equals("1")) {
rl_demo_img.setVisibility(View.VISIBLE);
@@ -926,7 +931,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
}
//////open demo image layout
}
}
///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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
skingn_btn_yes.setTextColor(getResources().getColor(R.color.white));
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
skingn_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.white));
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
maybelline_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
skingn_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
skingn_btn_no.setTextColor(getResources().getColor(R.color.white));
skingn_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
skingn_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
skingn_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
skingn_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
skingn_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
skin_genius_str = "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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
maybelline_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(getResources().getColor(R.color.white));
maybelline_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
maybelline_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
maybelline_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
maybelline_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
maybelline_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
promotion_btn_second.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
promotion_btn_second.setTextColor(getResources().getColor(R.color.white));
promotion_btn_first.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(getResources().getColor(R.color.grayfor_login));
promotion_btn_second.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
promotion_btn_second.setTextColor(ContextCompat.getColor(context,R.color.white));
promotion_btn_first.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
promotion_btn_first.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
demo_given_str = "No";
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())) {
AlertandMessages.showToastMsg(context, "Please Enter Valid Email Id ");
} else {
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
sale_btn_no.setTextColor(getResources().getColor(R.color.white));
sale_btn_yes.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
card_layout_scan.setVisibility(View.GONE);
card_layout_title.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.setTextColor(getResources().getColor(R.color.white));
sale_btn_no.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
sale_btn_no.setTextColor(getResources().getColor(R.color.grayfor_login));
sale_btn_yes.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
sale_btn_yes.setTextColor(ContextCompat.getColor(context,R.color.white));
sale_btn_no.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
sale_btn_no.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
card_layout_scan.setVisibility(View.VISIBLE);
card_layout_title.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 (new File(CommonString.getImagesFolder(context) + _pathforcheck).exists()) {
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;
_pathforcheck = "";
}
@@ -2581,12 +2584,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
setProductSpinnerData(productList, dialog_product_spin);
db.open();
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.setTextColor(getResources().getColor(R.color.white));
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.white));
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
});
btn_invoice_type_sample.setOnClickListener(view -> {
@@ -2604,12 +2607,12 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
setSubBrandSpinnerData(subbrandList, dialog_sub_brand_spin);
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
setProductSpinnerData(productList, dialog_product_spin);
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.white));
btn_invoice_type_saleable.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_saleable.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.white));
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
db.open();
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);
setReferenceSpinnerData(referenceList, dialog_franchise_spin);
setProductSpinnerData(productList, dialog_product_spin);
btn_invoice_type_gwp.setBackground(getResources().getDrawable(R.drawable.rouded_corner));
btn_invoice_type_gwp.setTextColor(getResources().getColor(R.color.white));
btn_invoice_type_saleable.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_saleable.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_sample.setBackground(getResources().getDrawable(R.drawable.round_btn_color_primary));
btn_invoice_type_sample.setTextColor(getResources().getColor(R.color.grayfor_login));
btn_invoice_type_gwp.setBackground(ContextCompat.getDrawable(context,R.drawable.rouded_corner));
btn_invoice_type_gwp.setTextColor(ContextCompat.getColor(context,R.color.white));
btn_invoice_type_saleable.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_saleable.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
btn_invoice_type_sample.setBackground(ContextCompat.getDrawable(context,R.drawable.round_btn_color_primary));
btn_invoice_type_sample.setTextColor(ContextCompat.getColor(context,R.color.grayfor_login));
db.open();
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 {
if (filterType == FILTER_FOR_BRAND) {
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) {
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 FILTER_FOR_BRAND = 1;
final int FILTER_FOR_SUB_BRAND = 2;
@@ -3149,7 +3198,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
response_term_condition = "0";
}
} 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);
}
}
@@ -3180,7 +3229,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
List<ConsumerTermsConditionAccept> dataresponce = reportbaAvailabilityGetterSetter.getConsumerTermsConditionAccept();
if (dataresponce.get(0).getTermsConditionAccept()) {
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);
} else {
@@ -3214,7 +3263,7 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
protected void onResume() {
super.onResume();
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);
}
@@ -3363,10 +3412,10 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
if (flag_worth) {
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 {
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
@@ -3374,7 +3423,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
recycl_promotion.setLayoutManager(new LinearLayoutManager(context));
cancet_btn.setOnClickListener(view -> {
purposeDialog.dismiss();
added_prmo_products.clear();
if (purposeDialog != null && purposeDialog.isShowing()) {
purposeDialog.dismiss();
@@ -3383,11 +3431,9 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
btn_add.setOnClickListener(view -> {
try {
purposeDialog.dismiss();
if (purposeDialog != null && purposeDialog.isShowing()) {
purposeDialog.dismiss();
}
if (flag_worth) {
if (!added_prmo_products.isEmpty()) {
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.setScan_ean_code_or_enterd_ean_code(qualified_products1.get(l).getScan_ean_code_or_enterd_ean_code());
applyeid_products.add(invoiceGetterSetter);
}
}
@@ -3895,7 +3940,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
} else {
calculate_per_productwise = (total_valueper_productwise * getentityValue) / 100;
}
//test("promodata", String.valueOf(calculate_per_productwise));
} catch (NumberFormatException e) {
e.fillInStackTrace();
}
@@ -4283,13 +4327,17 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
protected void remove_added_promo_index() {
try {
if (!selected_list.isEmpty()) {
Iterator<InvoiceGetterSetter> it = selected_list.iterator();
while (it.hasNext()) {
InvoiceGetterSetter name = it.next();
if (name.isPromo_flag()) {
it.remove();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // API 24+
selected_list.removeIf(InvoiceGetterSetter::isPromo_flag);
} else {
// Fallback for SDK 23 and below
Iterator<InvoiceGetterSetter> iterator = selected_list.iterator();
while (iterator.hasNext()) {
InvoiceGetterSetter item = iterator.next();
if (item.isPromo_flag()) {
iterator.remove();
}
}
// Do something
}
}
} catch (Exception e) {
@@ -4299,14 +4347,15 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
protected void remove_added_promo_fromtemp(String promoId) {
try {
if (!added_prmo_products.isEmpty()) {
Iterator<InvoiceGetterSetter> it = added_prmo_products.iterator();
while (it.hasNext()) {
InvoiceGetterSetter name = it.next();
if (promoId.equals(name.getPromotion_Id())) {
it.remove();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
added_prmo_products.removeIf(item -> promoId.equals(item.getPromotion_Id()));
} else {
Iterator<InvoiceGetterSetter> iterator = added_prmo_products.iterator();
while (iterator.hasNext()) {
InvoiceGetterSetter item = iterator.next();
if (promoId.equals(item.getPromotion_Id())) {
iterator.remove();
}
// Do something
}
}
} catch (Exception e) {
@@ -4362,7 +4411,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
}
close_white.setOnClickListener(view -> {
purposeDialog.dismiss();
if (purposeDialog != null && purposeDialog.isShowing()) {
purposeDialog.dismiss();
}
@@ -4514,8 +4562,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
////for product promotion
db.open();
ArrayList<MasterPromotion> promoMaster = db.getPromotionMaster(true);
// //test("promosize", String.valueOf(promoMaster.size()));
if (!promoMaster.isEmpty()) {
final ArrayList<MasterPromotion> validPromoList = new ArrayList<>();
for (int x = 0; x < promoMaster.size(); x++) {
@@ -4528,13 +4574,11 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
boolean flag_for_and = true;
for (int q = 0; q < promoAndList.size(); q++) {
db.open();
int product_countfor_and = db.getPromotiongetProductforAndPromo(promoAndList.get(q).getId(),
promoAndList.get(q).getPromoId().toString(), true, username, visit_date, CounterId);
int product_countfor_and = db.getPromotiongetProductforAndPromo(promoAndList.get(q).getId(), promoAndList.get(q).getPromoId().toString(), true, username, visit_date, CounterId);
////checking AND promo itemcount
if (product_countfor_and >= promoAndList.get(q).getItemCount()) {
db.open();
db.update_temp_promo_apply_definitionfor_andpromo(promoAndList.get(q).getId(), CounterId, username,
promoAndList.get(q).getPromoId(), visit_date);
db.update_temp_promo_apply_definitionfor_andpromo(promoAndList.get(q).getId(), CounterId, username, promoAndList.get(q).getPromoId(), visit_date);
} else {
db.open();
flag_for_and = false;
@@ -4542,7 +4586,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
break;
}
}
if (flag_for_and) {
//////--------insert all AND Promo data to Apply Definition.Table...-----------
db.open();
@@ -4553,17 +4596,22 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
} else {
db.open();
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 >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
db.open();
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
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()) {
runOnUiThread(() -> {
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);
});
} else {
///finish
checkPromoWorth(promoMaster);
@@ -4606,7 +4653,6 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
break;
}
}
if (flag_for_and) {
//////--------insert all AND Promo data to Apply Definition.Table...-----------
db.open();
@@ -4617,12 +4663,19 @@ public class ConsumerUserDetailsActivity extends AppCompatActivity implements Vi
} else {
db.open();
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 >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
db.open();
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
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 {
db.open();
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 >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
db.open();
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
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 {
db.open();
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 >= Integer.parseInt(promoMaster.get(x).getPromotionSetEntityValue())) {
if (promoSetEntityValues.contains("|") && promoSetEntityValues.split("\\|").length == 2 && isCostInRange(promoSetEntityValues, product_count, promoMaster.get(x))) {
db.open();
db.update_temp_promo_apply_definition(CounterId, username, promoMaster.get(x).getPromoId().toString(), visit_date);
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;
}
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) {
for (File value : file) arrayFiles.add(value.getName());
}
return arrayFiles;
}
@@ -239,7 +238,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
}
void getQuizProfileData() {
hashMapAnsListChildData = new HashMap<>();
childListData = new ArrayList<>();
@@ -359,7 +357,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
}
});
expandableListView.clearFocus();
}
@@ -1047,7 +1044,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
round_img_pic.setImageBitmap(bitmp);
}
} 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 {
bitmp = BitmapFactory.decodeResource(getResources(), R.mipmap.profile_image);
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();
}
}
}
@@ -784,17 +784,42 @@ public class ConsumerReturnActivity extends AppCompatActivity implements View.On
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) {
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++) {
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_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
} else if (filterType == FILTER_FOR_SUB_BRAND) {
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
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_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();
}
}*/
final int CLEAR_FILTER = 0;
final int FILTER_FOR_BRAND = 1;
@@ -91,6 +91,10 @@ public class CounterImageActivity extends AppCompatActivity implements
db = new Lorealba_Database(context);
db.open();
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() {
@@ -456,11 +460,11 @@ public class CounterImageActivity extends AppCompatActivity implements
super.onResume();
db.open();
checkgpsEnableDevice();
if (!db.isBaProfileFilled(counter_id, username, user_type)) {
/*if (!db.isBaProfileFilled(counter_id, username, user_type)) {
showAlertProfile(context);
} else if (db.getSaveServerData(null, username).isEmpty()) {
showAlertProfile(context);
}
}*/
}
private void checkgpsEnableDevice() {
@@ -763,12 +763,14 @@ public class ManualInWardStockActivity extends AppCompatActivity implements View
flag_filter_by_edt = false;
try {
dialog_brand_Id = adapterView.getSelectedItem().toString();
Log.d("spinner_error", dialog_brand_Id);
setFilter(FILTER_FOR_BRAND, dialog_product_spin);
setSubBrandSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "SubBrandName", "SubBrandId",
"BrandName", null, visit_date, counter_id, false, null), dialog_sub_brand_spin);
setReferenceSpinnerData(db.getsub_brand_using_brand_Id(dialog_brand_Id, "ReferenceName", "ReferenceId",
"BrandName", null, visit_date, counter_id, false, null), dialog_franchise_spin);
} catch (Exception e) {
Log.d("spinner_ex", e.getMessage());
throw new RuntimeException(e);
}
} else {
@@ -936,53 +938,36 @@ public class ManualInWardStockActivity extends AppCompatActivity implements View
public void setFilter(int filterType, Spinner dialog_spin) {
if (filterType == FILTER_FOR_BRAND) {
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
dialog_sku_adapter.add("- Select Product -");
List<ProductMaster> filteredList = new ArrayList<>();
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_spin.setAdapter(dialog_sku_adapter);
dialog_sku_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
} else if (filterType == FILTER_FOR_SUB_BRAND) {
dialog_sku_adapter = new ArrayAdapter<>(context, R.layout.spinner_custom_item);
dialog_sku_adapter.add("- Select Product -");
for (int i = 0; i < filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).size(); i++) {
dialog_sku_adapter.add(filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).get(i).getProductName() + " - (MRP-" +
filterListForSubBrand(dialog_product_list, dialog_sub_brand_Id, dialog_brand_Id).get(i).getMrp().toString() + ")");
}
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);
// Filter only 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);
break;
default:
filteredList = dialog_product_list;
break;
}
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);
}
@@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
@@ -145,7 +146,6 @@ public class SkinGeniusScreenshotActivity extends AppCompatActivity implements V
@SuppressLint("NonConstantResourceId")
@Override
public void onClick(View v) {
if (v.getId() == R.id.img_cam_selfie) {
browseDocuments();
} else if (v.getId() == R.id.save_skin_genius) {
@@ -182,82 +182,63 @@ public class SkinGeniusScreenshotActivity extends AppCompatActivity implements V
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
}
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.setType("*/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(Intent.createChooser(intent, "Choose Skin Genius Screenshot"), FILE_PICKER_CODE);
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(
Intent.createChooser(intent, "Choose Skin Genius Screenshot"),
FILE_PICKER_CODE
);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (resultCode == Activity.RESULT_OK) {
if (requestCode == FILE_PICKER_CODE) {
Uri uri = data.getData();
assert uri != null;
String uriString = uri.toString();
String displayName = null;
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (uriString.startsWith("content://")) {
try (Cursor cursor = getContentResolver().query(uri, null, null, null, null)) {
if (cursor != null && cursor.moveToFirst()) {
displayName = CounterId + username.replace(".", "") + "-SkinGenius-" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
}
}
} else if (uriString.startsWith("file://")) {
displayName = CounterId + username.replace(".", "") + "-SkinGenius-" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
if (requestCode == FILE_PICKER_CODE && resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
if (uri == null) return;
String displayName =
CounterId +
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;
sourceLocation = FileUtils.getFile(context, uri);
File targetLocation = new File(CommonString.getImagesFolder(context) + displayName);
if (sourceLocation != null) {
InputStream in = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
in = Files.newInputStream(sourceLocation.toPath());
} else {
in = new FileInputStream(sourceLocation);
}
OutputStream out = null;
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();
img_str = displayName;
if (targetFile.exists()) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2; // prevent OOM
Bitmap bitmap = BitmapFactory.decodeFile(
targetFile.getAbsolutePath(), options
);
img_cam.setImageBitmap(bitmap);
img_clicked.setVisibility(View.GONE);
img_cam.setVisibility(View.VISIBLE);
}
} catch (Exception e) {
e.fillInStackTrace();
AlertandMessages.showToastMsg(this, "Image load failed");
}
}
super.onActivityResult(requestCode, resultCode, data);
}
}
@@ -2,7 +2,6 @@ package com.cpm.lorealbaautomation.dailyactivity;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.checkNetIsAvailable;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCurrentTime;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -11,13 +10,10 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Environment;
@@ -27,7 +23,6 @@ import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
@@ -35,20 +30,16 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
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.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.LocationSettingsRequest;
import com.google.android.gms.location.Priority;
import com.google.android.gms.location.SettingsClient;
import com.google.gson.Gson;
import com.cpm.lorealbaautomation.BuildConfig;
import com.cpm.lorealbaautomation.Database.Lorealba_Database;
import com.cpm.lorealbaautomation.DealarBoardActivity;
import com.cpm.lorealbaautomation.R;
import com.cpm.lorealbaautomation.constant.AlertandMessages;
@@ -95,13 +86,17 @@ import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import android.content.SharedPreferences;
public class StoreImageActivity extends AppCompatActivity implements View.OnClickListener {
private static final int PERMISSION_ALL = 99;
private Button btn_save;
private ImageView img_cam, img_clicked;
private String _pathforcheck, _path, str, img_str, selfie_imge, visit_date, username, counter_id, userType;
private Lorealba_Database db;
private LocationEngine locationEngine;
private Runnable run;
private boolean isGeoTagAlertShown = false;
private Toolbar toolbar;
private ProgressDialog loading;
private Retrofit adapter;
@@ -113,11 +108,14 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
private FusedLocationProviderClient fusedLocationClient = null;
private LocationCallback locationCallback = null;
private SharedPreferences.Editor editor = null;
private boolean isLocationFetching = false;
private ProgressBar locationLoader;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store_image);
locationEngine = new LocationEngine(this);
db = new Lorealba_Database(this);
db.open();
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);
img_cam = (ImageView) findViewById(R.id.img_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);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@@ -165,9 +170,8 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
} catch (Exception e) {
e.fillInStackTrace();
}
checkAndRequestPermissions();
getLastLocation();
fetchLocationAndCheckGeoFence();
}
private void checkdates() {
@@ -205,7 +209,6 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.img_cam_selfie) {
clickFlag = true;
_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();
}
}
return super.onOptionsItemSelected(item);
}
private void AttempBaCoverage(final ProgressDialog loading, Context context) {
try {
getMid();
@@ -545,8 +546,7 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
}
} else {
/// checking GeoFencing
getLastLocation();
checkingGeoFencing(getMid());
fetchLocationAndCheckGeoFence();
}
}
@@ -557,14 +557,13 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
success_geoTag = true;
}
if (!success_geoTag) {
getLastLocation();
checkingGeoFencing(getMid());
fetchLocationAndCheckGeoFence();
}
checkgpsEnableDevice();
// checkgpsEnableDevice();
getMid();
}
private void checkgpsEnableDevice() {
/*private void checkgpsEnableDevice() {
if (!hasGPSDevice(this)) {
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() {
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, // priority
5000 // intervalMillis: 5 seconds
).setMinUpdateIntervalMillis(3000) // fastest interval
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
.setMinUpdateIntervalMillis(3000)
.setMaxUpdateDelayMillis(6000)
.setMinUpdateDistanceMeters(0f)// Optional batching
.setWaitForAccurateLocation(true) // Optional, improves first fix
.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.checkLocationSettings(builder.build()).addOnSuccessListener(locationSettingsResponse -> {
// All location settings are satisfied. You can request location updates here.
}).addOnFailureListener(e -> {
if (e instanceof ResolvableApiException) {
try {
ResolvableApiException resolvable = (ResolvableApiException) e;
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
} catch (IntentSender.SendIntentException sendEx) {
// Ignore the error.
sendEx.fillInStackTrace();
settingsClient.checkLocationSettings(builder.build())
.addOnSuccessListener(locationSettingsResponse -> {
// All location settings are satisfied, start updates
startLocationUpdates(locationRequest);
})
.addOnFailureListener(e -> {
if (e instanceof ResolvableApiException) {
try {
ResolvableApiException resolvable = (ResolvableApiException) e;
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) {
final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
if (mgr == null) return false;
final List<String> providers = mgr.getAllProviders();
if (providers == null) return false;
return providers.contains(LocationManager.GPS_PROVIDER);
}
}*/
private void DownloadJCP(final Context context, final ProgressDialog loading) {
try {
@@ -641,9 +676,9 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
if (jcpObject != null && db.insertJCPData(jcpObject)) {
Log.d("jcpdatanew","jcp data inserted");
/// checking GeoFencing
getLastLocation();
checkingGeoFencing(getMid());
fetchLocationAndCheckGeoFence();
AlertandMessages.showToastMsg(context, "Journey Plan Download Successfully.");
JourneyPlan jcp = db.getBIDfromJCP(username, counter_id);
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));
if (allPermissionsGranted) {
getLastLocation();
fetchLocationAndCheckGeoFence();
} else {
//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)) {
@@ -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) {
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
}
// fastest interval
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000).setMinUpdateIntervalMillis(3000) // fastest interval
.build();
locationCallback = new LocationCallback() {
@Override
public void onLocationResult(@NonNull LocationResult locationResult) {
for (Location location : locationResult.getLocations()) {
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
checkAndRequestPermissions();
return;
}
// First, try to get the last known location
fusedLocationClient.fetchLocationAndCheckGeoFence()
.addOnSuccessListener(location -> {
if (location != null) {
lat = location.getLatitude();
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)
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// Request permissions if not granted
!= PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
checkAndRequestPermissions();
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() {
if (fusedLocationClient != null && locationCallback != null) {
@@ -861,27 +1003,44 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
@Override
public void onDestroy() {
super.onDestroy();
stopLocationUpdates();
// stopLocationUpdates();
if (loading != null && loading.isShowing()) {
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.getGeoTag() != null && !jcp.getGeoTag().equalsIgnoreCase(CommonString.KEY_N) && jcp.getGeoFencingAllow() != null && jcp.getGeoFencingAllow() == 1) {
int distance = jcp.getGeoFencingRadius() != null ? jcp.getGeoFencingRadius() : 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) {
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);
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) +
"\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);
builder.setTitle(getResources().getString(R.string.alert));
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
dialog1.cancel();
dialog1.dismiss();
finishAffinity();
});
AlertDialog alert = builder.create();
@@ -889,18 +1048,32 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
}
}
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getString(R.string.first_geotag_the_store)).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), (dialog1, id) -> {
dialog1.cancel();
success_geoTag = false;
Intent in = new Intent(this, GeoTaggingActivity.class);
startActivity(in);
});
AlertDialog alert = builder.create();
alert.show();
if (isFinishing() || isDestroyed()) {
return;
}
db.open();
Log.d("jcpdata", jcp.getGeoTag());
if (jcp.getGeoTag() != null && !jcp.getGeoTag().equalsIgnoreCase(CommonString.KEY_Y) && !isGeoTagAlertShown) {
isGeoTagAlertShown = true;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.dialog_title));
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.PackageManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.InputFilter;
import android.text.Spanned;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
@@ -72,7 +69,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
@@ -355,9 +351,9 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
jsonObject.put("IMEINumber1", "0");
jsonObject.put("IMEINumber2", "0");
}
}
String jsonString = jsonObject.toString();
// Log.e("loginjson", jsonString);
try {
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")) {
loading.dismiss();
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")) {
loading.dismiss();
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_LOGIN_NO_DATA);
@@ -458,7 +459,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
dialogInterface.dismiss();
finish();
});
builder.show();
} else {
Intent in = new Intent(getApplicationContext(), PinViewActivity.class);
@@ -477,7 +477,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
finish();
loading.dismiss();
}
}
} catch (Exception e) {
e.fillInStackTrace();
@@ -489,20 +488,17 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_NO_RESPONSE_SERVER);
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
loading.dismiss();
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION);
}
});
}
} catch (Exception e) {
loading.dismiss();
e.fillInStackTrace();
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
}
} else {
loading.dismiss();
@@ -526,11 +522,9 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClickL
e.fillInStackTrace();
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
}
} catch (PackageManager.NameNotFoundException | JSONException e) {
loading.dismiss();
AlertandMessages.showAlertlogin(TabLoginActivity.this, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e + ")");
}
}
@@ -280,6 +280,7 @@ public class Downloader extends JobIntentService {
}
storeDetail.put(jsonObject);
}
Log.d("uploadProfiledata",storeDetail.toString());
JSONObject jsonFinalObject = new JSONObject();
jsonFinalObject.put("MID", mid);
jsonFinalObject.put("Keys", "BaProfileData");
@@ -664,7 +665,7 @@ public class Downloader extends JobIntentService {
}
}
}
Log.e("finalList", "Downloader"+finalList.toString());
if (!finalList.isEmpty()) {
filename = "";
for (int i = 0; i < finalList.size(); i++) {
@@ -708,10 +709,8 @@ public class Downloader extends JobIntentService {
} else {
foldername = "BulkUpload";
}
filename = finalList.get(i);
}
break;
}
@@ -759,8 +758,10 @@ public class Downloader extends JobIntentService {
UploadImageRecursive();
}
} catch (Exception e) {
Log.e("finalList", "Downloader"+e.toString());
e.fillInStackTrace();
} catch (OutOfMemoryError error) {
Log.e("finalList", "Downloader"+error.toString());
statusforimage[0] = -1;
error.fillInStackTrace();
}
@@ -768,15 +769,15 @@ public class Downloader extends JobIntentService {
@Override
public void onFailure(Throwable t) {
Log.e("finalList", "Downloader"+t.toString());
if (t instanceof IOException || t instanceof SocketTimeoutException || t instanceof SocketException) {
statusforimage[0] = -1;
}
}
});
}
} catch (JsonSyntaxException e) {
e.fillInStackTrace();
} catch (Exception e) {
Log.e("finalList", "Downloader"+e.toString());
e.fillInStackTrace();
}
}
@@ -72,9 +72,8 @@ public class BAdvisorMenuFragment extends Fragment {
user_type = preferences.getString(CommonString.KEY_USER_TYPE, "");
((DealarBoardActivity) requireActivity()).setBaMenuRefreshListener(value -> {
// Set the adapter
if (view instanceof RecyclerView) {
if (view instanceof RecyclerView recyclerView) {
Context context = view.getContext();
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setAdapter(new MyAdaperForIcon(context, getdata(value), value));
recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
}
@@ -85,7 +84,7 @@ public class BAdvisorMenuFragment extends Fragment {
public List<NavMenuItemGetterSetter> getdata(String value) {
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();
String saleable_status = db.getStatus(CommonString.KEY_SaleableStatus, counterId);
if (value.equals("1")) {
@@ -98,6 +97,7 @@ public class BAdvisorMenuFragment extends Fragment {
leave_mangment = R.mipmap.leave_m_grey;
}
ba_survey = R.mipmap.ba_survey;
ba_assessment = R.mipmap.ba_assessment;
ba_skin_genius = R.mipmap.vto_grey;
} else if (value.equals("2")) {
@@ -110,6 +110,7 @@ public class BAdvisorMenuFragment extends Fragment {
}
ba_training = R.mipmap.training;
ba_survey = R.mipmap.ba_survey;
ba_assessment = R.mipmap.ba_assessment;
ba_skin_genius = R.mipmap.vto_grey;
} else {
db.open();
@@ -131,9 +132,11 @@ public class BAdvisorMenuFragment extends Fragment {
leave_mangment = R.mipmap.leave_management;
}
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) {
consumer_return = R.mipmap.consumer_return;
consumer_interaction = R.mipmap.consumer_interaction;
@@ -150,6 +153,7 @@ public class BAdvisorMenuFragment extends Fragment {
leave_mangment = R.mipmap.leave_management;
}
ba_survey = R.mipmap.ba_survey;
ba_assessment = R.mipmap.ba_assessment;
} else {
if (complete) {
@@ -169,15 +173,16 @@ public class BAdvisorMenuFragment extends Fragment {
leave_mangment = R.mipmap.leave_management;
}
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};
String[] name = {"Grooming Image", "Consumer Interaction", "Consumer Return", "Break Management", "Training", "BA Survey", "VTO"};
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","BA Assessment", "VTO"};
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"};
img = new int[]{groomed_img, consumer_interaction, consumer_return, break_mangment, leave_mangment, ba_training, ba_survey, ba_skin_genius};
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_assessment, ba_skin_genius};
}
for (int i = 0; i < img.length; i++) {
NavMenuItemGetterSetter recData = new NavMenuItemGetterSetter();
@@ -21,6 +21,7 @@ import com.cpm.lorealbaautomation.constant.AlertandMessages;
import com.cpm.lorealbaautomation.constant.CommonString;
import com.cpm.lorealbaautomation.consumeractivity.ConsumerIntractionDetailActivity;
import com.cpm.lorealbaautomation.dailyactivity.BASurveyListActivity;
import com.cpm.lorealbaautomation.dailyactivity.BaAssessmentActivity;
import com.cpm.lorealbaautomation.dailyactivity.ConsumerReturnActivity;
import com.cpm.lorealbaautomation.dailyactivity.CounterImageActivity;
import com.cpm.lorealbaautomation.dailyactivity.CounterProfileActivity;
@@ -178,6 +179,8 @@ public class MyAdaperForIcon extends RecyclerView.Adapter<MyAdaperForIcon.ViewHo
db.deleteBASurveyData(counter_id, visit_date);
}
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) {
db.open();
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.content.ContextCompat;
import com.cpm.lorealbaautomation.LocationEngine;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
@@ -106,48 +107,105 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
geocoder = new Geocoder(this);
declaration();
fab.setOnClickListener(view -> {
/*fab.setOnClickListener(view -> {
try {
startLocationUpdates();
if (!img_str.isEmpty()) {
if (db.InsertSTOREgeotag(jcpGetset.getStoreId().toString(), counter_id, jcpGetset.getBID().toString(), username, latitude, longitude, img_str) > 0) {
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");
}
startLocationUpdates(true);
} else {
AlertandMessages.showToastMsg(view.getContext(), getResources().getString(R.string.takeimage));
}
} catch (Exception e) {
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 -> {
try {
if (checkNetIsAvailable(view.getContext())) {
if (latitude != 0.0 && longitude != 0.0) {
_pathforcheck = jcpGetset.getStoreId().toString() + "-" + jcpGetset.getCounterId().toString() +
"-" + jcpGetset.getBID().toString() + "_GeoTag-" + jcpGetset.getVisitDate().replace("/", "")
+ "_" + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context) + _pathforcheck;
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
} else {
AlertandMessages.showToastMsg(context, "Please wait for location");
}
if (latitude != 0.0 && longitude != 0.0) {
_pathforcheck = jcpGetset.getStoreId().toString() + "-" + jcpGetset.getCounterId().toString() +
"-" + jcpGetset.getBID().toString() + "_GeoTag-" + jcpGetset.getVisitDate().replace("/", "")
+ "_" + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context) + _pathforcheck;
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
} else {
AlertandMessages.showToastMsg(context, getResources().getString(R.string.nonetwork));
AlertandMessages.showToastMsg(context, "Please wait for location");
}
} catch (Exception e) {
e.fillInStackTrace();
}
});
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION);
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION
}, LOCATION_PERMISSION_REQUEST_CODE);
}
locationCallback = new LocationCallback() {
@Override
@@ -167,7 +225,6 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
if (distance > 10) {
previousLatitude = latitude;
previousLongitude = longitude;
updateMapWithLocation(latitude, longitude);
}
}
@@ -176,24 +233,86 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
}
};
}
private void startLocationUpdates() {
@SuppressLint("VisibleForTests") LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
private void startLocationUpdates(boolean save) {
LocationRequest locationRequest = new LocationRequest.Builder(
Priority.PRIORITY_HIGH_ACCURACY, 2000)
.setMinUpdateIntervalMillis(1000)
.setMaxUpdateDelayMillis(3000)
.setWaitForAccurateLocation(true)
.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 {
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) {
if (geocoder != null && mMap != null) {
Log.e("jeevanp", "" + lat);
String address = "";
try {
List<Address> addressList = geocoder.getFromLocation(lat, lon, 1);
if (addressList != null && !addressList.isEmpty()) {
address = addressList.get(0).getAddressLine(0);
@@ -232,48 +351,108 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.getUiSettings().setCompassEnabled(true);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(22.5726, 88.3639), 15));
// Enable My Location layer
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); // this shows blue dot
mMap.getUiSettings().setMyLocationButtonEnabled(true); // this shows the GPS icon
startLocationUpdates();
// REMOVE this (causes 0,0 jump)
// mMap.moveCamera(...)
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);
// Use LocationEngine instead
fetchMapLocation();
} else {
// request permission
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);
}
}
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
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
boolean locationGranted = false;
for (int i = 0; i < grantResults.length; i++) {
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
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
protected void onResume() {
super.onResume();
checkgpsEnableDevice();
// checkgpsEnableDevice();
}
@Override
protected void onStart() {
super.onStart();
startLocationUpdates();
startLocationUpdates(false);
}
@@ -327,9 +506,6 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
if (mapFragment != null) {
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 {
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
} catch (PackageManager.NameNotFoundException ignored) {
@@ -363,14 +539,12 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
@Override
protected String doInBackground(Void... params) {
try {
// uploading Geotag
uploadflag = false;
geotaglist = db.getinsertGeotaggingData(jcpGetset.getStoreId().toString(), counter_id, username, CommonString.KEY_N);
if (!geotaglist.isEmpty()) {
String jsonString2 = getString();
Log.e("jsonString2", jsonString2);
// Log.e("jsonString2", jsonString2);
String result = upload.downloadDataUniversal(jsonString2);
Log.e("jsonString2", result);
// Log.e("jsonString2", result);
if (result.equalsIgnoreCase(CommonString.MESSAGE_NO_RESPONSE_SERVER)) {
uploadflag = false;
throw new SocketTimeoutException();
@@ -423,7 +597,7 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
@NonNull
private JSONObject getJsonObject(int j) throws JSONException {
JSONObject obj = new JSONObject();
obj.put("UserId",username);
obj.put("UserId", username);
obj.put("StoreId", geotaglist.get(j).getStoreid());
obj.put("CounterId", geotaglist.get(j).getCounterId());
obj.put("bID", geotaglist.get(j).getBid());
@@ -440,7 +614,8 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
dialog.dismiss();
if (result != null && result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
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 = "";
AlertandMessages.showToastMsg(context, "Geotag Saved Successfully");
finish();
@@ -469,19 +644,17 @@ public class GeoTaggingActivity extends AppCompatActivity implements OnMapReadyC
}
private void enableLocationSettings() {
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, // priority
5000 // intervalMillis: 5 seconds
).setMinUpdateIntervalMillis(3000) // fastest interval
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5000)
.setMinUpdateIntervalMillis(3000)
.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.checkLocationSettings(builder.build()).addOnSuccessListener(locationSettingsResponse -> {
// All location settings are satisfied. You can request location updates here.
}).addOnFailureListener(e -> {
if (e instanceof ResolvableApiException) {
if (e instanceof ResolvableApiException resolvable) {
try {
ResolvableApiException resolvable = (ResolvableApiException) e;
resolvable.startResolutionForResult((Activity) this, REQUEST_LOCATION);
} catch (IntentSender.SendIntentException sendEx) {
// Ignore the error.
@@ -99,16 +99,7 @@ public class MPinActivity extends AppCompatActivity implements
blurLockView.setTypeface(getTypeface());
blurLockView.setOnLeftButtonClickListener(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);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
@@ -171,10 +162,6 @@ public class MPinActivity extends AppCompatActivity implements
int incorrect_times = blurLockView.getIncorrectInputTimes();
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);
View view = snackbar.getView();
/*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.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
@@ -81,7 +82,6 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class
PinViewActivity extends AppCompatActivity implements View.OnClickListener {
private String counterId = "";
private final String visitdate = "";
private String Update_Visit_Date;
private String userType;
Pinview pinview_confirm, pinview_start;
@@ -141,9 +141,12 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
}
getDeviceName();
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 ACCESS_NETWORK_STATE = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_NETWORK_STATE);
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()) {
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_ALL);
return false;
}
return true;
}
private void showDialogOK(String message, DialogInterface.OnClickListener okListener) {
@@ -364,7 +365,6 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
os_version = Build.VERSION.RELEASE;
}
@SuppressLint("NonConstantResourceId")
@Override
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())) {
AlertandMessages.showToastMsg(context, "Your MPIN Does Not Match From Inserted Database");
} 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)) {
AttempLogin();
} else {
@@ -441,8 +447,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
finish();
}
}
}
}*/
} else if (v.getId() == R.id.btn_clear) {
hideKeyboard(this);
@@ -482,12 +487,11 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
private void AttempLogin() {
try {
loading = ProgressDialog.show(context, "Processing", "Please wait...", false, false);
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
JSONObject jsonObject = new JSONObject();
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("Latitude", lat);
jsonObject.put("Longitude", lon);
@@ -518,6 +522,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
}
String jsonString = jsonObject.toString();
Log.d("pinviewjson", jsonString);
try {
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).
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")) {
loading.dismiss();
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)) {
AlertandMessages.showAlertlogin((Activity) context, CommonString.KEY_FAILURE + " Please try again");
loading.dismiss();
@@ -587,7 +597,7 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
loginGetterSetter = new LoginGetterSetter();
loginGetterSetter.setUserId(user_id);
loginGetterSetter.setPassword(allLoginData.get(0).getPassword());
loginGetterSetter.setVisitDate(visitdate);
loginGetterSetter.setVisitDate(visit_date);
loginGetterSetter.setUserType(userType);
if (data_login_Tym != null) {
loginGetterSetter.setUserLoginTym(data_login_Tym.getLoginTime().get(0).getLoginTime());
@@ -610,6 +620,12 @@ PinViewActivity extends AppCompatActivity implements View.OnClickListener {
builder.show();
} else {
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.get(0).getImg().isEmpty()) {
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);
finish();
} else {
//Toast.makeText(context,"Success",Toast.LENGTH_SHORT).show();
Intent in = new Intent(context, DealarBoardActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -355,7 +355,6 @@ public class ReportDayWiseActivity extends AppCompatActivity {
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
call_adapter(context);
} else if (!data.contains("No Data")) {
if (loading != null && loading.isShowing()) {
@@ -89,7 +89,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
this.context = context;
this.db = db;
this.pd = pd;
preferences = PrefHelper.getPrefs(context);
preferences = PrefHelper.getPrefs(context);
editor = preferences.edit();
date = preferences.getString(CommonString.KEY_DATE, "");
counterId = preferences.getString(CommonString.KEY_COUNTER_ID, "");
@@ -144,7 +144,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
} else {
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
editor.apply();
Log.d("JSON_DATA",data);
Log.d("JSON_DATA", data);
new MyLoader(context, finalKeyName, data).execute();
}
}
@@ -336,7 +336,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
case "Mapping_JourneyPlan":
if (!data.contains("No Data")) {
Log.d("JSON_DATA",data);
Log.d("JSON_DATA", data);
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
@@ -425,6 +425,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
pd.dismiss();
AlertandMessages.showToastMsg(context, "Master_Posm data not saved");
}
} else {
db.open();
db.delete_table_data("Master_Posm");
}
break;
@@ -438,6 +441,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
pd.dismiss();
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) {
throw new java.lang.Exception();
}
} else {
db.delete_table_data("T_StockSummary");
}
break;
@@ -506,8 +514,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
db.open();
db.delete_table_data("T_CounterInvoice");
}
break;
case "Master_NonVisibility":
@@ -526,7 +532,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
break;
case "Master_NonStockReason":
if (!data.contains("No Data")) {
masterNonStockReasonObj = new Gson().fromJson(data, MasterNonStockReasonGetterSetter.class);
@@ -540,7 +545,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
db.delete_table_data("Master_NonStockReason");
}
break;
//jp
case "Master_SkinType":
@@ -579,6 +583,9 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
pd.dismiss();
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();
}
break;
case "Master_TermsCondition":
if (!data.contains("No Data")) {
termConditionObject = new Gson().fromJson(data, MasterProfileQuestionGetterSetter.class);
@@ -834,7 +839,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
db.delete_table_data("Report_Top10Volume");
}
break;
case "Report_Top10Value":
@@ -882,6 +886,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
break;
case "Master_PromoOffers":
Log.e("Master_PromoOffers",data);
if (!data.contains("No Data")) {
masterPromoOfferObject = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
db.open();
@@ -1600,7 +1605,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
if (!data.contains("No Data")) {
TesterCounter testerCounter = new Gson().fromJson(data, TesterCounter.class);
db.open();
if (testerCounter != null && testerCounter.getReportTesterCounter()!=null && !db.insertTesterCounter(testerCounter)) {
if (testerCounter != null && testerCounter.getReportTesterCounter() != null && !db.insertTesterCounter(testerCounter)) {
pd.dismiss();
AlertandMessages.showToastMsg(context, "Report_TesterCounter not saved");
}
@@ -1806,7 +1811,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
break;
case "T_LeaveLedgerSummary":
case "T_LeaveLedgerSummary":
if (!data.contains("No Data")) {
ResponseResult leaveLedger = new Gson().fromJson(data, ResponseResult.class);
db.open();
@@ -1823,7 +1828,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
case "Mapping_AppRestrictedKPI":
if (!data.contains("No Data")) {
MasterBAProfileGetterSetter mappingAppRestrictedKPIGetterSetter = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
MasterBAProfileGetterSetter mappingAppRestrictedKPIGetterSetter = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
db.open();
if (mappingAppRestrictedKPIGetterSetter != null && !db.insertMappingAppRestrictedKPI(mappingAppRestrictedKPIGetterSetter)) {
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.apply();
}
int incorrect_tStockSummery = preferences.getInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + date, 0);
if (incorrect_tStockSummery != 0) {
if (incorrect_tStockSummery == 1) {
@@ -1963,7 +1967,6 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
}
}
}
} catch (Exception e) {
e.fillInStackTrace();
}
@@ -1987,12 +1990,10 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
int bytes = 0;
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is1.read(buffer)) != -1) {
bytes = (bytes + len1);
fos.write(buffer, 0, len1);
}
fos.close();
is1.close();
}
@@ -2058,7 +2059,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
} else {
data_global[0] = data;
if (finalKeyName.equalsIgnoreCase("Table_Structure")) {
Log.d("JSON_DATA",data);
Log.d("JSON_DATA", data);
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
editor.apply();
tableStructureObj = new Gson().fromJson(data, TableStructureGetterSetter.class);
@@ -2076,7 +2077,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
baListObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
if (baListObject != null && !db.insertBalistData(baListObject)) {
AlertandMessages.showSnackbarMsg(context, "Ba List data not saved");
AlertandMessages.showToastMsg(context, "Ba List data not saved");
}
} else {
throw new java.lang.Exception();
@@ -2088,7 +2089,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
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.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 testfilename = filename;
testfilename = testfilename.substring(testfilename.indexOf("-") + 1);
@@ -1,13 +1,10 @@
package com.cpm.lorealbaautomation.retrofit;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.ResponseBody;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import retrofit.Converter;
/**
@@ -41,11 +38,7 @@ class StringConverter implements Converter<String> {
}
private static byte[] convertToBytes(String string) {
try {
return string.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
return string.getBytes(StandardCharsets.UTF_8);
}
}
@@ -1,5 +1,6 @@
package com.cpm.lorealbaautomation.timer;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -47,10 +48,8 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class TimerActivity extends AppCompatActivity {
String process_data_Status = "", visit_date, username, counter_id;
SharedPreferences preferences = null;
SharedPreferences.Editor editor = null;
Lorealba_Database db;
Context context;
Timer timer;
TimerTask 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) {
db.open();
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 {
JSONObject jsonObject = new JSONObject();
jsonObject.put("Downloadtype", service_name);
jsonObject.put("Downloadtype", CommonString.Key_Download_Status);
jsonObject.put("Username", "");
jsonObject.put("Param1", counter_id);
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();
PostApi api = adapter.create(PostApi.class);
Call<ResponseBody> call = api.getTabjournePlan(jsonData);
call.enqueue(new Callback<ResponseBody>() {
call.enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
ResponseBody responseBody = response.body();
@@ -174,14 +173,13 @@ public class TimerActivity extends AppCompatActivity {
data = data.substring(1, data.length() - 1).replace("\\", "");
if (data.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
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")) {
JCPGetterSetter jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
if (jcpObject != null && jcpObject.getDownloadStatus() != null) {
process_data_Status = jcpObject.getDownloadStatus().get(0).getDownloadStatus().trim();
if (process_data_Status.equalsIgnoreCase("Wait")) {
} else {
if (!process_data_Status.equalsIgnoreCase("Wait")) {
///finsh
stoptimertask();
startActivity(new Intent(context, DealarBoardActivity.class));
@@ -196,7 +194,7 @@ public class TimerActivity extends AppCompatActivity {
} catch (Exception e) {
process_data_Status = "";
e.fillInStackTrace();
AlertandMessages.showToastMsg((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_SOCKETEXCEPTION + "(" + e.toString() + ")");
}
} else {
process_data_Status = "";
@@ -207,7 +205,7 @@ public class TimerActivity extends AppCompatActivity {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
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();
db.open();
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
startActivity(new Intent(context, DealarBoardActivity.class));
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -238,6 +236,7 @@ public class TimerActivity extends AppCompatActivity {
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
// super.onBackPressed();
@@ -16,6 +16,7 @@ import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -70,6 +71,7 @@ import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import retrofit.Converter;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -1841,7 +1843,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
@SuppressLint("NonConstantResourceId")
@Override
public void onClick(View view) {
if (view.getId() == R.id.img_manual_dataupload) {
if (CommonFunctions.checkNetIsAvailable(context)) {
masterList = db.getmasterTransaction(visit_date, counter_Id, true);
@@ -1864,8 +1865,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
} else {
AlertandMessages.showToastMsg(context, getString(R.string.nonetwork));
}
} else if (view.getId() == R.id.img_manual_imageupload) {
if (CommonFunctions.checkNetIsAvailable(context)) {
upload_imagewithfolder();
@@ -1922,6 +1921,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
}
}
Log.e("finalList", finalList.toString());
if (!finalList.isEmpty()) {
filename = "";
for (int i = 0; i < finalList.size(); i++) {
@@ -1966,7 +1966,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
} else {
foldername = "BulkUpload";
}
filename = finalList.get(i);
}
break;
@@ -1999,6 +1998,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
@Override
public void onResponse(retrofit.Response<String> response) {
try {
Log.e("finalList", response.toString());
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_")) {
db.open();
@@ -2006,7 +2006,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
} else {
finalFile1.delete();
}
statusforimage[0] = 1;
uploadedFiles[0]++;
} else {
@@ -2015,7 +2014,6 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
if (statusforimage[0] == 0) {
pd.dismiss();
AlertandMessages.showAlertlogin((Activity) context, "Image not uploaded.Please try again." + "\n" + uploadedFiles + " images uploaded out of " + totalFiles);
} else {
if (totalFiles == uploadedFiles[0]) {
pd.dismiss();
@@ -2026,6 +2024,7 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
}
}
} catch (Exception e) {
Log.e("finalList", e.toString());
e.fillInStackTrace();
statusforimage[0] = -1;
pd.dismiss();
@@ -11,6 +11,7 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
@@ -53,6 +54,7 @@ import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import retrofit.Converter;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -1854,6 +1856,7 @@ public class UploadKeyData extends AppCompatActivity implements View.OnClickList
}
}
Log.e("finalList", finalList.toString());
if (!finalList.isEmpty()) {
filename = "";
for (int i = 0; i < finalList.size(); i++) {
@@ -1993,6 +1996,7 @@ public class UploadKeyData extends AppCompatActivity implements View.OnClickList
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
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_centerInParent="true"
android:layout_gravity="center"
android:visibility="visible"
android:layout_margin="@dimen/custom_margin"
android:adjustViewBounds="true"
android:src="@mipmap/profile_image" />
@@ -25,6 +25,13 @@
android:gravity="center"
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
android:id="@+id/img_selfie"
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_centerInParent="true"
android:layout_gravity="center"
android:visibility="visible"
android:layout_margin="@dimen/custom_margin"
android:adjustViewBounds="true"
android:src="@mipmap/profile_image" />
@@ -25,6 +25,13 @@
android:layout_margin="@dimen/margin_30dp"
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
android:id="@+id/img_selfie"
android:layout_width="match_parent"
@@ -6,7 +6,8 @@
android:orientation="vertical"
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:layout_width="match_parent"
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

+10 -2
View File
@@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
<!-- 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>
+1 -1
View File
@@ -4,7 +4,7 @@ android {
namespace("com.androidbuts.multispinnerfilter")
compileSdk(35)
defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdk(35)
}
buildTypes {
@@ -0,0 +1 @@
i/classes_global-synthetics
@@ -0,0 +1 @@
i/classes_global-synthetics
@@ -0,0 +1 @@
o/classes
@@ -0,0 +1 @@
i/classes_dex
@@ -0,0 +1 @@
o/debug
@@ -0,0 +1 @@
i/classes_global-synthetics
@@ -0,0 +1 @@
o/classes
@@ -0,0 +1 @@
i/debug_dex
@@ -0,0 +1 @@
o/classes
@@ -0,0 +1 @@
o/classes
@@ -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