Merge pull request #52 from CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/ACVisibilityDone

Ac visibility done
This commit is contained in:
YadavendraSinghYaduvanshi
2017-01-13 18:24:48 +05:30
committed by GitHub
19 changed files with 643 additions and 227 deletions
@@ -96,6 +96,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(CommonString.CREATE_TABLE_STOCK_ADDITIONAL_STOCK_DATA);
db.execSQL(CommonString.CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKU);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG_MAIN);
db.execSQL(TableBean.getStorePerformance());
@@ -2156,13 +2158,17 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
sb.setCOMMON_ID(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_Common_ID)));
sb.setStore_id(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_STORE_ID)));
sb.setCategoryId(cursordata.getString(cursordata
.getColumnIndexOrThrow("categoryId")));
sb.setBrand_id(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
sb.setBrand(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
sb.setQuantity(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_QUANTITY)));
@@ -2172,7 +2178,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
sb.setSku_name(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_SKUNAME)));
productData.add(sb);
cursordata.moveToNext();
}
@@ -2200,6 +2205,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
public void deleteStockEntry(String id) {
try {
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL, "KEY_ID" + "='" + id + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL_MAIN, "KEY_ID" + "='" + id + "'", null);
} catch (Exception e) {
System.out.println("" + e);
}
@@ -2208,8 +2216,12 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
public void deleteStockEntryall(String storeid,String categoryid) {
try {
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL, "Store_Id" + "='" + storeid +"categoryId" + "='" + categoryid + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_DIALOG, "Store_Id" + "='" + storeid +"categoryId" + "='" + categoryid + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL, "Store_Id" + "='" + storeid +"'AND categoryId" + "='" + categoryid + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_DIALOG, "Store_Id" + "='" + storeid +"'AND categoryId" + "='" + categoryid + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_ADDITIONAL_MAIN, "Store_Id" + "='" + storeid +"'AND categoryId" + "='" + categoryid + "'", null);
db.delete(CommonString.TABLE_INSERT_STOCK_DIALOG_MAIN, "Store_Id" + "='" + storeid +"'AND categoryId" + "='" + categoryid + "'", null);
} catch (Exception e) {
System.out.println("" + e);
@@ -2472,7 +2484,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select * from Stock_Additional_visibility " + "where categoryId='" + category_id + "' and Store_Id='" + store_id + "'", null);
dbcursor = db.rawQuery("Select * from Stock_Additional_visibility_Main " + "where categoryId='" + category_id + "' and Store_Id='" + store_id + "'", null);
if (dbcursor != null) {
if (dbcursor.moveToFirst()) {
@@ -2505,7 +2517,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try {
cursordata = db.rawQuery("SELECT * FROM Stock_Additional_visibility WHERE Store_Id = '"+store_id +"'", null);
cursordata = db.rawQuery("SELECT * FROM Stock_Additional_visibility_Main WHERE Store_Id = '"+store_id +"'", null);
if (cursordata != null) {
cursordata.moveToFirst();
@@ -2554,6 +2566,101 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return productData;
}
public void InsertMainListAdditionalData(AddittionalGetterSetter Mainlist,ArrayList<AdditionalDialogGetterSetter> skulist,String categoryId) {
ContentValues values = new ContentValues();
ContentValues values1 = new ContentValues();
try {
values.put("Store_Id", Mainlist.getStore_id());
values.put("categoryId", categoryId);
values.put("brand_name", Mainlist.getBrand());
values.put("brand_id", Mainlist.getBrand_id());
values.put("image_url", Mainlist.getImage());
values.put("sku_id", Mainlist.getSku_id());
values.put("sku_name", Mainlist.getSku());
values.put("toggle_value", Mainlist.getBtn_toogle());
long key_id = db.insert(CommonString.TABLE_INSERT_STOCK_ADDITIONAL_MAIN, null, values);
for(int j=0;j<skulist.size();j++)
{
values1.put(CommonString.KEY_Common_ID, key_id);
values1.put(CommonString.KEY_STORE_ID, skulist.get(j).getStore_id());
values1.put("categoryId", categoryId);
values1.put(CommonString.KEY_BRAND, skulist.get(j).getBrand());
values1.put(CommonString.KEY_BRAND_ID, skulist.get(j).getBrand_id());
values1.put(CommonString.KEY_QUANTITY, skulist.get(j).getQuantity());
values1.put(CommonString.KEY_SKU_ID, skulist.get(j).getSku_id());
values1.put(CommonString.KEY_SKUNAME, skulist.get(j).getSku_name());
db.insert(CommonString.TABLE_INSERT_STOCK_DIALOG_MAIN, null, values1);
}
} catch (Exception ex) {
Log.d("Database Exception ", ex.getMessage());
}
}
public ArrayList<AdditionalDialogGetterSetter> getDialogStockUpload(String keyid) {
Cursor cursordata = null;
ArrayList<AdditionalDialogGetterSetter> productData = new ArrayList<AdditionalDialogGetterSetter>();
try {
cursordata = db.rawQuery("SELECT * FROM STOCK_DIALOG_MAIN WHERE COMMON_ID = '"+keyid + "'", null);
if (cursordata != null) {
cursordata.moveToFirst();
while (!cursordata.isAfterLast()) {
AdditionalDialogGetterSetter sb = new AdditionalDialogGetterSetter();
sb.setKEY_ID(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_ID)));
sb.setCOMMON_ID(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_Common_ID)));
sb.setStore_id(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_STORE_ID)));
sb.setCategoryId(cursordata.getString(cursordata
.getColumnIndexOrThrow("categoryId")));
sb.setBrand_id(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
sb.setBrand(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
sb.setQuantity(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_QUANTITY)));
sb.setSku_id(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_SKU_ID)));
sb.setSku_name(cursordata.getString(cursordata
.getColumnIndexOrThrow(CommonString.KEY_SKUNAME)));
productData.add(sb);
cursordata.moveToNext();
}
cursordata.close();
}
} catch (Exception ex) {
}
return productData;
}
// get T2P Compliance data
public ArrayList<T2PGetterSetter> getT2pComplianceData(String store_id, String category_id) {
@@ -2750,4 +2857,5 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return false;
}
}
@@ -3,6 +3,7 @@ package cpm.com.gskmtorange.GeoTag;
import android.Manifest;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -117,6 +118,8 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
private static final String TAG = GeoTagActivity.class.getSimpleName();
String defaultCameraPackage = "";
File file;
String gallery_package = "";
Uri outputFileUri;
private int factor, k;
ArrayList<GeotaggingBeans> geotaglist = new ArrayList<GeotaggingBeans>();
private TextView percentage, message;
@@ -188,13 +191,13 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GeoTagActivity.this);
// Setting Dialog Title
alertDialog.setTitle("GPS IS DISABLED...");
alertDialog.setTitle(getResources().getString(R.string.gps));
// Setting Dialog Message
alertDialog.setMessage("Click ok to enable GPS.");
alertDialog.setMessage(getResources().getString(R.string.gpsebale));
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("YES",
alertDialog.setPositiveButton(getResources().getString(R.string.yes),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
@@ -205,7 +208,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
});
// Setting Negative "NO" Button
alertDialog.setNegativeButton("NO",
alertDialog.setNegativeButton(getResources().getString(R.string.no),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Write your code here to invoke NO event
@@ -234,7 +237,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
} else {
Snackbar.make(view, "Please Take Image Before Save", Snackbar.LENGTH_LONG).setAction("Action", null).show();
Snackbar.make(view, getResources().getString(R.string.takeimage), Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
@@ -257,7 +260,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
}
}
_pathforcheck = storeid + "Store" + "Image" + getCurrentTime().replace(":", "") + ".jpg";
_pathforcheck = storeid + getResources().getString(R.string.store) + getResources().getString(R.string.image) + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -279,8 +282,8 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(getApplicationContext(),
"This device is not supported.", Toast.LENGTH_LONG)
Toast.makeText(getApplicationContext(),getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
}
@@ -433,59 +436,70 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
}
protected void startCameraActivity() {
/* Log.i("MakeMachine", "startCameraActivity()");
file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
try {
/*Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);*/
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
outputFileUri = Uri.fromFile(file);
takePictureIntent.setPackage(defaultCameraPackage);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(takePictureIntent, 1);*/
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
String defaultCameraPackage="";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n=0;n<list.size();n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
//temp value in case camera is gallery app above jellybean
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
defaultCameraPackage = list.get(n).packageName;
break;
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
//com.android.gallery3d
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, 0);
}
catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.setPackage(defaultCameraPackage);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(takePictureIntent, 1);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
startActivityForResult(intent, 0);
}
catch (Exception e) {
e.printStackTrace();
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
@@ -548,7 +562,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Uploading Data");
dialog.setTitle(getResources().getString(R.string.uploaddata));
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
@@ -584,7 +598,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
k = k + factor;
pb.setProgress(k);
percentage.setText(k + "%");
message.setText("Uploading Geotag Data...");
message.setText(getResources().getString(R.string.geotagdata));
}
});
@@ -716,7 +730,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, "failure", null);
+ result, getResources().getString(R.string.failure), null);
message.showMessage();
@@ -746,7 +760,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Uploading Geotag Images");
dialog.setTitle(getResources().getString(R.string.uploadimge));
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
@@ -783,7 +797,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
k = k + factor;
pb.setProgress(k);
percentage.setText(k + "%");
message.setText("Uploading Geotag Images...");
message.setText(getResources().getString(R.string.uploadimge));
}
});
@@ -886,7 +900,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_ERROR
+ result, "success", null);
+ result, getResources().getString(R.string.success), null);
message.showMessage();
@@ -896,7 +910,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, "failure", null);
+ result, getResources().getString(R.string.failure), null);
message.showMessage();
@@ -80,11 +80,6 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
db = new GSKOrangeDB(GeoTagStoreList.this);
db.open();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -94,7 +89,6 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
finish();
}
});
@@ -115,10 +109,8 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
fab.setVisibility(View.VISIBLE);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
@@ -261,11 +253,9 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
imageview=(ImageView) itemView.findViewById(R.id.imageView1);
}
}
}
}
public List<StoreBean> getdata() {
List<StoreBean> data = new ArrayList<>();
@@ -273,24 +263,17 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
StoreBean storelistdata=new StoreBean();
for(int i=0;i<storelist.size();i++)
{
storelistdata.setSTORE_NAME(storelist.get(0).getSTORE_NAME());
data.add(storelistdata);
}
return data;
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
@@ -330,4 +313,5 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
return true;
}
}
@@ -209,7 +209,8 @@ public class MainActivity extends AppCompatActivity
Snackbar.make(webView, R.string.no_data_for_upload, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
Intent i = new Intent(getBaseContext(), UploadActivity.class);
startActivity(i);
} else {
//if (isStoreCheckedIn()&& isValid()) {
@@ -431,6 +431,50 @@ public class CommonString {
+ KEY_IMAGE + " VARCHAR)";
public static final String TABLE_INSERT_STOCK_ADDITIONAL_MAIN = "Stock_Additional_visibility_Main";
public static final String CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN = "CREATE TABLE IF NOT EXISTS "
+ TABLE_INSERT_STOCK_ADDITIONAL_MAIN
+ "("
+ "KEY_ID"
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ "Store_Id"
+ " VARCHAR,"
+ "brand_name"
+ " VARCHAR,"
+ "brand_id"
+ " VARCHAR,"
+ "image_url"
+ " VARCHAR,"
+ "sku_id"
+ " VARCHAR,"
+ "sku_name"
+ " VARCHAR,"
+ "toggle_value"
+ " VARCHAR,"
+ "categoryId"
+ " VARCHAR"
+ ")";
public static final String TABLE_INSERT_STOCK_DIALOG_MAIN = "STOCK_DIALOG_MAIN";
public static final String CREATE_TABLE_STOCK_DIALOG_MAIN = "CREATE TABLE "
+ TABLE_INSERT_STOCK_DIALOG_MAIN + " (" + KEY_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_STORE_ID + " VARCHAR,"
+ KEY_BRAND_ID + " VARCHAR," + KEY_BRAND + " VARCHAR,"
+ KEY_DISPLAY_ID +" VARCHAR,"
+ KEY_SKU_ID + " VARCHAR," + KEY_QUANTITY + " VARCHAR," + KEY_Common_ID + " VARCHAR,"
+ "categoryId" + " VARCHAR,"
+ KEY_SKUNAME + " VARCHAR,"
+ KEY_PROCESS_ID + " VARCHAR)";
//Tables related to T2p Compliance
@@ -480,4 +524,5 @@ public class CommonString {
+ KEY_BRAND+ " VARCHAR,"
+ KEY_SKU + " VARCHAR"
+ ")";
}
@@ -3,6 +3,7 @@ package cpm.com.gskmtorange.dailyentry;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -20,6 +21,7 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
@@ -52,10 +54,12 @@ import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagActivity;
import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter;
import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.gsk_dailyentry.DailyDataMenuActivity;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
@@ -67,12 +71,14 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
ArrayList<AdditionalDialogGetterSetter> list = new ArrayList<AdditionalDialogGetterSetter>();
ArrayList<AddittionalGetterSetter> listdata = new ArrayList<AddittionalGetterSetter>();
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
ArrayList<AdditionalDialogGetterSetter> additionalVisibilityinsertSkuList;
ArrayList<AdditionalDialogGetterSetter> uploadlist = new ArrayList<AdditionalDialogGetterSetter>();
ArrayList<AdditionalDialogGetterSetter> defdata = new ArrayList<AdditionalDialogGetterSetter>();
Spinner spinner_brand, spinner_sku;
Spinner spinner_brand_list, spinner_sku_list;
AdditionalDialogGetterSetter additionalgeetersetter;
public static ArrayList<AddittionalGetterSetter> data = new ArrayList<AddittionalGetterSetter>();
ToggleButton btntoggle;
ImageView btnimage, btnedit;
@@ -99,10 +105,14 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
ListView listviewlay;
String errormsg,categoryName,categoryId;
MyAdaptorAdditionalStock adapteradditional;
AddittionalGetterSetter adGt;
AddittionalGetterSetter adGt,newadd;
LinearLayout brandlayout, diaplylayout, cameralayout;
FloatingActionButton fab;
//RelativeLayout skulayout;
CardView cardvew;
String gallery_package = "";
Uri outputFileUri;
////String brand_id,SKU_ID;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
@@ -142,7 +152,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
brandlayout = (LinearLayout) findViewById(R.id.tv_brandlayout);
diaplylayout = (LinearLayout) findViewById(R.id.tv_displaylayout);
cameralayout = (LinearLayout) findViewById(R.id.tv_cameralayout);
fab = (FloatingActionButton) findViewById(R.id.fab);
//skulayout = (RelativeLayout) findViewById(R.id.tv_skulayout);
btntoggle.setChecked(true);
@@ -153,7 +163,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
///band List
brand_list = db.getBrandMasterData(store_id);
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
brand.setBRAND("select");
String str= getResources().getString(R.string.select);
brand.setBRAND(str);
brand_list.add(0, brand);
CustomAdapter adapter = new CustomAdapter(AdditionalVisibility.this, R.layout.custom_spinner_item, brand_list);
@@ -164,7 +175,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
skuMaster_list = db.getSKUMasterData(store_id);
SkuMasterGetterSetter select = new SkuMasterGetterSetter();
select.setSKU("Select");
select.setSKU(str);
skuMaster_list.add(0, select);
CustomSkuMasterAdpter skuadapter = new CustomSkuMasterAdpter(AdditionalVisibility.this, R.layout.custom_spinner_item, skuMaster_list);
spinner_sku_list.setAdapter(skuadapter);
@@ -214,7 +225,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if(tooglevalue.equalsIgnoreCase("0"))
{
btnaddlayout.setVisibility(View.INVISIBLE);
cardvew.setVisibility(View.INVISIBLE);
listviewlay.setVisibility(View.INVISIBLE);
@@ -225,8 +235,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnsku.setVisibility(View.INVISIBLE);
}
/* String KeyID = listdata.get(k).getKey_id();
uploadlist = db.getDialogStock(KeyID);*/
@@ -234,9 +242,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
}
if (listdata.size() > 0) {
for (int i = 0; i < listdata.size(); i++) {
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
listviewlay.setVisibility(View.INVISIBLE);
@@ -254,13 +260,71 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listdata = db.getAdditionalStock(store_id,categoryId);
if(listdata.size()>0)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_save));
// set dialog message
alertDialogBuilder
.setMessage("")
.setCancelable(false)
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
for (int J = 0; J < listdata.size(); J++) {
newadd = new AddittionalGetterSetter();
newadd.setBrand(listdata.get(J).getBrand_id());
newadd.setBrand_id(listdata.get(J).getBrand_id());
newadd.setImage(listdata.get(J).getImage());
newadd.setSku(listdata.get(J).getSku());
newadd.setSku_id(listdata.get(J).getSku_id());
newadd.setStore_id(listdata.get(J).getStore_id());
newadd.setBtn_toogle(listdata.get(J).getBtn_toogle());
newadd.setCategoryId(listdata.get(J).getCategoryId());
String KeyID = listdata.get(J).getKey_id();
additionalVisibilitySkuList = db.getDialogStock(KeyID);
db.InsertMainListAdditionalData(newadd, additionalVisibilitySkuList,categoryId);
/*Intent in =new Intent(AdditionalVisibility.this, DailyDataMenuActivity.class);
startActivity(in);*/
KeyID="";
additionalVisibilitySkuList.clear();
}
finish();
}
})
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}else
{
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
}});
/* if (listdata.size() > 0) {
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
listviewlay.setAdapter(adapteradditional);
listviewlay.invalidateViews();
}*/
btnaddlayout.setOnClickListener(new View.OnClickListener() {
@Override
@@ -276,46 +340,32 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
adGt.setBtn_toogle(togglevalue);
adGt.setCategoryId(categoryId);
if (validateData(adGt, defdata)) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle("Do You Want To Save");
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_to_add));
// set dialog message
alertDialogBuilder
.setMessage("")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.InsertAdditionalData(adGt, defdata,categoryId);
spinner_brand_list.setSelection(0);
spinner_sku_list.setSelection(0);
img_str = "";
brand_list_name = "";
brand_list_id = "";
sku_list_name = "";
sku_list_id = "";
defdata.clear();
// btntoggle.setChecked(true);
btnimage.setBackgroundResource(R.mipmap.camera);
// togglevalue = "1";
listdata = db.getAdditionalStock(store_id,categoryId);
if (listdata.size() > 0) {
for(int i=0;i<listdata.size();i++)
{
if(listdata.get(i).getBtn_toogle().equalsIgnoreCase("0"))
@@ -333,22 +383,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
cardvew.setVisibility(View.VISIBLE);
listviewlay.setVisibility(View.VISIBLE);
}
}
} else {
}
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
@@ -372,30 +416,121 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btntoggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (btntoggle.isChecked()) {
togglevalue = "1";
listdata = db.getAdditionalStock(store_id,categoryId);
brandlayout.setVisibility(View.VISIBLE);
diaplylayout.setVisibility(View.VISIBLE);
cameralayout.setVisibility(View.VISIBLE);
btnsku.setVisibility(View.VISIBLE);
if(listdata.size()>0)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_to_delete));
// set dialog message
alertDialogBuilder
.setMessage("")
.setCancelable(false)
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
togglevalue = "1";
db.deleteStockEntryall(store_id,categoryId);
brandlayout.setVisibility(View.VISIBLE);
diaplylayout.setVisibility(View.VISIBLE);
cameralayout.setVisibility(View.VISIBLE);
btnsku.setVisibility(View.VISIBLE);
btnaddlayout.setVisibility(View.VISIBLE);
cardvew.setVisibility(View.VISIBLE);
listviewlay.setVisibility(View.VISIBLE);
btnaddlayout.setVisibility(View.VISIBLE);
cardvew.setVisibility(View.VISIBLE);
listviewlay.setVisibility(View.VISIBLE);
listdata = db.getAdditionalStock(store_id,categoryId);
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
listviewlay.setAdapter(adapteradditional);
listviewlay.invalidateViews();
}
})
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}else
{
togglevalue = "1";
brandlayout.setVisibility(View.VISIBLE);
diaplylayout.setVisibility(View.VISIBLE);
cameralayout.setVisibility(View.VISIBLE);
btnsku.setVisibility(View.VISIBLE);
btnaddlayout.setVisibility(View.VISIBLE);
cardvew.setVisibility(View.VISIBLE);
listviewlay.setVisibility(View.VISIBLE);
}
} else {
db.deleteStockEntryall(store_id,categoryId);
listdata = db.getAdditionalStock(store_id,categoryId);
if(listdata.size()>0)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_to_delete));
// set dialog message
alertDialogBuilder
.setMessage("")
.setCancelable(false)
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.deleteStockEntryall(store_id,categoryId);
togglevalue = "0";
defdata.clear();
brandlayout.setVisibility(View.INVISIBLE);
diaplylayout.setVisibility(View.INVISIBLE);
cameralayout.setVisibility(View.INVISIBLE);
btnsku.setVisibility(View.INVISIBLE);
listdata = db.getAdditionalStock(store_id,categoryId);
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
listviewlay.setAdapter(adapteradditional);
listviewlay.invalidateViews();
}
})
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
else
{
togglevalue = "0";
defdata.clear();
brandlayout.setVisibility(View.INVISIBLE);
diaplylayout.setVisibility(View.INVISIBLE);
cameralayout.setVisibility(View.INVISIBLE);
btnsku.setVisibility(View.INVISIBLE);
}
togglevalue = "0";
defdata.clear();
brandlayout.setVisibility(View.INVISIBLE);
diaplylayout.setVisibility(View.INVISIBLE);
cameralayout.setVisibility(View.INVISIBLE);
btnsku.setVisibility(View.INVISIBLE);
}
}
});
@@ -403,8 +538,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
_pathforcheck = store_id + "Store"
+ "Image" + date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_pathforcheck = store_id + getResources().getString(R.string.store)
+getResources().getString(R.string.image) + date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
intime = getCurrentTime();
@@ -501,7 +636,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if (position == 0) {
// Default selected Spinner item
label.setText("Select");
label.setText(getResources().getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
@@ -563,7 +698,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if (position == 0) {
// Default selected Spinner item
label.setText("Select");
label.setText(getResources().getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
@@ -626,7 +761,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if (position == 0) {
// Default selected Spinner item
label.setText("Select");
label.setText(getResources().getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
@@ -639,12 +774,20 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
protected void startCameraActivity() {
try {
/*Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 0);*/
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
outputFileUri = Uri.fromFile(file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -654,6 +797,11 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
//temp value in case camera is gallery app above jellybean
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
gallery_package = list.get(n).packageName;
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
@@ -666,21 +814,28 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
}
}
}
}
//com.android.gallery3d
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, 0);
}
catch (ActivityNotFoundException e) {
e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(gallery_package);
startActivityForResult(intent, 0);
} catch (Exception e) {
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -712,7 +867,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
public void showSkuDialog() {
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
brand.setBRAND("select");
brand.setBRAND(getResources().getString(R.string.select));
brandList.add(0, brand);
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
final Dialog dialog = new Dialog(AdditionalVisibility.this);
@@ -824,7 +979,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
ArrayList<SkuGetterSetter> empty_list = new ArrayList<>();
SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select");
select.setSKU(getResources().getString(R.string.select));
empty_list.add(select);
CustomSkuAdapter skuadapter = new CustomSkuAdapter(AdditionalVisibility.this, R.layout.custom_spinner_item, empty_list);
spinner_sku.setAdapter(skuadapter);
@@ -840,7 +995,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
sku_list = db.getSkuT2PData("1", "1", "1", brand_id);
SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select");
select.setSKU(getResources().getString(R.string.select));
sku_list.add(0, select);
// Create custom adapter object ( see below CustomSkuAdapter.java )
CustomSkuAdapter skuadapter = new CustomSkuAdapter(AdditionalVisibility.this, R.layout.custom_spinner_item, sku_list);
@@ -980,13 +1135,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle("Do You Want To Delete?");
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_to_delete1));
// set dialog message
alertDialogBuilder
.setMessage("Click Yes To Delete!")
.setMessage(getResources().getString(R.string.title_activity_click_delete))
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// db.deletedialogStockEntry(list.get(position1).getKEY_ID());
@@ -1006,7 +1161,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
@@ -1110,24 +1265,29 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
AdditionalVisibility.this);
// set title
alertDialogBuilder.setTitle("Do You Want To Delete?");
alertDialogBuilder.setTitle(getResources().getString(R.string.title_activity_Want_to_delete1));
// set dialog message
alertDialogBuilder
.setMessage("Click Yes To Delete!")
.setMessage(getResources().getString(R.string.title_activity_click_delete))
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.deleteStockEntry(listdata.get(position1).getKey_id());
adapteradditional.notifyDataSetChanged();
listdata = db.getAdditionalStock(store_id,categoryId);
/* adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
listviewlay.setAdapter(adapteradditional);
listviewlay.invalidateViews();*/
listviewlay.invalidateViews();
if (listdata.size() > 0) {
@@ -1148,12 +1308,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
}
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, just close
// the dialog box and do nothing
@@ -1201,16 +1358,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if (brandid.equalsIgnoreCase("") || skuid.equalsIgnoreCase("")) {
flag = false;
errormsg = "Please Select dropdown";
errormsg = getResources().getString(R.string.title_activity_select_dropdown);
} else if (imageu == null || imageu.equalsIgnoreCase("")) {
flag = false;
errormsg = "Please Take a image";
errormsg = getResources().getString(R.string.title_activity_take_image);
} else if (dialog.size() == 0) {
errormsg = "Please fill sku data";
errormsg = getResources().getString(R.string.title_activity_fill_sku);
flag = false;
@@ -1236,13 +1393,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
if (brandid.equalsIgnoreCase("") || brandid == null) {
flag = false;
msg = "Please Select Dropdown";
msg = getResources().getString(R.string.title_activity_select_dropdown);
} else if (displayid == null || displayid.equalsIgnoreCase("")) {
flag = false;
msg = "Please Select Dropdown";
msg = getResources().getString(R.string.title_activity_select_dropdown);
} else if (QTy.equalsIgnoreCase("") || QTy == null) {
flag = false;
msg = "Please enter Quantity";
msg = getResources().getString(R.string.title_activity_enter_quantity);
} else {
flag = true;
}
@@ -6,13 +6,19 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
@@ -66,6 +72,7 @@ public class StoreListActivity extends AppCompatActivity {
private Dialog dialog;
boolean result_flag = false, leaveflag = false;
FloatingActionButton fab;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -109,7 +116,8 @@ public class StoreListActivity extends AppCompatActivity {
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
storelist = db.getStoreData(date);
coverage=db.getCoverageData(date);
coverage = db.getCoverageData(date);
if (storelist.size() > 0) {
//list.setAdapter(new MyAdaptor());
@@ -134,8 +142,6 @@ public class StoreListActivity extends AppCompatActivity {
int id = item.getItemId();
if (id == android.R.id.home) {
// NavUtils.navigateUpFromSameTask(this);
@@ -190,35 +196,29 @@ public class StoreListActivity extends AppCompatActivity {
viewHolder.imageview.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_u);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_d);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_C)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_c);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_p);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tickl);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
}
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.leave_tick);
viewHolder.imageview.setBackgroundResource(R.mipmap.exclamation);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
}
else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_INVALID)) {
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_INVALID)) {
if (coverage.size() > 0) {
@@ -234,8 +234,10 @@ public class StoreListActivity extends AppCompatActivity {
if (storeid.equals(coverage.get(i).getStoreId())) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.checkin);
// viewHolder.imageview.setBackgroundResource(R.mipmap.checkin);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
viewHolder.Cardbtn.setCardBackgroundColor(getResources().getColor(R.color.green));
}
break;
@@ -246,6 +248,8 @@ public class StoreListActivity extends AppCompatActivity {
}
}
} else {
viewHolder.Cardbtn.setCardBackgroundColor(getResources().getColor(R.color.colorOrange));
viewHolder.imageview.setVisibility(View.INVISIBLE);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
}
@@ -271,12 +275,9 @@ public class StoreListActivity extends AppCompatActivity {
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE)) {
Snackbar.make(v, R.string.title_store_list_activity_already_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else {
} else {
// PUT IN PREFERENCES
editor = preferences.edit();
@@ -324,8 +325,61 @@ public class StoreListActivity extends AppCompatActivity {
}
}
});
}
viewHolder.chkbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(
StoreListActivity.this);
builder.setMessage(R.string.wantcheckout)
.setCancelable(false)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog, int id) {
if (CheckNetAvailability()) {
/*Intent i = new Intent(StoreListActivity.this, CheckOutStoreActivity.class);
startActivity(i);*/
} else {
Snackbar.make(recyclerView, R.string.nonetwork, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
}
}
})
.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}
public boolean CheckNetAvailability() {
boolean connected = false;
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
.getState() == NetworkInfo.State.CONNECTED
|| connectivityManager.getNetworkInfo(
ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
// we are connected to a network
connected = true;
}
return connected;
}
@Override
public int getItemCount() {
return data.size();
@@ -338,6 +392,7 @@ public class StoreListActivity extends AppCompatActivity {
RelativeLayout relativelayout;
ImageView imageview;
Button chkbtn;
CardView Cardbtn;
public MyViewHolder(View itemView) {
super(itemView);
@@ -348,6 +403,8 @@ public class StoreListActivity extends AppCompatActivity {
imageview = (ImageView) itemView.findViewById(R.id.imageView2);
chkbtn = (Button) itemView.findViewById(R.id.chkout);
Cardbtn = (CardView) itemView.findViewById(R.id.card_view);
}
}
@@ -368,25 +425,22 @@ public class StoreListActivity extends AppCompatActivity {
public void onCheckedChanged(RadioGroup group, int checkedId) {
// find which radio button is selected
if (checkedId == R.id.yes) {
boolean flag=true;
if(coverage.size()>0) {
boolean flag = true;
if (coverage.size() > 0) {
for (int i = 0; i < coverage.size(); i++) {
if (store_id.equals(coverage.get(i).getStoreId())) {
flag=false;
flag = false;
break;
}
}
}
if(flag==true)
{
if (flag == true) {
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
dialog.cancel();
}
else
{
Intent in=new Intent(StoreListActivity.this,CategoryListActivity.class);
} else {
Intent in = new Intent(StoreListActivity.this, CategoryListActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
dialog.cancel();
@@ -400,7 +454,7 @@ public class StoreListActivity extends AppCompatActivity {
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
builder.setMessage(CommonString.DATA_DELETE_ALERT_MESSAGE)
.setCancelable(false)
.setPositiveButton("Yes",
.setPositiveButton(getResources().getString(R.string.yes),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
@@ -409,13 +463,12 @@ public class StoreListActivity extends AppCompatActivity {
UpdateStore(store_id);
Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
startActivity(in);
}
})
.setNegativeButton("No",
.setNegativeButton(getResources().getString(R.string.no),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
@@ -430,7 +483,7 @@ public class StoreListActivity extends AppCompatActivity {
} else {
Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
startActivity(in);
}
@@ -500,3 +553,6 @@ public class StoreListActivity extends AppCompatActivity {
}
}
@@ -157,8 +157,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
case R.id.img_cam_selfie:
_pathforcheck = store_id + "Store"
+ "Image" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_pathforcheck = store_id + getResources().getString(R.string.store)
+ getResources().getString(R.string.image) + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -173,9 +173,9 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
if (img_str != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
builder.setMessage("Do you want to save the data ")
builder.setMessage(getResources().getString(R.string.title_activity_save_data))
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
@@ -211,7 +211,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
finish();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
@@ -221,7 +221,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
alert.show();
} else {
Toast.makeText(getApplicationContext(), "Please click the image", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
}
break;
}
@@ -541,7 +541,7 @@ public class UploadActivity extends AppCompatActivity {
String KeyID = additionalVisibilityList.get(J).getKey_id();
additionalVisibilitySkuList = db.getDialogStock(KeyID);
additionalVisibilitySkuList = db.getDialogStockUpload(KeyID);
if(additionalVisibilitySkuList.size()>0)
{
@@ -556,9 +556,9 @@ public class UploadActivity extends AppCompatActivity {
+ "[KEY_ID]"
+ additionalVisibilitySkuList.get(k).getCOMMON_ID()
+ "[/KEY_ID]"
/* + "[DIALOG_BRAND_ID]"
+ additionalVisibilitySkuList.get(k).getBrand_id()
+ "[/DIALOG_BRAND_ID]"*/
+ "[CATEGORY_ID]"
+ additionalVisibilitySkuList.get(k).getCategoryId()
+ "[/CATEGORY_ID]"
+ "[SKU_ID]"
+ additionalVisibilitySkuList.get(k).getSku_id()
+ "[/SKU_ID]"
@@ -600,6 +600,10 @@ public class UploadActivity extends AppCompatActivity {
+ "[/ADDITIONAL_VISIBILITY_DATA]";
additional_visibility_data_xml = additional_visibility_data_xml + onXML;
KeyID="";
additionalVisibilitySkuList.clear();
additional_visibility_dialog_xml="";
}
@@ -30,7 +30,7 @@
android:layout_height="match_parent"
android:layout_weight="10"
android:text="Brand Name"
android:text="@string/brandname"
android:textStyle="bold" />
<TextView
@@ -59,7 +59,7 @@
android:layout_height="match_parent"
android:layout_weight="10"
android:text="SKU Name"
android:text="@string/skuname"
android:textStyle="bold" />
<TextView
@@ -88,7 +88,7 @@
android:layout_height="match_parent"
android:layout_weight="10"
android:text="Quantity"
android:text="@string/quantity"
android:textStyle="bold" />
<TextView
@@ -118,7 +118,7 @@
android:layout_weight="10"
android:background="@color/grey_background"
android:layout_marginLeft="30dp"
android:text="Delete" />
android:text="@string/delete" />
</LinearLayout>
@@ -9,6 +9,15 @@
<include layout="@layout/contentadditionalvisibility" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_menu_save"
app:backgroundTint="@color/colorPrimary"
/>
@@ -62,8 +62,8 @@
android:id="@+id/btntoggle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textOn="Yes"
android:textOff="No"
android:textOn="@string/yes"
android:textOff="@string/no"
android:layout_weight=".5" />
</LinearLayout>
@@ -24,7 +24,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/store_image"
android:text="@string/storefront"
android:textSize="@dimen/store_entry_text_size"
android:layout_centerInParent="true"
android:textColor="@color/white"
@@ -90,8 +90,6 @@
<Button
android:id="@+id/btn_save_selfie"
android:layout_width="match_parent"
@@ -11,7 +11,7 @@
android:layout_height="wrap_content"
android:text="@string/store_visited"
android:textColor="@color/black"
android:textSize="25sp" />
android:textSize="18sp" />
<View
android:layout_width="match_parent"
@@ -44,7 +44,7 @@
android:layout_height="wrap_content"
android:layout_alignTop="@+id/storelistviewxml_storeico"
android:layout_toRightOf="@+id/storelistviewxml_storeico"
android:text="GSK MT ORANGE STORE"
android:text="@string/GSKMT"
android:textColor="#1F3A6C"
android:textSize="16sp"
android:textStyle="bold" />
@@ -55,7 +55,7 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/storelistviewxml_storename"
android:layout_below="@+id/storelistviewxml_storename"
android:text="C 126, Okhla II, "
android:text="@string/address"
android:textColor="#666666"
android:textSize="10sp"
android:textStyle="normal" />
@@ -63,10 +63,11 @@
<Button
android:id="@+id/chkout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:focusable="false"
android:background="@mipmap/checkout"
android:visibility="invisible" />
<ImageView
@@ -76,7 +77,6 @@
android:layout_alignBottom="@+id/storelistviewxml_storeico"
android:layout_alignParentRight="true"
android:background="@mipmap/tick_c"
android:visibility="gone"
/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@@ -36,6 +36,17 @@
<string name="add">Add</string>
<string name="cancel">Cancel</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="brandname">Brand Name</string>
<string name="skuname">SKU Name</string>
<string name="quantity">Quantity</string>
<string name="delete">Delete</string>
<string name="StoreVisited"> Store Visited</string>
<string name="GSKMT">GSK MT ORANGE STORE</string>
<string name="address">C 126, Okhla II,</string>
<string name="storefront">Click Store Front Image</string>
<string name="select_language">Please select language</string>
<string name="title_activity_select_language">Select Language</string>
@@ -141,6 +152,35 @@
<string name="Display">Display</string>
<string name="Photo">Photo</string>
<string name="title_activity_Additional_visibility">Additional Visibility</string>
<string name="title_activity_Want_save"> Do You Want To Save</string>
<string name="title_activity_Want_add"> Please Add Data</string>
<string name="title_activity_Want_to_add">Do You Want To Add</string>
<string name="title_activity_Want_to_delete"> Do You Want To Delete Data</string>
<string name="store"> store</string>
<string name="title_activity_Want_to_delete1"> Do You Want To Delete</string>
<string name="title_activity_click_delete">Click Yes To Delete!</string>
<string name="title_activity_select_dropdown">Please Select dropdown</string>
<string name="title_activity_take_image">Please Take a image</string>
<string name="title_activity_fill_sku">Please fill sku data</string>
<string name="title_activity_enter_quantity">Please enter Quantity</string>
<string name="title_activity_save_data">Do you want to save the data</string>
<string name="ok">OK</string>
<string name="clickimage">Please click the image</string>
<string name="gps">GPS IS DISABLED...</string>
<string name="gpsebale">Click ok to enable GPS.</string>
<string name="takeimage"> Please Take Image Before Save</string>
<string name="notsuppoted">This device is not supported.</string>
<string name="uploaddata">Uploading Data</string>
<string name="geotagdata">Uploading Geotag Data...</string>
<string name="failure">failure</string>
<string name="uploadimge">Uploading Geotag Images</string>
<string name="success">success</string>
<string name="wantcheckout">Are you sure you want to Checkout</string>
<string name="nonetwork"> No Network</string>
<string name="title_activity_Non_Work">Non Working Reason</string>
<string name="closed">Close</string>