Merge branch 'master' into GeoT

This commit is contained in:
YadavendraSinghYaduvanshi
2017-01-06 11:59:56 +05:30
committed by GitHub
23 changed files with 881 additions and 435 deletions
+52 -42
View File
@@ -35,51 +35,31 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"/>
<activity android:name=".autoupdate.AutoUpdateActivity"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".autoupdate.AutoUpdateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".SelectLanguageActivity"
android:label="@string/title_activity_select_language"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".download.DownloadActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".download.DownloadActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GeoTag.GeoTagStoreList"
android:label="@string/title_activity_store_list_geotag"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"/>
<!-- android:label="@string/title_activity_category_wise_performance" -->
<activity
android:name=".gsk_dailyentry.DailyDataMenuActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"/>
<!-- android:label="@string/title_activity_daily_main_menu" -->
<activity
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"/>
<!-- android:label="@string/title_activity_msl__availability" -->
<activity
android:name=".dailyentry.StoreListActivity"
android:label="@string/title_activity_store_list_geotag"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".dailyentry.StoreimageActivity"
android:label="@string/title_activity_store_list_geotag"
@@ -97,27 +77,57 @@
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".gsk_dailyentry.Stock_FacingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"/>
<activity
android:name=".dailyentry.T2PComplianceActivity"
android:label="@string/title_activity_t2_pcompliance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"></activity>
android:theme="@style/AppTheme.NoActionBar" />
<!--Gagan Start Declaration-->
<activity
android:name=".gsk_dailyentry.CategoryListActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.DailyDataMenuActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.Stock_FacingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!--Gagan End Declaration-->
<activity
android:name=".dailyentry.NonWorkingReason"
android:label="@string/title_activity_t2_pcompliance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application>
</manifest>
@@ -15,30 +15,28 @@ import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans;
import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
/**
* Created by ashishc on 29-12-2016.
@@ -67,7 +65,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(TableBean.getJourneyPlan());
//Gagan
//Gagan Start
db.execSQL(TableBean.getBrandMaster());
db.execSQL(TableBean.getSkuMaster());
db.execSQL(TableBean.getCategoryMaster());
@@ -75,21 +73,21 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(TableBean.getDisplayMaster());
db.execSQL(TableBean.getMappingStock());
db.execSQL(TableBean.getMappingT2p());
db.execSQL(TableBean.getNonWorkingReason());
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_CHILD);
//Gagan End
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
db.execSQL(TableBean.getDisplayChecklistMaster());
db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getNonWorkingReason());
}
@Override
@@ -152,17 +150,17 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
}
public ArrayList<T2PGetterSetter> getT2PDefaultData(String store_id){
public ArrayList<T2PGetterSetter> getT2PDefaultData(String store_id) {
ArrayList<T2PGetterSetter> t2PList = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select BM.BRAND As BRAND, BM.BRAND_ID As BRAND_ID, DM.DISPLAY As DISPLAY, DM.DISPLAY_ID As DISPLAY_ID from BRAND_MASTER BM INNER JOIN MAPPING_T2P T ON BM.BRAND_ID = T.BRAND_ID INNER JOIN DISPLAY_MASTER DM ON T.DISPLAY_ID= DM.DISPLAY_ID WHERE T.STORE_ID = '"+ store_id +"'",null);
if(dbcursor != null){
dbcursor = db.rawQuery("Select BM.BRAND As BRAND, BM.BRAND_ID As BRAND_ID, DM.DISPLAY As DISPLAY, DM.DISPLAY_ID As DISPLAY_ID from BRAND_MASTER BM INNER JOIN MAPPING_T2P T ON BM.BRAND_ID = T.BRAND_ID INNER JOIN DISPLAY_MASTER DM ON T.DISPLAY_ID= DM.DISPLAY_ID WHERE T.STORE_ID = '" + store_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while(!dbcursor.isAfterLast()){
while (!dbcursor.isAfterLast()) {
T2PGetterSetter t2p = new T2PGetterSetter();
@@ -192,8 +190,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
dbcursor.close();
return t2PList;
}
}
catch (Exception e){
} catch (Exception e) {
Log.d("Exception get T2P", e.toString());
return t2PList;
@@ -203,17 +200,17 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//get Gaps data
public ArrayList<GapsChecklistGetterSetter> getGapsDefaultData(String display_id){
public ArrayList<GapsChecklistGetterSetter> getGapsDefaultData(String display_id) {
ArrayList<GapsChecklistGetterSetter> checkList = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select DC.CHECKLIST_ID As CHECKLIST_ID, DC.CHECKLIST As CHECKLIST, C.DISPLAY_ID As DISPLAY_ID from MAPPING_DISPLAY_CHECKLIST C INNER JOIN DISPLAY_CHECKLIST_MASTER DC ON C.CHECKLIST_ID= DC.CHECKLIST_ID WHERE C.DISPLAY_ID = '"+ display_id +"'",null);
if(dbcursor != null){
dbcursor = db.rawQuery("Select DC.CHECKLIST_ID As CHECKLIST_ID, DC.CHECKLIST As CHECKLIST, C.DISPLAY_ID As DISPLAY_ID from MAPPING_DISPLAY_CHECKLIST C INNER JOIN DISPLAY_CHECKLIST_MASTER DC ON C.CHECKLIST_ID= DC.CHECKLIST_ID WHERE C.DISPLAY_ID = '" + display_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while(!dbcursor.isAfterLast()){
while (!dbcursor.isAfterLast()) {
GapsChecklistGetterSetter check = new GapsChecklistGetterSetter();
@@ -236,8 +233,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
dbcursor.close();
return checkList;
}
}
catch (Exception e){
} catch (Exception e) {
Log.d("Exception get T2P", e.toString());
return checkList;
@@ -247,17 +243,22 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//get Brand data for T2P
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id ){
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id) {
ArrayList<BrandMasterGetterSetter> brandList = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = "+ class_id +"'",null);
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '"+ class_id +"') As Brand",null);
if(dbcursor != null){
dbcursor.moveToFirst();
while(!dbcursor.isAfterLast()){
while (!dbcursor.isAfterLast()) {
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
@@ -276,8 +277,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
dbcursor.close();
return brandList;
}
}
catch (Exception e){
} catch (Exception e) {
Log.d("Exception get T2P", e.toString());
return brandList;
@@ -287,17 +287,18 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//get Sku data for T2P
public ArrayList<SkuGetterSetter> getSkuT2PData(String store_type_id, String class_id, String key_account_id , String brand_id){
public ArrayList<SkuGetterSetter> getSkuT2PData(String store_type_id, String class_id, String key_account_id, String brand_id) {
ArrayList<SkuGetterSetter> skuList = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='"+key_account_id +"' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = "+ class_id +"' AND SM.BRAND_ID='"+ brand_id + "'",null);
if(dbcursor != null){
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = " + class_id + "' AND SM.BRAND_ID='" + brand_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while(!dbcursor.isAfterLast()){
while (!dbcursor.isAfterLast()) {
SkuGetterSetter sku = new SkuGetterSetter();
@@ -318,8 +319,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
dbcursor.close();
return skuList;
}
}
catch (Exception e){
} catch (Exception e) {
Log.d("Exception get T2P", e.toString());
return skuList;
@@ -404,45 +404,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return list;
}
//Gagan Goel
public void InsertCategory(CategoryMasterGetterSetter data) {
db.delete("CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getCATEGORY_ID().size(); i++) {
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("CATEGORY", data.getCATEGORY().get(i));
values.put("CATEGORY_SEQUENCE", data.getCATEGORY_SEQUENCE().get(i));
db.insert("CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in CATEGORY_MASTER " + ex.toString());
}
}
public void InsertMappingStock(MappingStockGetterSetter data) {
db.delete("MAPPING_STOCK", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getKEYACCOUNT_ID().size(); i++) {
values.put("KEYACCOUNT_ID", data.getKEYACCOUNT_ID().get(i));
values.put("STORETYPE_ID", data.getSTORETYPE_ID().get(i));
values.put("CLASS_ID", data.getCLASS_ID().get(i));
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("MUST_HAVE", data.getMUST_HAVE().get(i));
values.put("MBQ", data.getMBQ().get(i));
db.insert("MAPPING_STOCK", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
//insert MAPPING_DISPLAY_CHECKLIST
public void InsertMappingDisplayChecklist(MappingDisplayChecklistGetterSetter data) {
@@ -462,64 +423,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
}
public void InsertSubCategoryMaster(SubCategoryMasterGetterSetter data) {
db.delete("SUB_CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSUB_CATEGORY_ID().size(); i++) {
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("SUB_CATEGORY", data.getSUB_CATEGORY().get(i));
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("SUB_CATEGORY_SEQUENCE", data.getSUB_CATEGORY_SEQUENCE().get(i));
db.insert("SUB_CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
public void InsertBrandMaster(BrandMasterGetterSetter data) {
db.delete("BRAND_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getBRAND_ID().size(); i++) {
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("BRAND", data.getBRAND().get(i));
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("COMPANY_ID", data.getCOMPANY_ID().get(i));
values.put("BRAND_SEQUENCE", data.getBRAND_SEQUENCE().get(i));
db.insert("BRAND_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in BRAND_MASTER " + ex.toString());
}
}
public void InsertSkuMaster(SkuMasterGetterSetter data) {
db.delete("SKU_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSKU_ID().size(); i++) {
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("SKU", data.getSKU().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("MRP", data.getMRP().get(i));
values.put("SKU_SEQUENCE", data.getSKU_SEQUENCE().get(i));
db.insert("SKU_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in SKU_MASTER " + ex.toString());
}
}
//insert DISPLAY_CHECKLIST_MASTER
public void InsertDisplayChecklistMaster(DisplayChecklistMasterGetterSetter data) {
@@ -557,26 +460,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
}
public void InsertMAPPING_T2P(MAPPINGT2PGetterSetter data) {
db.delete("MAPPING_T2P", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSTORE_ID().size(); i++) {
values.put("STORE_ID", data.getSTORE_ID().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
db.insert("MAPPING_T2P", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
}
}
public void InsertSTOREgeotag(String storeid, double lat, double longitude, String path,String status) {
public void InsertSTOREgeotag(String storeid, double lat, double longitude, String path, String status) {
ContentValues values = new ContentValues();
@@ -614,8 +499,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
public void updateCheckoutStatus(String id, String status) {
ContentValues values = new ContentValues();
@@ -666,8 +549,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} catch (Exception e) {
}
finally {
} finally {
if (dbcursor != null && !dbcursor.isClosed()) {
dbcursor.close();
}
@@ -679,7 +561,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
public void updateGeoTagData(String storeid,String status) {
public void updateGeoTagData(String storeid, String status) {
try {
@@ -687,7 +569,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
values.put("GEO_TAG", status);
int l = db.update(CommonString.TABLE_STORE_GEOTAGGING, values,
CommonString.KEY_STORE_ID + "=?", new String[] { storeid });
CommonString.KEY_STORE_ID + "=?", new String[]{storeid});
System.out.println("update : " + l);
} catch (Exception e) {
Log.d("Database Data ", e.toString());
@@ -695,7 +577,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
}
public void updateDataStatus(String id,String status) {
public void updateDataStatus(String id, String status) {
ContentValues values = new ContentValues();
@@ -784,6 +666,125 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
return list;
}
//Gagan Start Method
public void InsertCategory(CategoryMasterGetterSetter data) {
db.delete("CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getCATEGORY_ID().size(); i++) {
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("CATEGORY", data.getCATEGORY().get(i));
values.put("CATEGORY_SEQUENCE", data.getCATEGORY_SEQUENCE().get(i));
db.insert("CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in CATEGORY_MASTER " + ex.toString());
}
}
public void InsertSubCategoryMaster(SubCategoryMasterGetterSetter data) {
db.delete("SUB_CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSUB_CATEGORY_ID().size(); i++) {
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("SUB_CATEGORY", data.getSUB_CATEGORY().get(i));
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("SUB_CATEGORY_SEQUENCE", data.getSUB_CATEGORY_SEQUENCE().get(i));
db.insert("SUB_CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
public void InsertBrandMaster(BrandMasterGetterSetter data) {
db.delete("BRAND_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getBRAND_ID().size(); i++) {
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("BRAND", data.getBRAND().get(i));
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("COMPANY_ID", data.getCOMPANY_ID().get(i));
values.put("BRAND_SEQUENCE", data.getBRAND_SEQUENCE().get(i));
db.insert("BRAND_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in BRAND_MASTER " + ex.toString());
}
}
public void InsertSkuMaster(SkuMasterGetterSetter data) {
db.delete("SKU_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSKU_ID().size(); i++) {
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("SKU", data.getSKU().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("MRP", data.getMRP().get(i));
values.put("SKU_SEQUENCE", data.getSKU_SEQUENCE().get(i));
db.insert("SKU_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in SKU_MASTER " + ex.toString());
}
}
public void InsertMappingStock(MappingStockGetterSetter data) {
db.delete("MAPPING_STOCK", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getKEYACCOUNT_ID().size(); i++) {
values.put("KEYACCOUNT_ID", data.getKEYACCOUNT_ID().get(i));
values.put("STORETYPE_ID", data.getSTORETYPE_ID().get(i));
values.put("CLASS_ID", data.getCLASS_ID().get(i));
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("MUST_HAVE", data.getMUST_HAVE().get(i));
values.put("MBQ", data.getMBQ().get(i));
db.insert("MAPPING_STOCK", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
public void InsertMAPPING_T2P(MAPPINGT2PGetterSetter data) {
db.delete("MAPPING_T2P", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSTORE_ID().size(); i++) {
values.put("STORE_ID", data.getSTORE_ID().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
db.insert("MAPPING_T2P", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
}
}
//Category List
public ArrayList<CategoryGetterSetter> getCategoryListData(String keyAccountId, String storeTypeId, String classId) {
@@ -1238,7 +1239,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
public long InsertCoverageData(CoverageBean data) {
//db.delete(CommonString1.TABLE_COVERAGE_DATA, "STORE_ID" + "='" + data.getStoreId() + "'", null);
@@ -1344,6 +1344,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
//Gagan End Method----------------------------------------
//Non Working data
public void insertNonWorkingData(NonWorkingReasonGetterSetter data) {
@@ -1420,7 +1423,4 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
}
}
}
@@ -194,6 +194,7 @@ public class MainActivity extends AppCompatActivity
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_setting) {
startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
} else if (id == R.id.nav_export) {
@@ -21,7 +21,7 @@ import java.util.Locale;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener{
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
Button btn_lang_1, btn_lang_2;
@@ -51,7 +51,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
language = login_data.getCULTURE_NAME();
culture_id = login_data.getCULTURE_ID();
if(language.size()>1){
if (language.size() > 1) {
btn_lang_1.setText(language.get(0));
btn_lang_2.setText(language.get(1));
@@ -61,20 +61,18 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(selected_flag){
if (selected_flag) {
Intent intent = new Intent(getBaseContext(),
MainActivity.class);
intent.putExtra(CommonString.KEY_LOGIN_DATA, login_data);
startActivity(intent);
}
else {
} else {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
@@ -84,16 +82,14 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
@Override
public void onClick(View view) {
int id = view.getId();
switch (id){
switch (id) {
case R.id.btn_language_one:
selected_flag = true;
updateResources(getApplicationContext(),language.get(0));
updateResources(getApplicationContext(), language.get(0));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
@@ -109,7 +105,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
selected_flag = true;
updateResources(getApplicationContext(),language.get(1));
updateResources(getApplicationContext(), language.get(1));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
@@ -124,16 +120,15 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
}
private static boolean updateResources(Context context, String language) {
String lang;
String lang ;
if(language.equals("English")){
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equals("UAE")) {
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
} else {
lang = "TR";
}
@@ -8,15 +8,14 @@ import android.os.Environment;
public class CommonString {
// webservice constants
// webservice constants
// preferenec keys
public static final String KEY_USERNAME = "username";
public static final String KEY_PASSWORD = "password";
public static final String KEY_DATE = "date";
public static final String KEY_STOREVISITED_STATUS = "STOREVISITED_STATUS";
//public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/GSK_MT_Images/";
public static final String KEY_PATH = "path";
public static final String KEY_VERSION = "APP_VERSION";
@@ -156,6 +155,8 @@ public class CommonString {
//Gagan Code Start
//File Path
public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/GSK_MT_ORANGE_IMAGES/";
@@ -270,4 +271,5 @@ public class CommonString {
+ ")";
//Gagan Code End
}
@@ -126,11 +126,15 @@ public class StoreListActivity extends AppCompatActivity {
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
// NavUtils.navigateUpFromSameTask(this);
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
@@ -23,6 +23,7 @@ import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
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.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
/**
* 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;
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;
AlertDialog alert;
String img_str;
private GSKOrangeDB database;
String lat,lon;
String lat, lon;
GoogleApiClient mGoogleApiClient;
ArrayList<CoverageBean> coverage_list;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_storeimage);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -90,8 +90,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
database = new GSKOrangeDB(this);
database.open();
coverage_list = database.getCoverageData(date);
coverage_list = database.getCoverageData(date);
img_cam.setOnClickListener(this);
img_clicked.setOnClickListener(this);
@@ -106,13 +105,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
.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_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return ;
return;
}
}
@Override
@@ -122,13 +119,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if(id==android.R.id.home){
if (id == android.R.id.home) {
// NavUtils.navigateUpFromSameTask(this);
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
return super.onOptionsItemSelected(item);
@@ -136,12 +130,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
@Override
public void onBackPressed() {
/*Intent i = new Intent(this, DailyEntryScreen.class);
startActivity(i);*/
/*Intent i = new Intent(this, DailyEntryScreen.class);
startActivity(i);*/
finish();
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();
switch (id){
switch (id) {
case R.id.img_cam_selfie:
_pathforcheck = store_id + "Store"
+ "Image" + visit_date.replace("/","") + getCurrentTime().replace(":","")+".jpg";
+ "Image" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -167,41 +159,34 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
case R.id.btn_save_selfie:
if (img_str !=null) {
if (img_str != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(
StoreimageActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(StoreimageActivity.this);
builder.setMessage("Do you want to save the data ")
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int id) {
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert.getButton(
AlertDialog.BUTTON_POSITIVE)
.setEnabled(false);
alert.getButton(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();
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.InsertCoverageData(cdata);
database.updateCheckoutStatus(store_id, status);
database.updateCheckoutStatus(store_id, status);
/* SharedPreferences.Editor editor = preferences.edit();
@@ -211,41 +196,28 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
editor.commit();*/
/* Intent in=new Intent(StoreimageActivity.this,StoreEntry.class);
startActivity(in);
finish();*/
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int id) {
dialog.cancel();
}
});
Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class);
startActivity(in);
finish();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
alert = builder.create();
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;
}
}
protected void startCameraActivity() {
try {
/*Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
@@ -261,10 +233,10 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
String defaultCameraPackage="";
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
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) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
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.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, 0);
} catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
Bitmap bmp = BitmapFactory.decodeFile(str + _pathforcheck);
img_cam.setImageBitmap(bmp);
img_clicked.setVisibility(View.GONE);
@@ -320,21 +284,14 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
img_str = _pathforcheck;
_pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
public String getCurrentTime() {
Calendar m_cal = Calendar.getInstance();
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);*/
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
@@ -378,4 +332,4 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
super.onStop();
}
}
}
@@ -1,6 +1,8 @@
package cpm.com.gskmtorange.dailyentry;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
@@ -13,19 +15,24 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;
import java.util.ArrayList;
import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
@@ -64,7 +71,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
t2PGetterSetters = db.getT2PDefaultData("1");
if(t2PGetterSetters.size()>0){
if (t2PGetterSetters.size() > 0) {
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
t2PAdapter = new T2PAdapter(t2PGetterSetters);
rec_t2p.setAdapter(t2PAdapter);
@@ -98,8 +105,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
ArrayList<GapsChecklistGetterSetter> gapsChecklist = showGapsDialog(mItem.getDisplay_id());
if(gapsChecklist.size()>0){
ArrayList<GapsChecklistGetterSetter> gapsChecklist = showGapsDialog(mItem.getDisplay_id());
if (gapsChecklist.size() > 0) {
}
}
@@ -146,10 +153,10 @@ public class T2PComplianceActivity extends AppCompatActivity {
}
}
public ArrayList<GapsChecklistGetterSetter> showGapsDialog(String display_id){
public ArrayList<GapsChecklistGetterSetter> showGapsDialog(String display_id) {
ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id);
Dialog dialog = new Dialog(T2PComplianceActivity.this);
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.gaps_dialog_layout);
@@ -159,23 +166,87 @@ public class T2PComplianceActivity extends AppCompatActivity {
GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist);
rec_gap_checklist.setAdapter(gapAdapter);
//dialog.setCancelable(false);
Button btn_save = (Button) dialog.findViewById(R.id.btn_save);
btn_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.cancel();
}
});
dialog.setCancelable(false);
dialog.show();
return gapsChecklist;
}
public void showSkuDialog(){
public void showSkuDialog() {
ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
final ArrayList<BrandMasterGetterSetter> brandList = db.getBrandT2PData("1", "1", "1");
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
brand.setBRAND("select");
brandList.add(0,brand);
// ArrayList<SkuMasterGetterSetter> skuMasterGetterSetterArrayList = db.getSkuT2PData("1", "1", "1",)
Dialog dialog = new Dialog(T2PComplianceActivity.this);
final Dialog dialog = new Dialog(T2PComplianceActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.t2p_sku_dialog_layout);
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
//dialog.setCancelable(false);
//dialog.setCancelable(false);
Spinner spinner_brand = (Spinner) dialog.findViewById(R.id.spinner_brand);
final Spinner spinner_sku = (Spinner) dialog.findViewById(R.id.spinner_sku);
Button btn_add = (Button) dialog.findViewById(R.id.btn_add);
btn_add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.cancel();
}
});
// Create custom adapter object ( see below CustomAdapter.java )
CustomAdapter adapter = new CustomAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, brandList);
// Set adapter to spinner
spinner_brand.setAdapter(adapter);
ArrayList<SkuGetterSetter> empty_list = new ArrayList<>();
SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select");
empty_list.add(select);
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, empty_list);
spinner_sku.setAdapter(skuadapter);
spinner_brand.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(position!=0){
String brand_id = brandList.get(position).getBRAND_ID().get(0);
ArrayList<SkuGetterSetter> sku_list = db.getSkuT2PData("1", "1", "1", brand_id);
SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select");
sku_list.add(0,select);
// Create custom adapter object ( see below CustomSkuAdapter.java )
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
// Set adapter to spinner
spinner_sku.setAdapter(skuadapter);
spinner_sku.setSelection(0);
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
dialog.show();
}
@@ -236,4 +307,129 @@ public class T2PComplianceActivity extends AppCompatActivity {
}
}
public class CustomAdapter extends ArrayAdapter<String> {
private Activity activity;
private ArrayList data;
BrandMasterGetterSetter tempValues = null;
LayoutInflater inflater;
/*************
* CustomAdapter Constructor
*****************/
public CustomAdapter(
T2PComplianceActivity activitySpinner,
int textViewResourceId,
ArrayList objects
) {
super(activitySpinner, textViewResourceId, objects);
/********** Take passed values **********/
activity = activitySpinner;
data = objects;
/*********** Layout inflator to call external xml layout () **********************/
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
// This funtion called for each row ( Called data.size() times )
public View getCustomView(int position, View convertView, ViewGroup parent) {
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
/***** Get each Model object from Arraylist ********/
tempValues = null;
tempValues = (BrandMasterGetterSetter) data.get(position);
TextView label = (TextView) row.findViewById(R.id.tv_text);
if (position == 0) {
// Default selected Spinner item
label.setText("Select");
//sub.setText("");
} else {
// Set values for spinner each row
label.setText(tempValues.getBRAND().get(0));
}
return row;
}
}
public class CustomSkuAdapter extends ArrayAdapter<String> {
private Activity activity;
private ArrayList data;
SkuGetterSetter tempValues = null;
LayoutInflater inflater;
/*************
* CustomAdapter Constructor
*****************/
public CustomSkuAdapter(
T2PComplianceActivity activitySpinner,
int textViewResourceId,
ArrayList objects
) {
super(activitySpinner, textViewResourceId, objects);
/********** Take passed values **********/
activity = activitySpinner;
data = objects;
/*********** Layout inflator to call external xml layout () **********************/
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
// This funtion called for each row ( Called data.size() times )
public View getCustomView(int position, View convertView, ViewGroup parent) {
/********** Inflate spinner_rows.xml file for each row ( Defined below ) ************/
View row = inflater.inflate(R.layout.custom_spinner_item, parent, false);
/***** Get each Model object from Arraylist ********/
tempValues = null;
tempValues = (SkuGetterSetter) data.get(position);
TextView label = (TextView) row.findViewById(R.id.tv_text);
if (position == 0) {
// Default selected Spinner item
label.setText("Select");
//sub.setText("");
} else {
// Set values for spinner each row
label.setText(tempValues.getSKU());
}
return row;
}
}
}
@@ -2,7 +2,9 @@ package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
@@ -24,6 +26,7 @@ import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
public class CategoryListActivity extends AppCompatActivity {
@@ -35,6 +38,9 @@ public class CategoryListActivity extends AppCompatActivity {
GSKOrangeDB db;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -48,6 +54,17 @@ public class CategoryListActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
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.setText("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);
categoryList = new ArrayList<>();
categoryList = db.getCategoryListData("1", "1", "1");
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id);
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter);
@@ -99,7 +116,16 @@ public class CategoryListActivity extends AppCompatActivity {
final CategoryGetterSetter categoryData = list.get(position);
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() {
@Override
@@ -3,8 +3,10 @@ package cpm.com.gskmtorange.gsk_dailyentry;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
@@ -34,6 +36,7 @@ import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
public class MSL_AvailabilityActivity extends AppCompatActivity {
@@ -51,6 +54,9 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
String categoryName, categoryId, storeId;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -61,15 +67,27 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
db = new GSKOrangeDB(this);
db.open();
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
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");
categoryId = getIntent().getStringExtra("categoryId");
storeId = "";
//txt_mslAvailabilityName.setText(categoryName);
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) {
db.open();
if (db.checkMsl_AvailabilityData(storeId, categoryId)) {
db.updateMSL_Availability(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
} 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();
@@ -4,12 +4,15 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
@@ -43,6 +46,7 @@ import java.util.List;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
@@ -54,15 +58,20 @@ public class Stock_FacingActivity extends AppCompatActivity {
ArrayList<Stock_FacingGetterSetter> childDataList;
List<Stock_FacingGetterSetter> hashMapListHeaderData;
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData;
List<Integer> checkHeaderArray = new ArrayList<>();
ExpandableListAdapter adapter;
GSKOrangeDB db;
String categoryName, categoryId, storeId;
String categoryName, categoryId, Error_Message = "";
String path = "", str = "", _pathforcheck = "", img1 = "";
String path = "", str = "", _pathforcheck = "", img1 = "", img2 = "";
static int child_position = -1;
boolean isDialogOpen = true;
boolean checkflag = true;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -80,54 +89,62 @@ 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);
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");
categoryId = getIntent().getStringExtra("categoryId");
storeId = "";
//txt_stockFacingName.setText(categoryName);
txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
prepareList();
str = Environment.getExternalStorageState();
str = CommonString.FILE_PATH + _pathforcheck;
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();*/
//if (validateData(listDataHeader, listDataChild)) {
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("Are you sure you want to save")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.open();
//db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("Are you sure you want to save")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
db.open();
if (db.checkStockAndFacingData(storeId, categoryId)) {
db.updateStockAndFacing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
} else {
db.InsertStock_Facing(storeId, categoryId, hashMapListHeaderData, hashMapListChildData);
if (db.checkStockAndFacingData(store_id, categoryId)) {
db.updateStockAndFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
} else {
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
}
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
/*} else {
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
builder.setMessage("Fill the value or fill 0 ")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@@ -137,13 +154,22 @@ public class Stock_FacingActivity extends AppCompatActivity {
});
AlertDialog alert = builder.create();
alert.show();
}*/
}
}
});
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int lastItem = firstVisibleItem + visibleItemCount;
if (firstVisibleItem == 0) {
fab.setVisibility(View.VISIBLE);
} else if (lastItem == totalItemCount) {
fab.setVisibility(View.INVISIBLE);
} else {
fab.setVisibility(View.VISIBLE);
}
}
@Override
@@ -281,65 +307,66 @@ public class Stock_FacingActivity extends AppCompatActivity {
img_camera1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = new Date().toLocaleString().toString();
String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
//String date = new Date().toLocaleString().toString();
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock Camera1_" + tempDate + ".jpg";
_pathforcheck = "Stock_Cam1_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity(groupPosition);
startCameraActivity1(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
//headerTitle.setImg_cam(img1);
headerTitle.setImage1(img1);
img1 = "";
}
}
/*if (headerTitle.getImg_cam().equals("")) {
if (headerTitle.getImage1().equals("")) {
img_camera1.setBackgroundResource(R.drawable.ic_menu_camera);
} else {
//img_camera1.setBackgroundResource(R.drawable.camtick);
}*/
img_camera1.setBackgroundResource(R.drawable.ic_menu_gallery);
}
/*img_camera.setOnClickListener(new View.OnClickListener() {
img_camera2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = new Date().toLocaleString().toString();
String TempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
//String date = new Date().toLocaleString().toString();
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock" + headerTitle.getBrand_cd() + "_" + store_cd + "_" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
_pathforcheck = "Stock_Cam2_" + store_id + "_" + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity(groupPosition);
startCameraActivity2(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (!img2.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImg_cam(img1);
img1 = "";
headerTitle.setImage2(img2);
img2 = "";
}
}
if (headerTitle.getImg_cam().equals("")) {
img_camera.setBackgroundResource(R.drawable.cam);
if (headerTitle.getImage2().equals("")) {
img_camera2.setBackgroundResource(R.drawable.ic_menu_camera);
} else {
img_camera.setBackgroundResource(R.drawable.camtick);
img_camera2.setBackgroundResource(R.drawable.ic_menu_gallery);
}
if (!checkflag) {
if (checkHeaderArray.contains(groupPosition)) {
txt_header.setTextColor(getResources().getColor(R.color.red));
txt_stockFaceupHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
} else {
txt_header.setTextColor(getResources().getColor(R.color.grey_dark));
txt_stockFaceupHeader.setTextColor(getResources().getColor(R.color.black));
}
}*/
}
return convertView;
}
@@ -475,6 +502,29 @@ public class Stock_FacingActivity extends AppCompatActivity {
holder.ed_facing.setText(childData.getFacing());
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 (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));
}
}
return convertView;
}
@@ -497,23 +547,97 @@ public class Stock_FacingActivity extends AppCompatActivity {
LinearLayout lin_category;
}
private void startCameraActivity(int position) {
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 & Facing ", "startCameraActivity()");
/*Log.e("Stock and Facing ", "startCameraActivity()");
File file = new File(path);
Uri outputFileUri = Uri.fromFile(file);
/*String defaultCameraPackage = "";
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.d("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
// Log.d("TAG", "package name : " + list.get(n).packageName);
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
/*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;
}
}
}
}
@@ -521,11 +645,55 @@ public class Stock_FacingActivity extends AppCompatActivity {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, position);*/
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);
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();
}
@@ -534,7 +702,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("Stock & Facing", "resultCode: " + resultCode);
switch (resultCode) {
/*switch (resultCode) {
case 0:
Log.e("Stock & Facing", "User cancelled");
break;
@@ -542,13 +710,41 @@ public class Stock_FacingActivity extends AppCompatActivity {
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img1 = _pathforcheck;
//adapter.notifyDataSetChanged();
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;
}
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
}
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

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="10dp"
>
<LinearLayout
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/tv_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Checklist"
android:textColor="@color/black"
android:textStyle="bold"
android:gravity="center_vertical"
android:padding="10dp"
android:textSize="@dimen/text_size_xsmall"
android:paddingLeft="@dimen/custom_margin"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -17,6 +17,7 @@
>
<LinearLayout
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -48,6 +48,7 @@
android:background="@color/grey_background">
<Button
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@@ -38,7 +38,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:weightSum="3"
android:background="@color/grey_background"
android:padding="5dp">
@@ -55,7 +55,7 @@
android:id="@+id/spinner_brand"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="2"/>
@@ -65,7 +65,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:weightSum="3"
android:background="@color/grey_background"
android:padding="5dp">
@@ -81,7 +81,7 @@
android:id="@+id/spinner_sku"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="2"/>
@@ -91,7 +91,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:weightSum="3"
android:background="@color/grey_background"
android:padding="5dp">
@@ -107,7 +107,8 @@
android:id="@+id/et_stock"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="2"
android:inputType="number"/>
@@ -120,6 +121,7 @@
android:background="@color/grey_background">
<Button
android:id="@+id/btn_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@@ -16,6 +16,7 @@
<string name="menu_daily_download">Günlük Veri Indir</string>
<string name="menu_upload_data">Veri Paylaş</string>
<string name="menu_geotag">Coğrafi Konum</string>
<string name="menu_export">Data Export</string>
<string name="menu_exit">Çıkış</string>
<string name="menu_setting">Ayarlar</string>
<string name="menu_services">Hizmetler</string>
+4 -6
View File
@@ -52,9 +52,11 @@
<string name="menu_setting">Setting</string>
<string name="menu_services">Services</string>
<string name="title_activity_category_list">Category List</string>
<string name="title_activity_t2_pcompliance">T2P Compliance</string>
<!--Gagan start code-->
<string name="title_activity_category_list">Category List</string>
<string name="title_activity_category_wise_performance">Categorywise Performance</string>
<string name="title_activity_daily_main_menu">Daily Data Menu</string>
<string name="title_activity_msl__availability">Must Stock Availability</string>
@@ -78,13 +80,12 @@
<string name="stock_facing_faceup">Facing</string>
<string name="stock_facing_sos_target">SOS Target</string>
<!--Gagan end code-->
<string name="title_geo_tag_activity_upload_data">Store Uploaded</string>
<string name="title_geo_tag_activity_geo_data">Store Geo Data Uploaded</string>
<string name="title_geo_tag_activity_geo_already_done">Store Already Geotagged</string>
<string name="title_store_list_activity_store_already_done">Store Already Uploaded</string>
<string name="title_store_list_activity_store_data_uploaded">Store Data Uploaded</string>
<string name="title_store_list_activity_store_already_checkout">Store Already Checkout</string>
@@ -92,12 +93,9 @@
<string name="title_store_list_activity_store_closed">Store Closed</string>
<string name="title_store_list_activity_already_store_closed">Store Already Closed</string>
<string name="title_store_list_checkout_current">Please checkout from current store</string>
<string name="title_store_list_checkout_Already_filled">Data already filled</string>
<string name="title_store_list_download_data">Please Download Data First</string>
</resources>