Merge branch 'master' of https://github.com/CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/GSKORANGEV1 into Category_G
# Conflicts: # GSKMTOrange/src/main/AndroidManifest.xml # GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java
This commit is contained in:
@@ -178,7 +178,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
|
|
||||||
} else if (id == R.id.nav_setting) {
|
} else if (id == R.id.nav_setting) {
|
||||||
startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
|
//startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
|
||||||
} else if (id == R.id.nav_export) {
|
} else if (id == R.id.nav_export) {
|
||||||
|
|
||||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.view.View;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
import com.google.android.gms.common.api.GoogleApiClient;
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
import com.google.android.gms.location.LocationServices;
|
import com.google.android.gms.location.LocationServices;
|
||||||
@@ -37,36 +38,35 @@ import cpm.com.gskmtorange.R;
|
|||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||||
|
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ashishc on 31-05-2016.
|
* Created by ashishc on 31-05-2016.
|
||||||
*/
|
*/
|
||||||
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,
|
||||||
|
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
||||||
|
|
||||||
|
ImageView img_cam, img_clicked;
|
||||||
ImageView img_cam,img_clicked;
|
|
||||||
Button btn_save;
|
Button btn_save;
|
||||||
|
|
||||||
String _pathforcheck,_path,str;
|
String _pathforcheck, _path, str;
|
||||||
|
|
||||||
String store_id,visit_date,username,intime,date;
|
String store_id, visit_date, username, intime, date;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
AlertDialog alert;
|
AlertDialog alert;
|
||||||
String img_str;
|
String img_str;
|
||||||
private GSKOrangeDB database;
|
private GSKOrangeDB database;
|
||||||
|
|
||||||
String lat,lon;
|
String lat, lon;
|
||||||
GoogleApiClient mGoogleApiClient;
|
GoogleApiClient mGoogleApiClient;
|
||||||
ArrayList<CoverageBean> coverage_list;
|
ArrayList<CoverageBean> coverage_list;
|
||||||
|
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_storeimage);
|
setContentView(R.layout.activity_storeimage);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
@@ -90,8 +90,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
database = new GSKOrangeDB(this);
|
database = new GSKOrangeDB(this);
|
||||||
database.open();
|
database.open();
|
||||||
|
|
||||||
|
coverage_list = database.getCoverageData(date);
|
||||||
coverage_list = database.getCoverageData(date);
|
|
||||||
|
|
||||||
img_cam.setOnClickListener(this);
|
img_cam.setOnClickListener(this);
|
||||||
img_clicked.setOnClickListener(this);
|
img_clicked.setOnClickListener(this);
|
||||||
@@ -106,13 +105,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Build.VERSION.SDK_INT >= 23 &&
|
if (Build.VERSION.SDK_INT >= 23 &&
|
||||||
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||||
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,13 +119,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
if(id==android.R.id.home){
|
if (id == android.R.id.home) {
|
||||||
|
|
||||||
// NavUtils.navigateUpFromSameTask(this);
|
// NavUtils.navigateUpFromSameTask(this);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -136,12 +130,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
/*Intent i = new Intent(this, DailyEntryScreen.class);
|
/*Intent i = new Intent(this, DailyEntryScreen.class);
|
||||||
startActivity(i);*/
|
startActivity(i);*/
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,12 +142,12 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
switch (id){
|
switch (id) {
|
||||||
|
|
||||||
case R.id.img_cam_selfie:
|
case R.id.img_cam_selfie:
|
||||||
|
|
||||||
_pathforcheck = store_id + "Store"
|
_pathforcheck = store_id + "Store"
|
||||||
+ "Image" + visit_date.replace("/","") + getCurrentTime().replace(":","")+".jpg";
|
+ "Image" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
|
|
||||||
_path = CommonString.FILE_PATH + _pathforcheck;
|
_path = CommonString.FILE_PATH + _pathforcheck;
|
||||||
|
|
||||||
@@ -167,41 +159,34 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
case R.id.btn_save_selfie:
|
case R.id.btn_save_selfie:
|
||||||
|
|
||||||
if (img_str !=null) {
|
if (img_str != null) {
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
|
||||||
StoreimageActivity.this);
|
|
||||||
builder.setMessage("Do you want to save the data ")
|
builder.setMessage("Do you want to save the data ")
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton("OK",
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
new DialogInterface.OnClickListener() {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
public void onClick(
|
|
||||||
DialogInterface dialog,
|
|
||||||
int id) {
|
|
||||||
|
|
||||||
alert.getButton(
|
alert.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||||
AlertDialog.BUTTON_POSITIVE)
|
|
||||||
.setEnabled(false);
|
|
||||||
|
|
||||||
String status ="INVALID";
|
String status = "INVALID";
|
||||||
|
|
||||||
|
CoverageBean cdata = new CoverageBean();
|
||||||
|
cdata.setStoreId(store_id);
|
||||||
|
cdata.setVisitDate(visit_date);
|
||||||
|
cdata.setUserId(username);
|
||||||
|
cdata.setInTime(intime);
|
||||||
|
cdata.setReason("");
|
||||||
|
cdata.setReasonid("0");
|
||||||
|
cdata.setLatitude(lat);
|
||||||
|
cdata.setLongitude(lon);
|
||||||
|
cdata.setImage(img_str);
|
||||||
|
cdata.setRemark("");
|
||||||
|
cdata.setStatus(CommonString.KEY_CHECK_IN);
|
||||||
|
|
||||||
CoverageBean cdata = new CoverageBean();
|
database.InsertCoverageData(cdata);
|
||||||
cdata.setStoreId(store_id);
|
|
||||||
cdata.setVisitDate(visit_date);
|
|
||||||
cdata.setUserId(username);
|
|
||||||
cdata.setInTime(intime);
|
|
||||||
cdata.setReason("");
|
|
||||||
cdata.setReasonid("0");
|
|
||||||
cdata.setLatitude(lat);
|
|
||||||
cdata.setLongitude(lon);
|
|
||||||
cdata.setImage(img_str);
|
|
||||||
cdata.setRemark("");
|
|
||||||
cdata.setStatus(CommonString.KEY_CHECK_IN);
|
|
||||||
|
|
||||||
database.InsertCoverageData(cdata);
|
database.updateCheckoutStatus(store_id, status);
|
||||||
|
|
||||||
database.updateCheckoutStatus(store_id, status);
|
|
||||||
|
|
||||||
/* SharedPreferences.Editor editor = preferences.edit();
|
/* SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
@@ -211,41 +196,28 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
editor.commit();*/
|
editor.commit();*/
|
||||||
|
|
||||||
|
|
||||||
/* Intent in=new Intent(StoreimageActivity.this,StoreEntry.class);
|
Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class);
|
||||||
startActivity(in);
|
startActivity(in);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
finish();*/
|
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||||
}
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
})
|
dialog.cancel();
|
||||||
.setNegativeButton("Cancel",
|
}
|
||||||
new DialogInterface.OnClickListener() {
|
});
|
||||||
public void onClick(
|
|
||||||
DialogInterface dialog,
|
|
||||||
int id) {
|
|
||||||
dialog.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alert = builder.create();
|
alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getApplicationContext(), "Please click the image", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Toast.makeText(getApplicationContext(),
|
|
||||||
"Please click the image", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startCameraActivity() {
|
protected void startCameraActivity() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/*Log.i("MakeMachine", "startCameraActivity()");
|
/*Log.i("MakeMachine", "startCameraActivity()");
|
||||||
File file = new File(_path);
|
File file = new File(_path);
|
||||||
@@ -261,10 +233,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
File file = new File(_path);
|
File file = new File(_path);
|
||||||
Uri outputFileUri = Uri.fromFile(file);
|
Uri outputFileUri = Uri.fromFile(file);
|
||||||
|
|
||||||
String defaultCameraPackage="";
|
String defaultCameraPackage = "";
|
||||||
final PackageManager packageManager = getPackageManager();
|
final PackageManager packageManager = getPackageManager();
|
||||||
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
for (int n=0;n<list.size();n++) {
|
for (int n = 0; n < list.size(); n++) {
|
||||||
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||||
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||||
Log.e("TAG", "package name : " + list.get(n).packageName);
|
Log.e("TAG", "package name : " + list.get(n).packageName);
|
||||||
@@ -281,38 +253,30 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||||
intent.setPackage(defaultCameraPackage);
|
intent.setPackage(defaultCameraPackage);
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
Log.i("MakeMachine", "resultCode: " + resultCode);
|
Log.i("MakeMachine", "resultCode: " + resultCode);
|
||||||
switch (resultCode) {
|
switch (resultCode) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
Log.i("MakeMachine", "User cancelled");
|
Log.i("MakeMachine", "User cancelled");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
|
||||||
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||||
if (new File(str + _pathforcheck).exists()) {
|
if (new File(str + _pathforcheck).exists()) {
|
||||||
|
|
||||||
|
|
||||||
Bitmap bmp = BitmapFactory.decodeFile(str + _pathforcheck);
|
Bitmap bmp = BitmapFactory.decodeFile(str + _pathforcheck);
|
||||||
|
|
||||||
img_cam.setImageBitmap(bmp);
|
img_cam.setImageBitmap(bmp);
|
||||||
|
|
||||||
img_clicked.setVisibility(View.GONE);
|
img_clicked.setVisibility(View.GONE);
|
||||||
@@ -320,21 +284,14 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
img_str = _pathforcheck;
|
img_str = _pathforcheck;
|
||||||
_pathforcheck = "";
|
_pathforcheck = "";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCurrentTime() {
|
public String getCurrentTime() {
|
||||||
|
|
||||||
Calendar m_cal = Calendar.getInstance();
|
Calendar m_cal = Calendar.getInstance();
|
||||||
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
|
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
|
||||||
@@ -344,18 +301,15 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
|
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
|
||||||
|
|
||||||
return cdate;
|
return cdate;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnected(Bundle bundle) {
|
public void onConnected(Bundle bundle) {
|
||||||
|
|
||||||
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||||
if (mLastLocation != null) {
|
if (mLastLocation != null) {
|
||||||
lat = String.valueOf(mLastLocation.getLatitude());
|
lat = String.valueOf(mLastLocation.getLatitude());
|
||||||
lon = String.valueOf(mLastLocation.getLongitude());
|
lon = String.valueOf(mLastLocation.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -378,4 +332,4 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-1
@@ -2,7 +2,9 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
@@ -24,6 +26,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
|
||||||
|
|
||||||
public class CategoryListActivity extends AppCompatActivity {
|
public class CategoryListActivity extends AppCompatActivity {
|
||||||
@@ -35,6 +38,9 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
|
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -48,6 +54,17 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
db = new GSKOrangeDB(this);
|
db = new GSKOrangeDB(this);
|
||||||
db.open();
|
db.open();
|
||||||
|
|
||||||
|
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);
|
||||||
|
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||||
|
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||||
|
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||||
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
|
|
||||||
|
|
||||||
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||||
//txt_categoryName.setText("Category List");
|
//txt_categoryName.setText("Category List");
|
||||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));
|
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));
|
||||||
@@ -69,7 +86,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||||
categoryList = new ArrayList<>();
|
categoryList = new ArrayList<>();
|
||||||
|
|
||||||
categoryList = db.getCategoryListData("1", "1", "1");
|
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id);
|
||||||
|
|
||||||
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
|
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
@@ -100,6 +117,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
holder.categoryName.setText(categoryData.getCategory());
|
holder.categoryName.setText(categoryData.getCategory());
|
||||||
holder.categoryIcon.setImageResource(R.drawable.category);
|
holder.categoryIcon.setImageResource(R.drawable.category);
|
||||||
|
/*if (categoryData.getCategory().equalsIgnoreCase("Oral Health")) {
|
||||||
|
holder.categoryIcon.setImageResource(R.drawable.ohc);
|
||||||
|
} else if (categoryData.getCategory().equalsIgnoreCase("Wellness")) {
|
||||||
|
holder.categoryIcon.setImageResource(R.drawable.pdr);
|
||||||
|
} else if (categoryData.getCategory().equalsIgnoreCase("Nutritionals")) {
|
||||||
|
holder.categoryIcon.setImageResource(R.drawable.hfd);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
|
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+25
-7
@@ -3,8 +3,10 @@ package cpm.com.gskmtorange.gsk_dailyentry;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
@@ -34,6 +36,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||||
|
|
||||||
public class MSL_AvailabilityActivity extends AppCompatActivity {
|
public class MSL_AvailabilityActivity extends AppCompatActivity {
|
||||||
@@ -51,6 +54,9 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
String categoryName, categoryId, storeId;
|
String categoryName, categoryId, storeId;
|
||||||
|
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -61,15 +67,27 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
|||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
db = new GSKOrangeDB(this);
|
|
||||||
db.open();
|
|
||||||
|
|
||||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||||
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
|
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
|
||||||
|
|
||||||
|
db = new GSKOrangeDB(this);
|
||||||
|
db.open();
|
||||||
|
|
||||||
|
//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);
|
||||||
|
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||||
|
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||||
|
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||||
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
|
|
||||||
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
categoryId = getIntent().getStringExtra("categoryId");
|
categoryId = getIntent().getStringExtra("categoryId");
|
||||||
storeId = "";
|
|
||||||
|
|
||||||
//txt_mslAvailabilityName.setText(categoryName);
|
//txt_mslAvailabilityName.setText(categoryName);
|
||||||
txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
@@ -89,10 +107,10 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
|||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
db.open();
|
db.open();
|
||||||
|
|
||||||
if (db.checkMsl_AvailabilityData(storeId, categoryId)) {
|
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
|
||||||
db.updateMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
} else {
|
} else {
|
||||||
db.InsertMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
db.InsertMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||||
|
|||||||
+26
-11
@@ -4,6 +4,7 @@ import android.app.AlertDialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@@ -11,6 +12,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
@@ -61,13 +63,16 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
ExpandableListAdapter adapter;
|
ExpandableListAdapter adapter;
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
|
|
||||||
String categoryName, categoryId, storeId, Error_Message = "";
|
String categoryName, categoryId, Error_Message = "";
|
||||||
|
|
||||||
String path = "", str = "", _pathforcheck = "", img1 = "", img2 = "";
|
String path = "", str = "", _pathforcheck = "", img1 = "", img2 = "";
|
||||||
static int child_position = -1;
|
static int child_position = -1;
|
||||||
boolean isDialogOpen = true;
|
boolean isDialogOpen = true;
|
||||||
boolean checkflag = true;
|
boolean checkflag = true;
|
||||||
|
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -84,9 +89,19 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||||
txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
|
||||||
|
|
||||||
|
//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);
|
||||||
|
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||||
|
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||||
|
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||||
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
|
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
categoryId = getIntent().getStringExtra("categoryId");
|
categoryId = getIntent().getStringExtra("categoryId");
|
||||||
storeId = "";
|
|
||||||
|
|
||||||
//txt_stockFacingName.setText(categoryName);
|
//txt_stockFacingName.setText(categoryName);
|
||||||
txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
||||||
@@ -110,10 +125,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
db.open();
|
db.open();
|
||||||
|
|
||||||
if (db.checkStockAndFacingData(storeId, categoryId)) {
|
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||||
db.updateStockAndFacing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
db.updateStockAndFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
} else {
|
} else {
|
||||||
db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
|
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
|
||||||
@@ -292,10 +307,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
img_camera1.setOnClickListener(new View.OnClickListener() {
|
img_camera1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String date = new Date().toLocaleString().toString();
|
//String date = new Date().toLocaleString().toString();
|
||||||
String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||||
|
|
||||||
_pathforcheck = "Stock_Cam1_" + storeId + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
_pathforcheck = "Stock_Cam1_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
child_position = groupPosition;
|
child_position = groupPosition;
|
||||||
path = str + _pathforcheck;
|
path = str + _pathforcheck;
|
||||||
|
|
||||||
@@ -320,10 +335,10 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
img_camera2.setOnClickListener(new View.OnClickListener() {
|
img_camera2.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String date = new Date().toLocaleString().toString();
|
//String date = new Date().toLocaleString().toString();
|
||||||
String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
|
||||||
|
|
||||||
_pathforcheck = "Stock_Cam1_" + storeId + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
_pathforcheck = "Stock_Cam2_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
|
||||||
child_position = groupPosition;
|
child_position = groupPosition;
|
||||||
path = str + _pathforcheck;
|
path = str + _pathforcheck;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Reference in New Issue
Block a user