Category image
This commit is contained in:
@@ -2316,7 +2316,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
try {
|
||||
|
||||
cursordata = db.rawQuery("SELECT * FROM STOCK_DIALOG WHERE COMMON_ID = '" + keyid + "'", null);
|
||||
cursordata = db.rawQuery("SELECT * FROM STOCK_DIALOG_MAIN WHERE COMMON_ID = '" + keyid + "'", null);
|
||||
|
||||
if (cursordata != null) {
|
||||
cursordata.moveToFirst();
|
||||
|
||||
@@ -170,14 +170,6 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
||||
geocoder = new Geocoder(this);
|
||||
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
|
||||
|
||||
if (checkPlayServices()) {
|
||||
|
||||
// Building the GoogleApi client
|
||||
buildGoogleApiClient();
|
||||
}
|
||||
|
||||
|
||||
if (checkPlayServices()) {
|
||||
|
||||
// Building the GoogleApi client
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cpm.com.gskmtorange.dailyentry;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@@ -13,13 +14,16 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.location.Geocoder;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@@ -32,10 +36,19 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.appindexing.AppIndex;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.location.LocationListener;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
|
||||
import org.ksoap2.SoapEnvelope;
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||
@@ -59,6 +72,7 @@ import java.util.Locale;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import cpm.com.gskmtorange.GeoTag.GeoTagActivity;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
@@ -72,7 +86,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
* Created by ashishc on 31-05-2016.
|
||||
*/
|
||||
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,
|
||||
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||
|
||||
String gallery_package = "";
|
||||
Uri outputFileUri;
|
||||
@@ -91,13 +105,25 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
String img_str, strflag;
|
||||
private GSKOrangeDB database;
|
||||
|
||||
String lat, lon;
|
||||
double lat, lon;
|
||||
GoogleApiClient mGoogleApiClient;
|
||||
ArrayList<CoverageBean> coverage_list;
|
||||
Toolbar toolbar;
|
||||
boolean ResultFlag = true;
|
||||
ArrayList<CoverageBean> coverage = new ArrayList<CoverageBean>();
|
||||
|
||||
LocationManager locationManager;
|
||||
boolean enabled;
|
||||
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
|
||||
|
||||
private LocationRequest mLocationRequest;
|
||||
private static int UPDATE_INTERVAL = 500; // 5 sec
|
||||
private static int FATEST_INTERVAL = 100; // 1 sec
|
||||
private static int DISPLACEMENT = 5; // 10 meters
|
||||
private Location mLastLocation;
|
||||
|
||||
private static final String TAG = StoreimageActivity.class.getSimpleName();
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_storeimage);
|
||||
@@ -133,6 +159,53 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
img_clicked.setOnClickListener(this);
|
||||
btn_save.setOnClickListener(this);
|
||||
|
||||
if (checkPlayServices()) {
|
||||
|
||||
// Building the GoogleApi client
|
||||
buildGoogleApiClient();
|
||||
|
||||
createLocationRequest();
|
||||
}
|
||||
|
||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
|
||||
if (!enabled) {
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(
|
||||
StoreimageActivity.this);
|
||||
|
||||
// Setting Dialog Title
|
||||
alertDialog.setTitle(getResources().getString(R.string.gps));
|
||||
|
||||
// Setting Dialog Message
|
||||
alertDialog.setMessage(getResources().getString(R.string.gpsebale));
|
||||
|
||||
// Setting Positive "Yes" Button
|
||||
alertDialog.setPositiveButton(getResources().getString(R.string.yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
Intent intent = new Intent(
|
||||
Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// Setting Negative "NO" Button
|
||||
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
|
||||
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// Showing Alert Message
|
||||
alertDialog.show();
|
||||
|
||||
}
|
||||
|
||||
// Create an instance of GoogleAPIClient.
|
||||
if (mGoogleApiClient == null) {
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||
@@ -165,6 +238,125 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private boolean checkPlayServices() {
|
||||
int resultCode = GooglePlayServicesUtil
|
||||
.isGooglePlayServicesAvailable(this);
|
||||
if (resultCode != ConnectionResult.SUCCESS) {
|
||||
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
|
||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
||||
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.notsuppoted)
|
||||
, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
finish();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected synchronized void buildGoogleApiClient() {
|
||||
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||
.addConnectionCallbacks(this)
|
||||
.addOnConnectionFailedListener(this)
|
||||
.addApi(LocationServices.API).build();
|
||||
}
|
||||
|
||||
|
||||
protected void createLocationRequest() {
|
||||
mLocationRequest = new LocationRequest();
|
||||
mLocationRequest.setInterval(UPDATE_INTERVAL);
|
||||
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
|
||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
|
||||
}
|
||||
|
||||
protected void startLocationUpdates() {
|
||||
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stopping location updates
|
||||
*/
|
||||
protected void stopLocationUpdates() {
|
||||
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
|
||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (mLastLocation != null) {
|
||||
lat = mLastLocation.getLatitude();
|
||||
lon = mLastLocation.getLongitude();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (mRequestingLocationUpdates) {
|
||||
startLocationUpdates();
|
||||
// }
|
||||
|
||||
// startLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionSuspended(int i) {
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(ConnectionResult connectionResult) {
|
||||
Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + connectionResult.getErrorCode());
|
||||
}
|
||||
|
||||
|
||||
protected void onStart() {
|
||||
super.onStart();// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
//client.connect();
|
||||
if (mGoogleApiClient != null) {
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
// AppIndex.AppIndexApi.start(client, getIndexApiAction());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
// AppIndex.AppIndexApi.end(client, getIndexApiAction());
|
||||
if (mGoogleApiClient.isConnected()) {
|
||||
mGoogleApiClient.disconnect();
|
||||
}
|
||||
// ATTENTION: This was auto-generated to implement the App Indexing API.
|
||||
// See https://g.co/AppIndexing/AndroidStudio for more information.
|
||||
//client.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
stopLocationUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
/*Intent i = new Intent(this, DailyEntryScreen.class);
|
||||
@@ -212,8 +404,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
cdata.setInTime(intime);
|
||||
cdata.setReason("");
|
||||
cdata.setReasonid("0");
|
||||
cdata.setLatitude(lat);
|
||||
cdata.setLongitude(lon);
|
||||
cdata.setLatitude(lat+"");
|
||||
cdata.setLongitude(lon+"");
|
||||
cdata.setImage(img_str);
|
||||
cdata.setRemark("");
|
||||
cdata.setStatus(CommonString.KEY_INVALID);
|
||||
@@ -357,33 +549,22 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
return cdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(Bundle bundle) {
|
||||
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||
if (mLastLocation != null) {
|
||||
lat = String.valueOf(mLastLocation.getLatitude());
|
||||
lon = String.valueOf(mLastLocation.getLongitude());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionSuspended(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(ConnectionResult connectionResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||
toolbar.setTitle(R.string.title_activity_store_image);
|
||||
|
||||
// Resuming the periodic location updates
|
||||
if (mGoogleApiClient.isConnected() ) {
|
||||
startLocationUpdates();
|
||||
}
|
||||
|
||||
protected void onStart() {
|
||||
}
|
||||
|
||||
/*protected void onStart() {
|
||||
mGoogleApiClient.connect();
|
||||
super.onStart();
|
||||
}
|
||||
@@ -391,7 +572,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
protected void onStop() {
|
||||
mGoogleApiClient.disconnect();
|
||||
super.onStop();
|
||||
}
|
||||
}*/
|
||||
|
||||
private static boolean updateResources(Context context, String language) {
|
||||
|
||||
@@ -435,6 +616,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class GeoTagUpload extends AsyncTask<Void, Void, String> {
|
||||
|
||||
|
||||
+19
-1
@@ -40,7 +40,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
CategoryListAdapter adapter;
|
||||
|
||||
GSKOrangeDB db;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id,camera_allow;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
@Override
|
||||
@@ -65,6 +65,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||
|
||||
|
||||
/*txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||
@@ -147,6 +148,15 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
//Category image
|
||||
if (camera_allow.equalsIgnoreCase("1")) {
|
||||
//if (category_camera_list.size()>0) {
|
||||
if (!db.isCategoryPictureData(store_id, category_id)) {
|
||||
flag = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
flag_filled = flag;
|
||||
}
|
||||
|
||||
@@ -364,6 +374,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
if (camera_allow.equalsIgnoreCase("1")) {
|
||||
//if (category_camera_list.size()>0) {
|
||||
if (!db.isCategoryPictureData(store_id, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flag_filled = true;
|
||||
} else {
|
||||
flag_filled = false;
|
||||
|
||||
+5
-1
@@ -26,6 +26,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
||||
@@ -44,6 +45,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
ArrayList<CategoryPictureGetterSetter> category_camera_list;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -186,11 +189,12 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
}
|
||||
categoryList.add(data);
|
||||
|
||||
|
||||
//Category Pictures
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_category_picture));
|
||||
//category_camera_list = db.getCategoryPicturedata(categoryId, keyAccount_id, storeType_id, class_id);
|
||||
if (camera_allow.equalsIgnoreCase("1")) {
|
||||
//if (category_camera_list.size()>0) {
|
||||
if (db.isCategoryPictureData(store_id, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
} else {
|
||||
|
||||
@@ -637,7 +637,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
+ "[DISPLAY_ID]" + additionalVisibilityList.get(J).getSku_id() + "[/DISPLAY_ID]"
|
||||
+ "[SKU_LIST]" + additional_visibility_dialog_xml + "[/SKU_LIST]"
|
||||
+ "[/ADDITIONAL_VISIBILITY_NEW]";
|
||||
|
||||
//Here getSku_id gives display_id
|
||||
|
||||
additional_visibility_data_xml = additional_visibility_data_xml + onXML;
|
||||
KeyID = "";
|
||||
@@ -720,7 +720,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
/*String brandxml = "";
|
||||
String brandxml = "";
|
||||
String brandchild;
|
||||
|
||||
if (brandList.size() > 0) {
|
||||
@@ -735,7 +735,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
+ "[/BRAND]";
|
||||
brandxml = brandxml + brandchild;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
String present = "";
|
||||
if (t2PGetterSetters.get(i1).isPresent()) {
|
||||
@@ -757,7 +757,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||
+ "[PRESENT]" + present + "[/PRESENT]"
|
||||
+ "[GAPS_DATA]" + gaps_xml + "[/GAPS_DATA]"
|
||||
+ "[SKU_DATA]" + sku_xml + "[/SKU_DATA]"
|
||||
//+ "[BRAND_DATA]" + brandxml + "[/BRAND_DATA]"
|
||||
+ "[BRAND_DATA]" + brandxml + "[/BRAND_DATA]"
|
||||
+ "[/T2P_DATA]";
|
||||
|
||||
t2p_data_xml = t2p_data_xml + onXML;
|
||||
|
||||
Reference in New Issue
Block a user