Icons
This commit is contained in:
@@ -1457,8 +1457,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public void InsertAdditionalPromoData(Promo_Compliance_DataGetterSetter data) {
|
||||
ContentValues values = new ContentValues();
|
||||
try {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
values.put("STORE_ID", Integer.parseInt(data.getStore_id()));
|
||||
values.put("PROMO_ID", Integer.parseInt(data.getPromo_id()));
|
||||
values.put("PROMO", data.getPromo());
|
||||
@@ -1504,14 +1505,16 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void InsertPromoSkuData(ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData) {
|
||||
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);
|
||||
|
||||
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()));
|
||||
values.put("SKU", data.getSku());
|
||||
values.put("PROMO_ID", Integer.parseInt(data.getPromo_id()));
|
||||
@@ -1529,6 +1532,41 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPromoComplianceData(String store_id, String category_id) {
|
||||
Log.d("PromoCompliance ", "PromoCompliance data--------------->Start<------------");
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Promo_SKU_Data " +
|
||||
"where CATEGORY_ID='" + category_id + "' and STORE_ID='" + store_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
if (dbcursor.moveToFirst()) {
|
||||
do {
|
||||
Promo_Compliance_DataGetterSetter sb = new Promo_Compliance_DataGetterSetter();
|
||||
|
||||
sb.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
|
||||
list.add(sb);
|
||||
} while (dbcursor.moveToNext());
|
||||
}
|
||||
dbcursor.close();
|
||||
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.d("Stock_Facing ", "midday---------------------->Stop<-----------");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Gagan End Method
|
||||
|
||||
//Non Working data
|
||||
@@ -1610,34 +1648,22 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
//Gagan start new code 1
|
||||
|
||||
public void updatePromoComplianceSKU(String storeId, String categoryId, List<Stock_FacingGetterSetter> hashMapListHeaderData,
|
||||
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData) {
|
||||
public void updatePromoComplianceSKU(ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData,
|
||||
String categoryId, String storeId) {
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
Stock_FacingGetterSetter data1 = hashMapListHeaderData.get(i);
|
||||
for (int i = 0; i < promoSkuListData.size(); i++) {
|
||||
Promo_Compliance_DataGetterSetter data = promoSkuListData.get(i);
|
||||
|
||||
values1.put("IMAGE1", data1.getImage1());
|
||||
values1.put("IMAGE2", data1.getImage2());
|
||||
values.put("IN_STOCK_VALUE", Integer.parseInt(data.getIn_stock()));
|
||||
values.put("PROMO_ANNOUNCER_VALUE", Integer.parseInt(data.getPromo_announcer()));
|
||||
values.put("RUNNING_POS_VALUE", Integer.parseInt(data.getRunning_pos()));
|
||||
|
||||
//db.insert(CommonString.TABLE_INSERT_STOCK_FACING_HEADER, null, values1);
|
||||
db.update(CommonString.TABLE_INSERT_STOCK_FACING_HEADER, values1,
|
||||
"Category_Id='" + categoryId + "' AND Store_Id='" + storeId + "' ", null);
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
Stock_FacingGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("STOCK_VALUE", data.getStock());
|
||||
values.put("FACEUP_VALUE", data.getFacing());
|
||||
|
||||
//db.insert(CommonString.TABLE_INSERT_STOCK_FACING_CHILD, null, values);
|
||||
db.update(CommonString.TABLE_INSERT_STOCK_FACING_CHILD, values,
|
||||
"Brand_Id ='" + hashMapListHeaderData.get(i).getBrand_id() + "' AND SKU_ID ='" + data.getSku_id() +
|
||||
"' AND Category_Id='" + categoryId + "' AND Store_Id='" + storeId + "'", null);
|
||||
}
|
||||
db.update(CommonString.TABLE_INSERT_PROMO_SKU, values,
|
||||
"CATEGORY_ID='" + categoryId + "' AND STORE_ID='" + storeId +
|
||||
"' AND SKU_ID='" + data.getSku_id() + "' AND PROMO_ID='" + data.getPromo_id() + "'", null);
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
@@ -1647,5 +1673,39 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoComplianceSkuAfterData(String store_id, String category_id) {
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select * from Promo_SKU_Data " +
|
||||
"where STORE_ID='" + store_id + "' AND CATEGORY_ID='" + category_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
Promo_Compliance_DataGetterSetter cd = new Promo_Compliance_DataGetterSetter();
|
||||
|
||||
cd.setStore_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORE_ID")));
|
||||
cd.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_ID")));
|
||||
cd.setSku(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU")));
|
||||
cd.setPromo_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PROMO_ID")));
|
||||
cd.setPromo(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PROMO")));
|
||||
cd.setIn_stock(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IN_STOCK_VALUE")));
|
||||
cd.setPromo_announcer(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PROMO_ANNOUNCER_VALUE")));
|
||||
cd.setRunning_pos(dbcursor.getString(dbcursor.getColumnIndexOrThrow("RUNNING_POS_VALUE")));
|
||||
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "getPromoComplianceSkuAfterData!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
//Gagan end new code 1
|
||||
}
|
||||
|
||||
@@ -303,6 +303,9 @@ public class CommonString {
|
||||
+ "STORE_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "CATEGORY_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
+ "SKU_ID"
|
||||
+ " INTEGER,"
|
||||
|
||||
|
||||
+50
-4
@@ -2,7 +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.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@@ -20,7 +23,9 @@ 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;
|
||||
|
||||
@@ -29,11 +34,17 @@ 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);
|
||||
try {
|
||||
setContentView(R.layout.activity_daily_data_menu);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
@@ -44,6 +55,21 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
|
||||
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");
|
||||
|
||||
@@ -58,42 +84,58 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
});*/
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
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));
|
||||
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_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_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_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_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();
|
||||
@@ -111,6 +153,10 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
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> {
|
||||
|
||||
+13
-2
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -60,6 +61,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
setContentView(R.layout.activity_msl__availability);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
@@ -97,7 +99,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onClick(final View view) {
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
@@ -109,11 +111,13 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
|
||||
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();
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
@@ -211,9 +215,13 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
try {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
|
||||
@@ -236,6 +244,9 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
|
||||
+61
-5
@@ -9,6 +9,8 @@ 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;
|
||||
@@ -33,7 +35,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
ToggleButton toggle_add_InStock, toggle_add_promoAnnouncer, toggle_add_runningPos;
|
||||
Button btn_add;
|
||||
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData, promoSkuListAfterData;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSpinnerListData;
|
||||
ArrayList<Promo_Compliance_DataGetterSetter> additionalPromoListData;
|
||||
|
||||
@@ -46,6 +48,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
setContentView(R.layout.activity_promo_compliance);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
@@ -86,7 +89,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
promoSkuListView();
|
||||
|
||||
additionalPromoListData = new ArrayList<>();
|
||||
//AdditionalPromoListView();
|
||||
AdditionalPromoListView();
|
||||
|
||||
final Promo_Compliance_DataGetterSetter cd = new Promo_Compliance_DataGetterSetter();
|
||||
cd.setStore_id(store_id);
|
||||
@@ -188,6 +191,11 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
db.InsertAdditionalPromoData(cd);
|
||||
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();
|
||||
}
|
||||
@@ -212,10 +220,14 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.InsertPromoSkuData(promoSkuListData);
|
||||
|
||||
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();
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
@@ -238,11 +250,18 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
};*/
|
||||
} 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);
|
||||
@@ -252,9 +271,13 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
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++) {
|
||||
@@ -325,9 +348,13 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
|
||||
lin_promo_sku.addView(view);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void AdditionalPromoListView() {
|
||||
try {
|
||||
additionalPromoListData.clear();
|
||||
lin_addtional_promo.removeAllViews();
|
||||
|
||||
@@ -371,5 +398,34 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
+17
-6
@@ -7,6 +7,7 @@ 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;
|
||||
@@ -76,6 +77,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
setContentView(R.layout.activity_stock_facing);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
@@ -113,7 +115,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onClick(final View view) {
|
||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
|
||||
@@ -127,11 +129,13 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
@@ -227,9 +231,13 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
try {
|
||||
hashMapListHeaderData = new ArrayList<>();
|
||||
hashMapListChildData = new HashMap<>();
|
||||
|
||||
@@ -256,6 +264,9 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
@@ -326,9 +337,9 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
if (headerTitle.getImage1().equals("")) {
|
||||
img_camera1.setBackgroundResource(R.drawable.ic_menu_camera);
|
||||
img_camera1.setBackgroundResource(R.mipmap.camera);
|
||||
} else {
|
||||
img_camera1.setBackgroundResource(R.drawable.ic_menu_gallery);
|
||||
img_camera1.setBackgroundResource(R.mipmap.camera_done);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,9 +365,9 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
if (headerTitle.getImage2().equals("")) {
|
||||
img_camera2.setBackgroundResource(R.drawable.ic_menu_camera);
|
||||
img_camera2.setBackgroundResource(R.mipmap.camera);
|
||||
} else {
|
||||
img_camera2.setBackgroundResource(R.drawable.ic_menu_gallery);
|
||||
img_camera2.setBackgroundResource(R.mipmap.camera_done);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user