Merge branch 'master' into NewVisibilityCode
@@ -35,59 +35,38 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".autoupdate.AutoUpdateActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".autoupdate.AutoUpdateActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SelectLanguageActivity"
|
||||
android:label="@string/title_activity_select_language"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity android:name=".download.DownloadActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
|
||||
android:name=".download.DownloadActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".GeoTag.GeoTagStoreList"
|
||||
android:label="@string/title_activity_store_list_geotag"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="portrait"/>
|
||||
<!-- android:label="@string/title_activity_category_wise_performance" -->
|
||||
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.DailyDataMenuActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="portrait"/>
|
||||
<!-- android:label="@string/title_activity_daily_main_menu" -->
|
||||
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="portrait"/>
|
||||
<!-- android:label="@string/title_activity_msl__availability" -->
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".dailyentry.StoreListActivity"
|
||||
android:label="@string/title_activity_store_list_geotag"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".dailyentry.StoreimageActivity"
|
||||
android:label="@string/title_activity_store_list_geotag"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<activity
|
||||
android:name=".GeoTag.GeoTagActivity"
|
||||
android:label="@string/title_activity_store_geotag"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<meta-data
|
||||
@@ -97,30 +76,70 @@
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.Stock_FacingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name=".dailyentry.T2PComplianceActivity"
|
||||
android:label="@string/title_activity_t2_pcompliance"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<!-- Gagan Start Declaration -->
|
||||
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.CategoryListActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.DailyDataMenuActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.Stock_FacingActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".gsk_dailyentry.PromoComplianceActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
|
||||
<!-- Gagan End Declaration -->
|
||||
|
||||
<activity
|
||||
android:name=".dailyentry.NonWorkingReason"
|
||||
android:label="@string/title_activity_Non_Work"
|
||||
android:screenOrientation="portrait"
|
||||
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
|
||||
<activity
|
||||
|
||||
<activity
|
||||
android:name=".dailyentry.AdditionalVisibility"
|
||||
android:label="@string/title_activity_Additional_visibility"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
|
||||
<activity
|
||||
android:name=".upload.UploadActivity"
|
||||
android:label="@string/title_activity_upload"
|
||||
/>
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
@@ -660,10 +660,10 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equals("English")){
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equals("UAE")) {
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
package cpm.com.gskmtorange;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -34,13 +36,15 @@ import java.util.ArrayList;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
||||
import cpm.com.gskmtorange.dailyentry.T2PComplianceActivity;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
||||
import cpm.com.gskmtorange.upload.UploadActivity;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
@@ -53,6 +57,11 @@ public class MainActivity extends AppCompatActivity
|
||||
String user_name, user_type;
|
||||
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
|
||||
View headerView;
|
||||
|
||||
ArrayList<CoverageBean> coverageList;
|
||||
|
||||
String error_msg;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -72,6 +81,8 @@ public class MainActivity extends AppCompatActivity
|
||||
db = new GSKOrangeDB(MainActivity.this);
|
||||
db.open();
|
||||
|
||||
coverageList = db.getCoverageData(date);
|
||||
|
||||
webView.setWebViewClient(new MyWebViewClient());
|
||||
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
@@ -99,7 +110,7 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
|
||||
headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, navigationView, false);
|
||||
headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, navigationView, false);
|
||||
|
||||
TextView tv_username = (TextView) headerView.findViewById(R.id.nav_user_name);
|
||||
//tv_usertype = (TextView) headerView.findViewById(R.id.nav_user_type);
|
||||
@@ -165,22 +176,72 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
} else if (id == R.id.nav_upload) {
|
||||
|
||||
}
|
||||
else if (id == R.id.nav_geotag) {
|
||||
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();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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) {
|
||||
|
||||
db.open();
|
||||
storelist = db.getStoreData(date);
|
||||
|
||||
|
||||
if(storelist.size()>0)
|
||||
{
|
||||
Intent startDownload = new Intent(this,GeoTagStoreList.class);
|
||||
if (storelist.size() > 0) {
|
||||
Intent startDownload = new Intent(this, GeoTagStoreList.class);
|
||||
startActivity(startDownload);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -197,12 +258,13 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
} else if (id == R.id.nav_services) {
|
||||
|
||||
Intent startDownload = new Intent(this,T2PComplianceActivity.class);
|
||||
/*Intent startDownload = new Intent(this,T2PComplianceActivity.class);
|
||||
startActivity(startDownload);
|
||||
|
||||
*/
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
|
||||
} else if (id == R.id.nav_setting) {
|
||||
|
||||
startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
|
||||
|
||||
} else if (id == R.id.nav_export) {
|
||||
@@ -294,4 +356,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Locale;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||
|
||||
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener{
|
||||
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
Button btn_lang_1, btn_lang_2;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
language = login_data.getCULTURE_NAME();
|
||||
culture_id = login_data.getCULTURE_ID();
|
||||
|
||||
if(language.size()>1){
|
||||
if (language.size() > 1) {
|
||||
|
||||
btn_lang_1.setText(language.get(0));
|
||||
btn_lang_2.setText(language.get(1));
|
||||
@@ -61,20 +61,18 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
}
|
||||
|
||||
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if(selected_flag){
|
||||
if (selected_flag) {
|
||||
Intent intent = new Intent(getBaseContext(),
|
||||
MainActivity.class);
|
||||
|
||||
intent.putExtra(CommonString.KEY_LOGIN_DATA, login_data);
|
||||
startActivity(intent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
@@ -84,16 +82,14 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
int id = view.getId();
|
||||
|
||||
switch (id){
|
||||
|
||||
switch (id) {
|
||||
case R.id.btn_language_one:
|
||||
|
||||
selected_flag = true;
|
||||
|
||||
updateResources(getApplicationContext(),language.get(0));
|
||||
updateResources(getApplicationContext(), language.get(0));
|
||||
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
@@ -109,7 +105,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
|
||||
selected_flag = true;
|
||||
|
||||
updateResources(getApplicationContext(),language.get(1));
|
||||
updateResources(getApplicationContext(), language.get(1));
|
||||
|
||||
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
|
||||
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
@@ -124,16 +120,15 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
||||
}
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
String lang;
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equals("English")){
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equals("UAE")) {
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,14 @@ import android.os.Environment;
|
||||
|
||||
public class CommonString {
|
||||
|
||||
// webservice constants
|
||||
|
||||
// webservice constants
|
||||
|
||||
// preferenec keys
|
||||
public static final String KEY_USERNAME = "username";
|
||||
public static final String KEY_PASSWORD = "password";
|
||||
public static final String KEY_DATE = "date";
|
||||
public static final String KEY_STOREVISITED_STATUS = "STOREVISITED_STATUS";
|
||||
//public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/GSK_MT_Images/";
|
||||
|
||||
|
||||
public static final String KEY_PATH = "path";
|
||||
public static final String KEY_VERSION = "APP_VERSION";
|
||||
@@ -53,6 +52,7 @@ public class CommonString {
|
||||
public static final String KEY_IMAGE_URL = "IMAGE_URL";
|
||||
public static final String KEY_ID = "Id";
|
||||
public static final String KEY_MERCHANDISER_ID = "MERCHANDISER_ID";
|
||||
|
||||
public static final String KEY_BRAND = "BRAND";
|
||||
public static final String KEY_BRAND_ID = "BRAND_ID";
|
||||
public static final String KEY_DISPLAY_ID = "DISPLAY_ID";
|
||||
@@ -62,6 +62,7 @@ public class CommonString {
|
||||
public static final String UNIQUE_KEY_ID = "UNIQUE_KEY_ID";
|
||||
public static final String KEY_CATEGORY_ID = "CATEGORY_ID";
|
||||
public static final String KEY_PROCESS_ID = "PROCESS_ID";
|
||||
|
||||
public static final String KEY_JOURNEY_PLAN = "JOURNEY_PLAN";
|
||||
public static final String TABLE_INSERT_STOCK_DIALOG = "STOCK_DIALOG";
|
||||
|
||||
@@ -75,7 +76,7 @@ public class CommonString {
|
||||
public static final String KEY_INVALID = "INVALID";
|
||||
public static final String STORE_STATUS_LEAVE = "L";
|
||||
public static final String KEY_VALID = "Valid";
|
||||
public static final String DATA_DELETE_ALERT_MESSAGE="Saved data will be lost - Do you want to continue?";
|
||||
public static final String DATA_DELETE_ALERT_MESSAGE = "Saved data will be lost - Do you want to continue?";
|
||||
public static final String KEY_CHECK_IN = "I";
|
||||
// webservice constants
|
||||
|
||||
@@ -106,14 +107,22 @@ public class CommonString {
|
||||
public static final String SOAP_ACTION_DR_STORE_IMAGES_GEO = "http://tempuri.org/"
|
||||
+ 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;
|
||||
|
||||
public static final String METHOD_UPLOAD_IMAGE = "GetImageWithFolderName";
|
||||
|
||||
public static final String SOAP_ACTION_UPLOAD_IMAGE = "http://tempuri.org/" + METHOD_UPLOAD_IMAGE;
|
||||
|
||||
//Alert Messages
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String MESSAGE_FAILURE = "Server Error.Please Access After Some Time";
|
||||
public static final String MESSAGE_FALSE = "Invalid User";
|
||||
public static final String MESSAGE_CHANGED = "Invalid UserId Or Password / Password Has Been Changed.";
|
||||
@@ -124,24 +133,18 @@ public class CommonString {
|
||||
public static final String TABLE_COVERAGE_DATA = "COVERAGE_DATA";
|
||||
|
||||
|
||||
|
||||
public static final String CREATE_TABLE_COVERAGE_DATA = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_COVERAGE_DATA + " (" + KEY_ID
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ," + KEY_STORE_ID
|
||||
+ " VARCHAR,USER_ID VARCHAR, " + KEY_IN_TIME + " VARCHAR,"
|
||||
+ KEY_OUT_TIME + " VARCHAR," + KEY_VISIT_DATE + " VARCHAR,"
|
||||
+ KEY_LATITUDE + " VARCHAR," + KEY_LONGITUDE + " VARCHAR,"+ KEY_MERCHANDISER_ID + " VARCHAR,"
|
||||
+ KEY_COVERAGE_STATUS + " VARCHAR,"+ KEY_IMAGE + " VARCHAR,"
|
||||
+ KEY_LATITUDE + " VARCHAR," + KEY_LONGITUDE + " VARCHAR," + KEY_MERCHANDISER_ID + " VARCHAR,"
|
||||
+ KEY_COVERAGE_STATUS + " VARCHAR," + KEY_IMAGE + " VARCHAR,"
|
||||
+ KEY_GEO_TAG + " VARCHAR,"
|
||||
+ KEY_REASON_ID + " VARCHAR," + KEY_COVERAGE_REMARK
|
||||
+ " VARCHAR," + KEY_REASON + " VARCHAR)";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String CREATE_TABLE_STORE_GEOTAGGING = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_STORE_GEOTAGGING
|
||||
+ " ("
|
||||
@@ -166,6 +169,7 @@ public class CommonString {
|
||||
+ "FRONT_IMAGE" + " VARCHAR)";
|
||||
|
||||
|
||||
//Gagan Code Start
|
||||
|
||||
//File Path
|
||||
public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/GSK_MT_ORANGE_IMAGES/";
|
||||
@@ -282,6 +286,7 @@ public class CommonString {
|
||||
+ ")";
|
||||
|
||||
|
||||
|
||||
public static final String CREATE_TABLE_STOCK_DIALOG = "CREATE TABLE "
|
||||
+ TABLE_INSERT_STOCK_DIALOG + " (" + KEY_ID
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_STORE_ID + " VARCHAR,"
|
||||
@@ -327,4 +332,80 @@ public class CommonString {
|
||||
|
||||
+ ")";
|
||||
|
||||
public static final String TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "Additional_Promo_Compliance_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "STORE_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "CATEGORY_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "PROMO_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "PROMO"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "IN_STOCK_VALUE"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "PROMO_ANNOUNCER_VALUE"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "RUNNING_POS_VALUE"
|
||||
+ " INTEGER"
|
||||
|
||||
+ ")";
|
||||
|
||||
public static final String TABLE_INSERT_PROMO_SKU = "Promo_SKU_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_PROMO_SKU = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_PROMO_SKU
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "STORE_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "CATEGORY_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "PROMO_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "PROMO"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "IN_STOCK_VALUE"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "PROMO_ANNOUNCER_VALUE"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "RUNNING_POS_VALUE"
|
||||
+ " INTEGER"
|
||||
|
||||
+ ")";
|
||||
|
||||
//Gagan Code End
|
||||
|
||||
}
|
||||
|
||||
@@ -126,11 +126,15 @@ public class StoreListActivity extends AppCompatActivity {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
|
||||
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
|
||||
// NavUtils.navigateUpFromSameTask(this);
|
||||
finish();
|
||||
|
||||
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -23,6 +24,7 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
@@ -37,36 +39,38 @@ import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
||||
|
||||
/**
|
||||
* Created by ashishc on 31-05-2016.
|
||||
*/
|
||||
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,
|
||||
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||
|
||||
String gallery_package = "";
|
||||
Uri outputFileUri;
|
||||
|
||||
ImageView img_cam,img_clicked;
|
||||
ImageView img_cam, img_clicked;
|
||||
Button btn_save;
|
||||
|
||||
String _pathforcheck,_path,str;
|
||||
String _pathforcheck, _path, str;
|
||||
|
||||
String store_id,visit_date,username,intime,date;
|
||||
String store_id, visit_date, username, intime, date;
|
||||
private SharedPreferences preferences;
|
||||
AlertDialog alert;
|
||||
String img_str;
|
||||
private GSKOrangeDB database;
|
||||
|
||||
String lat,lon;
|
||||
String lat, lon;
|
||||
GoogleApiClient mGoogleApiClient;
|
||||
ArrayList<CoverageBean> coverage_list;
|
||||
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_storeimage);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@@ -90,8 +94,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
database = new GSKOrangeDB(this);
|
||||
database.open();
|
||||
|
||||
|
||||
coverage_list = database.getCoverageData(date);
|
||||
coverage_list = database.getCoverageData(date);
|
||||
|
||||
img_cam.setOnClickListener(this);
|
||||
img_clicked.setOnClickListener(this);
|
||||
@@ -106,13 +109,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
.build();
|
||||
}
|
||||
|
||||
if ( Build.VERSION.SDK_INT >= 23 &&
|
||||
if (Build.VERSION.SDK_INT >= 23 &&
|
||||
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,13 +123,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
if(id==android.R.id.home){
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
// NavUtils.navigateUpFromSameTask(this);
|
||||
finish();
|
||||
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -136,12 +134,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
/*Intent i = new Intent(this, DailyEntryScreen.class);
|
||||
startActivity(i);*/
|
||||
/*Intent i = new Intent(this, DailyEntryScreen.class);
|
||||
startActivity(i);*/
|
||||
|
||||
finish();
|
||||
|
||||
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
|
||||
@@ -150,12 +146,12 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
int id = v.getId();
|
||||
|
||||
switch (id){
|
||||
switch (id) {
|
||||
|
||||
case R.id.img_cam_selfie:
|
||||
|
||||
_pathforcheck = store_id + "Store"
|
||||
+ "Image" + visit_date.replace("/","") + getCurrentTime().replace(":","")+".jpg";
|
||||
+ "Image" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
|
||||
|
||||
_path = CommonString.FILE_PATH + _pathforcheck;
|
||||
|
||||
@@ -167,41 +163,32 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
case R.id.btn_save_selfie:
|
||||
|
||||
if (img_str !=null) {
|
||||
if (img_str != null) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||
StoreimageActivity.this);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
|
||||
builder.setMessage("Do you want to save the data ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int id) {
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
alert.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE)
|
||||
.setEnabled(false);
|
||||
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
|
||||
String status ="INVALID";
|
||||
CoverageBean cdata = new CoverageBean();
|
||||
cdata.setStoreId(store_id);
|
||||
cdata.setVisitDate(visit_date);
|
||||
cdata.setUserId(username);
|
||||
cdata.setInTime(intime);
|
||||
cdata.setReason("");
|
||||
cdata.setReasonid("0");
|
||||
cdata.setLatitude(lat);
|
||||
cdata.setLongitude(lon);
|
||||
cdata.setImage(img_str);
|
||||
cdata.setRemark("");
|
||||
cdata.setStatus(CommonString.KEY_INVALID);
|
||||
|
||||
database.InsertCoverageData(cdata);
|
||||
|
||||
CoverageBean cdata = new CoverageBean();
|
||||
cdata.setStoreId(store_id);
|
||||
cdata.setVisitDate(visit_date);
|
||||
cdata.setUserId(username);
|
||||
cdata.setInTime(intime);
|
||||
cdata.setReason("");
|
||||
cdata.setReasonid("0");
|
||||
cdata.setLatitude(lat);
|
||||
cdata.setLongitude(lon);
|
||||
cdata.setImage(img_str);
|
||||
cdata.setRemark("");
|
||||
cdata.setStatus(CommonString.KEY_CHECK_IN);
|
||||
|
||||
database.InsertCoverageData(cdata);
|
||||
|
||||
database.updateCheckoutStatus(store_id, status);
|
||||
database.updateCheckoutStatus(store_id, CommonString.KEY_INVALID);
|
||||
|
||||
/* SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
@@ -211,41 +198,28 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
editor.commit();*/
|
||||
|
||||
|
||||
/* Intent in=new Intent(StoreimageActivity.this,StoreEntry.class);
|
||||
startActivity(in);
|
||||
|
||||
|
||||
|
||||
finish();*/
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class);
|
||||
startActivity(in);
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), "Please click the image", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
"Please click the image", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void startCameraActivity() {
|
||||
|
||||
try {
|
||||
/*Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
@@ -259,16 +233,21 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
Log.i("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(_path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage="";
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
for (int n=0;n<list.size();n++) {
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
Log.e("TAG", "package name : " + list.get(n).packageName);
|
||||
|
||||
//temp value in case camera is gallery app above jellybean
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
gallery_package = list.get(n).packageName;
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
@@ -281,38 +260,42 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//com.android.gallery3d
|
||||
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
catch (ActivityNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(gallery_package);
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
Log.i("MakeMachine", "resultCode: " + resultCode);
|
||||
switch (resultCode) {
|
||||
|
||||
case 0:
|
||||
Log.i("MakeMachine", "User cancelled");
|
||||
break;
|
||||
|
||||
case -1:
|
||||
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
|
||||
|
||||
Bitmap bmp = BitmapFactory.decodeFile(str + _pathforcheck);
|
||||
|
||||
img_cam.setImageBitmap(bmp);
|
||||
|
||||
img_clicked.setVisibility(View.GONE);
|
||||
@@ -320,21 +303,14 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
|
||||
img_str = _pathforcheck;
|
||||
_pathforcheck = "";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
|
||||
public String getCurrentTime() {
|
||||
|
||||
Calendar m_cal = Calendar.getInstance();
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
|
||||
@@ -344,18 +320,15 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
|
||||
|
||||
return cdate;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
|
||||
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
if (mLastLocation != null) {
|
||||
lat = String.valueOf(mLastLocation.getLatitude());
|
||||
lon = String.valueOf(mLastLocation.getLongitude());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,4 +351,4 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,82 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.google.android.gms.appindexing.AppIndex;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
|
||||
|
||||
public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
String gallery_package = "";
|
||||
Uri outputFileUri;
|
||||
|
||||
GSKOrangeDB db;
|
||||
ArrayList<T2PGetterSetter> t2PGetterSetters;
|
||||
T2PAdapter t2PAdapter;
|
||||
RecyclerView rec_t2p;
|
||||
|
||||
String categoryName, categoryId, storeId;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
String path = "", str = CommonString.FILE_PATH, _pathforcheck = "", img = "";
|
||||
int child_position = -1;
|
||||
/**
|
||||
* ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
* See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
*/
|
||||
private GoogleApiClient client;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -43,35 +84,68 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
db = new GSKOrangeDB(T2PComplianceActivity.this);
|
||||
db.open();
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
|
||||
rec_t2p = (RecyclerView) findViewById(R.id.rec_t2p);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
t2PGetterSetters = db.getT2PDefaultData(store_id);
|
||||
|
||||
if (t2PGetterSetters.size() > 0) {
|
||||
|
||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(t2PGetterSetters.get(i).getDisplay_id());
|
||||
|
||||
t2PGetterSetters.get(i).setGapsChecklist(gapsChecklist);
|
||||
|
||||
}
|
||||
|
||||
|
||||
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
t2PAdapter = new T2PAdapter(t2PGetterSetters);
|
||||
rec_t2p.setAdapter(t2PAdapter);
|
||||
|
||||
}
|
||||
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
t2PGetterSetters = db.getT2PDefaultData("1");
|
||||
|
||||
if(t2PGetterSetters.size()>0){
|
||||
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
t2PAdapter = new T2PAdapter(t2PGetterSetters);
|
||||
rec_t2p.setAdapter(t2PAdapter);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class T2PAdapter extends RecyclerView.Adapter<T2PAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<T2PGetterSetter> list;
|
||||
@@ -88,7 +162,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
||||
|
||||
final T2PGetterSetter mItem = list.get(position);
|
||||
holder.tv_brand.setText(mItem.getBrand());
|
||||
@@ -98,20 +172,59 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = showGapsDialog(mItem.getDisplay_id());
|
||||
if(gapsChecklist.size()>0){
|
||||
showGapsDialog(mItem.getGapsChecklist());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
holder.toggle_btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes")) {
|
||||
mItem.setPresent(true);
|
||||
} else {
|
||||
mItem.setPresent(false);
|
||||
}
|
||||
|
||||
t2PAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
holder.img_cam.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
_pathforcheck = "T2P_Image_" + store_id + "_" + mItem.getBrand_id() + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||
child_position = position;
|
||||
path = str + _pathforcheck;
|
||||
|
||||
startCameraActivity();
|
||||
}
|
||||
});
|
||||
|
||||
holder.btn_sku.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showSkuDialog();
|
||||
showSkuDialog(mItem.getSkulist());
|
||||
}
|
||||
});
|
||||
|
||||
if (!img.equalsIgnoreCase("")) {
|
||||
if (position == child_position) {
|
||||
mItem.setImage(img);
|
||||
img = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (mItem.getImage().equals("")) {
|
||||
holder.img_cam.setBackgroundResource(R.drawable.cam_deactive);
|
||||
} else {
|
||||
holder.img_cam.setBackgroundResource(R.drawable.cam_active);
|
||||
}
|
||||
|
||||
holder.toggle_btn.setChecked(mItem.isPresent());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,6 +238,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
public final TextView tv_brand, tv_display;
|
||||
public final ImageView img_cam, img_remark;
|
||||
public final Button btn_gaps, btn_sku, btn_ref_img;
|
||||
public final ToggleButton toggle_btn;
|
||||
|
||||
|
||||
public ViewHolder(View view) {
|
||||
@@ -140,18 +254,19 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
btn_sku = (Button) mView.findViewById(R.id.btn_sku);
|
||||
btn_ref_img = (Button) mView.findViewById(R.id.btn_ref_image);
|
||||
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
||||
toggle_btn = (ToggleButton) mView.findViewById(R.id.toggle_btn);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<GapsChecklistGetterSetter> showGapsDialog(String display_id){
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id);
|
||||
public void showGapsDialog(ArrayList<GapsChecklistGetterSetter> gapsChecklist) {
|
||||
//ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id);
|
||||
|
||||
Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.gaps_dialog_layout);
|
||||
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
|
||||
RecyclerView rec_gap_checklist = (RecyclerView) dialog.findViewById(R.id.rec_gap_checklist);
|
||||
@@ -159,23 +274,174 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist);
|
||||
rec_gap_checklist.setAdapter(gapAdapter);
|
||||
|
||||
//dialog.setCancelable(false);
|
||||
Button btn_save = (Button) dialog.findViewById(R.id.btn_save);
|
||||
btn_save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
dialog.cancel();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
|
||||
return gapsChecklist;
|
||||
}
|
||||
|
||||
public void showSkuDialog(){
|
||||
public void showSkuDialog(final ArrayList<SkuGetterSetter> skuAddedList) {
|
||||
|
||||
ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
|
||||
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
|
||||
final SkuGetterSetter[] sku_selected = new SkuGetterSetter[1];
|
||||
final BrandMasterGetterSetter[] brand_selected = new BrandMasterGetterSetter[1];
|
||||
|
||||
Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id);
|
||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||
brand.setBRAND("select");
|
||||
brandList.add(0, brand);
|
||||
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
|
||||
|
||||
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
dialog.setContentView(R.layout.t2p_sku_dialog_layout);
|
||||
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
|
||||
//dialog.setCancelable(false);
|
||||
//dialog.setCancelable(false);
|
||||
final Spinner spinner_brand = (Spinner) dialog.findViewById(R.id.spinner_brand);
|
||||
final Spinner spinner_sku = (Spinner) dialog.findViewById(R.id.spinner_sku);
|
||||
Button btn_add = (Button) dialog.findViewById(R.id.btn_add);
|
||||
Button btn_cancel = (Button) dialog.findViewById(R.id.btn_cancel);
|
||||
final EditText et_stock = (EditText) dialog.findViewById(R.id.et_stock);
|
||||
final RecyclerView rec_sku = (RecyclerView) dialog.findViewById(R.id.rec_sku);
|
||||
|
||||
final ArrayList<SkuGetterSetter> sku_list = new ArrayList<>();
|
||||
|
||||
if(skuAddedList.size()>0){
|
||||
|
||||
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
|
||||
rec_sku.setAdapter(skuAdapter);
|
||||
|
||||
}
|
||||
|
||||
btn_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if(brand_selected[0] ==null || sku_selected[0]==null || et_stock.getText().toString().equals("")){
|
||||
|
||||
Snackbar.make(v, getResources().getString(R.string.enter_the_values),Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
SkuGetterSetter sku = new SkuGetterSetter();
|
||||
sku.setBRAND_ID(brand_selected[0].getBRAND_ID().get(0));
|
||||
sku.setBRAND(brand_selected[0].getBRAND().get(0));
|
||||
sku.setSKU(sku_selected[0].getSKU());
|
||||
sku.setSKU_ID(sku_selected[0].getSKU_ID());
|
||||
sku.setSTOCK(et_stock.getText().toString());
|
||||
|
||||
skuAddedList.add(sku);
|
||||
|
||||
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
|
||||
rec_sku.setAdapter(skuAdapter);
|
||||
|
||||
et_stock.setText("");
|
||||
spinner_brand.setSelection(0);
|
||||
|
||||
SkuGetterSetter select = new SkuGetterSetter();
|
||||
select.setSKU("Select");
|
||||
sku_list.clear();
|
||||
sku_list.add(select);
|
||||
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
spinner_sku.setAdapter(skuadapter);
|
||||
|
||||
spinner_sku.setSelection(0);
|
||||
|
||||
|
||||
brand_selected[0] = null;
|
||||
sku_selected[0] = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btn_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// Create custom adapter object ( see below CustomAdapter.java )
|
||||
CustomAdapter adapter = new CustomAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, brandList);
|
||||
// Set adapter to spinner
|
||||
spinner_brand.setAdapter(adapter);
|
||||
|
||||
|
||||
SkuGetterSetter select = new SkuGetterSetter();
|
||||
select.setSKU("Select");
|
||||
sku_list.add(select);
|
||||
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
spinner_sku.setAdapter(skuadapter);
|
||||
|
||||
|
||||
spinner_brand.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if (position != 0) {
|
||||
|
||||
sku_list.clear();
|
||||
|
||||
brand_selected[0] = brandList.get(position);
|
||||
|
||||
String brand_id = brandList.get(position).getBRAND_ID().get(0);
|
||||
|
||||
ArrayList<SkuGetterSetter> temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id);
|
||||
|
||||
for (int k=0;k<temp_list.size();k++){
|
||||
sku_list.add(temp_list.get(k));
|
||||
}
|
||||
|
||||
SkuGetterSetter select = new SkuGetterSetter();
|
||||
select.setSKU("Select");
|
||||
sku_list.add(0, select);
|
||||
// Create custom adapter object ( see below CustomSkuAdapter.java )
|
||||
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
|
||||
// Set adapter to spinner
|
||||
spinner_sku.setAdapter(skuadapter);
|
||||
|
||||
spinner_sku.setSelection(0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
spinner_sku.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if(position!=0){
|
||||
|
||||
sku_selected[0] = sku_list.get(position);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
@@ -204,10 +470,14 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
holder.tb_present.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes")) {
|
||||
mItem.setPresent(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
holder.tb_present.setChecked(mItem.isPresent());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,4 +506,284 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CustomAdapter extends ArrayAdapter<String> {
|
||||
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
BrandMasterGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomAdapter Constructor
|
||||
*****************/
|
||||
public CustomAdapter(
|
||||
T2PComplianceActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (BrandMasterGetterSetter) data.get(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
|
||||
if (position == 0) {
|
||||
|
||||
// Default selected Spinner item
|
||||
label.setText("Select");
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getBRAND().get(0));
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomSkuAdapter extends ArrayAdapter<String> {
|
||||
|
||||
private Activity activity;
|
||||
private ArrayList data;
|
||||
SkuGetterSetter tempValues = null;
|
||||
LayoutInflater inflater;
|
||||
|
||||
/*************
|
||||
* CustomAdapter Constructor
|
||||
*****************/
|
||||
public CustomSkuAdapter(
|
||||
T2PComplianceActivity activitySpinner,
|
||||
int textViewResourceId,
|
||||
ArrayList objects
|
||||
|
||||
) {
|
||||
super(activitySpinner, textViewResourceId, objects);
|
||||
|
||||
/********** Take passed values **********/
|
||||
activity = activitySpinner;
|
||||
data = objects;
|
||||
/*********** Layout inflator to call external xml layout () **********************/
|
||||
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
// This funtion called for each row ( Called data.size() times )
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
|
||||
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
|
||||
|
||||
/***** Get each Model object from Arraylist ********/
|
||||
tempValues = null;
|
||||
tempValues = (SkuGetterSetter) data.get(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.tv_text);
|
||||
|
||||
if (position == 0) {
|
||||
|
||||
// Default selected Spinner item
|
||||
label.setText("Select");
|
||||
//sub.setText("");
|
||||
} else {
|
||||
// Set values for spinner each row
|
||||
label.setText(tempValues.getSKU());
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public String getCurrentTime() {
|
||||
Calendar m_cal = Calendar.getInstance();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
||||
String cdate = formatter.format(m_cal.getTime());
|
||||
/* String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":"
|
||||
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
|
||||
|
||||
return cdate;
|
||||
}
|
||||
|
||||
private void startCameraActivity() {
|
||||
try {
|
||||
|
||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
/*Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
Log.e("TAG", "package name : " + list.get(n).packageName);*/
|
||||
|
||||
//temp value in case camera is gallery app above jellybean
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
gallery_package = list.get(n).packageName;
|
||||
}
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 1);
|
||||
//startActivityForResult(intent, position);
|
||||
|
||||
} catch (ActivityNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(gallery_package);
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.e("Stock & Facing", "resultCode: " + resultCode);
|
||||
switch (resultCode) {
|
||||
case 0:
|
||||
Log.e("Stock & Facing", "User cancelled");
|
||||
|
||||
break;
|
||||
case -1:
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
img = _pathforcheck;
|
||||
t2PAdapter.notifyDataSetChanged();
|
||||
_pathforcheck = "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
public class SkuAddedAdapter extends RecyclerView.Adapter<SkuAddedAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<SkuGetterSetter> list;
|
||||
|
||||
public SkuAddedAdapter(ArrayList<SkuGetterSetter> skuList) {
|
||||
list = skuList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.sku_added_item_layout, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
||||
|
||||
final SkuGetterSetter mItem = list.get(position);
|
||||
holder.tv_brand.setText(mItem.getBRAND());
|
||||
holder.tv_sku.setText(mItem.getSKU().trim());
|
||||
holder.tv_stock.setText(mItem.getSTOCK());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final LinearLayout parentLayout;
|
||||
public final TextView tv_brand, tv_sku, tv_stock;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
mView = view;
|
||||
|
||||
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
|
||||
tv_sku = (TextView) mView.findViewById(R.id.tv_sku);
|
||||
tv_stock = (TextView) mView.findViewById(R.id.tv_stock);
|
||||
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
@@ -25,9 +25,7 @@ import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
@@ -36,6 +34,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
|
||||
@@ -68,6 +67,7 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
MappingDisplayChecklistGetterSetter mappingChecklistGetterSetter;
|
||||
NonWorkingReasonGetterSetter nonWorkingReasonGetterSetter;
|
||||
MappingPromotionGetterSetter mappingPromotionGetterSetter;
|
||||
MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter mapping_additional_promotion_masterGetterSetter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -511,6 +511,7 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
}
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
// MAPPING_PROMOTION
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userId);
|
||||
@@ -531,20 +532,61 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
mappingPromotionGetterSetter = XMLHandlers.mappingPromotionXMLHandler(xpp, eventType);
|
||||
if (mappingPromotionGetterSetter.getSTORE_ID().size() > 0) {
|
||||
String mapping_promotion_table = mappingPromotionGetterSetter.getTable_MAPPING_PROMOTION();
|
||||
if (mapping_promotion_table != null) {
|
||||
resultHttp = CommonString.KEY_SUCCESS;
|
||||
TableBean.setMappingPromotion(mapping_promotion_table);
|
||||
}
|
||||
} else {
|
||||
//return "MAPPING_PROMOTION";
|
||||
//if (mappingPromotionGetterSetter.getSTORE_ID().size() > 0) {
|
||||
String mapping_promotion_table = mappingPromotionGetterSetter.getTable_MAPPING_PROMOTION();
|
||||
if (mapping_promotion_table != null) {
|
||||
resultHttp = CommonString.KEY_SUCCESS;
|
||||
TableBean.setMappingPromotion(mapping_promotion_table);
|
||||
}
|
||||
/*} else {
|
||||
//return "MAPPING_PROMOTION";
|
||||
}*/
|
||||
data.value = 100;
|
||||
data.name = "MAPPING_PROMOTION Data Download";
|
||||
}
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Gagan start code
|
||||
|
||||
// MAPPING_ADDITIONAL_PROMOTION
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||
request.addProperty("UserName", userId);
|
||||
request.addProperty("Type", "MAPPING_ADDITIONAL_PROMOTION");
|
||||
request.addProperty("cultureid", culture_id);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
|
||||
|
||||
result = (Object) envelope.getResponse();
|
||||
|
||||
if (result.toString() != null) {
|
||||
xpp.setInput(new StringReader(result.toString()));
|
||||
xpp.next();
|
||||
eventType = xpp.getEventType();
|
||||
mapping_additional_promotion_masterGetterSetter = XMLHandlers.mappingAdditionalPromotionXMLHandler(xpp, eventType);
|
||||
|
||||
//if (mapping_additional_promotion_masterGetterSetter.getSTORE_ID().size() > 0) {
|
||||
String mapping_additional_promotion_table = mapping_additional_promotion_masterGetterSetter.getTable_MAPPING_ADDITIONAL_PROMOTION();
|
||||
if (mapping_additional_promotion_table != null) {
|
||||
resultHttp = CommonString.KEY_SUCCESS;
|
||||
TableBean.setMappingAdditionalPromotion(mapping_additional_promotion_table);
|
||||
}
|
||||
/*} else {
|
||||
//return "MAPPING_ADDITIONAL_PROMOTION";
|
||||
}*/
|
||||
data.value = 100;
|
||||
data.name = "MAPPING_ADDITIONAL_PROMOTION Data Download";
|
||||
}
|
||||
publishProgress(data);
|
||||
|
||||
//Gagan end code
|
||||
|
||||
|
||||
db.open();
|
||||
db.InsertJCP(jcpgettersetter);
|
||||
db.InsertCategory(categoryMasterGetterSetter);
|
||||
@@ -556,6 +598,10 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
db.InsertMappingStock(mappingStockGetterSetter);
|
||||
db.InsertDisplayChecklistMaster(checklistMasterGetterSetter);
|
||||
db.InsertMappingDisplayChecklist(mappingChecklistGetterSetter);
|
||||
db.InsertMAPPING_PROMOTION(mappingPromotionGetterSetter);
|
||||
db.InsertMAPPING_ADDITIONAL_PROMOTION(mapping_additional_promotion_masterGetterSetter);
|
||||
|
||||
db.insertNonWorkingData(nonWorkingReasonGetterSetter);
|
||||
|
||||
db.insertNonWorkingData(nonWorkingReasonGetterSetter);
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@@ -24,6 +26,7 @@ import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
|
||||
|
||||
public class CategoryListActivity extends AppCompatActivity {
|
||||
@@ -35,24 +38,38 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
|
||||
GSKOrangeDB db;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_category_list);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
//txt_categoryName.setText("Category List");
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
|
||||
/*txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));*/
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_list));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_category);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -69,7 +86,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
categoryList = new ArrayList<>();
|
||||
|
||||
categoryList = db.getCategoryListData("1", "1", "1");
|
||||
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id);
|
||||
|
||||
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
@@ -99,7 +116,16 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
final CategoryGetterSetter categoryData = list.get(position);
|
||||
|
||||
holder.categoryName.setText(categoryData.getCategory());
|
||||
holder.categoryIcon.setImageResource(R.drawable.category);
|
||||
//holder.categoryIcon.setImageResource(R.drawable.category);
|
||||
|
||||
if (categoryData.getCategory().equalsIgnoreCase("Oral Health")) {
|
||||
holder.categoryIcon.setImageResource(R.drawable.ohc);
|
||||
} else if (categoryData.getCategory().equalsIgnoreCase("Wellness")) {
|
||||
holder.categoryIcon.setImageResource(R.drawable.pdr);
|
||||
} else if (categoryData.getCategory().equalsIgnoreCase("Nutritionals")) {
|
||||
holder.categoryIcon.setImageResource(R.drawable.hfd);
|
||||
}
|
||||
|
||||
|
||||
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -37,18 +37,18 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_category_wise_performance);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
//txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
//txt_categoryName.setText("CategoryWise Performance " + categoryName);
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
//txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@@ -2,9 +2,10 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@@ -22,7 +23,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.dailyentry.T2PComplianceActivity;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.DailyDataMenuGetterSetter;
|
||||
|
||||
public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
@@ -30,26 +34,47 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
ArrayList<DailyDataMenuGetterSetter> categoryList;
|
||||
DailyDataMenuAdapter adapter;
|
||||
TextView txt_categoryName;
|
||||
|
||||
GSKOrangeDB db;
|
||||
String categoryName = "", categoryId;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_daily_data_menu);
|
||||
try {
|
||||
setContentView(R.layout.activity_daily_data_menu);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
//txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
//txt_categoryName.setText("Daily Data Menu - " + categoryName);
|
||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
//txt_categoryName.setText(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -59,59 +84,79 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
});*/
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
categoryList = new ArrayList<>();
|
||||
try {
|
||||
categoryList = new ArrayList<>();
|
||||
|
||||
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("MSL Availability");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_msl_availability));
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("MSL Availability");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_msl_availability));
|
||||
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.msl_availability);
|
||||
}
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
|
||||
//data.setCategory_name("Stock & Facing");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("Stock & Facing");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
|
||||
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.stock_and_facing_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.stock_and_facing);
|
||||
}
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
|
||||
//data.setCategory_name("T2P Compliance");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("T2P Compliance");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
|
||||
data.setCategory_img(R.mipmap.t2p_compliance);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_visibility));
|
||||
//data.setCategory_name("Additional Visibility");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("Additional Visibility");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_visibility));
|
||||
data.setCategory_img(R.mipmap.additional_visibility);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
|
||||
//data.setCategory_name("Promo Compliance");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
//data.setCategory_name("Promo Compliance");
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
|
||||
if (db.checkPromoComplianceData(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.promo_compliance_done);
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.promo_compliance);
|
||||
}
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_competition_tracking));
|
||||
//data.setCategory_name("Competition Tracking");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
/*data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_competition_tracking));
|
||||
//data.setCategory_name("Competition Tracking");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_promotions));
|
||||
//data.setCategory_name("Competition Promo");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_additional_promotions));
|
||||
//data.setCategory_name("Competition Promo");
|
||||
data.setCategory_img(R.drawable.category);
|
||||
categoryList.add(data);*/
|
||||
|
||||
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
|
||||
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
|
||||
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class DailyDataMenuAdapter extends RecyclerView.Adapter<DailyDataMenuAdapter.MyViewHolder> {
|
||||
@@ -152,6 +197,18 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
|
||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
|
||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,8 +3,11 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@@ -34,6 +37,7 @@ import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||
|
||||
public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
@@ -51,173 +55,197 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
|
||||
String categoryName, categoryId, storeId;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_msl__availability);
|
||||
try {
|
||||
setContentView(R.layout.activity_msl__availability);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
|
||||
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
storeId = "";
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
//txt_mslAvailabilityName.setText(categoryName);
|
||||
txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
prepareList();
|
||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_msl__availability));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
prepareList();
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
|
||||
if (db.checkMsl_AvailabilityData(storeId, categoryId)) {
|
||||
db.updateMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
} else {
|
||||
db.InsertMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
}
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
|
||||
/*} else {
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
db.open();
|
||||
|
||||
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
||||
db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else {
|
||||
db.InsertMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}*/
|
||||
|
||||
}
|
||||
});
|
||||
/*} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}*/
|
||||
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
if (firstVisibleItem == 0) {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView arg0, int arg1) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
if (firstVisibleItem == 0) {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
//expandableListView.invalidateViews();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView arg0, int arg1) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
|
||||
// Listview Group click listener
|
||||
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group expanded listener
|
||||
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
//expandableListView.invalidateViews();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Listview Group collasped listener
|
||||
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
@Override
|
||||
public void onGroupCollapse(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
// Listview Group click listener
|
||||
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Listview on child click listener
|
||||
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// Listview Group expanded listener
|
||||
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group collasped listener
|
||||
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
@Override
|
||||
public void onGroupCollapse(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Listview on child click listener
|
||||
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
try {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
|
||||
//Header
|
||||
headerDataList = db.getMSL_AvailabilityHeaderData(categoryId);
|
||||
//Header
|
||||
headerDataList = db.getMSL_AvailabilityHeaderData(categoryId);
|
||||
|
||||
if (headerDataList.size() > 0) {
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
if (headerDataList.size() > 0) {
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
|
||||
//childDataList = new ArrayList<>();
|
||||
childDataList = db.getMSL_AvailabilitySKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getMSL_AvailabilitySKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
//childDataList = new ArrayList<>();
|
||||
childDataList = db.getMSL_AvailabilitySKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getMSL_AvailabilitySKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
}
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
|
||||
@@ -0,0 +1,436 @@
|
||||
package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter;
|
||||
|
||||
public class PromoComplianceActivity extends AppCompatActivity {
|
||||
LinearLayout lin_promo_sku, lin_addtional_promo;
|
||||
View view_promo_sku, view_additional_promo;
|
||||
Spinner sp_promo;
|
||||
ToggleButton toggle_add_InStock, toggle_add_promoAnnouncer, toggle_add_runningPos;
|
||||
Button btn_add;
|
||||
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData, promoSkuListAfterData;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSpinnerListData;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> additionalPromoListData;
|
||||
|
||||
GSKOrangeDB db;
|
||||
String categoryName, categoryId;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
setContentView(R.layout.activity_promo_compliance);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_promo_compliance));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
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);
|
||||
view_additional_promo = findViewById(R.id.view_additional_promo);
|
||||
|
||||
sp_promo = (Spinner) findViewById(R.id.sp_promo);
|
||||
toggle_add_InStock = (ToggleButton) findViewById(R.id.toggle_add_InStock);
|
||||
toggle_add_promoAnnouncer = (ToggleButton) findViewById(R.id.toggle_add_promoAnnouncer);
|
||||
toggle_add_runningPos = (ToggleButton) findViewById(R.id.toggle_add_runningPos);
|
||||
btn_add = (Button) findViewById(R.id.btn_add);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
prepareList();
|
||||
promoSkuListView();
|
||||
|
||||
additionalPromoListData = new ArrayList<>();
|
||||
AdditionalPromoListView();
|
||||
|
||||
final Promo_Compliance_DataGetterSetter cd = new Promo_Compliance_DataGetterSetter();
|
||||
cd.setStore_id(store_id);
|
||||
cd.setPromo_id("");
|
||||
cd.setPromo("");
|
||||
cd.setSku_id("");
|
||||
cd.setSku("");
|
||||
cd.setIn_stock("1");
|
||||
cd.setPromo_announcer("1");
|
||||
cd.setRunning_pos("1");
|
||||
cd.setSp_promo("0");
|
||||
|
||||
toggle_add_InStock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
cd.setIn_stock("1");
|
||||
} else {
|
||||
cd.setIn_stock("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (cd.getIn_stock().equals("1")) {
|
||||
toggle_add_InStock.setChecked(true);
|
||||
} else {
|
||||
toggle_add_InStock.setChecked(false);
|
||||
}
|
||||
|
||||
toggle_add_promoAnnouncer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
cd.setPromo_announcer("1");
|
||||
} else {
|
||||
cd.setPromo_announcer("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (cd.getPromo_announcer().equals("1")) {
|
||||
toggle_add_promoAnnouncer.setChecked(true);
|
||||
} else {
|
||||
toggle_add_promoAnnouncer.setChecked(false);
|
||||
}
|
||||
|
||||
toggle_add_runningPos.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
cd.setRunning_pos("1");
|
||||
} else {
|
||||
cd.setRunning_pos("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (cd.getRunning_pos().equals("1")) {
|
||||
toggle_add_runningPos.setChecked(true);
|
||||
} else {
|
||||
toggle_add_runningPos.setChecked(false);
|
||||
}
|
||||
|
||||
sp_promo.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
String item = parent.getItemAtPosition(position).toString();
|
||||
// childData.setSp_condition(position);
|
||||
// childData.setConditionName(item);
|
||||
|
||||
for (int i = 0; i < promoSpinnerListData.size(); i++) {
|
||||
if (position == i) {
|
||||
cd.setSku_id(promoSpinnerListData.get(i).getSku_id());
|
||||
cd.setSku(promoSpinnerListData.get(i).getSku());
|
||||
cd.setSp_promo(promoSpinnerListData.get(i).getPromo_id());
|
||||
cd.setPromo(promoSpinnerListData.get(i).getPromo());
|
||||
cd.setPromo_id(promoSpinnerListData.get(i).getPromo_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < promoSpinnerListData.size(); i++) {
|
||||
if (cd.getSp_promo() == promoSpinnerListData.get(i).getPromo_id()) {
|
||||
sp_promo.setSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
btn_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PromoComplianceActivity.this);
|
||||
builder.setMessage("Are you sure you want to add")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.InsertAdditionalPromoData(cd, categoryId);
|
||||
AdditionalPromoListView();
|
||||
|
||||
sp_promo.setSelection(0);
|
||||
toggle_add_InStock.setChecked(true);
|
||||
toggle_add_promoAnnouncer.setChecked(true);
|
||||
toggle_add_runningPos.setChecked(true);
|
||||
|
||||
Snackbar.make(v, "promo is add", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
//Toast.makeText(getApplicationContext(), "promo is add", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
});
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PromoComplianceActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
if (db.checkPromoComplianceData(store_id, categoryId)) {
|
||||
db.updatePromoComplianceSKU(promoSkuListData, categoryId, store_id);
|
||||
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else {
|
||||
db.InsertPromoSkuData(promoSkuListData, categoryId);
|
||||
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*ViewTreeObserver.OnScrollChangedListener onScrollChangedListener
|
||||
= new ViewTreeObserver.OnScrollChangedListener() {
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
|
||||
}
|
||||
};*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
try {
|
||||
//Promo SKU List
|
||||
promoSkuListData = db.getPromoComplianceSkuAfterData(store_id, categoryId);
|
||||
if (!(promoSkuListData.size() > 0)) {
|
||||
promoSkuListData = db.getPromoComplianceSkuData(store_id);
|
||||
}
|
||||
|
||||
//Promo Spinner List
|
||||
promoSpinnerListData = db.getPromoSpinnerData(store_id);
|
||||
|
||||
ArrayAdapter<String> sp_promo_adapter = new ArrayAdapter<>(PromoComplianceActivity.this, android.R.layout.simple_list_item_1);
|
||||
for (int i = 0; i < promoSpinnerListData.size(); i++) {
|
||||
sp_promo_adapter.add(promoSpinnerListData.get(i).getPromo());
|
||||
}
|
||||
sp_promo.setAdapter(sp_promo_adapter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void promoSkuListView() {
|
||||
try {
|
||||
View view;
|
||||
|
||||
for (int i = 0; i < promoSkuListData.size(); i++) {
|
||||
view = getLayoutInflater().inflate(R.layout.item_promo_sku_list, null, false);
|
||||
|
||||
final Promo_Compliance_DataGetterSetter data = promoSkuListData.get(i);
|
||||
|
||||
TextView txt_promoSkuName = (TextView) view.findViewById(R.id.txt_promoSkuName);
|
||||
ToggleButton toggle_inStock = (ToggleButton) view.findViewById(R.id.toggle_inStock);
|
||||
ToggleButton toggle_promoAnnouncer = (ToggleButton) view.findViewById(R.id.toggle_promoAnnouncer);
|
||||
ToggleButton toggle_runningPos = (ToggleButton) view.findViewById(R.id.toggle_runningPos);
|
||||
|
||||
txt_promoSkuName.setText(data.getPromo());
|
||||
|
||||
//In Stock
|
||||
toggle_inStock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
data.setIn_stock("1");
|
||||
} else {
|
||||
data.setIn_stock("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (data.getIn_stock().equals("1")) {
|
||||
toggle_inStock.setChecked(true);
|
||||
} else {
|
||||
toggle_inStock.setChecked(false);
|
||||
}
|
||||
|
||||
//Promo Announcer
|
||||
toggle_promoAnnouncer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
data.setPromo_announcer("1");
|
||||
} else {
|
||||
data.setPromo_announcer("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (data.getPromo_announcer().equals("1")) {
|
||||
toggle_promoAnnouncer.setChecked(true);
|
||||
} else {
|
||||
toggle_promoAnnouncer.setChecked(false);
|
||||
}
|
||||
|
||||
//Running on POS
|
||||
toggle_runningPos.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
data.setRunning_pos("1");
|
||||
} else {
|
||||
data.setRunning_pos("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (data.getRunning_pos().equals("1")) {
|
||||
toggle_runningPos.setChecked(true);
|
||||
} else {
|
||||
toggle_runningPos.setChecked(false);
|
||||
}
|
||||
|
||||
lin_promo_sku.addView(view);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void AdditionalPromoListView() {
|
||||
try {
|
||||
additionalPromoListData.clear();
|
||||
lin_addtional_promo.removeAllViews();
|
||||
|
||||
//Additional Promo List
|
||||
additionalPromoListData = db.getAdditionalPromoData(store_id, categoryId);
|
||||
|
||||
View view;
|
||||
|
||||
for (int i = 0; i < additionalPromoListData.size(); i++) {
|
||||
view = getLayoutInflater().inflate(R.layout.item_additional_promo_list, null, false);
|
||||
|
||||
final Promo_Compliance_DataGetterSetter data = additionalPromoListData.get(i);
|
||||
|
||||
TextView txt_promoName = (TextView) view.findViewById(R.id.txt_promoName);
|
||||
TextView txt_inStock = (TextView) view.findViewById(R.id.txt_inStock);
|
||||
TextView txt_promoAnnouncer = (TextView) view.findViewById(R.id.txt_promoAnnouncer);
|
||||
TextView txt_runningPos = (TextView) view.findViewById(R.id.txt_runningPos);
|
||||
|
||||
txt_promoName.setText(data.getPromo());
|
||||
|
||||
//In Stock
|
||||
if (data.getIn_stock().equals("1")) {
|
||||
txt_inStock.setText("Yes");
|
||||
} else {
|
||||
txt_inStock.setText("No");
|
||||
}
|
||||
|
||||
//Promo Announcer
|
||||
if (data.getPromo_announcer().equals("1")) {
|
||||
txt_promoAnnouncer.setText("Yes");
|
||||
} else {
|
||||
txt_promoAnnouncer.setText("No");
|
||||
}
|
||||
|
||||
//Running on POS
|
||||
if (data.getRunning_pos().equals("1")) {
|
||||
txt_runningPos.setText("Yes");
|
||||
} else {
|
||||
txt_runningPos.setText("No");
|
||||
}
|
||||
|
||||
lin_addtional_promo.addView(view);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,16 @@ import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
@@ -43,6 +47,7 @@ import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
|
||||
@@ -54,182 +59,214 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
ArrayList<Stock_FacingGetterSetter> childDataList;
|
||||
List<Stock_FacingGetterSetter> hashMapListHeaderData;
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData;
|
||||
List<Integer> checkHeaderArray = new ArrayList<>();
|
||||
|
||||
ExpandableListAdapter adapter;
|
||||
GSKOrangeDB db;
|
||||
|
||||
String categoryName, categoryId, storeId;
|
||||
String categoryName, categoryId, Error_Message = "";
|
||||
|
||||
String path = "", str = "", _pathforcheck = "", img1 = "";
|
||||
String path = "", str = "", _pathforcheck = "", img1 = "", img2 = "";
|
||||
static int child_position = -1;
|
||||
boolean isDialogOpen = true;
|
||||
boolean checkflag = true;
|
||||
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_stock_facing);
|
||||
try {
|
||||
setContentView(R.layout.activity_stock_facing);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
//txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
||||
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
storeId = "";
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
|
||||
//txt_stockFacingName.setText(categoryName);
|
||||
txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
prepareList();
|
||||
//txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_stock_facing));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
str = Environment.getExternalStorageState();
|
||||
prepareList();
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
str = CommonString.FILE_PATH + _pathforcheck;
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
//db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
|
||||
if (db.checkStockAndFacingData(storeId, categoryId)) {
|
||||
db.updateStockAndFacing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
} else {
|
||||
db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
}
|
||||
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||
db.updateStockAndFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else {
|
||||
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
/*} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}*/
|
||||
}
|
||||
});
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
}
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
int lastItem = firstVisibleItem + visibleItemCount;
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView arg0, int arg1) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
if (firstVisibleItem == 0) {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
expandableListView.invalidateViews();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView arg0, int arg1) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
|
||||
// Listview Group click listener
|
||||
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group expanded listener
|
||||
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
expandableListView.invalidateViews();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Listview Group collasped listener
|
||||
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
@Override
|
||||
public void onGroupCollapse(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
// Listview Group click listener
|
||||
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Listview on child click listener
|
||||
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// Listview Group expanded listener
|
||||
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Listview Group collasped listener
|
||||
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
|
||||
@Override
|
||||
public void onGroupCollapse(int groupPosition) {
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (getWindow().getCurrentFocus() != null) {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Listview on child click listener
|
||||
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
try {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
|
||||
//Header Data
|
||||
headerDataList = db.getStockAndFacingHeader_AfterSaveData(categoryId);
|
||||
if (!(headerDataList.size() > 0)) {
|
||||
headerDataList = db.getStockAndFacingHeaderData(categoryId);
|
||||
}
|
||||
|
||||
if (headerDataList.size() > 0) {
|
||||
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
|
||||
//Child Data
|
||||
childDataList = db.getStockAndFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getStockAndFacingSKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
//Header Data
|
||||
headerDataList = db.getStockAndFacingHeader_AfterSaveData(categoryId);
|
||||
if (!(headerDataList.size() > 0)) {
|
||||
headerDataList = db.getStockAndFacingHeaderData(categoryId);
|
||||
}
|
||||
}
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
if (headerDataList.size() > 0) {
|
||||
|
||||
for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListHeaderData.add(headerDataList.get(i));
|
||||
|
||||
//Child Data
|
||||
childDataList = db.getStockAndFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
if (!(childDataList.size() > 0)) {
|
||||
childDataList = db.getStockAndFacingSKUData(categoryId, headerDataList.get(i).getBrand_id());
|
||||
}
|
||||
|
||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||
}
|
||||
}
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
@@ -281,65 +318,66 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
img_camera1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String date = new Date().toLocaleString().toString();
|
||||
String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||
//String date = new Date().toLocaleString().toString();
|
||||
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||
|
||||
_pathforcheck = "Stock Camera1_" + tempDate + ".jpg";
|
||||
_pathforcheck = "Stock_Cam1_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||
child_position = groupPosition;
|
||||
path = str + _pathforcheck;
|
||||
|
||||
startCameraActivity(groupPosition);
|
||||
startCameraActivity1(groupPosition);
|
||||
}
|
||||
});
|
||||
|
||||
if (!img1.equalsIgnoreCase("")) {
|
||||
if (groupPosition == child_position) {
|
||||
//headerTitle.setImg_cam(img1);
|
||||
headerTitle.setImage1(img1);
|
||||
img1 = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if (headerTitle.getImg_cam().equals("")) {
|
||||
img_camera1.setBackgroundResource(R.drawable.ic_menu_camera);
|
||||
if (headerTitle.getImage1().equals("")) {
|
||||
img_camera1.setBackgroundResource(R.mipmap.camera);
|
||||
} else {
|
||||
//img_camera1.setBackgroundResource(R.drawable.camtick);
|
||||
}*/
|
||||
img_camera1.setBackgroundResource(R.mipmap.camera_done);
|
||||
}
|
||||
|
||||
/*img_camera.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
img_camera2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String date = new Date().toLocaleString().toString();
|
||||
String TempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||
//String date = new Date().toLocaleString().toString();
|
||||
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||
|
||||
_pathforcheck = "Stock" + headerTitle.getBrand_cd() + "_" + store_cd + "_" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
|
||||
_pathforcheck = "Stock_Cam2_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||
child_position = groupPosition;
|
||||
path = str + _pathforcheck;
|
||||
|
||||
startCameraActivity(groupPosition);
|
||||
startCameraActivity2(groupPosition);
|
||||
}
|
||||
});
|
||||
|
||||
if (!img1.equalsIgnoreCase("")) {
|
||||
if (!img2.equalsIgnoreCase("")) {
|
||||
if (groupPosition == child_position) {
|
||||
headerTitle.setImg_cam(img1);
|
||||
img1 = "";
|
||||
headerTitle.setImage2(img2);
|
||||
img2 = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (headerTitle.getImg_cam().equals("")) {
|
||||
img_camera.setBackgroundResource(R.drawable.cam);
|
||||
if (headerTitle.getImage2().equals("")) {
|
||||
img_camera2.setBackgroundResource(R.mipmap.camera);
|
||||
} else {
|
||||
img_camera.setBackgroundResource(R.drawable.camtick);
|
||||
img_camera2.setBackgroundResource(R.mipmap.camera_done);
|
||||
}
|
||||
|
||||
|
||||
if (!checkflag) {
|
||||
if (checkHeaderArray.contains(groupPosition)) {
|
||||
txt_header.setTextColor(getResources().getColor(R.color.red));
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else {
|
||||
txt_header.setTextColor(getResources().getColor(R.color.grey_dark));
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@@ -475,6 +513,29 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
holder.ed_facing.setText(childData.getFacing());
|
||||
|
||||
if (!checkflag) {
|
||||
boolean tempflag = false;
|
||||
|
||||
if (holder.ed_stock.getText().toString().equals("")) {
|
||||
holder.ed_stock.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
holder.ed_stock.setHintTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
holder.ed_stock.setHint("Empty");
|
||||
tempflag = true;
|
||||
}
|
||||
|
||||
if (holder.ed_facing.getText().toString().equals("")) {
|
||||
holder.ed_facing.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
holder.ed_facing.setHintTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
holder.ed_facing.setHint("Empty");
|
||||
tempflag = true;
|
||||
}
|
||||
|
||||
if (tempflag) {
|
||||
holder.cardView.setCardBackgroundColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else {
|
||||
holder.cardView.setCardBackgroundColor(getResources().getColor(R.color.white));
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@@ -497,23 +558,97 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
LinearLayout lin_category;
|
||||
}
|
||||
|
||||
private void startCameraActivity(int position) {
|
||||
boolean validateData(List<Stock_FacingGetterSetter> listDataHeader,
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listDataChild) {
|
||||
boolean flag = true;
|
||||
checkHeaderArray.clear();
|
||||
|
||||
for (int i = 0; i < listDataHeader.size(); i++) {
|
||||
String imagePath = listDataHeader.get(i).getImage1();
|
||||
String imagePath1 = listDataHeader.get(i).getImage2();
|
||||
|
||||
for (int j = 0; j < listDataChild.get(listDataHeader.get(i)).size(); j++) {
|
||||
String stock = listDataChild.get(listDataHeader.get(i)).get(j).getStock();
|
||||
String faceup = listDataChild.get(listDataHeader.get(i)).get(j).getFacing();
|
||||
|
||||
if (!imagePath.equals("") || !imagePath1.equals("")) {
|
||||
if (!stock.equals("0")) {
|
||||
if (stock.equals("") || faceup.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please fill all the data";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (stock.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please fill all the data";
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please click either 1 image";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag == false) {
|
||||
checkflag = false;
|
||||
break;
|
||||
} else {
|
||||
checkflag = true;
|
||||
}
|
||||
}
|
||||
//expListView.invalidate();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
return checkflag;
|
||||
}
|
||||
|
||||
private void startCameraActivity1(int position) {
|
||||
try {
|
||||
Log.e("Stock & Facing ", "startCameraActivity()");
|
||||
/*Log.e("Stock and Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
/*String defaultCameraPackage = "";
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
startActivityForResult(intent, position);*/
|
||||
|
||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
// Log.d("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
// Log.d("TAG", "package name : " + list.get(n).packageName);
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
/*Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
Log.e("TAG", "package name : " + list.get(n).packageName);*/
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -521,11 +656,55 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, position);*/
|
||||
startActivityForResult(intent, 1);
|
||||
//startActivityForResult(intent, position);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void startCameraActivity2(int position) {
|
||||
try {
|
||||
/*Log.e("Stock and Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
startActivityForResult(intent, position);
|
||||
startActivityForResult(intent, position);*/
|
||||
|
||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
/*Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
Log.e("TAG", "package name : " + list.get(n).packageName);*/
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 2);
|
||||
//startActivityForResult(intent, position);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -534,7 +713,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.e("Stock & Facing", "resultCode: " + resultCode);
|
||||
switch (resultCode) {
|
||||
/*switch (resultCode) {
|
||||
case 0:
|
||||
Log.e("Stock & Facing", "User cancelled");
|
||||
break;
|
||||
@@ -542,13 +721,41 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
img1 = _pathforcheck;
|
||||
//adapter.notifyDataSetChanged();
|
||||
adapter.notifyDataSetChanged();
|
||||
_pathforcheck = "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}*/
|
||||
|
||||
switch (requestCode) {
|
||||
case 1:
|
||||
if (resultCode == -1) {
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
img1 = _pathforcheck;
|
||||
adapter.notifyDataSetChanged();
|
||||
_pathforcheck = "";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("Stock & Facing", "User cancelled");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (resultCode == -1) {
|
||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||
if (new File(str + _pathforcheck).exists()) {
|
||||
img2 = _pathforcheck;
|
||||
adapter.notifyDataSetChanged();
|
||||
_pathforcheck = "";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("Stock & Facing", "User cancelled");
|
||||
}
|
||||
break;
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,636 @@
|
||||
package cpm.com.gskmtorange.upload;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
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.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
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;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
|
||||
public class UploadActivity extends AppCompatActivity {
|
||||
|
||||
private Dialog dialog;
|
||||
private ProgressBar pb;
|
||||
private TextView percentage, message;
|
||||
GSKOrangeDB db;
|
||||
ArrayList<CoverageBean> coverageList;
|
||||
|
||||
private FailureGetterSetter failureGetterSetter = null;
|
||||
private SharedPreferences preferences;
|
||||
String date, userId, app_version;
|
||||
|
||||
StoreBean storeData;
|
||||
String datacheck = "";
|
||||
String[] words;
|
||||
String validity;
|
||||
int mid;
|
||||
private int factor, k = 0;
|
||||
String errormsg = "", Path;
|
||||
|
||||
Data data;
|
||||
|
||||
ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList;
|
||||
ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_upload);
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
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(this);
|
||||
db.open();
|
||||
|
||||
Path = CommonString.FILE_PATH;
|
||||
|
||||
//start upload
|
||||
new UploadTask(this).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]"
|
||||
+ "[OUT_TIME]" + "00:00" + "[/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]));
|
||||
|
||||
|
||||
//MSL_Availability
|
||||
String mslAvailability_xml = "";
|
||||
onXML = "";
|
||||
msl_availabilityList = db.getMSL_AvailabilityUploadServerData(coverageList.get(i).getStoreId());
|
||||
|
||||
if (msl_availabilityList.size() > 0) {
|
||||
for (int j = 0; j < msl_availabilityList.size(); j++) {
|
||||
if (!msl_availabilityList.get(j).getSku_id().equals("0")) {
|
||||
|
||||
onXML = "[MSL_AVAILABILITY_DATA]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(msl_availabilityList.get(j).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[BRAND_ID]" + Integer.parseInt(msl_availabilityList.get(j).getBrand_id()) + "[/BRAND_ID]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(msl_availabilityList.get(j).getSku_id()) + "[/SKU_ID]"
|
||||
//+ "[SKU]" + msl_availabilityList.get(j).getSku() + "[/SKU]"
|
||||
+ "[TOGGLE_VALUE]" + Integer.parseInt(msl_availabilityList.get(j).getToggleValue()) + "[/TOGGLE_VALUE]"
|
||||
+ "[/MSL_AVAILABILITY_DATA]";
|
||||
|
||||
mslAvailability_xml = mslAvailability_xml + onXML;
|
||||
}
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + mslAvailability_xml + "[/DATA]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", sos_xml);
|
||||
request.addProperty("KEYS", "MSL_AVAILABILITY_DATA");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = (Object) envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
}
|
||||
data.value = 10;
|
||||
data.name = "MSL_Availability Uploading";
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Stock and Facing
|
||||
String stock_facing_xml = "";
|
||||
onXML = "";
|
||||
stock_facingHeaderList = db.getStockAndFacingHeaderServerUploadData(coverageList.get(i).getStoreId());
|
||||
|
||||
if (stock_facingHeaderList.size() > 0) {
|
||||
for (int i1 = 0; i1 < stock_facingHeaderList.size(); i1++) {
|
||||
if (!stock_facingHeaderList.get(i1).getCategory_id().equals("0")) {
|
||||
|
||||
stock_facingChildList = db.getStockAndFacingSKUServerUploadData(
|
||||
stock_facingHeaderList.get(i1).getCategory_id(), stock_facingHeaderList.get(i1).getBrand_id());
|
||||
|
||||
String stockChildXML = "";
|
||||
for (int j = 0; j < stock_facingChildList.size(); j++) {
|
||||
|
||||
stockChildXML = "[STOCK_FACING_DATA]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(stock_facingHeaderList.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_ID]" + Integer.parseInt(stock_facingHeaderList.get(i1).getSub_category_id()) + "[/SUB_CATEGORY_ID]"
|
||||
+ "[BRAND_ID]" + Integer.parseInt(stock_facingHeaderList.get(i1).getBrand_id()) + "[/BRAND_ID]"
|
||||
+ "[IAMGE1]" + stock_facingHeaderList.get(i1).getImage1() + "[/IAMGE1]"
|
||||
+ "[IAMGE2]" + stock_facingHeaderList.get(i1).getImage2() + "[/IAMGE2]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(stock_facingChildList.get(j).getSku_id()) + "[/SKU_ID]"
|
||||
//+ "[SKU]" + stock_facingChildList.get(j).getSku() + "[/SKU]"
|
||||
+ "[STOCK]" + Integer.parseInt(stock_facingChildList.get(j).getStock()) + "[/STOCK]"
|
||||
+ "[FACEUP]" + Integer.parseInt(stock_facingChildList.get(j).getFacing()) + "[/FACEUP]"
|
||||
+ "[/STOCK_FACING_DATA]";
|
||||
|
||||
onXML = onXML + stockChildXML;
|
||||
}
|
||||
stock_facing_xml = stock_facing_xml + onXML;
|
||||
}
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + stock_facing_xml + "[/DATA]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", sos_xml);
|
||||
request.addProperty("KEYS", "STOCK_FACING_DATA");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = (Object) envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
}
|
||||
data.value = 20;
|
||||
data.name = "Stock Facing Uploading";
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Promo Compliance - Promotion Data
|
||||
String promoition_data_xml = "";
|
||||
onXML = "";
|
||||
promotionSkuList = db.getPromoComplianceSkuServerUploadData(coverageList.get(i).getStoreId());
|
||||
|
||||
if (promotionSkuList.size() > 0) {
|
||||
for (int i1 = 0; i1 < promotionSkuList.size(); i1++) {
|
||||
if (!promotionSkuList.get(i1).getCategory_id().equals("0")) {
|
||||
|
||||
onXML = "[PROMOTION_DATA]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(promotionSkuList.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[PROMO_ID]" + Integer.parseInt(promotionSkuList.get(i1).getPromo_id()) + "[/PROMO_ID]"
|
||||
//+ "[SKU]" + promotionSkuList.get(i1).getSku() + "[/SKU]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(promotionSkuList.get(i1).getSku_id()) + "[/SKU_ID]"
|
||||
+ "[IN_STOCK]" + Integer.parseInt(promotionSkuList.get(i1).getIn_stock()) + "[/IN_STOCK]"
|
||||
+ "[PROMO_ANNOUNCER]" + Integer.parseInt(promotionSkuList.get(i1).getPromo_announcer()) + "[/PROMO_ANNOUNCER]"
|
||||
+ "[RUNNING_POS]" + Integer.parseInt(promotionSkuList.get(i1).getRunning_pos()) + "[/RUNNING_POS]"
|
||||
+ "[/PROMOTION_DATA]";
|
||||
|
||||
promoition_data_xml = promoition_data_xml + onXML;
|
||||
}
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + promoition_data_xml + "[/DATA]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", sos_xml);
|
||||
request.addProperty("KEYS", "PROMOTION_DATA");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = (Object) envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
}
|
||||
data.value = 30;
|
||||
data.name = "Promotion Data Uploading";
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Promo Compliance -Additional Promotion Data
|
||||
String additional_promoition_data_xml = "";
|
||||
onXML = "";
|
||||
additionalPromotionList = db.getAdditionalPromotionServerUploadData(coverageList.get(i).getStoreId());
|
||||
|
||||
if (additionalPromotionList.size() > 0) {
|
||||
for (int i1 = 0; i1 < additionalPromotionList.size(); i1++) {
|
||||
if (!additionalPromotionList.get(i1).getCategory_id().equals("0")) {
|
||||
|
||||
onXML = "[ADDITIONAL_PROMOTION_DATA]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[CATEGORY_ID]" + Integer.parseInt(additionalPromotionList.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||
+ "[PROMO_ID]" + Integer.parseInt(additionalPromotionList.get(i1).getPromo_id()) + "[/PROMO_ID]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(additionalPromotionList.get(i1).getSku_id()) + "[/SKU_ID]"
|
||||
//+ "[SKU]" + additionalPromotionList.get(i1).getSku() + "[/SKU]"
|
||||
+ "[IN_STOCK]" + Integer.parseInt(additionalPromotionList.get(i1).getIn_stock()) + "[/IN_STOCK]"
|
||||
+ "[PROMO_ANNOUNCER]" + Integer.parseInt(additionalPromotionList.get(i1).getPromo_announcer()) + "[/PROMO_ANNOUNCER]"
|
||||
+ "[RUNNING_POS]" + Integer.parseInt(additionalPromotionList.get(i1).getRunning_pos()) + "[/RUNNING_POS]"
|
||||
+ "[/ADDITIONAL_PROMOTION_DATA]";
|
||||
|
||||
additional_promoition_data_xml = additional_promoition_data_xml + onXML;
|
||||
}
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + additional_promoition_data_xml + "[/DATA]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", sos_xml);
|
||||
request.addProperty("KEYS", "ADDITIONAL_PROMOTION_DATA");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = (Object) envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
}
|
||||
data.value = 35;
|
||||
data.name = "Additional Promotion Data Uploading";
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Image Upload
|
||||
|
||||
//Stock Facing Images Upload
|
||||
if (stock_facingHeaderList.size() > 0) {
|
||||
for (int i1 = 0; i1 < stock_facingHeaderList.size(); i1++) {
|
||||
|
||||
if (stock_facingHeaderList.get(i1).getImage1() != null && !stock_facingHeaderList.get(i1).getImage1().equals("")) {
|
||||
if (new File(CommonString.FILE_PATH + stock_facingHeaderList.get(i1).getImage1()).exists()) {
|
||||
|
||||
try {
|
||||
result = UploadImage(stock_facingHeaderList.get(i1).getImage1(), "StockImages");
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return "StockImages";
|
||||
}
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
message.setText("StockFacing Images Uploaded");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stock_facingHeaderList.get(i1).getImage2() != null && !stock_facingHeaderList.get(i1).getImage2().equals("")) {
|
||||
if (new File(CommonString.FILE_PATH + stock_facingHeaderList.get(i1).getImage2()).exists()) {
|
||||
|
||||
try {
|
||||
result = UploadImage(stock_facingHeaderList.get(i1).getImage2(), "StockImages");
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return "StockImages";
|
||||
}
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
message.setText("StockFacing Images Uploaded");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SET COVERAGE STATUS
|
||||
String final_xml = "";
|
||||
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]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_COVERAGE_STATUS);
|
||||
request.addProperty("onXML", sos_xml);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
k = k + factor;
|
||||
data.value = k;
|
||||
data.name = "Uploading";
|
||||
publishProgress(data);
|
||||
|
||||
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);
|
||||
|
||||
dialog.dismiss();
|
||||
if (result.equals("")) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String UploadImage(String path, String folder_name) throws Exception {
|
||||
errormsg = "";
|
||||
BitmapFactory.Options o = new BitmapFactory.Options();
|
||||
o.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(Path + path, o);
|
||||
|
||||
// The new size we want to scale to
|
||||
final int REQUIRED_SIZE = 1639;
|
||||
|
||||
// Find the correct scale value. It should be the power of 2.
|
||||
int width_tmp = o.outWidth, height_tmp = o.outHeight;
|
||||
int scale = 1;
|
||||
|
||||
while (true) {
|
||||
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
|
||||
break;
|
||||
width_tmp /= 2;
|
||||
height_tmp /= 2;
|
||||
scale *= 2;
|
||||
}
|
||||
|
||||
// Decode with inSampleSize
|
||||
BitmapFactory.Options o2 = new BitmapFactory.Options();
|
||||
o2.inSampleSize = scale;
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
|
||||
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
|
||||
byte[] ba = bao.toByteArray();
|
||||
String ba1 = Base64.encodeBytes(ba);
|
||||
|
||||
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
|
||||
|
||||
String[] split = path.split("/");
|
||||
String path1 = split[split.length - 1];
|
||||
|
||||
request.addProperty("img", ba1);
|
||||
request.addProperty("name", path1);
|
||||
request.addProperty("FolderName", folder_name);
|
||||
|
||||
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
|
||||
|
||||
Object result = (Object) envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
||||
return CommonString.KEY_FALSE;
|
||||
}
|
||||
|
||||
SAXParserFactory saxPF = SAXParserFactory.newInstance();
|
||||
SAXParser saxP = saxPF.newSAXParser();
|
||||
XMLReader xmlR = saxP.getXMLReader();
|
||||
|
||||
// for failure
|
||||
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
|
||||
xmlR.setContentHandler(failureXMLHandler);
|
||||
|
||||
InputSource is = new InputSource();
|
||||
is.setCharacterStream(new StringReader(result.toString()));
|
||||
xmlR.parse(is);
|
||||
|
||||
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
|
||||
|
||||
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
errormsg = failureGetterSetter.getErrorMsg();
|
||||
return CommonString.KEY_FAILURE;
|
||||
}
|
||||
} else {
|
||||
//new File(Path + path).delete();
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by gagang on 06-01-2017.
|
||||
*/
|
||||
|
||||
public class MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter {
|
||||
String table_MAPPING_ADDITIONAL_PROMOTION;
|
||||
|
||||
ArrayList<String> STORE_ID = new ArrayList<>();
|
||||
ArrayList<String> SKU_ID = new ArrayList<>();
|
||||
ArrayList<String> SKU = new ArrayList<>();
|
||||
ArrayList<String> PROMO_ID = new ArrayList<>();
|
||||
ArrayList<String> PROMO = new ArrayList<>();
|
||||
|
||||
public String getTable_MAPPING_ADDITIONAL_PROMOTION() {
|
||||
return table_MAPPING_ADDITIONAL_PROMOTION;
|
||||
}
|
||||
|
||||
public void setTable_MAPPING_ADDITIONAL_PROMOTION(String table_MAPPING_ADDITIONAL_PROMOTION) {
|
||||
this.table_MAPPING_ADDITIONAL_PROMOTION = table_MAPPING_ADDITIONAL_PROMOTION;
|
||||
}
|
||||
|
||||
public ArrayList<String> getSTORE_ID() {
|
||||
return STORE_ID;
|
||||
}
|
||||
|
||||
public void setSTORE_ID(String STORE_ID) {
|
||||
this.STORE_ID.add(STORE_ID);
|
||||
}
|
||||
|
||||
public ArrayList<String> getSKU_ID() {
|
||||
return SKU_ID;
|
||||
}
|
||||
|
||||
public void setSKU_ID(String SKU_ID) {
|
||||
this.SKU_ID.add(SKU_ID);
|
||||
}
|
||||
|
||||
public ArrayList<String> getSKU() {
|
||||
return SKU;
|
||||
}
|
||||
|
||||
public void setSKU(String SKU) {
|
||||
this.SKU.add(SKU);
|
||||
}
|
||||
|
||||
public ArrayList<String> getPROMO_ID() {
|
||||
return PROMO_ID;
|
||||
}
|
||||
|
||||
public void setPROMO_ID(String PROMO_ID) {
|
||||
this.PROMO_ID.add(PROMO_ID);
|
||||
}
|
||||
|
||||
public ArrayList<String> getPROMO() {
|
||||
return PROMO;
|
||||
}
|
||||
|
||||
public void setPROMO(String PROMO) {
|
||||
this.PROMO.add(PROMO);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
public class MSL_AvailabilityGetterSetter {
|
||||
String sub_category_id, sub_category, brand_id, brand,
|
||||
sku_id, sku, mrp, sku_sequence, toggleValue,mbq;
|
||||
sku_id, sku, mrp, sku_sequence, toggleValue,mbq,category_id;
|
||||
|
||||
public String getSub_category_id() {
|
||||
return sub_category_id;
|
||||
@@ -87,4 +87,12 @@ public class MSL_AvailabilityGetterSetter {
|
||||
public void setMbq(String mbq) {
|
||||
this.mbq = mbq;
|
||||
}
|
||||
|
||||
public String getCategory_id() {
|
||||
return category_id;
|
||||
}
|
||||
|
||||
public void setCategory_id(String category_id) {
|
||||
this.category_id = category_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||
*/
|
||||
|
||||
public class MappingPromotionGetterSetter {
|
||||
|
||||
String table_MAPPING_PROMOTION;
|
||||
|
||||
ArrayList<String> STORE_ID = new ArrayList<>();
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by gagang on 06-01-2017.
|
||||
*/
|
||||
|
||||
public class Promo_Compliance_DataGetterSetter {
|
||||
String store_id, sku_id, sku, promo_id, promo, in_stock, promo_announcer, running_pos, sp_promo, category_id;
|
||||
|
||||
public String getStore_id() {
|
||||
return store_id;
|
||||
}
|
||||
|
||||
public void setStore_id(String store_id) {
|
||||
this.store_id = store_id;
|
||||
}
|
||||
|
||||
public String getSku_id() {
|
||||
return sku_id;
|
||||
}
|
||||
|
||||
public void setSku_id(String sku_id) {
|
||||
this.sku_id = sku_id;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getPromo_id() {
|
||||
return promo_id;
|
||||
}
|
||||
|
||||
public void setPromo_id(String promo_id) {
|
||||
this.promo_id = promo_id;
|
||||
}
|
||||
|
||||
public String getPromo() {
|
||||
return promo;
|
||||
}
|
||||
|
||||
public void setPromo(String promo) {
|
||||
this.promo = promo;
|
||||
}
|
||||
|
||||
public String getIn_stock() {
|
||||
return in_stock;
|
||||
}
|
||||
|
||||
public void setIn_stock(String in_stock) {
|
||||
this.in_stock = in_stock;
|
||||
}
|
||||
|
||||
public String getPromo_announcer() {
|
||||
return promo_announcer;
|
||||
}
|
||||
|
||||
public void setPromo_announcer(String promo_announcer) {
|
||||
this.promo_announcer = promo_announcer;
|
||||
}
|
||||
|
||||
public String getRunning_pos() {
|
||||
return running_pos;
|
||||
}
|
||||
|
||||
public void setRunning_pos(String running_pos) {
|
||||
this.running_pos = running_pos;
|
||||
}
|
||||
|
||||
public String getSp_promo() {
|
||||
return sp_promo;
|
||||
}
|
||||
|
||||
public void setSp_promo(String sp_promo) {
|
||||
this.sp_promo = sp_promo;
|
||||
}
|
||||
|
||||
public String getCategory_id() {
|
||||
return category_id;
|
||||
}
|
||||
|
||||
public void setCategory_id(String category_id) {
|
||||
this.category_id = category_id;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 28-12-2016.
|
||||
*/
|
||||
|
||||
public class SkuGetterSetter {
|
||||
String SKU_ID, SKU, BRAND_ID, MRP, SKU_SEQUENCE;
|
||||
String SKU_ID, SKU, BRAND_ID, BRAND, MRP, SKU_SEQUENCE,STOCK;
|
||||
|
||||
public String getSKU_ID() {
|
||||
return SKU_ID;
|
||||
@@ -48,4 +46,20 @@ public class SkuGetterSetter {
|
||||
public void setSKU_SEQUENCE(String SKU_SEQUENCE) {
|
||||
this.SKU_SEQUENCE = SKU_SEQUENCE;
|
||||
}
|
||||
|
||||
public String getBRAND() {
|
||||
return BRAND;
|
||||
}
|
||||
|
||||
public void setBRAND(String BRAND) {
|
||||
this.BRAND = BRAND;
|
||||
}
|
||||
|
||||
public String getSTOCK() {
|
||||
return STOCK;
|
||||
}
|
||||
|
||||
public void setSTOCK(String STOCK) {
|
||||
this.STOCK = STOCK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
*/
|
||||
|
||||
public class Stock_FacingGetterSetter {
|
||||
String sub_category_id, sub_category, brand_id, brand,
|
||||
String category_id, sub_category_id, sub_category, brand_id, brand,
|
||||
sku_id, sku, mrp, sku_sequence, stock, facing, mbq, company_id, image1, image2;
|
||||
|
||||
public String getSub_category_id() {
|
||||
@@ -119,4 +119,12 @@ public class Stock_FacingGetterSetter {
|
||||
public void setImage2(String image2) {
|
||||
this.image2 = image2;
|
||||
}
|
||||
|
||||
public String getCategory_id() {
|
||||
return category_id;
|
||||
}
|
||||
|
||||
public void setCategory_id(String category_id) {
|
||||
this.category_id = category_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 02-01-2017.
|
||||
*/
|
||||
@@ -9,6 +11,9 @@ public class T2PGetterSetter {
|
||||
String brand_id, display_id, brand, display, image, remark;
|
||||
boolean isPresent;
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = new ArrayList<>();
|
||||
ArrayList<SkuGetterSetter> skulist = new ArrayList<>();
|
||||
|
||||
public String getBrand_id() {
|
||||
return brand_id;
|
||||
}
|
||||
@@ -64,4 +69,20 @@ public class T2PGetterSetter {
|
||||
public void setPresent(boolean present) {
|
||||
isPresent = present;
|
||||
}
|
||||
|
||||
public ArrayList<GapsChecklistGetterSetter> getGapsChecklist() {
|
||||
return gapsChecklist;
|
||||
}
|
||||
|
||||
public void setGapsChecklist(ArrayList<GapsChecklistGetterSetter> gapsChecklist) {
|
||||
this.gapsChecklist = gapsChecklist;
|
||||
}
|
||||
|
||||
public ArrayList<SkuGetterSetter> getSkulist() {
|
||||
return skulist;
|
||||
}
|
||||
|
||||
public void setSkulist(ArrayList<SkuGetterSetter> skulist) {
|
||||
this.skulist = skulist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ public class TableBean {
|
||||
public static String NON_WORKING_REASON;
|
||||
public static String MAPPING_PROMOTION;
|
||||
|
||||
//Gagan start code
|
||||
public static String MAPPING_ADDITIONAL_PROMOTION;
|
||||
//Gagan end code
|
||||
|
||||
public static String getJourneyPlan() {
|
||||
return JOURNEY_PLAN;
|
||||
}
|
||||
@@ -114,4 +118,16 @@ public class TableBean {
|
||||
public static void setMappingPromotion(String mappingPromotion) {
|
||||
MAPPING_PROMOTION = mappingPromotion;
|
||||
}
|
||||
|
||||
//Gagan start code
|
||||
|
||||
public static String getMappingAdditionalPromotion() {
|
||||
return MAPPING_ADDITIONAL_PROMOTION;
|
||||
}
|
||||
|
||||
public static void setMappingAdditionalPromotion(String mappingAdditionalPromotion) {
|
||||
MAPPING_ADDITIONAL_PROMOTION = mappingAdditionalPromotion;
|
||||
}
|
||||
|
||||
//Gagan end code
|
||||
}
|
||||
|
||||
@@ -1,53 +1,47 @@
|
||||
package cpm.com.gskmtorange.xmlHandlers;
|
||||
|
||||
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
|
||||
public class FailureXMLHandler extends DefaultHandler{
|
||||
public class FailureXMLHandler extends DefaultHandler {
|
||||
|
||||
private String elementValue;
|
||||
private FailureGetterSetter failureGetterSetter = null;
|
||||
private String elementValue;
|
||||
private FailureGetterSetter failureGetterSetter = null;
|
||||
|
||||
|
||||
public FailureGetterSetter getFailureGetterSetter()
|
||||
{
|
||||
return failureGetterSetter;
|
||||
}
|
||||
public FailureGetterSetter getFailureGetterSetter() {
|
||||
return failureGetterSetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument() throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.startDocument();
|
||||
@Override
|
||||
public void startDocument() throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.startDocument();
|
||||
|
||||
failureGetterSetter = new FailureGetterSetter();
|
||||
}
|
||||
failureGetterSetter = new FailureGetterSetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.characters(ch, start, length);
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.characters(ch, start, length);
|
||||
|
||||
elementValue = new String(ch, start, length);
|
||||
}
|
||||
elementValue = new String(ch, start, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName)
|
||||
throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.endElement(uri, localName, qName);
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName)
|
||||
throws SAXException {
|
||||
// TODO Auto-generated method stub
|
||||
super.endElement(uri, localName, qName);
|
||||
|
||||
if(qName.equals("STATUS"))
|
||||
{
|
||||
failureGetterSetter.setStatus(elementValue);
|
||||
}
|
||||
else if(qName.equals("ERRORMSG"))
|
||||
{
|
||||
failureGetterSetter.setErrorMsg(elementValue);
|
||||
}
|
||||
}
|
||||
if (qName.equals("STATUS")) {
|
||||
failureGetterSetter.setStatus(elementValue);
|
||||
} else if (qName.equals("ERRORMSG")) {
|
||||
failureGetterSetter.setErrorMsg(elementValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
|
||||
@@ -191,7 +192,7 @@ public class XMLHandlers {
|
||||
|
||||
// SKU_MASTER XML HANDLER
|
||||
public static SkuMasterGetterSetter skuMasterXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
SkuMasterGetterSetter sku = new SkuMasterGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -231,7 +232,7 @@ public class XMLHandlers {
|
||||
|
||||
// BRAND_MASTER XML HANDLER
|
||||
public static BrandMasterGetterSetter brandMasterXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -308,7 +309,7 @@ public class XMLHandlers {
|
||||
|
||||
// CATEGORY_MASTER XML HANDLER
|
||||
public static CategoryMasterGetterSetter categoryMasterXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
CategoryMasterGetterSetter category = new CategoryMasterGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -374,7 +375,7 @@ public class XMLHandlers {
|
||||
|
||||
// MAPPING_STOCK XML HANDLER
|
||||
public static MappingStockGetterSetter mappingStockXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
MappingStockGetterSetter stock = new MappingStockGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -416,7 +417,7 @@ public class XMLHandlers {
|
||||
|
||||
// MAPPING_T2P XML HANDLER
|
||||
public static MAPPINGT2PGetterSetter mappingT2pXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
MAPPINGT2PGetterSetter t2p = new MAPPINGT2PGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -480,7 +481,7 @@ public class XMLHandlers {
|
||||
|
||||
// MAPPING_DISPLAY_CHECKLIST XML HANDLER
|
||||
public static MappingDisplayChecklistGetterSetter mappingMappingDisplayChecklistXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
MappingDisplayChecklistGetterSetter checklist = new MappingDisplayChecklistGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -510,7 +511,7 @@ public class XMLHandlers {
|
||||
|
||||
// NON_WORKING_REASON XML HANDLER
|
||||
public static NonWorkingReasonGetterSetter nonWorkingReasonXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
int eventType) {
|
||||
NonWorkingReasonGetterSetter reason = new NonWorkingReasonGetterSetter();
|
||||
|
||||
try {
|
||||
@@ -545,13 +546,13 @@ public class XMLHandlers {
|
||||
}
|
||||
|
||||
// MAPPING_PROMOTION XML HANDLER
|
||||
public static MappingPromotionGetterSetter mappingPromotionXMLHandler(XmlPullParser xpp,
|
||||
int eventType) {
|
||||
public static MappingPromotionGetterSetter mappingPromotionXMLHandler(XmlPullParser xpp, int eventType) {
|
||||
MappingPromotionGetterSetter t2p = new MappingPromotionGetterSetter();
|
||||
|
||||
try {
|
||||
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG) {
|
||||
|
||||
if (xpp.getName().equals("META_DATA")) {
|
||||
t2p.setTable_MAPPING_PROMOTION(xpp.nextText());
|
||||
}
|
||||
@@ -574,12 +575,51 @@ public class XMLHandlers {
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return t2p;
|
||||
}
|
||||
|
||||
//Gagan Start Code
|
||||
|
||||
//MAPPING_ADDITIONAL_PROMOTION
|
||||
public static MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter mappingAdditionalPromotionXMLHandler(XmlPullParser xpp, int eventType) {
|
||||
MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter map = new MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter();
|
||||
|
||||
try {
|
||||
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG) {
|
||||
|
||||
if (xpp.getName().equals("META_DATA")) {
|
||||
map.setTable_MAPPING_ADDITIONAL_PROMOTION(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("STORE_ID")) {
|
||||
map.setSTORE_ID(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("SKU_ID")) {
|
||||
map.setSKU_ID(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("SKU")) {
|
||||
map.setSKU(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("PROMO_ID")) {
|
||||
map.setPROMO_ID(xpp.nextText());
|
||||
}
|
||||
if (xpp.getName().equals("PROMO")) {
|
||||
map.setPROMO(xpp.nextText());
|
||||
}
|
||||
}
|
||||
xpp.next();
|
||||
}
|
||||
} catch (XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//Gagan End Code
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.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">
|
||||
@@ -23,12 +22,11 @@
|
||||
<include layout="@layout/content_category_list" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:id="@+id/fab_category"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
app:srcCompat="@drawable/right_arrow" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="cpm.com.gskmtorange.gsk_dailyentry.PromoComplianceActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_promo_compliance" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
@@ -26,7 +26,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -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>
|
||||
@@ -23,7 +23,8 @@
|
||||
android:paddingTop="10dp"
|
||||
android:text="Category Performance"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black" />
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
android:paddingTop="10dp"
|
||||
android:text="Category Performance"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black" />
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
android:paddingTop="10dp"
|
||||
android:text="Daily Data Menu"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black" />
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
android:paddingTop="10dp"
|
||||
android:text="Must Have Availability"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black" />
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lin_category"
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/content_promo_compliance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="cpm.com.gskmtorange.gsk_dailyentry.PromoComplianceActivity"
|
||||
tools:showIn="@layout/activity_promo_compliance">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_promoComplianceName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#FFF1710F"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/title_activity_promo_compliance"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView_promoCompliance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--Promo sku List-->
|
||||
<LinearLayout
|
||||
android:id="@+id/lin_promo_sku"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_promo_sku"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorPrimaryDark" />
|
||||
|
||||
<!--Add Additional layout-->
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5dp"
|
||||
card_view:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="4">
|
||||
|
||||
<!--Additional Promo-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#70888888"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="@string/promo_compliance_additional_promo"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--Promo Spinner-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight=".8"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="@string/promo_compliance_promo"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sp_promo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.2" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--InStock, Promo Announcer, Running on Pos-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_inStock"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_add_InStock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_promoAnnouncer"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_add_promoAnnouncer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_runningPOS"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_add_runningPos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!--Add Button-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingRight="15dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:text="@string/promo_compliance_add"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<!--Additional List-->
|
||||
<View
|
||||
android:id="@+id/view_additional_promo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorPrimaryDark" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lin_addtional_promo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -23,7 +23,8 @@
|
||||
android:paddingTop="10dp"
|
||||
android:text="Stock Facing"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@android:color/black" />
|
||||
android:textColor="@android:color/black"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lin_category"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ProgressBar
|
||||
<!--<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
@@ -25,6 +25,54 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar1"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
android:layout_centerHorizontal="true" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="Uploading Data"
|
||||
android:textSize="@dimen/text_size_small" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_title"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar1"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/percentage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="5dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -31,6 +31,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="@dimen/custom_margin"
|
||||
android:padding="10dp"
|
||||
android:textSize="@dimen/text_size_xsmall"
|
||||
android:paddingLeft="@dimen/custom_margin"/>
|
||||
|
||||
@@ -41,3 +42,5 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@@ -45,6 +46,8 @@
|
||||
android:id="@+id/btn_is_present"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOn="Yes"
|
||||
android:textOff="No"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
android:background="@color/grey_background">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
card_view:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="@string/promo_compliance_promos_sku"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<!--Promo sku name-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_promoName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="MIGROS COMPLETE"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--InStock, Promo Announcer, Running on Pos-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_inStock"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--<ToggleButton
|
||||
android:id="@+id/toggle_inStock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="No"
|
||||
android:textOn="Yes" />-->
|
||||
<TextView
|
||||
android:id="@+id/txt_inStock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/yes"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_promoAnnouncer"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--<ToggleButton
|
||||
android:id="@+id/toggle_promoAnnouncer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="No"
|
||||
android:textOn="Yes" />-->
|
||||
<TextView
|
||||
android:id="@+id/txt_promoAnnouncer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/yes"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Running on POS"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!--<ToggleButton
|
||||
android:id="@+id/toggle_runningPos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="No"
|
||||
android:textOn="Yes" />-->
|
||||
<TextView
|
||||
android:id="@+id/txt_runningPos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/yes"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
card_view:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="@string/promo_compliance_promos_sku"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<!--Promo sku name-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_promoSkuName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="MIGROS COMPLETE"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/black" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--InStock, Promo Announcer, Running on Pos-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_inStock"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_inStock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_promoAnnouncer"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_promoAnnouncer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/promo_compliance_runningPOS"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/toggle_runningPos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@android:drawable/btn_star_big_off" />
|
||||
android:src="@mipmap/star" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_camera1"
|
||||
@@ -72,7 +72,7 @@
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:src="@android:drawable/ic_menu_edit" />
|
||||
android:src="@mipmap/no_camera" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
card_view:cardBackgroundColor="@android:color/white"
|
||||
card_view:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/brand"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_brand"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/brand" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/sku"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sku"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/sku" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/stock"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_stock"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/stock" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -91,8 +91,8 @@
|
||||
android:id="@+id/toggle_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/custom_margin"
|
||||
android:text="@string/brand"
|
||||
android:textOn="Yes"
|
||||
android:textOff="No"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
android:id="@+id/spinner_brand"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2" />
|
||||
|
||||
android:layout_weight="2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -106,7 +105,6 @@
|
||||
android:layout_weight="2"
|
||||
android:inputType="number" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -115,15 +113,36 @@
|
||||
android:background="@color/grey_background"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="@string/add" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add"/>
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/cancel"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:background="@color/grey_background"
|
||||
android:id="@+id/rec_sku"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
@@ -16,6 +16,7 @@
|
||||
<string name="menu_daily_download">Günlük Veri Indir</string>
|
||||
<string name="menu_upload_data">Veri Paylaş</string>
|
||||
<string name="menu_geotag">Coğrafi Konum</string>
|
||||
<string name="menu_export">Data Export</string>
|
||||
<string name="menu_exit">Çıkış</string>
|
||||
<string name="menu_setting">Ayarlar</string>
|
||||
<string name="menu_services">Hizmetler</string>
|
||||
@@ -41,4 +42,9 @@
|
||||
|
||||
<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>
|
||||
@@ -33,6 +33,9 @@
|
||||
<string name="stock">Stock</string>
|
||||
<string name="select">Select</string>
|
||||
<string name="add">Add</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
|
||||
|
||||
<string name="select_language">Please select language</string>
|
||||
@@ -53,9 +56,11 @@
|
||||
<string name="menu_setting">Setting</string>
|
||||
<string name="menu_services">Services</string>
|
||||
|
||||
<string name="title_activity_category_list">Category List</string>
|
||||
<string name="title_activity_t2_pcompliance">T2P Compliance</string>
|
||||
|
||||
<!--Gagan start code-->
|
||||
|
||||
<string name="title_activity_category_list">Category List</string>
|
||||
<string name="title_activity_category_wise_performance">Categorywise Performance</string>
|
||||
<string name="title_activity_daily_main_menu">Daily Data Menu</string>
|
||||
<string name="title_activity_msl__availability">Must Stock Availability</string>
|
||||
@@ -79,13 +84,12 @@
|
||||
<string name="stock_facing_faceup">Facing</string>
|
||||
<string name="stock_facing_sos_target">SOS Target</string>
|
||||
|
||||
<!--Gagan end code-->
|
||||
|
||||
<string name="title_geo_tag_activity_upload_data">Store Uploaded</string>
|
||||
<string name="title_geo_tag_activity_geo_data">Store Geo Data Uploaded</string>
|
||||
<string name="title_geo_tag_activity_geo_already_done">Store Already Geotagged</string>
|
||||
|
||||
|
||||
|
||||
<string name="title_store_list_activity_store_already_done">Store Already Uploaded</string>
|
||||
<string name="title_store_list_activity_store_data_uploaded">Store Data Uploaded</string>
|
||||
<string name="title_store_list_activity_store_already_checkout">Store Already Checkout</string>
|
||||
@@ -93,13 +97,29 @@
|
||||
<string name="title_store_list_activity_store_closed">Store Closed</string>
|
||||
<string name="title_store_list_activity_already_store_closed">Store Already Closed</string>
|
||||
|
||||
|
||||
|
||||
<string name="title_store_list_checkout_current">Please checkout from current store</string>
|
||||
<string name="title_store_list_checkout_Already_filled">Data already filled</string>
|
||||
|
||||
|
||||
<string name="title_store_list_download_data">Please Download Data First</string>
|
||||
<string name="enter_the_values">Enter the values</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-->
|
||||
<string name="title_activity_promo_compliance">Promotion Compliance</string>
|
||||
|
||||
<string name="promo_compliance_additional_promo">Additional Promos</string>
|
||||
<string name="promo_compliance_promo">Promos</string>
|
||||
<string name="promo_compliance_promos_sku">Promos SKU</string>
|
||||
<string name="promo_compliance_sku">SKU</string>
|
||||
<string name="promo_compliance_inStock">In Stock</string>
|
||||
<string name="promo_compliance_promoAnnouncer">Promo Announcer</string>
|
||||
<string name="promo_compliance_runningPOS">Running on POS</string>
|
||||
<string name="promo_compliance_add">Add</string>
|
||||
|
||||
<!--Gagan end new code 1-->
|
||||
|
||||
|
||||
<string name="AdditionalDisplay">Is there any Additional Display</string>
|
||||
<string name="Display">Display</string>
|
||||
|
||||