Merge branch 'master' into ysy_latest_setting
This commit is contained in:
@@ -18,6 +18,7 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
|
||||
import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter;
|
||||
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
@@ -2561,11 +2562,10 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
|
||||
if(category_id == null){
|
||||
if (category_id == null) {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
|
||||
CommonString.KEY_STORE_ID + "='" + store_id + "'", null);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
|
||||
CommonString.KEY_STORE_ID + "='" + store_id + "' AND " +
|
||||
CommonString.KEY_CATEGORY_ID + "='" + category_id + "'", null);
|
||||
@@ -2683,6 +2683,36 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Log.d("Exception ", " MAPPING_PLANOGRAM " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> getMappingPlanogramData(String category_id) {
|
||||
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM MAPPING_PLANOGRAM", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
MAPPING_PLANOGRAM_DataGetterSetter mp = new MAPPING_PLANOGRAM_DataGetterSetter();
|
||||
|
||||
mp.setKEYACCOUNT_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("KEYACCOUNT_ID")));
|
||||
mp.setSTORETYPE_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORETYPE_ID")));
|
||||
mp.setCLASS_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CLASS_ID")));
|
||||
mp.setPLANOGRAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PLANOGRAM_IMAGE")));
|
||||
mp.setIMAGE_PATH(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE_PATH")));
|
||||
|
||||
list.add(mp);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//Gagan end new code 2
|
||||
|
||||
//T2P is filled
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Window;
|
||||
@@ -24,11 +25,16 @@ import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
@@ -669,6 +675,62 @@ public class DownloadActivity extends AppCompatActivity {
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//MAPPING_PLANOGRAM Image save into folder
|
||||
if (mapping_planogram_masterGetterSetter != null) {
|
||||
|
||||
for (int i = 0; i < mapping_planogram_masterGetterSetter.getIMAGE_PATH().size(); i++) {
|
||||
//publishing image download
|
||||
data.value = data.value + 1;
|
||||
if (data.value < 100) {
|
||||
publishProgress(data);
|
||||
}
|
||||
|
||||
String image_name = mapping_planogram_masterGetterSetter.getPLANOGRAM_IMAGE().get(i);
|
||||
String path = mapping_planogram_masterGetterSetter.getIMAGE_PATH().get(i);
|
||||
|
||||
if (!image_name.equalsIgnoreCase("NA") && !image_name.equalsIgnoreCase("")) {
|
||||
URL url = new URL(path + "/" + image_name);
|
||||
HttpURLConnection c = (HttpURLConnection) url.openConnection();
|
||||
c.setRequestMethod("GET");
|
||||
c.getResponseCode();
|
||||
c.connect();
|
||||
|
||||
if (c.getResponseCode() == 200) {
|
||||
int length = c.getContentLength();
|
||||
|
||||
String size = new DecimalFormat("##.##").format((double) length / 1024) + " KB";
|
||||
|
||||
//String PATH = Environment.getExternalStorageDirectory() + "/Download/GT_GSK_Images/";
|
||||
String PATH = CommonString.FILE_PATH;
|
||||
File file = new File(PATH);
|
||||
if (!file.isDirectory()) {
|
||||
file.mkdir();
|
||||
}
|
||||
|
||||
// Environment.getExternalStorageDirectory() + "/GT_GSK_Images/" + _pathforcheck1;
|
||||
if (!new File(PATH + image_name).exists() && !size.equalsIgnoreCase("0 KB")) {
|
||||
File outputFile = new File(file, image_name);
|
||||
FileOutputStream fos = new FileOutputStream(outputFile);
|
||||
InputStream is1 = c.getInputStream();
|
||||
|
||||
int bytes = 0;
|
||||
byte[] buffer = new byte[1024];
|
||||
int len1 = 0;
|
||||
|
||||
while ((len1 = is1.read(buffer)) != -1) {
|
||||
bytes = (bytes + len1);
|
||||
// data.value = (int) ((double) (((double)
|
||||
// bytes) / length) * 100);
|
||||
fos.write(buffer, 0, len1);
|
||||
}
|
||||
fos.close();
|
||||
is1.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Gagan end code
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ 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);
|
||||
//getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+39
-127
@@ -37,54 +37,28 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
|
||||
ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList;
|
||||
CategoryWisePerformaceAdapter adapter;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
GSKOrangeDB db;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_category_wise_performance);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
//txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
|
||||
categoryName = getIntent().getStringExtra("categoryName");
|
||||
categoryId = getIntent().getStringExtra("categoryId");
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
//txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(CategoryWisePerformanceActivity.this, DailyDataMenuActivity.class);
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
setContentView(R.layout.activity_category_wise_performance);
|
||||
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||
@@ -103,7 +77,16 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(CategoryWisePerformanceActivity.this, DailyDataMenuActivity.class);
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -113,79 +96,8 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
categoryWisePerformanceList = new ArrayList<>();
|
||||
CategoryWisePerformaceGetterSetter data = new CategoryWisePerformaceGetterSetter();
|
||||
|
||||
data.setPeriod("Period");
|
||||
data.setSos("SOS");
|
||||
data.setT2p("T2P");
|
||||
data.setPromo("Promo");
|
||||
data.setMsl_availability("MSL Availability");
|
||||
data.setOss("OSS");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("LTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("MTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("RTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("LTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("MTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
data = new CategoryWisePerformaceGetterSetter();
|
||||
data.setPeriod("RTM");
|
||||
data.setSos("75");
|
||||
data.setT2p("0");
|
||||
data.setPromo("0");
|
||||
data.setMsl_availability("25");
|
||||
data.setOss("55");
|
||||
categoryWisePerformanceList.add(data);
|
||||
|
||||
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
|
||||
try {
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId);
|
||||
|
||||
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
|
||||
@@ -194,13 +106,31 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@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 CategoryWisePerformaceAdapter extends RecyclerView.Adapter<CategoryWisePerformaceAdapter.MyViewHolder> {
|
||||
Context context;
|
||||
private LayoutInflater inflator;
|
||||
List<CategoryWisePerformaceGetterSetter> list = Collections.emptyList();
|
||||
private LayoutInflater inflator;
|
||||
|
||||
public CategoryWisePerformaceAdapter(Context context, List<CategoryWisePerformaceGetterSetter> list) {
|
||||
inflator = LayoutInflater.from(context);
|
||||
@@ -256,25 +186,6 @@ public class CategoryWisePerformanceActivity 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);
|
||||
}
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
@@ -301,4 +212,5 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-2
@@ -181,7 +181,7 @@ 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);
|
||||
//getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,6 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
+55
-15
@@ -73,11 +73,10 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
@@ -106,18 +105,18 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
|
||||
//if (validateData(listDataHeader, listDataChild)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
|
||||
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
||||
db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
Snackbar.make(view, getResources().getString(R.string.update_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else {
|
||||
db.InsertMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
@@ -125,7 +124,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
@@ -221,6 +220,13 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
@@ -260,7 +266,23 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
//finish();
|
||||
}
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
@@ -271,6 +293,28 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(MSL_AvailabilityActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
private Context _context;
|
||||
private List<MSL_AvailabilityGetterSetter> _listDataHeader;
|
||||
@@ -312,6 +356,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
ImageView img_camera = (ImageView) convertView.findViewById(R.id.img_camera);
|
||||
|
||||
txt_categoryHeader.setTypeface(null, Typeface.BOLD);
|
||||
txt_categoryHeader.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
txt_categoryHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
|
||||
|
||||
/*img_camera.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -393,6 +438,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimary));
|
||||
holder.txt_skuName.setText(childData.getSku());
|
||||
holder.txt_mbq.setText(childData.getMbq());
|
||||
|
||||
@@ -443,12 +489,6 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
+72
-35
@@ -45,9 +45,35 @@ public class PromoComplianceActivity 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;
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
Locale locale = new Locale(lang);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
configuration.locale = locale;
|
||||
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -75,11 +101,10 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
@@ -265,6 +290,13 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
@@ -418,7 +450,7 @@ public class PromoComplianceActivity 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);
|
||||
//getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -430,7 +462,23 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(PromoComplianceActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
//finish();
|
||||
}
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
@@ -442,35 +490,24 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(PromoComplianceActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
Locale locale = new Locale(lang);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
configuration.locale = locale;
|
||||
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
||||
+379
-156
@@ -2,6 +2,7 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@@ -26,6 +27,8 @@ import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -60,6 +63,7 @@ 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.MAPPING_PLANOGRAM_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
|
||||
@@ -79,8 +83,37 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
boolean isDialogOpen = true;
|
||||
boolean checkflag = true;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
||||
Uri outputFileUri = null;
|
||||
String gallery_package = "";
|
||||
private SharedPreferences preferences;
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
Locale locale = new Locale(lang);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
configuration.locale = locale;
|
||||
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -95,11 +128,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||
//txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
date = preferences.getString(CommonString.KEY_DATE, null);
|
||||
@@ -132,18 +164,18 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Are you sure you want to save")
|
||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
db.open();
|
||||
|
||||
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||
db.updateStockAndFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
Snackbar.make(view, getResources().getString(R.string.update_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
} else {
|
||||
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@@ -151,7 +183,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
@@ -160,9 +192,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
alert.show();
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setMessage("Fill the value or fill 0 ")
|
||||
//builder.setMessage(getResources().getString(R.string.empty_field))
|
||||
builder.setMessage(Error_Message)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
@@ -218,6 +251,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -231,6 +266,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
getCurrentFocus().clearFocus();
|
||||
}
|
||||
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -245,6 +282,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void prepareList() {
|
||||
@@ -293,10 +331,45 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
String stock = listDataChild.get(listDataHeader.get(i)).get(j).getStock();
|
||||
String faceup = listDataChild.get(listDataHeader.get(i)).get(j).getFacing();
|
||||
|
||||
//Camera allow enable
|
||||
if (camera_allow.equalsIgnoreCase("1")) {
|
||||
//Company_id
|
||||
if (listDataChild.get(listDataHeader.get(i)).get(j).getCompany_id().equals("1")) {
|
||||
//Camera allow enable
|
||||
if (camera_allow.equalsIgnoreCase("1")) {
|
||||
|
||||
if (!imagePath.equals("") || !imagePath1.equals("")) {
|
||||
if (!imagePath.equals("") || !imagePath1.equals("")) {
|
||||
if (!stock.equals("0")) {
|
||||
if (stock.equals("") || faceup.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = getResources().getString(R.string.fill_data);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (stock.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = getResources().getString(R.string.fill_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = getResources().getString(R.string.click_image);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
//Camera allow disable
|
||||
if (!stock.equals("0")) {
|
||||
if (stock.equals("") || faceup.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
@@ -318,40 +391,17 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
if (faceup.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please click either 1 image";
|
||||
Error_Message = "Please fill all the data";
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
//Camera allow disable
|
||||
if (!stock.equals("0")) {
|
||||
if (stock.equals("") || faceup.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please fill all the data";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (stock.equals("")) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "Please fill all the data";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,16 +419,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void startCameraActivity1(int position) {
|
||||
try {
|
||||
/*Log.e("Stock and Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
startActivityForResult(intent, position);*/
|
||||
|
||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||
/*try {
|
||||
Log.e("Stock & Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
@@ -387,8 +429,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
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);*/
|
||||
*//*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")) {
|
||||
@@ -410,21 +452,58 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
startActivityForResult(intent, 1);
|
||||
//startActivityForResult(intent, position);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
try {
|
||||
Log.e("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
//Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
//Log.e("TAG", "package name : " + list.get(n).packageName);
|
||||
|
||||
//temp value in case camera is gallery app above jellybean
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
gallery_package = list.get(n).packageName;
|
||||
}
|
||||
if (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("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 1);
|
||||
} 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, 1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void startCameraActivity2(int position) {
|
||||
try {
|
||||
/*Log.e("Stock and Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
startActivityForResult(intent, position);*/
|
||||
|
||||
/*try {
|
||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
Uri outputFileUri = Uri.fromFile(file);
|
||||
@@ -434,8 +513,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
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);*/
|
||||
*//*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")) {
|
||||
@@ -455,7 +534,51 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 2);
|
||||
//startActivityForResult(intent, position);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
try {
|
||||
Log.e("MakeMachine", "startCameraActivity()");
|
||||
File file = new File(path);
|
||||
outputFileUri = Uri.fromFile(file);
|
||||
|
||||
String defaultCameraPackage = "";
|
||||
final PackageManager packageManager = getPackageManager();
|
||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
//Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||
//Log.e("TAG", "package name : " + list.get(n).packageName);
|
||||
|
||||
//temp value in case camera is gallery app above jellybean
|
||||
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
|
||||
gallery_package = list.get(n).packageName;
|
||||
}
|
||||
if (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("Camera")) {
|
||||
defaultCameraPackage = list.get(n).packageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||
intent.setPackage(defaultCameraPackage);
|
||||
startActivityForResult(intent, 2);
|
||||
} 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, 2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -534,7 +657,24 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
//finish();
|
||||
}
|
||||
|
||||
//Planogram Dialog
|
||||
@@ -548,7 +688,9 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
||||
|
||||
String planogram_image = "";
|
||||
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> mp = db.getMappingPlanogramData("");
|
||||
|
||||
String planogram_image = mp.get(0).getPLANOGRAM_IMAGE();
|
||||
if (new File(str + planogram_image).exists()) {
|
||||
Bitmap bmp = BitmapFactory.decodeFile(str + planogram_image);
|
||||
img_planogram.setImageBitmap(bmp);
|
||||
@@ -579,6 +721,35 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(Stock_FacingActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
|
||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
private Context _context;
|
||||
private List<Stock_FacingGetterSetter> _listDataHeader;
|
||||
@@ -628,8 +799,16 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
if (headerTitle.getCompany_id().equals("1")) {
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||
|
||||
txt_sosHeader.setVisibility(View.VISIBLE);
|
||||
img_camera1.setVisibility(View.VISIBLE);
|
||||
img_camera2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
|
||||
|
||||
txt_sosHeader.setVisibility(View.GONE);
|
||||
img_camera1.setVisibility(View.GONE);
|
||||
img_camera2.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
//Camera allow enable
|
||||
@@ -641,7 +820,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
//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";
|
||||
_pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id()
|
||||
+ "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||
child_position = groupPosition;
|
||||
path = str + _pathforcheck;
|
||||
|
||||
@@ -669,7 +849,8 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
//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";
|
||||
_pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id()
|
||||
+ "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||
child_position = groupPosition;
|
||||
path = str + _pathforcheck;
|
||||
|
||||
@@ -695,11 +876,29 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
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));
|
||||
if (headerTitle.getCompany_id().equals("1")) {
|
||||
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.colorPrimaryDark));
|
||||
/*if (headerTitle.getCompany_id().equals("1")) {
|
||||
} else {
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!checkflag) {
|
||||
if (checkHeaderArray.contains(groupPosition)) {
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else {
|
||||
/*if (headerTitle.getCompany_id().equals("1")) {
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||
} else {*/
|
||||
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,8 +946,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
|
||||
if (childData.getCompany_id().equals("1")) {
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||
holder.ed_stock.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.txt_skuName.setTextColor(getResources().getColor(R.color.black));
|
||||
holder.ed_stock.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,6 +986,43 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
/*holder.ed_stock.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
//final EditText caption = (EditText) v;
|
||||
String edStock = s.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);
|
||||
}
|
||||
|
||||
expandableListView.invalidateViews();
|
||||
}
|
||||
});*/
|
||||
|
||||
holder.ed_stock.setText(childData.getStock());
|
||||
|
||||
holder.ed_facing.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@@ -793,44 +1031,49 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
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();
|
||||
if (childData.getCompany_id().equals("1")) {
|
||||
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 {
|
||||
childData.setFacing("");
|
||||
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();
|
||||
}
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
childData.setFacing(edFaceup);
|
||||
childData.setStock("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -840,24 +1083,39 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
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 (childData.getCompany_id().equals("1")) {
|
||||
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 (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));
|
||||
if (tempflag) {
|
||||
holder.cardView.setCardBackgroundColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else {
|
||||
holder.cardView.setCardBackgroundColor(getResources().getColor(R.color.white));
|
||||
}
|
||||
} else {
|
||||
holder.cardView.setCardBackgroundColor(getResources().getColor(R.color.white));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,39 +1139,4 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
||||
TextView txt_skuName;
|
||||
LinearLayout lin_category;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
}
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
Locale locale = new Locale(lang);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
configuration.locale = locale;
|
||||
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+56
-20
@@ -3,6 +3,7 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
@@ -21,6 +22,7 @@ import android.widget.TextView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
@@ -36,8 +38,35 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
||||
StoreWisePerformaceAdapter adapter;
|
||||
|
||||
GSKOrangeDB db;
|
||||
private SharedPreferences preferences;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
String lang ;
|
||||
|
||||
if(language.equalsIgnoreCase("English")){
|
||||
lang = "EN";
|
||||
}
|
||||
else if(language.equalsIgnoreCase("UAE")) {
|
||||
lang = "AR";
|
||||
}
|
||||
else {
|
||||
lang = "TR";
|
||||
}
|
||||
|
||||
Locale locale = new Locale(lang);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
configuration.locale = locale;
|
||||
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -51,6 +80,8 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
//preference data
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||
@@ -78,12 +109,15 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
try {
|
||||
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
|
||||
storeWisePerformanceList = db.getStoreWisePerformance(store_id);
|
||||
|
||||
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
|
||||
@@ -94,10 +128,29 @@ public class StoreWisePerformanceActivity 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 StoreWisePerformaceAdapter extends RecyclerView.Adapter<StoreWisePerformaceAdapter.MyViewHolder> {
|
||||
Context context;
|
||||
private LayoutInflater inflator;
|
||||
List<StoreWisePerformaceGetterSetter> list = Collections.emptyList();
|
||||
private LayoutInflater inflator;
|
||||
|
||||
public StoreWisePerformaceAdapter(Context context, List<StoreWisePerformaceGetterSetter> list) {
|
||||
inflator = LayoutInflater.from(context);
|
||||
@@ -152,22 +205,5 @@ public class StoreWisePerformanceActivity 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by gagang on 12-01-2017.
|
||||
*/
|
||||
|
||||
public class MAPPING_PLANOGRAM_DataGetterSetter {
|
||||
String KEYACCOUNT_ID, STORETYPE_ID, CLASS_ID, PLANOGRAM_IMAGE, IMAGE_PATH;
|
||||
|
||||
public String getKEYACCOUNT_ID() {
|
||||
return KEYACCOUNT_ID;
|
||||
}
|
||||
|
||||
public void setKEYACCOUNT_ID(String KEYACCOUNT_ID) {
|
||||
this.KEYACCOUNT_ID = KEYACCOUNT_ID;
|
||||
}
|
||||
|
||||
public String getSTORETYPE_ID() {
|
||||
return STORETYPE_ID;
|
||||
}
|
||||
|
||||
public void setSTORETYPE_ID(String STORETYPE_ID) {
|
||||
this.STORETYPE_ID = STORETYPE_ID;
|
||||
}
|
||||
|
||||
public String getCLASS_ID() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public void setCLASS_ID(String CLASS_ID) {
|
||||
this.CLASS_ID = CLASS_ID;
|
||||
}
|
||||
|
||||
public String getPLANOGRAM_IMAGE() {
|
||||
return PLANOGRAM_IMAGE;
|
||||
}
|
||||
|
||||
public void setPLANOGRAM_IMAGE(String PLANOGRAM_IMAGE) {
|
||||
this.PLANOGRAM_IMAGE = PLANOGRAM_IMAGE;
|
||||
}
|
||||
|
||||
public String getIMAGE_PATH() {
|
||||
return IMAGE_PATH;
|
||||
}
|
||||
|
||||
public void setIMAGE_PATH(String IMAGE_PATH) {
|
||||
this.IMAGE_PATH = IMAGE_PATH;
|
||||
}
|
||||
}
|
||||
@@ -160,9 +160,9 @@
|
||||
android:id="@+id/toggle_add_InStock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes"
|
||||
android:background="@drawable/toggle_selector_background"/>
|
||||
android:textOn="@string/yes"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -199,9 +199,9 @@
|
||||
android:id="@+id/toggle_add_promoAnnouncer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes"
|
||||
android:background="@drawable/toggle_selector_background" />
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -238,9 +238,9 @@
|
||||
android:id="@+id/toggle_add_runningPos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/toggle_selector_background"
|
||||
android:textOff="@string/no"
|
||||
android:textOn="@string/yes"
|
||||
android:background="@drawable/toggle_selector_background" />
|
||||
android:textOn="@string/yes" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -258,7 +258,7 @@
|
||||
android:id="@+id/btn_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_gravity="center"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:text="@string/promo_compliance_add"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:hint="@string/stock_facing_stock"
|
||||
android:inputType="number"
|
||||
android:maxLength="7"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
@@ -105,6 +106,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:hint="@string/stock_facing_faceup"
|
||||
android:inputType="number"
|
||||
android:maxLength="7"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_planogram"
|
||||
android:icon="@mipmap/star"
|
||||
android:icon="@mipmap/ref_images_white"
|
||||
android:orderInCategory="100"
|
||||
android:title="planogram"
|
||||
app:showAsAction="always" />
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -120,4 +120,6 @@
|
||||
|
||||
<string name="select_language_item">Dil Seçimi</string>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -161,6 +161,15 @@
|
||||
<!--Gagan start new code 2-->
|
||||
<string name="stock_facing_planogram_dialog_title">Planogram</string>
|
||||
<string name="title_activity_settings">SettingsActivity</string>
|
||||
|
||||
<string name="ok">OK</string>
|
||||
<string name="check_save_message">Are you sure you want to save</string>
|
||||
<string name="save_message">Data has been saved</string>
|
||||
<string name="update_message">Data has been updated</string>
|
||||
<string name="empty_field">Fill the value </string>
|
||||
<string name="fill_data">Please fill all the data</string>
|
||||
<string name="dialog_title">Parinaam</string>
|
||||
|
||||
<!--Gagan end new code 2-->
|
||||
|
||||
<string name="select_language_item">Select language</string>
|
||||
|
||||
Reference in New Issue
Block a user