# Conflicts:
#	GSKMTOrange/src/main/AndroidManifest.xml
This commit is contained in:
Gagan290
2017-01-12 17:04:24 +05:30
parent 11455f7702
commit 1c48f2f8ad
12 changed files with 559 additions and 416 deletions
@@ -1672,7 +1672,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
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();
@@ -37,9 +37,8 @@ public class CategoryListActivity extends AppCompatActivity {
CategoryListAdapter adapter;
GSKOrangeDB db;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -93,10 +92,36 @@ public class CategoryListActivity extends AppCompatActivity {
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
}
@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);
}
public class CategoryListAdapter extends RecyclerView.Adapter<CategoryListAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<CategoryGetterSetter> list = Collections.emptyList();
Context context;
private LayoutInflater inflator;
public CategoryListAdapter(CategoryListActivity context, List<CategoryGetterSetter> list) {
inflator = LayoutInflater.from(context);
@@ -123,19 +148,19 @@ public class CategoryListActivity extends AppCompatActivity {
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.ohc_done);
holder.categoryIcon.setImageResource(R.mipmap.oralcare_tick);
} else {
holder.categoryIcon.setImageResource(R.drawable.ohc);
holder.categoryIcon.setImageResource(R.mipmap.oral_care);
}
} else if (categoryData.getCategory().equalsIgnoreCase("Wellness")) {
if (db.checkMsl_AvailabilityData(store_id, categoryData.getCategory_id())
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.pdr_done);
holder.categoryIcon.setImageResource(R.mipmap.wellness_tick);
} else {
holder.categoryIcon.setImageResource(R.drawable.pdr);
holder.categoryIcon.setImageResource(R.mipmap.wellness);
}
} else if (categoryData.getCategory().equalsIgnoreCase("Nutritionals")) {
@@ -143,9 +168,9 @@ public class CategoryListActivity extends AppCompatActivity {
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.hfd_done);
holder.categoryIcon.setImageResource(R.mipmap.nutritionals_tick);
} else {
holder.categoryIcon.setImageResource(R.drawable.hfd);
holder.categoryIcon.setImageResource(R.mipmap.nutritionals);
}
}
@@ -179,30 +204,4 @@ public class CategoryListActivity extends AppCompatActivity {
}
}
}
@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);
}
}
@@ -37,9 +37,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
GSKOrangeDB db;
String categoryName = "", categoryId;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -110,9 +109,9 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//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);
data.setCategory_img(R.mipmap.stock_facing_done);
} else {
data.setCategory_img(R.mipmap.stock_and_facing);
data.setCategory_img(R.mipmap.stock_facing);
}
categoryList.add(data);
@@ -159,10 +158,36 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
}
@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);
}
public class DailyDataMenuAdapter extends RecyclerView.Adapter<DailyDataMenuAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<DailyDataMenuGetterSetter> list = Collections.emptyList();
Context context;
private LayoutInflater inflator;
public DailyDataMenuAdapter(Context context, List<DailyDataMenuGetterSetter> list) {
inflator = LayoutInflater.from(context);
@@ -232,31 +257,5 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
}
}
@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);
}
}
@@ -54,9 +54,8 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
GSKOrangeDB db;
String categoryName, categoryId, storeId;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -248,6 +247,25 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
}
}
@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 class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<MSL_AvailabilityGetterSetter> _listDataHeader;
@@ -362,8 +380,8 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
holder.txt_mbq = (TextView) convertView.findViewById(R.id.txt_mbq);
holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available);
holder.toggle_available.setTextOff("No");
holder.toggle_available.setTextOn("Yes");
/*holder.toggle_available.setTextOff("No");
holder.toggle_available.setTextOn("Yes");*/
convertView.setTag(holder);
} else {
@@ -418,23 +436,4 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
ToggleButton toggle_available;
LinearLayout lin_category;
}
@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);
}
}
@@ -1,6 +1,7 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -8,7 +9,11 @@ import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -22,12 +27,16 @@ import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageView;
@@ -48,31 +57,27 @@ 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.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
public class Stock_FacingActivity extends AppCompatActivity {
static int child_position = -1;
ExpandableListView expandableListView;
TextView txt_stockFacingName;
ArrayList<Stock_FacingGetterSetter> headerDataList;
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, Error_Message = "";
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, camera_allow;
private SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -270,308 +275,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
}
}
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<Stock_FacingGetterSetter> _listDataHeader;
private HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> _listDataChild;
public ExpandableListAdapter(Context context, List<Stock_FacingGetterSetter> listDataHeader,
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
final Stock_FacingGetterSetter headerTitle = (Stock_FacingGetterSetter) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_header, null, false);
}
TextView txt_stockFaceupHeader = (TextView) convertView.findViewById(R.id.txt_stockFaceupHeader);
LinearLayout lin_stockFaceupHeader = (LinearLayout) convertView.findViewById(R.id.lin_stockFaceupHeader);
ImageView img_reference = (ImageView) convertView.findViewById(R.id.img_reference);
ImageView img_camera1 = (ImageView) convertView.findViewById(R.id.img_camera1);
ImageView img_camera2 = (ImageView) convertView.findViewById(R.id.img_camera2);
ImageView img_edit = (ImageView) convertView.findViewById(R.id.img_edit);
txt_stockFaceupHeader.setTypeface(null, Typeface.BOLD);
txt_stockFaceupHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
if (headerTitle.getCompany_id().equals("1")) {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
}
//Camera allow enable
if (camera_allow.equalsIgnoreCase("1")) {
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(':', '-');
_pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id() + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity1(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImage1(img1);
img1 = "";
}
}
if (headerTitle.getImage1().equals("")) {
img_camera1.setBackgroundResource(R.mipmap.camera);
} else {
img_camera1.setBackgroundResource(R.mipmap.camera_done);
}
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(':', '-');
_pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id() + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity2(groupPosition);
}
});
if (!img2.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImage2(img2);
img2 = "";
}
}
if (headerTitle.getImage2().equals("")) {
img_camera2.setBackgroundResource(R.mipmap.camera);
} else {
img_camera2.setBackgroundResource(R.mipmap.camera_done);
}
} else {
//Camera allow disable
img_camera1.setBackgroundResource(R.mipmap.camera);
img_camera2.setBackgroundResource(R.mipmap.camera);
}
if (!checkflag) {
if (checkHeaderArray.contains(groupPosition)) {
txt_stockFaceupHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
} else {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
}
}
return convertView;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).size();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
final Stock_FacingGetterSetter childData = (Stock_FacingGetterSetter) getChild(groupPosition, childPosition);
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_child, null, false);
holder = new ViewHolder();
holder.cardView = (CardView) convertView.findViewById(R.id.card_view);
holder.lin_category = (LinearLayout) convertView.findViewById(R.id.lin_category);
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
holder.ed_stock = (EditText) convertView.findViewById(R.id.ed_stock);
holder.ed_facing = (EditText) convertView.findViewById(R.id.ed_facing);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_skuName.setText(childData.getSku());
if (childData.getCompany_id().equals("1")) {
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.txt_skuName.setTextColor(getResources().getColor(R.color.black));
}
if (childData.getStock().equals("0")) {
holder.ed_facing.setEnabled(false);
} else {
holder.ed_facing.setEnabled(true);
}
final ViewHolder finalHolder = holder;
holder.ed_stock.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
final EditText caption = (EditText) v;
String edStock = caption.getText().toString();
if (!edStock.equals("")) {
String stock = edStock.replaceFirst("^0+(?!$)", "");
childData.setStock(stock);
if (edStock.equals("0")) {
childData.setFacing("0");
finalHolder.ed_facing.setEnabled(false);
} else {
childData.setFacing(childData.getFacing());
finalHolder.ed_facing.setEnabled(true);
}
} else {
childData.setStock("");
finalHolder.ed_facing.setEnabled(true);
}
}
});
holder.ed_stock.setText(childData.getStock());
holder.ed_facing.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
final EditText caption = (EditText) v;
final String edFaceup = caption.getText().toString().replaceFirst("^0+(?!$)", "");
if (!childData.getStock().equals("")) {
if (!edFaceup.equals("")) {
if (Integer.parseInt(edFaceup) <= Integer.parseInt(childData.getStock())) {
childData.setFacing(edFaceup);
} else {
if (isDialogOpen) {
isDialogOpen = !isDialogOpen;
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("Faceup can not be greater than stock value")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
isDialogOpen = !isDialogOpen;
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
} else {
childData.setFacing("");
}
} else {
if (isDialogOpen) {
isDialogOpen = !isDialogOpen;
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("First fill the stock value")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
isDialogOpen = !isDialogOpen;
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
}
});
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;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
public class ViewHolder {
EditText ed_stock, ed_facing;
CardView cardView;
TextView txt_skuName;
LinearLayout lin_category;
}
boolean validateData(List<Stock_FacingGetterSetter> listDataHeader,
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listDataChild) {
boolean flag = true;
@@ -812,6 +515,12 @@ public class Stock_FacingActivity extends AppCompatActivity {
return cdate;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.planogram, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
@@ -823,11 +532,348 @@ public class Stock_FacingActivity extends AppCompatActivity {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
//Planogram Dialog
if (id == R.id.action_planogram) {
//final Dialog dialog = new Dialog(Stock_FacingActivity.this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
final Dialog dialog = new Dialog(Stock_FacingActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
//dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.setContentView(R.layout.planogram_dialog_layout);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
String planogram_image = "";
if (new File(str + planogram_image).exists()) {
Bitmap bmp = BitmapFactory.decodeFile(str + planogram_image);
img_planogram.setImageBitmap(bmp);
} else {
img_planogram.setBackgroundResource(R.drawable.sad_cloud);
}
/*if (new File(str + "Stock_Cam1_3_9_01122017_162052.jpg").exists()) {
Bitmap bmp = BitmapFactory.decodeFile(str + "Stock_Cam1_3_9_01122017_162052.jpg");
img_planogram.setImageBitmap(bmp);
} else {
img_planogram.setBackgroundResource(R.drawable.sad_cloud);
}*/
ImageView cancel = (ImageView) dialog.findViewById(R.id.img_cancel);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
return true;
}
return super.onOptionsItemSelected(item);
}
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<Stock_FacingGetterSetter> _listDataHeader;
private HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> _listDataChild;
public ExpandableListAdapter(Context context, List<Stock_FacingGetterSetter> listDataHeader,
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
final Stock_FacingGetterSetter headerTitle = (Stock_FacingGetterSetter) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_header, null, false);
}
TextView txt_stockFaceupHeader = (TextView) convertView.findViewById(R.id.txt_stockFaceupHeader);
TextView txt_sosHeader = (TextView) convertView.findViewById(R.id.txt_sosHeader);
LinearLayout lin_stockFaceupHeader = (LinearLayout) convertView.findViewById(R.id.lin_stockFaceupHeader);
ImageView img_camera1 = (ImageView) convertView.findViewById(R.id.img_camera1);
ImageView img_camera2 = (ImageView) convertView.findViewById(R.id.img_camera2);
//ImageView img_reference = (ImageView) convertView.findViewById(R.id.img_reference);
//ImageView img_edit = (ImageView) convertView.findViewById(R.id.img_edit);
txt_stockFaceupHeader.setTypeface(null, Typeface.BOLD);
txt_stockFaceupHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
if (headerTitle.getCompany_id().equals("1")) {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
}
//Camera allow enable
if (camera_allow.equalsIgnoreCase("1")) {
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(':', '-');
_pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id() + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity1(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImage1(img1);
img1 = "";
}
}
if (headerTitle.getImage1().equals("")) {
img_camera1.setBackgroundResource(R.mipmap.camera_orange);
} else {
img_camera1.setBackgroundResource(R.mipmap.camera_green);
}
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(':', '-');
_pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id() + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity2(groupPosition);
}
});
if (!img2.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImage2(img2);
img2 = "";
}
}
if (headerTitle.getImage2().equals("")) {
img_camera2.setBackgroundResource(R.mipmap.camera_orange);
} else {
img_camera2.setBackgroundResource(R.mipmap.camera_green);
}
} else {
//Camera allow disable
img_camera1.setBackgroundResource(R.mipmap.camera_grey);
img_camera2.setBackgroundResource(R.mipmap.camera_grey);
}
if (!checkflag) {
if (checkHeaderArray.contains(groupPosition)) {
txt_stockFaceupHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
} else {
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
}
}
return convertView;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).size();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
final Stock_FacingGetterSetter childData = (Stock_FacingGetterSetter) getChild(groupPosition, childPosition);
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_child, null, false);
holder = new ViewHolder();
holder.cardView = (CardView) convertView.findViewById(R.id.card_view);
holder.lin_category = (LinearLayout) convertView.findViewById(R.id.lin_category);
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
holder.ed_stock = (EditText) convertView.findViewById(R.id.ed_stock);
holder.ed_facing = (EditText) convertView.findViewById(R.id.ed_facing);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_skuName.setText(childData.getSku());
if (childData.getCompany_id().equals("1")) {
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
} else {
holder.txt_skuName.setTextColor(getResources().getColor(R.color.black));
}
if (childData.getStock().equals("0")) {
holder.ed_facing.setEnabled(false);
} else {
holder.ed_facing.setEnabled(true);
}
final ViewHolder finalHolder = holder;
holder.ed_stock.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
final EditText caption = (EditText) v;
String edStock = caption.getText().toString();
if (!edStock.equals("")) {
String stock = edStock.replaceFirst("^0+(?!$)", "");
childData.setStock(stock);
if (edStock.equals("0")) {
childData.setFacing("0");
finalHolder.ed_facing.setEnabled(false);
} else {
childData.setFacing(childData.getFacing());
finalHolder.ed_facing.setEnabled(true);
}
} else {
childData.setStock("");
finalHolder.ed_facing.setEnabled(true);
}
}
});
holder.ed_stock.setText(childData.getStock());
holder.ed_facing.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
final EditText caption = (EditText) v;
final String edFaceup = caption.getText().toString().replaceFirst("^0+(?!$)", "");
if (!childData.getStock().equals("")) {
if (!edFaceup.equals("")) {
if (Integer.parseInt(edFaceup) <= Integer.parseInt(childData.getStock())) {
childData.setFacing(edFaceup);
} else {
if (isDialogOpen) {
isDialogOpen = !isDialogOpen;
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("Faceup can not be greater than stock value")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
isDialogOpen = !isDialogOpen;
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
} else {
childData.setFacing("");
}
} else {
if (isDialogOpen) {
isDialogOpen = !isDialogOpen;
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("First fill the stock value")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
isDialogOpen = !isDialogOpen;
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
}
});
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;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
public class ViewHolder {
EditText ed_stock, ed_facing;
CardView cardView;
TextView txt_skuName;
LinearLayout lin_category;
}
}
@@ -93,7 +93,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/toggle_selector_background" />
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no"
android:textOn="@string/yes" />
</LinearLayout>
</LinearLayout>
@@ -23,35 +23,48 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="10dp">
android:layout_weight="1.5"
android:orientation="horizontal"
android:paddingTop="5dp"
android:weightSum="2">
<!--android:gravity="center_vertical"-->
<TextView
android:id="@+id/txt_stockFaceupHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.4"
android:paddingLeft="20dp"
android:paddingRight="5dp"
android:text="Brand Name "
android:text="Brand Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
<TextView
android:id="@+id/txt_sosHeader"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".6"
android:paddingRight="5dp"
android:text="@string/stock_facing_sos"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<!--Camera Images-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_weight=".5"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
<!--<ImageView
android:id="@+id/img_reference"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:src="@mipmap/star" />
android:src="@mipmap/star" />-->
<ImageView
android:id="@+id/img_camera1"
@@ -67,13 +80,14 @@
android:layout_marginRight="10dp" />
<!--android:src="@drawable/ic_menu_camera"-->
<ImageView
<!--<ImageView
android:id="@+id/img_edit"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginRight="20dp"
android:src="@mipmap/no_camera" />
android:src="@mipmap/no_camera" />-->
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -0,0 +1,66 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="20dp">-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Title and Image-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#90888888"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:padding="10dp"
android:text="@string/stock_facing_planogram_dialog_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/img_planogram"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:src="@drawable/sad_cloud"/>
</LinearLayout>
</LinearLayout>
<!--Cancel Image-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="5dp"
android:orientation="vertical">
<ImageView
android:id="@+id/img_cancel"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/cancel" />
</LinearLayout>
</FrameLayout>
<!--</android.support.v7.widget.CardView>-->
</LinearLayout>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_planogram"
android:icon="@mipmap/star"
android:orderInCategory="100"
android:title="planogram"
app:showAsAction="always" />
</menu>
Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

@@ -71,6 +71,7 @@
<string name="stock_facing_stock">X</string>
<string name="stock_facing_faceup">Önyüz</string>
<string name="stock_facing_sos_target">Raf Payı Hedefi</string>
<string name="stock_facing_sos">Raf Payi</string>
<string name="title_activity_promo_compliance">Promosyon</string>
@@ -95,6 +96,9 @@
<string name="category_performance_lsv">Son Ziyaret</string>
<string name="title_activity_store_wise_performance">Mağaza Performansı</string>
<!--Gagan End Code -->
<!--Gagan start new code 2-->
<string name="stock_facing_planogram_dialog_title">Planogram</string>
<!--Gagan end new code 2-->
</resources>
@@ -80,6 +80,7 @@
<string name="stock_facing_stock">Stock</string>
<string name="stock_facing_faceup">Facing</string>
<string name="stock_facing_sos_target">SOS Target</string>
<string name="stock_facing_sos">SOS</string>
<!--Gagan end code-->
@@ -147,5 +148,8 @@
<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>
<!--Gagan start new code 2-->
<string name="stock_facing_planogram_dialog_title">Planogram</string>
<!--Gagan end new code 2-->
</resources>