Merge branch 'master' into ACVisibilityDone

This commit is contained in:
YadavendraSinghYaduvanshi
2017-01-13 18:24:36 +05:30
committed by GitHub
119 changed files with 5154 additions and 1311 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
+8 -6
View File
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 23 compileSdkVersion 24
buildToolsVersion "24.0.1" buildToolsVersion "24.0.1"
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
@@ -32,12 +32,14 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1' compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.2'
compile 'com.android.support:cardview-v7:24.2.1' compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.0.2' compile 'com.google.android.gms:play-services-appindexing:9.4.0'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.7'
} }
+21 -13
View File
@@ -14,7 +14,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/icon" android:icon="@drawable/gsklogo"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
@@ -34,7 +34,7 @@
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" android:label="@string/main_menu_activity_name"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
@@ -59,9 +59,9 @@
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".dailyentry.StoreimageActivity" android:name=".dailyentry.StoreimageActivity"
android:label="@string/title_activity_store_list_geotag"
android:screenOrientation="portrait"
android:configChanges="screenSize|orientation|keyboardHidden" android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_store_image"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".GeoTag.GeoTagActivity" android:name=".GeoTag.GeoTagActivity"
@@ -78,6 +78,7 @@
<activity <activity
android:name=".dailyentry.T2PComplianceActivity" android:name=".dailyentry.T2PComplianceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_t2_pcompliance" android:label="@string/title_activity_t2_pcompliance"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
@@ -119,28 +120,35 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".gsk_dailyentry.StoreWisePerformanceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!-- Gagan End Declaration --> <!-- Gagan End Declaration -->
<activity <activity
android:name=".dailyentry.NonWorkingReason" android:name=".dailyentry.NonWorkingReason"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_Non_Work" android:label="@string/title_activity_Non_Work"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity <activity
android:name=".dailyentry.AdditionalVisibility" android:name=".dailyentry.AdditionalVisibility"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_Additional_visibility" android:label="@string/title_activity_Additional_visibility"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"></activity> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".upload.UploadActivity" android:name=".upload.UploadActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:label="@string/title_activity_upload" android:label="@string/title_activity_upload"
/> android:screenOrientation="portrait" />
<activity
android:name=".dailyentry.SettingsActivity"
android:label="@string/title_activity_settings"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application> </application>
</manifest> </manifest>
@@ -15,7 +15,11 @@ import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
import cpm.com.gskmtorange.GetterSetter.CoverageBean; import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans; import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans;
import cpm.com.gskmtorange.GetterSetter.StoreBean; import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter; import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
@@ -32,9 +36,11 @@ import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.STORE_PERFORMANCE_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.StoreWisePerformaceGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.TableBean; import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
@@ -46,8 +52,8 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
public class GSKOrangeDB extends SQLiteOpenHelper { public class GSKOrangeDB extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "GSK_ORANGE"; public static final String DATABASE_NAME = "GSK_ORANGE";
public static final int DATABASE_VERSION = 13; public static final int DATABASE_VERSION = 13;
private SQLiteDatabase db;
TableBean tableBean; TableBean tableBean;
private SQLiteDatabase db;
public GSKOrangeDB(Context context) { public GSKOrangeDB(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, null, DATABASE_VERSION);
@@ -81,6 +87,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(TableBean.getMappingDisplayChecklist()); db.execSQL(TableBean.getMappingDisplayChecklist());
db.execSQL(TableBean.getMappingAdditionalPromotion()); db.execSQL(TableBean.getMappingAdditionalPromotion());
db.execSQL(TableBean.getMappingPromotion()); db.execSQL(TableBean.getMappingPromotion());
db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY); db.execSQL(CommonString.CREATE_TABLE_INSERT_MSL_AVAILABILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY); db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY);
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER); db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_HEADER);
@@ -92,7 +99,23 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN); db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN);
db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG_MAIN); db.execSQL(CommonString.CREATE_TABLE_STOCK_DIALOG_MAIN);
db.execSQL(TableBean.getStorePerformance());
//Gagan End //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());
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_GAPS);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_SKU);
db.execSQL(TableBean.getMappingPlanogram());
} }
@Override @Override
@@ -102,7 +125,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
public void deleteTableWithStoreID(String storeid) { public void deleteTableWithStoreID(String storeid) {
db.delete( CommonString.TABLE_COVERAGE_DATA, CommonString.KEY_STORE_ID + "='" + storeid + "'", null); db.delete(CommonString.TABLE_COVERAGE_DATA, CommonString.KEY_STORE_ID + "='" + storeid + "'", null);
} }
@@ -147,7 +170,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
values.put("CAMERA_ALLOW", data.getCAMERA_ALLOW().get(i)); values.put("CAMERA_ALLOW", data.getCAMERA_ALLOW().get(i));
values.put("GEO_TAG", data.getGEO_TAG().get(i)); values.put("GEO_TAG", data.getGEO_TAG().get(i));
values.put("CHANNEL_ID", data.getCHANNEL_ID().get(i));
db.insert("JOURNEY_PLAN", null, values); db.insert("JOURNEY_PLAN", null, values);
@@ -258,7 +281,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try { try {
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);
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 + "' AND BR.COMPANY_ID ='1' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE) As Brand", null);
if (dbcursor != null) { if (dbcursor != null) {
dbcursor.moveToFirst(); dbcursor.moveToFirst();
@@ -337,7 +361,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
Cursor dbcursor = null; Cursor dbcursor = null;
try { try {
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " + "where VISIT_DATE ='" + date + "'", null); dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
"where VISIT_DATE ='" + date + "'", null);
if (dbcursor != null) { if (dbcursor != null) {
dbcursor.moveToFirst(); dbcursor.moveToFirst();
@@ -816,7 +841,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID"))); cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
cd.setCategory(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY"))); cd.setCategory(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY")));
cd.setCategory_img("category"); cd.setCategory_img(-1);
list.add(cd); list.add(cd);
dbcursor.moveToNext(); dbcursor.moveToNext();
@@ -901,7 +926,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
cd.setMrp(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MRP"))); cd.setMrp(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MRP")));
cd.setSku_sequence(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_SEQUENCE"))); cd.setSku_sequence(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU_SEQUENCE")));
cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ"))); cd.setMbq(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MBQ")));
cd.setToggleValue("0"); cd.setToggleValue("1");
list.add(cd); list.add(cd);
dbcursor.moveToNext(); dbcursor.moveToNext();
@@ -998,11 +1023,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
dbcursor.close(); dbcursor.close();
if (list.size() > 0) { return list.size() > 0;
return true;
} else {
return false;
}
} }
} catch (Exception e) { } catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString()); Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
@@ -1044,7 +1065,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
Cursor dbcursor = null; Cursor dbcursor = null;
try { try {
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND " + dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID " +
"from MAPPING_STOCK M " + "from MAPPING_STOCK M " +
"inner join SKU_MASTER SK " + "inner join SKU_MASTER SK " +
"on M.SKU_ID=SK.SKU_ID " + "on M.SKU_ID=SK.SKU_ID " +
@@ -1055,13 +1076,14 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
"inner join CATEGORY_MASTER CA " + "inner join CATEGORY_MASTER CA " +
"on SB.CATEGORY_ID=CA.CATEGORY_ID " + "on SB.CATEGORY_ID=CA.CATEGORY_ID " +
"where CA.CATEGORY_ID='" + category_id + "' " + "where CA.CATEGORY_ID='" + category_id + "' " +
"order by SB.SUB_CATEGORY,BR.BRAND", null); "order by SB.SUB_CATEGORY,BR.COMPANY_ID,BR.BRAND", null);
if (dbcursor != null) { if (dbcursor != null) {
dbcursor.moveToFirst(); dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) { while (!dbcursor.isAfterLast()) {
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter(); Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
cd.setCompany_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("COMPANY_ID")));
cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID"))); cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
cd.setSub_category(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY"))); cd.setSub_category(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY")));
cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND_ID"))); cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND_ID")));
@@ -1139,6 +1161,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
values1.put("Store_Id", storeId); values1.put("Store_Id", storeId);
values1.put("Category_Id", categoryId); values1.put("Category_Id", categoryId);
values1.put("COMPANY_ID", data1.getCompany_id());
values1.put("SUB_CATEGORY_ID", data1.getSub_category_id()); values1.put("SUB_CATEGORY_ID", data1.getSub_category_id());
values1.put("SUB_CATEGORY", data1.getSub_category()); values1.put("SUB_CATEGORY", data1.getSub_category());
values1.put("BRAND_ID", data1.getBrand_id()); values1.put("BRAND_ID", data1.getBrand_id());
@@ -1185,6 +1208,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
while (!dbcursor.isAfterLast()) { while (!dbcursor.isAfterLast()) {
Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter(); Stock_FacingGetterSetter cd = new Stock_FacingGetterSetter();
cd.setCompany_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("COMPANY_ID")));
cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID"))); cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
cd.setSub_category(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY"))); cd.setSub_category(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY")));
cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND_ID"))); cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND_ID")));
@@ -1293,11 +1317,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
dbcursor.close(); dbcursor.close();
if (list.size() > 0) { return list.size() > 0;
return true;
} else {
return false;
}
} }
} catch (Exception e) { } catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString()); Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
@@ -1459,9 +1479,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
public void InsertAdditionalPromoData(Promo_Compliance_DataGetterSetter data, String category_id) { public void InsertAdditionalPromoData(Promo_Compliance_DataGetterSetter data, String category_id) {
try {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
try {
values.put("STORE_ID", Integer.parseInt(data.getStore_id())); values.put("STORE_ID", Integer.parseInt(data.getStore_id()));
values.put("CATEGORY_ID", Integer.parseInt(category_id)); values.put("CATEGORY_ID", Integer.parseInt(category_id));
values.put("SKU_ID", Integer.parseInt(data.getSku_id())); values.put("SKU_ID", Integer.parseInt(data.getSku_id()));
@@ -1516,7 +1535,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
try { try {
db.beginTransaction(); db.beginTransaction();
for (int i = 0; i < promoSkuListData.size(); i++) { for (int i = 0; i < promoSkuListData.size(); i++) {
Promo_Compliance_DataGetterSetter data = promoSkuListData.get(i); Promo_Compliance_DataGetterSetter data = promoSkuListData.get(i);
@@ -1559,11 +1577,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
dbcursor.close(); dbcursor.close();
if (list.size() > 0) { return list.size() > 0;
return true;
} else {
return false;
}
} }
} catch (Exception e) { } catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString()); Log.d("Exception ", "when fetching Records!!!!!!!!!!!!!!!!!!!!!" + e.toString());
@@ -1576,7 +1590,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
//Gagan End Method //Gagan End Method
//Non Working data //Non Working data
public void insertNonWorkingData(NonWorkingReasonGetterSetter data) { public void insertNonWorkingData(NonWorkingReasonGetterSetter data) {
db.delete("NON_WORKING_REASON", null, null); db.delete("NON_WORKING_REASON", null, null);
@@ -1659,9 +1673,11 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
Cursor dbcursor = null; Cursor dbcursor = null;
try { try {
dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " + dbcursor = db.rawQuery("SELECT * from JOURNEY_PLAN " +
"where VISIT_DATE ='" + date + "' AND STORE_ID='" + store_id + "'", null); "where VISIT_DATE ='" + date + "' AND STORE_ID='" + store_id + "'", null);
if (dbcursor != null) { if (dbcursor != null) {
dbcursor.moveToFirst(); dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) { while (!dbcursor.isAfterLast()) {
@@ -1987,6 +2003,109 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
return list; return list;
} }
//Store wise Performance
public void InsertSTORE_PERFORMANCE(STORE_PERFORMANCE_MasterGetterSetter data) {
db.delete("STORE_PERFORMANCE", 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("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("PERIOD", data.getPERIOD().get(i));
values.put("MSL_AVAILABILITY", data.getMSL_AVAILABILITY().get(i));
values.put("SOS", data.getSOS().get(i));
values.put("T2P", data.getT2P().get(i));
values.put("PROMO", data.getPROMO().get(i));
values.put("OSS", data.getOSS().get(i));
values.put("ORDERID", data.getORDERID().get(i));
db.insert("STORE_PERFORMANCE", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " STORE_PERFORMANCE " + ex.toString());
}
}
//Category wise Performance
public ArrayList<CategoryWisePerformaceGetterSetter> getCategoryWisePerformance(String store_id, String category_id) {
ArrayList<CategoryWisePerformaceGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select * from STORE_PERFORMANCE " +
"where STORE_ID='" + store_id + "' and CATEGORY_ID='" + category_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
CategoryWisePerformaceGetterSetter cd = new CategoryWisePerformaceGetterSetter();
cd.setStore_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORE_ID")));
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
cd.setPeriod(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PERIOD")));
cd.setMsl_availability(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MSL_AVAILABILITY")));
cd.setSos(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SOS")));
cd.setT2p(dbcursor.getString(dbcursor.getColumnIndexOrThrow("T2P")));
cd.setPromo(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PROMO")));
cd.setOss(dbcursor.getString(dbcursor.getColumnIndexOrThrow("OSS")));
cd.setOrder_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ORDERID")));
list.add(cd);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception ", "getPromoComplianceSkuData!" + e.toString());
return list;
}
return list;
}
public ArrayList<StoreWisePerformaceGetterSetter> getStoreWisePerformance(String store_id) {
ArrayList<StoreWisePerformaceGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("Select PERIOD, ROUND(avg(MSL_AVAILABILITY),1) as MSL_AVAILABILITY,ROUND(avg(sos),1) as SOS ," +
" ROUND(avg(t2p),1) as T2P,ROUND(avg(pROMO),1) as PROMO,ROUND(SUM(oss),1) AS OSS " +
"from STORE_PERFORMANCE " +
"where STORE_ID='" + store_id + "' " +
"GROUP BY PERIOD " +
"ORDER BY ORDERID ", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
StoreWisePerformaceGetterSetter cd = new StoreWisePerformaceGetterSetter();
/* cd.setStore_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORE_ID")));
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));*/
cd.setPeriod(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PERIOD")));
cd.setMsl_availability(dbcursor.getString(dbcursor.getColumnIndexOrThrow("MSL_AVAILABILITY")));
cd.setSos(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SOS")));
cd.setT2p(dbcursor.getString(dbcursor.getColumnIndexOrThrow("T2P")));
cd.setPromo(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PROMO")));
cd.setOss(dbcursor.getString(dbcursor.getColumnIndexOrThrow("OSS")));
// cd.setOrder_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ORDERID")));
list.add(cd);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception ", "getPromoComplianceSkuData!" + e.toString());
return list;
}
return list;
}
//Gagan end new code 1 //Gagan end new code 1
public void InsertStockDialog(AdditionalDialogGetterSetter data) { public void InsertStockDialog(AdditionalDialogGetterSetter data) {
@@ -2026,7 +2145,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
try { try {
cursordata = db.rawQuery("SELECT * FROM STOCK_DIALOG WHERE COMMON_ID = '"+keyid + "'", null); cursordata = db.rawQuery("SELECT * FROM STOCK_DIALOG WHERE COMMON_ID = '" + keyid + "'", null);
if (cursordata != null) { if (cursordata != null) {
cursordata.moveToFirst(); cursordata.moveToFirst();
@@ -2110,8 +2229,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
public ArrayList<BrandMasterGetterSetter> getBrandMasterData(String store_id) { public ArrayList<BrandMasterGetterSetter> getBrandMasterData(String store_id) {
Cursor cursordata = null; Cursor cursordata = null;
ArrayList<BrandMasterGetterSetter> Data = new ArrayList<BrandMasterGetterSetter>(); ArrayList<BrandMasterGetterSetter> Data = new ArrayList<BrandMasterGetterSetter>();
@@ -2129,8 +2246,11 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
sb.setBRAND(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND"))); sb.setBRAND(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND")));
/*sb.setSUB_CATEGORY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("SUB_CATEGORY_ID"))); /*sb.setSUB_CATEGORY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
sb.setSUB_CATEGORY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
sb.setCOMPANY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("COMPANY_ID"))); sb.setCOMPANY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("COMPANY_ID")));
sb.setBRAND_SEQUENCE(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_SEQUENCE")));*/ sb.setBRAND_SEQUENCE(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_SEQUENCE")));*/
@@ -2151,7 +2271,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
public ArrayList<SkuMasterGetterSetter> getSKUMasterData(String store_id) { public ArrayList<SkuMasterGetterSetter> getSKUMasterData(String store_id) {
Cursor cursordata = null; Cursor cursordata = null;
ArrayList<SkuMasterGetterSetter> Data = new ArrayList<SkuMasterGetterSetter>(); ArrayList<SkuMasterGetterSetter> Data = new ArrayList<SkuMasterGetterSetter>();
@@ -2172,7 +2291,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
sb.setBRAND_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_ID"))); sb.setBRAND_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_ID")));
sb.setMRP(cursordata.getString(cursordata.getColumnIndexOrThrow("MRP"))); sb.setMRP(cursordata.getString(cursordata.getColumnIndexOrThrow("MRP")));
sb.setSKU_SEQUENCE(cursordata.getString(cursordata.getColumnIndexOrThrow("SKU_SEQUENCE"))); sb.setSKU_SEQUENCE(cursordata.getString(cursordata.getColumnIndexOrThrow("SKU_SEQUENCE")));
@@ -2192,7 +2310,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
public void InsertAdditionalData(AddittionalGetterSetter data,ArrayList<AdditionalDialogGetterSetter> dialog,String categoryId) { public void InsertAdditionalData(AddittionalGetterSetter data,ArrayList<AdditionalDialogGetterSetter> dialog,String categoryId) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
ContentValues values1 = new ContentValues(); ContentValues values1 = new ContentValues();
try { try {
@@ -2205,11 +2325,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
values.put("sku_name", data.getSku()); values.put("sku_name", data.getSku());
values.put("toggle_value", data.getBtn_toogle()); values.put("toggle_value", data.getBtn_toogle());
long key_id = db.insert(CommonString.TABLE_INSERT_STOCK_ADDITIONAL, null, values); long key_id = db.insert(CommonString.TABLE_INSERT_STOCK_ADDITIONAL, null, values);
for(int i=0;i<dialog.size();i++) for (int i = 0; i < dialog.size(); i++) {
{
values1.put(CommonString.KEY_Common_ID, key_id); values1.put(CommonString.KEY_Common_ID, key_id);
values1.put(CommonString.KEY_STORE_ID, dialog.get(i).getStore_id()); values1.put(CommonString.KEY_STORE_ID, dialog.get(i).getStore_id());
values1.put("categoryId", categoryId); values1.put("categoryId", categoryId);
@@ -2221,6 +2339,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.insert(CommonString.TABLE_INSERT_STOCK_DIALOG, null, values1); db.insert(CommonString.TABLE_INSERT_STOCK_DIALOG, null, values1);
} }
} catch (Exception ex) { } catch (Exception ex) {
@@ -2286,6 +2405,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return productData; return productData;
} }
public void updateStoreStatus(String storeid, String visitdate, public void updateStoreStatus(String storeid, String visitdate,
String status) { String status) {
@@ -2296,6 +2416,65 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.update("JOURNEY_PLAN", values, CommonString.KEY_STORE_ID + "='" + storeid + "' AND " + CommonString.KEY_VISIT_DATE + "='" + visitdate + "'", null); db.update("JOURNEY_PLAN", values, CommonString.KEY_STORE_ID + "='" + storeid + "' AND " + CommonString.KEY_VISIT_DATE + "='" + visitdate + "'", null);
} catch (Exception e) { } catch (Exception e) {
}
}
public void InsertT2PData(ArrayList<T2PGetterSetter> data, String store_id, String category_id) {
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, CommonString.KEY_STORE_ID + "='" + store_id + "' AND " + CommonString.KEY_CATEGORY_ID + "='" + category_id + "'", null);
long l = 0;
ContentValues values = new ContentValues();
ContentValues values1 = new ContentValues();
ContentValues values2 = new ContentValues();
try {
for (int i = 0; i < data.size(); i++) {
values.put(CommonString.KEY_STORE_ID, store_id);
values.put(CommonString.KEY_CATEGORY_ID, category_id);
values.put(CommonString.KEY_DISPLAY_ID, data.get(i).getDisplay_id());
values.put(CommonString.KEY_BRAND_ID, data.get(i).getBrand_id());
values.put(CommonString.KEY_BRAND, data.get(i).getBrand());
values.put(CommonString.KEY_DISPLAY, data.get(i).getDisplay());
values.put(CommonString.KEY_IMAGE, data.get(i).getImage());
values.put(CommonString.KEY_REMARK, data.get(i).getRemark());
values.put(CommonString.KEY_PRESENT, data.get(i).isPresent());
l = db.insert(CommonString.TABLE_INSERT_T2P_COMPLIANCE, null, values);
ArrayList<GapsChecklistGetterSetter> gaps = data.get(i).getGapsChecklist();
for (int j = 0; j < gaps.size(); j++) {
values1.put(CommonString.KEY_COMMON_ID, l);
values1.put(CommonString.KEY_CHECKLIST_ID, gaps.get(j).getChecklist_id());
values1.put(CommonString.KEY_DISPLAY_ID, gaps.get(j).getDisplay_id());
values1.put(CommonString.KEY_CHECKLIST, gaps.get(j).getChecklist());
values1.put(CommonString.KEY_PRESENT, gaps.get(j).isPresent());
db.insert(CommonString.TABLE_INSERT_T2P_GAPS, null, values1);
}
ArrayList<SkuGetterSetter> sku = data.get(i).getSkulist();
for (int k = 0; k < sku.size(); k++) {
values2.put(CommonString.KEY_COMMON_ID, l);
values2.put(CommonString.KEY_SKU_ID, sku.get(k).getSKU_ID());
values2.put(CommonString.KEY_BRAND_ID, sku.get(k).getBRAND_ID());
values2.put(CommonString.KEY_STOCK, sku.get(k).getSTOCK());
values2.put(CommonString.KEY_BRAND, sku.get(k).getBRAND());
values2.put(CommonString.KEY_SKU, sku.get(k).getSKU());
db.insert(CommonString.TABLE_INSERT_T2P_SKU, null, values2);
}
}
} catch (Exception ex) {
Log.d("Exception ", " in T2P_COMPLIANCE " + ex.toString());
} }
} }
@@ -2481,4 +2660,202 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
} }
// get T2P Compliance data
public ArrayList<T2PGetterSetter> getT2pComplianceData(String store_id, String category_id) {
ArrayList<T2PGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
if (category_id == null) {
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
CommonString.KEY_STORE_ID + "='" + store_id + "'", null);
} else {
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
CommonString.KEY_STORE_ID + "='" + store_id + "' AND " +
CommonString.KEY_CATEGORY_ID + "='" + category_id + "'", null);
}
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
T2PGetterSetter tp = new T2PGetterSetter();
tp.setKey_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_ID)));
tp.setDisplay_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY_ID)));
tp.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
tp.setBrand(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
tp.setDisplay(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY)));
tp.setImage(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IMAGE)));
tp.setRemark(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_REMARK)));
tp.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CATEGORY_ID)));
tp.setPresent((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_PRESENT)).equalsIgnoreCase("1")));
list.add(tp);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
return list;
}
return list;
}
// get Gaps T2P data
public ArrayList<GapsChecklistGetterSetter> getGapsData(String common_id) {
ArrayList<GapsChecklistGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_GAPS + " where " +
CommonString.KEY_COMMON_ID + "='" + common_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
GapsChecklistGetterSetter gp = new GapsChecklistGetterSetter();
gp.setDisplay_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_DISPLAY_ID)));
gp.setChecklist_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CHECKLIST_ID)));
gp.setChecklist(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CHECKLIST)));
gp.setPresent((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_PRESENT)).equalsIgnoreCase("1")));
list.add(gp);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
return list;
}
return list;
}
// get T2P SKU data
public ArrayList<SkuGetterSetter> getT2PSKUData(String common_id) {
ArrayList<SkuGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_SKU + " where " +
CommonString.KEY_COMMON_ID + "='" + common_id + "'", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
SkuGetterSetter gp = new SkuGetterSetter();
gp.setSKU_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SKU_ID)));
gp.setBRAND_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
gp.setSTOCK(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_STOCK)));
gp.setBRAND(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
gp.setSKU(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SKU)));
list.add(gp);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
return list;
}
return list;
}
//Gagan start new code 2
public void InsertMAPPING_PLANOGRAM(MAPPING_PLANOGRAM_MasterGetterSetter data) {
db.delete("MAPPING_PLANOGRAM", 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("PLANOGRAM_IMAGE", data.getPLANOGRAM_IMAGE().get(i));
values.put("IMAGE_PATH", data.getIMAGE_PATH().get(i));
db.insert("MAPPING_PLANOGRAM", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " MAPPING_PLANOGRAM " + ex.toString());
}
}
public ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> getMappingPlanogramData(String category_id) {
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM MAPPING_PLANOGRAM", null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
MAPPING_PLANOGRAM_DataGetterSetter mp = new MAPPING_PLANOGRAM_DataGetterSetter();
mp.setKEYACCOUNT_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("KEYACCOUNT_ID")));
mp.setSTORETYPE_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORETYPE_ID")));
mp.setCLASS_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CLASS_ID")));
mp.setPLANOGRAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PLANOGRAM_IMAGE")));
mp.setIMAGE_PATH(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE_PATH")));
list.add(mp);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
return list;
}
return list;
}
//Gagan end new code 2
//T2P is filled
public boolean isFilledT2P(String store_id, String category_id) {
Log.d("T2P ", "T2P data--------------->Start<------------");
ArrayList<T2PGetterSetter> list = new ArrayList<>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_INSERT_T2P_COMPLIANCE + " where " +
CommonString.KEY_STORE_ID + "='" + store_id + "' AND " +
CommonString.KEY_CATEGORY_ID + "='" + category_id + "'", null);
if (dbcursor != null) {
if (dbcursor.moveToFirst()) {
do {
T2PGetterSetter tp = new T2PGetterSetter();
tp.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_BRAND_ID)));
list.add(tp);
} while (dbcursor.moveToNext());
}
dbcursor.close();
if (list.size() > 0) {
return true;
} else {
return false;
}
}
} catch (Exception e) {
Log.d("Exception ", "when fetching Records!!!!" + e.toString());
return false;
}
return false;
}
} }
@@ -11,6 +11,8 @@ 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.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
@@ -68,6 +70,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
@@ -133,6 +136,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
storeid = preferences.getString(CommonString.KEY_STORE_ID, null); storeid = preferences.getString(CommonString.KEY_STORE_ID, null);
storename = preferences.getString(CommonString.KEY_STORE_NAME, null); storename = preferences.getString(CommonString.KEY_STORE_NAME, null);
@@ -387,6 +393,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
/* checkPlayServices(); /* checkPlayServices();
// Resuming the periodic location updates // Resuming the periodic location updates
@@ -1007,4 +1014,32 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
} }
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -3,6 +3,8 @@ package cpm.com.gskmtorange.GeoTag;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@@ -23,6 +25,7 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.MainActivity; import cpm.com.gskmtorange.MainActivity;
@@ -68,6 +71,9 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, ""); visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
@@ -125,9 +131,9 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Intent intent = new Intent(GeoTagStoreList.this, MainActivity.class); /* Intent intent = new Intent(GeoTagStoreList.this, MainActivity.class);
startActivity(intent); startActivity(intent);*/
GeoTagStoreList.this.finish(); GeoTagStoreList.this.finish();
} }
@@ -274,5 +280,38 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -39,7 +39,6 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.ksoap2.SoapEnvelope; import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.serialization.SoapSerializationEnvelope;
@@ -115,6 +114,19 @@ public class LoginActivity extends AppCompatActivity {
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
TextView tv_version = (TextView) findViewById(R.id.tv_version_code);
try {
app_ver =String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
// login_version.setText("Parinaam Version " + app_ver);
} catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tv_version.setText("Version/Versiyon - " + app_ver);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit(); editor = preferences.edit();
@@ -682,5 +694,7 @@ public class LoginActivity extends AppCompatActivity {
return true; return true;
} }
} }
@@ -5,6 +5,8 @@ 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.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
@@ -33,6 +35,7 @@ import java.io.FileOutputStream;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList; import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
@@ -40,6 +43,7 @@ import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.GetterSetter.StoreBean; import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility; import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
import cpm.com.gskmtorange.dailyentry.SettingsActivity;
import cpm.com.gskmtorange.dailyentry.T2PComplianceActivity; import cpm.com.gskmtorange.dailyentry.T2PComplianceActivity;
import cpm.com.gskmtorange.dailyentry.StoreListActivity; import cpm.com.gskmtorange.dailyentry.StoreListActivity;
import cpm.com.gskmtorange.download.DownloadActivity; import cpm.com.gskmtorange.download.DownloadActivity;
@@ -68,7 +72,11 @@ public class MainActivity extends AppCompatActivity
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
imageView = (ImageView) findViewById(R.id.img_main); imageView = (ImageView) findViewById(R.id.img_main);
@@ -122,6 +130,13 @@ public class MainActivity extends AppCompatActivity
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
@Override @Override
public void onBackPressed() { public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
@@ -251,12 +266,12 @@ public class MainActivity extends AppCompatActivity
} else if (id == R.id.nav_exit) { } else if (id == R.id.nav_exit) {
Intent startDownload = new Intent(this,AdditionalVisibility.class); /* Intent startDownload = new Intent(this,AdditionalVisibility.class);
startActivity(startDownload); startActivity(startDownload);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out); overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
*/
finish();
} else if (id == R.id.nav_services) { } else if (id == R.id.nav_services) {
@@ -267,9 +282,14 @@ public class MainActivity extends AppCompatActivity
} else if (id == R.id.nav_setting) { } else if (id == R.id.nav_setting) {
startActivity(new Intent(MainActivity.this, CategoryListActivity.class)); Intent startDownload = new Intent(this,SettingsActivity.class);
startActivity(startDownload);
} else if (id == R.id.nav_export) { overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
//startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
} /*else if (id == R.id.nav_export) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this); AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("Are you sure you want to take the backup of your data") builder1.setMessage("Are you sure you want to take the backup of your data")
@@ -278,12 +298,12 @@ public class MainActivity extends AppCompatActivity
@SuppressWarnings("resource") @SuppressWarnings("resource")
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
try { try {
/*File file = new File(Environment *//*File file = new File(Environment
.getExternalStorageDirectory(), .getExternalStorageDirectory(),
"capital_backup"); "capital_backup");
if (!file.isDirectory()) { if (!file.isDirectory()) {
file.mkdir(); file.mkdir();
}*/ }*//*
File sd = Environment.getExternalStorageDirectory(); File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory(); File data = Environment.getDataDirectory();
@@ -326,7 +346,7 @@ public class MainActivity extends AppCompatActivity
}); });
AlertDialog alert1 = builder1.create(); AlertDialog alert1 = builder1.create();
alert1.show(); alert1.show();
} }*/
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
@@ -410,4 +430,31 @@ public class MainActivity extends AppCompatActivity
return flag; return flag;
} }
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -15,6 +15,8 @@ import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import com.google.gson.Gson;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
@@ -51,6 +53,8 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
language = login_data.getCULTURE_NAME(); language = login_data.getCULTURE_NAME();
culture_id = login_data.getCULTURE_ID(); culture_id = login_data.getCULTURE_ID();
setDataFromSharedPreferences(login_data);
if (language.size() > 1) { if (language.size() > 1) {
btn_lang_1.setText(language.get(0)); btn_lang_1.setText(language.get(0));
@@ -144,4 +148,15 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
return true; return true;
} }
private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs);
//SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit();
}
} }
@@ -53,6 +53,18 @@ public class CommonString {
public static final String KEY_ID = "Id"; public static final String KEY_ID = "Id";
public static final String KEY_MERCHANDISER_ID = "MERCHANDISER_ID"; public static final String KEY_MERCHANDISER_ID = "MERCHANDISER_ID";
public static final String KEY_LOOGIN_PREF ="LOGIN_PREF";
//KEYS RELATED TO T2P COMPLIANCE
public static final String KEY_DISPLAY = "DISPLAY";
public static final String KEY_REMARK = "REMARK";
public static final String KEY_PRESENT = "PRESENT";
public static final String KEY_COMMON_ID = "COMMON_ID";
public static final String KEY_CHECKLIST_ID = "CHECKLIST_ID";
public static final String KEY_CHECKLIST = "CHECKLIST";
public static final String KEY_SKU = "SKU";
public static final String KEY_STOCK = "STOCK";
public static final String KEY_BRAND = "BRAND"; public static final String KEY_BRAND = "BRAND";
public static final String KEY_BRAND_ID = "BRAND_ID"; public static final String KEY_BRAND_ID = "BRAND_ID";
public static final String KEY_DISPLAY_ID = "DISPLAY_ID"; public static final String KEY_DISPLAY_ID = "DISPLAY_ID";
@@ -225,6 +237,9 @@ public class CommonString {
+ "Category_Id" + "Category_Id"
+ " VARCHAR," + " VARCHAR,"
+ "COMPANY_ID"
+ " VARCHAR,"
+ "SUB_CATEGORY_ID" + "SUB_CATEGORY_ID"
+ " VARCHAR," + " VARCHAR,"
@@ -332,6 +347,7 @@ public class CommonString {
+ ")"; + ")";
public static final String TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "Additional_Promo_Compliance_Data"; public static final String TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "Additional_Promo_Compliance_Data";
public static final String CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "CREATE TABLE IF NOT EXISTS " public static final String CREATE_TABLE_INSERT_ADDITIONAL_PROMO_COMPLIANCE = "CREATE TABLE IF NOT EXISTS "
@@ -343,14 +359,11 @@ public class CommonString {
+ "STORE_ID" + "STORE_ID"
+ " INTEGER," + " INTEGER,"
+ "CATEGORY_ID" /*+ "SKU_ID"
+ " INTEGER,"
+ "SKU_ID"
+ " INTEGER," + " INTEGER,"
+ "SKU" + "SKU"
+ " VARCHAR," + " VARCHAR,"*/
+ "PROMO_ID" + "PROMO_ID"
+ " INTEGER," + " INTEGER,"
@@ -418,7 +431,6 @@ public class CommonString {
+ KEY_IMAGE + " VARCHAR)"; + KEY_IMAGE + " VARCHAR)";
public static final String TABLE_INSERT_STOCK_ADDITIONAL_MAIN = "Stock_Additional_visibility_Main"; public static final String TABLE_INSERT_STOCK_ADDITIONAL_MAIN = "Stock_Additional_visibility_Main";
public static final String CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN = "CREATE TABLE IF NOT EXISTS " public static final String CREATE_TABLE_INSERT_STOCK_ADDITIONAL_VISIBILITY_MAIN = "CREATE TABLE IF NOT EXISTS "
@@ -464,7 +476,53 @@ public class CommonString {
+ KEY_SKUNAME + " VARCHAR," + KEY_SKUNAME + " VARCHAR,"
+ KEY_PROCESS_ID + " VARCHAR)"; + KEY_PROCESS_ID + " VARCHAR)";
//Tables related to T2p Compliance
public static final String TABLE_INSERT_T2P_COMPLIANCE = "T2P_COMPLIANCE";
public static final String CREATE_TABLE_INSERT_T2P_COMPLIANCE = "CREATE TABLE IF NOT EXISTS "
+ TABLE_INSERT_T2P_COMPLIANCE
+ "("
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ KEY_STORE_ID + " INTEGER,"
+ KEY_CATEGORY_ID + " INTEGER,"
+ KEY_BRAND_ID + " INTEGER,"
+ KEY_DISPLAY_ID + " INTEGER,"
+ KEY_BRAND + " VARCHAR,"
+ KEY_DISPLAY + " VARCHAR,"
+ KEY_IMAGE + " VARCHAR,"
+ KEY_REMARK + " VARCHAR,"
+ KEY_PRESENT + " VARCHAR"
+ ")";
public static final String TABLE_INSERT_T2P_GAPS = "T2P_GAPS";
public static final String CREATE_TABLE_INSERT_T2P_GAPS = "CREATE TABLE IF NOT EXISTS "
+ TABLE_INSERT_T2P_GAPS
+ "("
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ KEY_COMMON_ID + " INTEGER,"
+ KEY_CHECKLIST_ID + " INTEGER,"
+ KEY_DISPLAY_ID + " INTEGER,"
+ KEY_CHECKLIST + " VARCHAR,"
+ KEY_PRESENT + " VARCHAR"
+ ")";
public static final String TABLE_INSERT_T2P_SKU = "T2P_SKU";
public static final String CREATE_TABLE_INSERT_T2P_SKU = "CREATE TABLE IF NOT EXISTS "
+ TABLE_INSERT_T2P_SKU
+ "("
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ KEY_COMMON_ID + " INTEGER,"
+ KEY_SKU_ID + " INTEGER,"
+ KEY_BRAND_ID + " INTEGER,"
+ KEY_STOCK + " INTEGER,"
+ KEY_BRAND+ " VARCHAR,"
+ KEY_SKU + " VARCHAR"
+ ")";
} }
@@ -10,6 +10,8 @@ import android.content.Intent;
import android.content.SharedPreferences; 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.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
@@ -49,6 +51,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagActivity; import cpm.com.gskmtorange.GeoTag.GeoTagActivity;
@@ -124,6 +127,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId"); categoryId = getIntent().getStringExtra("categoryId");
@@ -1404,5 +1408,38 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
return flag; return flag;
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -1,11 +1,14 @@
package cpm.com.gskmtorange.dailyentry; package cpm.com.gskmtorange.dailyentry;
import android.app.AlertDialog; import android.app.AlertDialog;
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.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@@ -32,6 +35,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CoverageBean; import cpm.com.gskmtorange.GetterSetter.CoverageBean;
@@ -90,6 +94,9 @@ public class NonWorkingReason extends AppCompatActivity implements
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
_UserId = preferences.getString(CommonString.KEY_USERNAME, ""); _UserId = preferences.getString(CommonString.KEY_USERNAME, "");
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
store_id = preferences.getString(CommonString.KEY_STORE_ID, ""); store_id = preferences.getString(CommonString.KEY_STORE_ID, "");
@@ -108,7 +115,7 @@ public class NonWorkingReason extends AppCompatActivity implements
reason_adapter = new ArrayAdapter<CharSequence>(this, reason_adapter = new ArrayAdapter<CharSequence>(this,
android.R.layout.simple_spinner_item); android.R.layout.simple_spinner_item);
reason_adapter.add("Select Reason"); reason_adapter.add(getResources().getString(R.string.select_reason));
for (int i = 0; i < reasondata.size(); i++) { for (int i = 0; i < reasondata.size(); i++) {
reason_adapter.add(reasondata.get(i).getREASON().get(0)); reason_adapter.add(reasondata.get(i).getREASON().get(0));
@@ -463,4 +470,37 @@ public class NonWorkingReason extends AppCompatActivity implements
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -0,0 +1,51 @@
package cpm.com.gskmtorange.dailyentry;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.fragment.SelectLanguageFragment;
import cpm.com.gskmtorange.fragment.SettingsActivityFragment;
public class SettingsActivity extends AppCompatActivity implements SelectLanguageFragment.OnFragmentInteractionListener {
boolean isSelected = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
SettingsActivityFragment fragment = new SettingsActivityFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(isSelected){
finish();
}
else {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}
});
}
@Override
public void onFragmentInteraction(boolean isSelected) {
this.isSelected = isSelected;
}
}
@@ -6,8 +6,13 @@ 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.SharedPreferences;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@@ -36,6 +41,7 @@ import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagActivity; import cpm.com.gskmtorange.GeoTag.GeoTagActivity;
@@ -76,6 +82,9 @@ public class StoreListActivity extends AppCompatActivity {
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, ""); visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
db = new GSKOrangeDB(StoreListActivity.this); db = new GSKOrangeDB(StoreListActivity.this);
@@ -94,8 +103,6 @@ public class StoreListActivity extends AppCompatActivity {
startActivity(in); startActivity(in);
finish(); finish();
} }
}); });
@@ -106,6 +113,8 @@ public class StoreListActivity extends AppCompatActivity {
// TODO Auto-generated method stub // TODO Auto-generated method stub
super.onResume(); super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
storelist = db.getStoreData(date); storelist = db.getStoreData(date);
coverage = db.getCoverageData(date); coverage = db.getCoverageData(date);
@@ -507,6 +516,34 @@ public class StoreListActivity extends AppCompatActivity {
return result_flag; return result_flag;
} }
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
public void UpdateStore(String storeid) { public void UpdateStore(String storeid) {
db.open(); db.open();
@@ -2,11 +2,14 @@ package cpm.com.gskmtorange.dailyentry;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
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.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.location.Location; import android.location.Location;
@@ -34,12 +37,14 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.R; 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; import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
import cpm.com.gskmtorange.gsk_dailyentry.StoreWisePerformanceActivity;
/** /**
* Created by ashishc on 31-05-2016. * Created by ashishc on 31-05-2016.
@@ -81,6 +86,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -198,7 +205,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
editor.commit();*/ editor.commit();*/
Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class); //Intent in = new Intent(StoreimageActivity.this, CategoryListActivity.class);
Intent in = new Intent(StoreimageActivity.this, StoreWisePerformanceActivity.class);
startActivity(in); startActivity(in);
finish(); finish();
} }
@@ -268,8 +276,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
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 (ActivityNotFoundException e) {
catch (ActivityNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
@@ -277,8 +284,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
intent.setPackage(gallery_package); intent.setPackage(gallery_package);
startActivityForResult(intent, 0); startActivityForResult(intent, 0);
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -341,6 +347,12 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
protected void onStart() { protected void onStart() {
mGoogleApiClient.connect(); mGoogleApiClient.connect();
super.onStart(); super.onStart();
@@ -351,4 +363,31 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
super.onStop(); super.onStop();
} }
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -4,12 +4,17 @@ import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; 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.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@@ -17,6 +22,7 @@ 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;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
@@ -45,10 +51,14 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.LoginActivity;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.fonts.FontManager;
import cpm.com.gskmtorange.fonts.TextDrawable;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
@@ -64,34 +74,36 @@ public class T2PComplianceActivity extends AppCompatActivity {
T2PAdapter t2PAdapter; T2PAdapter t2PAdapter;
RecyclerView rec_t2p; RecyclerView rec_t2p;
String categoryName, categoryId, storeId; String categoryName, categoryId;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
String path = "", str = CommonString.FILE_PATH, _pathforcheck = "", img = ""; String path = "", str = CommonString.FILE_PATH, _pathforcheck = "", img = "";
int child_position = -1; int child_position = -1;
/** String error_msg;
* ATTENTION: This was auto-generated to implement the App Indexing API. private SharedPreferences preferences;
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_t2_pcompliance); setContentView(R.layout.activity_t2_pcompliance);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
// toolbar.setTitle(R.string.title_activity_t2_pcompliance + " - " + categoryName);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
db = new GSKOrangeDB(T2PComplianceActivity.this); db = new GSKOrangeDB(T2PComplianceActivity.this);
db.open(); db.open();
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -100,7 +112,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, ""); keyAccount_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
class_id = preferences.getString(CommonString.KEY_CLASS_ID, ""); class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, ""); storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
rec_t2p = (RecyclerView) findViewById(R.id.rec_t2p); rec_t2p = (RecyclerView) findViewById(R.id.rec_t2p);
@@ -108,24 +120,47 @@ public class T2PComplianceActivity extends AppCompatActivity {
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (isValid()) {
db.InsertT2PData(t2PGetterSetters, store_id, categoryId);
Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG) Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG)
.setAction("Action", null).show(); .setAction("Action", null).show();
finish(); finish();
} else {
Snackbar.make(view, error_msg, Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
} }
}); });
t2PGetterSetters = db.getT2pComplianceData(store_id, categoryId);
if (t2PGetterSetters.size() == 0) {
t2PGetterSetters = db.getT2PDefaultData(store_id); t2PGetterSetters = db.getT2PDefaultData(store_id);
} else {
for (int i = 0; i < t2PGetterSetters.size(); i++) {
ArrayList<GapsChecklistGetterSetter> gapsList = db.getGapsData(t2PGetterSetters.get(i).getKey_id());
ArrayList<SkuGetterSetter> skuList = db.getT2PSKUData(t2PGetterSetters.get(i).getKey_id());
t2PGetterSetters.get(i).setGapsChecklist(gapsList);
t2PGetterSetters.get(i).setSkulist(skuList);
}
}
if (t2PGetterSetters.size() > 0) { if (t2PGetterSetters.size() > 0) {
for (int i = 0; i < t2PGetterSetters.size(); i++) { /* for (int i = 0; i < t2PGetterSetters.size(); i++) {
ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(t2PGetterSetters.get(i).getDisplay_id()); ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(t2PGetterSetters.get(i).getDisplay_id());
t2PGetterSetters.get(i).setGapsChecklist(gapsChecklist); t2PGetterSetters.get(i).setGapsChecklist(gapsChecklist);
} }*/
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
t2PAdapter = new T2PAdapter(t2PGetterSetters); t2PAdapter = new T2PAdapter(t2PGetterSetters);
@@ -133,16 +168,13 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
@@ -168,11 +200,16 @@ public class T2PComplianceActivity extends AppCompatActivity {
holder.tv_brand.setText(mItem.getBrand()); holder.tv_brand.setText(mItem.getBrand());
holder.tv_display.setText(mItem.getDisplay().trim()); holder.tv_display.setText(mItem.getDisplay().trim());
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
*/
holder.btn_gaps.setOnClickListener(new View.OnClickListener() { holder.btn_gaps.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
showGapsDialog(mItem.getGapsChecklist()); showGapsDialog(mItem);
} }
}); });
@@ -181,26 +218,12 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes")) { mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase(getResources().getString(R.string.yes)));
mItem.setPresent(true);
} else {
mItem.setPresent(false);
}
t2PAdapter.notifyDataSetChanged(); t2PAdapter.notifyDataSetChanged();
} }
}); });
holder.img_cam.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
_pathforcheck = "T2P_Image_" + store_id + "_" + mItem.getBrand_id() + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = position;
path = str + _pathforcheck;
startCameraActivity();
}
});
holder.btn_sku.setOnClickListener(new View.OnClickListener() { holder.btn_sku.setOnClickListener(new View.OnClickListener() {
@Override @Override
@@ -216,14 +239,43 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
} }
if (mItem.getImage().equals("")) { if(camera_allow.equals("1")){
holder.img_cam.setBackgroundResource(R.drawable.cam_deactive);
} else { holder.img_cam.setOnClickListener(new View.OnClickListener() {
holder.img_cam.setBackgroundResource(R.drawable.cam_active); @Override
public void onClick(View v) {
_pathforcheck = "T2P_Image_" + store_id + "_" + mItem.getBrand_id() + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + getCurrentTime().replace(":", "") + ".jpg";
child_position = position;
path = str + _pathforcheck;
startCameraActivity();
} }
});
if (mItem.getImage().equals("")) {
holder.img_cam.setBackgroundResource(R.mipmap.camera_orange);
} else {
holder.img_cam.setBackgroundResource(R.mipmap.camera_green);
}
}
else {
holder.img_cam.setBackgroundResource(R.mipmap.camera_grey);
}
holder.toggle_btn.setChecked(mItem.isPresent()); holder.toggle_btn.setChecked(mItem.isPresent());
if (mItem.getGapsChecklist().size() > 0) {
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.green));
} else {
holder.btn_gaps.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
}
if (mItem.getSkulist().size() > 0) {
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.green));
} else {
holder.btn_sku.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
}
} }
@@ -261,8 +313,17 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
} }
public void showGapsDialog(ArrayList<GapsChecklistGetterSetter> gapsChecklist) {
//ArrayList<GapsChecklistGetterSetter> gapsChecklist = db.getGapsDefaultData(display_id); public void showGapsDialog(final T2PGetterSetter t2p) {
final ArrayList<GapsChecklistGetterSetter> gapsChecklist;
if (t2p.getGapsChecklist().size() > 0) {
gapsChecklist = t2p.getGapsChecklist();
} else {
gapsChecklist = db.getGapsDefaultData(t2p.getDisplay_id());
}
final Dialog dialog = new Dialog(T2PComplianceActivity.this); final Dialog dialog = new Dialog(T2PComplianceActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@@ -279,8 +340,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
t2p.setGapsChecklist(gapsChecklist);
dialog.cancel(); dialog.cancel();
t2PAdapter.notifyDataSetChanged();
} }
}); });
@@ -315,7 +377,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
final ArrayList<SkuGetterSetter> sku_list = new ArrayList<>(); final ArrayList<SkuGetterSetter> sku_list = new ArrayList<>();
if(skuAddedList.size()>0){ if (skuAddedList.size() > 0) {
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList); SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
@@ -327,11 +389,10 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if(brand_selected[0] ==null || sku_selected[0]==null || et_stock.getText().toString().equals("")){ if (brand_selected[0] == null || sku_selected[0] == null || et_stock.getText().toString().equals("")) {
Snackbar.make(v, getResources().getString(R.string.enter_the_values),Snackbar.LENGTH_SHORT).show(); Snackbar.make(v, getResources().getString(R.string.enter_the_values), Snackbar.LENGTH_SHORT).show();
} } else {
else{
SkuGetterSetter sku = new SkuGetterSetter(); SkuGetterSetter sku = new SkuGetterSetter();
sku.setBRAND_ID(brand_selected[0].getBRAND_ID().get(0)); sku.setBRAND_ID(brand_selected[0].getBRAND_ID().get(0));
sku.setBRAND(brand_selected[0].getBRAND().get(0)); sku.setBRAND(brand_selected[0].getBRAND().get(0));
@@ -349,7 +410,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
spinner_brand.setSelection(0); spinner_brand.setSelection(0);
SkuGetterSetter select = new SkuGetterSetter(); SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select"); select.setSKU(getString(R.string.select));
sku_list.clear(); sku_list.clear();
sku_list.add(select); sku_list.add(select);
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list); CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
@@ -360,7 +421,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
brand_selected[0] = null; brand_selected[0] = null;
sku_selected[0] = null; sku_selected[0] = null;
} }
} }
@@ -369,7 +429,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
btn_cancel.setOnClickListener(new View.OnClickListener() { btn_cancel.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dialog.cancel(); dialog.cancel();
t2PAdapter.notifyDataSetChanged();
} }
}); });
@@ -380,7 +442,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
SkuGetterSetter select = new SkuGetterSetter(); SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select"); select.setSKU(getString(R.string.select));
sku_list.add(select); sku_list.add(select);
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list); CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
spinner_sku.setAdapter(skuadapter); spinner_sku.setAdapter(skuadapter);
@@ -400,12 +462,12 @@ public class T2PComplianceActivity extends AppCompatActivity {
ArrayList<SkuGetterSetter> temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id); ArrayList<SkuGetterSetter> temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id);
for (int k=0;k<temp_list.size();k++){ for (int k = 0; k < temp_list.size(); k++) {
sku_list.add(temp_list.get(k)); sku_list.add(temp_list.get(k));
} }
SkuGetterSetter select = new SkuGetterSetter(); SkuGetterSetter select = new SkuGetterSetter();
select.setSKU("Select"); select.setSKU(getString(R.string.select));
sku_list.add(0, select); sku_list.add(0, select);
// Create custom adapter object ( see below CustomSkuAdapter.java ) // Create custom adapter object ( see below CustomSkuAdapter.java )
CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list); CustomSkuAdapter skuadapter = new CustomSkuAdapter(T2PComplianceActivity.this, R.layout.custom_spinner_item, sku_list);
@@ -428,7 +490,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(position!=0){ if (position != 0) {
sku_selected[0] = sku_list.get(position); sku_selected[0] = sku_list.get(position);
} }
@@ -446,191 +508,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
public class GapsAdapter extends RecyclerView.Adapter<GapsAdapter.ViewHolder> {
private ArrayList<GapsChecklistGetterSetter> list;
public GapsAdapter(ArrayList<GapsChecklistGetterSetter> gapsPList) {
list = gapsPList;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.gap_checklist_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final GapsChecklistGetterSetter mItem = list.get(position);
holder.tv_checklist.setText(mItem.getChecklist());
holder.tb_present.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes")) {
mItem.setPresent(true);
}
}
});
holder.tb_present.setChecked(mItem.isPresent());
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final LinearLayout parentLayout;
public final TextView tv_checklist;
public final ToggleButton tb_present;
public ViewHolder(View view) {
super(view);
mView = view;
tv_checklist = (TextView) mView.findViewById(R.id.tv_checklist);
tb_present = (ToggleButton) mView.findViewById(R.id.btn_is_present);
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
}
}
}
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;
}
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will // Handle action bar item clicks here. The action bar will
@@ -736,6 +613,237 @@ public class T2PComplianceActivity extends AppCompatActivity {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
public boolean isValid() {
boolean flag = true;
for (int i = 0; i < t2PGetterSetters.size(); i++) {
if (camera_allow.equals("1") && t2PGetterSetters.get(i).getImage().equals("")) {
flag = false;
error_msg = getResources().getString(R.string.click_image);
break;
} else if (t2PGetterSetters.get(i).getGapsChecklist().size() == 0) {
flag = false;
error_msg = getResources().getString(R.string.fill_gaps_data);
break;
} else if (t2PGetterSetters.get(i).getSkulist().size() == 0) {
flag = false;
error_msg = getResources().getString(R.string.fill_sku_data);
break;
}
}
return flag;
}
@Override
public void onBackPressed() {
//super.onBackPressed();
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
})
.setNegativeButton("Cancel ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
}
public class GapsAdapter extends RecyclerView.Adapter<GapsAdapter.ViewHolder> {
private ArrayList<GapsChecklistGetterSetter> list;
public GapsAdapter(ArrayList<GapsChecklistGetterSetter> gapsPList) {
list = gapsPList;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.gap_checklist_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final GapsChecklistGetterSetter mItem = list.get(position);
holder.tv_checklist.setText(mItem.getChecklist());
holder.tb_present.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mItem.setPresent(((ToggleButton) v).getText().toString().equalsIgnoreCase("Yes"));
}
});
holder.tb_present.setChecked(mItem.isPresent());
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final LinearLayout parentLayout;
public final TextView tv_checklist;
public final ToggleButton tb_present;
public ViewHolder(View view) {
super(view);
mView = view;
tv_checklist = (TextView) mView.findViewById(R.id.tv_checklist);
tb_present = (ToggleButton) mView.findViewById(R.id.btn_is_present);
parentLayout = (LinearLayout) mView.findViewById(R.id.parent_layout);
}
}
}
public class CustomAdapter extends ArrayAdapter<String> {
BrandMasterGetterSetter tempValues = null;
LayoutInflater inflater;
private Activity activity;
private ArrayList data;
/*************
* 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(getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
label.setText(tempValues.getBRAND().get(0));
}
return row;
}
}
public class CustomSkuAdapter extends ArrayAdapter<String> {
SkuGetterSetter tempValues = null;
LayoutInflater inflater;
private Activity activity;
private ArrayList data;
/*************
* 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(getString(R.string.select));
//sub.setText("");
} else {
// Set values for spinner each row
label.setText(tempValues.getSKU());
}
return row;
}
}
public class SkuAddedAdapter extends RecyclerView.Adapter<SkuAddedAdapter.ViewHolder> { public class SkuAddedAdapter extends RecyclerView.Adapter<SkuAddedAdapter.ViewHolder> {
private ArrayList<SkuGetterSetter> list; private ArrayList<SkuGetterSetter> list;
@@ -786,4 +894,30 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
} }
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -5,9 +5,12 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.Window; import android.view.Window;
@@ -19,12 +22,19 @@ import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE; import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader; import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
@@ -35,10 +45,12 @@ import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.STORE_PERFORMANCE_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.TableBean; import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
@@ -46,15 +58,10 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class DownloadActivity extends AppCompatActivity { public class DownloadActivity extends AppCompatActivity {
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
Data data; Data data;
int eventType; int eventType;
GSKOrangeDB db; GSKOrangeDB db;
private SharedPreferences preferences = null;
String userId, culture_id; String userId, culture_id;
JourneyPlanGetterSetter jcpgettersetter; JourneyPlanGetterSetter jcpgettersetter;
SkuMasterGetterSetter skumastergettersetter; SkuMasterGetterSetter skumastergettersetter;
BrandMasterGetterSetter brandMasterGetterSetter; BrandMasterGetterSetter brandMasterGetterSetter;
@@ -68,6 +75,12 @@ public class DownloadActivity extends AppCompatActivity {
NonWorkingReasonGetterSetter nonWorkingReasonGetterSetter; NonWorkingReasonGetterSetter nonWorkingReasonGetterSetter;
MappingPromotionGetterSetter mappingPromotionGetterSetter; MappingPromotionGetterSetter mappingPromotionGetterSetter;
MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter mapping_additional_promotion_masterGetterSetter; MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter mapping_additional_promotion_masterGetterSetter;
STORE_PERFORMANCE_MasterGetterSetter store_performance_masterGetterSetter;
MAPPING_PLANOGRAM_MasterGetterSetter mapping_planogram_masterGetterSetter;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private SharedPreferences preferences = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -77,11 +90,16 @@ public class DownloadActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
new UploadTask(DownloadActivity.this).execute(); new UploadTask(DownloadActivity.this).execute();
} }
class Data { class Data {
int value; int value;
String name; String name;
@@ -116,7 +134,7 @@ public class DownloadActivity extends AppCompatActivity {
data = new Data(); data = new Data();
data.value = 10; data.value = 10;
data.name = "JCP Data Downloading"; data.name = "JCP "+getResources().getString(R.string.download_data);
publishProgress(data); publishProgress(data);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
@@ -135,7 +153,7 @@ public class DownloadActivity extends AppCompatActivity {
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL); HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
Object result = (Object) envelope.getResponse(); Object result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
//InputStream stream = new ByteArrayInputStream(result.toString().getBytes("UTF-8")); //InputStream stream = new ByteArrayInputStream(result.toString().getBytes("UTF-8"));
@@ -157,7 +175,7 @@ public class DownloadActivity extends AppCompatActivity {
} }
data.value = 10; data.value = 10;
data.name = "JCP Data Downloading"; data.name = "JCP "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -175,7 +193,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -193,7 +211,7 @@ public class DownloadActivity extends AppCompatActivity {
} }
data.value = 20; data.value = 20;
data.name = "SKU_MASTER Data Download"; data.name = "SKU_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -211,7 +229,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -229,7 +247,7 @@ public class DownloadActivity extends AppCompatActivity {
} }
data.value = 30; data.value = 30;
data.name = "BRAND_MASTER Data Download"; data.name = "BRAND_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -247,7 +265,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -264,7 +282,7 @@ public class DownloadActivity extends AppCompatActivity {
return "SUB_CATEGORY_MASTER"; return "SUB_CATEGORY_MASTER";
} }
data.value = 40; data.value = 40;
data.name = "SUB_CATEGORY_MASTER Data Download"; data.name = "SUB_CATEGORY_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -282,7 +300,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -299,7 +317,7 @@ public class DownloadActivity extends AppCompatActivity {
return "CATEGORY_MASTER"; return "CATEGORY_MASTER";
} }
data.value = 50; data.value = 50;
data.name = "CATEGORY_MASTER Data Download"; data.name = "CATEGORY_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -317,7 +335,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -334,7 +352,7 @@ public class DownloadActivity extends AppCompatActivity {
return "DISPLAY_MASTER"; return "DISPLAY_MASTER";
} }
data.value = 60; data.value = 60;
data.name = "DISPLAY_MASTER Data Download"; data.name = "DISPLAY_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -352,7 +370,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -369,7 +387,7 @@ public class DownloadActivity extends AppCompatActivity {
return "MAPPING_STOCK"; return "MAPPING_STOCK";
} }
data.value = 80; data.value = 80;
data.name = "MAPPING_STOCK Data Download"; data.name = "MAPPING_STOCK "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -387,7 +405,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -404,7 +422,7 @@ public class DownloadActivity extends AppCompatActivity {
//return "MAPPING_T2P"; //return "MAPPING_T2P";
} }
data.value = 100; data.value = 100;
data.name = "MAPPING_T2P Data Download"; data.name = "MAPPING_T2P "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -421,7 +439,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -438,7 +456,7 @@ public class DownloadActivity extends AppCompatActivity {
return "DISPLAY_CHECKLIST_MASTER"; return "DISPLAY_CHECKLIST_MASTER";
} }
data.value = 100; data.value = 100;
data.name = "DISPLAY_CHECKLIST_MASTER Data Download"; data.name = "DISPLAY_CHECKLIST_MASTER "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -455,7 +473,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -472,7 +490,7 @@ public class DownloadActivity extends AppCompatActivity {
//return "MAPPING_DISPLAY_CHECKLIST"; //return "MAPPING_DISPLAY_CHECKLIST";
} }
data.value = 100; data.value = 100;
data.name = "MAPPING_DISPLAY_CHECKLIST Data Download"; data.name = "MAPPING_DISPLAY_CHECKLIST "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -490,7 +508,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -507,7 +525,7 @@ public class DownloadActivity extends AppCompatActivity {
return "NON_WORKING_REASON"; return "NON_WORKING_REASON";
} }
data.value = 100; data.value = 100;
data.name = "NON_WORKING_REASON Data Download"; data.name = "NON_WORKING_REASON "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -525,7 +543,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -542,7 +560,7 @@ public class DownloadActivity extends AppCompatActivity {
//return "MAPPING_PROMOTION"; //return "MAPPING_PROMOTION";
}*/ }*/
data.value = 100; data.value = 100;
data.name = "MAPPING_PROMOTION Data Download"; data.name = "MAPPING_PROMOTION "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
@@ -562,7 +580,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (result.toString() != null) { if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
@@ -580,10 +598,139 @@ public class DownloadActivity extends AppCompatActivity {
//return "MAPPING_ADDITIONAL_PROMOTION"; //return "MAPPING_ADDITIONAL_PROMOTION";
}*/ }*/
data.value = 100; data.value = 100;
data.name = "MAPPING_ADDITIONAL_PROMOTION Data Download"; data.name = "MAPPING_ADDITIONAL_PROMOTION "+getResources().getString(R.string.download_data);
} }
publishProgress(data); publishProgress(data);
//STORE_PERFORMANCE
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId);
request.addProperty("Type", "STORE_PERFORMANCE");
request.addProperty("cultureid", culture_id);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
xpp.next();
eventType = xpp.getEventType();
store_performance_masterGetterSetter = XMLHandlers.STORE_PERFORMANCEXMLHandler(xpp, eventType);
if (store_performance_masterGetterSetter.getSTORE_ID().size() > 0) {
String table_store_performace = store_performance_masterGetterSetter.getTable_STORE_PERFORMANCE();
if (table_store_performace != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setStorePerformance(table_store_performace);
}
} else {
//return "STORE_PERFORMANCE";
}
data.value = 100;
data.name = "STORE_PERFORMANCE Data Download";
}
publishProgress(data);
//MAPPING_PLANOGRAM
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId);
request.addProperty("Type", "MAPPING_PLANOGRAM");
request.addProperty("cultureid", culture_id);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
xpp.next();
eventType = xpp.getEventType();
mapping_planogram_masterGetterSetter = XMLHandlers.MAPPING_PLANOGRAM_XMLHandler(xpp, eventType);
if (mapping_planogram_masterGetterSetter.getKEYACCOUNT_ID().size() > 0) {
String table_mapping_planogram = mapping_planogram_masterGetterSetter.getTable_MAPPING_PLANOGRAM();
if (table_mapping_planogram != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingPlanogram(table_mapping_planogram);
}
} else {
//return "MAPPING_PLANOGRAM";
}
data.value = 100;
data.name = "MAPPING_PLANOGRAM Data Download";
}
publishProgress(data);
//MAPPING_PLANOGRAM Image save into folder
if (mapping_planogram_masterGetterSetter != null) {
for (int i = 0; i < mapping_planogram_masterGetterSetter.getIMAGE_PATH().size(); i++) {
//publishing image download
data.value = data.value + 1;
if (data.value < 100) {
publishProgress(data);
}
String image_name = mapping_planogram_masterGetterSetter.getPLANOGRAM_IMAGE().get(i);
String path = mapping_planogram_masterGetterSetter.getIMAGE_PATH().get(i);
if (!image_name.equalsIgnoreCase("NA") && !image_name.equalsIgnoreCase("")) {
URL url = new URL(path + "/" + image_name);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.getResponseCode();
c.connect();
if (c.getResponseCode() == 200) {
int length = c.getContentLength();
String size = new DecimalFormat("##.##").format((double) length / 1024) + " KB";
//String PATH = Environment.getExternalStorageDirectory() + "/Download/GT_GSK_Images/";
String PATH = CommonString.FILE_PATH;
File file = new File(PATH);
if (!file.isDirectory()) {
file.mkdir();
}
// Environment.getExternalStorageDirectory() + "/GT_GSK_Images/" + _pathforcheck1;
if (!new File(PATH + image_name).exists() && !size.equalsIgnoreCase("0 KB")) {
File outputFile = new File(file, image_name);
FileOutputStream fos = new FileOutputStream(outputFile);
InputStream is1 = c.getInputStream();
int bytes = 0;
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is1.read(buffer)) != -1) {
bytes = (bytes + len1);
// data.value = (int) ((double) (((double)
// bytes) / length) * 100);
fos.write(buffer, 0, len1);
}
fos.close();
is1.close();
}
}
}
}
}
//Gagan end code //Gagan end code
@@ -605,6 +752,9 @@ public class DownloadActivity extends AppCompatActivity {
db.insertNonWorkingData(nonWorkingReasonGetterSetter); db.insertNonWorkingData(nonWorkingReasonGetterSetter);
db.InsertSTORE_PERFORMANCE(store_performance_masterGetterSetter);
db.InsertMAPPING_PLANOGRAM(mapping_planogram_masterGetterSetter);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
/*final AlertMessage message = new AlertMessage( /*final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this, CompleteDownloadActivity.this,
@@ -627,20 +777,8 @@ public class DownloadActivity extends AppCompatActivity {
showAlert(CommonString.MESSAGE_SOCKETEXCEPTION); showAlert(CommonString.MESSAGE_SOCKETEXCEPTION);
} }
}); });
} catch (Exception e) { } catch (XmlPullParserException e) {
/* final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this,
AlertMessage.MESSAGE_EXCEPTION, "download", e);*/
/* e.getMessage();
e.printStackTrace(); e.printStackTrace();
e.getCause();*/
runOnUiThread(new Runnable() {
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
}
});
} }
return ""; return "";
} }
@@ -681,4 +819,39 @@ public class DownloadActivity extends AppCompatActivity {
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
} }
@@ -0,0 +1,18 @@
package cpm.com.gskmtorange.fonts;
import android.content.Context;
import android.graphics.Typeface;
/**
* Created by yadavendras on 11-01-2017.
*/
public class FontManager {
public static final String ROOT = "fonts/",
FONTAWESOME = ROOT + "fontawesome-webfont.ttf";
public static Typeface getTypeface(Context context, String font) {
return Typeface.createFromAsset(context.getAssets(), font);
}
}
@@ -0,0 +1,52 @@
package cpm.com.gskmtorange.fonts;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
/**
* Created by yadavendras on 11-01-2017.
*/
public class TextDrawable extends Drawable {
private final String text;
private final Paint paint;
public TextDrawable(String text) {
this.text = text;
this.paint = new Paint();
paint.setColor(Color.WHITE);
paint.setTextSize(22f);
paint.setAntiAlias(true);
paint.setFakeBoldText(true);
paint.setShadowLayer(6f, 0, 0, Color.BLACK);
paint.setStyle(Paint.Style.FILL);
paint.setTextAlign(Paint.Align.LEFT);
}
@Override
public void draw(Canvas canvas) {
canvas.drawText(text, 0, 0, paint);
}
@Override
public void setAlpha(int alpha) {
paint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
paint.setColorFilter(cf);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
}
@@ -0,0 +1,242 @@
package cpm.com.gskmtorange.fragment;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link SelectLanguageFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link SelectLanguageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SelectLanguageFragment extends Fragment implements View.OnClickListener{
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
private SharedPreferences preferences = null;
private SharedPreferences.Editor editor = null;
Button btn_lang_1, btn_lang_2;
ArrayList<String> language, culture_id;
LoginGetterSetter login_data;
public SelectLanguageFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment SelectLanguageFragment.
*/
// TODO: Rename and change types and number of parameters
public static SelectLanguageFragment newInstance(String param1, String param2) {
SelectLanguageFragment fragment = new SelectLanguageFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_select_language, container, false);
preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
editor = preferences.edit();
getDataFromSharedPreferences();
btn_lang_1 = (Button) view.findViewById(R.id.btn_language_one);
btn_lang_2 = (Button) view.findViewById(R.id.btn_language_two);
/* login_data = (LoginGetterSetter) getIntent().getSerializableExtra(CommonString.KEY_LOGIN_DATA);
language = login_data.getCULTURE_NAME();
culture_id = login_data.getCULTURE_ID();
*/
if (language.size() > 1) {
btn_lang_1.setText(language.get(0));
btn_lang_2.setText(language.get(1));
btn_lang_1.setOnClickListener(this);
btn_lang_2.setOnClickListener(this);
}
return view;
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(boolean selected_flag) {
if (mListener != null) {
mListener.onFragmentInteraction(selected_flag);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id) {
case R.id.btn_language_one:
//selected_flag = true;
onButtonPressed(true);
updateResources(getActivity(), language.get(0));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(0));
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(0));
editor.commit();
break;
case R.id.btn_language_two:
//selected_flag = true;
onButtonPressed(true);
updateResources(getActivity(), language.get(1));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
editor.putString(CommonString.KEY_LANGUAGE, language.get(1));
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(1));
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, login_data.getNOTICE_URL().get(1));
editor.commit();
break;
}
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(boolean flag);
}
private void getDataFromSharedPreferences(){
Gson gson = new Gson();
login_data = new LoginGetterSetter();
String jsonPreferences = preferences.getString(CommonString.KEY_LOOGIN_PREF, "");
Type type = new TypeToken<LoginGetterSetter>() {}.getType();
login_data = gson.fromJson(jsonPreferences, type);
language = login_data.getCULTURE_NAME();
culture_id = login_data.getCULTURE_ID();
//return ;
}
private static boolean updateResources(Context context, String language) {
String lang;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
} else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
}
@@ -0,0 +1,140 @@
package cpm.com.gskmtorange.fragment;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
/**
* A placeholder fragment containing a simple view.
*/
public class SettingsActivityFragment extends Fragment {
ArrayList<SettingsGetterSetter> settingsList;
public SettingsActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings, container, false);
RecyclerView rec = (RecyclerView) view.findViewById(R.id.rec_settings);
SettingsGetterSetter settings = new SettingsGetterSetter();
settings.setName(getString(R.string.select_language_item));
settings.setIcon(R.mipmap.entry_grey);
SelectLanguageFragment selectLanguageFragment = new SelectLanguageFragment();
settings.setFragment(selectLanguageFragment);
settingsList = new ArrayList<>();
settingsList.add(settings);
rec.setLayoutManager(new LinearLayoutManager(getActivity()));
SettingsAdapter settingsAdapter = new SettingsAdapter();
rec.setAdapter(settingsAdapter);
return view;
}
class SettingsAdapter extends RecyclerView.Adapter<SettingsAdapter.ViewHolder>{
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.settings_item_layout, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final SettingsGetterSetter mItem = settingsList.get(position);
holder.tv_settings.setText(mItem.getName());
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Fragment nextFrag= mItem.getFragment();
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment, nextFrag,"Settings")
.addToBackStack(null)
.commit();
}
});
}
@Override
public int getItemCount() {
return settingsList.size();
}
class ViewHolder extends RecyclerView.ViewHolder{
public CardView cardView;
public TextView tv_settings;
public ViewHolder(View itemView) {
super(itemView);
cardView = (CardView) itemView.findViewById(R.id.card_layout);
tv_settings = (TextView) itemView.findViewById(R.id.tv_settings);
}
}
}
class SettingsGetterSetter{
String name;
int icon;
Fragment fragment;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIcon() {
return icon;
}
public void setIcon(int icon) {
this.icon = icon;
}
public Fragment getFragment() {
return fragment;
}
public void setFragment(Fragment fragment) {
this.fragment = fragment;
}
}
}
@@ -3,6 +3,8 @@ 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.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@@ -23,6 +25,7 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
@@ -37,9 +40,8 @@ public class CategoryListActivity extends AppCompatActivity {
CategoryListAdapter adapter; CategoryListAdapter adapter;
GSKOrangeDB db; GSKOrangeDB db;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -52,6 +54,9 @@ public class CategoryListActivity extends AppCompatActivity {
db.open(); db.open();
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -83,20 +88,90 @@ public class CategoryListActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>(); categoryList = new ArrayList<>();
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id); categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id);
if(categoryList.size()>0){
for(int i=0;i<categoryList.size();i++){
boolean flag_filled = false;
String category_id = categoryList.get(i).getCategory_id();
if (db.checkMsl_AvailabilityData(store_id, category_id)
&& db.checkStockAndFacingData(store_id, category_id)
&& db.checkPromoComplianceData(store_id, category_id)
&& db.isFilledT2P(store_id, category_id)
&& db.additionalVisibilitydata(store_id, category_id)) {
flag_filled =true;
}
if(flag_filled){
if (category_id.equals("1")){
categoryList.get(i).setCategory_img(R.mipmap.nutritionals_tick);
}
else if (category_id.equals("2")){
categoryList.get(i).setCategory_img(R.mipmap.oralcare_tick);
}else if (category_id.equals("3")){
categoryList.get(i).setCategory_img(R.mipmap.wellness_tick);
}
}
else {
if (category_id.equals("1")){
categoryList.get(i).setCategory_img(R.mipmap.nutritionals);
}
else if (category_id.equals("2")){
categoryList.get(i).setCategory_img(R.mipmap.oral_care);
}else if (category_id.equals("3")){
categoryList.get(i).setCategory_img(R.mipmap.wellness);
}
}
}
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList); adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2)); recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
updateStatus();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
} }
public class CategoryListAdapter extends RecyclerView.Adapter<CategoryListAdapter.MyViewHolder> { public class CategoryListAdapter extends RecyclerView.Adapter<CategoryListAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<CategoryGetterSetter> list = Collections.emptyList(); List<CategoryGetterSetter> list = Collections.emptyList();
Context context; Context context;
private LayoutInflater inflator;
public CategoryListAdapter(CategoryListActivity context, List<CategoryGetterSetter> list) { public CategoryListAdapter(CategoryListActivity context, List<CategoryGetterSetter> list) {
inflator = LayoutInflater.from(context); inflator = LayoutInflater.from(context);
@@ -116,39 +191,8 @@ public class CategoryListActivity extends AppCompatActivity {
final CategoryGetterSetter categoryData = list.get(position); final CategoryGetterSetter categoryData = list.get(position);
holder.categoryName.setText(categoryData.getCategory()); holder.categoryName.setText(categoryData.getCategory());
//holder.categoryIcon.setImageResource(R.drawable.category);
if (categoryData.getCategory().equalsIgnoreCase("Oral Health")) {
if (db.checkMsl_AvailabilityData(store_id, categoryData.getCategory_id())
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.ohc_done);
} else {
holder.categoryIcon.setImageResource(R.drawable.ohc);
}
} else if (categoryData.getCategory().equalsIgnoreCase("Wellness")) {
if (db.checkMsl_AvailabilityData(store_id, categoryData.getCategory_id())
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.pdr_done);
} else {
holder.categoryIcon.setImageResource(R.drawable.pdr);
}
} else if (categoryData.getCategory().equalsIgnoreCase("Nutritionals")) {
if (db.checkMsl_AvailabilityData(store_id, categoryData.getCategory_id())
&& db.checkStockAndFacingData(store_id, categoryData.getCategory_id())
&& db.checkPromoComplianceData(store_id, categoryData.getCategory_id())) {
holder.categoryIcon.setImageResource(R.drawable.hfd_done);
} else {
holder.categoryIcon.setImageResource(R.drawable.hfd);
}
}
holder.categoryIcon.setImageResource(categoryData.getCategory_img());
holder.lay_menu.setOnClickListener(new View.OnClickListener() { holder.lay_menu.setOnClickListener(new View.OnClickListener() {
@Override @Override
@@ -180,29 +224,58 @@ public class CategoryListActivity extends AppCompatActivity {
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) { private static boolean updateResources(Context context, String language) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu); String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true; return true;
} }
@Override public void updateStatus() {
public boolean onOptionsItemSelected(MenuItem item) { //Update Checkout Status
// Handle action bar item clicks here. The action bar will boolean flag_filled = false;
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) { for (int i = 0; i < categoryList.size(); i++) {
finish(); String category_id = categoryList.get(i).getCategory_id();
if (db.checkMsl_AvailabilityData(store_id, category_id)
&& db.checkStockAndFacingData(store_id, category_id)
&& db.checkPromoComplianceData(store_id, category_id)
&& db.isFilledT2P(store_id, category_id)
&& db.additionalVisibilitydata(store_id, category_id)) {
flag_filled = true;
} else {
flag_filled = false;
break;
}
} }
//noinspection SimplifiableIfStatement if (flag_filled) {
if (id == R.id.action_settings) { db.updateCheckoutStatus(store_id, CommonString.KEY_VALID);
return true; }
} }
return super.onOptionsItemSelected(item);
}
} }
@@ -2,7 +2,11 @@ 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.content.res.Configuration;
import android.content.res.Resources;
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.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@@ -18,29 +22,52 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
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.CategoryWisePerformaceGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
public class CategoryWisePerformanceActivity extends AppCompatActivity { public class CategoryWisePerformanceActivity extends AppCompatActivity {
TextView txt_categoryName;
RecyclerView recyclerView; RecyclerView recyclerView;
Toolbar toolbar;
String categoryName = "", categoryId; String categoryName = "", categoryId;
ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList; ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList;
CategoryWisePerformaceAdapter adapter; CategoryWisePerformaceAdapter adapter;
GSKOrangeDB db;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_category_wise_performance); setContentView(R.layout.activity_category_wise_performance);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
//txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
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");
@@ -60,86 +87,50 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
startActivity(intent); startActivity(intent);
} }
}); });
} catch (Resources.NotFoundException e) {
e.printStackTrace();
}
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
try {
categoryWisePerformanceList = new ArrayList<>(); updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
CategoryWisePerformaceGetterSetter data = new CategoryWisePerformaceGetterSetter(); categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId);
data.setPeriod("Period");
data.setSos("SOS");
data.setT2p("T2P");
data.setPromo("Promo");
data.setMsl_availability("MSL Availability");
data.setOss("OSS");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("LTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("MTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("RTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("LTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("MTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("RTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList); adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
} }
public class CategoryWisePerformaceAdapter extends RecyclerView.Adapter<CategoryWisePerformaceAdapter.MyViewHolder> { public class CategoryWisePerformaceAdapter extends RecyclerView.Adapter<CategoryWisePerformaceAdapter.MyViewHolder> {
Context context; Context context;
private LayoutInflater inflator;
List<CategoryWisePerformaceGetterSetter> list = Collections.emptyList(); List<CategoryWisePerformaceGetterSetter> list = Collections.emptyList();
private LayoutInflater inflator;
public CategoryWisePerformaceAdapter(Context context, List<CategoryWisePerformaceGetterSetter> list) { public CategoryWisePerformaceAdapter(Context context, List<CategoryWisePerformaceGetterSetter> list) {
inflator = LayoutInflater.from(context); inflator = LayoutInflater.from(context);
@@ -158,11 +149,18 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
public void onBindViewHolder(CategoryWisePerformaceAdapter.MyViewHolder holder, int position) { public void onBindViewHolder(CategoryWisePerformaceAdapter.MyViewHolder holder, int position) {
final CategoryWisePerformaceGetterSetter categoryData = list.get(position); final CategoryWisePerformaceGetterSetter categoryData = list.get(position);
holder.txt_period.setText(categoryData.getPeriod()); if (categoryData.getPeriod().equalsIgnoreCase("LTM")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_ltm));
} else if (categoryData.getPeriod().equalsIgnoreCase("MTD")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_mtd));
} else if (categoryData.getPeriod().equalsIgnoreCase("LSV")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_lsv));
}
//holder.txt_period.setText(categoryData.getPeriod());
holder.txt_msl_availability.setText(categoryData.getMsl_availability());
holder.txt_sos.setText(categoryData.getSos()); holder.txt_sos.setText(categoryData.getSos());
holder.txt_t2p.setText(categoryData.getT2p()); holder.txt_t2p.setText(categoryData.getT2p());
holder.txt_promo.setText(categoryData.getPromo()); holder.txt_promo.setText(categoryData.getPromo());
holder.txt_msl_availability.setText(categoryData.getMsl_availability());
holder.txt_oss.setText(categoryData.getOss()); holder.txt_oss.setText(categoryData.getOss());
} }
@@ -186,25 +184,33 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
txt_oss = (TextView) itemView.findViewById(R.id.txt_oss); txt_oss = (TextView) itemView.findViewById(R.id.txt_oss);
} }
} }
} }
@Override private static boolean updateResources(Context context, String language) {
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) { String lang ;
finish();
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
} }
//noinspection SimplifiableIfStatement Locale locale = new Locale(lang);
if (id == R.id.action_settings) { Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true; return true;
} }
return super.onOptionsItemSelected(item);
}
} }
@@ -3,6 +3,7 @@ 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.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@@ -22,6 +23,7 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
@@ -38,9 +40,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
GSKOrangeDB db; GSKOrangeDB db;
String categoryName = "", categoryId; String categoryName = "", categoryId;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -58,6 +59,9 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -94,6 +98,8 @@ public class DailyDataMenuActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
try { try {
categoryList = new ArrayList<>(); categoryList = new ArrayList<>();
@@ -111,17 +117,24 @@ public class DailyDataMenuActivity extends AppCompatActivity {
//data.setCategory_name("Stock & Facing"); //data.setCategory_name("Stock & Facing");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing)); data.setCategory_name(getResources().getString(R.string.daily_data_menu_stock_facing));
if (db.checkStockAndFacingData(store_id, categoryId)) { if (db.checkStockAndFacingData(store_id, categoryId)) {
data.setCategory_img(R.mipmap.stock_and_facing_done); data.setCategory_img(R.mipmap.stock_facing_done);
} else { } else {
data.setCategory_img(R.mipmap.stock_and_facing); data.setCategory_img(R.mipmap.stock_facing);
} }
categoryList.add(data); categoryList.add(data);
//T2p
data = new DailyDataMenuGetterSetter(); data = new DailyDataMenuGetterSetter();
//data.setCategory_name("T2P Compliance");
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p)); data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
if (db.isFilledT2P(store_id, categoryId)) {
data.setCategory_img(R.mipmap.t2p_compliance_done);
} else {
data.setCategory_img(R.mipmap.t2p_compliance); data.setCategory_img(R.mipmap.t2p_compliance);
}
categoryList.add(data); categoryList.add(data);
//T2p added
data = new DailyDataMenuGetterSetter(); data = new DailyDataMenuGetterSetter();
//data.setCategory_name("Additional Visibility"); //data.setCategory_name("Additional Visibility");
@@ -165,10 +178,36 @@ public class DailyDataMenuActivity extends AppCompatActivity {
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public class DailyDataMenuAdapter extends RecyclerView.Adapter<DailyDataMenuAdapter.MyViewHolder> { public class DailyDataMenuAdapter extends RecyclerView.Adapter<DailyDataMenuAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<DailyDataMenuGetterSetter> list = Collections.emptyList(); List<DailyDataMenuGetterSetter> list = Collections.emptyList();
Context context; Context context;
private LayoutInflater inflator;
public DailyDataMenuAdapter(Context context, List<DailyDataMenuGetterSetter> list) { public DailyDataMenuAdapter(Context context, List<DailyDataMenuGetterSetter> list) {
inflator = LayoutInflater.from(context); inflator = LayoutInflater.from(context);
@@ -250,30 +289,32 @@ public class DailyDataMenuActivity extends AppCompatActivity {
} }
} }
@Override private static boolean updateResources(Context context, String language) {
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present. String lang ;
getMenuInflater().inflate(R.menu.main, menu);
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true; return true;
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
} }
@@ -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.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
@@ -34,6 +35,7 @@ import android.widget.ToggleButton;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
@@ -54,9 +56,8 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
GSKOrangeDB db; GSKOrangeDB db;
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; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -72,6 +73,8 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -102,18 +105,18 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
//if (validateData(listDataHeader, listDataChild)) { //if (validateData(listDataHeader, listDataChild)) {
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this); AlertDialog.Builder builder = new AlertDialog.Builder(MSL_AvailabilityActivity.this);
builder.setMessage("Are you sure you want to save") builder.setMessage(getResources().getString(R.string.check_save_message))
.setCancelable(false) .setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() { .setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
db.open(); db.open();
if (db.checkMsl_AvailabilityData(store_id, categoryId)) { if (db.checkMsl_AvailabilityData(store_id, categoryId)) {
db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData); db.updateMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, "Data has been updated", Snackbar.LENGTH_LONG).setAction("Action", null).show(); Snackbar.make(view, getResources().getString(R.string.update_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else { } else {
db.InsertMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData); db.InsertMSL_Availability(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, "Data has been saved", Snackbar.LENGTH_LONG).setAction("Action", null).show(); Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
} }
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show(); //Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
@@ -121,7 +124,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out); overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
} }
}) })
.setNegativeButton("No", new DialogInterface.OnClickListener() { .setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
dialog.cancel(); dialog.cancel();
} }
@@ -217,6 +220,13 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
} catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
}
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
private void prepareList() { private void prepareList() {
@@ -248,6 +258,63 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
} }
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(MSL_AvailabilityActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
//finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
//super.onBackPressed();
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(MSL_AvailabilityActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
}
public class ExpandableListAdapter extends BaseExpandableListAdapter { public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context; private Context _context;
private List<MSL_AvailabilityGetterSetter> _listDataHeader; private List<MSL_AvailabilityGetterSetter> _listDataHeader;
@@ -289,6 +356,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
ImageView img_camera = (ImageView) convertView.findViewById(R.id.img_camera); ImageView img_camera = (ImageView) convertView.findViewById(R.id.img_camera);
txt_categoryHeader.setTypeface(null, Typeface.BOLD); txt_categoryHeader.setTypeface(null, Typeface.BOLD);
txt_categoryHeader.setTextColor(getResources().getColor(R.color.colorPrimary));
txt_categoryHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand()); txt_categoryHeader.setText(headerTitle.getSub_category() + "-" + headerTitle.getBrand());
/*img_camera.setOnClickListener(new View.OnClickListener() { /*img_camera.setOnClickListener(new View.OnClickListener() {
@@ -362,14 +430,15 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
holder.txt_mbq = (TextView) convertView.findViewById(R.id.txt_mbq); holder.txt_mbq = (TextView) convertView.findViewById(R.id.txt_mbq);
holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available); holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available);
holder.toggle_available.setTextOff("No"); /*holder.toggle_available.setTextOff("No");
holder.toggle_available.setTextOn("Yes"); holder.toggle_available.setTextOn("Yes");*/
convertView.setTag(holder); convertView.setTag(holder);
} else { } else {
holder = (ViewHolder) convertView.getTag(); holder = (ViewHolder) convertView.getTag();
} }
holder.txt_skuName.setTextColor(getResources().getColor(R.color.colorPrimary));
holder.txt_skuName.setText(childData.getSku()); holder.txt_skuName.setText(childData.getSku());
holder.txt_mbq.setText(childData.getMbq()); holder.txt_mbq.setText(childData.getMbq());
@@ -419,22 +488,32 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
LinearLayout lin_category; LinearLayout lin_category;
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) { private static boolean updateResources(Context context, String language) {
finish();
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
} }
//noinspection SimplifiableIfStatement Locale locale = new Locale(lang);
if (id == R.id.action_settings) { Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true; return true;
} }
return super.onOptionsItemSelected(item);
}
} }
@@ -1,8 +1,11 @@
package cpm.com.gskmtorange.gsk_dailyentry; package cpm.com.gskmtorange.gsk_dailyentry;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@@ -22,6 +25,7 @@ import android.widget.TextView;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
@@ -41,9 +45,35 @@ public class PromoComplianceActivity extends AppCompatActivity {
GSKOrangeDB db; GSKOrangeDB db;
String categoryName, categoryId; String categoryName, categoryId;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -71,6 +101,8 @@ public class PromoComplianceActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -258,6 +290,13 @@ public class PromoComplianceActivity extends AppCompatActivity {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
@Override
protected void onResume() {
super.onResume();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
private void prepareList() { private void prepareList() {
@@ -411,7 +450,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present. // Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu); //getMenuInflater().inflate(R.menu.main, menu);
return true; return true;
} }
@@ -423,8 +462,24 @@ public class PromoComplianceActivity extends AppCompatActivity {
int id = item.getItemId(); int id = item.getItemId();
if (id == android.R.id.home) { if (id == android.R.id.home) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(PromoComplianceActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish(); finish();
} }
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
//finish();
}
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (id == R.id.action_settings) { if (id == R.id.action_settings) {
@@ -433,4 +488,26 @@ public class PromoComplianceActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
public void onBackPressed() {
//super.onBackPressed();
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(PromoComplianceActivity.this);
builder.setTitle(getResources().getString(R.string.dialog_title));
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
}
} }
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,209 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.StoreWisePerformaceGetterSetter;
public class StoreWisePerformanceActivity extends AppCompatActivity {
RecyclerView recyclerView;
Toolbar toolbar;
ArrayList<StoreWisePerformaceGetterSetter> storeWisePerformanceList;
StoreWisePerformaceAdapter adapter;
GSKOrangeDB db;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
private SharedPreferences preferences;
private static boolean updateResources(Context context, String language) {
String lang ;
if(language.equalsIgnoreCase("English")){
lang = "EN";
}
else if(language.equalsIgnoreCase("UAE")) {
lang = "AR";
}
else {
lang = "TR";
}
Locale locale = new Locale(lang);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_store_wise_performance);
toolbar = (Toolbar) findViewById(R.id.toolbar);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
db = new GSKOrangeDB(this);
db.open();
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
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, "");
toolbar.setTitle(getResources().getString(R.string.title_activity_store_wise_performance));
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(StoreWisePerformanceActivity.this, CategoryListActivity.class);
startActivity(intent);
}
});
} catch (Resources.NotFoundException e) {
e.printStackTrace();
}
}
@Override
protected void onResume() {
super.onResume();
try {
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
storeWisePerformanceList = db.getStoreWisePerformance(store_id);
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public class StoreWisePerformaceAdapter extends RecyclerView.Adapter<StoreWisePerformaceAdapter.MyViewHolder> {
Context context;
List<StoreWisePerformaceGetterSetter> list = Collections.emptyList();
private LayoutInflater inflator;
public StoreWisePerformaceAdapter(Context context, List<StoreWisePerformaceGetterSetter> list) {
inflator = LayoutInflater.from(context);
this.list = list;
this.context = context;
}
@Override
public StoreWisePerformaceAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.item_store_wise_performance, parent, false);
StoreWisePerformaceAdapter.MyViewHolder holder = new StoreWisePerformaceAdapter.MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(StoreWisePerformaceAdapter.MyViewHolder holder, int position) {
final StoreWisePerformaceGetterSetter categoryData = list.get(position);
if (categoryData.getPeriod().equalsIgnoreCase("LTM")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_ltm));
} else if (categoryData.getPeriod().equalsIgnoreCase("MTD")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_mtd));
} else if (categoryData.getPeriod().equalsIgnoreCase("LSV")) {
holder.txt_period.setText(getResources().getString(R.string.category_performance_lsv));
}
holder.txt_msl_availability.setText(categoryData.getMsl_availability());
holder.txt_sos.setText(categoryData.getSos());
holder.txt_t2p.setText(categoryData.getT2p());
holder.txt_promo.setText(categoryData.getPromo());
holder.txt_oss.setText(categoryData.getOss());
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView txt_period, txt_sos, txt_t2p, txt_promo, txt_msl_availability, txt_oss;
LinearLayout lay_menu;
public MyViewHolder(View itemView) {
super(itemView);
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
txt_period = (TextView) itemView.findViewById(R.id.txt_period);
txt_sos = (TextView) itemView.findViewById(R.id.txt_sos);
txt_t2p = (TextView) itemView.findViewById(R.id.txt_t2p);
txt_promo = (TextView) itemView.findViewById(R.id.txt_promo);
txt_msl_availability = (TextView) itemView.findViewById(R.id.txt_msl_availability);
txt_oss = (TextView) itemView.findViewById(R.id.txt_oss);
}
}
}
}
@@ -3,6 +3,8 @@ package cpm.com.gskmtorange.upload;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.AsyncTask; import android.os.AsyncTask;
@@ -26,6 +28,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
@@ -38,38 +41,38 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler; import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class UploadActivity extends AppCompatActivity { public class UploadActivity extends AppCompatActivity {
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
GSKOrangeDB db; GSKOrangeDB db;
ArrayList<CoverageBean> coverageList; ArrayList<CoverageBean> coverageList;
private FailureGetterSetter failureGetterSetter = null;
private SharedPreferences preferences;
String date, userId, app_version; String date, userId, app_version;
StoreBean storeData; StoreBean storeData;
String datacheck = ""; String datacheck = "";
String[] words; String[] words;
String validity; String validity;
int mid; int mid;
private int factor, k = 0;
String errormsg = "", Path; String errormsg = "", Path;
Data data; Data data;
ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList; ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList;
ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList; ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList;
ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList; ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList;
ArrayList<T2PGetterSetter> t2PGetterSetters;
ArrayList<AddittionalGetterSetter> additionalVisibilityList; ArrayList<AddittionalGetterSetter> additionalVisibilityList;
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList; ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private FailureGetterSetter failureGetterSetter = null;
private SharedPreferences preferences;
private int factor, k = 0;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -79,6 +82,9 @@ public class UploadActivity extends AppCompatActivity {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
app_version = preferences.getString(CommonString.KEY_VERSION, null); app_version = preferences.getString(CommonString.KEY_VERSION, null);
@@ -92,6 +98,85 @@ public class UploadActivity extends AppCompatActivity {
new UploadTask(this).execute(); new UploadTask(this).execute();
} }
public String UploadImage(String path, String folder_name) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Path + path, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 1639;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
String[] split = path.split("/");
String path1 = split[split.length - 1];
request.addProperty("img", ba1);
request.addProperty("name", path1);
request.addProperty("FolderName", folder_name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
Object result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
}
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}
} else {
new File(Path + path).delete();
}
return result.toString();
}
class Data { class Data {
int value; int value;
String name; String name;
@@ -180,7 +265,7 @@ public class UploadActivity extends AppCompatActivity {
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL); HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE, envelope);
Object result = (Object) envelope.getResponse(); Object result = envelope.getResponse();
datacheck = result.toString(); datacheck = result.toString();
words = datacheck.split("\\;"); words = datacheck.split("\\;");
@@ -212,6 +297,7 @@ public class UploadActivity extends AppCompatActivity {
+ "[CATEGORY_ID]" + Integer.parseInt(msl_availabilityList.get(j).getCategory_id()) + "[/CATEGORY_ID]" + "[CATEGORY_ID]" + Integer.parseInt(msl_availabilityList.get(j).getCategory_id()) + "[/CATEGORY_ID]"
+ "[BRAND_ID]" + Integer.parseInt(msl_availabilityList.get(j).getBrand_id()) + "[/BRAND_ID]" + "[BRAND_ID]" + Integer.parseInt(msl_availabilityList.get(j).getBrand_id()) + "[/BRAND_ID]"
+ "[SKU_ID]" + Integer.parseInt(msl_availabilityList.get(j).getSku_id()) + "[/SKU_ID]" + "[SKU_ID]" + Integer.parseInt(msl_availabilityList.get(j).getSku_id()) + "[/SKU_ID]"
+ "[MBQ]" + Integer.parseInt(msl_availabilityList.get(j).getMbq()) + "[/MBQ]"
//+ "[SKU]" + msl_availabilityList.get(j).getSku() + "[/SKU]" //+ "[SKU]" + msl_availabilityList.get(j).getSku() + "[/SKU]"
+ "[TOGGLE_VALUE]" + Integer.parseInt(msl_availabilityList.get(j).getToggleValue()) + "[/TOGGLE_VALUE]" + "[TOGGLE_VALUE]" + Integer.parseInt(msl_availabilityList.get(j).getToggleValue()) + "[/TOGGLE_VALUE]"
+ "[/MSL_AVAILABILITY_DATA]"; + "[/MSL_AVAILABILITY_DATA]";
@@ -235,7 +321,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -304,7 +390,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -363,7 +449,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -422,7 +508,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -440,6 +526,7 @@ public class UploadActivity extends AppCompatActivity {
data.name = "Additional Promotion Data Uploading"; data.name = "Additional Promotion Data Uploading";
publishProgress(data); publishProgress(data);
////ashish open ////ashish open
//Additional Visibility Data //Additional Visibility Data
@@ -535,7 +622,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -549,17 +636,154 @@ public class UploadActivity extends AppCompatActivity {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA; return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
} }
} }
data.value = 35; data.value = 35;
data.name = "Additional Visibility Data"; data.name = "Additional Visibility Data";
publishProgress(data); publishProgress(data);
/////ashish close /////ashish close
//T2p Upload Data
String t2p_data_xml = "";
onXML = "";
t2PGetterSetters = db.getT2pComplianceData(coverageList.get(i).getStoreId(), null);
if (t2PGetterSetters.size() > 0) {
for (int i1 = 0; i1 < t2PGetterSetters.size(); i1++) {
ArrayList<GapsChecklistGetterSetter> gapsList = db.getGapsData(t2PGetterSetters.get(i).getKey_id());
ArrayList<SkuGetterSetter> skuList = db.getT2PSKUData(t2PGetterSetters.get(i).getKey_id());
String gaps_xml = "";
String gaps_child;
for (int l = 0; l < gapsList.size(); l++) {
String present = "";
if (gapsList.get(l).isPresent()) {
present = "1";
} else {
present = "0";
}
gaps_child = "[GAPS]"
+ "[MID]" + mid + "[/MID]"
+ "[USER_ID]" + userId + "[/USER_ID]"
+ "[CHECK_LIST_ID]"
+ gapsList.get(l).getChecklist_id()
+ "[/CHECK_LIST_ID]"
+ "[DISPLAY_ID]"
+ gapsList.get(l).getDisplay_id()
+ "[/DISPLAY_ID]"
+ "[PRESENT]"
+ present
+ "[/PRESENT]"
+ "[COMMON_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getKey_id())
+ "[/COMMON_ID]"
+ "[/GAPS]";
gaps_xml = gaps_xml + gaps_child;
}
String sku_xml = "";
String sku_child;
for (int k = 0; k < skuList.size(); k++) {
sku_child = "[SKU]"
+ "[MID]" + mid + "[/MID]"
+ "[USER_ID]" + userId + "[/USER_ID]"
+ "[SKU_ID]"
+ skuList.get(k).getSKU_ID()
+ "[/SKU_ID]"
+ "[BRAND_ID]"
+ skuList.get(k).getBRAND_ID()
+ "[/BRAND_ID]"
+ "[STOCK]"
+ skuList.get(k).getSTOCK()
+ "[/STOCK]"
+ "[COMMON_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getKey_id())
+ "[/COMMON_ID]"
+ "[/SKU]";
sku_xml = sku_xml + sku_child;
}
String present = "";
if (t2PGetterSetters.get(i1).isPresent()) {
present = "1";
} else {
present = "0";
}
onXML = "[T2P_DATA]"
+ "[MID]" + mid + "[/MID]"
+ "[USER_ID]" + userId + "[/USER_ID]"
+ "[CATEGORY_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getCategory_id())
+ "[/CATEGORY_ID]"
+ "[BRAND_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getBrand_id())
+ "[/BRAND_ID]"
+ "[DISPLAY_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getDisplay_id())
+ "[/DISPLAY_ID]"
+ "[COMMON_ID]"
+ Integer.parseInt(t2PGetterSetters.get(i1).getKey_id())
+ "[/COMMON_ID]"
+ "[IMAGE]"
+ t2PGetterSetters.get(i1).getImage()
+ "[/IMAGE]"
+ "[PRESENT]"
+ present
+ "[/PRESENT]"
+ "[GAPS_DATA]"
+ gaps_xml
+ "[/GAPS_DATA]"
+ "[SKU_DATA]"
+ sku_xml
+ "[/SKU_DATA]"
+ "[/T2P_DATA]";
t2p_data_xml = t2p_data_xml + onXML;
}
final String t2p_final_xml = "[DATA]" + t2p_data_xml + "[/DATA]";
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
request.addProperty("XMLDATA", t2p_final_xml);
request.addProperty("KEYS", "T2P_DATA");
request.addProperty("USERNAME", userId);
request.addProperty("MID", mid);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
}
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
}
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
}
}
data.value = 40;
data.name = "T2P Data Uploading";
publishProgress(data);
//Image Upload //Image Upload
@@ -641,6 +865,31 @@ public class UploadActivity extends AppCompatActivity {
for(int m=0;m<t2PGetterSetters.size();m++){
if (t2PGetterSetters.get(m).getImage() != null && !t2PGetterSetters.get(m).getImage().equals("")) {
if (new File(CommonString.FILE_PATH + t2PGetterSetters.get(m).getImage()).exists()) {
try {
result = UploadImage(t2PGetterSetters.get(m).getImage(), "T2PImages");
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return "T2PImages";
}
runOnUiThread(new Runnable() {
public void run() {
message.setText("T2P Images Uploaded");
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
// SET COVERAGE STATUS // SET COVERAGE STATUS
String final_xml = ""; String final_xml = "";
onXML = ""; onXML = "";
@@ -665,7 +914,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope); androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope);
result = (Object) envelope.getResponse(); result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS; return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
@@ -709,82 +958,39 @@ public class UploadActivity extends AppCompatActivity {
} }
} }
public String UploadImage(String path, String folder_name) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Path + path, o);
// The new size we want to scale to @Override
final int REQUIRED_SIZE = 1639; protected void onResume() {
super.onResume();
// Find the correct scale value. It should be the power of 2. updateResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
} }
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream(); private static boolean updateResources(Context context, String language) {
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE); String lang ;
String[] split = path.split("/"); if(language.equalsIgnoreCase("English")){
String path1 = split[split.length - 1]; lang = "EN";
}
request.addProperty("img", ba1); else if(language.equalsIgnoreCase("UAE")) {
request.addProperty("name", path1); lang = "AR";
request.addProperty("FolderName", folder_name); }
else {
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); lang = "TR";
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
Object result = (Object) envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
} }
SAXParserFactory saxPF = SAXParserFactory.newInstance(); Locale locale = new Locale(lang);
SAXParser saxP = saxPF.newSAXParser(); Locale.setDefault(locale);
XMLReader xmlR = saxP.getXMLReader();
// for failure Resources resources = context.getResources();
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource(); Configuration configuration = resources.getConfiguration();
is.setCharacterStream(new StringReader(result.toString())); configuration.locale = locale;
xmlR.parse(is);
failureGetterSetter = failureXMLHandler.getFailureGetterSetter(); resources.updateConfiguration(configuration, resources.getDisplayMetrics());
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) { return true;
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}
} else {
new File(Path + path).delete();
} }
return result.toString();
}
} }
@@ -6,7 +6,9 @@ package cpm.com.gskmtorange.xmlGetterSetter;
public class CategoryGetterSetter { public class CategoryGetterSetter {
String category_id, category, category_img; String category_id, category;
int category_img;
public String getCategory_id() { public String getCategory_id() {
return category_id; return category_id;
@@ -24,11 +26,12 @@ public class CategoryGetterSetter {
this.category = category; this.category = category;
} }
public String getCategory_img() {
public int getCategory_img() {
return category_img; return category_img;
} }
public void setCategory_img(String category_img) { public void setCategory_img(int category_img) {
this.category_img = category_img; this.category_img = category_img;
} }
} }
@@ -5,7 +5,23 @@ package cpm.com.gskmtorange.xmlGetterSetter;
*/ */
public class CategoryWisePerformaceGetterSetter { public class CategoryWisePerformaceGetterSetter {
String period, sos, t2p, promo, msl_availability, oss; String store_id, category_id, period, msl_availability, sos, t2p, promo, oss, order_id;
public String getStore_id() {
return store_id;
}
public void setStore_id(String store_id) {
this.store_id = store_id;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public String getPeriod() { public String getPeriod() {
return period; return period;
@@ -15,6 +31,14 @@ public class CategoryWisePerformaceGetterSetter {
this.period = period; this.period = period;
} }
public String getMsl_availability() {
return msl_availability;
}
public void setMsl_availability(String msl_availability) {
this.msl_availability = msl_availability;
}
public String getSos() { public String getSos() {
return sos; return sos;
} }
@@ -39,14 +63,6 @@ public class CategoryWisePerformaceGetterSetter {
this.promo = promo; this.promo = promo;
} }
public String getMsl_availability() {
return msl_availability;
}
public void setMsl_availability(String msl_availability) {
this.msl_availability = msl_availability;
}
public String getOss() { public String getOss() {
return oss; return oss;
} }
@@ -54,4 +70,12 @@ public class CategoryWisePerformaceGetterSetter {
public void setOss(String oss) { public void setOss(String oss) {
this.oss = oss; this.oss = oss;
} }
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
} }
@@ -0,0 +1,51 @@
package cpm.com.gskmtorange.xmlGetterSetter;
import java.util.ArrayList;
/**
* Created by gagang on 12-01-2017.
*/
public class MAPPING_PLANOGRAM_DataGetterSetter {
String KEYACCOUNT_ID, STORETYPE_ID, CLASS_ID, PLANOGRAM_IMAGE, IMAGE_PATH;
public String getKEYACCOUNT_ID() {
return KEYACCOUNT_ID;
}
public void setKEYACCOUNT_ID(String KEYACCOUNT_ID) {
this.KEYACCOUNT_ID = KEYACCOUNT_ID;
}
public String getSTORETYPE_ID() {
return STORETYPE_ID;
}
public void setSTORETYPE_ID(String STORETYPE_ID) {
this.STORETYPE_ID = STORETYPE_ID;
}
public String getCLASS_ID() {
return CLASS_ID;
}
public void setCLASS_ID(String CLASS_ID) {
this.CLASS_ID = CLASS_ID;
}
public String getPLANOGRAM_IMAGE() {
return PLANOGRAM_IMAGE;
}
public void setPLANOGRAM_IMAGE(String PLANOGRAM_IMAGE) {
this.PLANOGRAM_IMAGE = PLANOGRAM_IMAGE;
}
public String getIMAGE_PATH() {
return IMAGE_PATH;
}
public void setIMAGE_PATH(String IMAGE_PATH) {
this.IMAGE_PATH = IMAGE_PATH;
}
}
@@ -0,0 +1,65 @@
package cpm.com.gskmtorange.xmlGetterSetter;
import java.util.ArrayList;
/**
* Created by gagang on 12-01-2017.
*/
public class MAPPING_PLANOGRAM_MasterGetterSetter {
String table_MAPPING_PLANOGRAM;
ArrayList<String> KEYACCOUNT_ID = new ArrayList<>();
ArrayList<String> STORETYPE_ID = new ArrayList<>();
ArrayList<String> CLASS_ID = new ArrayList<>();
ArrayList<String> PLANOGRAM_IMAGE = new ArrayList<>();
ArrayList<String> IMAGE_PATH = new ArrayList<>();
public String getTable_MAPPING_PLANOGRAM() {
return table_MAPPING_PLANOGRAM;
}
public void setTable_MAPPING_PLANOGRAM(String table_MAPPING_PLANOGRAM) {
this.table_MAPPING_PLANOGRAM = table_MAPPING_PLANOGRAM;
}
public ArrayList<String> getKEYACCOUNT_ID() {
return KEYACCOUNT_ID;
}
public void setKEYACCOUNT_ID(String KEYACCOUNT_ID) {
this.KEYACCOUNT_ID.add(KEYACCOUNT_ID);
}
public ArrayList<String> getSTORETYPE_ID() {
return STORETYPE_ID;
}
public void setSTORETYPE_ID(String STORETYPE_ID) {
this.STORETYPE_ID.add(STORETYPE_ID);
}
public ArrayList<String> getCLASS_ID() {
return CLASS_ID;
}
public void setCLASS_ID(String CLASS_ID) {
this.CLASS_ID.add(CLASS_ID);
}
public ArrayList<String> getPLANOGRAM_IMAGE() {
return PLANOGRAM_IMAGE;
}
public void setPLANOGRAM_IMAGE(String PLANOGRAM_IMAGE) {
this.PLANOGRAM_IMAGE.add(PLANOGRAM_IMAGE);
}
public ArrayList<String> getIMAGE_PATH() {
return IMAGE_PATH;
}
public void setIMAGE_PATH(String IMAGE_PATH) {
this.IMAGE_PATH.add(IMAGE_PATH);
}
}
@@ -0,0 +1,101 @@
package cpm.com.gskmtorange.xmlGetterSetter;
import java.util.ArrayList;
/**
* Created by gagang on 11-01-2017.
*/
public class STORE_PERFORMANCE_MasterGetterSetter {
String table_STORE_PERFORMANCE;
ArrayList<String> STORE_ID = new ArrayList<>();
ArrayList<String> CATEGORY_ID = new ArrayList<>();
ArrayList<String> PERIOD = new ArrayList<>();
ArrayList<String> SOS = new ArrayList<>();
ArrayList<String> T2P = new ArrayList<>();
ArrayList<String> PROMO = new ArrayList<>();
ArrayList<String> MSL_AVAILABILITY = new ArrayList<>();
ArrayList<String> OSS = new ArrayList<>();
ArrayList<String> ORDERID = new ArrayList<>();
public String getTable_STORE_PERFORMANCE() {
return table_STORE_PERFORMANCE;
}
public void setTable_STORE_PERFORMANCE(String table_STORE_PERFORMANCE) {
this.table_STORE_PERFORMANCE = table_STORE_PERFORMANCE;
}
public ArrayList<String> getSTORE_ID() {
return STORE_ID;
}
public void setSTORE_ID(String STORE_ID) {
this.STORE_ID.add(STORE_ID);
}
public ArrayList<String> getCATEGORY_ID() {
return CATEGORY_ID;
}
public void setCATEGORY_ID(String CATEGORY_ID) {
this.CATEGORY_ID.add(CATEGORY_ID);
}
public ArrayList<String> getPERIOD() {
return PERIOD;
}
public void setPERIOD(String PERIOD) {
this.PERIOD.add(PERIOD);
}
public ArrayList<String> getSOS() {
return SOS;
}
public void setSOS(String SOS) {
this.SOS.add(SOS);
}
public ArrayList<String> getT2P() {
return T2P;
}
public void setT2P(String t2P) {
this.T2P.add(t2P);
}
public ArrayList<String> getPROMO() {
return PROMO;
}
public void setPROMO(String PROMO) {
this.PROMO.add(PROMO);
}
public ArrayList<String> getMSL_AVAILABILITY() {
return MSL_AVAILABILITY;
}
public void setMSL_AVAILABILITY(String MSL_AVAILABILITY) {
this.MSL_AVAILABILITY.add(MSL_AVAILABILITY);
}
public ArrayList<String> getOSS() {
return OSS;
}
public void setOSS(String OSS) {
this.OSS.add(OSS);
}
public ArrayList<String> getORDERID() {
return ORDERID;
}
public void setORDERID(String ORDERID) {
this.ORDERID.add(ORDERID);
}
}
@@ -0,0 +1,81 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 23-12-2016.
*/
public class StoreWisePerformaceGetterSetter {
String store_id, category_id, period, msl_availability, sos, t2p, promo, oss, order_id;
public String getStore_id() {
return store_id;
}
public void setStore_id(String store_id) {
this.store_id = store_id;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public String getPeriod() {
return period;
}
public void setPeriod(String period) {
this.period = period;
}
public String getMsl_availability() {
return msl_availability;
}
public void setMsl_availability(String msl_availability) {
this.msl_availability = msl_availability;
}
public String getSos() {
return sos;
}
public void setSos(String sos) {
this.sos = sos;
}
public String getT2p() {
return t2p;
}
public void setT2p(String t2p) {
this.t2p = t2p;
}
public String getPromo() {
return promo;
}
public void setPromo(String promo) {
this.promo = promo;
}
public String getOss() {
return oss;
}
public void setOss(String oss) {
this.oss = oss;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
}
@@ -8,7 +8,7 @@ import java.util.ArrayList;
public class T2PGetterSetter { public class T2PGetterSetter {
String brand_id, display_id, brand, display, image, remark; String brand_id, display_id, brand, display, image, remark, key_id, category_id;
boolean isPresent; boolean isPresent;
ArrayList<GapsChecklistGetterSetter> gapsChecklist = new ArrayList<>(); ArrayList<GapsChecklistGetterSetter> gapsChecklist = new ArrayList<>();
@@ -85,4 +85,20 @@ public class T2PGetterSetter {
public void setSkulist(ArrayList<SkuGetterSetter> skulist) { public void setSkulist(ArrayList<SkuGetterSetter> skulist) {
this.skulist = skulist; this.skulist = skulist;
} }
public String getKey_id() {
return key_id;
}
public void setKey_id(String key_id) {
this.key_id = key_id;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
} }
@@ -21,6 +21,9 @@ public class TableBean {
//Gagan start code //Gagan start code
public static String MAPPING_ADDITIONAL_PROMOTION; public static String MAPPING_ADDITIONAL_PROMOTION;
public static String STORE_PERFORMANCE;
public static String MAPPING_PLANOGRAM;
//Gagan end code //Gagan end code
public static String getJourneyPlan() { public static String getJourneyPlan() {
@@ -129,5 +132,21 @@ public class TableBean {
MAPPING_ADDITIONAL_PROMOTION = mappingAdditionalPromotion; MAPPING_ADDITIONAL_PROMOTION = mappingAdditionalPromotion;
} }
public static String getStorePerformance() {
return STORE_PERFORMANCE;
}
public static void setStorePerformance(String storePerformance) {
STORE_PERFORMANCE = storePerformance;
}
public static String getMappingPlanogram() {
return MAPPING_PLANOGRAM;
}
public static void setMappingPlanogram(String mappingPlanogram) {
MAPPING_PLANOGRAM = mappingPlanogram;
}
//Gagan end code //Gagan end code
} }
@@ -14,10 +14,12 @@ import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.STORE_PERFORMANCE_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
@@ -621,5 +623,89 @@ public class XMLHandlers {
return map; return map;
} }
public static STORE_PERFORMANCE_MasterGetterSetter STORE_PERFORMANCEXMLHandler(XmlPullParser xpp, int eventType) {
STORE_PERFORMANCE_MasterGetterSetter st = new STORE_PERFORMANCE_MasterGetterSetter();
try {
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
if (xpp.getEventType() == XmlPullParser.START_TAG) {
if (xpp.getName().equals("META_DATA")) {
st.setTable_STORE_PERFORMANCE(xpp.nextText());
}
if (xpp.getName().equals("STORE_ID")) {
st.setSTORE_ID(xpp.nextText());
}
if (xpp.getName().equals("CATEGORY_ID")) {
st.setCATEGORY_ID(xpp.nextText());
}
if (xpp.getName().equals("PERIOD")) {
st.setPERIOD(xpp.nextText());
}
if (xpp.getName().equals("SOS")) {
st.setSOS(xpp.nextText());
}
if (xpp.getName().equals("T2P")) {
st.setT2P(xpp.nextText());
}
if (xpp.getName().equals("PROMO")) {
st.setPROMO(xpp.nextText());
}
if (xpp.getName().equals("MSL_AVAILABILITY")) {
st.setMSL_AVAILABILITY(xpp.nextText());
}
if (xpp.getName().equals("OSS")) {
st.setOSS(xpp.nextText());
}
if (xpp.getName().equals("ORDERID")) {
st.setORDERID(xpp.nextText());
}
}
xpp.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return st;
}
public static MAPPING_PLANOGRAM_MasterGetterSetter MAPPING_PLANOGRAM_XMLHandler(XmlPullParser xpp, int eventType) {
MAPPING_PLANOGRAM_MasterGetterSetter st = new MAPPING_PLANOGRAM_MasterGetterSetter();
try {
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
if (xpp.getEventType() == XmlPullParser.START_TAG) {
if (xpp.getName().equals("META_DATA")) {
st.setTable_MAPPING_PLANOGRAM(xpp.nextText());
}
if (xpp.getName().equals("KEYACCOUNT_ID")) {
st.setKEYACCOUNT_ID(xpp.nextText());
}
if (xpp.getName().equals("STORETYPE_ID")) {
st.setSTORETYPE_ID(xpp.nextText());
}
if (xpp.getName().equals("CLASS_ID")) {
st.setCLASS_ID(xpp.nextText());
}
if (xpp.getName().equals("PLANOGRAM_IMAGE")) {
st.setPLANOGRAM_IMAGE(xpp.nextText());
}
if (xpp.getName().equals("IMAGE_PATH")) {
st.setIMAGE_PATH(xpp.nextText());
}
}
xpp.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return st;
}
//Gagan End Code //Gagan End Code
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:drawable="@color/grey_background" /> <item android:state_checked="false" android:drawable="@drawable/toggle_grey" />
<item android:state_checked="true" android:drawable="@color/green" /> <item android:state_checked="true" android:drawable="@drawable/toggle_green" />
</selector> </selector>
@@ -1,80 +1,3 @@
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="cpm.com.gskmtorange.LoginActivity">
&lt;!&ndash; Login progress &ndash;&gt;
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/userid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_userid"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/user_login_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_sign_in"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
@@ -119,7 +42,7 @@
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="45dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@@ -207,11 +130,11 @@
<ImageView <ImageView
android:id="@+id/gsklogo" android:id="@+id/gsklogo"
android:layout_width="167dp" android:layout_width="115dp"
android:layout_height="113dp" android:layout_height="100dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:background="@drawable/gsk_logo"></ImageView> android:background="@drawable/gsklogo"></ImageView>
</RelativeLayout> </RelativeLayout>
@@ -226,7 +149,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:text="Version" android:text="Version/Versiyon"
android:textSize="@dimen/text_size_normal" /> android:textSize="@dimen/text_size_normal" />
</RelativeLayout> </RelativeLayout>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="cpm.com.gskmtorange.dailyentry.SettingsActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_settings" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
@@ -34,10 +34,10 @@
<ImageView <ImageView
android:id="@+id/logo" android:id="@+id/logo"
android:layout_width="300dp" android:layout_width="153dp"
android:layout_height="204dp" android:layout_height="133dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="@drawable/gsk_logo" /> android:background="@drawable/gsklogo" />
</RelativeLayout> </RelativeLayout>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_store_wise_performance" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/right_arrow" />
</android.support.design.widget.CoordinatorLayout>
@@ -24,5 +24,4 @@
<include layout="@layout/contentstoreimage" /> <include layout="@layout/contentstoreimage" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
@@ -24,14 +24,123 @@
android:text="Category Performance" android:text="Category Performance"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="30">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_period"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_msl_availability"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_sos"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_t2p"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_promo"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_oss"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#888" />
</LinearLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="5dp" android:paddingBottom="5dp" />
android:paddingTop="5dp" /> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
@@ -21,7 +21,7 @@
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:paddingTop="10dp" android:paddingTop="10dp"
android:text="Daily Data Menu" android:text="@string/daily_activity_menu"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:visibility="gone"/> android:visibility="gone"/>
@@ -49,11 +49,12 @@
<ImageView <ImageView
android:id="@+id/img_main" android:id="@+id/img_main"
android:layout_width="match_parent" android:layout_width="153dp"
android:layout_height="200dp" android:layout_height="133dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:src="@drawable/gsk_logo" android:src="@drawable/gsklogo"
android:layout_centerInParent="true"
/> />
<WebView <WebView
@@ -13,7 +13,10 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView <TextView
android:id="@+id/txt_promoComplianceName" android:id="@+id/txt_promoComplianceName"
@@ -157,9 +160,9 @@
android:id="@+id/toggle_add_InStock" android:id="@+id/toggle_add_InStock"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no" android:textOff="@string/no"
android:textOn="@string/yes" android:textOn="@string/yes"/>
android:background="@drawable/toggle_selector_background"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -196,9 +199,9 @@
android:id="@+id/toggle_add_promoAnnouncer" android:id="@+id/toggle_add_promoAnnouncer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no" android:textOff="@string/no"
android:textOn="@string/yes" android:textOn="@string/yes" />
android:background="@drawable/toggle_selector_background" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -235,9 +238,9 @@
android:id="@+id/toggle_add_runningPos" android:id="@+id/toggle_add_runningPos"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/toggle_selector_background"
android:textOff="@string/no" android:textOff="@string/no"
android:textOn="@string/yes" android:textOn="@string/yes" />
android:background="@drawable/toggle_selector_background" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -255,7 +258,7 @@
android:id="@+id/btn_add" android:id="@+id/btn_add"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="center"
android:background="@color/colorPrimaryDark" android:background="@color/colorPrimaryDark"
android:text="@string/promo_compliance_add" android:text="@string/promo_compliance_add"
android:textColor="@color/white" /> android:textColor="@color/white" />
@@ -0,0 +1,9 @@
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment"
android:name="cpm.com.gskmtorange.fragment.SettingsActivityFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:layout="@layout/fragment_settings" />
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_category_wise_performance"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_category_wise_performance">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/txt_categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Category Performance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="30">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_period"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_msl_availability"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_sos"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_t2p"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_promo"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="@string/category_performance_oss"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#888" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
@@ -79,7 +79,7 @@
android:id="@+id/img_cam_selfie" android:id="@+id/img_cam_selfie"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@mipmap/camera_icon_done" android:background="@mipmap/camera_orange"
android:layout_centerInParent="true" android:layout_centerInParent="true"
/> />
@@ -28,7 +28,7 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="Downloading Data" android:text="@string/download_data"
android:textSize="@dimen/text_size_normal" android:textSize="@dimen/text_size_normal"
android:paddingBottom="20dp" android:paddingBottom="20dp"
android:textColor="@color/white" android:textColor="@color/white"
@@ -9,7 +9,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/StoreVisited" android:text="@string/store_visited"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="18sp" /> android:textSize="18sp" />
@@ -0,0 +1,112 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="cpm.com.gskmtorange.fragment.SelectLanguageFragment">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_select_language"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="5dp">
<LinearLayout
android:id="@+id/ans_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- <TextView
android:id="@+id/tv_qns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:padding="5dp"
android:text="Alert"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/text_size_normal"
android:textStyle="bold" />-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="5dp"
android:text="@string/select_language"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/text_size_normal"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<Button
android:id="@+id/btn_language_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="80dp"
android:paddingRight="80dp"
android:text="English" />
<Button
android:id="@+id/btn_language_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="80dp"
android:paddingRight="80dp"
android:text="English" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</FrameLayout>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_settings"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/custom_margin"
android:paddingLeft="@dimen/custom_margin"
android:paddingRight="@dimen/custom_margin"
android:paddingTop="@dimen/custom_margin"
tools:showIn="@layout/activity_settings">
<android.support.v7.widget.RecyclerView
android:id="@+id/rec_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
@@ -46,8 +46,9 @@
android:id="@+id/btn_is_present" android:id="@+id/btn_is_present"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textOn="Yes" android:textOn="@string/yes"
android:textOff="No" android:textOff="@string/no"
android:background="@drawable/toggle_selector_background"
android:layout_centerInParent="true"/> android:layout_centerInParent="true"/>
</RelativeLayout> </RelativeLayout>
@@ -15,7 +15,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
android:weightSum="30"> android:weightSum="30">
<!--android:background="#F1E9E9"-->
<TextView <TextView
android:id="@+id/txt_period" android:id="@+id/txt_period"
@@ -23,71 +22,15 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="5" android:layout_weight="5"
android:gravity="center" android:gravity="center"
android:paddingBottom="5dp" android:padding="5dp"
android:paddingTop="5dp"
android:text="Period" android:text="Period"
android:textColor="#000" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="20sp" android:textColor="#000" />
android:textStyle="bold" />
<View <View
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#f2711f" /> android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_sos"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SOS"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_t2p"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="T2P"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_promo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Promo"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView <TextView
android:id="@+id/txt_msl_availability" android:id="@+id/txt_msl_availability"
@@ -95,17 +38,63 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="5" android:layout_weight="5"
android:gravity="center" android:gravity="center"
android:paddingBottom="5dp" android:padding="5dp"
android:paddingTop="5dp"
android:text="MSL Availability" android:text="MSL Availability"
android:textColor="#000" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="15sp" android:textColor="#000" />
android:textStyle="bold" />
<View <View
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#f2711f" /> android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_sos"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="SOS"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_t2p"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="T2P"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_promo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="Promo"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView <TextView
android:id="@+id/txt_oss" android:id="@+id/txt_oss"
@@ -113,12 +102,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="5" android:layout_weight="5"
android:gravity="center" android:gravity="center"
android:paddingBottom="5dp" android:padding="5dp"
android:paddingTop="5dp"
android:text="OSS" android:text="OSS"
android:textColor="#000" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="15sp" android:textColor="#000" />
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<View <View
@@ -91,9 +91,11 @@
<ToggleButton <ToggleButton
android:id="@+id/toggle_available" android:id="@+id/toggle_available"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="70dp"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/toggle_selector_background" /> android:background="@drawable/toggle_selector_background"
android:textOff="@string/no"
android:textOn="@string/yes" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -77,6 +77,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:hint="@string/stock_facing_stock"
android:inputType="number" android:inputType="number"
android:maxLength="7" android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
@@ -105,6 +106,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:hint="@string/stock_facing_faceup"
android:inputType="number" android:inputType="number"
android:maxLength="7" android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
@@ -23,57 +23,71 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1.5"
android:gravity="center_vertical" android:orientation="horizontal"
android:orientation="vertical" android:paddingTop="5dp"
android:paddingRight="10dp"> android:weightSum="2">
<!--android:gravity="center_vertical"-->
<TextView <TextView
android:id="@+id/txt_stockFaceupHeader" android:id="@+id/txt_stockFaceupHeader"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:paddingLeft="25dp" android:layout_weight="1.4"
android:paddingLeft="20dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="Brand Name " android:text="Brand Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
<TextView
android:id="@+id/txt_sosHeader"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".6"
android:paddingRight="5dp"
android:text="@string/stock_facing_sos"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" /> android:textColor="#222" />
</LinearLayout> </LinearLayout>
<!--Camera Images-->
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight=".5"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <!--<ImageView
android:id="@+id/img_reference" android:id="@+id/img_reference"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:src="@mipmap/star" /> android:src="@mipmap/star" />-->
<ImageView <ImageView
android:id="@+id/img_camera1" android:id="@+id/img_camera1"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp" />
android:src="@drawable/ic_menu_camera" /> <!--android:src="@drawable/ic_menu_camera"-->
<ImageView <ImageView
android:id="@+id/img_camera2" android:id="@+id/img_camera2"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp" />
android:src="@drawable/ic_menu_camera" /> <!--android:src="@drawable/ic_menu_camera"-->
<ImageView <!--<ImageView
android:id="@+id/img_edit" android:id="@+id/img_edit"
android:layout_width="25dp" android:layout_width="25dp"
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:src="@mipmap/no_camera" /> android:src="@mipmap/no_camera" />-->
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
@@ -0,0 +1,120 @@
<?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"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/lay_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="30">
<TextView
android:id="@+id/txt_period"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="Period"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_msl_availability"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="MSL Availability"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_sos"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="SOS"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_t2p"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="T2P"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_promo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="Promo"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<TextView
android:id="@+id/txt_oss"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:padding="5dp"
android:text="OSS"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#888" />
</LinearLayout>
</LinearLayout>
@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:src="@drawable/gsk_logo" /> android:src="@drawable/gsklogo" />
<TextView <TextView
android:id="@+id/nav_user_name" android:id="@+id/nav_user_name"
@@ -41,7 +41,7 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="3sp" android:layout_marginLeft="3sp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="Reason" android:text=""
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- <android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="20dp">-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Title and Image-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#90888888"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:padding="10dp"
android:text="@string/stock_facing_planogram_dialog_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/img_planogram"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:src="@drawable/sad_cloud"/>
</LinearLayout>
</LinearLayout>
<!--Cancel Image-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="5dp"
android:orientation="vertical">
<ImageView
android:id="@+id/img_cancel"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/cancel" />
</LinearLayout>
</FrameLayout>
<!--</android.support.v7.widget.CardView>-->
</LinearLayout>
@@ -0,0 +1,63 @@
<?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:id="@+id/card_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/custom_margin"
android:layout_marginRight="@dimen/custom_margin"
android:layout_marginTop="@dimen/custom_margin"
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"
android:layout_weight="3"
>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5dp"
>
<ImageView
android:id="@+id/btn_is_present"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="@string/yes"
android:textOff="@string/no"
android:background="@mipmap/entry_grey"
android:layout_centerInParent="true"/>
</RelativeLayout>
<TextView
android:id="@+id/tv_settings"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:text="Checklist"
android:textColor="@color/black"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingLeft="@dimen/custom_margin"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -91,8 +91,9 @@
android:id="@+id/toggle_btn" android:id="@+id/toggle_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textOn="Yes" android:textOn="@string/yes"
android:textOff="No" android:textOff="@string/no"
android:background="@drawable/toggle_selector_background"
android:layout_centerInParent="true"/> android:layout_centerInParent="true"/>
@@ -126,9 +127,10 @@
android:layout_height="50dp" android:layout_height="50dp"
android:text="@string/image" android:text="@string/image"
android:layout_weight="1" android:layout_weight="1"
android:layout_centerInParent="true" android:background="@mipmap/camera_orange"
android:background="@drawable/cam_active" android:padding="@dimen/custom_margin"
android:padding="@dimen/custom_margin"/> android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout> </RelativeLayout>
@@ -136,7 +138,8 @@
<RelativeLayout <RelativeLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1"
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/img_remark" android:id="@+id/img_remark"
@@ -130,7 +130,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel"/> android:text="@string/closed"/>
</LinearLayout> </LinearLayout>
@@ -147,7 +147,7 @@
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
<android.support.v7.widget.CardView <!-- <android.support.v7.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@@ -176,5 +176,5 @@
android:fastScrollEnabled="true" android:fastScrollEnabled="true"
android:smoothScrollbar="true"></ListView> android:smoothScrollbar="true"></ListView>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>-->
</LinearLayout> </LinearLayout>
@@ -4,28 +4,24 @@
<group android:checkableBehavior="single"> <group android:checkableBehavior="single">
<item <item
android:id="@+id/nav_route_plan" android:id="@+id/nav_route_plan"
android:icon="@drawable/ic_menu_gallery" android:icon="@mipmap/entry_grey"
android:title="@string/menu_daily_route_plan" /> android:title="@string/menu_daily_route_plan" />
<item <item
android:id="@+id/nav_download" android:id="@+id/nav_download"
android:icon="@drawable/ic_menu_slideshow" android:icon="@mipmap/download_grey"
android:title="@string/menu_daily_download" /> android:title="@string/menu_daily_download" />
<item <item
android:id="@+id/nav_upload" android:id="@+id/nav_upload"
android:icon="@drawable/ic_menu_send" android:icon="@mipmap/upload_grey"
android:title="@string/menu_upload_data" /> android:title="@string/menu_upload_data" />
<item <item
android:id="@+id/nav_geotag" android:id="@+id/nav_geotag"
android:icon="@drawable/ic_menu_manage" android:icon="@mipmap/geotag_grey"
android:title="@string/menu_geotag" /> android:title="@string/menu_geotag" />
<item
android:id="@+id/nav_export"
android:icon="@drawable/ic_menu_share"
android:title="@string/menu_export" />
<item <item
android:id="@+id/nav_exit" android:id="@+id/nav_exit"
android:icon="@drawable/ic_menu_send" android:icon="@mipmap/exit_grey"
android:title="@string/menu_exit" /> android:title="@string/menu_exit" />
</group> </group>
@@ -33,11 +29,11 @@
<menu> <menu>
<item <item
android:id="@+id/nav_setting" android:id="@+id/nav_setting"
android:icon="@drawable/ic_menu_manage" android:icon="@mipmap/settings_grey"
android:title="@string/menu_setting" /> android:title="@string/menu_setting" />
<item <item
android:id="@+id/nav_services" android:id="@+id/nav_services"
android:icon="@drawable/ic_menu_send" android:icon="@mipmap/services_grey"
android:title="@string/menu_services" /> android:title="@string/menu_services" />
</menu> </menu>
</item> </item>
@@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="cpm.com.gskmtorange.dailyentry.SettingsActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_planogram"
android:icon="@mipmap/ref_images_white"
android:orderInCategory="100"
android:title="planogram"
app:showAsAction="always" />
</menu>
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Some files were not shown because too many files have changed in this diff Show More