Added checkout and mandate profile

This commit is contained in:
Jeevan Prasad
2025-07-03 19:02:40 +05:30
parent 917fee86de
commit e68ddd7133
491 changed files with 2336 additions and 30039 deletions
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+2 -2
View File
@@ -68,8 +68,8 @@ artifacts {
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
androidTestImplementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
androidTestImplementation 'androidx.annotation:annotation:1.9.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
+5 -11
View File
@@ -44,7 +44,6 @@ android {
}
}
// 👇 Add this block to force override
}
android {
@@ -67,16 +66,12 @@ android {
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleDependency
implementation 'androidx.appcompat:appcompat:1.3.1'
//noinspection GradleDependency
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
//noinspection GradleDependency
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//noinspection GradleDependency
implementation 'androidx.recyclerview:recyclerview:1.2.1'
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'
@@ -90,7 +85,7 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.code.gson:gson:2.11.0'
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:33.13.0')
implementation platform('com.google.firebase:firebase-bom:33.15.0')
// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-analytics'
@@ -105,7 +100,6 @@ dependencies {
///new lib
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation files('libs/hoinsdk.jar')
//noinspection GradleDependency
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation project(':library')
implementation 'me.relex:circleindicator:1.2.2@aar'
+8
View File
@@ -650,6 +650,14 @@
android:windowSoftInputMode="adjustPan"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".checkout.BaCheckoutActivity"
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"
@@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.cpm.lorealbaautomation.checkout.MasterCheckoutQuestion;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.cpm.lorealbaautomation.constant.CommonString;
@@ -372,6 +373,7 @@ public class Lorealba_Database extends SQLiteOpenHelper {
values.put("GeoTag", jcpList.get(i).getGeoTag());
values.put("GeoFencingRadius", jcpList.get(i).getGeoFencingRadius());
values.put("GeoFencingAllow", jcpList.get(i).getGeoFencingAllow());
values.put("Checkout", jcpList.get(i).getCheckout());
if (!db.isOpen()) {
open();
@@ -724,12 +726,12 @@ public class Lorealba_Database extends SQLiteOpenHelper {
sb.setCounterwidth(dbcursor.getDouble(dbcursor.getColumnIndexOrThrow("CounterWidth")));
sb.setSetupDate(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SetUpDate")));
sb.setVisitDate(dbcursor.getString(dbcursor.getColumnIndexOrThrow("VisitDate")));
sb.setLatitude(dbcursor.getDouble(dbcursor.getColumnIndexOrThrow("Latitude")));
sb.setLongitude(dbcursor.getDouble(dbcursor.getColumnIndexOrThrow("Longitude")));
sb.setGeoTag(dbcursor.getString(dbcursor.getColumnIndexOrThrow("GeoTag")));
sb.setGeoFencingRadius(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("GeoFencingRadius")));
sb.setGeoFencingAllow(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("GeoFencingAllow")));
sb.setCheckout(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Checkout")));
list.add(sb);
@@ -3108,7 +3110,6 @@ public class Lorealba_Database extends SQLiteOpenHelper {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
MasterProfile ch = new MasterProfile();
ch.setEmail(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Email")));
ch.setFullName(dbcursor.getString(dbcursor.getColumnIndexOrThrow("FullName")));
ch.setSupervisor(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Supervisor")));
@@ -3205,14 +3206,7 @@ public class Lorealba_Database extends SQLiteOpenHelper {
Cursor cursordata = null;
ArrayList<MasterProfileQuestion> auditData = new ArrayList<>();
try {
if (userType.trim().equalsIgnoreCase("BA")) {
cursordata = db.rawQuery("select distinct CategoryId,Category from Master_ProfileQuestion where BA='1'", null);
} else if (userType.trim().equalsIgnoreCase("TBA")) {
cursordata = db.rawQuery("select distinct CategoryId,Category from Master_ProfileQuestion where TBA='1'", null);
} else if (userType.trim().equalsIgnoreCase("ME")) {
cursordata = db.rawQuery("select distinct CategoryId,Category from Master_ProfileQuestion where ME='1'", null);
}
cursordata = db.rawQuery("select distinct CategoryId,Category from Master_ProfileQuestion where upper(" + userType + ") = '1'", null);
if (cursordata != null) {
cursordata.moveToFirst();
while (!cursordata.isAfterLast()) {
@@ -3274,13 +3268,9 @@ public class Lorealba_Database extends SQLiteOpenHelper {
public ArrayList<AuditDataGetterSetter> getAuditCategoryWise(int categoryId) {
Cursor cursordata = null;
ArrayList<AuditDataGetterSetter> auditData = new ArrayList<>();
try {
cursordata = db.rawQuery("select distinct QuestionId,Question, QuestionType FROM Master_ProfileQuestion " + "where CategoryId ='" + categoryId + "'", null);
if (cursordata != null) {
cursordata = db.rawQuery("select distinct QuestionId,Question, QuestionType FROM Master_ProfileQuestion where CategoryId = " + categoryId, null);
cursordata.moveToFirst();
while (!cursordata.isAfterLast()) {
AuditDataGetterSetter sb = new AuditDataGetterSetter();
@@ -3288,21 +3278,18 @@ public class Lorealba_Database extends SQLiteOpenHelper {
sb.setQUESTION_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("QuestionId")));
sb.setANSWER_TYPE(cursordata.getString(cursordata.getColumnIndexOrThrow("QuestionType")));
sb.setKEYACCOUNT_ID("0");
auditData.add(sb);
cursordata.moveToNext();
}
cursordata.close();
} catch (Exception ignored) {
}
} catch (Exception ex) {
}
return auditData;
}
public ArrayList<AuditDataGetterSetter> getAuditAnswerData(AuditDataGetterSetter auditGetSet, String select) {
ArrayList<AuditDataGetterSetter> list = new ArrayList<>();
if (auditGetSet.getANSWER_TYPE().equalsIgnoreCase("Single selection")) {
AuditDataGetterSetter sb1 = new AuditDataGetterSetter();
@@ -3317,32 +3304,21 @@ public class Lorealba_Database extends SQLiteOpenHelper {
}
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("select distinct QuestionType,AnswerId,Answer FROM Master_ProfileQuestion where QuestionId =" + auditGetSet.getQUESTION_ID() + "", null);
if (dbcursor != null) {
dbcursor = db.rawQuery("select distinct QuestionType,AnswerId,Answer FROM Master_ProfileQuestion where QuestionId =" + auditGetSet.getQUESTION_ID(), null);
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
AuditDataGetterSetter sb = new AuditDataGetterSetter();
sb.setANSWER_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("AnswerId")));
sb.setANSWER(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Answer")));
list.add(sb);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
////////test("Exception", " answer " + e.toString());
return list;
}
////////test("Fetching", " audit answer-->Stop<-");
return list;
}
@@ -5810,14 +5786,14 @@ public class Lorealba_Database extends SQLiteOpenHelper {
Cursor dbcursor = null;
try {
if (UserId == null) {
dbcursor = db.rawQuery("SELECT distinct MID,BID,VisitDate from Mapping_JourneyPlan where CounterId=" + CounterId, null);
dbcursor = db.rawQuery("SELECT distinct MID,BID,VisitDate,Checkout from Mapping_JourneyPlan where CounterId=" + CounterId, null);
} else {
dbcursor = db.rawQuery("SELECT distinct MID,BID,VisitDate from Mapping_JourneyPlan where UserId='" + UserId + "' and CounterId=" + CounterId, null);
dbcursor = db.rawQuery("SELECT distinct MID,BID,VisitDate,Checkout from Mapping_JourneyPlan where UserId='" + UserId + "' and CounterId=" + CounterId, null);
}
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
if (UserId == null) {
sb.setCheckout(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Checkout")));
sb.setVisitDate(dbcursor.getString(dbcursor.getColumnIndexOrThrow("VisitDate")));
sb.setMID(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("MID")));
sb.setBID(0);
@@ -5825,6 +5801,7 @@ public class Lorealba_Database extends SQLiteOpenHelper {
sb.setMID(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("MID")));
sb.setBID(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("BID")));
sb.setVisitDate(dbcursor.getString(dbcursor.getColumnIndexOrThrow("VisitDate")));
sb.setCheckout(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Checkout")));
}
dbcursor.moveToNext();
@@ -5832,14 +5809,12 @@ public class Lorealba_Database extends SQLiteOpenHelper {
dbcursor.close();
return sb;
}
} catch (Exception e) {
////////test("Exception get JCP!", e.toString());
return sb;
}
return sb;
}
//jeevan nmjnmn,
@@ -7434,11 +7409,18 @@ public class Lorealba_Database extends SQLiteOpenHelper {
public ArrayList<AuditDataGetterSetter> getSaveServerData(String categoryId, String userId) {
ArrayList<AuditDataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("select distinct mp.QuestionId as QuestionId,mp.Question as Question,mb.AnswerId as AnswerId,mb.Answer as Answer," + "mp.QuestionType as QuestionType" + ",mp.CategoryId as CategoryId,mb.OthersValue as OthersValue from (select distinct QuestionId, Question, QuestionType, CategoryId from Master_ProfileQuestion) as mp " + "inner join Master_BAProfile mb on mp.QuestionId=mb.QuestionId inner join BA_List bl on bl.EmpId=mb.EmpId " + "where mp.CategoryId='" + categoryId + "' and bl.UserName='" + userId + "'", null);
if (dbcursor != null) {
String query = "select distinct mp.QuestionId as QuestionId,mp.Question as Question,mb.AnswerId as AnswerId,mb.Answer as Answer," +
"mp.QuestionType as QuestionType" + ",mp.CategoryId as CategoryId,mb.OthersValue as OthersValue from (select distinct QuestionId, Question, QuestionType, CategoryId from Master_ProfileQuestion) as mp " +
"inner join Master_BAProfile mb on mp.QuestionId=mb.QuestionId inner join BA_List bl on bl.EmpId=mb.EmpId "
+ "where mp.CategoryId='" + categoryId + "' and bl.UserName='" + userId + "'";
if (categoryId == null) {
query = "select distinct mp.QuestionId as QuestionId,mp.Question as Question,mb.AnswerId as AnswerId,mb.Answer as Answer," +
"mp.QuestionType as QuestionType" + ",mp.CategoryId as CategoryId,mb.OthersValue as OthersValue from (select distinct QuestionId, Question, QuestionType, CategoryId from Master_ProfileQuestion) as mp " +
"inner join Master_BAProfile mb on mp.QuestionId=mb.QuestionId inner join BA_List bl on bl.EmpId=mb.EmpId "
+ "where bl.UserName='" + userId + "'";
}
dbcursor = db.rawQuery(query, null);
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
AuditDataGetterSetter sb = new AuditDataGetterSetter();
@@ -7456,12 +7438,10 @@ public class Lorealba_Database extends SQLiteOpenHelper {
}
dbcursor.close();
return list;
}
} catch (Exception e) {
return list;
}
return list;
}
@@ -7607,31 +7587,25 @@ public class Lorealba_Database extends SQLiteOpenHelper {
JourneyPlan sb = new JourneyPlan();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * from Mapping_JourneyPlan where VisitDate='" + date + "' and CounterId=" + counter_id + " and UserId='" + userId + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
sb.setCounterId((dbcursor.getInt(dbcursor.getColumnIndexOrThrow("CounterId"))));
sb.setStoreName(dbcursor.getString(dbcursor.getColumnIndexOrThrow("StoreName")));
sb.setCounterName(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CounterName")));
sb.setAddress((dbcursor.getString(dbcursor.getColumnIndexOrThrow("Address"))));
sb.setCityName(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CityName")));
sb.setCheckout(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Checkout")));
dbcursor.moveToNext();
}
dbcursor.close();
return sb;
}
} catch (Exception e) {
////////test("Exception get JCP!", e.toString());
return sb;
}
return sb;
}
public long updateImageLoginData(String userId, String strImg) {
@@ -8409,31 +8383,25 @@ public class Lorealba_Database extends SQLiteOpenHelper {
JourneyPlan sb = new JourneyPlan();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * from Mapping_JourneyPlan", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
sb.setMID(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("MID")));
sb.setBID(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("BID")));
sb.setCounterGroupId(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("CounterGroupId")));
sb.setVisitDate(dbcursor.getString(dbcursor.getColumnIndexOrThrow("VisitDate")));
sb.setCheckout(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Checkout")));
dbcursor.moveToNext();
}
dbcursor.close();
return sb;
}
} catch (Exception e) {
////////test("Exception get JCP!", e.toString());
return sb;
}
return sb;
}
public boolean CheckPreviousProduct(String visit_date) {
@@ -15168,6 +15136,15 @@ public class Lorealba_Database extends SQLiteOpenHelper {
}
}
public void updateCheckoutStatus(String counterId, String bID, String userId) {
ContentValues values = new ContentValues();
try {
values.put("Checkout", "Y");
db.update("Mapping_JourneyPlan", values, "UserId = '" + userId + "' And BID = " + bID + " And CounterId = " + counterId, null);
} catch (Exception ignored) {
}
}
public long InsertSTOREgeotag(String storeid, String counterId, String bId, String userId, double lat, double longitude, String path) {
db.delete(CommonString.TABLE_STORE_GEOTAGGING, "STORE_ID = " + storeid + " And "
@@ -15235,6 +15212,7 @@ public class Lorealba_Database extends SQLiteOpenHelper {
}
}
@SuppressLint("LongLogTag")
public boolean insertMappingAppRestrictedKPI(MasterBAProfileGetterSetter data) {
db.delete("Mapping_AppRestrictedKPI", null, null);
@@ -15310,5 +15288,183 @@ public class Lorealba_Database extends SQLiteOpenHelper {
return status;
}
@SuppressLint("LongLogTag")
public boolean insertMasterCheckoutQuestion(MasterBAProfileGetterSetter data) {
db.delete("Master_CheckoutQuestion", null, null);
List<MasterCheckoutQuestion> questions = data.getMasterCheckoutQuestion();
ContentValues values = new ContentValues();
try {
db.beginTransaction();
if (questions.isEmpty()) {
return false;
}
for (MasterCheckoutQuestion question : questions) {
values.put("CategoryId", question.getCategoryId());
values.put("Category", question.getCategory());
values.put("QuestionId", question.getQuestionId());
values.put("Question", question.getQuestion());
values.put("QuestionType", question.getQuestionType());
values.put("QuestionImageAllow", question.getQuestionImageAllow());
values.put("QuestionImageMandatory", question.getQuestionImageMandatory());
values.put("QEnable", question.getQEnable());
values.put("LengthValidation", question.getLengthValidation());
values.put("MinLength", question.getMinLength());
values.put("MaxLength", question.getMaxLength());
values.put("AnswerId", question.getAnswerId());
values.put("Answer", question.getAnswer());
values.put("ImageAllow", question.getImageAllow());
values.put("ImageAllowMandatory", question.getImageAllowMandatory());
values.put("QuestionEnable", question.getQuestionEnable());
values.put("QuestionDisable", question.getQuestionDisable());
if (!db.isOpen()) {
open();
}
long id = db.insert("Master_CheckoutQuestion", null, values);
if (id == -1) {
throw new Exception();
}
}
// do ALL your inserts here
db.setTransactionSuccessful();
db.endTransaction();
return true;
} catch (Exception ex) {
ex.fillInStackTrace();
// do ALL your inserts here
db.setTransactionSuccessful();
db.endTransaction();
Log.d("Exception in Master_CheckoutQuestion", ex.toString());
return false;
}
}
public ArrayList<MasterCheckoutQuestion> getCheckoutQuestions(String counterId, String baId, String userId) {
ArrayList<MasterCheckoutQuestion> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select Distinct QuestionId, Question || ' - ' || Category as Question,QuestionType,QuestionImageAllow,QuestionImageMandatory,LengthValidation,MinLength,MaxLength From Master_CheckoutQuestion where QEnable =1", null);
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
MasterCheckoutQuestion question = new MasterCheckoutQuestion();
question.setQuestionId(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("QuestionId")));
question.setQuestion(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Question")));
question.setQuestionType(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QuestionType")));
question.setQuestionImageAllow("1".equals(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QuestionImageAllow"))));
question.setQuestionImageMandatory("1".equals(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QuestionImageMandatory"))));
question.setLengthValidation("1".equals(dbcursor.getString(dbcursor.getColumnIndexOrThrow("LengthValidation"))));
question.setMinLength(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("MinLength")));
question.setMaxLength(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("MaxLength")));
question.setAns(question.getQuestionType().equals("List Single Choice") ? getCheckoutQuestionAns(question.getQuestionId()) : new ArrayList<>());
question.setImageAllowMandatory(false);
question.setImageAllow(false);
question.setCorrect_ansId(0);
question.setCorrect_ans("");
question.setQuestionImg("");
question.setAnsImg("");
list.add(question);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
} catch (Exception e) {
Log.e("QError", e.getLocalizedMessage());
return list;
}
}
private ArrayList<MasterCheckoutQuestion> getCheckoutQuestionAns(int questionId) {
ArrayList<MasterCheckoutQuestion> list = new ArrayList<>();
Cursor dbcursor = null;
try {
MasterCheckoutQuestion question = new MasterCheckoutQuestion();
question.setAnswerId(0);
question.setAnswer("- Select -");
question.setImageAllow(false);
question.setQuestionEnable("");
question.setQuestionDisable("");
question.setImageAllowMandatory(false);
list.add(0, question);
dbcursor = db.rawQuery("Select Distinct AnswerId,Answer,QuestionType,ImageAllow,ImageAllowMandatory,QuestionEnable,QuestionDisable From Master_CheckoutQuestion where QuestionId =" + questionId, null);
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
question = new MasterCheckoutQuestion();
question.setAnswerId(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("AnswerId")));
question.setAnswer(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Answer")));
question.setImageAllow("1".equals(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ImageAllow"))));
question.setImageAllowMandatory("1".equals(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ImageAllowMandatory"))));
question.setQuestionEnable((dbcursor.getString(dbcursor.getColumnIndexOrThrow("QuestionEnable"))));
question.setQuestionDisable(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QuestionDisable")));
list.add(question);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
} catch (Exception e) {
Log.e("QError", e.getLocalizedMessage());
return list;
}
}
public boolean isBaProfileFilled(String _counterId, String _userId, String _userType) {
boolean _filled = false;
Cursor outerCursor = null;
Cursor dbcursor = null;
try {
outerCursor = db.rawQuery("SELECT * from Master_ProfileQuestion Where " + _userType + " = '1'", null);
if (outerCursor.moveToFirst()) {
do {
int icount = outerCursor.getCount();
outerCursor.close();
String query = "SELECT ifnull(Profile_Pic,'')as Profile_Pic from BA_List Where UserName = '" + _userId + "' and CounterId = " + _counterId;
if (icount > 0) {
query = "SELECT DISTINCT T.EmpId,ifnull(K.Profile_Pic,'')as Profile_Pic FROM Master_BAProfile T " +
"INNER JOIN BA_List K ON K.EmpId = T.EmpId " +
"INNER JOIN Master_ProfileQuestion M ON M.QuestionId = T.QuestionId " +
"WHERE K.UserName = '" + _userId + "' and M." + _userType + " = '1' And K.CounterId = '" + _counterId + "'";
}
dbcursor = db.rawQuery(query, null);
if (dbcursor.moveToFirst()) {
String Profile_Pic = dbcursor.getString(dbcursor.getColumnIndexOrThrow("Profile_Pic"));
if (icount > 0) {
String empId = dbcursor.getString(dbcursor.getColumnIndexOrThrow("EmpId"));
if (empId != null && !empId.isEmpty() && !Profile_Pic.isEmpty()) {
_filled = true;
break;
}
} else {
if (!Profile_Pic.isEmpty()) {
_filled = true;
break;
}
}
dbcursor.close();
}
} while (outerCursor.moveToNext());
outerCursor.close();
}
return _filled;
} catch (Exception e) {
return _filled;
} finally {
if (outerCursor != null && !outerCursor.isClosed()) outerCursor.close();
if (dbcursor != null && !dbcursor.isClosed()) dbcursor.close();
}
}
}
@@ -24,7 +24,6 @@ import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -33,6 +32,9 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import com.cpm.lorealbaautomation.checkout.BaCheckoutActivity;
import com.cpm.lorealbaautomation.dailyactivity.ServiceActivity;
import com.cpm.lorealbaautomation.gsonGetterSetter.JourneyPlan;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.SettingsClient;
@@ -81,7 +83,6 @@ import com.cpm.lorealbaautomation.dailyactivity.CounterProfileActivity;
import com.cpm.lorealbaautomation.dailyactivity.GroomedActivity;
import com.cpm.lorealbaautomation.dailyactivity.NotificationsActivity;
import com.cpm.lorealbaautomation.dailyactivity.RetailExcellenceActivity;
import com.cpm.lorealbaautomation.dailyactivity.ServiceActivity;
import com.cpm.lorealbaautomation.databinding.DialogApplyLeaveBinding;
import com.cpm.lorealbaautomation.delegates.PrefHelper;
import com.cpm.lorealbaautomation.download.DownloadActivity;
@@ -134,7 +135,6 @@ import retrofit2.converter.gson.GsonConverterFactory;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.checkincomplete_upload_data;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCroppedBitmap;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCurrentTime_only;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getResizedBitmap;
import static com.cpm.lorealbaautomation.dailyactivity.StoreImageActivity.convertBitmap;
@@ -154,9 +154,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
private double lat = 0.0;
private double lon = 0.0;
private static final int REQUEST_LOCATION = 1;
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
Location mLastLocation;
LocationRequest mLocationRequest;
SharedPreferences.Editor editor = null;
LinearLayout rl_pending_data;
TextView textCartItemCount;
@@ -262,7 +259,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
navigationView.setNavigationItemSelectedListener(this);
headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_dealar_board, navigationView, false);
checkAndRequestPermissions();
createLocationRequest();
getLastLocation();
//find location
@@ -307,7 +303,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
txt_dashboard.setText(getString(R.string.dashboard) + " Last Updated at - " + DASHBOARD_REFRESH_TIME + " - " + visitDate);
txt_more.setOnClickListener(this);
String couter_code = preferences.getString(CommonString.KEY_COUNTER_CODE, "");
TextView txt_counter_code = (TextView) findViewById(R.id.txt_counter_code);
txt_counter_code.setText("Counter Code - " + couter_code + " / Id - " + counterId);
@@ -332,6 +327,7 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
}
};
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
@@ -560,7 +556,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
AlertandMessages.showToastMsg(context, " Profile Data Not Found");
}
}
} else if (id == 11) {//for logout
////upload data if not upload
if (checkNetIsAvailable()) {
@@ -581,7 +576,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
} else {
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_INTERNET_NOT_AVALABLE);
}
} else if (id == R.id.notification_img_nav) {
if (!db.getNotificationList().isEmpty()) {
startActivity(new Intent(context, NotificationsActivity.class));
@@ -589,9 +583,7 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
} else {
AlertandMessages.showToastMsg(context, getResources().getString(R.string.notification_error_msg));
}
} else {
String userId = Objects.requireNonNull(item.getTitle()).toString();
String mpin = preferences.getString(userId, null);
if (mpin != null) {
@@ -653,7 +645,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
Intent profile = new Intent(context, BAProfileActivity.class);
startActivity(profile);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_counter_menu) {
Intent profile = new Intent(context, CounterProfileActivity.class);
startActivity(profile);
@@ -664,6 +655,9 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
} else if (id == R.id.nav_reset_password) {
startActivity(new Intent(context, ChangePasswordActivity.class));
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_counter_checkout) {
startActivity(new Intent(context, BaCheckoutActivity.class));
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_logout) {
if (checkNetIsAvailable()) {
AlertDialog.Builder builder = new AlertDialog.Builder(context).setTitle(R.string.parinaam).setMessage(R.string.alertlogout);
@@ -683,10 +677,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
} else {
AlertandMessages.showToastMsg(context, CommonString.MESSAGE_INTERNET_NOT_AVALABLE);
}
/*Intent intent = new Intent(context, UserLoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);*/
} else if (id == R.id.nav_report) {
startActivity(new Intent(context, ReportsActivity.class).putExtra("from", user_type));
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -754,13 +744,18 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
no_data_lay.setVisibility(View.GONE);
fab_download.hide();
dealerb_scroll_view.setVisibility(View.VISIBLE);
db.open();
JourneyPlan jcp = db.getBIDfromJCP(user_name, counterId);
if (jcp != null && jcp.getCheckout() != null && !jcp.getCheckout().isEmpty() && jcp.getCheckout().equals("Y")) {
editor = preferences.edit();
editor.putBoolean(CommonString.KEY_IS_CHECKOUT_DONE + user_name + visitDate, true);
editor.apply();
}
}
checkAndRequestPermissions();
createLocationRequest();
getLastLocation();
//find location
checkgpsEnableDevice();
/////set picture current user
Bitmap bitmpprofile = null;
@@ -853,22 +848,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
}
@SuppressLint("VisibleForTests")
protected void createLocationRequest() {
LocationRequest mLocationRequest = new LocationRequest();
// Location updates intervals in sec
// 5 sec
int UPDATE_INTERVAL = 5000;
mLocationRequest.setInterval(UPDATE_INTERVAL);
// 1 sec
int FATEST_INTERVAL = 1000;
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// 10 meters
int DISPLACEMENT = 5;
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
}
private void checkgpsEnableDevice() {
if (!hasGPSDevice(context)) {
Toast.makeText(context, "Gps not Supported", Toast.LENGTH_SHORT).show();
@@ -1109,7 +1088,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
final Dialog dialog_for = new Dialog(context);
Objects.requireNonNull(dialog_for.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog_for.setContentView(R.layout.comment_layout);
Window window = dialog_for.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.CENTER;
@@ -1130,7 +1108,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
final Dialog dialog_for = new Dialog(context);
Objects.requireNonNull(dialog_for.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog_for.setContentView(R.layout.comment_retail_excellence);
Window window = dialog_for.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.CENTER;
@@ -1152,11 +1129,11 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
final Dialog dialogcounter = new Dialog(context);
Objects.requireNonNull(dialogcounter.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialogcounter.setContentView(R.layout.commentfor_counter_layout);
Window window = dialogcounter.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.CENTER;
window.setAttributes(wlp);
dialogcounter.setCancelable(false);
dialogcounter.setCanceledOnTouchOutside(false);
RelativeLayout rl_dialog = dialogcounter.findViewById(R.id.rl_dialog);
rl_dialog.setOnClickListener(view -> {
@@ -1190,28 +1167,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
return hours;
}
private int calculateTotalDurationinminutes(String currentTime) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm:ss", Locale.ENGLISH);
int days = 0, hours = 0, min = 0;
try {
Date date1 = simpleDateFormat.parse(currentTime);
Date date2 = simpleDateFormat.parse(getCurrentTime_only());
assert date2 != null;
assert date1 != null;
long difference = date2.getTime() - date1.getTime();
days = (int) (difference / (1000 * 60 * 60 * 24));
hours = (int) ((difference - (1000 * 60 * 60 * 24 * days)) / (1000 * 60 * 60));
min = (int) (difference - (1000 * 60 * 60 * 24 * days) - (1000 * 60 * 60 * hours)) / (1000 * 60);
hours = (hours < 0 ? -hours : hours);
Log.i("======= Hours", " :: " + hours);
} catch (ParseException e) {
e.fillInStackTrace();
}
return min;
}
//--------------Download all data........................---------
private void download_data() {
int incorrect_tStockSummery = preferences.getInt(CommonString.KEY_INCORRECT_TSTOCK_SUMMERY + visitDate, 0);
@@ -1282,8 +1237,8 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
}
}
private void showDialogOK(String message, DialogInterface.OnClickListener okListener) {
new AlertDialog.Builder(this).setMessage(message).setPositiveButton("OK", okListener).setNegativeButton("Cancel", okListener).create().show();
private void showDialogOK(DialogInterface.OnClickListener okListener) {
new AlertDialog.Builder(this).setMessage("Location,File,Call and Camera Services Permission required for this app").setPositiveButton("OK", okListener).setNegativeButton("Cancel", okListener).create().show();
}
@Override
@@ -1312,8 +1267,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
if (allPermissionsGranted) {
getLastLocation();
createLocationRequest();
}
} else {
//test("", "Some permissions are not granted ask again ");
@@ -1321,7 +1274,7 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
// // shouldShowRequestPermissionRationale will return true
//show the dialog or snackbar saying its necessary and try again otherwise proceed with setup.
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)) {
showDialogOK("Location,File,Call and Camera Services Permission required for this app", (dialog, which) -> {
showDialogOK((dialog, which) -> {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
checkAndRequestPermissions();
@@ -1378,12 +1331,10 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
}
}
public void downloadDataUniversalWithoutWait(final ArrayList<String> jsonStringList,
final ArrayList<String> KeyNames, int downloadindex, final ProgressDialog pd) {
private void downloadDataUniversalWithoutWait(final ArrayList<String> jsonStringList, final ArrayList<String> KeyNames, int downloadindex, final ProgressDialog pd) {
final String[] data_global = {""};
String jsonString = "", KeyName = "";
int jsonIndex = 0;
if (!jsonStringList.isEmpty()) {
final OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS).connectTimeout(20, TimeUnit.SECONDS).build();
jsonString = jsonStringList.get(downloadindex);
@@ -1526,7 +1477,6 @@ public class DealarBoardActivity extends AppCompatActivity implements Navigation
if (finalJsonIndex[0] != KeyNames.size()) {
downloadDataUniversalWithoutWait(jsonStringList, KeyNames, finalJsonIndex[0], pd);
} else {
/////update Dashboard UI reports.......
editor = preferences.edit();
editor.putString(CommonString.KEY_DASHBOARD_REFRESH_TIME, CommonFunctions.getCurrentTime_only());
@@ -13,6 +13,8 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import com.cpm.lorealbaautomation.gsonGetterSetter.JourneyPlan;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.firebase.messaging.FirebaseMessaging;
import com.cpm.lorealbaautomation.delegates.PrefHelper;
@@ -92,14 +94,12 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_user_login);
getViewId();
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(task -> {
if (!task.isSuccessful()) {
Log.w(TAG, "Fetching FCM registration token failed", task.getException());
return;
}
// Get new FCM registration token
String token = task.getResult();
try {
@@ -111,12 +111,12 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
} catch (JSONException e) {
e.fillInStackTrace();
}
// Log and toast
//test(TAG, "Token: " + token);
Log.d(TAG, "Token: " + token);
});
showAlertForLogoutUser(false);
}
@@ -132,7 +132,6 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
lay_ma = (LinearLayout) findViewById(R.id.lay_ma);
lay_tba = (LinearLayout) findViewById(R.id.lay_tba);
btncontinue = (Button) findViewById(R.id.btncontinue);
user_password = (EditText) findViewById(R.id.user_password);
counter_name = (TextView) findViewById(R.id.counter_name);
versioncode_txt = (TextView) findViewById(R.id.versioncode_txt);
@@ -140,10 +139,10 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(getString(R.string.user_login));
counterId = preferences.getString(CommonString.KEY_COUNTER_ID, "");
counter_code = preferences.getString(CommonString.KEY_COUNTER_CODE, "");
counterName = preferences.getString(CommonString.KEY_COUNTER_NAME, "");
userId = preferences.getString(CommonString.KEY_USERNAME, "");
visitdate = preferences.getString(CommonString.KEY_DATE, "");
counter_name.setText("Counter Name : " + counterName + "\n" + "Counter Code : " + counter_code);
lay_ba.setOnClickListener(this);
@@ -151,12 +150,10 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
lay_tba.setOnClickListener(this);
btncontinue.setOnClickListener(this);
checkAndRequestPermissions();
bsListData = db.getBAListAllData(visitdate, counterId);
if (bsListData.size() == 0) {
if (bsListData.isEmpty()) {
UploadDataTask();
}
if (getIntent().getExtras() != null) {
for (String key : getIntent().getExtras().keySet()) {
if (key.equalsIgnoreCase("title")) {
@@ -172,7 +169,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
assert title != null;
assert body != null;
if (!title.equalsIgnoreCase("") && !body.equalsIgnoreCase("")) {
if (!title.isEmpty() && !body.isEmpty()) {
db.open();
long value = db.insertNotificationData(title, body, path, visitdate, type, counterId);
if (value > 0) {
@@ -181,8 +178,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
Toast.makeText(context, "Notification Not Inserted", Toast.LENGTH_SHORT).show();
}
}
if (!title.equals("")) {
if (!title.isEmpty()) {
Intent in = new Intent(this, NotificationDetailActivity.class);
in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
in.putExtra("Type", type);
@@ -199,12 +195,11 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
public void onClick(View v) {
if (v.getId() == R.id.lay_ba) {
db.open();
if (db.getBAListAllData(visitdate, counterId).size() > 0) {
if (!db.getBAListAllData(visitdate, counterId).isEmpty()) {
editor.putString(CommonString.TAG_FROM, CommonString.TAG_FROM_BA);
editor.putString(CommonString.TAG_MODE, CommonString.MODE_FROM_BA_LOGIN);
editor.putString(CommonString.KEY_USER_TYPE, CommonString.TAG_FROM_BA);
editor.commit();
Intent balogin = new Intent(context, TabLoginActivity.class);
balogin.putExtra(CommonString.TAG_FROM, CommonString.TAG_FROM_BA);
balogin.putExtra(CommonString.TAG_MODE, CommonString.MODE_FROM_BA_LOGIN);
@@ -216,7 +211,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
} else if (v.getId() == R.id.lay_ma) {
db.open();
if (db.getBAListAllData(visitdate, counterId).size() > 0) {
if (!db.getBAListAllData(visitdate, counterId).isEmpty()) {
editor.putString(CommonString.TAG_FROM, CommonString.TAG_FROM_ME);
editor.putString(CommonString.TAG_MODE, CommonString.MODE_FROM_ME_LOGIN);
editor.putString(CommonString.KEY_USER_TYPE, CommonString.TAG_FROM_ME);
@@ -233,22 +228,19 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
} else if (v.getId() == R.id.lay_tba) {
db.open();
if (db.getBAListAllData(visitdate, counterId).size() > 0) {
if (!db.getBAListAllData(visitdate, counterId).isEmpty()) {
editor.putString(CommonString.TAG_FROM, CommonString.TAG_FROM_TBA);
editor.putString(CommonString.TAG_MODE, CommonString.MODE_FROM_TBA_LOGIN);
editor.putString(CommonString.KEY_USER_TYPE, CommonString.TAG_FROM_TBA);
editor.commit();
Intent tbalogin = new Intent(context, TabLoginActivity.class);
tbalogin.putExtra(CommonString.TAG_FROM, CommonString.TAG_FROM_TBA);
tbalogin.putExtra(CommonString.TAG_MODE, CommonString.MODE_FROM_TBA_LOGIN);
startActivity(tbalogin);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else {
DownloadData(CommonString.TAG_FROM_TBA);
}
}
}
@@ -270,7 +262,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
jsonList.add(jsonObject.toString());
KeyNames.add(keysList.get(i));
}
if (jsonList.size() > 0) {
if (!jsonList.isEmpty()) {
ProgressDialog pd = new ProgressDialog(context);
DownloadAllDatawithRetro downloadData = new DownloadAllDatawithRetro(context, db, pd, CommonString.TAG_FROM_CURRENT);
downloadData.listSize = jsonList.size();
@@ -301,7 +293,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
}
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);
@@ -330,22 +322,19 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
if (!listPermissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), CommonString.PERMISSION_ALL);
return false;
}
return true;
}
private void showDialogOK(String message, DialogInterface.OnClickListener okListener) {
new AlertDialog.Builder(this).setMessage(message).setPositiveButton("OK", okListener).setNegativeButton("Cancel", okListener).create().show();
private void showDialogOK(DialogInterface.OnClickListener okListener) {
new AlertDialog.Builder(this).setMessage("Location,File,Call and Camera Services Permission required for this app").setPositiveButton("OK", okListener).setNegativeButton("Cancel", okListener).create().show();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//test("", "Permission callback called-------");
switch (requestCode) {
case CommonString.PERMISSION_ALL: {
if (requestCode == CommonString.PERMISSION_ALL) {
Map<String, Integer> perms = new HashMap<>();
// Initialize the map with both permissions
perms.put(Manifest.permission.CAMERA, PackageManager.PERMISSION_GRANTED);
@@ -364,9 +353,6 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
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) {
}
} else {
//test("", "Some permissions are not granted ask again ");
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA) ||
@@ -374,7 +360,7 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_COARSE_LOCATION) ||
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION) ||
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_PHONE_STATE)) {
showDialogOK("Location,File,Call and Camera Services Permission required for this app", (dialog, which) -> {
showDialogOK((dialog, which) -> {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
checkAndRequestPermissions();
@@ -389,13 +375,6 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
}
});
}
//permission is denied (and never ask again is checked)
//shouldShowRequestPermissionRationale will return false
else {
Toast.makeText(this, "Go to settings and enable permissions", Toast.LENGTH_LONG).show();
// //proceed with logic by disabling the related features or quit the app.
}
}
}
}
}
@@ -419,12 +398,10 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
jsonList.add(jsonObject.toString());
KeyNames.add(keysList.get(i));
}
if (jsonList.size() > 0) {
if (!jsonList.isEmpty()) {
loading = ProgressDialog.show(context, "Downloading", "Please wait...", false, true);
downloadBaList(context, jsonList, KeyNames, downloadindex, userType, loading);
}
} else {
AlertandMessages.showToastMsg(context, getString(R.string.nonetwork));
}
@@ -437,21 +414,19 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
final String[] data_global = {""};
String jsonString = "", KeyName = "";
int jsonIndex = 0;
if (jsonStringList.size() > 0) {
if (!jsonStringList.isEmpty()) {
OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout(CommonString.TIMEOUT,
TimeUnit.SECONDS).connectTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).build();
jsonString = jsonStringList.get(downloadindex);
KeyName = KeyNames.get(downloadindex);
jsonIndex = downloadindex;
RequestBody jsonData = RequestBody.create(MediaType.parse("application/json"), jsonString);
Retrofit adapter = new Retrofit.Builder().baseUrl(CommonString.URL).client(okHttpClient).addConverterFactory(GsonConverterFactory.create()).build();
PostApi api = adapter.create(PostApi.class);
Call<String> call = api.getDownloadAll(jsonData);
final int[] finalJsonIndex = {jsonIndex};
final String finalKeyName = KeyName;
call.enqueue(new Callback<String>() {
call.enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
String responseBody = response.body();
@@ -459,20 +434,18 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
if (responseBody != null && response.isSuccessful()) {
try {
data = response.body();
if (data.equals("")) {
assert data != null;
if (data.isEmpty()) {
data_global[0] = "";
} else {
data_global[0] = data;
if (finalKeyName.equalsIgnoreCase("Table_Structure")) {
TableStructureGetterSetter tableStructureObj = new Gson().fromJson(data, TableStructureGetterSetter.class);
String isAllTableCreated = createTable(tableStructureObj);
if (isAllTableCreated != CommonString.KEY_SUCCESS) {
loading.dismiss();
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
AlertandMessages.showAlert((Activity) context, isAllTableCreated + " not created", true);
}
} else {
@@ -488,11 +461,20 @@ 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);
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
db.open();
if (jcpObject != null && db.insertJCPData(jcpObject)) {
db.open();
JourneyPlan jcp = db.getBIDfromJCP(userId, counterId);
if (jcp != null && jcp.getCheckout() != null && !jcp.getCheckout().isEmpty() && jcp.getCheckout().equals("Y")) {
editor.putBoolean(CommonString.KEY_IS_CHECKOUT_DONE + userId + visitdate, true);
editor.apply();
showAlertForLogoutUser(true);
}
} else {
AlertandMessages.showToastMsg(context, "JCP data not saved");
}
}
@@ -506,14 +488,10 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
if (finalJsonIndex[0] != KeyNames.size()) {
downloadBaList(context, jsonStringList, KeyNames, finalJsonIndex[0], userType, loading);
} else {
loading.dismiss();
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
AlertandMessages.showToastMsg(context, "BA List data downloaded Successfully");
if (userType.equalsIgnoreCase(CommonString.TAG_FROM_BA)) {
editor.putString(CommonString.TAG_FROM, CommonString.TAG_FROM_BA);
editor.putString(CommonString.TAG_MODE, CommonString.MODE_FROM_BA_LOGIN);
@@ -551,20 +529,15 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
}
}
} catch (Exception e) {
e.fillInStackTrace();
loading.dismiss();
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
AlertandMessages.showToastMsg(context, "Ba List Data Not Found. Please Contact To Supervisor");
}
} else {
loading.dismiss();
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
@@ -574,11 +547,9 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
loading.dismiss();
if (loading != null && loading.isShowing()) {
loading.dismiss();
}
AlertandMessages.showAlertlogin((Activity) context, CommonString.MESSAGE_SOCKETEXCEPTION);
}
});
@@ -593,6 +564,20 @@ public class UserLoginActivity extends AppCompatActivity implements View.OnClick
return table;
}
}
return CommonString.KEY_SUCCESS;
}
private void showAlertForLogoutUser(boolean direct) {
if (preferences.getBoolean(CommonString.KEY_IS_CHECKOUT_DONE + userId + visitdate, false) || direct) {
new MaterialAlertDialogBuilder(this, R.style.MyMaterialAlertDialog)
.setTitle("Alert")
.setMessage("You have already checked-out in Store/Counter.You can't login again for today.").setCancelable(false)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
finishAffinity();
}).show();
}
}
}
@@ -0,0 +1,697 @@
package com.cpm.lorealbaautomation.checkout;
import static com.cpm.lorealbaautomation.constant.CommonFunctions.getCurrentTime;
import static com.cpm.lorealbaautomation.dailyactivity.StoreImageActivity.convertBitmap;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.location.Location;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.InputFilter;
import android.text.InputType;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.cpm.lorealbaautomation.Database.Lorealba_Database;
import com.cpm.lorealbaautomation.R;
import com.cpm.lorealbaautomation.constant.AlertandMessages;
import com.cpm.lorealbaautomation.constant.CommonFunctions;
import com.cpm.lorealbaautomation.constant.CommonString;
import com.cpm.lorealbaautomation.databinding.ActivityBacheckoutBinding;
import com.cpm.lorealbaautomation.databinding.ItemBacheckoutBinding;
import com.cpm.lorealbaautomation.delegates.PrefHelper;
import com.cpm.lorealbaautomation.download.Downloader;
import com.cpm.lorealbaautomation.gsonGetterSetter.JourneyPlan;
import com.cpm.lorealbaautomation.gsonGetterSetter.MasterPosm;
import com.cpm.lorealbaautomation.retrofit.UploadDataWithRetrofit;
import com.google.android.gms.common.api.ResolvableApiException;
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.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.JsonSyntaxException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class BaCheckoutActivity extends AppCompatActivity {
private String counter_Id, visit_date, username, _pathforcheck, _path, img_str = "", checkout_img_str = "";
private double latitude = 0.0, logitude = 0.0;
private SharedPreferences.Editor editor = null;
private SharedPreferences preferences = null;
private Lorealba_Database db;
private boolean checkflag = true, clickFlag = false, onspinTouch = false;
private JourneyPlan jcp_Object = null;
private QuestionAdapter adapter = null;
private ActivityBacheckoutBinding binding = null;
private ArrayList<MasterCheckoutQuestion> questions = new ArrayList<>();
private int _pos = -1;
String blockCharacterSet = "[';:-+{('}<!>@=#$%^&*?)\"]";
InputFilter filter = (source, start, end, dest, dstart, dend) -> {
if (source != null && blockCharacterSet.contains(("" + source))) {
return "";
}
return null;
};
private static final int REQUEST_LOCATION = 1;
private FusedLocationProviderClient fusedLocationClient = null;
private LocationCallback locationCallback = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityBacheckoutBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
fusedLocationClient = LocationServices.
getFusedLocationProviderClient(this);
db = new Lorealba_Database(this);
db.open();
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (!CommonFunctions.isTablet(this)) {
toolbar.setTitleTextAppearance(this, R.style.changestext_sizefor_mobile);
}
iduserinterface();
showAlertOfLogout();
setTitle("Checkout Selfie - " + username);
binding.contentCheckout.imgCamSelfie.setOnClickListener(v -> {
clickFlag = true;
_pathforcheck = counter_Id + "-Checkout_Selfie_img_" + username + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(this) + _pathforcheck;
if (CommonFunctions.isTablet(this)) {
CommonFunctions.startAnncaCameraActivity(this, _path, null, false, CommonString.CAMERA_FACE_REAR);
} else {
CommonFunctions.startAnncaCameraActivity(this, _path, null, false, CommonString.CAMERA_FACE_FRONT);
}
});
}
private void iduserinterface() {
preferences = PrefHelper.getPrefs(this);
editor = preferences.edit();
counter_Id = preferences.getString(CommonString.KEY_COUNTER_ID, "");
username = preferences.getString(CommonString.KEY_USERNAME, "");
visit_date = preferences.getString(CommonString.KEY_DATE, "");
jcp_Object = db.getBIDfromJCP(username, counter_Id);
Log.e("jcp_Object", "MID : " + jcp_Object.getMID().toString() + " BID : " + jcp_Object.getBID() + " UserId : " + username);
callquestions();
getLastLocation();
binding.fab.setOnClickListener(v -> {
CommonFunctions.dismissKeyboard(v);
if (checkout_img_str.isEmpty()) {
AlertandMessages.showToastMsg(v.getContext(), "Please click Selfie in front of counter at Checkout");
} else if (validate()) {
if (CommonFunctions.checkNetIsAvailable(v.getContext())) {
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext()).setTitle(R.string.parinaam).setMessage(R.string.title_activity_save_data).setCancelable(false).setPositiveButton(R.string.yes, (dialog, id) -> {
new BaCheckoutUpload(this).execute();
//upload service
Downloader.enqueueWork(v.getContext(), new Intent(v.getContext(),
Downloader.class).putExtra(CommonString.KEY_UPLOADIMAGE, "1"));
}).setNegativeButton(R.string.no, (dialog, id) -> dialog.cancel());
AlertDialog alert = builder.create();
alert.show();
}
}
});
}
@Override
protected void onResume() {
super.onResume();
db.open();
checkgpsEnableDevice();
}
private void checkgpsEnableDevice() {
if (!hasGPSDevice(this)) {
Toast.makeText(this, "Gps not Supported", Toast.LENGTH_SHORT).show();
}
final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER) && hasGPSDevice(this)) {
enableLocationSettings();
} else {
if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
hasGPSDevice(this);
}
}
}
private void enableLocationSettings() {
LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, // priority
5000 // intervalMillis: 5 seconds
).setMinUpdateIntervalMillis(3000) // fastest interval
.build();
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();
}
}
});
}
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();
return providers.contains(LocationManager.GPS_PROVIDER);
}
private void getLastLocation() {
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 (location != null) {
latitude = location.getLatitude();
logitude = location.getLongitude();
Log.d("Location", "Lat: " + latitude + ", Lng: " + logitude);
}
}
}
};
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 void stopLocationUpdates() {
if (fusedLocationClient != null && locationCallback != null) {
fusedLocationClient.removeLocationUpdates(locationCallback);
}
}
@Override
public void onDestroy() {
super.onDestroy();
stopLocationUpdates();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
backPress();
}
return super.onOptionsItemSelected(item);
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
backPress();
}
private void backPress() {
if (clickFlag) {
AlertDialog.Builder builder = new AlertDialog.Builder(this).setMessage(CommonString.ONBACK_ALERT_MESSAGE).setCancelable(false).setPositiveButton("Ok", (dialog, id1) -> {
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
this.finish();
}).setNegativeButton("Cancel", (dialog, id12) -> dialog.cancel());
AlertDialog alert = builder.create();
alert.show();
} else {
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
this.finish();
}
}
private void callquestions() {
db.open();
questions = db.getCheckoutQuestions(counter_Id, "", username);
binding.contentCheckout.tvPrompt.setVisibility(questions != null && !questions.isEmpty() ? View.VISIBLE : View.GONE);
binding.contentCheckout.recyclQuestionire.setVisibility(questions != null && !questions.isEmpty() ? View.VISIBLE : View.GONE);
adapter = new QuestionAdapter(this, questions);
binding.contentCheckout.recyclQuestionire.setAdapter(adapter);
binding.contentCheckout.recyclQuestionire.setLayoutManager(new LinearLayoutManager(this));
}
private class QuestionAdapter extends RecyclerView.Adapter<QuestionAdapter.ViewHolder> {
Context context;
ArrayList<MasterCheckoutQuestion> listDataHeader;
public QuestionAdapter(Context context, ArrayList<MasterCheckoutQuestion> listDataHeader) {
this.context = context;
this.listDataHeader = listDataHeader;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
ItemBacheckoutBinding itemBinding = ItemBacheckoutBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new ViewHolder(itemBinding);
}
@SuppressLint({"SetTextI18n", "ClickableViewAccessibility"})
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") final int pos) {
final MasterCheckoutQuestion object = listDataHeader.get(pos);
holder.item_binding.txtQuestion.setText(object.getQuestion());
holder.item_binding.txtQuestion.setId(pos);
if (object.getAns() != null && !object.getAns().isEmpty()) {
holder.item_binding.spAuditAnswer.setAdapter(new AnswerSpinnerAdapter(context, R.layout.custom_spinner_item, object.getAns()));
holder.item_binding.spAuditAnswer.setId(pos);
}
if (object.getQuestionType().equals("List Single Choice")) {
holder.item_binding.rlSpin.setVisibility(View.VISIBLE);
holder.item_binding.edtAnswer.setVisibility(View.GONE);
holder.item_binding.rlSpin.setId(pos);
holder.item_binding.edtAnswer.setId(pos);
} else if (object.getQuestionType().equals("Number") || object.getQuestionType().equals("Text")) {
holder.item_binding.rlSpin.setVisibility(View.GONE);
holder.item_binding.edtAnswer.setVisibility(View.VISIBLE);
holder.item_binding.rlSpin.setId(pos);
holder.item_binding.edtAnswer.setId(pos);
holder.item_binding.edtAnswer.setHint(object.getQuestion());
holder.item_binding.edtAnswer.setInputType(object.getQuestionType().equals("Number") ? InputType.TYPE_CLASS_NUMBER : InputType.TYPE_CLASS_TEXT);
holder.item_binding.edtAnswer.setTypeface(holder.item_binding.edtAnswer.getTypeface(), object.getQuestionType().equals("Number") ? Typeface.BOLD : Typeface.NORMAL);
holder.item_binding.edtAnswer.setFilters(new InputFilter[]{filter, object.getQuestionType().equals("Number") ? new InputFilter.LengthFilter(object.getMaxLength()) : new InputFilter.LengthFilter(350)});
}
holder.item_binding.spAuditAnswer.setOnTouchListener((view, motionEvent) -> {
onspinTouch = true;
return false;
});
holder.item_binding.spAuditAnswer.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (onspinTouch) {
if (position != 0) {
MasterCheckoutQuestion ans = object.getAns().get(position);
object.setCorrect_ans(ans.getAnswer());
object.setCorrect_ansId(ans.getAnswerId());
object.setImageAllow(ans.getImageAllow());
object.setImageAllowMandatory(ans.getImageAllowMandatory());
if (ans.getImageAllow()) {
holder.item_binding.rlAnsImg.setVisibility(View.VISIBLE);
} else {
holder.item_binding.rlAnsImg.setVisibility(View.GONE);
if (!object.getAnsImg().isEmpty()) {
if (new File(CommonString.getImagesFolder(context) + object.getAnsImg()).exists()) {
new File(CommonString.getImagesFolder(context) + object.getAnsImg()).delete();
}
}
object.setAnsImg("");
}
holder.item_binding.ansImg.setImageResource(object.getImageAllow() && object.getImageAllowMandatory() ? R.mipmap.camera_star : R.mipmap.camera_bs);
holder.item_binding.ansImg.setId(pos);
holder.item_binding.rlAnsImg.setId(pos);
} else {
object.setAnsImg("");
object.setCorrect_ans("");
object.setCorrect_ansId(0);
object.setImageAllow(false);
object.setImageAllowMandatory(false);
holder.item_binding.rlAnsImg.setId(pos);
holder.item_binding.rlAnsImg.setVisibility(View.GONE);
}
}
onspinTouch = false;
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
holder.item_binding.edtAnswer.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
object.setCorrect_ansId(0);
object.setCorrect_ans(((EditText) v).getText().toString());
}
});
holder.item_binding.edtAnswer.setText(object.getCorrect_ans());
holder.item_binding.edtAnswer.setId(pos);
if (object.getAns() != null && !object.getAns().isEmpty()) {
for (int i = 0; i < object.getAns().size(); i++) {
if ((object.getQuestionType().equals("List Single Choice") && object.getAns().get(i).getAnswerId().toString().equals(object.getCorrect_ansId().toString()))) {
holder.item_binding.spAuditAnswer.setSelection(i);
break;
}
}
}
holder.item_binding.questionImg.setOnClickListener(v -> {
_pathforcheck = object.getQuestionId().toString() + "_" + counter_Id + "_CheckoutQuestionImg-" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeHHMMSS().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context) + _pathforcheck;
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
_pos = pos;
});
holder.item_binding.ansImg.setOnClickListener(v -> {
String ansId = object.getCorrect_ansId() != 0 ? object.getCorrect_ansId().toString() + "_" : "";
_pathforcheck = object.getQuestionId().toString() + "_" + ansId + counter_Id + "_CheckoutAnsImg-" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeHHMMSS().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context) + _pathforcheck;
CommonFunctions.startAnncaCameraActivity(context, _path, null, false, CommonString.CAMERA_FACE_REAR);
_pos = pos;
});
if (!img_str.isEmpty()) {
if (_pos == pos) {
if (img_str.contains("_CounterCheckoutImg-")) {
object.setQuestionImg(img_str);
} else {
object.setAnsImg(img_str);
}
img_str = "";
_pos = -1;
}
}
holder.item_binding.rlQImg.setVisibility(object.getQuestionImageAllow() ? View.VISIBLE : View.GONE);
holder.item_binding.rlQImg.setId(pos);
holder.item_binding.questionImg.setImageResource(!object.getQuestionImg().isEmpty() ? R.mipmap.camera_bsd : object.getQuestionImageAllow()
&& object.getQuestionImageMandatory() ? R.mipmap.camera_star : R.mipmap.camera_bs);
holder.item_binding.questionImg.setId(pos);
holder.item_binding.rlAnsImg.setVisibility(object.getImageAllow() ? View.VISIBLE : View.GONE);
holder.item_binding.rlAnsImg.setId(pos);
holder.item_binding.ansImg.setImageResource(!object.getAnsImg().isEmpty() ? R.mipmap.camera_bsd :
object.getImageAllow() && object.getImageAllowMandatory() ? R.mipmap.camera_star : R.mipmap.camera_bs);
holder.item_binding.ansImg.setId(pos);
}
@Override
public int getItemCount() {
return listDataHeader.size();
}
private static class ViewHolder extends RecyclerView.ViewHolder {
ItemBacheckoutBinding item_binding;
private ViewHolder(@NonNull ItemBacheckoutBinding itemBacheckoutBinding) {
super(itemBacheckoutBinding.getRoot());
this.item_binding = itemBacheckoutBinding;
}
}
}
private static class AnswerSpinnerAdapter extends ArrayAdapter<MasterCheckoutQuestion> {
List<MasterCheckoutQuestion> list;
Context context;
int resourceId;
public AnswerSpinnerAdapter(Context context, int resourceId, ArrayList<MasterCheckoutQuestion> list) {
super(context, resourceId, list);
this.context = context;
this.list = list;
this.resourceId = resourceId;
}
@NonNull
@SuppressLint("ViewHolder")
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View view = convertView;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
view = inflater.inflate(resourceId, parent, false);
MasterCheckoutQuestion cm = list.get(position);
TextView txt_spinner = (TextView) view.findViewById(R.id.tv_ans);
txt_spinner.setGravity(Gravity.CENTER_VERTICAL);
txt_spinner.setText(list.get(position).getAnswer());
return view;
}
@Override
public View getDropDownView(int position, View _convertView, @NonNull ViewGroup parent) {
View view = _convertView;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
view = inflater.inflate(resourceId, parent, false);
MasterCheckoutQuestion cm = list.get(position);
TextView txt_spinner = (TextView) view.findViewById(R.id.tv_ans);
txt_spinner.setGravity(Gravity.CENTER_VERTICAL);
txt_spinner.setText(cm.getAnswer());
return view;
}
}
@SuppressLint("NotifyDataSetChanged")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.isEmpty()) {
if (new File(CommonString.getImagesFolder(this) + _pathforcheck).exists()) {
Bitmap bmp = convertBitmap(CommonString.getImagesFolder(this) + _pathforcheck);
if (_pathforcheck.contains("-Checkout_Selfie_img_")) {
try {
binding.contentCheckout.imgSelfie.setImageBitmap(bmp);
} catch (OutOfMemoryError ex) {
CommonFunctions.setScaledImage(binding.contentCheckout.imgSelfie, CommonString.getImagesFolder(this) + _pathforcheck);
}
binding.contentCheckout.imgCamSelfie.setVisibility(View.GONE);
binding.contentCheckout.imgSelfie.setVisibility(View.VISIBLE);
checkout_img_str = _pathforcheck;
} else {
img_str = _pathforcheck;
if (adapter != null) adapter.notifyDataSetChanged();
}
_pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
@SuppressLint("NotifyDataSetChanged")
private boolean validate() {
checkflag = true;
adapter.notifyDataSetChanged();
if (questions != null && !questions.isEmpty()) {
for (int a = 0; a < questions.size(); a++) {
if (questions.get(a).getCorrect_ans().isEmpty()) {
AlertandMessages.showToastMsg(this, "Please " + (questions.get(a).getQuestionType().equals("List Single Choice") ? "Select an answer for the " + questions.get(a).getQuestion() : "provide an answer to the " + questions.get(a).getQuestion()));
checkflag = false;
break;
} else if (questions.get(a).getQuestionImageAllow() && questions.get(a).getQuestionImageMandatory() && questions.get(a).getQuestionImg().isEmpty()) {
AlertandMessages.showToastMsg(this, "Please capture image of the " + questions.get(a).getQuestion());
checkflag = false;
break;
} else if (questions.get(a).getImageAllow() && questions.get(a).getImageAllowMandatory() && questions.get(a).getAnsImg().isEmpty()) {
AlertandMessages.showToastMsg(this, "Please capture image of the " + questions.get(a).getQuestion());
checkflag = false;
break;
}
}
}
return checkflag;
}
@SuppressLint({"StaticFieldLeak", ""})
private class BaCheckoutUpload extends AsyncTask<Void, Void, String> {
private ProgressDialog loading = null;
private boolean uploadflag;
private String errormsg = "";
private Context context;
private BaCheckoutUpload(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
loading = ProgressDialog.show(context, "Uploading Checkout Info", "Please wait...", false, true);
}
@Override
protected String doInBackground(Void... params) {
try {
// uploading BaCheckoutUpload
uploadflag = false;
if (!checkout_img_str.isEmpty()) {
String jsonString2 = getString();
Log.e("jsonString2", jsonString2);
UploadDataWithRetrofit upload = new UploadDataWithRetrofit(context);
String result = upload.uploadDeviceTokenDetails(jsonString2, 420);
if (result.contains("1")) {
uploadflag = true;
} else if (result.equalsIgnoreCase(CommonString.MESSAGE_NO_RESPONSE_SERVER)) {
uploadflag = false;
throw new SocketTimeoutException();
} else if (result.equalsIgnoreCase(CommonString.MESSAGE_SOCKETEXCEPTION)) {
uploadflag = false;
throw new IOException();
} else if (result.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
uploadflag = false;
throw new Exception();
}
}
} catch (IOException ex) {
uploadflag = false;
ex.fillInStackTrace();
errormsg = CommonString.MESSAGE_INTERNET_NOT_AVALABLE;
} catch (JsonSyntaxException ex) {
uploadflag = false;
ex.fillInStackTrace();
errormsg = CommonString.MESSAGE_INVALID_JSON;
} catch (Exception ex) {
uploadflag = false;
errormsg = CommonString.MESSAGE_EXCEPTION;
}
if (uploadflag) {
return CommonString.KEY_SUCCESS;
} else {
return errormsg;
}
}
private @NonNull String getString() throws JSONException {
JSONArray array = new JSONArray();
if (questions != null && !questions.isEmpty()) {
JSONObject jsonObject = null;
for (MasterCheckoutQuestion question : questions) {
jsonObject = new JSONObject();
jsonObject.put("QuestionId", question.getQuestionId());
jsonObject.put("QuestionType", question.getQuestionType());
jsonObject.put("AnswerId", question.getCorrect_ansId());
jsonObject.put("Answer", question.getCorrect_ans());
jsonObject.put("QuestionImg", question.getQuestionImg());
jsonObject.put("AnsImg", question.getAnsImg());
array.put(jsonObject);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("MID", jcp_Object.getMID());
jsonObject.put("BID", jcp_Object.getBID());
jsonObject.put("Latitude", latitude);
jsonObject.put("Longitude", logitude);
jsonObject.put("CheckoutImage", checkout_img_str);
jsonObject.put("JsonQuestion", array.toString());
jsonObject.put("UserId", username);
return jsonObject.toString();
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
if (result != null && result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(context.getString(R.string.parinaam));
builder.setMessage("You have successfully checked out.").setCancelable(false)
.setPositiveButton(android.R.string.ok, (dialog_, id) -> {
runOnUiThread(() -> {
db.open();
db.updateCheckoutStatus(counter_Id, jcp_Object.getBID().toString(), username);
editor = preferences.edit();
editor.putBoolean(CommonString.KEY_IS_CHECKOUT_DONE + username + visit_date, true);
editor.apply();
finishAffinity();
});
dialog_.dismiss();
});
AlertDialog alert = builder.create();
alert.show();
} else {
AlertandMessages.showAlert((Activity) context, getResources().getString(R.string.failure) + " : " + errormsg, true);
}
/// dismiss progress dialog
if (loading != null && loading.isShowing()) loading.dismiss();
}
}
private void showAlertOfLogout() {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this, R.style.MyMaterialAlertDialog)
.setTitle("Hi User!")
.setMessage("Once you have checked out at the store or counter, you cannot log in again for the rest of the day.")
.setCancelable(true);
androidx.appcompat.app.AlertDialog dialog_ = builder.show();
// Auto-dismiss after 5 seconds
new Handler(Looper.getMainLooper()).postDelayed(() -> {
if (dialog_.isShowing()) {
dialog_.dismiss();
}
}, 8000); // 5000 milliseconds = 5 seconds
}
}
@@ -0,0 +1,226 @@
package com.cpm.lorealbaautomation.checkout;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class MasterCheckoutQuestion {
@SerializedName("CategoryId")
private Integer categoryId;
@SerializedName("Category")
private String category;
@SerializedName("QuestionId")
private Integer questionId;
@SerializedName("Question")
private String question;
@SerializedName("QuestionType")
private String questionType;
@SerializedName("QuestionImageAllow")
private Boolean questionImageAllow;
@SerializedName("QuestionImageMandatory")
private Boolean questionImageMandatory;
@SerializedName("QEnable")
private Boolean qEnable;
@SerializedName("LengthValidation")
private Boolean lengthValidation;
@SerializedName("MinLength")
private Integer minLength;
@SerializedName("MaxLength")
private Integer maxLength;
@SerializedName("AnswerId")
private Integer answerId;
@SerializedName("Answer")
private String answer;
@SerializedName("ImageAllow")
private Boolean imageAllow;
@SerializedName("ImageAllowMandatory")
private Boolean imageAllowMandatory;
@SerializedName("QuestionEnable")
private String questionEnable;
@SerializedName("QuestionDisable")
private String questionDisable;
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Integer getQuestionId() {
return questionId;
}
public void setQuestionId(Integer questionId) {
this.questionId = questionId;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getQuestionType() {
return questionType;
}
public void setQuestionType(String questionType) {
this.questionType = questionType;
}
public Boolean getQuestionImageAllow() {
return questionImageAllow;
}
public void setQuestionImageAllow(Boolean questionImageAllow) {
this.questionImageAllow = questionImageAllow;
}
public Boolean getQuestionImageMandatory() {
return questionImageMandatory;
}
public void setQuestionImageMandatory(Boolean questionImageMandatory) {
this.questionImageMandatory = questionImageMandatory;
}
public Boolean getQEnable() {
return qEnable;
}
public void setQEnable(Boolean qEnable) {
this.qEnable = qEnable;
}
public Boolean getLengthValidation() {
return lengthValidation;
}
public void setLengthValidation(Boolean lengthValidation) {
this.lengthValidation = lengthValidation;
}
public Integer getMinLength() {
return minLength;
}
public void setMinLength(Integer minLength) {
this.minLength = minLength;
}
public Integer getMaxLength() {
return maxLength;
}
public void setMaxLength(Integer maxLength) {
this.maxLength = maxLength;
}
public Integer getAnswerId() {
return answerId;
}
public void setAnswerId(Integer answerId) {
this.answerId = answerId;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public Boolean getImageAllow() {
return imageAllow;
}
public void setImageAllow(Boolean imageAllow) {
this.imageAllow = imageAllow;
}
public Boolean getImageAllowMandatory() {
return imageAllowMandatory;
}
public void setImageAllowMandatory(Boolean imageAllowMandatory) {
this.imageAllowMandatory = imageAllowMandatory;
}
public String getQuestionEnable() {
return questionEnable;
}
public void setQuestionEnable(String questionEnable) {
this.questionEnable = questionEnable;
}
public String getQuestionDisable() {
return questionDisable;
}
public void setQuestionDisable(String questionDisable) {
this.questionDisable = questionDisable;
}
public String getQuestionImg() {
return questionImg;
}
public void setQuestionImg(String questionImg) {
this.questionImg = questionImg;
}
public String getAnsImg() {
return ansImg;
}
public void setAnsImg(String ansImg) {
this.ansImg = ansImg;
}
public Integer getCorrect_ansId() {
return correct_ansId;
}
public void setCorrect_ansId(Integer correct_ansId) {
this.correct_ansId = correct_ansId;
}
public String getCorrect_ans() {
return correct_ans;
}
public void setCorrect_ans(String correct_ans) {
this.correct_ans = correct_ans;
}
String questionImg="";
String ansImg="";
Integer correct_ansId=0;
String correct_ans="";
ArrayList<MasterCheckoutQuestion>ans=new ArrayList<>();
public ArrayList<MasterCheckoutQuestion> getAns() {
return ans;
}
public void setAns(ArrayList<MasterCheckoutQuestion> ans) {
this.ans = ans;
}
}
@@ -322,14 +322,11 @@ public class CommonFunctions {
}
public static String setTimeFormat(String start_dt) {
//test("xxxd" + start_dt);
String newvalue = "";
try {
if (!start_dt.isEmpty()) {
String s[] = start_dt.split(":");
//test("time-----------------" + s[0] + "parseint" + Integer.parseInt(s[0]));
int t = Integer.parseInt(s[0]);
//test("vv....." + t);
if (t < 12) {
s[0] = Integer.valueOf(s[0]).toString();
if (Integer.parseInt(s[0]) < 10 && s[0].length() == 0) {
@@ -337,7 +334,6 @@ public class CommonFunctions {
} else {
newvalue = s[0] + ":" + s[1] + ":" + s[2];
}
//test("value..." + newvalue);
} else {
int time = Integer.parseInt(s[0]) - 12;
if (time < 10) {
@@ -345,8 +341,6 @@ public class CommonFunctions {
} else {
newvalue = "0" + time + ":" + s[1] + ":" + s[2];
}
//test("value..." + newvalue);
}
}
} catch (NumberFormatException e) {
@@ -56,6 +56,7 @@ public class CommonString {
public static final String KEY_PASSWORD = "PASSWORD";
public static final String KEY_MPIN = "MPIN";
public static final String KEY_STATUS = "STATUS";
public static final String KEY_IS_CHECKOUT_DONE = "is_checkout_done";
public static final String KEY_INCORRECT_TSTOCK_SUMMERY = "TSTOCK_SUMMERY";
public static final String KEY_MY_KNOWLEDGE_URL = "https://lba.parinaam.in/WebView/ViewContent?Counter_Id=";
public static final String KEY_DATE = "DATE";
@@ -11,6 +11,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import com.cpm.lorealbaautomation.utils.NonScrollExpandableListView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.annotation.NonNull;
@@ -102,7 +103,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> hashMapAnsListChildData;
int child_position = -1;
String error_msg = "";
ExpandableListView expandableListView;
NonScrollExpandableListView expandableListView;
ExpandableListAdapter adapter;
ArrayList<MasterProfileQuestion> listDataHeader = new ArrayList<>();
HashMap<MasterProfileQuestion, ArrayList<AuditDataGetterSetter>> listDataChild;
@@ -190,7 +191,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
@SuppressLint("NonConstantResourceId")
@Override
public void onClick(View view) {
if (view.getId() == R.id.img_dob) {
c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
@@ -216,6 +216,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
if (file != null) {
for (File value : file) arrayFiles.add(value.getName());
}
return arrayFiles;
}
@@ -242,7 +243,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
void getQuizProfileData() {
hashMapAnsListChildData = new HashMap<>();
childListData = new ArrayList<>();
expandableListView = (ExpandableListView) findViewById(R.id.list);
expandableListView = (NonScrollExpandableListView) findViewById(R.id.list);
db.open();
listDataHeader = db.getAuditQuestionCategoryData(user_type);
question_list = new ArrayList<>();
@@ -268,7 +269,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
db.open();
childListData = db.getAuditAnswerData(question_list.get(j), select);
if (question_list.get(j).getANSWER_TYPE().equalsIgnoreCase("Multi selection")) {
if (question_list.get(j).getANSWER() != null) {
if (question_list.get(j).getANSWER() != null && !question_list.get(j).getANSWER().isEmpty()) {
final ArrayList<KeyPairBoolData> finalSelectedSamplingData = getKeyPairBoolData(j);
question_list.get(j).setSelectedSamplingData(finalSelectedSamplingData);
}
@@ -277,13 +278,10 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
hashMapAnsListChildData.put(question_list.get(j), answerList); // Header, Child data
}
}
listDataChild.put(listDataHeader.get(i), question_list);
}
adapter = new ExpandableListAdapter(context, listDataHeader, listDataChild);
expandableListView.setAdapter(adapter);
expandableListView.setAdapter(adapter);
for (int i = 0; i < adapter.getGroupCount(); i++) {
expandableListView.expandGroup(i);
}
@@ -304,7 +302,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
fab.show();//setVisibility(View.VISIBLE);
}
}
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -312,7 +309,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
expandableListView.invalidateViews();
}
});
@@ -321,13 +317,14 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
fab.setOnClickListener(view -> {
expandableListView.clearFocus();
expandableListView.invalidateViews();
baProfileGetterSetter.setLandmark(edt_landmark.getText().toString().trim().replaceAll("[(!@#$%^&*?)\"]", ""));
baProfileGetterSetter.setLocation(edt_location.getText().toString().trim().replaceAll("[(!@#$%^&*?)\"]", ""));
baProfileGetterSetter.setAddress(edt_address.getText().toString().trim().replaceAll("[(!@#$%^&*?)\"]", ""));
baProfileGetterSetter.setLandmark(edt_landmark.getText().toString().trim().replaceAll("[(!@#$%^&*'?)\"]", ""));
baProfileGetterSetter.setLocation(edt_location.getText().toString().trim().replaceAll("[(!@#$%^&'*?)\"]", ""));
baProfileGetterSetter.setAddress(edt_address.getText().toString().trim().replaceAll("[(!@#$%^&*'?)\"]", ""));
baProfileGetterSetter.setDob(storeProfile_dob.getText().toString());
baProfileGetterSetter.setMobile(edt_mobile_no.getText().toString().trim());
baProfileGetterSetter.setEmail(edt_email.getText().toString().trim());
baProfileGetterSetter.setInstragramAddress(edt_enstagram_address.getText().toString());
baProfileGetterSetter.setProfilePic(img_str != null && !img_str.isEmpty() ? img_str : baProfileListData.get(0).getProfilePic());
if (validateimg_str()) {
if (validateData(listDataHeader, listDataChild)) {
AlertDialog.Builder builder = new AlertDialog.Builder(context).setTitle(R.string.parinaam);
@@ -375,6 +372,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
h1.setSelected(question_list.get(j).getANSWER().contains(childListData.get(k).getANSWER()));
finalSelectedSamplingData.add(h1);
}
return finalSelectedSamplingData;
}
@@ -396,6 +394,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
return super.onOptionsItemSelected(item);
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
if (backpress_flag) {
@@ -530,7 +529,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
finalHolder.edt_for_others.setText("");
finalHolder.edt_for_others.setVisibility(View.GONE);
finalHolder.edt_for_others.setId(childPosition);
}
} else {
finalHolder.data.setANSWER_ID("0");
@@ -553,12 +551,10 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
});
List<KeyPairBoolData> listArray0 = new ArrayList<>();
if (!checkList.getSelectedSamplingData().isEmpty()) {
selectedSamplingData.clear();
listArray0.addAll(checkList.getSelectedSamplingData());
holder.tv_mer.setVisibility(View.GONE);
} else {
for (int i = 0; i < ans_list.size(); i++) {
KeyPairBoolData h = new KeyPairBoolData();
@@ -568,8 +564,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
h.setMerCd(merCd);
h.setSelected(false);
listArray0.add(h);
holder.tv_mer.setVisibility(View.GONE);
}
}
@@ -596,25 +590,17 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
if (!finalSelectedSamplingData.isEmpty()) {
boolean selectedData = false;
for (int i = 0; i < finalSelectedSamplingData.size(); i++) {
if (finalSelectedSamplingData.get(i).isSelected()) {
selectedData = true;
break;
}
}
finalHolder2.tv_mer.setVisibility(View.GONE);
finalHolder2.tv_mer.setId(childPosition);
} else {
finalHolder2.tv_mer.setVisibility(View.GONE);
finalHolder2.tv_mer.setId(childPosition);
}
checkList.setSelectedSamplingData(finalSelectedSamplingData);
adapter.notifyDataSetChanged();
}
multitouch = false;
});
holder.img_cam.setOnClickListener(v -> {
pathforcheck = counterId + "_ba_AuditPic_" + visitdate.replace("/", "") + CommonFunctions.getCurrentTimeHHMMSS().replace(":", "") + ".jpg";
_path = CommonString.getImagesFolder(context) + pathforcheck;
@@ -630,8 +616,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
});
holder.edt_for_others.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
finalHolder1.data.setSpin_others_for_edt(CommonFunctions.removed_special_char((EditText) v));
@@ -647,14 +631,9 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
}
}
}
holder.edt_for_others.setText(holder.data.getSpin_others_for_edt());
holder.edt_for_others.setId(childPosition);
} else if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Number") || holder.data.getANSWER_TYPE().equalsIgnoreCase("Decimal") || holder.data.getANSWER_TYPE().equalsIgnoreCase("Text")) {
holder.edt_answer.setText(holder.data.getANSWER());
holder.edt_answer.setId(childPosition);
}
@@ -760,13 +739,11 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
CardView card_view;
public final RelativeLayout relay_multisppener;
BaProfileMultiSelection searchSpinner;
public final TextView tv_mer;
AuditDataGetterSetter data;
public ViewHolder(View view) {
super(view);
mView = view;
tv_mer = (TextView) view.findViewById(R.id.tv_mer);
txt_question = (TextView) view.findViewById(R.id.txt_question);
sp_auditAnswer = (Spinner) view.findViewById(R.id.sp_auditAnswer);
card_view = (CardView) view.findViewById(R.id.card_view);
@@ -893,7 +870,6 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
} catch (OutOfMemoryError ex) {
CommonFunctions.setScaledImage(round_img_pic, CommonString.getImagesFolder(context) + pathforcheck);
}
round_img_pic.setVisibility(View.VISIBLE);
img_str = pathforcheck;
baProfileGetterSetter.setProfilePic(img_str);
@@ -901,6 +877,7 @@ public class BAProfileActivity extends AppCompatActivity implements View.OnClick
pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
@@ -197,6 +197,7 @@ public class BASurveyActivity extends AppCompatActivity {
expandableListView.clearFocus();
if (validateData(listDataHeader, listDataChild)) {
if (CommonFunctions.checkNetIsAvailable(context)) {
AlertDialog.Builder builder = new AlertDialog.Builder(context).setTitle(R.string.parinaam).setMessage(R.string.ba_survey_save_data_msg)
.setCancelable(false)
.setPositiveButton(R.string.yes, (dialog, id) -> {
@@ -428,7 +429,6 @@ public class BASurveyActivity extends AppCompatActivity {
@SuppressLint({"NewApi", "InflateParams"})
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
BASurveyGetterSetter checkList = (BASurveyGetterSetter) getChild(groupPosition, childPosition);
ViewHolder holder = null;
if (convertView == null) {
@@ -4,11 +4,13 @@ import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable;
import android.location.LocationManager;
import com.google.android.gms.common.api.ResolvableApiException;
@@ -24,12 +26,17 @@ import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.google.android.gms.location.LocationServices;
@@ -174,6 +181,7 @@ public class CounterImageActivity extends AppCompatActivity implements
return super.onOptionsItemSelected(item);
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
if (click_flag) {
@@ -193,7 +201,6 @@ public class CounterImageActivity extends AppCompatActivity implements
@SuppressLint("NonConstantResourceId")
@Override
public void onClick(View view) {
if (view.getId() == R.id.counter_img_one) {
if (!update_flag) {
click_flag = false;
@@ -341,11 +348,9 @@ public class CounterImageActivity extends AppCompatActivity implements
if (_pathforcheck.contains("_presetup_counter_img_one_")) {
presetup_img_one.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
counterimg_object.setPresetup_img_one_str(_pathforcheck);
} else if (_pathforcheck.contains("_presetup_counter_img_two_")) {
presetup_img_two.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
counterimg_object.setPresetup_img_two_str(_pathforcheck);
} else if (_pathforcheck.contains("_postsetup_counter_img_one_")) {
post_setup_img_one.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
counterimg_object.setPostsetup_img_one_str(_pathforcheck);
@@ -376,24 +381,24 @@ public class CounterImageActivity extends AppCompatActivity implements
@SuppressLint("UseCompatLoadingForDrawables")
private void validate_ui() {
if (!counterimg_object.getPresetup_img_one_str().isEmpty()) {
presetup_img_one.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
presetup_img_one.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
if (!counterimg_object.getPresetup_img_two_str().isEmpty()) {
presetup_img_two.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
presetup_img_two.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
if (!counterimg_object.getPostsetup_img_one_str().isEmpty()) {
post_setup_img_one.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
post_setup_img_one.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
if (!counterimg_object.getPostsetup_img_two_str().isEmpty()) {
post_setup_img_two.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
post_setup_img_two.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
if (!counterimg_object.getCounter_img_onefor_ba().isEmpty()) {
counter_img_one.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
counter_img_one.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
if (!counterimg_object.getCounter_img_two_for_ba().isEmpty()) {
counter_img_two.setImageDrawable(getResources().getDrawable(R.mipmap.camera_bsd));
counter_img_two.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_bsd));
}
}
@@ -423,27 +428,39 @@ public class CounterImageActivity extends AppCompatActivity implements
}
public void showAlertProfile(final Context context) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
final Dialog dialogcounter = new Dialog(context);
Objects.requireNonNull(dialogcounter.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialogcounter.setContentView(R.layout.dialog_alert_profile);
Window window = dialogcounter.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.CENTER;
window.setAttributes(wlp);
dialogcounter.setCancelable(false);
dialogcounter.setCanceledOnTouchOutside(false);
RelativeLayout rl_dialog = dialogcounter.findViewById(R.id.rl_dialog);
rl_dialog.setOnClickListener(view -> {
startActivity(new Intent(context, BAProfileActivity.class));
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
dialogcounter.dismiss();
});
dialogcounter.show();
}
@Override
protected void onResume() {
super.onResume();
db.open();
checkgpsEnableDevice();
createLocationRequest();
if (!db.isBaProfileFilled(counter_id, username, user_type)) {
showAlertProfile(context);
} else if (db.getSaveServerData(null, username).isEmpty()) {
showAlertProfile(context);
}
@SuppressLint("VisibleForTests")
protected void createLocationRequest() {
LocationRequest mLocationRequest = new LocationRequest();
// Location updates intervals in sec
// 5 sec
int UPDATE_INTERVAL = 5000;
mLocationRequest.setInterval(UPDATE_INTERVAL);
// 1 sec
int FATEST_INTERVAL = 1000;
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// 10 meters
int DISPLACEMENT = 5;
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
}
private void checkgpsEnableDevice() {
@@ -493,8 +510,6 @@ public class CounterImageActivity extends AppCompatActivity implements
if (mgr == null)
return false;
final List<String> providers = mgr.getAllProviders();
if (providers == null)
return false;
return providers.contains(LocationManager.GPS_PROVIDER);
}
}
@@ -97,21 +97,22 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class StoreImageActivity extends AppCompatActivity implements View.OnClickListener {
private static final int PERMISSION_ALL = 99;
Button btn_save;
ImageView img_cam, img_clicked;
String _pathforcheck, _path, str, img_str, selfie_imge, visit_date, username, counter_id, userType;
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;
Runnable run;
Toolbar toolbar;
ProgressDialog loading;
private Runnable run;
private Toolbar toolbar;
private ProgressDialog loading;
private Retrofit adapter;
private Integer versionCode, mid = 0, bid = 0, storeId = 0;
private double lat = 0.0;
private double lon = 0.0;
private static final int REQUEST_LOCATION = 1;
boolean clickFlag = false, success_geoTag = true;
private static final int REQUEST_LOCATION = 1;
private FusedLocationProviderClient fusedLocationClient = null;
private LocationCallback locationCallback = null;
private SharedPreferences.Editor editor = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -120,6 +121,7 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
db = new Lorealba_Database(this);
db.open();
SharedPreferences preferences = PrefHelper.getPrefs(this);
editor = preferences.edit();
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
img_cam = (ImageView) findViewById(R.id.img_selfie);
@@ -295,6 +297,7 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
return bitmap;
}
@SuppressLint("MissingSuperCall")
@Override
public void onBackPressed() {
if (clickFlag) {
@@ -636,13 +639,19 @@ public class StoreImageActivity extends AppCompatActivity implements View.OnClic
} else if (!data.contains("No Data")) {
JCPGetterSetter jcpObject;
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
AlertandMessages.showAlert((Activity) context, "Mapping_JCP data not saved.", true);
} else {
db.open();
if (jcpObject != null && db.insertJCPData(jcpObject)) {
/// checking GeoFencing
getLastLocation();
checkingGeoFencing(getMid());
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")) {
editor.putBoolean(CommonString.KEY_IS_CHECKOUT_DONE + username + visit_date, true);
editor.apply();
}
} else {
AlertandMessages.showToastMsg(context, "JCP data not saved");
}
} else {
AlertandMessages.showAlert((Activity) context, "No Journey Plan", true);
@@ -34,12 +34,16 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.cpm.lorealbaautomation.constant.CommonFunctions;
import com.cpm.lorealbaautomation.gsonGetterSetter.JourneyPlan;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.SettingsClient;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
@@ -81,34 +85,22 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class TabLoginActivity extends AppCompatActivity implements View.OnClickListener {
private String counterId = "";
private String str_updated_date = "0";
private String visitdate = "";
private String counterId = "", str_updated_date = "0", visitdate = "", tag_from = "", userId, passwordData, app_ver, manufacturer, model, os_version;
private Spinner sp_sppiner;
private EditText password;
private Button btncontinue;
private String tag_from = "";
private Context context;
private SharedPreferences preferences;
Lorealba_Database db;
private Lorealba_Database db;
ArrayList<BaListGetterSetter> bsListData = new ArrayList<>();
String userId;
String passwordData;
LoginGetterSetter loginGetterSetter;
private int versionCode;
ProgressDialog loading;
private String[] imeiNumbers;
private SharedPreferences.Editor editor = null;
private double lat = 0.0;
private double lon = 0.0;
private double lat = 0.0, lon = 0.0;
private static final int REQUEST_LOCATION = 1;
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
private LocationRequest mLocationRequest;
private ImeiNumberClass imei;
private String app_ver;
private String manufacturer;
private String model;
private String os_version;
ArrayList<LoginGetterSetter> allLoginListData = new ArrayList<>();
TextView forgot_password, versioncode_txt;
private FirebaseAnalytics mFirebaseAnalytics;
@@ -125,52 +117,50 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
getViewId();
setSppinerData();
checkAndRequestPermissions();
createLocationRequest();
getLastLocation();
/* To restrict Space Bar in Keyboard */
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
InputFilter filter = (source, start, end, dest, dstart, dend) -> {
for (int i = start; i < end; i++) {
if (Character.isWhitespace(source.charAt(i))) {
return "";
}
}
return null;
}
};
password.setFilters(new InputFilter[]{filter});
showAlertForLogoutUser(false);
}
private void showAlertForLogoutUser(boolean clicked) {
if (userId != null && !userId.isEmpty()) {
JourneyPlan jcp = db.getBIDfromJCP(userId, counterId);
if ((jcp != null && jcp.getCheckout() != null && jcp.getCheckout().equals("Y")) || preferences.getBoolean(CommonString.KEY_IS_CHECKOUT_DONE + userId + visitdate, false)) {
new MaterialAlertDialogBuilder(this, R.style.MyMaterialAlertDialog)
.setTitle("Alert")
.setMessage("You have already checked-out in Store/Counter.You can't login again for today.").setCancelable(false)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
finishAffinity();
}).show();
} else if (clicked) {
attemptLogin();
}
}
}
@Override
protected void onResume() {
super.onResume();
checkgpsEnableDevice();
createLocationRequest();
imeiNumbers = imei.getDeviceImei();
getDeviceName();
}
@SuppressLint("VisibleForTests")
protected void createLocationRequest() {
LocationRequest mLocationRequest = new LocationRequest();
// Location updates intervals in sec
// 5 sec
int UPDATE_INTERVAL = 5000;
mLocationRequest.setInterval(UPDATE_INTERVAL);
// 1 sec
int FATEST_INTERVAL = 1000;
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// 10 meters
int DISPLACEMENT = 5;
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
}
private void checkgpsEnableDevice() {
if (!hasGPSDevice(context)) {
Toast.makeText(context, "Gps not Supported", Toast.LENGTH_SHORT).show();
}
final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER) && hasGPSDevice(context)) {
enableLocationSettings();
@@ -189,9 +179,7 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
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.
@@ -213,8 +201,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
if (mgr == null)
return false;
final List<String> providers = mgr.getAllProviders();
if (providers == null)
return false;
return providers.contains(LocationManager.GPS_PROVIDER);
}
@@ -224,7 +210,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
db = new Lorealba_Database(context);
db.open();
preferences = PrefHelper.getPrefs(this);
// preferences = PrefHelper.getPrefs(this);
editor = preferences.edit();
sp_sppiner = (Spinner) findViewById(R.id.sp_sppiner);
password = (EditText) findViewById(R.id.password);
@@ -233,7 +218,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
TextView counter_name = (TextView) findViewById(R.id.counter_name);
forgot_password = (TextView) findViewById(R.id.forgot_password);
versioncode_txt = (TextView) findViewById(R.id.versioncode_txt);
String tag_mode = "";
if (getIntent().getSerializableExtra(CommonString.TAG_FROM) != null && getIntent().getSerializableExtra(CommonString.TAG_MODE) != null) {
tag_from = getIntent().getStringExtra(CommonString.TAG_FROM);
@@ -256,7 +240,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
// TODO Auto-generated catch block
e.fillInStackTrace();
}
user_type_login.setText(tag_mode);
counterId = preferences.getString(CommonString.KEY_COUNTER_ID, "");
String counterCode = preferences.getString(CommonString.KEY_COUNTER_CODE, "");
@@ -266,14 +249,15 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
db.open();
bsListData = db.getBAListData(tag_from, counterId);
btncontinue.setOnClickListener(v -> {
if (checkNetIsAvailable()) {
if (CommonFunctions.checkNetIsAvailable(context)) {
if (validation()) {
attemptLogin();
showAlertForLogoutUser(true);
}
} else {
AlertandMessages.showAlert((Activity) context, CommonString.MESSAGE_INTERNET_NOT_AVALABLE, false);
}
});
forgot_password.setOnClickListener(this);
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(getPackageName(), 0);
@@ -291,7 +275,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
for (int i = 0; i < bsListData.size(); i++) {
store_visited_adapter.add(bsListData.get(i).getUserName());
}
store_visited_adapter.setDropDownViewResource(R.layout.spinner_custom_item);
sp_sppiner.setAdapter(store_visited_adapter);
sp_sppiner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@@ -307,7 +290,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
db.updateVisitDateLoginData(userId, visitdate);
str_updated_date = "1";
}
db.open();
allLoginListData = db.getlistAllUserIdData(visitdate, userId, false);
if (!allLoginListData.isEmpty()) {
@@ -337,14 +319,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
private void attemptLogin() {
passwordData = password.getText().toString().trim();
AttempLogin();
}
private boolean checkNetIsAvailable() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
}
@@ -653,7 +627,6 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
Integer.valueOf(PackageManager.PERMISSION_GRANTED).equals(perms.get(Manifest.permission.READ_PHONE_STATE));
if (allPermissionsGranted) {
//test("Permissions", "All required permissions granted");
createLocationRequest();
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
getLastLocation();
getDeviceName();
@@ -686,6 +659,7 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
@@ -693,6 +667,7 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
loading.dismiss();
}
}
private void getLastLocation() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
@@ -705,12 +680,10 @@ public class TabLoginActivity extends AppCompatActivity implements View.OnClick
if (location != null) {
lat = location.getLatitude();
lon = location.getLongitude();
//test("Location", "Lat: " + lat + ", Lng: " + lon);
}
});
} catch (Exception e) {
e.fillInStackTrace();
//test("Location", "Lat: " + lat + ", Lng: " + lon);
}
}
}
@@ -169,16 +169,10 @@ public class DownloadActivity extends AppCompatActivity {
keysList.add("Report_SalesDateWiseME");
keysList.add("Report_SalesL3MValueME");
keysList.add("Report_MTD_WorkingCounterME");
//keysList.add("Report_ME_Sale");
///new reports added 25/5/024
keysList.add("AppDashboard_TVA");
keysList.add("AppDashboard_TVADrillDown");
keysList.add("AppDashboard_LeaderBoard");
keysList.add("AppDashboard_Incentive");
/* All reports replaced by new reports
keysList.add("AppDashboard_L3MOffTake_Counter");
keysList.add("AppDashboard_L3MOffTake_Nuance");
keysList.add("AppDashboard_L3MOffTake_SubAxe");*/
keysList.add("ReportDaily_TVA");
keysList.add("Report_SalesGrowth_Counter");
keysList.add("Report_SalesGrowth_CounterDetail");
@@ -198,6 +192,7 @@ public class DownloadActivity extends AppCompatActivity {
keysList.add("Master_HolidayList");
keysList.add("T_LeaveLedgerSummary");
keysList.add("Mapping_AppRestrictedKPI");
keysList.add("Master_CheckoutQuestion");
keysList.add("Product_Master");
}
@@ -3,7 +3,9 @@ package com.cpm.lorealbaautomation.download;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import com.google.gson.JsonObject;
@@ -119,16 +121,13 @@ public class Downloader extends JobIntentService {
////for upload quiz data me
quizList = db.getme_quiz_from_database(null, null, visit_date, counter_id, null);
calculate_me_quiz_data(db.getBIDfromJCP(username, counter_id), quizList);
}
else if(masterRetailExcellenceArrayList!=null){
} else if (masterRetailExcellenceArrayList != null) {
masterRetailExcellenceArrayList = db.getRetailExcellencedata(null, null, visit_date, counter_id);
calculate_retail_excellence_data(db.getBIDfromJCP(username, counter_id), masterRetailExcellenceArrayList);
}
else if(productMasterArrayList!=null){
} else if (productMasterArrayList != null) {
productMasterArrayList = db.getMeSaledata(null, null, visit_date, counter_id);
calculate_me_sale_data(db.getBIDfromJCP(username, counter_id), productMasterArrayList);
}
else if (counterimg_object != null) {
} else if (counterimg_object != null) {
UploadCounterProfile();
} else if (baProfileImage != null) {
UploadBaProfile();
@@ -213,7 +212,7 @@ public class Downloader extends JobIntentService {
Call<JsonObject> call = api.getGeotag(jsonData);
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
String responseBody = response.body().get("UploadJsonResult").toString();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -236,8 +235,9 @@ public class Downloader extends JobIntentService {
}
}
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t) {
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
}
});
@@ -253,26 +253,14 @@ public class Downloader extends JobIntentService {
JSONArray topUpArray = new JSONArray();
JSONArray storeDetail = new JSONArray();
if (baProfileImage != null) {
if (baProfile != null && baProfile.getBaProfileList().size() > 0) {
if (baProfile != null && !baProfile.getBaProfileList().isEmpty()) {
for (int j = 0; j < baProfile.getBaProfileList().size(); j++) {
JSONObject obj = new JSONObject();
obj.put("Category_Id", baProfile.getBaProfileList().get(j).getCATEGORY_ID());
obj.put("Question_Id", baProfile.getBaProfileList().get(j).getQUESTION_ID());
obj.put("Question", baProfile.getBaProfileList().get(j).getQUESTION());
obj.put("Answer_type", baProfile.getBaProfileList().get(j).getANSWER_TYPE());
obj.put("Answer_Id", baProfile.getBaProfileList().get(j).getANSWER_ID());
obj.put("Answer", baProfile.getBaProfileList().get(j).getANSWER());
obj.put("OthersTextValue", baProfile.getBaProfileList().get(j).getSpin_others_for_edt());
obj.put("Visit_Date", visit_date);
obj.put("MID", mid);
obj.put("UserId", username);
obj.put("Counter_id", counter_id);
JSONObject obj = getJsonObject(j);
topUpArray.put(obj);
}
}
if (baProfileImage.getProfilePic() != null && !baProfileImage.getProfilePic().equals("")) {
if (baProfileImage != null && baProfileImage.getProfilePic() != null && !baProfileImage.getProfilePic().isEmpty()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("Address", baProfileImage.getAddress());
jsonObject.put("Dob", baProfileImage.getDob());
@@ -285,15 +273,13 @@ public class Downloader extends JobIntentService {
jsonObject.put("MID", mid);
jsonObject.put("UserId", username);
jsonObject.put("Counter_id", counter_id);
if (baProfile != null && baProfile.getBaProfileList().size() > 0) {
if (baProfile != null && !baProfile.getBaProfileList().isEmpty()) {
jsonObject.put("BA_PROFILE_DATA", topUpArray);
} else {
jsonObject.put("BA_PROFILE_DATA", "");
}
storeDetail.put(jsonObject);
}
JSONObject jsonFinalObject = new JSONObject();
jsonFinalObject.put("MID", mid);
jsonFinalObject.put("Keys", "BaProfileData");
@@ -306,6 +292,23 @@ public class Downloader extends JobIntentService {
}
}
@NonNull
private JSONObject getJsonObject(int j) throws JSONException {
JSONObject obj = new JSONObject();
obj.put("Category_Id", baProfile.getBaProfileList().get(j).getCATEGORY_ID());
obj.put("Question_Id", baProfile.getBaProfileList().get(j).getQUESTION_ID());
obj.put("Question", baProfile.getBaProfileList().get(j).getQUESTION());
obj.put("Answer_type", baProfile.getBaProfileList().get(j).getANSWER_TYPE());
obj.put("Answer_Id", baProfile.getBaProfileList().get(j).getANSWER_ID());
obj.put("Answer", baProfile.getBaProfileList().get(j).getANSWER());
obj.put("OthersTextValue", baProfile.getBaProfileList().get(j).getSpin_others_for_edt());
obj.put("Visit_Date", visit_date);
obj.put("MID", mid);
obj.put("UserId", username);
obj.put("Counter_id", counter_id);
return obj;
}
private void UploadCounterProfile() {
try {
JSONArray storeDetail = new JSONArray();
@@ -377,7 +380,7 @@ public class Downloader extends JobIntentService {
Call<JsonObject> call = api.getGeotag(jsonData);
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
String responseBody = response.body().get("UploadJsonResult").toString();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -400,7 +403,7 @@ public class Downloader extends JobIntentService {
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t) {
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
}
});
@@ -418,7 +421,6 @@ public class Downloader extends JobIntentService {
displayFormat = new SimpleDateFormat("HH:mm");
parseFormat = new SimpleDateFormat("hh:mm a");
date = parseFormat.parse(str);
//test(parseFormat.format(date) + " = " + displayFormat.format(date));
} catch (ParseException e) {
e.fillInStackTrace();
}
@@ -466,7 +468,7 @@ public class Downloader extends JobIntentService {
Call<JsonObject> call = api.getGeotag(jsonData);
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
String responseBody = response.body().get("UploadJsonResult").toString();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -489,7 +491,7 @@ public class Downloader extends JobIntentService {
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t) {
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
}
});
@@ -533,7 +535,7 @@ public class Downloader extends JobIntentService {
Call<JsonObject> call = api.getGeotag(jsonData);
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
String responseBody = response.body().get("UploadJsonResult").toString();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -554,7 +556,7 @@ public class Downloader extends JobIntentService {
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t) {
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
}
});
@@ -603,7 +605,7 @@ public class Downloader extends JobIntentService {
Call<JsonObject> call = api.getGeotag(jsonData);
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
String responseBody = response.body().get("UploadJsonResult").toString();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -628,7 +630,7 @@ public class Downloader extends JobIntentService {
}
@Override
public void onFailure(Call<JsonObject> call, Throwable t) {
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
}
});
@@ -701,6 +703,8 @@ public class Downloader extends JobIntentService {
foldername = "CompetitionOffersImages";
} else if (finalList.get(i).contains("_GeoTag-")) {
foldername = "GeoTagImages";
} else if (finalList.get(i).contains("-Checkout_Selfie_img_") || finalList.get(i).contains("_CheckoutQuestionImg-") || finalList.get(i).contains("_CheckoutAnsImg-")) {
foldername = "CheckoutImages";
} else {
foldername = "BulkUpload";
}
@@ -711,7 +715,6 @@ public class Downloader extends JobIntentService {
break;
}
File originalFile = new File(CommonString.getImagesFolder(context) + filename);
File finalFile = saveBitmapToFile(originalFile);
if (finalFile == null) {
@@ -738,11 +741,11 @@ public class Downloader extends JobIntentService {
@Override
public void onResponse(retrofit.Response<String> response) {
try {
Log.d("IMG_response", response.body() + " --- File_name ----" + finalFilename);
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();
db.insert_temp_image(finalFilename, visit_date);
} else {
finalFile1.delete();
}
@@ -914,6 +917,7 @@ public class Downloader extends JobIntentService {
e.fillInStackTrace();
}
}
public void upload_ME_Quiz_Data(String jsondata, final ArrayList<MEMEAuditQuestion> me_quizList) {
try {
OkHttpClient okHttpClient = new OkHttpClient.Builder().readTimeout(CommonString.TIMEOUT, TimeUnit.SECONDS).writeTimeout(CommonString.TIMEOUT,
@@ -970,8 +974,7 @@ public class Downloader extends JobIntentService {
obj.put("ItemId", masterRetailExcellenceArrayList.get(k).getItemId());
if (masterRetailExcellenceArrayList.get(k).getAnswer().equalsIgnoreCase("Yes")) {
obj.put("Available", 1);
}
else{
} else {
obj.put("Available", 0);
}
consumerUserInfoArray.put(obj);
@@ -8,125 +8,128 @@ import java.io.Serializable;
public class JourneyPlan implements Serializable {
@SerializedName("StoreId")
@Expose
private Integer storeId;
@SerializedName("CounterId")
@Expose
private Integer counterId;
@SerializedName("EmpId")
@Expose
private Integer empId;
@SerializedName("ChainId")
@Expose
private Integer chainId;
@SerializedName("ChainName")
@Expose
private String chainName;
@SerializedName("StoreName")
@Expose
private String storeName;
@SerializedName("Address")
@Expose
private String address;
@SerializedName("Location")
@Expose
private String location;
@SerializedName("Landmark")
@Expose
private String landmark;
@SerializedName("CityId")
@Expose
private Integer cityId;
@SerializedName("CityName")
@Expose
private String cityName;
@SerializedName("CounterName")
@Expose
private String counterName;
@SerializedName("IMEI")
@Expose
private String iMEI;
@SerializedName("ChannelId")
@Expose
private Integer channelId;
@SerializedName("ChannelName")
@Expose
private String channelName;
@SerializedName("StoreTypeId")
@Expose
private Integer storeTypeId;
@SerializedName("StoreTypeName")
@Expose
private String storeTypeName;
@SerializedName("ClassId")
@Expose
private Integer classId;
@SerializedName("ClassName")
@Expose
private String className;
@SerializedName("CounterGroupId")
@Expose
private Integer counterGroupId;
@SerializedName("CounterUploadStatus")
@Expose
private String counterUploadStatus;
@SerializedName("BAUploadStatus")
@Expose
private String bAUploadStatus;
@SerializedName("MID")
@Expose
private Integer mID;
@SerializedName("BID")
@Expose
private Integer bID;
@SerializedName("RefImage")
@Expose
private String refImage;
@SerializedName("ProfileImage1")
@Expose
private String profileImage1;
@SerializedName("ProfileImage2")
@Expose
private String profileImage2;
@SerializedName("CounterLength")
@Expose
private double counterlength;
@SerializedName("CounterWidth")
@Expose
private double counterwidth;
@SerializedName("SetUpDate")
@Expose
private String setupDate;
@SerializedName("VisitDate")
@Expose
private String visitDate;
@SerializedName("UserId")
@Expose
private String userId;
@SerializedName("Latitude")
@Expose
private Double latitude;
@SerializedName("Longitude")
@Expose
private Double longitude;
@SerializedName("GeoTag")
@Expose
private String geoTag;
@SerializedName("GeoFencingRadius")
@Expose
private Integer geoFencingRadius;
@SerializedName("GeoFencingAllow")
@Expose
private Integer geoFencingAllow;
@SerializedName("Checkout")
private String checkout;
public String getVisitDate() {
return visitDate;
}
@@ -374,6 +377,7 @@ public class JourneyPlan implements Serializable {
public void setBID(Integer bID) {
this.bID = bID;
}
public Double getLatitude() {
return latitude;
}
@@ -533,5 +537,13 @@ public class JourneyPlan implements Serializable {
this.entry_type = entry_type;
}
public String getCheckout() {
return checkout;
}
public void setCheckout(String checkout) {
this.checkout = checkout;
}
String entry_type = "";
}
@@ -3,6 +3,8 @@ package com.cpm.lorealbaautomation.gsonGetterSetter;
import java.io.Serializable;
import java.util.List;
import com.cpm.lorealbaautomation.checkout.MasterCheckoutQuestion;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.cpm.lorealbaautomation.reportGetterSetter.ReportAttendanceDetail;
@@ -79,7 +81,7 @@ public class MasterBAProfileGetterSetter implements Serializable {
}
@SerializedName("ME_MEAuditQuestion")
@Expose
private List<MEMEAuditQuestion> mEMEAuditQuestion = null;
private List<MEMEAuditQuestion> mEMEAuditQuestion;
public List<MEMEAuditQuestion> getMEMEAuditQuestion() {
return mEMEAuditQuestion;
@@ -87,7 +89,7 @@ public class MasterBAProfileGetterSetter implements Serializable {
@SerializedName("ME_MEAuditQuestion_UploadStatus")
@Expose
private List<MEMEAuditQuestionUploadstatus> mEMEAuditQuestionUploadStatus = null;
private List<MEMEAuditQuestionUploadstatus> mEMEAuditQuestionUploadStatus;
public List<MEMEAuditQuestionUploadstatus> getMEMEAuditQuestionUploadStatus() {
return mEMEAuditQuestionUploadStatus;
@@ -98,4 +100,11 @@ public class MasterBAProfileGetterSetter implements Serializable {
public List<MappingAppRestrictedKPI> getMappingAppRestrictedKPI() {
return mappingAppRestrictedKPI;
}
@SerializedName("Master_CheckoutQuestion")
private List<MasterCheckoutQuestion> masterCheckoutQuestion;
public List<MasterCheckoutQuestion> getMasterCheckoutQuestion() {
return masterCheckoutQuestion;
}
}
@@ -92,7 +92,6 @@ public class LeaveManagemntActivity extends AppCompatActivity implements View.On
if (id == android.R.id.home) {
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
LeaveManagemntActivity.this.finish();
}
return super.onOptionsItemSelected(item);
@@ -1,5 +1,6 @@
package com.cpm.lorealbaautomation.makeupexpert;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -20,8 +21,6 @@ import android.widget.TextView;
import com.androidbuts.multispinnerfilter.KeyPairBoolData;
import com.androidbuts.multispinnerfilter.SpinnerListener;
import com.cpm.lorealbaautomation.R;
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +29,6 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
private String defaultText = "";
private String spinnerTitle = "";
private SpinnerListener listener;
private int selected = 0;
MultipleSelectionSpinAdapter adapter;
List<KeyPairBoolData> productList = new ArrayList<>();
public static AlertDialog ad;
@@ -39,6 +37,7 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
super(context);
}
@SuppressLint("CustomViewStyleable")
public BaProfileMultiSelection(Context arg0, AttributeSet arg1) {
super(arg0, arg1);
TypedArray a = arg0.obtainStyledAttributes(arg1, R.styleable.MultiSpinnerSearch);
@@ -82,6 +81,7 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
listener.onItemsSelected(productList);
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean performClick() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
@@ -94,21 +94,14 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
listView.setFastScrollEnabled(false);
adapter = new MultipleSelectionSpinAdapter(getContext(), productList);
listView.setAdapter(adapter);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
Log.i(TAG, " ITEMS : " + productList.size());
dialog.cancel();
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
builder.setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> {
Log.i(TAG, " ITEMS : " + productList.size());
dialogInterface.dismiss();
}
});
builder.setOnCancelListener(this);
ad = builder.show();
@@ -168,7 +161,7 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
return position;
}
private class ViewHolder {
private static class ViewHolder {
TextView textView;
CheckBox checkBox;
}
@@ -177,7 +170,7 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
public View getView(final int position, View convertView, ViewGroup parent) {
MultipleSelectionSpinAdapter.ViewHolder holder;
if (convertView == null) {
holder = new MultipleSelectionSpinAdapter.ViewHolder();
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.item_listview_multiple_row, parent, false);
holder.textView = (TextView) convertView.findViewById(R.id.alertTextView);
holder.checkBox = (CheckBox) convertView.findViewById(R.id.alertCheckbox);
@@ -185,34 +178,20 @@ public class BaProfileMultiSelection extends AppCompatSpinner implements DialogI
} else {
holder = (MultipleSelectionSpinAdapter.ViewHolder) convertView.getTag();
}
final KeyPairBoolData data = arrayList.get(position);
holder.textView.setText(data.getName());
holder.textView.setTypeface(null, Typeface.NORMAL);
holder.checkBox.setChecked(data.isSelected());
convertView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (data.isSelected()) { // deselect
selected--;
} else {// selected
selected++;
}
final MultipleSelectionSpinAdapter.ViewHolder temp = (MultipleSelectionSpinAdapter.ViewHolder) v.getTag();
convertView.setOnClickListener(v -> {
final ViewHolder temp = (ViewHolder) v.getTag();
temp.checkBox.setChecked(!temp.checkBox.isChecked());
data.setSelected(!data.isSelected());
Log.i("", "On Click Selected Item : " + data.getName() + " : " + data.isSelected());
notifyDataSetChanged();
}
});
if (data.isSelected()) {
holder.textView.setTypeface(null, Typeface.NORMAL);
}
holder.checkBox.setTag(holder);
return convertView;
}
@@ -343,6 +343,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
case "Mapping_JourneyPlan":
if (!data.contains("No Data")) {
Log.d("JSON_DATA",data);
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
if (jcpObject != null && !db.insertJCPData(jcpObject)) {
@@ -1839,6 +1840,20 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
throw new java.lang.Exception();
}
break;
case "Master_CheckoutQuestion":
if (!data.contains("No Data")) {
MasterBAProfileGetterSetter masterCheckoutQuestion = new Gson().fromJson(data, MasterBAProfileGetterSetter.class);
db.open();
if (masterCheckoutQuestion != null && !db.insertMasterCheckoutQuestion(masterCheckoutQuestion)) {
AlertandMessages.showToastMsg(context, "Master_CheckoutQuestion data not saved");
pd.dismiss();
}
} else {
db.open();
db.delete_table_data("Master_CheckoutQuestion");
}
break;
}
@@ -2050,6 +2065,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
} else {
data_global[0] = data;
if (finalKeyName.equalsIgnoreCase("Table_Structure")) {
Log.d("JSON_DATA",data);
editor.putInt(CommonString.KEY_DOWNLOAD_INDEX, finalJsonIndex[0]);
editor.apply();
tableStructureObj = new Gson().fromJson(data, TableStructureGetterSetter.class);
@@ -2075,6 +2091,7 @@ public class DownloadAllDatawithRetro extends ReferenceVariablesForDownloadActiv
break;
case "Mapping_JourneyPlan":
Log.d("JSON_DATA",data);
if (!data.contains("No Data")) {
jcpObject = new Gson().fromJson(data, JCPGetterSetter.class);
db.open();
@@ -10,15 +10,9 @@ import retrofit2.http.POST;
public interface PostApi {
// @POST("CounterDeviceLoginWithCode")---Old Method
//Ravi Changes
@POST("CounterInfoDetail")
Call<ResponseBody> getCounterInfodetail(@Body RequestBody request);
@POST("CounterDeviceLoginWithCodeAppId")
Call<ResponseBody> getLogindetail(@Body RequestBody request);
///@POST("BADeviceLogin")----Old Ba login Method
@POST("BADeviceLoginAppId")
Call<ResponseBody> getLoginUserdetail(@Body RequestBody request);
@@ -79,5 +73,8 @@ public interface PostApi {
@POST("LeaveRequest")
Call<String> LeaveRequest(@Body RequestBody request);
@POST("BACheckout")
Call<ResponseBody> BACheckout(@Body RequestBody request);
}
@@ -1,19 +0,0 @@
package com.cpm.lorealbaautomation.retrofit;
import com.squareup.okhttp.RequestBody;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.POST;
/**
* Created by jeevanp on 05-10-2017.
*/
public interface PostApiForFile {
@POST("Uploadimages")
Call<String>getUploadImage(@Body RequestBody reqesBody);
}
@@ -2,6 +2,8 @@ package com.cpm.lorealbaautomation.retrofit;
import android.content.Context;
import androidx.annotation.NonNull;
import com.cpm.lorealbaautomation.constant.CommonString;
import com.cpm.lorealbaautomation.gettersetter.ReferenceVariablesForDownloadActivity;
@@ -51,11 +53,13 @@ public class UploadDataWithRetrofit extends ReferenceVariablesForDownloadActivit
if (type == CommonString.UPLOAD_DEVICE_TOKEN_DETAILS) {
call = api.uploadTokenDetails(jsonData);
} else {
call = api.BACheckout(jsonData);
}
call.enqueue(new Callback<ResponseBody>() {
assert call != null;
call.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
ResponseBody responseBody = response.body();
String data = null;
if (responseBody != null && response.isSuccessful()) {
@@ -64,14 +68,12 @@ public class UploadDataWithRetrofit extends ReferenceVariablesForDownloadActivit
data = data.substring(1, data.length() - 1).replace("\\", "");
if (data.equalsIgnoreCase("")) {
data_global[0] = "";
isvalid = true;
status = 1;
} else {
data = data.substring(1, data.length() - 1).replace("\\", "");
data_global[0] = data;
}
isvalid = true;
status = 1;
}
} catch (Exception e) {
e.fillInStackTrace();
@@ -85,7 +87,7 @@ public class UploadDataWithRetrofit extends ReferenceVariablesForDownloadActivit
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
isvalid = true;
if (t instanceof SocketTimeoutException) {
status = 3;
@@ -94,10 +96,21 @@ public class UploadDataWithRetrofit extends ReferenceVariablesForDownloadActivit
} else {
status = 3;
}
}
});
if (type != CommonString.UPLOAD_DEVICE_TOKEN_DETAILS) {
while (!isvalid) {
synchronized (this) {
this.wait(25);
}
}
if (isvalid) {
synchronized (this) {
this.notify();
}
}
}
if (status == 1) {
return data_global[0];
} else if (status == 2) {
@@ -1961,6 +1961,8 @@ public class ManualUploadActivity extends AppCompatActivity implements View.OnCl
foldername = "CompetitionOffersImages";
} else if (finalList.get(i).contains("_GeoTag-")) {
foldername = "GeoTagImages";
} else if (finalList.get(i).contains("-Checkout_Selfie_img_") || finalList.get(i).contains("_CheckoutQuestionImg-") || finalList.get(i).contains("_CheckoutAnsImg-")) {
foldername = "CheckoutImages";
} else {
foldername = "BulkUpload";
}
@@ -1893,6 +1893,8 @@ public class UploadKeyData extends AppCompatActivity implements View.OnClickList
foldername = "CompetitionOffersImages";
} else if (finalList.get(i).contains("_GeoTag-")) {
foldername = "GeoTagImages";
} else if (finalList.get(i).contains("-Checkout_Selfie_img_") || finalList.get(i).contains("_CheckoutQuestionImg-") || finalList.get(i).contains("_CheckoutAnsImg-")) {
foldername = "CheckoutImages";
} else {
foldername = "BulkUpload";
}
@@ -0,0 +1,28 @@
package com.cpm.lorealbaautomation.utils;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
public class NonScrollExpandableListView extends ExpandableListView {
public NonScrollExpandableListView(Context context) {
super(context);
}
public NonScrollExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NonScrollExpandableListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
}
@@ -16,8 +16,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/edit_text_border">
android:background="@drawable/edit_text_border"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
@@ -29,11 +29,11 @@
android:id="@+id/txt_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/custom_layout_margin11"
android:gravity="center_vertical"
android:padding="@dimen/custom_layout_margin11"
android:layout_gravity="center_vertical"
android:text="Question"
android:layout_marginLeft="@dimen/custom_layout_margin11"
android:textColor="@color/black"
android:textSize="@dimen/text_size_16sp"
android:textStyle="bold" />
@@ -51,56 +51,53 @@
android:id="@+id/sp_auditAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin1dp"
android:layout_gravity="center"
android:gravity="center"
android:backgroundTint="@color/colorPrimaryDark"
android:layout_marginLeft="@dimen/custom_layout_margin_50"
android:layout_marginRight="@dimen/custom_layout_margin_50"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/custom_layout_margin_50"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:visibility="gone"
/>
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center"
android:padding="@dimen/margin1dp"
android:visibility="gone" />
<EditText
android:id="@+id/edt_answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/margin60dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/margin60dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:background="@drawable/rouded_corner_edt"
android:focusable="true"
android:hint="type your answer here."
android:gravity="center_vertical"
android:hint="Type your answer here."
android:padding="@dimen/custom_layout_margin11"
android:textColor="@color/black"
android:textSize="@dimen/text_size_16sp"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/custom_layout_margin11"
android:background="@drawable/rouded_corner_edt"
android:layout_marginLeft="@dimen/margin60dp"
android:layout_marginRight="@dimen/margin60dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:visibility="gone"
/>
android:visibility="gone" />
<EditText
android:id="@+id/edt_for_others"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/margin60dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/margin60dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:background="@drawable/rouded_corner_edt"
android:focusable="true"
android:hint="type your answer here."
android:textColor="@color/black"
android:textSize="@dimen/text_size_16sp"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/custom_layout_margin11"
android:gravity="center_vertical"
android:hint="Type your answer here."
android:inputType="text"
android:maxLength="100"
android:background="@drawable/rouded_corner_edt"
android:layout_marginLeft="@dimen/margin60dp"
android:layout_marginRight="@dimen/margin60dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:padding="@dimen/custom_layout_margin11"
android:textColor="@color/black"
android:textSize="@dimen/text_size_16sp"
android:visibility="gone" />
<RelativeLayout
@@ -109,28 +106,20 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin3dp"
android:visibility="gone">
<com.cpm.lorealbaautomation.makeupexpert.BaProfileMultiSelection
android:id="@+id/searchSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/custom_layout_margin_50"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/custom_layout_margin_50"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/text_size_16sp"
card_view:hintText="- Select -"
android:gravity="center"
android:layout_marginLeft="@dimen/custom_layout_margin_50"
android:layout_marginRight="@dimen/custom_layout_margin_50"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:backgroundTint="@color/colorPrimaryDark"/>
<TextView
android:id="@+id/tv_mer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Select "
android:visibility="gone"
android:textSize="14sp" />
app:hintText="- Select -" />
</RelativeLayout>
@@ -141,15 +130,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_margin="@dimen/custom_margin"
android:visibility="gone"
>
android:gravity="center"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:orientation="horizontal">
<ImageView
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".checkout.BaCheckoutActivity"
tools:showIn="@layout/activity_bacheckout">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/appbar_padding_top"
app:cardElevation="@dimen/custom_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/selfie_checkout_msg"
android:textColor="@color/black"
android:padding="@dimen/appbar_padding_top"
android:textSize="@dimen/text_size_16sp"
android:textStyle="bold" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/img_selfie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_12dp"
android:background="@color/light_grey"
android:scaleType="centerCrop"
android:src="@mipmap/selfie_image"
android:visibility="gone"
app:shapeAppearanceOverlay="@style/RoundedCornerImageView" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_cam_selfie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@mipmap/selfie_image" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/appbar_padding_top"
android:background="@color/transparent"
android:gravity="center"
android:orientation="vertical"
android:weightSum="10">
<TextView
android:id="@+id/tvPrompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mandatory_daily_questionnaire_at_the_time_of_check_out"
android:textColor="@color/grey_dark_background"
android:padding="@dimen/appbar_padding_top"
android:textSize="@dimen/text_size_16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycl_questionire"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/appbar_padding_top" />
</LinearLayout>
</LinearLayout>
@@ -367,11 +367,11 @@
android:id="@+id/edt_address"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:layout_weight="6"
android:background="@drawable/rouded_corner_edittaxt"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_gravity="start|top"
android:gravity="start|top"
android:padding="@dimen/custom_layout_margin11"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium" />
@@ -706,7 +706,7 @@
</LinearLayout>
</androidx.cardview.widget.CardView>
<ExpandableListView
<com.cpm.lorealbaautomation.utils.NonScrollExpandableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="1400dp"
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@mipmap/popup_profile"
android:gravity="center">
</RelativeLayout>
@@ -0,0 +1,146 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:layout_width="match_parent"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/padding_10dp"
app:cardElevation="@dimen/custom_margin">
<LinearLayout
android:layout_height="wrap_content"
android:layout_margin="@dimen/appbar_padding_top"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:id="@+id/txt_question"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/appbar_padding_top"
android:text="@string/settings_video_quality_title"
android:textColor="@color/black"
android:textSize="@dimen/text_size_16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/rlQImg"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="horizontal"
android:visibility="gone"
android:weightSum="1">
<TextView
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_weight=".8"
android:layout_width="0dp"
android:padding="@dimen/appbar_padding_top"
android:text="@string/question_image"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_14sp"
android:textStyle="normal" />
<ImageView
android:contentDescription="@string/question_image"
android:id="@+id/questionImg"
android:layout_gravity="center|end"
android:layout_height="@dimen/design_navigation_icon_size"
android:layout_weight=".2"
android:layout_width="0dp"
android:src="@mipmap/camera_star"
card_view:ignore="PrivateResource" />
</LinearLayout>
<LinearLayout
android:id="@+id/editTextlayout"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/appbar_padding_top"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:background="@drawable/rouded_corner_edt"
android:gravity="center_vertical"
android:id="@+id/rlSpin"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/custom_margin">
<Spinner
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center"
android:id="@+id/sp_auditAnswer"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin1dp"
android:layout_width="match_parent" />
</LinearLayout>
<EditText
android:autofillHints="false"
android:background="@drawable/rouded_corner_edt"
android:hint="@string/type_your_answer_here"
android:id="@+id/edt_answer"
android:inputType="none"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/padding_10dp"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/rlAnsImg"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_weight=".8"
android:layout_width="0dp"
android:padding="@dimen/appbar_padding_top"
android:text="@string/anser_image"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_14sp"
android:textStyle="normal" />
<ImageView
android:contentDescription="@string/anser_image"
android:id="@+id/ansImg"
android:layout_gravity="center|end"
android:layout_height="@dimen/design_navigation_icon_size"
android:layout_weight=".2"
android:layout_width="0dp"
android:src="@mipmap/camera_star"
card_view:ignore="PrivateResource" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
@@ -0,0 +1,40 @@
<?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"
android:fitsSystemWindows="true"
tools:context=".checkout.BaCheckoutActivity">
<com.google.android.material.appbar.AppBarLayout
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:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextAppearance="@style/Toolbar.TitleTextPhone"
app:titleTextColor="@color/white" />
</com.google.android.material.appbar.AppBarLayout>
<include
android:id="@+id/contentCheckout"
layout="@layout/content_bacheckout" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="@dimen/appbar_padding_top"
android:contentDescription="@string/save"
android:src="@drawable/save_icon"
app:backgroundTint="@color/green" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -1,8 +1,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:card_view="http://schemas.android.com/tools"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
@@ -17,8 +17,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/edit_text_border">
android:background="@drawable/edit_text_border"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
@@ -32,9 +32,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:paddingLeft="@dimen/custom_layout_margin11"
android:paddingStart="@dimen/custom_layout_margin11"
android:paddingTop="@dimen/custom_margin"
android:paddingRight="20dp"
android:paddingEnd="20dp"
android:paddingBottom="@dimen/custom_margin"
android:text="Question"
android:textColor="@color/black"
@@ -54,84 +54,72 @@
android:id="@+id/sp_auditAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin1dp"
android:layout_gravity="center"
android:gravity="center"
android:backgroundTint="@color/colorPrimaryDark"
android:layout_marginLeft="@dimen/text22dp"
android:layout_marginRight="@dimen/text22dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/text22dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:visibility="gone"
/>
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center"
android:padding="@dimen/margin1dp"
android:visibility="gone" />
<EditText
android:id="@+id/edt_answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/custom_margin35dp"
android:layout_margin="@dimen/custom_margin"
android:layout_marginRight="@dimen/custom_margin35dp"
android:background="@drawable/rouded_corner_edt"
android:focusable="true"
android:hint="type your answer here."
android:padding="@dimen/appbar_padding_top"
android:gravity="center_vertical"
android:hint="Type your answer here."
android:textColor="@color/black"
android:textSize="@dimen/text_14sp"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/custom_margin"
android:background="@drawable/rouded_corner_edt"
android:layout_marginLeft="@dimen/custom_margin35dp"
android:layout_marginRight="@dimen/custom_margin35dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:visibility="gone" />
<EditText
android:id="@+id/edt_for_others"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="type your answer here."
android:textColor="@color/black"
android:textSize="@dimen/text_14sp"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/custom_margin"
android:inputType="text"
android:maxLength="100"
android:background="@drawable/rouded_corner_edt"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/custom_margin35dp"
android:layout_marginRight="@dimen/custom_margin35dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:background="@drawable/rouded_corner_edt"
android:focusable="true"
android:gravity="center_vertical"
android:hint="Type your answer here."
android:inputType="text"
android:maxLength="100"
android:padding="@dimen/appbar_padding_top"
android:textColor="@color/black"
android:textSize="@dimen/text_14sp"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/relay_multisppener"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_margin="@dimen/custom_margin3dp">
android:layout_margin="@dimen/custom_margin3dp"
android:visibility="gone">
<com.cpm.lorealbaautomation.makeupexpert.BaProfileMultiSelection
android:id="@+id/searchSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_30dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginRight="@dimen/margin_30dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_16sp"
card_view:hintText="- Select -"
android:gravity="center_vertical"
android:layout_marginLeft="@dimen/margin_30dp"
android:layout_marginRight="@dimen/margin_30dp"
android:layout_marginTop="@dimen/custom_margin3dp"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:backgroundTint="@color/colorPrimaryDark"/>
<TextView
android:id="@+id/tv_mer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:visibility="gone"
android:text="Select "
android:textSize="@dimen/text_14sp" />
app:hintText="- Select -" />
</RelativeLayout>
@@ -142,14 +130,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/custom_margin"
android:gravity="center"
android:visibility="gone"
android:layout_margin="@dimen/custom_margin">
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:orientation="horizontal">
<ImageView
@@ -158,7 +146,6 @@
android:layout_height="@dimen/custom_margin35dp"
android:background="@mipmap/camera_star" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
@@ -6,6 +6,4 @@
android:layout_gravity="center"
android:background="@mipmap/popup_counter"
android:gravity="center">
</RelativeLayout>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".checkout.BaCheckoutActivity"
tools:showIn="@layout/activity_bacheckout">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/appbar_padding_top"
app:cardElevation="@dimen/custom_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/selfie_checkout_msg"
android:textColor="@color/black"
android:padding="@dimen/custom_margin"
android:textSize="@dimen/txt_size_14sp"
android:textStyle="bold" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/img_selfie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_12dp"
android:background="@color/light_grey"
android:scaleType="centerCrop"
android:src="@mipmap/selfie_image"
android:visibility="gone"
app:shapeAppearanceOverlay="@style/RoundedCornerImageView" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_cam_selfie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@mipmap/selfie_image" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/custom_margin"
android:background="@color/transparent"
android:gravity="center"
android:orientation="vertical"
android:weightSum="10">
<TextView
android:id="@+id/tvPrompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mandatory_daily_questionnaire_at_the_time_of_check_out"
android:textColor="@color/grey_dark_background"
android:padding="@dimen/custom_margin"
android:textSize="@dimen/txt_size_14sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycl_questionire"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/custom_margin" />
</LinearLayout>
</LinearLayout>
+11 -12
View File
@@ -370,11 +370,11 @@
android:id="@+id/edt_address"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dp"
android:layout_gravity="start|top"
android:layout_marginEnd="3dp"
android:layout_weight="6"
android:background="@drawable/rouded_corner_edittaxt"
android:gravity="center_vertical"
android:gravity="start|top"
android:padding="@dimen/custom_margin"
android:textColor="@color/black"
android:textSize="@dimen/text_14sp" />
@@ -629,7 +629,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:layout_weight="6"
android:background="@color/gray"
android:enabled="false"
@@ -662,7 +662,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:layout_weight="6"
android:background="@color/gray"
android:enabled="false"
@@ -688,7 +688,7 @@
android:layout_weight="4"
android:gravity="center_vertical"
android:padding="@dimen/custom_margin"
android:text="Current BP Grade"
android:text="@string/current_bp_grade"
android:textColor="@color/black"
android:textSize="@dimen/text_14sp" />
@@ -697,7 +697,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:layout_weight="6"
android:background="@color/gray"
android:enabled="false"
@@ -710,15 +710,14 @@
</LinearLayout>
</androidx.cardview.widget.CardView>
<ExpandableListView
<com.cpm.lorealbaautomation.utils.NonScrollExpandableListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="1800dp"
android:layout_marginTop="@dimen/custom_margin"
android:layout_marginBottom="@dimen/custom_margin3dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:cacheColorHint="#00000000"
android:divider="@null"
android:dividerHeight="0dp"
android:dividerHeight="@dimen/margin1dp"
android:scrollingCache="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
@@ -3,23 +3,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- android:background="@drawable/rouded_corner"-->
<!--<ImageView
android:id="@+id/imageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="5dp"
android:src="@drawable/ic_launcher" />&lt;!&ndash;Make sure image is present in Drawable folder&ndash;&gt;
-->
<TextView
android:id="@+id/tv_ans"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/custom_margin"
android:text="Demo"
android:gravity="center"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_12sp"/>
android:textSize="@dimen/sp13" />
</LinearLayout>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@mipmap/popup_profile"
android:gravity="center">
</RelativeLayout>
+146
View File
@@ -0,0 +1,146 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:layout_width="match_parent"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/padding_10dp"
app:cardElevation="@dimen/custom_margin">
<LinearLayout
android:layout_height="wrap_content"
android:layout_margin="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:id="@+id/txt_question"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/appbar_padding_top"
android:text="@string/settings_video_quality_title"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_14sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/rlQImg"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="horizontal"
android:visibility="gone"
android:weightSum="1">
<TextView
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_weight=".8"
android:layout_width="0dp"
android:padding="@dimen/appbar_padding_top"
android:text="@string/question_image"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_12sp"
android:textStyle="normal" />
<ImageView
android:contentDescription="@string/question_image"
android:id="@+id/questionImg"
android:layout_gravity="center|end"
android:layout_height="@dimen/design_navigation_icon_size"
android:layout_weight=".2"
android:layout_width="0dp"
android:src="@mipmap/camera_star"
card_view:ignore="PrivateResource" />
</LinearLayout>
<LinearLayout
android:id="@+id/editTextlayout"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/appbar_padding_top"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:background="@drawable/rouded_corner_edt"
android:gravity="center_vertical"
android:id="@+id/rlSpin"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/custom_margin">
<Spinner
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="center"
android:id="@+id/sp_auditAnswer"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin1dp"
android:layout_width="match_parent" />
</LinearLayout>
<EditText
android:autofillHints="false"
android:background="@drawable/rouded_corner_edt"
android:hint="@string/type_your_answer_here"
android:id="@+id/edt_answer"
android:inputType="none"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="@dimen/padding_10dp"
android:textColor="@color/black"
android:textSize="@dimen/text_14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/rlAnsImg"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20dp"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/custom_margin"
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_weight=".8"
android:layout_width="0dp"
android:padding="@dimen/appbar_padding_top"
android:text="@string/anser_image"
android:textColor="@color/black"
android:textSize="@dimen/txt_size_12sp"
android:textStyle="normal" />
<ImageView
android:contentDescription="@string/anser_image"
android:id="@+id/ansImg"
android:layout_gravity="center|end"
android:layout_height="@dimen/design_navigation_icon_size"
android:layout_weight=".2"
android:layout_width="0dp"
android:src="@mipmap/camera_star"
card_view:ignore="PrivateResource" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
@@ -75,13 +75,15 @@
android:id="@+id/nav_leave_ledger"
android:icon="@mipmap/leave_ledger"
android:title="@string/leave_ledger_tba" />
<item
android:id="@+id/nav_services"
android:icon="@mipmap/serivces"
android:title="@string/menu_service" />
<item
android:id="@+id/nav_counter_checkout"
android:icon="@mipmap/checkout_icon"
android:title="@string/menu_counter_checkout" />
<item
android:id="@+id/nav_logout"
android:icon="@mipmap/logout"
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+1
View File
@@ -67,6 +67,7 @@
<dimen name="text100dp">100dp</dimen>
<dimen name="text_size_35sp">35sp</dimen>
<dimen name="dp125">125dp</dimen>
<dimen name="sp13">13sp</dimen>
<integer name="weight">1</integer>
+9
View File
@@ -43,6 +43,7 @@
<string name="menu_reset_password" translatable="false">Change Password</string>
<string name="menu_manual_upload" translatable="false">Upload Sync</string>
<string name="menu_logout" translatable="false">Logout</string>
<string name="menu_counter_checkout" translatable="false">Checkout</string>
<string name="title_activity_auto_update" translatable="false">AutoUpdateActivity</string>
<string name="new_update_available" translatable="false">New Update Available</string>
<string name="ok" translatable="false">OK</string>
@@ -375,5 +376,13 @@
<string name="distance_from_the_store" translatable="false">your current distance from Store/Counter is </string>
<string name="you_need_to_be_in_the_store" translatable="false">of the Store/Counter premises to Checkin/Checkout</string>
<string name="first_geotag_the_store" translatable="false">You need to geotag Store/Counter.</string>
<string name="selfie_checkout_msg" translatable="false">Click Selfie in front of counter at Checkout</string>
<string name="question_image" translatable="false">Question Image</string>
<string name="type_your_answer_here" translatable="false">type your answer here.</string>
<string name="anser_image" translatable="false">Answer Image</string>
<string name="mandatory_daily_questionnaire_at_the_time_of_check_out" translatable="false">Mandatory daily questionnaire at the time of check-out</string>
<string name="current_bp_grade">Current BP Grade</string>
<string name="first_please_complete_your_profile">First, please complete your profile.</string>
////
</resources>
+30
View File
@@ -111,4 +111,34 @@
<item name="android:textColor">#000000</item> <!-- Optional -->
</style>
<style name="RoundedCornerImageView" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">16dp</item>
</style>
<style name="MyMaterialAlertDialog" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<!-- Dialog background -->
<item name="android:background">@color/white</item>
<item name="colorSurface">@color/white</item>
<!-- Text and icon color -->
<item name="android:textColorPrimary">@color/black</item>
<item name="colorOnSurface">@color/black</item>
<!-- Button and branding colors -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- Title & message appearance -->
<item name="textAppearanceHeadline6">@style/DialogTitleText</item>
<item name="textAppearanceBody2">@style/DialogMessageText</item>
</style>
<style name="DialogTitleText" parent="TextAppearance.MaterialComponents.Headline6">
<item name="android:textColor">@color/black</item>
</style>
<style name="DialogMessageText" parent="TextAppearance.MaterialComponents.Body2">
<item name="android:textColor">@color/black</item>
</style>
</resources>
+1 -1
View File
@@ -20,5 +20,5 @@ android {
dependencies {
implementation 'com.github.rey5137:material:1.2.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.12.0'
}
@@ -1 +0,0 @@
o/debug
@@ -1,2 +0,0 @@
#- File Locator -
listingFile=../../../outputs/apk/androidTest/debug/output-metadata.json
@@ -1,4 +1,4 @@
#Mon Jun 23 15:27:46 IST 2025
#Wed Jul 02 13:00:40 IST 2025
com.androidbuts.multispinnerfilter.library-main-6\:/layout/activity_main.xml=D\:\\jeevanp_cpm_projects\\LorealBaFixedVersionIssue\\RaviLatestCode19JUNE025\\LorealBA_AutomationLatest\\library\\build\\intermediates\\packaged_res\\debug\\layout\\activity_main.xml
com.androidbuts.multispinnerfilter.library-main-6\:/layout/alert_dialog_listview_search.xml=D\:\\jeevanp_cpm_projects\\LorealBaFixedVersionIssue\\RaviLatestCode19JUNE025\\LorealBA_AutomationLatest\\library\\build\\intermediates\\packaged_res\\debug\\layout\\alert_dialog_listview_search.xml
com.androidbuts.multispinnerfilter.library-main-6\:/layout/item_listview_single.xml=D\:\\jeevanp_cpm_projects\\LorealBaFixedVersionIssue\\RaviLatestCode19JUNE025\\LorealBA_AutomationLatest\\library\\build\\intermediates\\packaged_res\\debug\\layout\\item_listview_single.xml

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