Added draft mode, delete image changes
This commit is contained in:
@@ -4693,7 +4693,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
if (key_account_id != null) {
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT ifnull(T.IRPD_IMAGES,'')as IRPD_IMAGES, ifnull(SB.PD_SUB_CATEGORY_CODE,'')AS PD_SUB_CATEGORY_CODE,SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM "
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT ifnull(T.IRPD_IMAGES,'')as IRPD_IMAGES,ifnull(T.IRPD_IMAGES_MODIFY,'')as IRPD_IMAGES_MODIFY, ifnull(SB.PD_SUB_CATEGORY_CODE,'')AS PD_SUB_CATEGORY_CODE,SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM "
|
||||
+ tableName + " M INNER JOIN SKU_MASTER SK ON M.SKU_ID = SK.SKU_ID" +
|
||||
" INNER JOIN BRAND_MASTER BR ON SK.BRAND_ID = BR.BRAND_ID" +
|
||||
" INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID" +
|
||||
@@ -4706,20 +4706,16 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
"' AND M.CLASS_ID = '" + class_id + "' AND CA.CATEGORY_ID = '" + categoryId + "'", null);
|
||||
|
||||
} else {
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT ifnull(T.IRPD_IMAGES,'')as IRPD_IMAGES,ifnull(SB.PD_SUB_CATEGORY_CODE,'')AS PD_SUB_CATEGORY_CODE,SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM MAPPING_STOCK_STOREWISE M INNER JOIN SKU_MASTER SK ON M.SKU_ID = SK.SKU_ID" +
|
||||
dbcursor = db.rawQuery("SELECT DISTINCT ifnull(T.IRPD_IMAGES,'')as IRPD_IMAGES,ifnull(T.IRPD_IMAGES_MODIFY,'')as IRPD_IMAGES_MODIFY,ifnull(SB.PD_SUB_CATEGORY_CODE,'')AS PD_SUB_CATEGORY_CODE,SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM MAPPING_STOCK_STOREWISE M INNER JOIN SKU_MASTER SK ON M.SKU_ID = SK.SKU_ID" +
|
||||
" INNER JOIN BRAND_MASTER BR ON SK.BRAND_ID = BR.BRAND_ID" +
|
||||
" INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID" +
|
||||
" INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID" +
|
||||
" INNER JOIN MAPPING_SUB_CATEGORY_IMAGE_ALLOW MIA ON SB.SUB_CATEGORY_ID=MIA.SUB_CATEGORY_ID " +
|
||||
|
||||
" LEFT JOIN (SELECT * FROM " + CommonString.TABLE_IRPD + " WHERE " + CommonString.KEY_STORE_ID + "=" + store_id +
|
||||
" AND " + CommonString.KEY_CATEGORY_ID + "=" + categoryId + " AND " + CommonString.KEY_VISIT_DATE + "='" + visit_date +
|
||||
"') AS T ON T.CATEGORY_ID=CA.CATEGORY_ID AND T.SUB_CATEGORY_ID=SB.SUB_CATEGORY_ID " +
|
||||
|
||||
"WHERE M.STORE_ID = '" + store_id + "' AND CA.CATEGORY_ID = '" + categoryId + "'", null);
|
||||
|
||||
}
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
@@ -4728,10 +4724,33 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
CPGS.setSUB_CATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
|
||||
CPGS.setImage_allow(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE_ALLOW")));
|
||||
CPGS.setSubCatCode(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PD_SUB_CATEGORY_CODE")));
|
||||
String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_IMAGES));
|
||||
/* String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_IMAGES));
|
||||
// String imgs_modify = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_MODIFY_IMAGES));
|
||||
CPGS.setImageUris(imgs != null && !imgs.isEmpty() ? (ArrayList<ImageUri>) Arrays.stream(imgs.split(", "))
|
||||
.map(img -> new ImageUri(img, new File(img).getName())) // Extract file name as second parameter
|
||||
.collect(Collectors.toList()) : new ArrayList<>());
|
||||
.collect(Collectors.toList()) : new ArrayList<>());*/
|
||||
|
||||
// Retrieve image URIs from database
|
||||
String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_IMAGES));
|
||||
String imgs_modify = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_MODIFY_IMAGES));
|
||||
|
||||
// Split and map URIs and Modify URIs separately
|
||||
List<String> imageUris = imgs != null && !imgs.isEmpty()
|
||||
? Arrays.stream(imgs.split(", ")).collect(Collectors.toList())
|
||||
: new ArrayList<>();
|
||||
List<String> modifyUris = imgs_modify != null && !imgs_modify.isEmpty()
|
||||
? Arrays.stream(imgs_modify.split(", ")).collect(Collectors.toList())
|
||||
: new ArrayList<>();
|
||||
|
||||
// Create ImageUri objects with original URI and Modify URI
|
||||
ArrayList<ImageUri> imageUriList = new ArrayList<>();
|
||||
for (int i = 0; i < imageUris.size(); i++) {
|
||||
String uri = imageUris.get(i);
|
||||
String modifyUri = (i < modifyUris.size()) ? modifyUris.get(i) : uri; // Fallback to original if no modify URI
|
||||
imageUriList.add(new ImageUri(uri, modifyUri));
|
||||
}
|
||||
|
||||
CPGS.setImageUris(imageUriList);
|
||||
|
||||
CPGS.setSubCategoryCamera1("");
|
||||
CPGS.setSubCategoryCamera2("");
|
||||
@@ -10533,7 +10552,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
|
||||
public long InsertPdImageData(
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list) {
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String savemode) {
|
||||
ContentValues values = new ContentValues();
|
||||
long l = 0;
|
||||
try {
|
||||
@@ -10543,6 +10562,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < _list.size(); i++) {
|
||||
values.put(CommonString.KEY_SAVE_MODE, savemode);
|
||||
values.put(CommonString.KEY_STORE_ID, storeId);
|
||||
values.put(CommonString.KEY_VISIT_DATE, visit_date);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, categoryId);
|
||||
@@ -10552,8 +10572,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
values.put(CommonString.KEY_IRPD_IMAGES, _list.get(i).getImageUris().stream().map(ImageUri::getUri).collect(Collectors.toList()).stream().collect(Collectors.joining(", ")));
|
||||
values.put(CommonString.KEY_IRPD_MODIFY_IMAGES, _list.get(i).getImageUris().stream().map(ImageUri::getModify_uri).collect(Collectors.toList()).stream().collect(Collectors.joining(", ")));
|
||||
l = db.insert(CommonString.TABLE_IRPD, null, values);
|
||||
Log.e("data_d", info.toString());
|
||||
Log.e("data_d", values.toString());
|
||||
Log.e("data_d", info.toString() + ","+_list.get(i).getImageUris().size());
|
||||
// Log.e("data_d", values.toString());
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
@@ -10565,6 +10585,81 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
|
||||
public boolean isSOS(String store_id, String date, String mode) {
|
||||
boolean filled = false;
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
String query = "";
|
||||
if (mode != null) {
|
||||
query = "SELECT * FROM " + CommonString.TABLE_IRPD + " WHERE "
|
||||
+ CommonString.KEY_STORE_ID + " =" + store_id + " AND "
|
||||
+ CommonString.KEY_VISIT_DATE + " ='" + date + "'";
|
||||
} else {
|
||||
|
||||
}
|
||||
dbcursor = db.rawQuery(query, null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
String common_status = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SAVE_MODE));
|
||||
if (mode != null) {
|
||||
if (common_status != null && !common_status.equals("") && common_status.equalsIgnoreCase(CommonString.KEY_COMPELETE)) {
|
||||
filled = true;
|
||||
} else {
|
||||
filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return filled;
|
||||
}
|
||||
return filled;
|
||||
}
|
||||
|
||||
public boolean isSOSCategory(String store_id, String date, String mode, String categoryId) {
|
||||
boolean filled = false;
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
String query = "";
|
||||
if (mode != null) {
|
||||
query = "SELECT * FROM " + CommonString.TABLE_IRPD + " WHERE "
|
||||
+ CommonString.KEY_STORE_ID + " =" + store_id + " AND "
|
||||
+ CommonString.KEY_CATEGORY_ID + " =" + categoryId + " AND "
|
||||
+ CommonString.KEY_VISIT_DATE + " ='" + date + "'";
|
||||
} else {
|
||||
|
||||
}
|
||||
dbcursor = db.rawQuery(query, null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
String common_status = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SAVE_MODE));
|
||||
if (mode != null) {
|
||||
if (common_status != null && !common_status.equals("") && common_status.equalsIgnoreCase(CommonString.KEY_COMPELETE)) {
|
||||
filled = true;
|
||||
} else {
|
||||
filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return filled;
|
||||
}
|
||||
return filled;
|
||||
}
|
||||
|
||||
public ArrayList<CategoryPictureGetterSetter> getIrPDforUpload(String store_id, String visit_date) {
|
||||
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cpm.com.gskmtorange.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -24,6 +25,7 @@ class SavedImagesAdapter(private val context: Context, private val images: List<
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SavedImageViewHolder, position: Int) {
|
||||
Log.d("imagedata",images[position].uri)
|
||||
imgPreviewwithError(
|
||||
context = context,
|
||||
url = images[position].uri,
|
||||
|
||||
@@ -18,6 +18,9 @@ public class CommonString {
|
||||
public static final String KEY_DATE = "date";
|
||||
public static final String KEY_COUNTRY_ID = "COUNTRY_ID";
|
||||
public static final String KEY_STOREVISITED_STATUS = "STOREVISITED_STATUS";
|
||||
public static final String KEY_SAVE_MODE = "SAVE_MODE";
|
||||
public static final String KEY_DRAFT = "DRAFT";
|
||||
public static final String KEY_COMPELETE = "COMPELETE";
|
||||
|
||||
|
||||
public static final String KEY_PATH = "path";
|
||||
@@ -1546,6 +1549,8 @@ public class CommonString {
|
||||
+ " INTEGER,"
|
||||
+ KEY_VISIT_DATE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_SAVE_MODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_ID
|
||||
|
||||
@@ -2,8 +2,10 @@ package cpm.com.gskmtorange.constant
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.util.Patterns
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.swiperefreshlayout.widget.CircularProgressDrawable
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.Priority
|
||||
@@ -20,7 +22,6 @@ object CommonUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun imgPreviewwithError(context: Context, url: String, imgView: ImageView, resId: Int) {
|
||||
val circularProgressDrawable = CircularProgressDrawable(context).apply {
|
||||
strokeWidth = 5f
|
||||
@@ -32,6 +33,12 @@ object CommonUtils {
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).priority(Priority.HIGH)
|
||||
|
||||
Glide.with(context).load(url).apply(options).into(imgView)
|
||||
/* Glide.with(context).load(url).apply(options).into(imgView)
|
||||
Glide.get(context).clearMemory()*/
|
||||
// Clear disk cache in a background thread
|
||||
/* Thread {
|
||||
Glide.get(context).clearDiskCache()
|
||||
}.start()*/
|
||||
}
|
||||
|
||||
fun isValidUrl(url: String): Boolean {
|
||||
@@ -39,18 +46,17 @@ object CommonUtils {
|
||||
}
|
||||
|
||||
fun deleteSpecificImage(context: Context,filePath: String?) {
|
||||
val file = File(context.filesDir, "")
|
||||
// val file = File(context.filesDir, "")
|
||||
if (!filePath.isNullOrEmpty()) {
|
||||
val file = File(filePath)
|
||||
val file = File(filePath)
|
||||
//Log.d("filedatanew", file.toString());
|
||||
if (file.exists()) {
|
||||
val directory = file.parent // Get the directory path
|
||||
val imageName = file.name // Get the image file name
|
||||
println("Directory: $directory")
|
||||
println("Image Name: $imageName")
|
||||
if (file.delete()) {
|
||||
println("File deleted successfully: $filePath")
|
||||
val isDeleted = file.delete()
|
||||
if (isDeleted) {
|
||||
Log.d("deletefile","File deleted successfully");
|
||||
// Toast.makeText(context, "File deleted successfully", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
println("Failed to delete file: $filePath")
|
||||
println("Failed to delete file")
|
||||
}
|
||||
} else {
|
||||
println("File does not exist: $filePath")
|
||||
|
||||
@@ -10,6 +10,8 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -143,6 +145,10 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
deleteIRURl();
|
||||
|
||||
/* new Handler(Looper.getMainLooper()).postDelayed({
|
||||
notifyDataSetChanged()
|
||||
}, 5000);*/
|
||||
db.open();
|
||||
db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(context), CommonString.KEY_Y, checkOutImagePath);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.LoginActivity
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
@@ -112,7 +111,7 @@ class PDimageActivity : AppCompatActivity() {
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
// Handle Yes button click
|
||||
db?.open()
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat)?.let {
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat,CommonString.KEY_COMPELETE)?.let {
|
||||
if (it > 0) {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
@@ -228,7 +227,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPDIMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(Uri.parse(item.uri), "$dir $setName")
|
||||
}
|
||||
@@ -345,7 +343,9 @@ class PDimageActivity : AppCompatActivity() {
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat)
|
||||
if (!db!!.isSOSCategory(store_id, date, CommonString.KEY_COMPELETE,categoryId)) {
|
||||
db?.InsertPdImageData(date, store_id, categoryId,listdat,CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAndRequestPermissions() {
|
||||
@@ -389,7 +389,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
if (requestCode == PERMISSION_ALL) {
|
||||
val perms: MutableMap<String, Int> = HashMap()
|
||||
// Initialize the map with both permissions
|
||||
|
||||
@@ -287,7 +287,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
|
||||
}
|
||||
|
||||
deleteIRURl();
|
||||
// deleteIRURl();
|
||||
}
|
||||
|
||||
private void deleteIRURl() {
|
||||
@@ -299,7 +299,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
if (uris != null && !uris.isEmpty()) {
|
||||
for (int k = 0; k < uris.size(); k++) {
|
||||
CommonUtils.INSTANCE.deleteSpecificImage(this,uris.get(k).getUri());
|
||||
CommonUtils.INSTANCE. deleteImage(this,uris.get(k).getUri());
|
||||
// CommonUtils.INSTANCE. deleteImage(this,uris.get(k).getUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -282,12 +282,12 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
//// IR PD images handling by jp
|
||||
ArrayList<CategoryPictureGetterSetter> irList = isPdIRMapping(category_id);
|
||||
if (irList != null && !irList.isEmpty() && camera_allow.equals("1")) {
|
||||
flag = db.isFilledIRPDdata(store_id, visit_date, category_id);
|
||||
//flag = db.isFilledIRPDdata(store_id, visit_date, category_id);
|
||||
// flag = db.isSOS(store_id, date, CommonString.KEY_COMPELETE);
|
||||
flag = db.isSOSCategory(store_id, visit_date, CommonString.KEY_COMPELETE, category_id);
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
flag_filled = flag;
|
||||
}
|
||||
}
|
||||
|
||||
+71
-1
@@ -16,6 +16,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -24,6 +25,7 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@@ -34,8 +36,10 @@ import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalPromoSKUwiseActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
||||
import cpm.com.gskmtorange.dailyentry.AuditActivity;
|
||||
@@ -82,6 +86,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
db.open();
|
||||
context = this;
|
||||
//preference data
|
||||
//deletefile(context);
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
@@ -106,6 +112,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
db.open();
|
||||
deleteIRURl(context);
|
||||
visittypelist = db.getInsertedVisitType(store_id, visit_date, "3");
|
||||
if (visittypelist.size() > 0) {
|
||||
if (visittypelist.get(0).getVISIT_TYPE_ID().equals("3")) {
|
||||
@@ -117,6 +124,66 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteIRURl(Context context) {
|
||||
try {
|
||||
ArrayList<CategoryPictureGetterSetter> irList = db.getIrPDforUpload(store_id, visit_date);
|
||||
Log.d("irlistsize", String.valueOf(irList));
|
||||
if (irList != null && !irList.isEmpty()) {
|
||||
for (int i = 0; i < irList.size(); i++) {
|
||||
ArrayList<ImageUri> uris = irList.get(i).getImageUris();
|
||||
if (uris != null && !uris.isEmpty()) {
|
||||
for (int k = 0; k < uris.size(); k++) {
|
||||
// CommonUtils.INSTANCE.deleteSpecificImage(this,uris.get(k).getUri());
|
||||
deleteSpecificImage(context,uris.get(k).getUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSpecificImage(Context context, String uri) {
|
||||
// Path to the file in app-specific internal storage
|
||||
String filePath = uri;
|
||||
Log.d("filepath",filePath);
|
||||
|
||||
// Create a File object
|
||||
File file = new File(filePath);
|
||||
// Check if the file exists and delete it
|
||||
if (file.exists()) {
|
||||
boolean isDeleted = file.delete();
|
||||
if (isDeleted) {
|
||||
Toast.makeText(context, "File deleted successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to delete the file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(context, "File does not exist", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void deletefile(Context context) {
|
||||
// Path to the file in app-specific internal storage
|
||||
String filePath = context.getFilesDir().getAbsolutePath() + "/e462845c-0dc4-4aa0-9066-6334d33af7d8_1.jpg";
|
||||
Log.d("filepathnew",filePath);
|
||||
|
||||
// Create a File object
|
||||
File file = new File(filePath);
|
||||
// Check if the file exists and delete it
|
||||
if (file.exists()) {
|
||||
boolean isDeleted = file.delete();
|
||||
if (isDeleted) {
|
||||
Toast.makeText(context, "File deleted successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to delete the file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(context, "File does not exist", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -428,7 +495,10 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
if (ir_list != null && !ir_list.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
if (db.isFilledIRPDdata(store_id, visit_date, categoryId)) {
|
||||
/*if (db.isFilledIRPDdata(store_id, visit_date, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}*/
|
||||
if (db.isSOSCategory(store_id, visit_date, CommonString.KEY_COMPELETE,categoryId)){
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user