T2P upload data newss

This commit is contained in:
yadavendras
2017-01-12 19:05:45 +05:30
parent 5a02ac0d6b
commit d3606ada7b
9 changed files with 7 additions and 431 deletions
@@ -653,7 +653,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
alert.show();
}
public class T2PAdapter extends RecyclerView.Adapter<T2PAdapter.ViewHolder> {
/* public class T2PAdapter extends RecyclerView.Adapter<T2PAdapter.ViewHolder> {
private ArrayList<T2PGetterSetter> list;
@@ -677,9 +677,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
*//* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
*/
*//*
holder.btn_gaps.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -786,7 +786,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
}
}
}
}*/
public class GapsAdapter extends RecyclerView.Adapter<GapsAdapter.ViewHolder> {
@@ -21,6 +21,7 @@ import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
@@ -91,23 +92,7 @@ public class DownloadActivity extends AppCompatActivity {
new UploadTask(DownloadActivity.this).execute();
}
public void showAlert(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(DownloadActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
/* Intent i = new Intent(activity, StorelistActivity.class);
activity.startActivity(i);
activity.finish();*/
}
});
AlertDialog alert = builder.create();
alert.show();
}
class Data {
int value;
@@ -730,20 +715,8 @@ public class DownloadActivity extends AppCompatActivity {
showAlert(CommonString.MESSAGE_SOCKETEXCEPTION);
}
});
} catch (Exception e) {
/* final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this,
AlertMessage.MESSAGE_EXCEPTION, "download", e);*/
/* e.getMessage();
} catch (XmlPullParserException e) {
e.printStackTrace();
e.getCause();*/
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
}
return "";
}
@@ -213,33 +213,6 @@ public class CategoryListActivity extends AppCompatActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
private static boolean updateResources(Context context, String language) {
@@ -104,16 +104,7 @@ 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();
}
@@ -282,32 +282,6 @@ public class DailyDataMenuActivity extends AppCompatActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
private static boolean updateResources(Context context, String language) {
@@ -442,24 +442,6 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
LinearLayout lin_category;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onResume() {
@@ -882,235 +882,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
LinearLayout lin_category;
}
boolean validateData(List<Stock_FacingGetterSetter> listDataHeader,
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listDataChild) {
boolean flag = true;
checkHeaderArray.clear();
for (int i = 0; i < listDataHeader.size(); i++) {
String imagePath = listDataHeader.get(i).getImage1();
String imagePath1 = listDataHeader.get(i).getImage2();
for (int j = 0; j < listDataChild.get(listDataHeader.get(i)).size(); j++) {
String stock = listDataChild.get(listDataHeader.get(i)).get(j).getStock();
String faceup = listDataChild.get(listDataHeader.get(i)).get(j).getFacing();
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 = "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;
}
}
} else {
if (!checkHeaderArray.contains(i)) {
checkHeaderArray.add(i);
}
flag = false;
Error_Message = "Please click either 1 image";
break;
}
}
if (flag == false) {
checkflag = false;
break;
} else {
checkflag = true;
}
}
//expListView.invalidate();
adapter.notifyDataSetChanged();
return checkflag;
}
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()");
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 {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
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);
//startActivityForResult(intent, position);
} 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);*/
Log.i("Stock & Facing ", "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 {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
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);
//startActivityForResult(intent, position);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("Stock & Facing", "resultCode: " + resultCode);
/*switch (resultCode) {
case 0:
Log.e("Stock & Facing", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img1 = _pathforcheck;
adapter.notifyDataSetChanged();
_pathforcheck = "";
}
}
break;
}*/
switch (requestCode) {
case 1:
if (resultCode == -1) {
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img1 = _pathforcheck;
adapter.notifyDataSetChanged();
_pathforcheck = "";
}
}
} else {
Log.e("Stock & Facing", "User cancelled");
}
break;
case 2:
if (resultCode == -1) {
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img2 = _pathforcheck;
adapter.notifyDataSetChanged();
_pathforcheck = "";
}
}
} else {
Log.e("Stock & Facing", "User cancelled");
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
public String getCurrentTime() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String cdate = formatter.format(m_cal.getTime());
/* String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":"
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
return cdate;
}
@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);
}
@Override
protected void onResume() {
@@ -954,84 +954,6 @@ public class UploadActivity extends AppCompatActivity {
}
}
public String UploadImage(String path, String folder_name) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Path + path, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 1639;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
String[] split = path.split("/");
String path1 = split[split.length - 1];
request.addProperty("img", ba1);
request.addProperty("name", path1);
request.addProperty("FolderName", folder_name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
Object result = (Object) envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
}
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}
} else {
new File(Path + path).delete();
}
return result.toString();
}
@Override
protected void onResume() {
@@ -55,18 +55,8 @@
<string name="select_reason">Bir sebep seçiniz</string>
<string name="daily_activity_menu">Günlük Veri Menüsü</string>
<string name="daily_data_menu_msl_availability">Bulunurluk</string>
<string name="daily_data_menu_stock_facing">Raf Payı</string>
<string name="daily_data_menu_t2p">Kalıcı Teşhir</string>
<string name="daily_data_menu_additional_visibility">Ek Teşhir</string>
<string name="daily_data_menu_promo_compliance">Promosyon</string>
<string name="daily_data_menu_competition_tracking">Rakip Bilgisi</string>
<string name="daily_data_menu_additional_promotions">Competition Promo</string>
<string name="closed">kapalı</string>
<string name="title_activity_promo_compliance">Promosyon</string>
<!--Gagan Start Code -->
<string name="title_activity_category_list">Kategoriler</string>
<string name="title_activity_category_wise_performance">Kategori Performansı</string>