Merge branch 'master' of https://github.com/CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/GSKORANGEV1 into GG_Update_Manifest
# Conflicts: # GSKMTOrange/src/main/AndroidManifest.xml
This commit is contained in:
Generated
+1
-1
@@ -41,7 +41,7 @@
|
|||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -60,10 +60,13 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".dailyentry.StoreimageActivity"
|
android:name=".dailyentry.StoreimageActivity"
|
||||||
android:label="@string/title_activity_store_list_geotag"
|
android:label="@string/title_activity_store_list_geotag"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".GeoTag.GeoTagActivity"
|
android:name=".GeoTag.GeoTagActivity"
|
||||||
android:label="@string/title_activity_store_geotag"
|
android:label="@string/title_activity_store_geotag"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
@@ -110,7 +113,6 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gsk_dailyentry.PromoComplianceActivity"
|
android:name=".gsk_dailyentry.PromoComplianceActivity"
|
||||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
@@ -120,13 +122,15 @@
|
|||||||
|
|
||||||
<!-- Gagan End Declaration -->
|
<!-- Gagan End Declaration -->
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".dailyentry.NonWorkingReason"
|
android:name=".dailyentry.NonWorkingReason"
|
||||||
android:label="@string/title_activity_t2_pcompliance"
|
android:label="@string/title_activity_t2_pcompliance"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar"/>
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name=".upload.UploadActivity"
|
||||||
|
android:label="@string/title_activity_upload"
|
||||||
|
/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1645,6 +1645,100 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get specific store data
|
||||||
|
public StoreBean getSpecificStoreData(String date, String store_id) {
|
||||||
|
//ArrayList<StoreBean> list = new ArrayList<StoreBean>();
|
||||||
|
StoreBean sb = new StoreBean();
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
|
||||||
|
"where VISIT_DATE ='" + date + "' AND STORE_ID'="+ store_id +"'", null);
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
dbcursor.moveToFirst();
|
||||||
|
while (!dbcursor.isAfterLast()) {
|
||||||
|
|
||||||
|
sb.setSTORE_ID(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("STORE_ID")));
|
||||||
|
|
||||||
|
sb.setEMP_ID((dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("EMP_ID"))));
|
||||||
|
|
||||||
|
sb.setKEYACCOUNT(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("KEYACCOUNT")));
|
||||||
|
|
||||||
|
sb.setSTORE_NAME(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("STORE_NAME")));
|
||||||
|
|
||||||
|
sb.setADDRESS((dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("ADDRESS"))));
|
||||||
|
sb.setCITY(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("CITY")));
|
||||||
|
|
||||||
|
sb.setSTORETYPE(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("STORETYPE")));
|
||||||
|
|
||||||
|
sb.setCLASSIFICATION(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("CLASSIFICATION")));
|
||||||
|
|
||||||
|
sb.setKEYACCOUNT_ID(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("KEYACCOUNT_ID")));
|
||||||
|
|
||||||
|
sb.setSTORETYPE_ID(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("STORETYPE_ID")));
|
||||||
|
|
||||||
|
sb.setCLASS_ID(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("CLASS_ID")));
|
||||||
|
|
||||||
|
sb.setVISIT_DATE(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("VISIT_DATE")));
|
||||||
|
|
||||||
|
sb.setCAMERA_ALLOW(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("CAMERA_ALLOW")));
|
||||||
|
|
||||||
|
sb.setUPLOAD_STATUS(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("UPLOAD_STATUS")));
|
||||||
|
sb.setCHECKOUT_STATUS(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("CHECKOUT_STATUS")));
|
||||||
|
|
||||||
|
sb.setGEO_TAG(dbcursor.getString(dbcursor
|
||||||
|
.getColumnIndexOrThrow("GEO_TAG")));
|
||||||
|
|
||||||
|
//dbcursor.moveToNext();
|
||||||
|
}
|
||||||
|
dbcursor.close();
|
||||||
|
return sb;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception get JCP!", e.toString());
|
||||||
|
return sb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb;
|
||||||
|
}
|
||||||
|
|
||||||
|
//update coverage status
|
||||||
|
|
||||||
|
public void updateCoverageStatus(String id, String status) {
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
values.put(CommonString.KEY_COVERAGE_STATUS, status);
|
||||||
|
|
||||||
|
db.update(CommonString.TABLE_COVERAGE_DATA, values, CommonString.KEY_STORE_ID + "='" + id + "'", null);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
Log.d("Excep update checkout", e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Gagan start new code 1
|
//Gagan start new code 1
|
||||||
|
|
||||||
@@ -1708,4 +1802,5 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
//Gagan end new code 1
|
//Gagan end new code 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package cpm.com.gskmtorange;
|
package cpm.com.gskmtorange;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
@@ -33,11 +36,13 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
||||||
|
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||||
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
||||||
|
import cpm.com.gskmtorange.upload.UploadActivity;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends AppCompatActivity
|
||||||
implements NavigationView.OnNavigationItemSelectedListener {
|
implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
@@ -50,6 +55,11 @@ public class MainActivity extends AppCompatActivity
|
|||||||
String user_name, user_type;
|
String user_name, user_type;
|
||||||
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
|
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
|
||||||
View headerView;
|
View headerView;
|
||||||
|
|
||||||
|
ArrayList<CoverageBean> coverageList;
|
||||||
|
|
||||||
|
String error_msg;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -69,6 +79,8 @@ public class MainActivity extends AppCompatActivity
|
|||||||
db = new GSKOrangeDB(MainActivity.this);
|
db = new GSKOrangeDB(MainActivity.this);
|
||||||
db.open();
|
db.open();
|
||||||
|
|
||||||
|
coverageList = db.getCoverageData(date);
|
||||||
|
|
||||||
webView.setWebViewClient(new MyWebViewClient());
|
webView.setWebViewClient(new MyWebViewClient());
|
||||||
|
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
@@ -162,22 +174,73 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
} else if (id == R.id.nav_upload) {
|
} else if (id == R.id.nav_upload) {
|
||||||
|
|
||||||
|
db.open();
|
||||||
|
|
||||||
|
if (checkNetIsAvailable()) {
|
||||||
|
|
||||||
|
storelist = db.getStoreData(date);
|
||||||
|
|
||||||
|
if (storelist.size() == 0) {
|
||||||
|
|
||||||
|
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
|
||||||
|
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (coverageList.size() == 0) {
|
||||||
|
|
||||||
|
Snackbar.make(webView, R.string.no_data_for_upload, Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (isStoreCheckedIn()&& isValid()) {
|
||||||
|
|
||||||
|
Intent i = new Intent(getBaseContext(),
|
||||||
|
UploadActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Snackbar.make(webView, error_msg, Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
}
|
}
|
||||||
else if (id == R.id.nav_geotag) {
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
intent = new Intent(getBaseContext(),
|
||||||
|
UploadOptionActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
MainMenuActivity.this.finish();*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Snackbar.make(webView, "No Network Available", Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
|
||||||
|
// Toast.makeText(getApplicationContext(), "No Network Available", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
} else if (id == R.id.nav_geotag) {
|
||||||
|
|
||||||
|
|
||||||
storelist = db.getStoreData(date);
|
storelist = db.getStoreData(date);
|
||||||
|
|
||||||
|
|
||||||
if(storelist.size()>0)
|
if (storelist.size() > 0) {
|
||||||
{
|
Intent startDownload = new Intent(this, GeoTagStoreList.class);
|
||||||
Intent startDownload = new Intent(this,GeoTagStoreList.class);
|
|
||||||
startActivity(startDownload);
|
startActivity(startDownload);
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Snackbar.make(headerView, R.string.title_store_list_download_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
Snackbar.make(headerView, R.string.title_store_list_download_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,4 +347,56 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkNetIsAvailable() {
|
||||||
|
ConnectivityManager cm =
|
||||||
|
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
|
||||||
|
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||||
|
boolean isConnected = activeNetwork != null &&
|
||||||
|
activeNetwork.isConnectedOrConnecting();
|
||||||
|
return isConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStoreCheckedIn() {
|
||||||
|
|
||||||
|
boolean result_flag = true;
|
||||||
|
for (int i = 0; i < coverageList.size(); i++) {
|
||||||
|
|
||||||
|
String status = coverageList.get(i).getStatus();
|
||||||
|
if (status.equals(CommonString.KEY_INVALID) || status.equals(CommonString.KEY_VALID)) {
|
||||||
|
result_flag = false;
|
||||||
|
error_msg = getResources().getString(R.string.title_store_list_checkout_current);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid(){
|
||||||
|
boolean flag = false;
|
||||||
|
String storestatus;
|
||||||
|
for (int i = 0; i < coverageList.size(); i++) {
|
||||||
|
|
||||||
|
storestatus = db.getSpecificStoreData(date, coverageList.get(i).getStoreId()).getUPLOAD_STATUS();
|
||||||
|
|
||||||
|
if (!storestatus.equalsIgnoreCase(CommonString.KEY_U)) {
|
||||||
|
if ((storestatus.equalsIgnoreCase(
|
||||||
|
CommonString.KEY_C)
|
||||||
|
|| storestatus.equalsIgnoreCase(CommonString.KEY_P) ||
|
||||||
|
storestatus.equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE))) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!flag)
|
||||||
|
error_msg = getResources().getString(R.string.no_data_for_upload);
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,15 @@ public class CommonString {
|
|||||||
public static final String SOAP_ACTION_DR_STORE_IMAGES_GEO = "http://tempuri.org/"
|
public static final String SOAP_ACTION_DR_STORE_IMAGES_GEO = "http://tempuri.org/"
|
||||||
+ METHOD_Get_DR_STORE_IMAGES_GEO;
|
+ METHOD_Get_DR_STORE_IMAGES_GEO;
|
||||||
|
|
||||||
|
public static final String METHOD_UPLOAD_COVERAGE = "UPLOAD_COVERAGE";
|
||||||
|
|
||||||
|
public static final String METHOD_UPLOAD_COVERAGE_STATUS = "UploadCoverage_Status";
|
||||||
|
|
||||||
|
public static final String SOAP_ACTION = "http://tempuri.org/";
|
||||||
|
|
||||||
|
public static final String SOAP_ACTION_UPLOAD_STORE_COVERAGE = "http://tempuri.org/"
|
||||||
|
+ METHOD_UPLOAD_COVERAGE;
|
||||||
|
|
||||||
//Alert Messages
|
//Alert Messages
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,8 +173,6 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||||
|
|
||||||
String status = "INVALID";
|
|
||||||
|
|
||||||
CoverageBean cdata = new CoverageBean();
|
CoverageBean cdata = new CoverageBean();
|
||||||
cdata.setStoreId(store_id);
|
cdata.setStoreId(store_id);
|
||||||
cdata.setVisitDate(visit_date);
|
cdata.setVisitDate(visit_date);
|
||||||
@@ -186,11 +184,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
cdata.setLongitude(lon);
|
cdata.setLongitude(lon);
|
||||||
cdata.setImage(img_str);
|
cdata.setImage(img_str);
|
||||||
cdata.setRemark("");
|
cdata.setRemark("");
|
||||||
cdata.setStatus(CommonString.KEY_CHECK_IN);
|
cdata.setStatus(CommonString.KEY_INVALID);
|
||||||
|
|
||||||
database.InsertCoverageData(cdata);
|
database.InsertCoverageData(cdata);
|
||||||
|
|
||||||
database.updateCheckoutStatus(store_id, status);
|
database.updateCheckoutStatus(store_id, CommonString.KEY_INVALID);
|
||||||
|
|
||||||
/* SharedPreferences.Editor editor = preferences.edit();
|
/* SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,297 @@
|
|||||||
|
package cpm.com.gskmtorange.upload;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.ksoap2.SoapEnvelope;
|
||||||
|
import org.ksoap2.serialization.SoapObject;
|
||||||
|
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||||
|
import org.ksoap2.transport.HttpTransportSE;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
|
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||||
|
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
|
||||||
|
public class UploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private Dialog dialog;
|
||||||
|
private ProgressBar pb;
|
||||||
|
private TextView percentage, message;
|
||||||
|
GSKOrangeDB db;
|
||||||
|
ArrayList<CoverageBean> coverageList;
|
||||||
|
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
String date, userId, app_version;
|
||||||
|
|
||||||
|
StoreBean storeData;
|
||||||
|
String datacheck = "";
|
||||||
|
String[] words;
|
||||||
|
String validity;
|
||||||
|
int mid;
|
||||||
|
private int factor, k=0;
|
||||||
|
|
||||||
|
Data data;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_upload);
|
||||||
|
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||||
|
userId = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||||
|
app_version = preferences.getString(CommonString.KEY_VERSION, null);
|
||||||
|
|
||||||
|
db = new GSKOrangeDB(getApplicationContext());
|
||||||
|
|
||||||
|
//start upload
|
||||||
|
new UploadTask(getApplicationContext()).execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
int value;
|
||||||
|
String name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UploadTask extends AsyncTask<Void, Data, String> {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
UploadTask(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
|
||||||
|
dialog = new Dialog(context);
|
||||||
|
dialog.setContentView(R.layout.custom);
|
||||||
|
dialog.setTitle("Uploading Data");
|
||||||
|
dialog.setCancelable(false);
|
||||||
|
dialog.show();
|
||||||
|
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
|
||||||
|
percentage = (TextView) dialog.findViewById(R.id.percentage);
|
||||||
|
message = (TextView) dialog.findViewById(R.id.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onProgressUpdate(Data... values) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
pb.setProgress(values[0].value);
|
||||||
|
percentage.setText(values[0].value + "%");
|
||||||
|
message.setText(values[0].name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(Void... params) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
data = new Data();
|
||||||
|
|
||||||
|
coverageList = db.getCoverageData(date);
|
||||||
|
|
||||||
|
if (coverageList.size() > 0) {
|
||||||
|
|
||||||
|
if (coverageList.size() == 1) {
|
||||||
|
factor = 50;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
factor = 100 / (coverageList.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < coverageList.size(); i++) {
|
||||||
|
|
||||||
|
storeData = db.getSpecificStoreData(date, coverageList.get(i).getStoreId());
|
||||||
|
if (storeData.getSTORE_ID() != null) {
|
||||||
|
|
||||||
|
if (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_C) || storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) ||
|
||||||
|
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U)) {
|
||||||
|
|
||||||
|
String camera_allow = storeData.getCAMERA_ALLOW();
|
||||||
|
|
||||||
|
String onXML = "[DATA][USER_DATA][STORE_CD]"
|
||||||
|
+ coverageList.get(i).getStoreId()
|
||||||
|
+ "[/STORE_CD]" + "[VISIT_DATE]"
|
||||||
|
+ coverageList.get(i).getVisitDate()
|
||||||
|
+ "[/VISIT_DATE][LATITUDE]"
|
||||||
|
+ coverageList.get(i).getLatitude()
|
||||||
|
+ "[/LATITUDE][APP_VERSION]"
|
||||||
|
+ app_version
|
||||||
|
+ "[/APP_VERSION][LONGITUDE]"
|
||||||
|
+ coverageList.get(i).getLongitude()
|
||||||
|
+ "[/LONGITUDE][IN_TIME]"
|
||||||
|
+ coverageList.get(i).getInTime()
|
||||||
|
+ "[/IN_TIME][OUT_TIME]"
|
||||||
|
+ coverageList.get(i).getOutTime()
|
||||||
|
+ "[/OUT_TIME][UPLOAD_STATUS]"
|
||||||
|
+ "N"
|
||||||
|
+ "[/UPLOAD_STATUS][USER_ID]" + userId
|
||||||
|
+ "[/USER_ID][IMAGE_URL]" + coverageList.get(i).getImage()
|
||||||
|
+ "[/IMAGE_URL][REASON_ID]"
|
||||||
|
+ coverageList.get(i).getReasonid()
|
||||||
|
+ "[/REASON_ID][REASON_REMARK]"
|
||||||
|
+ coverageList.get(i).getRemark()
|
||||||
|
+ "[/REASON_REMARK][CAMERA_ALLOWED]"
|
||||||
|
+ camera_allow
|
||||||
|
+ "[/CAMERA_ALLOWED][/USER_DATA][/DATA]";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SoapObject request = new SoapObject(
|
||||||
|
CommonString.NAMESPACE,
|
||||||
|
CommonString.METHOD_UPLOAD_COVERAGE);
|
||||||
|
request.addProperty("onXML", onXML);
|
||||||
|
|
||||||
|
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
|
||||||
|
SoapEnvelope.VER11);
|
||||||
|
envelope.dotNet = true;
|
||||||
|
envelope.setOutputSoapObject(request);
|
||||||
|
|
||||||
|
HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||||
|
CommonString.URL);
|
||||||
|
|
||||||
|
|
||||||
|
androidHttpTransport
|
||||||
|
.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE,
|
||||||
|
envelope);
|
||||||
|
|
||||||
|
Object result = (Object) envelope.getResponse();
|
||||||
|
|
||||||
|
|
||||||
|
datacheck = result.toString();
|
||||||
|
words = datacheck.split("\\;");
|
||||||
|
validity = (words[0]);
|
||||||
|
|
||||||
|
if (validity
|
||||||
|
.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
|
db.updateCoverageStatus(coverageList
|
||||||
|
.get(i).getStoreId(), CommonString.KEY_P);
|
||||||
|
|
||||||
|
db.updateStoreStatusOnLeave(
|
||||||
|
coverageList.get(i).getStoreId(),
|
||||||
|
date, CommonString.KEY_P);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return CommonString.METHOD_UPLOAD_COVERAGE;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mid = Integer.parseInt((words[1]));
|
||||||
|
|
||||||
|
k = k + factor;
|
||||||
|
data.value = k;
|
||||||
|
data.name = "Uploading";
|
||||||
|
|
||||||
|
publishProgress(data);
|
||||||
|
|
||||||
|
String final_xml = "";
|
||||||
|
// Add below------------------
|
||||||
|
|
||||||
|
|
||||||
|
// SET COVERAGE STATUS
|
||||||
|
|
||||||
|
final_xml = "";
|
||||||
|
String onXML = "";
|
||||||
|
onXML = "[COVERAGE_STATUS][STORE_ID]"
|
||||||
|
+ coverageList.get(i).getStoreId()
|
||||||
|
+ "[/STORE_ID]"
|
||||||
|
+ "[VISIT_DATE]"
|
||||||
|
+ coverageList.get(i).getVisitDate()
|
||||||
|
+ "[/VISIT_DATE]"
|
||||||
|
+ "[USER_ID]"
|
||||||
|
+ coverageList.get(i).getUserId()
|
||||||
|
+ "[/USER_ID]"
|
||||||
|
+ "[STATUS]"
|
||||||
|
+ CommonString.KEY_U
|
||||||
|
+ "[/STATUS]"
|
||||||
|
+ "[/COVERAGE_STATUS]";
|
||||||
|
|
||||||
|
final_xml = final_xml + onXML;
|
||||||
|
|
||||||
|
final String sos_xml = "[DATA]" + final_xml
|
||||||
|
+ "[/DATA]";
|
||||||
|
|
||||||
|
SoapObject request = new SoapObject(
|
||||||
|
CommonString.NAMESPACE,
|
||||||
|
CommonString.METHOD_UPLOAD_COVERAGE_STATUS);
|
||||||
|
request.addProperty("onXML", sos_xml);
|
||||||
|
|
||||||
|
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
|
||||||
|
SoapEnvelope.VER11);
|
||||||
|
envelope.dotNet = true;
|
||||||
|
envelope.setOutputSoapObject(request);
|
||||||
|
|
||||||
|
HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||||
|
CommonString.URL);
|
||||||
|
|
||||||
|
androidHttpTransport.call(
|
||||||
|
CommonString.SOAP_ACTION+CommonString.METHOD_UPLOAD_COVERAGE_STATUS,
|
||||||
|
envelope);
|
||||||
|
Object result = (Object) envelope.getResponse();
|
||||||
|
|
||||||
|
if (!result.toString().equalsIgnoreCase(
|
||||||
|
CommonString.KEY_SUCCESS)) {
|
||||||
|
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.toString().equalsIgnoreCase(
|
||||||
|
CommonString.KEY_NO_DATA)) {
|
||||||
|
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.toString().equalsIgnoreCase(
|
||||||
|
CommonString.KEY_FAILURE)) {
|
||||||
|
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
db.open();
|
||||||
|
|
||||||
|
db.updateCoverageStatus(coverageList.get(i)
|
||||||
|
.getStoreId(), CommonString.KEY_U);
|
||||||
|
db.updateStoreStatusOnLeave(coverageList.get(i)
|
||||||
|
.getStoreId(), coverageList.get(i)
|
||||||
|
.getVisitDate(), CommonString.KEY_U);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (XmlPullParserException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String result) {
|
||||||
|
super.onPostExecute(result);
|
||||||
|
|
||||||
|
if(result.equals("")){
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/activity_upload"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context="cpm.com.gskmtorange.upload.UploadActivity">
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -42,4 +42,9 @@
|
|||||||
|
|
||||||
<string name="title_activity_t2_pcompliance">Kalıcı Teşhir</string>
|
<string name="title_activity_t2_pcompliance">Kalıcı Teşhir</string>
|
||||||
|
|
||||||
|
<string name="yes">Evet</string>
|
||||||
|
<string name="no">Hayır</string>
|
||||||
|
|
||||||
|
<string name="title_activity_upload">Veri Paylaş</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -101,6 +101,12 @@
|
|||||||
<string name="title_store_list_download_data">Please Download Data First</string>
|
<string name="title_store_list_download_data">Please Download Data First</string>
|
||||||
<string name="enter_the_values">Enter the values</string>
|
<string name="enter_the_values">Enter the values</string>
|
||||||
|
|
||||||
|
<string name="yes">Yes</string>
|
||||||
|
<string name="no">No</string>
|
||||||
|
|
||||||
|
<string name="title_activity_upload">Upload Data</string>
|
||||||
|
<string name="no_data_for_upload">No Data For Upload</string>
|
||||||
|
<string name="first_checkout_store">First checkout of store</string>
|
||||||
|
|
||||||
<!--Gagan start new code 1-->
|
<!--Gagan start new code 1-->
|
||||||
<string name="title_activity_promo_compliance">Promotion Compliance</string>
|
<string name="title_activity_promo_compliance">Promotion Compliance</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user