Merge branch 'master' into AC_VisibilityUpload
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
android:name=".dailyentry.T2PComplianceActivity"
|
||||
android:label="@string/title_activity_t2_pcompliance"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<!-- Gagan Start Declaration -->
|
||||
|
||||
Binary file not shown.
@@ -81,6 +81,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.execSQL(TableBean.getMappingDisplayChecklist());
|
||||
db.execSQL(TableBean.getMappingAdditionalPromotion());
|
||||
db.execSQL(TableBean.getMappingPromotion());
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
|
||||
@@ -91,6 +92,18 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKU);
|
||||
|
||||
//Gagan End
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
|
||||
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
|
||||
|
||||
db.execSQL(TableBean.getDisplayChecklistMaster());
|
||||
db.execSQL(TableBean.getMappingDisplayChecklist());
|
||||
|
||||
db.execSQL(TableBean.getNonWorkingReason());
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_COMPLIANCE);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_GAPS);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_SKU);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,7 +158,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
values.put("CAMERA_ALLOW", data.getCAMERA_ALLOW().get(i));
|
||||
values.put("GEO_TAG", data.getGEO_TAG().get(i));
|
||||
values.put("CHANNEL_ID", data.getCHANNEL_ID().get(i));
|
||||
|
||||
|
||||
db.insert("JOURNEY_PLAN", null, values);
|
||||
|
||||
@@ -256,6 +269,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "') As Brand", null);
|
||||
if (dbcursor != null) {
|
||||
|
||||
@@ -335,7 +349,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " + "where VISIT_DATE ='" + date + "'", null);
|
||||
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
|
||||
"where VISIT_DATE ='" + date + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
@@ -1457,9 +1472,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public void InsertAdditionalPromoData(Promo_Compliance_DataGetterSetter data, String category_id) {
|
||||
ContentValues values = new ContentValues();
|
||||
try {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
values.put("STORE_ID", Integer.parseInt(data.getStore_id()));
|
||||
values.put("CATEGORY_ID", Integer.parseInt(category_id));
|
||||
values.put("SKU_ID", Integer.parseInt(data.getSku_id()));
|
||||
@@ -1510,11 +1524,11 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public void InsertPromoSkuData(ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData, String category_id) {
|
||||
ContentValues values = new ContentValues();
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
for (int i = 0; i < promoSkuListData.size(); i++) {
|
||||
Promo_Compliance_DataGetterSetter data = promoSkuListData.get(i);
|
||||
|
||||
@@ -1574,7 +1588,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
//Gagan End Method
|
||||
|
||||
//Non Working data
|
||||
//Non Working data
|
||||
|
||||
public void insertNonWorkingData(NonWorkingReasonGetterSetter data) {
|
||||
db.delete("NON_WORKING_REASON", null, null);
|
||||
@@ -1657,8 +1671,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
|
||||
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
|
||||
"where VISIT_DATE ='" + date + "' AND STORE_ID='" + store_id + "'", null);
|
||||
"where VISIT_DATE ='" + date + "' AND STORE_ID'="+ store_id +"'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
@@ -1986,7 +2001,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return list;
|
||||
}
|
||||
//Gagan end new code 1
|
||||
|
||||
|
||||
public void InsertStockDialog(AdditionalDialogGetterSetter data) {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
@@ -2281,6 +2296,165 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.update("JOURNEY_PLAN", values, CommonString.KEY_STORE_ID + "='" + storeid + "' AND " + CommonString.KEY_VISIT_DATE + "='" + visitdate + "'", null);
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void InsertT2PData(ArrayList<T2PGetterSetter> data, String store_id, String category_id) {
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, CommonString.KEY_STORE_ID + "='" + store_id + "' AND " + CommonString.KEY_CATEGORY_ID + "='" + category_id + "'", null);
|
||||
|
||||
long l = 0;
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
ContentValues values2 = new ContentValues();
|
||||
try {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
||||
values.put(CommonString.KEY_STORE_ID, store_id);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, category_id);
|
||||
values.put(CommonString.KEY_DISPLAY_ID, data.get(i).getDisplay_id());
|
||||
values.put(CommonString.KEY_BRAND_ID, data.get(i).getBrand_id());
|
||||
values.put(CommonString.KEY_BRAND, data.get(i).getBrand());
|
||||
values.put(CommonString.KEY_DISPLAY, data.get(i).getDisplay());
|
||||
values.put(CommonString.KEY_IMAGE, data.get(i).getImage());
|
||||
values.put(CommonString.KEY_REMARK, data.get(i).getRemark());
|
||||
values.put(CommonString.KEY_PRESENT, data.get(i).isPresent());
|
||||
|
||||
l = db.insert(CommonString.TABLE_INSERT_T2P_COMPLIANCE, null, values);
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gaps = data.get(i).getGapsChecklist();
|
||||
|
||||
for (int j = 0; j < gaps.size(); j++) {
|
||||
|
||||
values1.put(CommonString.KEY_COMMON_ID, l);
|
||||
values1.put(CommonString.KEY_CHECKLIST_ID, gaps.get(j).getChecklist_id());
|
||||
values1.put(CommonString.KEY_DISPLAY_ID, gaps.get(j).getDisplay_id());
|
||||
values1.put(CommonString.KEY_CHECKLIST, gaps.get(j).getChecklist());
|
||||
values1.put(CommonString.KEY_PRESENT, gaps.get(j).isPresent());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_T2P_GAPS, null, values1);
|
||||
|
||||
}
|
||||
|
||||
ArrayList<SkuGetterSetter> sku = data.get(i).getSkulist();
|
||||
|
||||
for (int k = 0; k < sku.size(); k++) {
|
||||
|
||||
values2.put(CommonString.KEY_COMMON_ID, l);
|
||||
values2.put(CommonString.KEY_SKU_ID, sku.get(k).getSKU_ID());
|
||||
values2.put(CommonString.KEY_BRAND_ID, sku.get(k).getBRAND_ID());
|
||||
values2.put(CommonString.KEY_STOCK, sku.get(k).getSTOCK());
|
||||
values2.put(CommonString.KEY_BRAND, sku.get(k).getBRAND());
|
||||
values2.put(CommonString.KEY_SKU, sku.get(k).getSKU());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_T2P_SKU, null, values2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in T2P_COMPLIANCE " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// get T2P Compliance data
|
||||
public ArrayList<T2PGetterSetter> getT2pComplianceData(String store_id, String common_id) {
|
||||
|
||||
ArrayList<T2PGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
|
||||
CommonString.KEY_STORE_ID + "='" + store_id + "' AND " +
|
||||
CommonString.KEY_CATEGORY_ID + "='" + common_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
T2PGetterSetter tp = new T2PGetterSetter();
|
||||
|
||||
tp.setKey_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_ID)));
|
||||
tp.setDisplay_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY_ID)));
|
||||
tp.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
|
||||
tp.setBrand(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
|
||||
tp.setDisplay(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY)));
|
||||
tp.setImage(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE)));
|
||||
tp.setRemark(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_REMARK)));
|
||||
tp.setPresent((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_PRESENT)).equalsIgnoreCase("1")));
|
||||
|
||||
list.add(tp);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// get Gaps T2P data
|
||||
public ArrayList<GapsChecklistGetterSetter> getGapsData(String common_id) {
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_GAPS + " where " +
|
||||
CommonString.KEY_COMMON_ID + "='" + common_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
GapsChecklistGetterSetter gp = new GapsChecklistGetterSetter();
|
||||
|
||||
gp.setDisplay_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY_ID)));
|
||||
gp.setChecklist_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CHECKLIST_ID)));
|
||||
gp.setChecklist(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CHECKLIST)));
|
||||
gp.setPresent((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_PRESENT)).equalsIgnoreCase("1")));
|
||||
|
||||
list.add(gp);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// get T2P SKU data
|
||||
public ArrayList<SkuGetterSetter> getT2PSKUData(String common_id) {
|
||||
|
||||
ArrayList<SkuGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_SKU + " where " +
|
||||
CommonString.KEY_COMMON_ID + "='" + common_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
SkuGetterSetter gp = new SkuGetterSetter();
|
||||
|
||||
gp.setSKU_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SKU_ID)));
|
||||
gp.setBRAND_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
|
||||
gp.setSTOCK(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_STOCK)));
|
||||
gp.setBRAND(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
|
||||
gp.setSKU(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SKU)));
|
||||
|
||||
list.add(gp);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,16 @@ public class CommonString {
|
||||
public static final String KEY_ID = "Id";
|
||||
public static final String KEY_MERCHANDISER_ID = "MERCHANDISER_ID";
|
||||
|
||||
//KEYS RELATED TO T2P COMPLIANCE
|
||||
|
||||
public static final String KEY_DISPLAY = "DISPLAY";
|
||||
public static final String KEY_REMARK = "REMARK";
|
||||
public static final String KEY_PRESENT = "PRESENT";
|
||||
public static final String KEY_COMMON_ID = "COMMON_ID";
|
||||
public static final String KEY_CHECKLIST_ID = "CHECKLIST_ID";
|
||||
public static final String KEY_CHECKLIST = "CHECKLIST";
|
||||
public static final String KEY_SKU = "SKU";
|
||||
public static final String KEY_STOCK = "STOCK";
|
||||
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";
|
||||
@@ -332,6 +342,7 @@ 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 "
|
||||
@@ -343,14 +354,11 @@ public class CommonString {
|
||||
+ "STORE_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "CATEGORY_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU_ID"
|
||||
/*+ "SKU_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU"
|
||||
+ " VARCHAR,"
|
||||
+ " VARCHAR,"*/
|
||||
|
||||
+ "PROMO_ID"
|
||||
+ " INTEGER,"
|
||||
@@ -418,4 +426,53 @@ public class CommonString {
|
||||
+ KEY_IMAGE + " VARCHAR)";
|
||||
|
||||
|
||||
|
||||
//Tables related to T2p Compliance
|
||||
|
||||
public static final String TABLE_INSERT_T2P_COMPLIANCE = "T2P_COMPLIANCE";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_T2P_COMPLIANCE = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_T2P_COMPLIANCE
|
||||
+ "("
|
||||
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_STORE_ID + " INTEGER,"
|
||||
+ KEY_CATEGORY_ID + " INTEGER,"
|
||||
+ KEY_BRAND_ID + " INTEGER,"
|
||||
+ KEY_DISPLAY_ID + " INTEGER,"
|
||||
+ KEY_BRAND + " VARCHAR,"
|
||||
+ KEY_DISPLAY + " VARCHAR,"
|
||||
+ KEY_IMAGE + " VARCHAR,"
|
||||
+ KEY_REMARK + " VARCHAR,"
|
||||
+ KEY_PRESENT + " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
|
||||
|
||||
public static final String TABLE_INSERT_T2P_GAPS = "T2P_GAPS";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_T2P_GAPS = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_T2P_GAPS
|
||||
+ "("
|
||||
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_COMMON_ID + " INTEGER,"
|
||||
+ KEY_CHECKLIST_ID + " INTEGER,"
|
||||
+ KEY_DISPLAY_ID + " INTEGER,"
|
||||
+ KEY_CHECKLIST + " VARCHAR,"
|
||||
+ KEY_PRESENT + " VARCHAR"
|
||||
+ ")";
|
||||
|
||||
|
||||
public static final String TABLE_INSERT_T2P_SKU = "T2P_SKU";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_T2P_SKU = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_T2P_SKU
|
||||
+ "("
|
||||
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_COMMON_ID + " INTEGER,"
|
||||
+ KEY_SKU_ID + " INTEGER,"
|
||||
+ KEY_BRAND_ID + " INTEGER,"
|
||||
+ KEY_STOCK + " INTEGER,"
|
||||
+ KEY_BRAND+ " VARCHAR,"
|
||||
+ KEY_SKU + " VARCHAR"
|
||||
+ ")";
|
||||
}
|
||||
|
||||
+132
-40
@@ -4,12 +4,15 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
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.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -17,6 +20,7 @@ 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.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@@ -47,8 +51,11 @@ import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.LoginActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.fonts.FontManager;
|
||||
import cpm.com.gskmtorange.fonts.TextDrawable;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
||||
@@ -64,29 +71,31 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
T2PAdapter t2PAdapter;
|
||||
RecyclerView rec_t2p;
|
||||
|
||||
String categoryName, categoryId, storeId;
|
||||
String categoryName, categoryId;
|
||||
|
||||
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;
|
||||
|
||||
String error_msg;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_t2_pcompliance);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
//Intent data
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
// toolbar.setTitle(R.string.title_activity_t2_pcompliance + " - " + categoryName);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
db = new GSKOrangeDB(T2PComplianceActivity.this);
|
||||
db.open();
|
||||
|
||||
@@ -108,24 +117,47 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
finish();
|
||||
|
||||
if (isValid()) {
|
||||
|
||||
db.InsertT2PData(t2PGetterSetters, store_id, categoryId);
|
||||
|
||||
Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
|
||||
finish();
|
||||
} else {
|
||||
Snackbar.make(view, error_msg, Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
t2PGetterSetters = db.getT2PDefaultData(store_id);
|
||||
t2PGetterSetters = db.getT2pComplianceData(store_id, categoryId);
|
||||
|
||||
if (t2PGetterSetters.size() == 0) {
|
||||
t2PGetterSetters = db.getT2PDefaultData(store_id);
|
||||
} else {
|
||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||
ArrayList<GapsChecklistGetterSetter> gapsList = db.getGapsData(t2PGetterSetters.get(i).getKey_id());
|
||||
ArrayList<SkuGetterSetter> skuList = db.getT2PSKUData(t2PGetterSetters.get(i).getKey_id());
|
||||
|
||||
t2PGetterSetters.get(i).setGapsChecklist(gapsList);
|
||||
t2PGetterSetters.get(i).setSkulist(skuList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (t2PGetterSetters.size() > 0) {
|
||||
|
||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||
/* 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);
|
||||
@@ -133,9 +165,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -168,11 +197,16 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
holder.tv_brand.setText(mItem.getBrand());
|
||||
holder.tv_display.setText(mItem.getDisplay().trim());
|
||||
|
||||
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
|
||||
|
||||
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
|
||||
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
|
||||
*/
|
||||
holder.btn_gaps.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
showGapsDialog(mItem.getGapsChecklist());
|
||||
showGapsDialog(mItem);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -181,11 +215,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes")) {
|
||||
mItem.setPresent(true);
|
||||
} else {
|
||||
mItem.setPresent(false);
|
||||
}
|
||||
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
||||
|
||||
t2PAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@@ -217,13 +247,24 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
if (mItem.getImage().equals("")) {
|
||||
holder.img_cam.setBackgroundResource(R.drawable.cam_deactive);
|
||||
holder.img_cam.setBackgroundResource(R.mipmap.camera);
|
||||
} else {
|
||||
holder.img_cam.setBackgroundResource(R.drawable.cam_active);
|
||||
holder.img_cam.setBackgroundResource(R.mipmap.camera_done);
|
||||
}
|
||||
|
||||
holder.toggle_btn.setChecked(mItem.isPresent());
|
||||
|
||||
if (mItem.getGapsChecklist().size() > 0) {
|
||||
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.green));
|
||||
} else {
|
||||
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
}
|
||||
|
||||
if (mItem.getSkulist().size() > 0) {
|
||||
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.green));
|
||||
} else {
|
||||
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -261,8 +302,16 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void showGapsDialog(ArrayList<GapsChecklistGetterSetter> gapsChecklist) {
|
||||
//ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id);
|
||||
public void showGapsDialog(final T2PGetterSetter t2p) {
|
||||
|
||||
final ArrayList<GapsChecklistGetterSetter> gapsChecklist;
|
||||
|
||||
if (t2p.getGapsChecklist().size() > 0) {
|
||||
|
||||
gapsChecklist = t2p.getGapsChecklist();
|
||||
} else {
|
||||
gapsChecklist = db.getGapsDefaultData(t2p.getDisplay_id());
|
||||
}
|
||||
|
||||
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
@@ -279,8 +328,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
t2p.setGapsChecklist(gapsChecklist);
|
||||
dialog.cancel();
|
||||
|
||||
t2PAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -315,7 +365,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
final ArrayList<SkuGetterSetter> sku_list = new ArrayList<>();
|
||||
|
||||
if(skuAddedList.size()>0){
|
||||
if (skuAddedList.size() > 0) {
|
||||
|
||||
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
|
||||
@@ -327,11 +377,10 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if(brand_selected[0] ==null || sku_selected[0]==null || et_stock.getText().toString().equals("")){
|
||||
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{
|
||||
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));
|
||||
@@ -360,7 +409,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
brand_selected[0] = null;
|
||||
sku_selected[0] = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -369,7 +417,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
btn_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
dialog.cancel();
|
||||
t2PAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -394,13 +444,13 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
|
||||
sku_list.clear();
|
||||
|
||||
brand_selected[0] = brandList.get(position);
|
||||
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++){
|
||||
for (int k = 0; k < temp_list.size(); k++) {
|
||||
sku_list.add(temp_list.get(k));
|
||||
}
|
||||
|
||||
@@ -428,7 +478,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if(position!=0){
|
||||
if (position != 0) {
|
||||
|
||||
sku_selected[0] = sku_list.get(position);
|
||||
}
|
||||
@@ -470,9 +520,9 @@ 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);
|
||||
}
|
||||
|
||||
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -786,4 +836,46 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
boolean flag = true;
|
||||
|
||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||
|
||||
if (t2PGetterSetters.get(i).getImage().equals("")) {
|
||||
flag = false;
|
||||
error_msg = getResources().getString(R.string.click_image);
|
||||
break;
|
||||
} else if (t2PGetterSetters.get(i).getGapsChecklist().size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getResources().getString(R.string.fill_gaps_data);
|
||||
break;
|
||||
} else if (t2PGetterSetters.get(i).getSkulist().size() == 0) {
|
||||
flag = false;
|
||||
error_msg = getResources().getString(R.string.fill_sku_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
|
||||
builder.setTitle("Parinaam");
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
/* Intent i = new Intent(activity, StorelistActivity.class);
|
||||
activity.startActivity(i);
|
||||
activity.finish();*/
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cpm.com.gskmtorange.fonts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 11-01-2017.
|
||||
*/
|
||||
|
||||
public class FontManager {
|
||||
|
||||
public static final String ROOT = "fonts/",
|
||||
FONTAWESOME = ROOT + "fontawesome-webfont.ttf";
|
||||
|
||||
public static Typeface getTypeface(Context context, String font) {
|
||||
return Typeface.createFromAsset(context.getAssets(), font);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cpm.com.gskmtorange.fonts;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/**
|
||||
* Created by yadavendras on 11-01-2017.
|
||||
*/
|
||||
|
||||
public class TextDrawable extends Drawable {
|
||||
|
||||
private final String text;
|
||||
private final Paint paint;
|
||||
|
||||
public TextDrawable(String text) {
|
||||
|
||||
this.text = text;
|
||||
|
||||
this.paint = new Paint();
|
||||
paint.setColor(Color.WHITE);
|
||||
paint.setTextSize(22f);
|
||||
paint.setAntiAlias(true);
|
||||
paint.setFakeBoldText(true);
|
||||
paint.setShadowLayer(6f, 0, 0, Color.BLACK);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setTextAlign(Paint.Align.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
canvas.drawText(text, 0, 0, paint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
paint.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
paint.setColorFilter(cf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return PixelFormat.TRANSLUCENT;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class T2PGetterSetter {
|
||||
|
||||
String brand_id, display_id, brand, display, image, remark;
|
||||
String brand_id, display_id, brand, display, image, remark, key_id;
|
||||
boolean isPresent;
|
||||
|
||||
ArrayList<GapsChecklistGetterSetter> gapsChecklist = new ArrayList<>();
|
||||
@@ -85,4 +85,12 @@ public class T2PGetterSetter {
|
||||
public void setSkulist(ArrayList<SkuGetterSetter> skulist) {
|
||||
this.skulist = skulist;
|
||||
}
|
||||
|
||||
public String getKey_id() {
|
||||
return key_id;
|
||||
}
|
||||
|
||||
public void setKey_id(String key_id) {
|
||||
this.key_id = key_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textOn="Yes"
|
||||
android:textOff="No"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textOn="Yes"
|
||||
android:textOff="No"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/cancel"/>
|
||||
android:text="@string/closed"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
<!-- <android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
@@ -176,5 +176,5 @@
|
||||
android:fastScrollEnabled="true"
|
||||
android:smoothScrollbar="true"></ListView>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</android.support.v7.widget.CardView>-->
|
||||
</LinearLayout>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:title="@string/menu_daily_download" />
|
||||
<item
|
||||
android:id="@+id/nav_upload"
|
||||
android:icon="@drawable/ic_menu_send"
|
||||
android:icon="@drawable/ic_menu_manage"
|
||||
android:title="@string/menu_upload_data" />
|
||||
<item
|
||||
android:id="@+id/nav_geotag"
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
<color name="colorOrange">#FFE0B2</color>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="fa_icon_areachart"></string>
|
||||
<string name="fa_icon_piechart"></string>
|
||||
<string name="fa_icon_linechart"></string>
|
||||
</resources>
|
||||
@@ -34,9 +34,6 @@
|
||||
<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>
|
||||
<string name="title_activity_select_language">SelectLanguageActivity</string>
|
||||
@@ -99,9 +96,14 @@
|
||||
|
||||
<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="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
|
||||
<string name="title_activity_upload">Upload Data</string>
|
||||
<string name="no_data_for_upload">No Data For Upload</string>
|
||||
<string name="first_checkout_store">First checkout of store</string>
|
||||
@@ -126,5 +128,12 @@
|
||||
<string name="Photo">Photo</string>
|
||||
<string name="title_activity_Additional_visibility">Additional Visibility</string>
|
||||
<string name="title_activity_Non_Work">Non-Work Reason</string>
|
||||
<string name="closed">Close</string>
|
||||
|
||||
<string name="click_image">Please click image</string>
|
||||
<string name="fill_sku_data">Please fill SKU data</string>
|
||||
<string name="fill_gaps_data">Please fill GAP data</string>
|
||||
<string name="data_will_be_lost">Want to proceed usaved data will be deleted</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user