yes_no_permission_pd
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"Mer_NoticeBoard": [
|
||||
{
|
||||
"NoticeBoardId": 1,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/Parinaam\/BM_th1.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/share3.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 4,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/video.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/Trainings\/Data_security_video-final_eng.mp4?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "video"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 5,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/image.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/Trainings\/datasec_training_th.png?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "image"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 6,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/html-webview.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/image.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 7,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/html-browser.png",
|
||||
"NoticeLink_FullPage": "https:\/\/cd.parinaam.in?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webbrowser"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 8,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/Frame.png",
|
||||
"NoticeLink_FullPage": "https:\/\/dle.parinaam.in\/testdb\/share1.html?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "html-webview"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 9,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/deeplink.png",
|
||||
"NoticeLink_FullPage": "reports?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "deeplink"
|
||||
},
|
||||
{
|
||||
"NoticeBoardId": 10,
|
||||
"NoticThumnail_Path": "https:\/\/bigm1.parinaam.in\/notice\/ThumbnailImages\/",
|
||||
"NoticeLink_Thumbnail": "https:\/\/dle.parinaam.in\/app\/Content\/Test\/contact.png",
|
||||
"NoticeLink_FullPage": "{\"Name\":\"CPMHelpline\",\"Label\":\"Mobile\",\"Value\":\"9898989898\"}?e=CPD03388&p=58678&en=test%20mer",
|
||||
"FullPageTarget": "contact"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2829,15 +2829,19 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
public void deleteStockEntryMainTable(String storeid, String categoryid) {
|
||||
try {
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL_MAIN, "Store_Id" + "='" + storeid + "'AND categoryId" + "='" + categoryid + "'", null);
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_STOCK_DIALOG_MAIN, "Store_Id" + "='" + storeid + "'AND categoryId" + "='" + categoryid + "'", null);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("" + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void deletePdImagedata(String storeid, String categoryid) {
|
||||
try {
|
||||
db.delete(CommonString.TABLE_IRPD, "STORE_ID" + "='" + storeid + "'AND CATEGORY_ID" + "='" + categoryid + "'", null);
|
||||
} catch (Exception e) {
|
||||
System.out.println("" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4549,7 +4553,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
String value = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_IMAGES));
|
||||
if (value != null && !value.isEmpty()) {
|
||||
String value2 = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_TOGGLE_VALUE));
|
||||
if (value != null && !value.isEmpty() || value2.equals("0")){
|
||||
filled = true;
|
||||
}
|
||||
dbcursor.close();
|
||||
@@ -4771,7 +4776,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(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 "
|
||||
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,ifnull(T.TOGGLE_VALUE,'1')AS TOGGLE_VALUE,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" +
|
||||
@@ -4784,7 +4789,7 @@ 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(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" +
|
||||
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,ifnull(T.TOGGLE_VALUE,'1')AS TOGGLE_VALUE, 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" +
|
||||
@@ -4824,7 +4829,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
CPGS.setImageUris(imageUriList);
|
||||
|
||||
CPGS.setToggle_value(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_TOGGLE_VALUE)));
|
||||
CPGS.setSubCategoryCamera1("");
|
||||
CPGS.setSubCategoryCamera2("");
|
||||
list.add(CPGS);
|
||||
@@ -10694,6 +10699,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
"SELECT DISTINCT SB.SUB_CATEGORY_ID, SB.SUB_CATEGORY, " +
|
||||
"IFNULL(BR.PD_SUB_CATEGORY_CODE, '') AS PD_SUB_CATEGORY_CODE, " +
|
||||
"IFNULL(T.IRPD_VISIBILITY_IMAGES, '') AS IRPD_VISIBILITY_IMAGES, " +
|
||||
"IFNULL(T.TOGGLE_VALUE, '1') AS TOGGLE_VALUE, " +
|
||||
"IFNULL(T.IRPD_VISIBILITY_IMAGES_MODIFY, '') AS IRPD_VISIBILITY_IMAGES_MODIFY " +
|
||||
"FROM STOCK_DIALOG_MAIN SB " +
|
||||
"INNER JOIN SUB_CATEGORY_MASTER BR ON SB.SUB_CATEGORY_ID = BR.SUB_CATEGORY_ID " +
|
||||
@@ -10731,6 +10737,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
imageUriList.add(new ImageUri(uri, modifyUri));
|
||||
}
|
||||
CPGS.setImageUris(imageUriList);
|
||||
CPGS.setToggle_value(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_TOGGLE_VALUE)));
|
||||
CPGS.setSubCategoryCamera1("");
|
||||
CPGS.setSubCategoryCamera2("");
|
||||
list.add(CPGS);
|
||||
@@ -10792,7 +10799,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
|
||||
public long InsertPdImageData(
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String savemode) {
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String toggle,String savemode) {
|
||||
ContentValues values = new ContentValues();
|
||||
long l = 0;
|
||||
try {
|
||||
@@ -10805,6 +10812,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
values.put(CommonString.KEY_SAVE_MODE, savemode);
|
||||
values.put(CommonString.KEY_STORE_ID, storeId);
|
||||
values.put(CommonString.KEY_VISIT_DATE, visit_date);
|
||||
values.put("toggle_value", toggle);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, categoryId);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, categoryId);
|
||||
values.put(CommonString.KEY_SUB_CATEGORY_ID, _list.get(i).getSUB_CATEGORY_ID());
|
||||
values.put(CommonString.KEY_SUB_CATEGORY_CODE, _list.get(i).getSubCatCode());
|
||||
@@ -10854,7 +10863,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public long InsertPdImageVisibilityData(
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String savemode) {
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String toggle,String savemode) {
|
||||
ContentValues values = new ContentValues();
|
||||
long l = 0;
|
||||
try {
|
||||
@@ -10866,6 +10875,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
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_TOGGLE_VALUE, toggle);
|
||||
values.put(CommonString.KEY_VISIT_DATE, visit_date);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, categoryId);
|
||||
values.put(CommonString.KEY_SUB_CATEGORY_ID, _list.get(i).getSUB_CATEGORY_ID());
|
||||
@@ -11088,6 +11098,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
cd.setSUB_CATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY_ID)));
|
||||
cd.setSubCatCode(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY_CODE)));
|
||||
cd.setSubCategoryCamera2(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_MODIFY_IMAGES)));
|
||||
cd.setToggle_value(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_TOGGLE_VALUE)));
|
||||
|
||||
String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_IMAGES));
|
||||
cd.setImageUris(imgs != null && !imgs.isEmpty() ? (ArrayList<ImageUri>) Arrays.stream(imgs.split(", "))
|
||||
@@ -11128,6 +11139,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
.collect(Collectors.toList()) : new ArrayList<>());
|
||||
|
||||
cd.setSubCategoryCamera1(imgs);
|
||||
cd.setToggle_value(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_TOGGLE_VALUE)));
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.GeoTag;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -92,6 +94,7 @@ import cpm.com.gskmtorange.dailyentry.StoreimageActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.VisitTypeStatusActivity;
|
||||
import cpm.com.gskmtorange.messgae.AlertMessage;
|
||||
import cpm.com.gskmtorange.upload.Base64;
|
||||
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -258,11 +261,16 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
||||
else{
|
||||
db.updateStatus(storeid, status, latitude, longitude, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
|
||||
db.InsertSTOREgeotag(storeid, latitude, longitude, img_str, status);
|
||||
img_str = "";
|
||||
|
||||
new GeoTagUpload(GeoTagActivity.this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new GeoTagUpload(GeoTagActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
+12
@@ -90,6 +90,18 @@ public class CategoryPictureGetterSetter {
|
||||
|
||||
String SubCategoryCamera1;
|
||||
|
||||
String Toggle_value="1";
|
||||
|
||||
public String getToggle_value() {
|
||||
return Toggle_value;
|
||||
}
|
||||
|
||||
public void setToggle_value(String toggle_value) {
|
||||
Toggle_value = toggle_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String SUB_CATEGORY_ID;
|
||||
|
||||
public String getSUB_CATEGORY() {
|
||||
|
||||
@@ -94,6 +94,7 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
|
||||
|
||||
import static android.Manifest.permission.READ_CONTACTS;
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
@@ -450,7 +451,12 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
} else if (!isPasswordValid(password)) {
|
||||
Snackbar.make(museridView, getString(R.string.error_incorrect_password), Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +470,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
if (!u_id.equals("") && !userid.equalsIgnoreCase(u_id)) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -673,7 +678,12 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
if (counter < 3) {
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
showAlert(getString(R.string.nonetwork));
|
||||
counter = 1;
|
||||
@@ -892,7 +902,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
|
||||
if (mGoogleApiClient != null) {
|
||||
mGoogleApiClient.connect();
|
||||
|
||||
}
|
||||
checkgpsEnableDevice();
|
||||
locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 100000)
|
||||
@@ -973,7 +982,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
if (mGoogleApiClient != null) {
|
||||
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startLocationUpdates() {
|
||||
@@ -1004,26 +1012,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
Log.e("onConnectdata", "true" + "," + mGoogleApiClient);
|
||||
/*if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mLastLocation != null) {
|
||||
lat = mLastLocation.getLatitude();
|
||||
lon = mLastLocation.getLongitude();
|
||||
// Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
startLocationUpdates();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1125,7 +1114,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//return ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
|
||||
@@ -32,12 +35,22 @@ import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
||||
@@ -52,6 +65,7 @@ import cpm.com.gskmtorange.dailyentry.PlanogramPDFActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.ServiceActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.SettingsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.WebViewActivity;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.password.ChangePasswordActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivity;
|
||||
@@ -65,6 +79,10 @@ public class MainActivity extends AppCompatActivity
|
||||
private Context context;
|
||||
WebView webView;
|
||||
ImageView imageView;
|
||||
ViewPager2 viewPager;
|
||||
private Handler sliderHandler = new Handler();
|
||||
private Runnable sliderRunnable;
|
||||
private List<ImageView> dots = new ArrayList<>();
|
||||
String date;
|
||||
String app_ver;
|
||||
private SharedPreferences preferences = null;
|
||||
@@ -75,6 +93,7 @@ public class MainActivity extends AppCompatActivity
|
||||
ArrayList<CoverageBean> coverageList;
|
||||
String error_msg;
|
||||
Toolbar toolbar;
|
||||
LinearLayout dotsLayout;
|
||||
NavigationView navigationView;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@@ -83,19 +102,62 @@ public class MainActivity extends AppCompatActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
setSupportActionBar(toolbar);
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
context = this;
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
imageView = (ImageView) findViewById(R.id.img_main);
|
||||
dotsLayout = findViewById(R.id.dotsLayout);
|
||||
webView = (WebView) findViewById(R.id.webview);
|
||||
String url = preferences.getString(CommonString.KEY_NOTICE_BOARD_LINK, "");
|
||||
// String url = preferences.getString(CommonString.KEY_NOTICE_BOARD_LINK, "");
|
||||
String url = "https://dle.parinaam.in/OneApp/Dabur/brand-spiels/dabur-brand-spiels.html";
|
||||
user_name = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||
db = new GSKOrangeDB(MainActivity.this);
|
||||
webView.setWebViewClient(new MyWebViewClient());
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
|
||||
String json = loadJSONFromAsset();
|
||||
|
||||
Gson gson = new Gson();
|
||||
NoticeResponse response = gson.fromJson(json, NoticeResponse.class);
|
||||
List<NoticeItem> list = response.getMer_NoticeBoard();
|
||||
Log.d("listdata", String.valueOf(list.size()));
|
||||
setupDots(list.size());
|
||||
|
||||
viewPager.setAdapter(new NoticeAdapter(list, item -> handleClick(item)));
|
||||
viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
|
||||
setActiveDot(position); // 👈 your dots logic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
super.onPageScrollStateChanged(state);
|
||||
|
||||
if (state == ViewPager2.SCROLL_STATE_DRAGGING) {
|
||||
sliderHandler.removeCallbacks(sliderRunnable); // stop
|
||||
}
|
||||
else if (state == ViewPager2.SCROLL_STATE_IDLE) {
|
||||
startAutoSlide(); // 🔥 don't call postDelayed directly
|
||||
}
|
||||
}
|
||||
});
|
||||
viewPager.setClipToPadding(false);
|
||||
viewPager.setClipChildren(false);
|
||||
// TabLayout tabLayout = findViewById(R.id.tabDots);
|
||||
/*new TabLayoutMediator(tabLayout, viewPager,
|
||||
(tab, position) -> {
|
||||
// no title, just dots
|
||||
}
|
||||
).attach();*/
|
||||
|
||||
if (!url.isEmpty()) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
@@ -122,6 +184,148 @@ public class MainActivity extends AppCompatActivity
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
}
|
||||
|
||||
private void setupDots(int size) {
|
||||
dotsLayout.removeAllViews();
|
||||
dots.clear();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
ImageView dot = new ImageView(this);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
params.setMargins(8, 0, 8, 0);
|
||||
dot.setLayoutParams(params);
|
||||
|
||||
// default (inactive)
|
||||
dot.setImageResource(R.drawable.dot_inactive);
|
||||
|
||||
dotsLayout.addView(dot);
|
||||
dots.add(dot);
|
||||
}
|
||||
|
||||
// set first dot active
|
||||
if (size > 0) {
|
||||
setActiveDot(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void setActiveDot(int position) {
|
||||
|
||||
for (int i = 0; i < dots.size(); i++) {
|
||||
ImageView dot = dots.get(i);
|
||||
|
||||
if (i == position) {
|
||||
// Active dot (bigger + dark)
|
||||
dot.setImageResource(R.drawable.dot_active);
|
||||
|
||||
dot.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(200)
|
||||
.start();
|
||||
|
||||
} else {
|
||||
// Inactive dot (small + light)
|
||||
dot.setImageResource(R.drawable.dot_inactive);
|
||||
|
||||
dot.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setDuration(200)
|
||||
.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleClick(NoticeItem item) {
|
||||
|
||||
String url = item.getNoticeLink_FullPage();
|
||||
String type = item.getFullPageTarget();
|
||||
|
||||
if (type == null) return;
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
|
||||
case "html-webview":
|
||||
Intent webIntent = new Intent(this, WebViewActivity.class);
|
||||
webIntent.putExtra("url", url);
|
||||
webIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(webIntent);
|
||||
break;
|
||||
|
||||
case "html-webbrowser":
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||
break;
|
||||
|
||||
case "video":
|
||||
Intent videoIntent = new Intent(this, WebViewActivity.class);
|
||||
videoIntent.putExtra("url", url);
|
||||
videoIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(videoIntent);
|
||||
break;
|
||||
|
||||
case "image":
|
||||
Intent imageIntent = new Intent(this, WebViewActivity.class);
|
||||
imageIntent.putExtra("url", url);
|
||||
imageIntent.putExtra("type", item.getFullPageTarget());
|
||||
startActivity(imageIntent);
|
||||
break;
|
||||
|
||||
case "deeplink":
|
||||
try {
|
||||
Intent deepIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(deepIntent);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Invalid deeplink", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
||||
case "contact":
|
||||
handleContact(url);
|
||||
break;
|
||||
|
||||
default:
|
||||
Toast.makeText(this, "Unsupported type", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleContact(String raw) {
|
||||
try {
|
||||
// remove query params
|
||||
String jsonPart = raw.split("\\?")[0];
|
||||
|
||||
JSONObject obj = new JSONObject(jsonPart);
|
||||
|
||||
String number = obj.getString("Value");
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
intent.setData(Uri.parse("tel:" + number));
|
||||
startActivity(intent);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, "Invalid contact data", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private String loadJSONFromAsset() {
|
||||
String json = null;
|
||||
try {
|
||||
InputStream is = getAssets().open("notice.json");
|
||||
int size = is.available();
|
||||
byte[] buffer = new byte[size];
|
||||
is.read(buffer);
|
||||
is.close();
|
||||
json = new String(buffer, "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -131,6 +335,7 @@ public class MainActivity extends AppCompatActivity
|
||||
db.open();
|
||||
//usk
|
||||
navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
startAutoSlide();
|
||||
try {
|
||||
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
|
||||
// login_version.setText("Parinaam Version " + app_ver);
|
||||
@@ -223,6 +428,30 @@ public class MainActivity extends AppCompatActivity
|
||||
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
|
||||
}
|
||||
|
||||
private void startAutoSlide() {
|
||||
|
||||
if (sliderRunnable != null) {
|
||||
sliderHandler.removeCallbacks(sliderRunnable); // 🔥 prevent duplicate
|
||||
}
|
||||
|
||||
sliderRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (viewPager.getAdapter() == null) return;
|
||||
|
||||
int nextItem = (viewPager.getCurrentItem() + 1) %
|
||||
viewPager.getAdapter().getItemCount();
|
||||
|
||||
viewPager.setCurrentItem(nextItem, true);
|
||||
|
||||
sliderHandler.postDelayed(this, 3000); // 3 sec
|
||||
}
|
||||
};
|
||||
|
||||
sliderHandler.postDelayed(sliderRunnable, 3000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
@@ -377,7 +606,7 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
imageView.setVisibility(View.INVISIBLE);
|
||||
imageView.setVisibility(View.GONE);
|
||||
webView.setVisibility(View.VISIBLE);
|
||||
super.onPageFinished(view, url);
|
||||
view.clearCache(true);
|
||||
@@ -502,4 +731,57 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
|
||||
}
|
||||
public class NoticeAdapter extends RecyclerView.Adapter<NoticeAdapter.ViewHolder> {
|
||||
|
||||
private List<NoticeItem> list;
|
||||
private OnItemClickListener listener;
|
||||
|
||||
// Interface for click handling
|
||||
public interface OnItemClickListener {
|
||||
void onClick(NoticeItem item);
|
||||
}
|
||||
|
||||
public NoticeAdapter(List<NoticeItem> list, OnItemClickListener listener) {
|
||||
this.list = list;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView image;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
image = itemView.findViewById(R.id.bannerImage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoticeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.banner_item, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(NoticeAdapter.ViewHolder holder, int position) {
|
||||
NoticeItem item = list.get(position);
|
||||
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(item.getNoticeLink_Thumbnail())
|
||||
.into(holder.image);
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) {
|
||||
listener.onClick(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list != null ? list.size() : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NoticeResponse {
|
||||
List<NoticeItem> Mer_NoticeBoard;
|
||||
|
||||
public List<NoticeItem> getMer_NoticeBoard() {
|
||||
return Mer_NoticeBoard;
|
||||
}
|
||||
}
|
||||
|
||||
class NoticeItem {
|
||||
int NoticeBoardId;
|
||||
String NoticeLink_Thumbnail;
|
||||
String NoticeLink_FullPage;
|
||||
String FullPageTarget;
|
||||
|
||||
public String getNoticeLink_Thumbnail() { return NoticeLink_Thumbnail; }
|
||||
public String getNoticeLink_FullPage() { return NoticeLink_FullPage; }
|
||||
public String getFullPageTarget() { return FullPageTarget; }
|
||||
}
|
||||
@@ -9,6 +9,9 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -29,10 +32,6 @@ import android.app.AlertDialog;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 13-11-2017.
|
||||
*/
|
||||
|
||||
public class CommonFunctions {
|
||||
public static boolean updateLangResources(Context context, String language) {
|
||||
String lang;
|
||||
@@ -153,7 +152,6 @@ public class CommonFunctions {
|
||||
inSampleSize *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
return inSampleSize;
|
||||
}
|
||||
|
||||
@@ -211,4 +209,28 @@ public class CommonFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isInternetAvailable(Context context) {
|
||||
ConnectivityManager connectivityManager =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (connectivityManager == null)
|
||||
return false;
|
||||
|
||||
Network network = connectivityManager.getActiveNetwork();
|
||||
if (network == null)
|
||||
return false;
|
||||
|
||||
NetworkCapabilities capabilities =
|
||||
connectivityManager.getNetworkCapabilities(network);
|
||||
if (capabilities == null)
|
||||
return false;
|
||||
|
||||
return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
|
||||
capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1556,6 +1556,7 @@ public class CommonString {
|
||||
|
||||
public static final String KEY_IRPD_IMAGES = "IRPD_IMAGES";
|
||||
public static final String KEY_IRPD_MODIFY_IMAGES = "IRPD_IMAGES_MODIFY";
|
||||
public static final String KEY_TOGGLE_VALUE = "TOGGLE_VALUE";
|
||||
public static final String TABLE_IRPD = "DR_IRPD";
|
||||
public static final String CREATE_TABLE_IRPD = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_IRPD
|
||||
@@ -1576,6 +1577,8 @@ public class CommonString {
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_MODIFY_IMAGES
|
||||
+ " VARCHAR,"
|
||||
+ KEY_TOGGLE_VALUE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
@@ -1625,6 +1628,8 @@ public class CommonString {
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_MODIFY_IMAGES
|
||||
+ " VARCHAR,"
|
||||
+ KEY_TOGGLE_VALUE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
|
||||
@@ -270,14 +270,12 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if (togglevalue.equals("1")) {
|
||||
if (listdata.size() > 0) {
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
} else {
|
||||
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
@@ -390,114 +388,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
public void onClick(View view) {
|
||||
|
||||
if (btntoggle.isChecked()) {
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
/*if (listdata.size() > 0) {
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.data_will_be_lost))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
db.deleteStockEntryall(store_id, categoryId);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
|
||||
listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
btntoggle.setChecked(false);
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
// show it
|
||||
alertDialog.show();
|
||||
|
||||
} else {
|
||||
|
||||
listMain = db.getAdditionalMainStock(store_id, categoryId);
|
||||
|
||||
if (listMain.size() > 0) {
|
||||
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.data_will_be_lost))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.deleteStockEntryall(store_id, categoryId);
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
btntoggle.setChecked(false);
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
// show it
|
||||
alertDialog.show();
|
||||
|
||||
} else {
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.VISIBLE);
|
||||
cameralayout.setVisibility(View.VISIBLE);
|
||||
btnsku.setVisibility(View.VISIBLE);
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
listdata.clear();
|
||||
|
||||
togglevalue = "1";
|
||||
btntoggle.setChecked(true);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
@@ -524,26 +415,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
//db.deleteStockEntryall(store_id, categoryId);
|
||||
/* togglevalue = "0";
|
||||
btntoggle.setChecked(false);
|
||||
*/
|
||||
//clear both parent and child data lists
|
||||
//defdata.clear();
|
||||
listdata.clear();
|
||||
|
||||
/* btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);*/
|
||||
|
||||
// listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
/* adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();*/
|
||||
togglevalue = "0";
|
||||
btntoggle.setChecked(false);
|
||||
defdata.clear();
|
||||
@@ -556,7 +428,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
adapteradditional.notifyDataSetChanged();
|
||||
editFlag = true;
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
|
||||
@@ -19,10 +19,14 @@ import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
@@ -130,7 +134,6 @@ public class AuditActivity extends AppCompatActivity {
|
||||
for (int j = 0; j < childListData.size(); j++) {
|
||||
answerList.add(childListData.get(j));
|
||||
}
|
||||
|
||||
hashMapAnsListChildData.put(question_list.get(i), answerList); // Header, Child data
|
||||
}
|
||||
|
||||
@@ -514,7 +517,7 @@ public class AuditActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
/*holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
@@ -528,8 +531,66 @@ public class AuditActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
holder.edt_answer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
EditText edit = (EditText) v;
|
||||
String input = edit.getText().toString();
|
||||
String cleanText;
|
||||
|
||||
// Clean text based on type
|
||||
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("NUMBER")) {
|
||||
cleanText = input.replaceFirst("^0+.(?!$)", "");
|
||||
} else {
|
||||
cleanText = input.replaceAll("[&^<>{}'$]", "");
|
||||
}
|
||||
|
||||
// ✔ Prevent crash if ViewHolder is recycled
|
||||
if (holder.getAdapterPosition() != RecyclerView.NO_POSITION) {
|
||||
holder.data.setANSWER_ID("0");
|
||||
holder.data.setANSWER(cleanText);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*holder.edt_answer.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
||||
holder.edt_answer.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT) {
|
||||
|
||||
View next = v.focusSearch(View.FOCUS_DOWN);
|
||||
|
||||
if (next != null) {
|
||||
if (next instanceof EditText) {
|
||||
// Focus next EditText, keyboard stays
|
||||
next.requestFocus();
|
||||
} else if (next instanceof Spinner) {
|
||||
// Hide keyboard safely
|
||||
InputMethodManager imm = (InputMethodManager) v.getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(holder.edt_answer.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
// Post the performClick to ensure it happens after keyboard hides
|
||||
next.post(() -> next.performClick());
|
||||
} else {
|
||||
next.requestFocus();
|
||||
}
|
||||
}
|
||||
return true; // consume action
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
//set remark
|
||||
holder.edt_text.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -16,12 +18,9 @@ import androidx.appcompat.widget.Toolbar;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
@@ -30,6 +29,8 @@ 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.upload.UploadActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
|
||||
public class CheckoutActivity extends AppCompatActivity {
|
||||
private Context context;
|
||||
@@ -64,7 +65,12 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
lon = getIntent().getStringExtra(CommonString.KEY_LONGITUDE);
|
||||
coverageBean = db.getCoverageSpecificData(visit_date, store_id);
|
||||
|
||||
new BackgroundTask(CheckoutActivity.this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new BackgroundTask(CheckoutActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private class BackgroundTask extends AsyncTask<Void, Data, String> {
|
||||
@@ -113,7 +119,7 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + service, envelope);
|
||||
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@@ -56,6 +57,7 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var masterStoreListPd: ArrayList<Master_Storelist_PDA_GetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
var toggle: String? = "1"
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdvisibilityBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
@@ -120,7 +122,19 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
)
|
||||
)
|
||||
|
||||
binding.rlContent.btntoggle.setOnClickListener {
|
||||
if(toggle =="1"){
|
||||
toggle = "0"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
else{
|
||||
toggle = "1"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
Log.d("toggle_value_new",toggle.toString())
|
||||
}
|
||||
}
|
||||
binding.apply {
|
||||
fab.setOnClickListener {
|
||||
if (validate()) {
|
||||
@@ -134,6 +148,7 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
toggle,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
@@ -170,12 +185,16 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
CommonFunctions.updateLangResources(
|
||||
context,
|
||||
preferences!!.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty()) {
|
||||
if (!listdat.isNullOrEmpty() && toggle=="1") {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
@@ -349,7 +368,7 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
db?.open()
|
||||
listdat = db?.getirVisibilityData(date,store_id,categoryId)
|
||||
|
||||
Log.d("listdatsize", listdat?.size.toString())
|
||||
// Log.d("listdatsize", listdat?.size.toString() +","+listdat?.get(0)?.toggle_value)
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
@@ -357,12 +376,6 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
btnlistener = object : SubCatPdAdapter.BtnClickListener {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PDVisibilityActivity._pos = _pos
|
||||
/* if (isNetworkAvailable(this@PDVisibilityActivity)) {
|
||||
launchCamera(data.subCatCode,data.suB_CATEGORY,data.suB_CATEGORY_ID)
|
||||
Log.d("subCatCode", data.subCatCode)
|
||||
} else {
|
||||
Toast.makeText(context, "No internet connection", Toast.LENGTH_SHORT).show()
|
||||
}*/
|
||||
launchCamera(data.subCatCode,data.suB_CATEGORY,data.suB_CATEGORY_ID)
|
||||
}
|
||||
})
|
||||
@@ -371,12 +384,22 @@ class PDVisibilityActivity : AppCompatActivity() {
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDVisibilityActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
|
||||
toggle = listdat?.get(0)?.toggle_value ?: "1"
|
||||
|
||||
if(toggle == "1"){
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
} else {
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
if (!db!!.isPdVisibility(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdImageVisibilityData(date, store_id, categoryId, listdat, CommonString.KEY_DRAFT)
|
||||
db?.InsertPdImageVisibilityData(date, store_id, categoryId, listdat,toggle, CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
fun isNetworkAvailable(context: Context): Boolean {
|
||||
|
||||
@@ -197,77 +197,6 @@ class PD_Realtime_Report : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchCamera(subCat_code: String) {
|
||||
val uploadFrom = "TestApp"
|
||||
val uploadParams = JSONObject(
|
||||
"""
|
||||
{
|
||||
"shop_id": 62475,
|
||||
"project_id": "4f57635b-6b07-45bf-bfba-c61c2826b6db",
|
||||
"td_version_id": 178,
|
||||
"shelf_image_id": null,
|
||||
"asset_image_id": null,
|
||||
"shelf_type": "Primary Shelf",
|
||||
"category_id": 123,
|
||||
"user_id": 133,
|
||||
"isConnected": true,
|
||||
"sn_image_type": "skus",
|
||||
"image_type": "multiple",
|
||||
"seq_no": 1,
|
||||
"level": 1,
|
||||
"uploadOnlyOnWifi": 0,
|
||||
"app_session_id": "8e2faa6b-d6fe-413a-a693-76a0cbe0ce71",
|
||||
"metadata": { "Device_Name": "Samsung" }
|
||||
}
|
||||
"""
|
||||
)
|
||||
uploadParams.put("shop_id", store_id)
|
||||
uploadParams.put("user_id", username)
|
||||
uploadParams.put("category_id", subCat_code)
|
||||
uploadParams.put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
Log.d("uploadparamdata",uploadParams.toString());
|
||||
|
||||
|
||||
if(!lang.equals("ENGLISH",ignoreCase = true)){
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "ar",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
else{
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
if (country_id == "8") {
|
||||
db?.open()
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.net.toUri
|
||||
@@ -43,6 +44,7 @@ class PDimageActivity : AppCompatActivity() {
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var lang: String? = null;
|
||||
var userId: String? = null
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
@@ -53,6 +55,7 @@ class PDimageActivity : AppCompatActivity() {
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var masterStoreListPd: ArrayList<Master_Storelist_PDA_GetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
var toggle: String? = "1"
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdimageBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
@@ -101,10 +104,24 @@ class PDimageActivity : AppCompatActivity() {
|
||||
masterStoreListPd = db?.getMasterStoreListPd(store_id,CommonString.TABLE_MASTER_STORELIST_PD)
|
||||
// Log.d("master_store_list_size",masterStoreListPd.toString())
|
||||
|
||||
|
||||
binding.rlContent.btntoggle.setOnClickListener {
|
||||
if(toggle =="1"){
|
||||
toggle = "0"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
else{
|
||||
toggle = "1"
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
Log.d("toggle_value_new",toggle.toString())
|
||||
}
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
Log.d("pd_user_id",userId.toString());
|
||||
// Log.d("pd_user_id",userId.toString());
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PDimageActivity,
|
||||
@@ -112,7 +129,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
@@ -132,6 +148,7 @@ class PDimageActivity : AppCompatActivity() {
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
toggle,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
@@ -173,12 +190,17 @@ class PDimageActivity : AppCompatActivity() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
CommonFunctions.updateLangResources(
|
||||
context,
|
||||
preferences!!.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty()) {
|
||||
if (!listdat.isNullOrEmpty() && toggle=="1") {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
@@ -289,54 +311,13 @@ class PDimageActivity : AppCompatActivity() {
|
||||
put("StoreTypeId", masterstorelistpddata?.storeTypeId?.getOrNull(0) ?: "NA")
|
||||
put("SOName", masterstorelistpddata?.soName?.getOrNull(0) ?: "NA")
|
||||
}
|
||||
|
||||
/* val uploadParams = JSONObject(
|
||||
"""
|
||||
{
|
||||
"shop_id": 62475,
|
||||
"store_name": "abc",
|
||||
"project_id": "4f57635b-6b07-45bf-bfba-c61c2826b6db",
|
||||
"td_version_id": 178,
|
||||
"shelf_image_id": null,
|
||||
"asset_image_id": null,
|
||||
"shelf_type": "Primary Shelf",
|
||||
"category_id": 123,
|
||||
"user_id": 133,
|
||||
"isConnected": true,
|
||||
"sn_image_type": "skus",
|
||||
"image_type": "multiple",
|
||||
"seq_no": 1,
|
||||
"level": 1,
|
||||
"uploadOnlyOnWifi": 0,
|
||||
"app_session_id": "8e2faa6b-d6fe-413a-a693-76a0cbe0ce71",
|
||||
"metadata": { "Device_Name": $devicename,"User_name": $username,
|
||||
"StoreId":${masterstorelistpddata?.storeId?.get(0)},
|
||||
"channel":${masterstorelistpddata?.channel?.get(0)},
|
||||
"format":${masterstorelistpddata?.format?.get(0)},
|
||||
"region":${masterstorelistpddata?.region?.get(0)},
|
||||
"bay_type":"NA",
|
||||
"no_of_bays":"NA",
|
||||
"category":${masterstorelistpddata?.category?.get(0)},
|
||||
"user_id":$username,
|
||||
"Active":${masterstorelistpddata?.active?.get(0)},
|
||||
"ASMArea":"NA",
|
||||
"EmployeeName":${masterstorelistpddata?.employeeName?.get(0)},
|
||||
"DesignationName":${masterstorelistpddata?.designationName?.get(0)},
|
||||
"SupervisorId":${masterstorelistpddata?.supervisorId?.get(0)},
|
||||
"Supervisor":${masterstorelistpddata?.supervisor?.get(0)},
|
||||
"StoreCode":${masterstorelistpddata?.storeCode?.get(0)},
|
||||
"ChainId":${masterstorelistpddata?.chainId?.get(0)},
|
||||
"StoreTypeId":${masterstorelistpddata?.storeTypeId?.get(0)},
|
||||
"SOName":${masterstorelistpddata?.soName?.get(0)}
|
||||
}
|
||||
"""
|
||||
)*/
|
||||
val uploadParams = JSONObject().apply {
|
||||
put("shop_id", store_id)
|
||||
put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
put("shelf_type", "Primary Shelf")
|
||||
put("category_id", subCat_code)
|
||||
put("user_id", username)
|
||||
put("user_id", userId)
|
||||
// put("user_id", userId)
|
||||
put("metadata", metadata)
|
||||
}
|
||||
|
||||
@@ -421,7 +402,6 @@ class PDimageActivity : AppCompatActivity() {
|
||||
CommonString.TABLE_MAPPING_STOCK
|
||||
)
|
||||
}
|
||||
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
@@ -433,17 +413,27 @@ class PDimageActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDimageActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDimageActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
// Now only handle toggle visibility
|
||||
toggle = listdat?.get(0)?.toggle_value ?: "1"
|
||||
|
||||
if(toggle == "1"){
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.VISIBLE
|
||||
binding.rlContent.btntoggle.isChecked = true
|
||||
} else {
|
||||
binding.rlContent.recyclerViewSubCat.visibility = View.GONE
|
||||
binding.rlContent.btntoggle.isChecked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
if (!db!!.isSOSCategory(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat, CommonString.KEY_DRAFT)
|
||||
db?.InsertPdImageData(date, store_id, categoryId, listdat,toggle, CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -51,7 +51,6 @@ import com.google.android.gms.location.Priority;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -78,6 +77,7 @@ import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -477,7 +477,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(
|
||||
CommonString.URL);
|
||||
androidHttpTransport.call(
|
||||
CommonString.SOAP_ACTION_UPLOAD_CURRRENT_DATA, envelope);
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@@ -708,101 +710,153 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
viewHolder.imgview_navigation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
viewHolder.parent_layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
store_id = current.getSTORE_ID();
|
||||
store_facing_hide = current.getFACING_HIDE();
|
||||
storeCurrentObj = current;
|
||||
|
||||
viewHolder.parent_layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U) || current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_data_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_Y)) {
|
||||
|
||||
store_id = current.getSTORE_ID();
|
||||
store_facing_hide = current.getFACING_HIDE();
|
||||
storeCurrentObj = current;
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_checkout, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (store_flag_str.equals(CommonString.FROM_DEVIATION) && (coverageObj.getStatus() != null
|
||||
&& coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID))) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (checkleavestatus(store_id)) {
|
||||
|
||||
if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U) || current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_data_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_Y)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_already_checkout, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else if (checkleavestatus(store_id)) {
|
||||
|
||||
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
|
||||
} else {
|
||||
// PUT IN PREFERENCES
|
||||
if (checkotherCheckedIn(store_flag_str)) {
|
||||
Snackbar.make(v, getString(R.string.title_store_list_checkout_current) + " - " + from_checkedIn, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} else {
|
||||
if (!setCheckedMethod(store_id)) {
|
||||
boolean enteryflag = true;
|
||||
if (coverage.size() > 0) {
|
||||
int i;
|
||||
for (i = 0; i < coverage.size(); i++) {
|
||||
// PUT IN PREFERENCES
|
||||
if (checkotherCheckedIn(store_flag_str)) {
|
||||
Snackbar.make(v, getString(R.string.title_store_list_checkout_current) + " - " + from_checkedIn, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} else {
|
||||
if (!setCheckedMethod(store_id)) {
|
||||
boolean enteryflag = true;
|
||||
if (coverage.size() > 0) {
|
||||
int i;
|
||||
for (i = 0; i < coverage.size(); i++) {
|
||||
|
||||
if (coverage.get(i).getInTime() != null) {
|
||||
if (coverage.get(i).getInTime() != null) {
|
||||
|
||||
if (coverage.get(i).getOutTime() == null) {
|
||||
if (!store_id.equals(coverage.get(i).getStoreId())) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
enteryflag = false;
|
||||
if (coverage.get(i).getOutTime() == null) {
|
||||
if (!store_id.equals(coverage.get(i).getStoreId())) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
enteryflag = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enteryflag) {
|
||||
if (store_flag_str.equals(CommonString.FROM_PHARMA) && coverageObj.getStatus() != null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} /*if((store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) && coverageObj.getStatus()!=null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)){
|
||||
if (enteryflag) {
|
||||
if (store_flag_str.equals(CommonString.FROM_PHARMA) && coverageObj.getStatus() != null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)) {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
} /*if((store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) && coverageObj.getStatus()!=null && coverageObj.getStatus().equalsIgnoreCase(CommonString.KEY_VALID)){
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}*/ else if (store_flag_str.equals(CommonString.FROM_JCP) || store_flag_str.equals(CommonString.FROM_PHARMA) || store_flag_str.equals(CommonString.FROM_ADDITIONAL_ADHOC) || store_flag_str.equals(CommonString.FROM_ADDITIONAL)) {
|
||||
showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS(), current.getGEO_TAG(), current);
|
||||
} else {
|
||||
if (country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase("15") || country_id.equalsIgnoreCase("2") || country_id.equalsIgnoreCase(CommonString.COUNTRY_ID_EGYPT + "")) {
|
||||
if (!current.getGEO_TAG().equalsIgnoreCase("N")) {
|
||||
boolean flag = true;
|
||||
if (coverage.size() > 0) {
|
||||
for (int i = 0; i < coverage.size(); i++) {
|
||||
if (store_id.equals(coverage.get(i).getStoreId())) {
|
||||
flag = false;
|
||||
break;
|
||||
showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS(), current.getGEO_TAG(), current);
|
||||
} else {
|
||||
if (country_id.equalsIgnoreCase("5") || country_id.equalsIgnoreCase("15") || country_id.equalsIgnoreCase("2") || country_id.equalsIgnoreCase(CommonString.COUNTRY_ID_EGYPT + "")) {
|
||||
if (!current.getGEO_TAG().equalsIgnoreCase("N")) {
|
||||
boolean flag = true;
|
||||
if (coverage.size() > 0) {
|
||||
for (int i = 0; i < coverage.size(); i++) {
|
||||
if (store_id.equals(coverage.get(i).getStoreId())) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean flag_entry = true;
|
||||
int distance = 0;
|
||||
//geo fencing enabled only if GEO_FENCING equals 1 for COUNTRY_ID
|
||||
if (flag && geoFencingGetterSetters.size() > 0 && geoFencingGetterSetters.get(0).getGEO_FENCING().get(0).equals("1")) {
|
||||
distanceGeoPhence = Integer.parseInt(geoFencingGetterSetters.get(0).getDISTANCE_MTR().get(0));
|
||||
boolean flag_entry = true;
|
||||
int distance = 0;
|
||||
//geo fencing enabled only if GEO_FENCING equals 1 for COUNTRY_ID
|
||||
if (flag && geoFencingGetterSetters.size() > 0 && geoFencingGetterSetters.get(0).getGEO_FENCING().get(0).equals("1")) {
|
||||
distanceGeoPhence = Integer.parseInt(geoFencingGetterSetters.get(0).getDISTANCE_MTR().get(0));
|
||||
|
||||
double store_lat = Double.parseDouble(current.getLATITUDE());
|
||||
double store_lon = Double.parseDouble(current.getLONGITUDE());
|
||||
double store_lat = Double.parseDouble(current.getLATITUDE());
|
||||
double store_lon = Double.parseDouble(current.getLONGITUDE());
|
||||
|
||||
if (store_lat != 0.0 && store_lon != 0.0) {
|
||||
distance = distFrom(store_lat, store_lon, lat, lon);
|
||||
if (store_lat != 0.0 && store_lon != 0.0) {
|
||||
distance = distFrom(store_lat, store_lon, lat, lon);
|
||||
|
||||
if (distance > distanceGeoPhence) {
|
||||
flag_entry = false;
|
||||
if (distance > distanceGeoPhence) {
|
||||
flag_entry = false;
|
||||
} else {
|
||||
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_entry) {
|
||||
// Log.e("flag_entrydata","flagdata");
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
|
||||
if (!coverageObj.getStatus().equalsIgnoreCase("N")) {
|
||||
//if(db.isFilledAdhoc(store_id, visit_date)){
|
||||
Intent in = new Intent(StoreListActivity.this, StoreWisePerformanceActivity.class);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String msg = getString(R.string.you_need_to_be_in_the_store) + "\n " + getString(R.string.distance_from_the_store) + " - " + distance + " " + getString(R.string.meters);
|
||||
//dialog.cancel();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog1, int id) {
|
||||
|
||||
dialog1.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
|
||||
alert.show();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (flag_entry) {
|
||||
// Log.e("flag_entrydata","flagdata");
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
@@ -811,85 +865,46 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
|
||||
if (!coverageObj.getStatus().equalsIgnoreCase("N")) {
|
||||
//if(db.isFilledAdhoc(store_id, visit_date)){
|
||||
Intent in = new Intent(StoreListActivity.this, StoreWisePerformanceActivity.class);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
}
|
||||
} else {
|
||||
String msg = getString(R.string.you_need_to_be_in_the_store) + "\n " + getString(R.string.distance_from_the_store) + " - " + distance + " " + getString(R.string.meters);
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//dialog.cancel();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(msg).setCancelable(false).setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog1, int id) {
|
||||
|
||||
dialog1.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert = builder.create();
|
||||
|
||||
alert.show();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
editor = preferences.edit();
|
||||
editor.putString(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
editor.putString(CommonString.KEY_STORE_FLAG_FACING_HIDE, current.getFACING_HIDE());
|
||||
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
|
||||
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
|
||||
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
|
||||
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
|
||||
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
|
||||
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
|
||||
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
|
||||
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
|
||||
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
|
||||
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
|
||||
editor.putString(CommonString.KEY_POG_TYPE_ID, current.getPOG_TYPE_ID());
|
||||
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
|
||||
editor.commit();
|
||||
new UploadTask(StoreListActivity.this, store_id).execute();
|
||||
//dialog.cancel();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (coverageObj.getStatus().equals("N")) {
|
||||
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
if (coverageObj.getStatus().equals("N")) {
|
||||
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||
in.putExtra(CommonString.KEY_STORE_ID, store_id);
|
||||
in.putExtra(CommonString.KEY_STORE_FLAG_FACING_HIDE, store_facing_hide);
|
||||
startActivity(in);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
viewHolder.imgview_navigation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -912,44 +927,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
/* String visit_xml = "";
|
||||
String onXML = "";
|
||||
ArrayList<Visit_Type_Master_GetterSetter> visittypelist = db.getUploadedVisitType(store_id);
|
||||
|
||||
if (visittypelist.size() > 0) {
|
||||
for (int j = 0; j < visittypelist.size(); j++) {
|
||||
// Log.e("visit_type_id", String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()));
|
||||
if(String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()).equalsIgnoreCase("[3]")){
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" + "3" + "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
else if(String.valueOf(visittypelist.get(j).getVISIT_TYPE_ID()).equalsIgnoreCase("[2]")){
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" + "2" + "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
else{
|
||||
onXML = "[VISIT_TYPE_STATUS]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + userId + "[/USERID]"
|
||||
+ "[STORE_ID]" + store_id + "[/STORE_ID]"
|
||||
+ "[VISIT_TYPE_ID]" +"1"+ "[/VISIT_TYPE_ID]"
|
||||
+ "[/VISIT_TYPE_STATUS]";
|
||||
}
|
||||
|
||||
visit_xml = visit_xml + onXML;
|
||||
}
|
||||
final String sos_xml = "[DATA]" + visit_xml + "[/DATA]";
|
||||
Log.e("visit_xml_data", sos_xml);
|
||||
}*/
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
|
||||
builder.setMessage(R.string.wantcheckout).setCancelable(false).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -56,7 +58,6 @@ import com.google.android.gms.location.Priority;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -84,7 +85,9 @@ import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
import cpm.com.gskmtorange.pharma_stores.PharmaActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
@@ -333,21 +336,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
// AppIndex.AppIndexApi.end(client, getIndexApiAction());
|
||||
/* if (mGoogleApiClient.isConnected()) {
|
||||
mGoogleApiClient.disconnect();
|
||||
}*/
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
//client.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//stopLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,7 +530,12 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
database.updateCheckoutStatus(store_id, status, table);
|
||||
|
||||
new GeoTagUpload(StoreimageActivity.this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new GeoTagUpload(StoreimageActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@@ -802,14 +800,13 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + service, envelope);
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
if (result.toString().equalsIgnoreCase(
|
||||
CommonString.KEY_SUCCESS)) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (result.toString().equalsIgnoreCase(
|
||||
|
||||
@@ -1,24 +1,52 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Message
|
||||
import android.provider.MediaStore
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.*
|
||||
import android.view.View
|
||||
import android.webkit.ConsoleMessage
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import com.bumptech.glide.request.target.ViewTarget
|
||||
import cpm.com.gskmtorange.databinding.ActivityWebviewBinding
|
||||
import org.json.JSONObject
|
||||
|
||||
class WebViewActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var binding: ActivityWebviewBinding
|
||||
var toolbar: Toolbar? = null
|
||||
private lateinit var type : String
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityWebviewBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val url = intent.getStringExtra("url") ?: ""
|
||||
// Configure WebView settings
|
||||
type = intent.getStringExtra("type") ?: "html-webview"
|
||||
type = intent.getStringExtra("type") ?: "html-webview"
|
||||
handleContent(type, url)
|
||||
|
||||
binding.toolbar.setTitle("Banner Detail")
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
|
||||
|
||||
/* // ✅ SETTINGS
|
||||
with(binding.webView.settings) {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
@@ -27,104 +55,374 @@ class WebViewActivity : AppCompatActivity() {
|
||||
loadWithOverviewMode = true
|
||||
useWideViewPort = true
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||
// ✅ Force desktop mode by dynamically modifying user-agent
|
||||
val defaultUA = WebSettings.getDefaultUserAgent(this@WebViewActivity)
|
||||
val desktopUA = defaultUA.replace("Mobile", "").replace("Android", "").trim()
|
||||
userAgentString = desktopUA
|
||||
Log.d("UserAgent", "Final User-Agent: $desktopUA")
|
||||
}
|
||||
|
||||
// Keep navigation inside WebView
|
||||
// ✅ JS INTERFACE
|
||||
binding.webView.addJavascriptInterface(WebAppInterface(), "Android")
|
||||
|
||||
// ✅ WEBVIEW CLIENT
|
||||
binding.webView.webViewClient = object : WebViewClient() {
|
||||
override fun shouldOverrideUrlLoading(
|
||||
view: WebView?,
|
||||
request: WebResourceRequest?
|
||||
): Boolean {
|
||||
return false
|
||||
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: android.graphics.Bitmap?) {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
injectJS(view) // 🔥 early injection
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
// Inject JS to simulate mouseover/mouseenter on tap
|
||||
view?.evaluateJavascript(
|
||||
"""
|
||||
(function() {
|
||||
function findAncestorWithAttr(el, attr) {
|
||||
while (el && el !== document.body) {
|
||||
if (el.hasAttribute && el.hasAttribute(attr)) {
|
||||
return el;
|
||||
}
|
||||
el = el.parentElement;
|
||||
injectJS(view) // 🔥 safe injection again
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
document.addEventListener('touchend', function(e) {
|
||||
var point = e.changedTouches[0];
|
||||
var el = document.elementFromPoint(point.clientX, point.clientY);
|
||||
var target = findAncestorWithAttr(el, 'data-annotation-id') || el;
|
||||
|
||||
console.log('Touch at element:', target.getAttribute('data-annotation-id') || target.className);
|
||||
|
||||
function dispatchMouseEvent(type) {
|
||||
var event = new MouseEvent(type, {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
clientX: point.clientX,
|
||||
clientY: point.clientY
|
||||
});
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
|
||||
dispatchMouseEvent('mouseover');
|
||||
dispatchMouseEvent('mouseenter');
|
||||
dispatchMouseEvent('mousemove');
|
||||
target.click();
|
||||
});
|
||||
})();
|
||||
""".trimIndent(), null
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Handle JS dialogs, popups, and log console messages
|
||||
// ✅ JS LOGS
|
||||
binding.webView.webChromeClient = object : WebChromeClient() {
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
override fun onCreateWindow(
|
||||
view: WebView?,
|
||||
isDialog: Boolean,
|
||||
isUserGesture: Boolean,
|
||||
resultMsg: Message?
|
||||
): Boolean {
|
||||
val popupWebView = WebView(this@WebViewActivity)
|
||||
popupWebView.settings.javaScriptEnabled = true
|
||||
popupWebView.settings.domStorageEnabled = true
|
||||
|
||||
val dialog = Dialog(this@WebViewActivity)
|
||||
dialog.setContentView(popupWebView)
|
||||
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
dialog.show()
|
||||
|
||||
popupWebView.webViewClient = object : WebViewClient() {
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
}
|
||||
}
|
||||
|
||||
val transport = resultMsg?.obj as WebView.WebViewTransport
|
||||
transport.webView = popupWebView
|
||||
resultMsg.sendToTarget()
|
||||
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
|
||||
Log.e("JS_LOG", consoleMessage?.message() ?: "")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
binding.webView.loadUrl(url)
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private fun handleContent(type: String, url: String) {
|
||||
|
||||
when (type) {
|
||||
|
||||
"html-webview" -> {
|
||||
binding.webView.visibility = View.VISIBLE
|
||||
binding.imageView.visibility = View.GONE
|
||||
binding.videoView.visibility = View.GONE
|
||||
setupWebView(url)
|
||||
|
||||
}
|
||||
|
||||
"image" -> {
|
||||
binding.webView.visibility = View.GONE
|
||||
binding.imageView.visibility = View.VISIBLE
|
||||
binding.videoView.visibility = View.GONE
|
||||
|
||||
com.bumptech.glide.Glide.with(this)
|
||||
.load(url)
|
||||
.into(binding.imageView)
|
||||
}
|
||||
|
||||
"video" -> {
|
||||
binding.webView.visibility = View.GONE
|
||||
binding.imageView.visibility = View.GONE
|
||||
binding.videoView.visibility = View.VISIBLE
|
||||
|
||||
playVideo(url)
|
||||
}
|
||||
|
||||
"html-webbrowser" -> {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
finish()
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.webView.visibility = View.VISIBLE
|
||||
setupWebView(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun playVideo(url: String) {
|
||||
|
||||
val uri = Uri.parse(url)
|
||||
binding.videoView.setVideoURI(uri)
|
||||
|
||||
val controller = android.widget.MediaController(this)
|
||||
controller.setAnchorView(binding.videoView)
|
||||
|
||||
binding.videoView.setMediaController(controller)
|
||||
binding.videoView.start()
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private fun setupWebView(url: String) {
|
||||
|
||||
with(binding.webView.settings) {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
javaScriptCanOpenWindowsAutomatically = true
|
||||
setSupportMultipleWindows(true)
|
||||
loadWithOverviewMode = true
|
||||
useWideViewPort = true
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||
}
|
||||
|
||||
binding.webView.addJavascriptInterface(WebAppInterface(), "Android")
|
||||
|
||||
binding.webView.webViewClient = object : WebViewClient() {
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: android.graphics.Bitmap?) {
|
||||
injectJS(view)
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
injectJS(view)
|
||||
}
|
||||
}
|
||||
|
||||
binding.webView.webChromeClient = object : WebChromeClient() {
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
|
||||
Log.e("JS_LOG", consoleMessage?.message() ?: "")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Load URL
|
||||
binding.webView.loadUrl(url)
|
||||
}
|
||||
|
||||
// 🔥 JS INJECTION (RN BRIDGE + FIXES)
|
||||
private fun injectJS(view: WebView?) {
|
||||
|
||||
}
|
||||
view?.evaluateJavascript(
|
||||
"""
|
||||
(function() {
|
||||
|
||||
console.log("🔥 JS INJECTED");
|
||||
|
||||
// ✅ imageToBase64 FIX
|
||||
window.imageToBase64 = function(img) {
|
||||
try {
|
||||
if (!img) return null;
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = img.naturalWidth || img.width;
|
||||
canvas.height = img.naturalHeight || img.height;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
|
||||
return canvas.toDataURL('image/png');
|
||||
|
||||
} catch(e) {
|
||||
console.log("imageToBase64 error:", e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ React Native bridge
|
||||
window.ReactNativeWebView = {
|
||||
postMessage: function(data) {
|
||||
console.log("POST MESSAGE:", data);
|
||||
Android.postMessage(data);
|
||||
}
|
||||
};
|
||||
|
||||
// ✅ Share function
|
||||
window.nativeShare = function(options) {
|
||||
console.log("CALL nativeShare:", options);
|
||||
|
||||
if (!options) return;
|
||||
|
||||
window.ReactNativeWebView.postMessage(JSON.stringify({
|
||||
type: 'SHARE',
|
||||
data: options
|
||||
}));
|
||||
};
|
||||
|
||||
// 🔍 Debug click
|
||||
document.addEventListener('click', function(e) {
|
||||
console.log("CLICK:", e.target.innerText);
|
||||
}, true);
|
||||
|
||||
})();
|
||||
""".trimIndent(),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
// ✅ JS INTERFACE
|
||||
inner class WebAppInterface {
|
||||
|
||||
@JavascriptInterface
|
||||
fun postMessage(message: String?) {
|
||||
Log.e("WEB_MESSAGE", "RAW: $message")
|
||||
|
||||
runOnUiThread {
|
||||
handleWebMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ HANDLE MESSAGE
|
||||
private fun handleWebMessage(message: String?) {
|
||||
try {
|
||||
val obj = JSONObject(message ?: return)
|
||||
val type = obj.optString("type")
|
||||
|
||||
if (type == "SHARE") {
|
||||
val data = obj.optJSONObject("data")
|
||||
handleShare(data)
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("WEB_MESSAGE", "Error: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ HANDLE SHARE
|
||||
private fun handleShare(data: JSONObject?) {
|
||||
|
||||
if (data == null) return
|
||||
|
||||
val type = data.optString("type")
|
||||
val message = data.optString("message")
|
||||
val url = data.optString("url")
|
||||
val image = data.optString("image")
|
||||
val imagesArray = data.optJSONArray("images")
|
||||
|
||||
Log.e("SHARE_DEBUG", "TYPE: $type")
|
||||
Log.e("SHARE_DEBUG", "MESSAGE: $message")
|
||||
Log.e("SHARE_DEBUG", "URL: $url")
|
||||
Log.e("SHARE_DEBUG", "IMAGE: ${image.take(50)}")
|
||||
|
||||
when (type) {
|
||||
|
||||
"text" -> shareText("$message\n$url")
|
||||
|
||||
"image" -> {
|
||||
if (image.isNotEmpty()) shareImageSmart(image)
|
||||
}
|
||||
|
||||
"multiple_images" -> {
|
||||
if (imagesArray != null) {
|
||||
val list = mutableListOf<String>()
|
||||
for (i in 0 until imagesArray.length()) {
|
||||
list.add(imagesArray.getString(i))
|
||||
}
|
||||
shareMultipleImages(list)
|
||||
}
|
||||
}
|
||||
|
||||
"image_with_text" -> {
|
||||
if (image.isNotEmpty()) {
|
||||
shareImageTextSmart(image, "$message\n$url")
|
||||
}
|
||||
}
|
||||
|
||||
else -> shareText(message)
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ TEXT SHARE
|
||||
private fun shareText(text: String) {
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "text/plain"
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text)
|
||||
startActivity(Intent.createChooser(intent, "Share via"))
|
||||
}
|
||||
|
||||
// ✅ SMART IMAGE SHARE (BASE64 + URL)
|
||||
private fun shareImageSmart(imageData: String) {
|
||||
|
||||
Log.e("SHARE_DEBUG", "Image Data: ${imageData.take(100)}")
|
||||
|
||||
try {
|
||||
if (imageData.startsWith("data:image")) {
|
||||
|
||||
val pure = imageData.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
val uri = Uri.parse(path)
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
|
||||
startActivity(Intent.createChooser(intent, "Share Image"))
|
||||
|
||||
} else {
|
||||
// URL → Glide
|
||||
com.bumptech.glide.Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(imageData)
|
||||
.into(object : com.bumptech.glide.request.target.CustomTarget<android.graphics.Bitmap>() {
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: android.graphics.Bitmap,
|
||||
transition: com.bumptech.glide.request.transition.Transition<in android.graphics.Bitmap>?
|
||||
) {
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(
|
||||
contentResolver, resource, "Image", null
|
||||
)
|
||||
|
||||
val uri = Uri.parse(path)
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
|
||||
startActivity(Intent.createChooser(intent, "Share Image"))
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: android.graphics.drawable.Drawable?) {}
|
||||
})
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("SHARE_DEBUG", "Error: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ IMAGE + TEXT
|
||||
private fun shareImageTextSmart(imageData: String, text: String) {
|
||||
|
||||
if (imageData.startsWith("data:image")) {
|
||||
|
||||
val pure = imageData.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
val uri = Uri.parse(path)
|
||||
val intent = Intent(Intent.ACTION_SEND)
|
||||
intent.type = "image/*"
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri)
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text)
|
||||
startActivity(Intent.createChooser(intent, "Share"))
|
||||
} else {
|
||||
shareText(text)
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ MULTIPLE IMAGES
|
||||
private fun shareMultipleImages(list: List<String>) {
|
||||
|
||||
val uris = ArrayList<Uri>()
|
||||
|
||||
for (base64 in list) {
|
||||
val pure = base64.substringAfter(",")
|
||||
val bytes = Base64.decode(pure, Base64.DEFAULT)
|
||||
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
|
||||
|
||||
val path = MediaStore.Images.Media.insertImage(contentResolver, bitmap, "Image", null)
|
||||
uris.add(Uri.parse(path))
|
||||
}
|
||||
|
||||
val intent = Intent(Intent.ACTION_SEND_MULTIPLE)
|
||||
intent.type = "image/*"
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
||||
|
||||
startActivity(Intent.createChooser(intent, "Share Images"))
|
||||
}
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (binding.webView.canGoBack()) {
|
||||
binding.webView.goBack()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.download;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -37,6 +39,7 @@ import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.utils.TLSSocketFactory;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.ADDITIONAL_DISPLAY_MASTERGetterSetter;
|
||||
@@ -167,7 +170,13 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||
|
||||
new UploadTask(DownloadActivity.this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(DownloadActivity.this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkTLSVersion() {
|
||||
@@ -1914,6 +1923,8 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
if (order_received_status_getterSetter.getSTORE_ID().size() > 0) {
|
||||
// if (masterStorelistPdaGetterSetter.getStoreId().size() > 0) {
|
||||
Log.d("mastetpdadata","download");
|
||||
data.value = 99;
|
||||
data.name = "Master_StoreList_PDA" + getResources().getString(R.string.download_data);
|
||||
} else {
|
||||
|
||||
+12
-18
@@ -11,8 +11,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -44,10 +42,6 @@ import retrofit.Callback;
|
||||
import retrofit.Response;
|
||||
import retrofit.Retrofit;
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class ServiceActivityFragment extends Fragment {
|
||||
String result = "";
|
||||
boolean isvalid = false;
|
||||
@@ -119,10 +113,10 @@ public class ServiceActivityFragment extends Fragment {
|
||||
public void onClick(View v) {
|
||||
Fragment nextFrag= mItem.getFragment();
|
||||
|
||||
if(position==0){
|
||||
showExportDialog();
|
||||
// restoreBackup();
|
||||
}
|
||||
if(position==0){
|
||||
showExportDialog();
|
||||
// restoreBackup();
|
||||
}
|
||||
/* else if(position==1){
|
||||
|
||||
File f = new File(CommonString.getImagesFolder(context));
|
||||
@@ -257,7 +251,7 @@ public class ServiceActivityFragment extends Fragment {
|
||||
String backupDBPath = "GSKMT_ORANGE_Database_backup" + "_"+username+"_"+ visit_date.replace("/", "") + "_" +
|
||||
CommonFunctions.getCurrentTimeWithLanguage(getActivity()).replace(":", "") ;
|
||||
|
||||
// String path = Environment.getExternalStorageDirectory().getPath()+ "/gsk_orange_backup";
|
||||
// String path = Environment.getExternalStorageDirectory().getPath()+ "/gsk_orange_backup";
|
||||
|
||||
String path = CommonString.getBackupFolder(context);
|
||||
File currentDB = new File(data, currentDBPath);
|
||||
@@ -277,14 +271,14 @@ public class ServiceActivityFragment extends Fragment {
|
||||
}
|
||||
|
||||
//usk
|
||||
// File dir = new File(CommonString.BACKUP_PATH);
|
||||
// File dir = new File(CommonString.BACKUP_PATH);
|
||||
File dir = new File(CommonString.getBackupFolder(context));
|
||||
ArrayList<String> list = new ArrayList();
|
||||
list = getFileNames(dir.listFiles());
|
||||
if (list.size() > 0) {
|
||||
for (int i1 = 0; i1 < list.size(); i1++) {
|
||||
if (list.get(i1).contains("GSKMT_ORANGE_Database_backup")) {
|
||||
// File originalFile = new File(CommonString.BACKUP_PATH + list.get(i1));
|
||||
// File originalFile = new File(CommonString.BACKUP_PATH + list.get(i1));
|
||||
Object result = uploadBackup(getActivity(), list.get(i1), "DBBackup");
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.databasexported), Toast.LENGTH_SHORT).show();
|
||||
@@ -296,9 +290,9 @@ public class ServiceActivityFragment extends Fragment {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.logException(new Exception(e.getCause()));
|
||||
// Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||
// Crashlytics.logException(e.getCause());
|
||||
// Crashlytics.logException(new Exception(e.getCause()));
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -357,8 +351,8 @@ public class ServiceActivityFragment extends Fragment {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
|
||||
// Crashlytics.logException(t);
|
||||
// Crashlytics.logException(new Exception(t.getCause()));
|
||||
// Crashlytics.logException(t);
|
||||
// Crashlytics.logException(new Exception(t.getCause()));
|
||||
|
||||
isvalid = true;
|
||||
if (t instanceof UnknownHostException) {
|
||||
|
||||
+24
-5
@@ -71,6 +71,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||
Log.d("countrydata",country_id);
|
||||
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||
pog_type_id = preferences.getString(CommonString.KEY_POG_TYPE_ID, "");
|
||||
preferences.getString(CommonString.KEY_VISIT_ID, "");
|
||||
@@ -106,14 +107,11 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
int imageRes = getImageRes(flag_filled, category_id);
|
||||
categoryList.get(i).setCategory_img(imageRes);
|
||||
}
|
||||
|
||||
adapter = new CategoryListAdapter(this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private int getImageRes(boolean flag_filled, String category_id) {
|
||||
@@ -388,7 +386,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
} else {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||
}
|
||||
if (isMappingPromotion_Flag) {
|
||||
if (isMappingPromotion_Flag ) {
|
||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
@@ -540,7 +538,6 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
|
||||
private boolean isCategoryComplete(String category_id) {
|
||||
boolean flag_filled = true;
|
||||
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_ADDITIONAL)) {
|
||||
flag_filled = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id,
|
||||
CommonString.TABLE_MAPPING_STOCK_ADDITIONAL)
|
||||
@@ -598,6 +595,25 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (country_id.equals("7")) {
|
||||
if (db.getPromoComplianceSkuwiseExistsAfterData(store_id, category_id).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
boolean isMappingPromotion_Flag;
|
||||
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||
} else {
|
||||
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||
}
|
||||
if (isMappingPromotion_Flag ) {
|
||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// POG Upload
|
||||
if (!db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).isEmpty()
|
||||
&& db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).isEmpty()) {
|
||||
@@ -614,11 +630,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Order Taking for country 15
|
||||
if (country_id.equals("15") && !db.checkOrder_taking_Data(store_id, category_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// IR-PD Image Check
|
||||
ArrayList<CategoryPictureGetterSetter> irList = isPdIRMapping(category_id);
|
||||
if (irList != null && !irList.isEmpty() && camera_allow.equals("1")) {
|
||||
|
||||
+2
-4
@@ -77,8 +77,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, store_flag_str;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
String str = CommonString.getImagesFolder(context),
|
||||
path = "", _pathforcheck = "", img = "";
|
||||
String str = "", path = "", _pathforcheck = "", img = "";
|
||||
int child_position = -1;
|
||||
Uri outputFileUri;
|
||||
String gallery_package = "";
|
||||
@@ -100,6 +99,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
context = this;
|
||||
str = CommonString.getImagesFolder(context);
|
||||
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
|
||||
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
|
||||
view_promo_sku = findViewById(R.id.view_promo_sku);
|
||||
@@ -203,8 +203,6 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
cd.setImage_promotion("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
cd.setIn_stock("-1");
|
||||
img_addPromotion.setClickable(false);
|
||||
|
||||
@@ -2,6 +2,8 @@ package cpm.com.gskmtorange.password;
|
||||
|
||||
import static com.google.android.gms.location.LocationRequest.Builder.IMPLICIT_MIN_UPDATE_INTERVAL;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -61,7 +63,6 @@ import com.google.gson.reflect.TypeToken;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
import org.ksoap2.transport.HttpTransportSE;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
@@ -86,6 +87,8 @@ import cpm.com.gskmtorange.blurlockview.Password;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.constant.CommonUtils;
|
||||
import cpm.com.gskmtorange.dailyentry.CheckoutActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
|
||||
@@ -108,9 +111,9 @@ public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPa
|
||||
private static final int MY_PERMISSIONS_REQUEST_LOCATION = 11;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_READ = 12;
|
||||
private static final int MY_PERMISSIONS_REQUEST_STORAGE_WRITE = 14;
|
||||
|
||||
private static final int PERMISSION_ALL = 99;
|
||||
|
||||
|
||||
GoogleApiClient mGoogleApiClient;
|
||||
private static int UPDATE_INTERVAL = 200; // 5 sec
|
||||
private static int FATEST_INTERVAL = 100; // 1 sec
|
||||
@@ -342,7 +345,13 @@ public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPa
|
||||
userId = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||
password = preferences.getString(CommonString.KEY_PASSWORD, "");
|
||||
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(this, "Correct", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -480,7 +489,7 @@ public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPa
|
||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
OkHttpTransportSE androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN, envelope);
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
@@ -519,7 +528,7 @@ public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPa
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport = new OkHttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
result = envelope.getResponse();
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
@@ -565,7 +574,12 @@ public class MPinActivity extends AppCompatActivity implements BlurLockView.OnPa
|
||||
runOnUiThread(() -> {
|
||||
// TODO Auto-generated method stub
|
||||
if (counter < 3) {
|
||||
new AuthenticateTask().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new AuthenticateTask().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
showAlert(getString(R.string.nonetwork));
|
||||
counter = 1;
|
||||
|
||||
@@ -7,11 +7,8 @@ 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);
|
||||
Call<String> getUploadImage(@Body RequestBody reqestBody);
|
||||
}
|
||||
|
||||
+16
-25
@@ -1,22 +1,13 @@
|
||||
package cpm.com.gskmtorange.retrofit;
|
||||
|
||||
|
||||
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
import com.squareup.okhttp.ResponseBody;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import retrofit.Converter;
|
||||
|
||||
|
||||
/**
|
||||
* Created by jeevanp on 19-05-2017.
|
||||
*/
|
||||
|
||||
public class StringConverterFactory implements Converter.Factory {
|
||||
public StringConverterFactory() {
|
||||
}
|
||||
@@ -31,24 +22,24 @@ public class StringConverterFactory implements Converter.Factory {
|
||||
}
|
||||
|
||||
class StringConverter implements Converter<String> {
|
||||
private static final MediaType PLAIN_TEXT = MediaType.parse("text/plain; charset=UTF-8");
|
||||
private static final MediaType PLAIN_TEXT = MediaType.parse("text/plain; charset=UTF-8");
|
||||
|
||||
@Override
|
||||
public String fromBody(ResponseBody body) throws IOException {
|
||||
return new String(body.bytes());
|
||||
}
|
||||
@Override
|
||||
public String fromBody(ResponseBody body) throws IOException {
|
||||
return new String(body.bytes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestBody toBody(String value) {
|
||||
return RequestBody.create(PLAIN_TEXT, convertToBytes(value));
|
||||
}
|
||||
@Override
|
||||
public RequestBody toBody(String value) {
|
||||
return RequestBody.create(PLAIN_TEXT, convertToBytes(value));
|
||||
}
|
||||
|
||||
private static byte[] convertToBytes(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
private static byte[] convertToBytes(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-1
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -14,6 +16,8 @@ import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
@@ -43,6 +47,7 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.password.MPinActivity;
|
||||
import cpm.com.gskmtorange.utils.OkHttpTransportSE;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CompetitonPromoGetterSetter;
|
||||
@@ -117,7 +122,13 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
Path = CommonString.getImagesFolder(context);
|
||||
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
//start upload
|
||||
new UploadTask(this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String UploadImage(String path, String folder_name) throws Exception {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -11,6 +13,7 @@ import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@@ -30,6 +33,7 @@ import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoachingVisitGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.LoginActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
@@ -112,7 +116,13 @@ public class UploadActivity extends AppCompatActivity {
|
||||
Path = CommonString.getImagesFolder(context);
|
||||
|
||||
//start upload
|
||||
new UploadTask(this).execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new UploadTask(this).execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Data {
|
||||
@@ -140,7 +150,6 @@ public class UploadActivity extends AppCompatActivity {
|
||||
percentage = (TextView) dialog.findViewById(R.id.percentage);
|
||||
message = (TextView) dialog.findViewById(R.id.message);
|
||||
((TextView) dialog.findViewById(R.id.tv_title)).setText(getString(R.string.uploaddata));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1500,14 +1509,14 @@ public class UploadActivity extends AppCompatActivity {
|
||||
ArrayList<CategoryPictureGetterSetter> irdata = db.getIrPDforUpload(coverageList.get(i).getStoreId(), coverageList.get(i).getVisitDate());
|
||||
if (irdata != null && !irdata.isEmpty()) {
|
||||
for (int j = 0; j < irdata.size(); j++) {
|
||||
onXML = "[IR_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + irdata.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + irdata.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + irdata.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_IMAGES]" + irdata.get(j).getSubCategoryCamera2() + "[/IR_IMAGES]" + "[/IR_DATA]";
|
||||
onXML = "[IR_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CAM_ALLOW]" +irdata.get(j).getToggle_value() + "[/CAM_ALLOW]"+ "[CATEGORY_ID]" + irdata.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + irdata.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + irdata.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_IMAGES]" + irdata.get(j).getSubCategoryCamera2() + "[/IR_IMAGES]" + "[/IR_DATA]";
|
||||
irPD_xmlData = irPD_xmlData + onXML;
|
||||
}
|
||||
final String irpd_xml = "[DATA]" + irPD_xmlData + "[/DATA]";
|
||||
Log.e("irp_xml_data", irpd_xml);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", irpd_xml);
|
||||
request.addProperty("KEYS", "IR_DATA_XML");
|
||||
request.addProperty("KEYS", "IR_DATA_NEW_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
@@ -1528,14 +1537,14 @@ public class UploadActivity extends AppCompatActivity {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visi_data = db.getIrPDVisibilityforUpload(coverageList.get(i).getStoreId(), coverageList.get(i).getVisitDate());
|
||||
if (ir_visi_data != null && !ir_visi_data.isEmpty()) {
|
||||
for (int j = 0; j < ir_visi_data.size(); j++) {
|
||||
onXML = "[IR_VISIBILITY_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + ir_visi_data.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + ir_visi_data.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + ir_visi_data.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_VISIBILITY_IMAGES]" + ir_visi_data.get(j).getSubCategoryCamera2() + "[/IR_VISIBILITY_IMAGES]" + "[/IR_VISIBILITY_DATA]";
|
||||
onXML = "[IR_VISIBILITY_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CAM_ALLOW]" +ir_visi_data.get(j).getToggle_value() + "[/CAM_ALLOW]" + "[CATEGORY_ID]" + ir_visi_data.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + ir_visi_data.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + ir_visi_data.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_VISIBILITY_IMAGES]" + ir_visi_data.get(j).getSubCategoryCamera2() + "[/IR_VISIBILITY_IMAGES]" + "[/IR_VISIBILITY_DATA]";
|
||||
irPD_visi_xmlData = irPD_visi_xmlData + onXML;
|
||||
}
|
||||
final String irpd_xml = "[DATA]" + irPD_visi_xmlData + "[/DATA]";
|
||||
Log.e("irpd_visi_xml_data", irPD_visi_xmlData);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", irpd_xml);
|
||||
request.addProperty("KEYS", "IRPD_VISIBILITY_DATA_XML");
|
||||
request.addProperty("KEYS", "IRPD_VISIBILITY_DATA_NEW_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import static cpm.com.gskmtorange.constant.CommonFunctions.isInternetAvailable;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -12,18 +14,13 @@ import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
//import com.crashlytics.android.Crashlytics;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.squareup.okhttp.ConnectionSpec;
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.MultipartBuilder;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import com.squareup.okhttp.Protocol;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
import com.squareup.okhttp.TlsVersion;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
@@ -48,6 +45,7 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.MainActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.retrofit.PostApiForFile;
|
||||
import cpm.com.gskmtorange.retrofit.StringConverterFactory;
|
||||
import retrofit.Retrofit;
|
||||
@@ -197,7 +195,12 @@ public class UploadImageWithRetrofit {
|
||||
} else {
|
||||
if (totalFiles == uploadedFiles) {
|
||||
//region Coverage upload status Data
|
||||
new StatusUpload().execute();
|
||||
if(isInternetAvailable(context)){
|
||||
new StatusUpload().execute();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(context, "No internet connection. Please try again", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (JsonSyntaxException e) {
|
||||
@@ -285,10 +288,8 @@ public class UploadImageWithRetrofit {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
pd.dismiss();
|
||||
if (totalFiles == uploadedFiles) {
|
||||
//region Coverage upload status Data
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
|
||||
<solid android:color="@color/green"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
|
||||
<solid android:color="#BDBDBD"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,4 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dot_active" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/dot_inactive"/>
|
||||
</selector>
|
||||
@@ -16,7 +16,9 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/grey_background"
|
||||
android:background="@color/white"
|
||||
android:elevation="8dp"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
|
||||
|
||||
<include
|
||||
layout="@layout/app_bar_main"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,4 +1,65 @@
|
||||
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<!--<WebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"/>-->
|
||||
|
||||
<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"
|
||||
android:id="@+id/coordinate"
|
||||
tools:context="cpm.com.gskmtorange.MainActivity">
|
||||
|
||||
<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="@color/white"
|
||||
android:elevation="8dp"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="55dp">
|
||||
|
||||
<!-- WebView -->
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/custom_margin"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<!-- Image -->
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/custom_margin"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<!-- Video -->
|
||||
<VideoView
|
||||
android:id="@+id/videoView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/custom_margin"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
@@ -26,5 +27,4 @@
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
@@ -59,10 +59,10 @@
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="5" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5dp"
|
||||
card_view:cardCornerRadius="12dp"
|
||||
card_view:cardElevation="0dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bannerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/grey_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/activity_horizontal_margin"
|
||||
@@ -12,6 +13,44 @@
|
||||
tools:context="cpm.com.gskmtorange.dailyentry.PDimageActivity"
|
||||
tools:showIn="@layout/activity_pdimage">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/grey_background"
|
||||
card_view:cardCornerRadius="5dp"
|
||||
android:elevation="5dp"
|
||||
android:layout_margin="5dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/iscamallowed" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/btntoggle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight=".5"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewSubCat"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<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"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/grey_background"
|
||||
@@ -12,6 +13,44 @@
|
||||
tools:context="cpm.com.gskmtorange.dailyentry.PDVisibilityActivity"
|
||||
tools:showIn="@layout/activity_pdvisibility">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/grey_background"
|
||||
card_view:cardCornerRadius="5dp"
|
||||
android:elevation="5dp"
|
||||
android:layout_margin="5dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/iscamallowed" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/btntoggle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight=".5"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewSubCat"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -23,29 +23,33 @@
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
card_view:cardBackgroundColor="@color/white"
|
||||
card_view:cardCornerRadius="5dp" >
|
||||
card_view:cardCornerRadius="12dp" >
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- <ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
<!-- ViewPager + Dots -->
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
android:layout_marginTop="40dp"
|
||||
android:src="@drawable/chings"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@drawable/baking_chocolates" />-->
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"/>
|
||||
<!-- ✅ Custom Dots -->
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/dotsLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="10dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_main"
|
||||
@@ -53,17 +57,19 @@
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/gsklogo"
|
||||
android:layout_centerInParent="true"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"></WebView>
|
||||
android:layout_margin="@dimen/custom_margin"
|
||||
android:visibility="gone">
|
||||
</WebView>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -236,4 +236,5 @@
|
||||
<string name="competition_promotion">تعليق</string>
|
||||
<string name="exists">التواجد</string>
|
||||
<string name="view_report_pd">عرض التقرير</string>
|
||||
<string name="iscamallowed">هل يسمح بالتصوير داخل الصيدلية/المتجر ؟</string>
|
||||
</resources>
|
||||
|
||||
@@ -363,5 +363,6 @@
|
||||
<string name="order_status_polist">حالة الطلب- قائمة طالبات الشراء</string>
|
||||
<string name="order_status_entry">حالة الطلب-الادخال</string>
|
||||
<string name="po_qty">كمية طلب الشراء </string>
|
||||
<string name="iscamallowed">هل يسمح بالتصوير داخل الصيدلية/المتجر ؟</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -119,6 +119,7 @@
|
||||
<!--Gagan end new code 1-->
|
||||
|
||||
<string name="AdditionalDisplay">Is there any Additional Display</string>
|
||||
<string name="iscamallowed">Is the Camera Allowed in store?</string>
|
||||
<string name="Display">Display</string>
|
||||
<string name="Photo">Photo</string>
|
||||
<string name="title_activity_Additional_visibility">Additional Visibility</string>
|
||||
|
||||
Reference in New Issue
Block a user