Merge pull request #61 from CPM-INDIA-SALES-AND-MARKETING-PVT-LTD/YSY_POG_Compulsory_UAE
Ysy pog compulsory uae
This commit is contained in:
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Kotlin2JsCompilerArguments">
|
||||||
|
<option name="sourceMapEmbedSources" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
-16
@@ -48,20 +48,4 @@
|
|||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
<option name="id" value="Android" />
|
<option name="id" value="Android" />
|
||||||
</component>
|
</component>
|
||||||
<component name="masterDetails">
|
|
||||||
<states>
|
|
||||||
<state key="ProjectJDKs.UI">
|
|
||||||
<settings>
|
|
||||||
<last-edited>1.8</last-edited>
|
|
||||||
<splitter-proportions>
|
|
||||||
<option name="proportions">
|
|
||||||
<list>
|
|
||||||
<option value="0.2" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</splitter-proportions>
|
|
||||||
</settings>
|
|
||||||
</state>
|
|
||||||
</states>
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
||||||
@@ -21,25 +21,24 @@ android {
|
|||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
|
|
||||||
//For Egypt
|
//For Egypt
|
||||||
/*versionCode 22
|
/*versionCode 23
|
||||||
versionName "3.4"*/
|
versionName "3.5"*/
|
||||||
|
|
||||||
//For UAE
|
//For UAE
|
||||||
/*versionCode 18
|
versionCode 20
|
||||||
versionName "3.0"*/
|
versionName "3.2"
|
||||||
|
|
||||||
//For Turkey
|
//For Turkey
|
||||||
/*versionCode 21
|
/*versionCode 21
|
||||||
versionName "3.3"*/
|
versionName "3.3"*/
|
||||||
|
|
||||||
//For KSA
|
//For KSA
|
||||||
/*versionCode 22
|
/*versionCode 23
|
||||||
versionName "3.4"*/
|
versionName "3.5"*/
|
||||||
|
|
||||||
//For SA
|
//For SA
|
||||||
versionCode 23
|
/*versionCode 22
|
||||||
versionName "3.5"
|
versionName "3.4"*/
|
||||||
|
|
||||||
|
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="cpm.com.gskmtorange">
|
package="cpm.com.gskmtorange">
|
||||||
|
|
||||||
<!-- To auto-complete the email text field in the login form with the user's emails -->
|
<!-- To auto-complete the email text field in the login form with the user's emails -->
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||||
@@ -11,7 +10,8 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="firebase_crashlytics_collection_enabled"
|
android:name="firebase_crashlytics_collection_enabled"
|
||||||
@@ -24,6 +24,24 @@
|
|||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
<activity
|
||||||
|
android:name=".dailyentry.CounterfeitProductsActivity"
|
||||||
|
android:label="@string/title_activity_counterfeit_products"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustPan"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".password.MPinActivity"
|
||||||
|
android:label="@string/title_activity_mpin"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
|
<activity
|
||||||
|
android:name=".password.ChangePasswordActivity"
|
||||||
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
|
android:label="@string/title_activity_change_password"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SplashScreenActivity"
|
android:name=".SplashScreenActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
@@ -77,7 +95,6 @@
|
|||||||
android:label="@string/title_activity_store_geotag"
|
android:label="@string/title_activity_store_geotag"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.maps.v2.API_KEY"
|
android:name="com.google.android.maps.v2.API_KEY"
|
||||||
@@ -86,16 +103,12 @@
|
|||||||
android:name="com.google.android.gms.version"
|
android:name="com.google.android.gms.version"
|
||||||
android:value="@integer/google_play_services_version" />
|
android:value="@integer/google_play_services_version" />
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".dailyentry.T2PComplianceActivity"
|
android:name=".dailyentry.T2PComplianceActivity"
|
||||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
android:label="@string/daily_data_menu_t2p"
|
android:label="@string/daily_data_menu_t2p"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Gagan Start Declaration -->
|
||||||
|
|
||||||
<!-- Gagan Start Declaration -->
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gsk_dailyentry.CategoryListActivity"
|
android:name=".gsk_dailyentry.CategoryListActivity"
|
||||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
@@ -137,9 +150,7 @@
|
|||||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
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:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
@@ -315,22 +326,21 @@
|
|||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".dailyentry.AdditionalPromoSKUwiseActivity"
|
android:name=".dailyentry.AdditionalPromoSKUwiseActivity"
|
||||||
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
android:label="@string/title_activity_additional_promo_skuwise"
|
android:label="@string/title_activity_additional_promo_skuwise"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:configChanges="screenSize|orientation|keyboardHidden"
|
android:windowSoftInputMode="adjustPan" />
|
||||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="android.support.v4.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities="${applicationId}.fileprovider"
|
||||||
android:grantUriPermissions="true"
|
android:exported="false"
|
||||||
android:exported="false">
|
android:grantUriPermissions="true">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/provider_paths"/>
|
android:resource="@xml/provider_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -36,6 +36,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
|
|||||||
import cpm.com.gskmtorange.xmlGetterSetter.ChatMessageDownloadGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.ChatMessageDownloadGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationContrywiseGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationContrywiseGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.DeliveryCallsGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.DeliveryCallsGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.DisplayChecklistMasterGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
|
||||||
@@ -86,7 +87,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class GSKOrangeDB extends SQLiteOpenHelper {
|
public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||||
public static final String DATABASE_NAME = "GSK_ORANGE_DB46";
|
public static final String DATABASE_NAME = "GSK_ORANGE_DB49";
|
||||||
public static final int DATABASE_VERSION = 15;
|
public static final int DATABASE_VERSION = 15;
|
||||||
TableBean tableBean;
|
TableBean tableBean;
|
||||||
private SQLiteDatabase db;
|
private SQLiteDatabase db;
|
||||||
@@ -205,6 +206,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
db.execSQL(CommonString.CREATE_TABLE_DELIVERY_CALLS);//--Added 09.10.2018
|
db.execSQL(CommonString.CREATE_TABLE_DELIVERY_CALLS);//--Added 09.10.2018
|
||||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKUWISE);//--Added 10.12.2018
|
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKUWISE);//--Added 10.12.2018
|
||||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKUWISE_EXISTS);//--Added 11.12.2018
|
db.execSQL(CommonString.CREATE_TABLE_INSERT_PROMO_SKUWISE_EXISTS);//--Added 11.12.2018
|
||||||
|
db.execSQL(CommonString.CREATE_ABLE_IS_ADHOC_SAVED);//--Added 20.02.2019
|
||||||
|
db.execSQL(CommonString.CREATE_TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS);//--Added 12.03.2019
|
||||||
|
db.execSQL(CommonString.CREATE_TABLE_INSERT_COUNTERFEIT_PRODUCT);//--Added 12.03.2019
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -262,6 +266,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
db.delete(CommonString.TABLE_AUDIT_DATA_SAVE, "STORE_CD" + "='" + storeid + "'", null);
|
db.delete(CommonString.TABLE_AUDIT_DATA_SAVE, "STORE_CD" + "='" + storeid + "'", null);
|
||||||
db.delete(CommonString.TABLE_POG_DATA_SAVE, "STORE_CD" + "='" + storeid + "'", null);
|
db.delete(CommonString.TABLE_POG_DATA_SAVE, "STORE_CD" + "='" + storeid + "'", null);
|
||||||
db.delete(CommonString.TABLE_COACHING_VISIT, "STORE_ID" + "='" + storeid + "'", null);
|
db.delete(CommonString.TABLE_COACHING_VISIT, "STORE_ID" + "='" + storeid + "'", null);
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS, "STORE_ID" + "='" + storeid + "'", null);
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT, "STORE_ID" + "='" + storeid + "'", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,6 +306,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
db.delete(CommonString.TABLE_AUDIT_DATA_SAVE, null, null);
|
db.delete(CommonString.TABLE_AUDIT_DATA_SAVE, null, null);
|
||||||
db.delete(CommonString.TABLE_POG_DATA_SAVE, null, null);
|
db.delete(CommonString.TABLE_POG_DATA_SAVE, null, null);
|
||||||
db.delete(CommonString.TABLE_COACHING_VISIT, null, null);
|
db.delete(CommonString.TABLE_COACHING_VISIT, null, null);
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS, null, null);
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertJCP(JourneyPlanGetterSetter data) {
|
public void InsertJCP(JourneyPlanGetterSetter data) {
|
||||||
@@ -354,16 +362,16 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<T2PGetterSetter> getT2PDefaultData(String store_id, String category_id) {
|
public ArrayList<T2PGetterSetter> getT2PDefaultData(String store_id, String category_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<T2PGetterSetter> t2PList = new ArrayList<>();
|
ArrayList<T2PGetterSetter> t2PList = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
dbcursor = db.rawQuery("Select BM.BRAND As BRAND, BM.BRAND_ID As BRAND_ID, DM.DISPLAY As DISPLAY, " +
|
dbcursor = db.rawQuery("Select DISTINCT BM.BRAND As BRAND, BM.BRAND_ID As BRAND_ID, DM.DISPLAY As DISPLAY, " +
|
||||||
"DM.DISPLAY_ID As DISPLAY_ID, DM.IMAGE_URL As IMAGE_URL, DM.IMAGE_PATH As IMAGE_PATH, " +
|
"DM.DISPLAY_ID As DISPLAY_ID, DM.IMAGE_URL As IMAGE_URL, DM.IMAGE_PATH As IMAGE_PATH, " +
|
||||||
"T.CATEGORY_FIXTURE As CATEGORY_FIXTURE from BRAND_MASTER BM INNER JOIN MAPPING_T2P T " +
|
"T.CATEGORY_FIXTURE As CATEGORY_FIXTURE from BRAND_MASTER BM INNER JOIN "+ tableName +" T " +
|
||||||
"ON BM.BRAND_ID = T.BRAND_ID INNER JOIN DISPLAY_MASTER DM " +
|
"ON BM.BRAND_ID = T.BRAND_ID INNER JOIN DISPLAY_MASTER DM " +
|
||||||
"ON T.DISPLAY_ID= DM.DISPLAY_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BM.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID " +
|
"ON T.DISPLAY_ID= DM.DISPLAY_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BM.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID " +
|
||||||
"WHERE T.STORE_ID = '" + store_id + "' AND SCM.CATEGORY_ID ='" + category_id + "'", null);
|
"WHERE T.STORE_ID = '" + store_id + "' AND SCM.CATEGORY_ID ='" + category_id + "'", null);
|
||||||
@@ -463,7 +471,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get Brand data for T2P
|
//get Brand data for T2P
|
||||||
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id, String category_id, String store_id) {
|
public ArrayList<BrandMasterGetterSetter> getBrandT2PData(String store_type_id, String class_id, String key_account_id, String category_id, String store_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<BrandMasterGetterSetter> brandList = new ArrayList<>();
|
ArrayList<BrandMasterGetterSetter> brandList = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -471,7 +479,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if(key_account_id!=null){
|
if(key_account_id!=null){
|
||||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK MS " +
|
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM " + tableName + " 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 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 + "' " +
|
"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' AND SCM.CATEGORY_ID = '" + category_id + "' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE ) As Brand", null);
|
"AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND BR.COMPANY_ID ='1' AND SCM.CATEGORY_ID = '" + category_id + "' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE ) As Brand", null);
|
||||||
@@ -516,7 +524,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get Sku data for T2P
|
//get Sku data for T2P
|
||||||
public ArrayList<SkuGetterSetter> getSkuT2PData(String store_type_id, String class_id, String key_account_id, String brand_id, String store_id) {
|
public ArrayList<SkuGetterSetter> getSkuT2PData(String store_type_id, String class_id, String key_account_id, String brand_id, String store_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<SkuGetterSetter> skuList = new ArrayList<>();
|
ArrayList<SkuGetterSetter> skuList = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -524,7 +532,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if(key_account_id!=null){
|
if(key_account_id!=null){
|
||||||
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM MAPPING_STOCK MS INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID " +
|
dbcursor = db.rawQuery("SELECT DISTINCT SM.SKU, SM.SKU_ID, BR.BRAND_ID FROM "+ tableName +" 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 " +
|
"INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID " +
|
||||||
"WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND SM.BRAND_ID='" + brand_id + "' " +
|
"WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND SM.BRAND_ID='" + brand_id + "' " +
|
||||||
"AND MS.SHOW_ADDITIONAL_VISIBILITY='1' ORDER BY SM.PROMO_SKU, SM.SKU", null);
|
"AND MS.SHOW_ADDITIONAL_VISIBILITY='1' ORDER BY SM.PROMO_SKU, SM.SKU", null);
|
||||||
@@ -731,7 +739,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStatus(String id, String status, double lat, double longtitude) {
|
public void updateStatus(String id, String status, double lat, double longtitude, String table_name) {
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
@@ -739,7 +747,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
values.put("GEO_TAG", status);
|
values.put("GEO_TAG", status);
|
||||||
|
|
||||||
db.update(CommonString.KEY_JOURNEY_PLAN, values, CommonString.KEY_STORE_ID + "='" + id + "'", null);
|
db.update(table_name, values, CommonString.KEY_STORE_ID + "='" + id + "'", null);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
||||||
@@ -825,7 +833,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataStatus(String id, String status) {
|
public void updateDataStatus(String id, String status, String table_name) {
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
@@ -833,7 +841,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
values.put("GEO_TAG", status);
|
values.put("GEO_TAG", status);
|
||||||
|
|
||||||
db.update(CommonString.KEY_JOURNEY_PLAN, values,
|
db.update(table_name, values,
|
||||||
CommonString.KEY_STORE_ID + "='" + id + "'", null);
|
CommonString.KEY_STORE_ID + "='" + id + "'", null);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -1005,8 +1013,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertMappingStock(MappingStockGetterSetter data) {
|
public void InsertMappingStock(MappingStockGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_STOCK", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -1020,15 +1028,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("MBQ", data.getMBQ().get(i));
|
values.put("MBQ", data.getMBQ().get(i));
|
||||||
values.put("SHOW_ADDITIONAL_VISIBILITY", data.getSHOW_ADDITIONAL_VISIBILITY().get(i));
|
values.put("SHOW_ADDITIONAL_VISIBILITY", data.getSHOW_ADDITIONAL_VISIBILITY().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_STOCK", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
|
Log.d("Exception ", " in " + tableName + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertMAPPING_T2P(MAPPINGT2PGetterSetter data) {
|
public void InsertMAPPING_T2P(MAPPINGT2PGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_T2P", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -1039,16 +1047,16 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
|
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
|
||||||
values.put("CATEGORY_FIXTURE", data.getCATEGORY_FIXTURE().get(i));
|
values.put("CATEGORY_FIXTURE", data.getCATEGORY_FIXTURE().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_T2P", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
|
Log.d("Exception ", " in "+ tableName + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Category List
|
//Category List
|
||||||
public ArrayList<CategoryGetterSetter> getCategoryListData(String keyAccountId, String storeTypeId, String classId, String store_id) {
|
public ArrayList<CategoryGetterSetter> getCategoryListData(String keyAccountId, String storeTypeId, String classId, String store_id, String tableName) {
|
||||||
ArrayList<CategoryGetterSetter> list = new ArrayList<>();
|
ArrayList<CategoryGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
@@ -1056,7 +1064,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
if(keyAccountId!=null){
|
if(keyAccountId!=null){
|
||||||
dbcursor = db.rawQuery("Select DISTINCT CA.CATEGORY_ID,CA.CATEGORY " +
|
dbcursor = db.rawQuery("Select DISTINCT CA.CATEGORY_ID,CA.CATEGORY " +
|
||||||
"from MAPPING_STOCK M " +
|
"from " + tableName + " 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -1653,8 +1661,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertMAPPING_ADDITIONAL_PROMOTION(MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter data) {
|
public void InsertMAPPING_ADDITIONAL_PROMOTION(MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_ADDITIONAL_PROMOTION", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -1666,15 +1674,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("PROMO_ID", data.getPROMO_ID().get(i));
|
values.put("PROMO_ID", data.getPROMO_ID().get(i));
|
||||||
values.put("PROMO", data.getPROMO().get(i));
|
values.put("PROMO", data.getPROMO().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_ADDITIONAL_PROMOTION", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " in MAPPING_ADDITIONAL_PROMOTION " + ex.toString());
|
Log.d("Exception ", " in " + tableName + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertMAPPING_PROMOTION(MappingPromotionGetterSetter data) {
|
public void InsertMAPPING_PROMOTION(MappingPromotionGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_PROMOTION", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -1686,21 +1694,21 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("PROMO_ID", data.getPROMO_ID().get(i));
|
values.put("PROMO_ID", data.getPROMO_ID().get(i));
|
||||||
values.put("PROMO", data.getPROMO().get(i));
|
values.put("PROMO", data.getPROMO().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_PROMOTION", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " in MAPPING_PROMOTION " + ex.toString());
|
Log.d("Exception ", " in "+ tableName + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Promo Compliance
|
//Promo Compliance
|
||||||
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoComplianceSkuData(String store_id, String category_id) {
|
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoComplianceSkuData(String store_id, String category_id, String tableName) {
|
||||||
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("Select M.* " +
|
dbcursor = db.rawQuery("Select M.* " +
|
||||||
"from MAPPING_PROMOTION M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -1743,7 +1751,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoSpinnerData(String store_id, String category_id) {
|
public ArrayList<Promo_Compliance_DataGetterSetter> getPromoSpinnerData(String store_id, String category_id, String tableName) {
|
||||||
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
ArrayList<Promo_Compliance_DataGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
@@ -1754,8 +1762,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
list.add(promo);
|
list.add(promo);
|
||||||
|
|
||||||
dbcursor = db.rawQuery("Select M.* " +
|
dbcursor = db.rawQuery("Select DISTINCT M.* " +
|
||||||
"from MAPPING_ADDITIONAL_PROMOTION M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -2361,8 +2369,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Store wise Performance
|
//Store wise Performance
|
||||||
public void InsertSTORE_PERFORMANCE(STORE_PERFORMANCE_MasterGetterSetter data) {
|
public void InsertSTORE_PERFORMANCE(STORE_PERFORMANCE_MasterGetterSetter data, String tableName) {
|
||||||
db.delete("STORE_PERFORMANCE_NEW", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -2379,15 +2387,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("ORDERID", data.getORDERID().get(i));
|
values.put("ORDERID", data.getORDERID().get(i));
|
||||||
values.put("PLANOGRAM", data.getPLANOGRAM().get(i));
|
values.put("PLANOGRAM", data.getPLANOGRAM().get(i));
|
||||||
|
|
||||||
db.insert("STORE_PERFORMANCE_NEW", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " STORE_PERFORMANCE_NEW " + ex.toString());
|
Log.d("Exception ", tableName + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Category wise Performance
|
//Category wise Performance
|
||||||
public ArrayList<CategoryWisePerformaceGetterSetter> getCategoryWisePerformance(String store_id, String category_id) {
|
public ArrayList<CategoryWisePerformaceGetterSetter> getCategoryWisePerformance(String store_id, String category_id, String tableName) {
|
||||||
ArrayList<CategoryWisePerformaceGetterSetter> list = new ArrayList<>();
|
ArrayList<CategoryWisePerformaceGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
@@ -2423,15 +2431,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<StoreWisePerformaceGetterSetter> getStoreWisePerformance(String store_id) {
|
public ArrayList<StoreWisePerformaceGetterSetter> getStoreWisePerformance(String store_id, String tableName) {
|
||||||
ArrayList<StoreWisePerformaceGetterSetter> list = new ArrayList<>();
|
ArrayList<StoreWisePerformaceGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("Select PERIOD, ROUND(avg(MSL),1) as MSL,ROUND(avg(sos),1) as SOS ," +
|
dbcursor = db.rawQuery("Select PERIOD, ROUND(avg(MSL),1) as MSL,ROUND(avg(sos),1) as SOS ," +
|
||||||
" ROUND(avg(t2p),1) as T2P,ROUND(avg(pROMO),1) as PROMO , ROUND(avg(pLANOGRAM),1) as PLANOGRAM, ROUND(SUM(oss),1) AS OSS " +
|
" ROUND(avg(t2p),1) as T2P,ROUND(avg(pROMO),1) as PROMO , ROUND(avg(pLANOGRAM),1) as PLANOGRAM, ROUND(SUM(oss),1) AS OSS " +
|
||||||
"from STORE_PERFORMANCE_NEW " +
|
"from "+ tableName +
|
||||||
"where STORE_ID='" + store_id + "' " +
|
" where STORE_ID='" + store_id + "' " +
|
||||||
"GROUP BY PERIOD " +
|
"GROUP BY PERIOD " +
|
||||||
"ORDER BY ORDERID ", null);
|
"ORDER BY ORDERID ", null);
|
||||||
|
|
||||||
@@ -3273,8 +3281,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
//Gagan start new code 2
|
//Gagan start new code 2
|
||||||
|
|
||||||
public void InsertMAPPING_PLANOGRAM(MAPPING_PLANOGRAM_MasterGetterSetter data) {
|
public void InsertMAPPING_PLANOGRAM(MAPPING_PLANOGRAM_MasterGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_PLANOGRAM", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -3287,14 +3295,14 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("PLANOGRAM_IMAGE", data.getPLANOGRAM_IMAGE().get(i));
|
values.put("PLANOGRAM_IMAGE", data.getPLANOGRAM_IMAGE().get(i));
|
||||||
values.put("IMAGE_PATH", data.getIMAGE_PATH().get(i));
|
values.put("IMAGE_PATH", data.getIMAGE_PATH().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_PLANOGRAM", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " MAPPING_PLANOGRAM " + ex.toString());
|
Log.d("Exception ", tableName + " " + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> getMappingPlanogramData(String category_id, String store_type_id, String class_id, String store_id) {
|
public ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> getMappingPlanogramData(String category_id, String store_type_id, String class_id, String store_id, String tableName) {
|
||||||
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> list = new ArrayList<>();
|
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
try {
|
try {
|
||||||
@@ -3561,13 +3569,22 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<CoverageBean> getPreviousCoverageData(String visitdate) {
|
public ArrayList<CoverageBean> getPreviousCoverageData(String visitdate, String flag_from) {
|
||||||
ArrayList<CoverageBean> list = new ArrayList<CoverageBean>();
|
ArrayList<CoverageBean> list = new ArrayList<CoverageBean>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("SELECT * from " + CommonString.TABLE_COVERAGE_DATA + " where "
|
|
||||||
+ CommonString.KEY_VISIT_DATE + "<>'" + visitdate + "'", null);
|
if (flag_from != null) {
|
||||||
|
dbcursor = db.rawQuery("SELECT * from " + CommonString.TABLE_COVERAGE_DATA + " where "
|
||||||
|
+ CommonString.KEY_VISIT_DATE + "<>'" + visitdate + "' AND " + CommonString.KEY_STORE_FLAG + "='" + flag_from + "'",
|
||||||
|
null);
|
||||||
|
} else {
|
||||||
|
dbcursor = db.rawQuery("SELECT * from " + CommonString.TABLE_COVERAGE_DATA + " where "
|
||||||
|
+ CommonString.KEY_VISIT_DATE + "<>'" + visitdate + "'",
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dbcursor != null) {
|
if (dbcursor != null) {
|
||||||
dbcursor.moveToFirst();
|
dbcursor.moveToFirst();
|
||||||
@@ -3594,6 +3611,10 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
sb.setRemark((((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_COVERAGE_REMARK))))));
|
sb.setRemark((((dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_COVERAGE_REMARK))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb.setCheckOut_Image(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CHECKOUT_IMAGE)));
|
||||||
|
sb.setFlag_from(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_STORE_FLAG)));
|
||||||
|
sb.setSub_reasonId(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SUB_REASON_ID)));
|
||||||
|
|
||||||
list.add(sb);
|
list.add(sb);
|
||||||
dbcursor.moveToNext();
|
dbcursor.moveToNext();
|
||||||
}
|
}
|
||||||
@@ -3633,13 +3654,13 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMappingPromotionData(String store_id, String category_id) {
|
public boolean isMappingPromotionData(String store_id, String category_id, String tableName) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("Select M.* " +
|
dbcursor = db.rawQuery("Select M.* " +
|
||||||
"from MAPPING_PROMOTION M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -3707,14 +3728,14 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMappingStockDataStockFacing(String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id) {
|
public boolean isMappingStockDataStockFacing(String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id, String tableName) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(keyAccount_id!=null){
|
if(keyAccount_id!=null){
|
||||||
dbcursor = db.rawQuery("Select M.* from MAPPING_STOCK M " +
|
dbcursor = db.rawQuery("Select M.* from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -3762,12 +3783,12 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isMappingT2PData(String store_id, String category_id) {
|
public boolean isMappingT2PData(String store_id, String category_id, String tableName) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("SELECT * FROM MAPPING_T2P M INNER JOIN BRAND_MASTER BR ON M.BRAND_ID = BR.BRAND_ID " +
|
dbcursor = db.rawQuery("SELECT * FROM "+ tableName +" M INNER JOIN BRAND_MASTER BR ON M.BRAND_ID = BR.BRAND_ID " +
|
||||||
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
||||||
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID " +
|
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID " +
|
||||||
"WHERE M.STORE_ID = '" + store_id + "' AND CA.CATEGORY_ID= '" + category_id + "'", null);
|
"WHERE M.STORE_ID = '" + store_id + "' AND CA.CATEGORY_ID= '" + category_id + "'", null);
|
||||||
@@ -3789,13 +3810,13 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return filled;
|
return filled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMappingAdditionalPromotionData(String store_id, String category_id) {
|
public boolean isMappingAdditionalPromotionData(String store_id, String category_id, String tableName) {
|
||||||
boolean filled = false;
|
boolean filled = false;
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dbcursor = db.rawQuery("Select M.* " +
|
dbcursor = db.rawQuery("Select M.* " +
|
||||||
"from MAPPING_ADDITIONAL_PROMOTION M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -3857,8 +3878,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertMAPPING_SOS_TARGET(MAPPING_SOS_TARGET_MasterGetterSetter data) {
|
public void InsertMAPPING_SOS_TARGET(MAPPING_SOS_TARGET_MasterGetterSetter data, String tableName) {
|
||||||
db.delete("MAPPING_SOS_TARGET", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -3868,15 +3889,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("BRAND_ID", data.getBRAND_ID().get(i));
|
values.put("BRAND_ID", data.getBRAND_ID().get(i));
|
||||||
values.put("SOS_TARGET", data.getSOS_TARGET().get(i));
|
values.put("SOS_TARGET", data.getSOS_TARGET().get(i));
|
||||||
|
|
||||||
db.insert("MAPPING_SOS_TARGET", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " MAPPING_SOS_TARGET " + ex.toString());
|
Log.d("Exception ", tableName +" " + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<BrandAvabilityGetterSetter> getBrandAvailbilitydata(String store_id, String category_id, String keyAccount_id, String class_id, String storeType_id) {
|
public ArrayList<BrandAvabilityGetterSetter> getBrandAvailbilitydata(String store_id, String category_id, String keyAccount_id, String class_id, String storeType_id, String tableName) {
|
||||||
Cursor cursordata = null;
|
Cursor cursordata = null;
|
||||||
ArrayList<BrandAvabilityGetterSetter> Data = new ArrayList<BrandAvabilityGetterSetter>();
|
ArrayList<BrandAvabilityGetterSetter> Data = new ArrayList<BrandAvabilityGetterSetter>();
|
||||||
|
|
||||||
@@ -3887,7 +3908,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
||||||
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID " +
|
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID " +
|
||||||
"INNER JOIN " +
|
"INNER JOIN " +
|
||||||
"(SELECT DISTINCT SKU_ID FROM MAPPING_STOCK WHERE KEYACCOUNT_ID = '" + keyAccount_id + "' AND STORETYPE_ID = '" + storeType_id + "' AND CLASS_ID = '" + class_id + "') A " +
|
"(SELECT DISTINCT SKU_ID FROM "+ tableName +" WHERE KEYACCOUNT_ID = '" + keyAccount_id + "' AND STORETYPE_ID = '" + storeType_id + "' AND CLASS_ID = '" + class_id + "') A " +
|
||||||
"ON SK.SKU_ID = A.SKU_ID " +
|
"ON SK.SKU_ID = A.SKU_ID " +
|
||||||
"WHERE CA.CATEGORY_ID = '" + category_id + "'", null);
|
"WHERE CA.CATEGORY_ID = '" + category_id + "'", null);
|
||||||
}
|
}
|
||||||
@@ -4440,14 +4461,14 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
|
|
||||||
// get CATEGORY PICTURE data
|
// get CATEGORY PICTURE data
|
||||||
public ArrayList<CategoryPictureGetterSetter> getCategoryPicturedata(String categoryId, String key_account_id, String store_type_id, String class_id, String store_id) {
|
public ArrayList<CategoryPictureGetterSetter> getCategoryPicturedata(String categoryId, String key_account_id, String store_type_id, String class_id, String store_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(key_account_id!=null){
|
if(key_account_id!=null){
|
||||||
dbcursor = db.rawQuery("SELECT DISTINCT SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM MAPPING_STOCK M INNER JOIN SKU_MASTER SK ON M.SKU_ID = SK.SKU_ID" +
|
dbcursor = db.rawQuery("SELECT DISTINCT SB.SUB_CATEGORY_ID, MIA.IMAGE_ALLOW,SB.SUB_CATEGORY FROM "+ tableName +" M INNER JOIN SKU_MASTER SK ON M.SKU_ID = SK.SKU_ID" +
|
||||||
" INNER JOIN BRAND_MASTER BR ON SK.BRAND_ID = BR.BRAND_ID" +
|
" INNER JOIN BRAND_MASTER BR ON SK.BRAND_ID = BR.BRAND_ID" +
|
||||||
" INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID" +
|
" INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID" +
|
||||||
" INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID" +
|
" INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID = CA.CATEGORY_ID" +
|
||||||
@@ -5051,7 +5072,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
//14-03-2017
|
//14-03-2017
|
||||||
//MSL_Availability_StockFacing
|
//MSL_Availability_StockFacing
|
||||||
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getMSL_Availability_StockFacingHeaderData(
|
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getMSL_Availability_StockFacingHeaderData(
|
||||||
String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id) {
|
String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id, String tableName, String tableMappingSOS) {
|
||||||
|
|
||||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -5060,8 +5081,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
if(keyAccount_id!=null){
|
if(keyAccount_id!=null){
|
||||||
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
||||||
" (SELECT SUM(SOS_TARGET) FROM MAPPING_SOS_TARGET WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
" (SELECT SUM(SOS_TARGET) FROM "+ tableMappingSOS +" WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
||||||
"from MAPPING_STOCK M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -5076,7 +5097,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
||||||
" (SELECT SUM(SOS_TARGET) FROM MAPPING_SOS_TARGET WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
" (SELECT SUM(SOS_TARGET) FROM "+ tableMappingSOS +" WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
||||||
"from MAPPING_STOCK_STOREWISE M " +
|
"from MAPPING_STOCK_STOREWISE 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 " +
|
||||||
@@ -5087,7 +5108,8 @@ 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 + "' AND M.STORE_ID = '" + store_id + "'" +
|
"where CA.CATEGORY_ID='" + category_id + "' AND M.STORE_ID = '" + store_id + "'" +
|
||||||
" order by SB.SUB_CATEGORY,BR.COMPANY_ID,BR.BRAND", null);
|
" order by SB.SUB_CATEGORY, BR.COMPANY_ID,BR.BRAND_SEQUENCE", null);
|
||||||
|
//" order by SB.SUB_CATEGORY,BR.COMPANY_ID,BR.BRAND, BR.BRAND_SEQUENCE", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5135,7 +5157,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getMSL_Availability_StockFacingSKUData(
|
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getMSL_Availability_StockFacingSKUData(
|
||||||
String category_id, String brand_id, String keyAccount_id, String storeType_id, String class_id, String store_id) {
|
String category_id, String brand_id, String keyAccount_id, String storeType_id, String class_id, String store_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -5144,7 +5166,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
if(keyAccount_id!=null){
|
if(keyAccount_id!=null){
|
||||||
dbcursor = db.rawQuery("Select DISTINCT SK.SKU_ID,SK.SKU,SK.MRP,SK.SKU_SEQUENCE,M.MBQ,BR.COMPANY_ID,M.MUST_HAVE " +
|
dbcursor = db.rawQuery("Select DISTINCT SK.SKU_ID,SK.SKU,SK.MRP,SK.SKU_SEQUENCE,M.MBQ,BR.COMPANY_ID,M.MUST_HAVE " +
|
||||||
"from MAPPING_STOCK M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -5736,7 +5758,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
//Stock N Facing
|
//Stock N Facing
|
||||||
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getStockFacingHeaderData(
|
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getStockFacingHeaderData(
|
||||||
String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id) {
|
String category_id, String keyAccount_id, String storeType_id, String class_id, String store_id, String tableName, String tableMappingSOSTarget) {
|
||||||
|
|
||||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -5745,8 +5767,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
if(keyAccount_id!=null){
|
if(keyAccount_id!=null){
|
||||||
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
||||||
" (SELECT SUM(SOS_TARGET) FROM MAPPING_SOS_TARGET WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
" (SELECT SUM(SOS_TARGET) FROM "+ tableMappingSOSTarget +" WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
||||||
"from MAPPING_STOCK M " +
|
"from "+ tableName +" 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 " +
|
||||||
"inner join BRAND_MASTER BR " +
|
"inner join BRAND_MASTER BR " +
|
||||||
@@ -5761,7 +5783,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
dbcursor = db.rawQuery("Select DISTINCT SB.SUB_CATEGORY_ID,SB.SUB_CATEGORY,BR.BRAND_ID,BR.BRAND,BR.COMPANY_ID ," +
|
||||||
" (SELECT SUM(SOS_TARGET) FROM MAPPING_SOS_TARGET WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
" (SELECT SUM(SOS_TARGET) FROM "+ tableMappingSOSTarget +" WHERE STORE_ID = 1 AND BRAND_ID = BR.BRAND_ID)AS SOS_TARGET " +
|
||||||
"from MAPPING_STOCK_STOREWISE M " +
|
"from MAPPING_STOCK_STOREWISE 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 " +
|
||||||
@@ -5926,6 +5948,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("QUESTION_ID", data.getQUESTION_ID());
|
values.put("QUESTION_ID", data.getQUESTION_ID());
|
||||||
values.put("QUESTION", data.getQUESTION());
|
values.put("QUESTION", data.getQUESTION());
|
||||||
values.put("ANSWER_ID", data.getANSWER_ID());
|
values.put("ANSWER_ID", data.getANSWER_ID());
|
||||||
|
values.put("ANSWER", data.getANSWER().replaceAll("[&^<>{}'$]", ""));
|
||||||
values.put("ANSWER_TYPE", data.getANSWER_TYPE());
|
values.put("ANSWER_TYPE", data.getANSWER_TYPE());
|
||||||
values.put("CATEGORY_ID", category_cd);
|
values.put("CATEGORY_ID", category_cd);
|
||||||
values.put("ANS_CAM_IMAGE", data.getCAM_IMAGE());
|
values.put("ANS_CAM_IMAGE", data.getCAM_IMAGE());
|
||||||
@@ -5955,6 +5978,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
sb.setQUESTION_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION_ID")));
|
sb.setQUESTION_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION_ID")));
|
||||||
sb.setQUESTION(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION")));
|
sb.setQUESTION(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION")));
|
||||||
sb.setANSWER_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_ID")));
|
sb.setANSWER_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_ID")));
|
||||||
|
sb.setANSWER(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER")));
|
||||||
sb.setANSWER_TYPE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_TYPE")));
|
sb.setANSWER_TYPE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_TYPE")));
|
||||||
sb.setCATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
sb.setCATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
||||||
sb.setCAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE")));
|
sb.setCAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE")));
|
||||||
@@ -5995,6 +6019,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
sb.setCATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
sb.setCATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
||||||
sb.setCAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE")));
|
sb.setCAM_IMAGE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE")));
|
||||||
sb.setCAM_IMAGE2(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE2")));
|
sb.setCAM_IMAGE2(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANS_CAM_IMAGE2")));
|
||||||
|
sb.setANSWER(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER")));
|
||||||
|
|
||||||
list.add(sb);
|
list.add(sb);
|
||||||
dbcursor.moveToNext();
|
dbcursor.moveToNext();
|
||||||
@@ -6038,13 +6063,20 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Sub Category wise POG
|
//Sub Category wise POG
|
||||||
public ArrayList<POGGetterSetter> getPOGSubCategoryWise(String sub_category_id, String pog_type_id, String store_type_id) {
|
public ArrayList<POGGetterSetter> getPOGSubCategoryWise(String sub_category_id, String pog_type_id, String store_type_id, String planogramType) {
|
||||||
Cursor cursordata = null;
|
Cursor cursordata = null;
|
||||||
ArrayList<POGGetterSetter> pogData = new ArrayList<>();
|
ArrayList<POGGetterSetter> pogData = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(planogramType==null){
|
||||||
|
cursordata = db.rawQuery("Select DISTINCT QUESTION , QUESTION_ID, QTYPE from POG_QUESTION_NEW " + "where SUB_CATEGORY_ID ='" + sub_category_id + "'AND POG_TYPE_ID='" + pog_type_id +"' " +
|
||||||
|
"AND STORETYPE_ID='"+ store_type_id +"'", null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cursordata = db.rawQuery("Select DISTINCT QUESTION , QUESTION_ID, QTYPE from POG_QUESTION_NEW " + "where SUB_CATEGORY_ID ='" + sub_category_id + "'AND POG_TYPE_ID='" + pog_type_id +"' " +
|
||||||
|
"AND STORETYPE_ID='"+ store_type_id +"'AND QTYPE='"+ planogramType +"'", null);
|
||||||
|
}
|
||||||
|
|
||||||
cursordata = db.rawQuery("Select DISTINCT QUESTION , QUESTION_ID, QTYPE from POG_QUESTION_NEW " + "where SUB_CATEGORY_ID ='" + sub_category_id + "'AND POG_TYPE_ID='" + pog_type_id +"' AND STORETYPE_ID='"+ store_type_id +"'", null);
|
|
||||||
|
|
||||||
if (cursordata != null) {
|
if (cursordata != null) {
|
||||||
cursordata.moveToFirst();
|
cursordata.moveToFirst();
|
||||||
@@ -6142,7 +6174,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getSubCategoryMasterForPOG(
|
public ArrayList<MSL_AvailabilityStockFacingGetterSetter> getSubCategoryMasterForPOG(
|
||||||
String category_id, String store_type_id, String pog_type_id) {
|
String category_id, String store_type_id, String pog_type_id, String planogramType) {
|
||||||
|
|
||||||
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
ArrayList<MSL_AvailabilityStockFacingGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
@@ -6150,8 +6182,15 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
//dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID WHERE CATEGORY_ID = '" + category_id + "'", null);
|
//dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID WHERE CATEGORY_ID = '" + category_id + "'", null);
|
||||||
dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION_NEW PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID " +
|
|
||||||
"WHERE CATEGORY_ID = '" + category_id + "' AND POG_TYPE_ID='" + pog_type_id +"' AND STORETYPE_ID='"+ store_type_id +"'", null);
|
if(planogramType==null){
|
||||||
|
dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION_NEW PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID " +
|
||||||
|
"WHERE CATEGORY_ID = '" + category_id + "' AND POG_TYPE_ID='" + pog_type_id +"' AND STORETYPE_ID='"+ store_type_id +"'", null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION_NEW PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID " +
|
||||||
|
"WHERE CATEGORY_ID = '" + category_id + "' AND POG_TYPE_ID='" + pog_type_id +"' AND STORETYPE_ID='"+ store_type_id +"' AND QTYPE='"+ planogramType +"'", null);
|
||||||
|
}
|
||||||
|
|
||||||
if (dbcursor != null) {
|
if (dbcursor != null) {
|
||||||
dbcursor.moveToFirst();
|
dbcursor.moveToFirst();
|
||||||
@@ -6222,6 +6261,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
sb.setQUESTION_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION_ID")));
|
sb.setQUESTION_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION_ID")));
|
||||||
sb.setQUESTION(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION")));
|
sb.setQUESTION(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QUESTION")));
|
||||||
sb.setANSWER_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_ID")));
|
sb.setANSWER_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("ANSWER_ID")));
|
||||||
|
sb.setQTYPE(dbcursor.getString(dbcursor.getColumnIndexOrThrow("QTYPE")));
|
||||||
|
|
||||||
list.add(sb);
|
list.add(sb);
|
||||||
dbcursor.moveToNext();
|
dbcursor.moveToNext();
|
||||||
@@ -6358,6 +6398,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("VISIT_ORDER", data.getVISIT_ORDER().get(i));
|
values.put("VISIT_ORDER", data.getVISIT_ORDER().get(i));
|
||||||
values.put("LATITUDE", data.getLATITUDE().get(i));
|
values.put("LATITUDE", data.getLATITUDE().get(i));
|
||||||
values.put("LONGITUDE", data.getLONGITUDE().get(i));
|
values.put("LONGITUDE", data.getLONGITUDE().get(i));
|
||||||
|
values.put("POG_TYPE_ID", data.getPOG_TYPE_ID().get(i));
|
||||||
|
|
||||||
db.insert("ADHOC_JOURNEYPLAN", null, values);
|
db.insert("ADHOC_JOURNEYPLAN", null, values);
|
||||||
|
|
||||||
@@ -6537,8 +6578,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//NO_CAMERA_LAST_VISIT_DATA
|
//NO_CAMERA_LAST_VISIT_DATA
|
||||||
public void InsertNO_CAMERA_LAST_VISIT_DATA(NoCameraLastVisitGetterSetter data) {
|
public void InsertNO_CAMERA_LAST_VISIT_DATA(NoCameraLastVisitGetterSetter data, String tableName) {
|
||||||
db.delete("NO_CAMERA_LAST_VISIT_DATA", null, null);
|
db.delete(tableName, null, null);
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
try {
|
try {
|
||||||
@@ -6555,7 +6596,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
values.put("FACING", data.getFACING().get(i));
|
values.put("FACING", data.getFACING().get(i));
|
||||||
values.put("IS_VERTICAL", data.getIS_VERTICAL().get(i));
|
values.put("IS_VERTICAL", data.getIS_VERTICAL().get(i));
|
||||||
|
|
||||||
db.insert("NO_CAMERA_LAST_VISIT_DATA", null, values);
|
db.insert(tableName, null, values);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d("Exception ", " in NO_CAMERA_LAST_VISIT_DATA " + ex.toString());
|
Log.d("Exception ", " in NO_CAMERA_LAST_VISIT_DATA " + ex.toString());
|
||||||
@@ -6565,14 +6606,14 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
//get no camera category drag drop
|
//get no camera category drag drop
|
||||||
//get for specific sub category id
|
//get for specific sub category id
|
||||||
public ArrayList<NoCameraDataGetterSetter> getNoCameraLastVisitCategoryData(
|
public ArrayList<NoCameraDataGetterSetter> getNoCameraLastVisitCategoryData(
|
||||||
String store_id, String category_id, String subcategory_id) {
|
String store_id, String category_id, String subcategory_id, String tableName) {
|
||||||
|
|
||||||
ArrayList<NoCameraDataGetterSetter> list = new ArrayList<>();
|
ArrayList<NoCameraDataGetterSetter> list = new ArrayList<>();
|
||||||
Cursor dbcursor = null;
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
dbcursor = db.rawQuery("SELECT * FROM NO_CAMERA_LAST_VISIT_DATA WHERE " + CommonString.KEY_STORE_ID + " = '" + store_id
|
dbcursor = db.rawQuery("SELECT * FROM "+ tableName +" WHERE " + CommonString.KEY_STORE_ID + " = '" + store_id
|
||||||
+ "' AND " + CommonString.KEY_CATEGORY_ID + " ='" + category_id
|
+ "' AND " + CommonString.KEY_CATEGORY_ID + " ='" + category_id
|
||||||
+ "' AND " + CommonString.KEY_SUB_CATEGORY_ID + " ='" + subcategory_id + "'", null);
|
+ "' AND " + CommonString.KEY_SUB_CATEGORY_ID + " ='" + subcategory_id + "'", null);
|
||||||
|
|
||||||
@@ -7263,4 +7304,258 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
|||||||
Log.d("Exception ", " MAPPING_PLANOGRAM_STORE_WISE " + ex.toString());
|
Log.d("Exception ", " MAPPING_PLANOGRAM_STORE_WISE " + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Adhoc is filled
|
||||||
|
public boolean isFilledAdhoc(String store_id, String visitDate) {
|
||||||
|
//Log.d("MAPPING_STOCK_ADHOC ", "MAPPING_STOCK_ADHOC data--------------->Start<------------");
|
||||||
|
ArrayList<JourneyPlanGetterSetter> list = new ArrayList<>();
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_IS_ADHOC_SAVED + " where " +
|
||||||
|
CommonString.KEY_STORE_ID + "='" + store_id + "' AND " +
|
||||||
|
CommonString.KEY_VISIT_DATE + "='" + visitDate + "'", null);
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
if (dbcursor.moveToFirst()) {
|
||||||
|
do {
|
||||||
|
JourneyPlanGetterSetter tp = new JourneyPlanGetterSetter();
|
||||||
|
|
||||||
|
tp.setSTORE_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_STORE_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InsertAdhocFilled(String store_id, String visitDate) {
|
||||||
|
db.delete(CommonString.TABLE_IS_ADHOC_SAVED, null, null);
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
try {
|
||||||
|
|
||||||
|
values.put(CommonString.KEY_STORE_ID, store_id);
|
||||||
|
values.put(CommonString.KEY_VISIT_DATE, visitDate);
|
||||||
|
|
||||||
|
db.insert(CommonString.TABLE_IS_ADHOC_SAVED, null, values);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.d("Exception ", " in "+ CommonString.TABLE_IS_ADHOC_SAVED + ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getPogType(
|
||||||
|
String category_id, String store_type_id, String pog_type_id) {
|
||||||
|
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
//dbcursor = db.rawQuery("SELECT DISTINCT SM.SUB_CATEGORY_ID,SM.SUB_CATEGORY FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID WHERE CATEGORY_ID = '" + category_id + "'", null);
|
||||||
|
dbcursor = db.rawQuery("SELECT DISTINCT PG.QTYPE FROM SUB_CATEGORY_MASTER SM INNER JOIN POG_QUESTION_NEW PG ON SM.SUB_CATEGORY_ID = PG.SUB_CATEGORY_ID " +
|
||||||
|
"WHERE CATEGORY_ID = '" + category_id + "' AND POG_TYPE_ID='" + pog_type_id +"' AND STORETYPE_ID='"+ store_type_id +"'", null);
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
dbcursor.moveToFirst();
|
||||||
|
while (!dbcursor.isAfterLast()) {
|
||||||
|
String qType;
|
||||||
|
|
||||||
|
qType = dbcursor.getString(dbcursor.getColumnIndexOrThrow("QTYPE"));
|
||||||
|
|
||||||
|
list.add(qType);
|
||||||
|
dbcursor.moveToNext();
|
||||||
|
}
|
||||||
|
dbcursor.close();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception ", "get MSL_AvailabilityHeader!" + e.toString());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//insert Counterfeit Product
|
||||||
|
public void InsertCounterfeitProductData(ArrayList<CounterfeitProductGetterSetter> counterfeitProductListData, String category_id, String store_id, boolean exists) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT, "STORE_ID = '"+ store_id +"' AND CATEGORY_ID ='"+ category_id +"'", null);
|
||||||
|
db.delete(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS, "STORE_ID = '"+ store_id +"' AND CATEGORY_ID ='"+ category_id +"'", null);
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
ContentValues values1 = new ContentValues();
|
||||||
|
int existexist_int = 0;
|
||||||
|
|
||||||
|
if(exists){
|
||||||
|
existexist_int = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
values1.put("STORE_ID", Integer.parseInt(store_id));
|
||||||
|
values1.put("CATEGORY_ID", Integer.parseInt(category_id));
|
||||||
|
values1.put("Existss", existexist_int);
|
||||||
|
|
||||||
|
long id = db.insert(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS, null, values1);
|
||||||
|
|
||||||
|
|
||||||
|
db.beginTransaction();
|
||||||
|
for (int i = 0; i < counterfeitProductListData.size(); i++) {
|
||||||
|
CounterfeitProductGetterSetter data = counterfeitProductListData.get(i);
|
||||||
|
|
||||||
|
values.put("STORE_ID", Integer.parseInt(store_id));
|
||||||
|
values.put("CATEGORY_ID", Integer.parseInt(category_id));
|
||||||
|
values.put("BRAND_ID", data.getBrandId());
|
||||||
|
values.put("BRAND", data.getBrand());
|
||||||
|
values.put("SKU", data.getSkuName());
|
||||||
|
values.put("STOCK", data.getStock());
|
||||||
|
values.put("IMAGE", data.getImgStr());
|
||||||
|
values.put("IMAGE1", data.getImgStr1());
|
||||||
|
values.put("IMAGE2", data.getImgStr2());
|
||||||
|
values.put("COMMON_ID", id);
|
||||||
|
|
||||||
|
db.insert(CommonString.TABLE_INSERT_COUNTERFEIT_PRODUCT, null, values);
|
||||||
|
}
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
db.endTransaction();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.d("Exception ", "Counterfeit Data " + ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get Counterfeit Product inserted data
|
||||||
|
public ArrayList<CounterfeitProductGetterSetter> getCounterfeitProductExistsAfterData(String store_id, String category_id) {
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> list = new ArrayList<>();
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(category_id==null){
|
||||||
|
dbcursor = db.rawQuery("Select * from COUNTERFEIT_PRODUCT_EXISTS " +
|
||||||
|
"where STORE_ID='" + store_id + "'", null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dbcursor = db.rawQuery("Select * from COUNTERFEIT_PRODUCT_EXISTS " +
|
||||||
|
"where STORE_ID='" + store_id + "' AND CATEGORY_ID='" + category_id + "'", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
dbcursor.moveToFirst();
|
||||||
|
while (!dbcursor.isAfterLast()) {
|
||||||
|
CounterfeitProductGetterSetter cd = new CounterfeitProductGetterSetter();
|
||||||
|
|
||||||
|
cd.setExists(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Existss")).equals("1"));
|
||||||
|
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
||||||
|
cd.set_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("KEY_ID")));
|
||||||
|
|
||||||
|
list.add(cd);
|
||||||
|
dbcursor.moveToNext();
|
||||||
|
}
|
||||||
|
dbcursor.close();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception ", "getCounterfeitAfterData!" + e.toString());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<CounterfeitProductGetterSetter> getCounterfeitProductAfterData(String store_id, String category_id) {
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> list = new ArrayList<>();
|
||||||
|
Cursor dbcursor = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(category_id==null){
|
||||||
|
//common_id is passed in variable store_id in this case
|
||||||
|
dbcursor = db.rawQuery("Select * from COUNTERFEIT_PRODUCT " +
|
||||||
|
"where COMMON_ID='" + store_id + "'", null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dbcursor = db.rawQuery("Select * from COUNTERFEIT_PRODUCT " +
|
||||||
|
"where STORE_ID='" + store_id + "' AND CATEGORY_ID='" + category_id + "'", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbcursor != null) {
|
||||||
|
dbcursor.moveToFirst();
|
||||||
|
while (!dbcursor.isAfterLast()) {
|
||||||
|
CounterfeitProductGetterSetter cd = new CounterfeitProductGetterSetter();
|
||||||
|
|
||||||
|
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("CATEGORY_ID")));
|
||||||
|
cd.setSkuName(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SKU")));
|
||||||
|
cd.setBrandId(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("BRAND_ID")));
|
||||||
|
cd.setBrand(dbcursor.getString(dbcursor.getColumnIndexOrThrow("BRAND")));
|
||||||
|
cd.setStock(dbcursor.getInt(dbcursor.getColumnIndexOrThrow("STOCK")));
|
||||||
|
cd.setImgStr(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE")));
|
||||||
|
cd.setImgStr1(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE1")));
|
||||||
|
cd.setImgStr2(dbcursor.getString(dbcursor.getColumnIndexOrThrow("IMAGE2")));
|
||||||
|
|
||||||
|
list.add(cd);
|
||||||
|
dbcursor.moveToNext();
|
||||||
|
}
|
||||||
|
dbcursor.close();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception ", "getPromoComplianceSkuwiseAfterData!" + e.toString());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<BrandMasterGetterSetter> getBrandData(String category_id) {
|
||||||
|
Cursor cursordata = null;
|
||||||
|
ArrayList<BrandMasterGetterSetter> Data = new ArrayList<BrandMasterGetterSetter>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
cursordata = db.rawQuery("SELECT DISTINCT BR.BRAND_ID, BR.BRAND FROM BRAND_MASTER BR " +
|
||||||
|
"INNER JOIN SUB_CATEGORY_MASTER SB ON BR.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
||||||
|
"INNER JOIN CATEGORY_MASTER CA ON SB.CATEGORY_ID =CA.CATEGORY_ID WHERE COMPANY_ID =1 AND SB.CATEGORY_ID ='" + category_id + "'", null);
|
||||||
|
|
||||||
|
if (cursordata != null) {
|
||||||
|
cursordata.moveToFirst();
|
||||||
|
while (!cursordata.isAfterLast()) {
|
||||||
|
BrandMasterGetterSetter sb = new BrandMasterGetterSetter();
|
||||||
|
|
||||||
|
sb.setBRAND_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_ID")));
|
||||||
|
|
||||||
|
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.setCOMPANY_ID(cursordata.getString(cursordata.getColumnIndexOrThrow("COMPANY_ID")));
|
||||||
|
|
||||||
|
sb.setBRAND_SEQUENCE(cursordata.getString(cursordata.getColumnIndexOrThrow("BRAND_SEQUENCE")));*/
|
||||||
|
|
||||||
|
Data.add(sb);
|
||||||
|
cursordata.moveToNext();
|
||||||
|
}
|
||||||
|
cursordata.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return Data;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans;
|
|||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.dailyentry.StoreimageActivity;
|
||||||
import cpm.com.gskmtorange.messgae.AlertMessage;
|
import cpm.com.gskmtorange.messgae.AlertMessage;
|
||||||
import cpm.com.gskmtorange.upload.Base64;
|
import cpm.com.gskmtorange.upload.Base64;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||||
@@ -102,7 +103,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
FloatingActionButton fab, fabcarmabtn;
|
FloatingActionButton fab, fabcarmabtn;
|
||||||
SupportMapFragment mapFragment;
|
SupportMapFragment mapFragment;
|
||||||
SharedPreferences preferences;
|
SharedPreferences preferences;
|
||||||
String username, storeid, str, storename, visitData;
|
String username, storeid, str, visitData, store_flag_str;//storename;
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
LocationManager locationManager;
|
LocationManager locationManager;
|
||||||
Geocoder geocoder;
|
Geocoder geocoder;
|
||||||
@@ -144,9 +145,11 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(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);
|
||||||
visitData = preferences.getString(CommonString.KEY_VISIT_DATE, null);
|
visitData = preferences.getString(CommonString.KEY_DATE, null);
|
||||||
|
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
|
||||||
|
storeid = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
|
||||||
|
|
||||||
|
|
||||||
final PackageManager packageManager = getPackageManager();
|
final PackageManager packageManager = getPackageManager();
|
||||||
@@ -235,7 +238,12 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!img_str.equalsIgnoreCase("")) {
|
if (!img_str.equalsIgnoreCase("")) {
|
||||||
status = "Y";
|
status = "Y";
|
||||||
db.updateStatus(storeid, status, latitude, longitude);
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
db.updateStatus(storeid, status, latitude, longitude, CommonString.KEY_ADHOC_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
db.updateStatus(storeid, status, latitude, longitude, CommonString.KEY_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
|
|
||||||
db.InsertSTOREgeotag(storeid, latitude, longitude, img_str, status);
|
db.InsertSTOREgeotag(storeid, latitude, longitude, img_str, status);
|
||||||
img_str = "";
|
img_str = "";
|
||||||
@@ -268,7 +276,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
_pathforcheck = storeid +"GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
_pathforcheck = storeid + "GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
||||||
|
|
||||||
_path = CommonString.FILE_PATH + _pathforcheck;
|
_path = CommonString.FILE_PATH + _pathforcheck;
|
||||||
|
|
||||||
@@ -290,7 +298,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
||||||
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.notsuppoted)
|
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
|
||||||
, Toast.LENGTH_LONG)
|
, Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
finish();
|
finish();
|
||||||
@@ -338,6 +346,16 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
@Override
|
@Override
|
||||||
public void onConnected(Bundle bundle) {
|
public void onConnected(Bundle bundle) {
|
||||||
|
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// TODO: Consider calling
|
||||||
|
// ActivityCompat#requestPermissions
|
||||||
|
// here to request the missing permissions, and then overriding
|
||||||
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||||
|
// int[] grantResults)
|
||||||
|
// to handle the case where the user grants the permission. See the documentation
|
||||||
|
// for ActivityCompat#requestPermissions for more details.
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
@@ -568,9 +586,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
if (new File(str + _pathforcheck).exists()) {
|
if (new File(str + _pathforcheck).exists()) {
|
||||||
|
|
||||||
|
|
||||||
fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.mipmap.camera_icon_done));
|
fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.mipmap.camera_green));
|
||||||
|
|
||||||
fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC")));
|
//fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC")));
|
||||||
|
|
||||||
img_str = _pathforcheck;
|
img_str = _pathforcheck;
|
||||||
_pathforcheck = "";
|
_pathforcheck = "";
|
||||||
@@ -707,8 +725,12 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
for (int i = 0; i < geotaglist.size(); i++) {
|
for (int i = 0; i < geotaglist.size(); i++) {
|
||||||
db.updateGeoTagData(geotaglist.get(i).storeid, statusD);
|
db.updateGeoTagData(geotaglist.get(i).storeid, statusD);
|
||||||
|
|
||||||
db.updateDataStatus(geotaglist.get(i).getStoreid(), statusD);
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
db.updateDataStatus(geotaglist.get(i).getStoreid(), statusD, CommonString.KEY_ADHOC_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
db.updateDataStatus(geotaglist.get(i).getStoreid(), statusD, CommonString.KEY_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -748,7 +770,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
GeoTagActivity.this,
|
GeoTagActivity.this,
|
||||||
GeoTagStoreList.class);
|
StoreimageActivity.class);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_ID, storeid);
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
@@ -762,7 +786,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
GeoTagActivity.this,
|
GeoTagActivity.this,
|
||||||
GeoTagStoreList.class);
|
StoreimageActivity.class);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_ID, storeid);
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
@@ -929,7 +955,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
Crashlytics.logException(new Exception(e.getCause()));
|
Crashlytics.logException(new Exception(e.getCause()));
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
GeoTagActivity.this,
|
GeoTagActivity.this,
|
||||||
GeoTagStoreList.class);
|
StoreimageActivity.class);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_ID, storeid);
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
@@ -961,7 +989,13 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
|
|
||||||
db.updateGeoTagData(geotaglistImage.get(i).getStoreid(), Statustag);
|
db.updateGeoTagData(geotaglistImage.get(i).getStoreid(), Statustag);
|
||||||
|
|
||||||
db.updateDataStatus(geotaglistImage.get(i).getStoreid(), Statustag);
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
db.updateDataStatus(geotaglistImage.get(i).getStoreid(), Statustag, CommonString.KEY_ADHOC_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
db.updateDataStatus(geotaglistImage.get(i).getStoreid(), Statustag, CommonString.KEY_JOURNEY_PLAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
db.deleteGeoTagData(geotaglistImage.get(i).getStoreid());
|
db.deleteGeoTagData(geotaglistImage.get(i).getStoreid());
|
||||||
|
|
||||||
@@ -976,7 +1010,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
|
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
GeoTagActivity.this,
|
GeoTagActivity.this,
|
||||||
GeoTagStoreList.class);
|
StoreimageActivity.class);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_ID, storeid);
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
@@ -995,7 +1031,9 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
|
|||||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.failure),Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(),getResources().getString(R.string.failure),Toast.LENGTH_LONG).show();
|
||||||
Intent intent = new Intent(
|
Intent intent = new Intent(
|
||||||
GeoTagActivity.this,
|
GeoTagActivity.this,
|
||||||
GeoTagStoreList.class);
|
StoreimageActivity.class);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_FLAG, store_flag_str);
|
||||||
|
intent.putExtra(CommonString.KEY_STORE_ID, storeid);
|
||||||
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
|
|||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|||||||
@@ -4,13 +4,17 @@ import android.Manifest;
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentSender;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationManager;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -32,8 +36,22 @@ import android.widget.AutoCompleteTextView;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
|
import com.google.android.gms.common.api.PendingResult;
|
||||||
|
import com.google.android.gms.common.api.ResultCallback;
|
||||||
|
import com.google.android.gms.common.api.Status;
|
||||||
|
import com.google.android.gms.location.LocationListener;
|
||||||
|
import com.google.android.gms.location.LocationRequest;
|
||||||
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.google.android.gms.location.LocationSettingsRequest;
|
||||||
|
import com.google.android.gms.location.LocationSettingsResult;
|
||||||
|
import com.google.android.gms.location.LocationSettingsStatusCodes;
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.google.firebase.perf.FirebasePerformance;
|
import com.google.firebase.perf.FirebasePerformance;
|
||||||
import com.google.firebase.perf.metrics.Trace;
|
import com.google.firebase.perf.metrics.Trace;
|
||||||
@@ -62,6 +80,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import cpm.com.gskmtorange.autoupdate.AutoUpdateActivity;
|
import cpm.com.gskmtorange.autoupdate.AutoUpdateActivity;
|
||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.password.MPinActivity;
|
||||||
import cpm.com.gskmtorange.upload.UploadImageWithRetrofit;
|
import cpm.com.gskmtorange.upload.UploadImageWithRetrofit;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||||
@@ -73,7 +92,7 @@ import static android.Manifest.permission.READ_CONTACTS;
|
|||||||
/**
|
/**
|
||||||
* A login screen that offers login via userid/password.
|
* A login screen that offers login via userid/password.
|
||||||
*/
|
*/
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||||
|
|
||||||
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10;
|
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10;
|
||||||
private static final int MY_PERMISSIONS_REQUEST_LOCATION = 11;
|
private static final int MY_PERMISSIONS_REQUEST_LOCATION = 11;
|
||||||
@@ -105,8 +124,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
"foo@example.com:hello", "bar@example.com:world"
|
"foo@example.com:hello", "bar@example.com:world"
|
||||||
};
|
};
|
||||||
|
|
||||||
String lat = "0.0";
|
double lat = 0.0;
|
||||||
String lon = "0.0";
|
double lon = 0.0;
|
||||||
|
|
||||||
// UI references.
|
// UI references.
|
||||||
private AutoCompleteTextView museridView;
|
private AutoCompleteTextView museridView;
|
||||||
@@ -124,6 +143,16 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Trace myTrace;
|
Trace myTrace;
|
||||||
|
|
||||||
|
GoogleApiClient mGoogleApiClient;
|
||||||
|
private static int UPDATE_INTERVAL = 200; // 5 sec
|
||||||
|
private static int FATEST_INTERVAL = 100; // 1 sec
|
||||||
|
private static int DISPLACEMENT = 1; // 10 meters
|
||||||
|
private static final int REQUEST_LOCATION = 1;
|
||||||
|
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
|
||||||
|
private Location mLastLocation;
|
||||||
|
private LocationRequest mLocationRequest;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -133,6 +162,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
setContentView(R.layout.activity_login);
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
|
context = this;
|
||||||
|
|
||||||
// Obtain the FirebaseAnalytics instance.
|
// Obtain the FirebaseAnalytics instance.
|
||||||
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||||
|
|
||||||
@@ -187,8 +218,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
museridSignInButton.setOnClickListener(new OnClickListener() {
|
museridSignInButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
|
//checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
|
||||||
//attemptLogin();
|
attemptLogin();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -207,6 +238,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
file_planogram.mkdir();
|
file_planogram.mkdir();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private void populateAutoComplete() {
|
/* private void populateAutoComplete() {
|
||||||
@@ -239,19 +272,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback received when a permissions request has been completed.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
|
||||||
@NonNull int[] grantResults) {
|
|
||||||
if (requestCode == REQUEST_READ_CONTACTS) {
|
|
||||||
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
//populateAutoComplete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to sign in or register the account specified by the login form.
|
* Attempts to sign in or register the account specified by the login form.
|
||||||
@@ -574,7 +594,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
|
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
|
||||||
|
|
||||||
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
|
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
|
||||||
|
|
||||||
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
|
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
|
||||||
|
//editor.putString(CommonString.KEY_DATE, "01/25/2019");
|
||||||
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
|
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
|
||||||
|
|
||||||
editor.commit();
|
editor.commit();
|
||||||
@@ -677,10 +699,15 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
Intent intent = new Intent(getBaseContext(),
|
/*Intent intent = new Intent(getBaseContext(),
|
||||||
MainActivity.class);
|
MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
|
finish();*/
|
||||||
|
|
||||||
|
Intent in = new Intent(getApplicationContext(), MPinActivity.class);
|
||||||
|
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
|
||||||
|
startActivity(in);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
//uploadPreviousImages();
|
//uploadPreviousImages();
|
||||||
@@ -699,8 +726,29 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
//For SA Only
|
||||||
|
/*if (preferences.getString(CommonString.KEY_LANGUAGE, "").equals("")) {
|
||||||
|
|
||||||
|
Intent intent = new Intent(getBaseContext(),
|
||||||
|
SelectLanguageActivity.class);
|
||||||
|
|
||||||
|
intent.putExtra(CommonString.KEY_LOGIN_DATA, lgs);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
|
Intent intent = new Intent(getBaseContext(),
|
||||||
|
MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
|
||||||
|
//uploadPreviousImages();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,12 +810,12 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
return cdate;
|
return cdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadPreviousImages(){
|
public void uploadPreviousImages() {
|
||||||
try {
|
try {
|
||||||
File f = new File(CommonString.FILE_PATH);
|
File f = new File(CommonString.FILE_PATH);
|
||||||
if(f!=null){
|
if (f != null) {
|
||||||
File file[] = f.listFiles();
|
File file[] = f.listFiles();
|
||||||
if(file!=null && file.length>0){
|
if (file != null && file.length > 0) {
|
||||||
String newPattern = "EEE MMM dd HH:mm:ss Z yyyy";
|
String newPattern = "EEE MMM dd HH:mm:ss Z yyyy";
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(newPattern, Locale.ENGLISH);
|
SimpleDateFormat sdf = new SimpleDateFormat(newPattern, Locale.ENGLISH);
|
||||||
|
|
||||||
@@ -779,7 +827,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Date visitdate = sdf.parse(formattedDate);
|
Date visitdate = sdf.parse(formattedDate);
|
||||||
|
|
||||||
for (int i=0;i<file.length;i++){
|
for (int i = 0; i < file.length; i++) {
|
||||||
Date lastModDate = new Date(file[i].lastModified());
|
Date lastModDate = new Date(file[i].lastModified());
|
||||||
String day = lastModDate.toString();
|
String day = lastModDate.toString();
|
||||||
//String day = "Sun Apr 01 22:20:48 GMT+05:30 2018";
|
//String day = "Sun Apr 01 22:20:48 GMT+05:30 2018";
|
||||||
@@ -787,9 +835,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
long diff = visitdate.getTime() - file_date.getTime();
|
long diff = visitdate.getTime() - file_date.getTime();
|
||||||
System.out.println ("Days: " + TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS));
|
System.out.println("Days: " + TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS));
|
||||||
long difference = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
|
long difference = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
|
||||||
if(difference>12){
|
if (difference > 12) {
|
||||||
file[i].delete();
|
file[i].delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,24 +845,21 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
date = spf.format(newDate);
|
date = spf.format(newDate);
|
||||||
System.out.println(date);*/
|
System.out.println(date);*/
|
||||||
}
|
}
|
||||||
if(file.length>0){
|
if (file.length > 0) {
|
||||||
UploadImageWithRetrofit.uploadedFiles = 0;
|
UploadImageWithRetrofit.uploadedFiles = 0;
|
||||||
UploadImageWithRetrofit.totalFiles = file.length;
|
UploadImageWithRetrofit.totalFiles = file.length;
|
||||||
UploadImageWithRetrofit uploadImg = new UploadImageWithRetrofit( "", userid,LoginActivity.this);
|
UploadImageWithRetrofit uploadImg = new UploadImageWithRetrofit("", userid, LoginActivity.this);
|
||||||
//uploadImg.UploadImageRecursive(LoginActivity.this);
|
//uploadImg.UploadImageRecursive(LoginActivity.this);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendToMain();
|
sendToMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendToMain();
|
sendToMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendToMain();
|
sendToMain();
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@@ -825,11 +870,11 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToMain(){
|
public void sendToMain() {
|
||||||
// Check if no view has focus:
|
// Check if no view has focus:
|
||||||
View view = this.getCurrentFocus();
|
View view = this.getCurrentFocus();
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +943,29 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
file_planogram.mkdir();
|
file_planogram.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
attemptLogin();
|
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
|
||||||
|
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||||
|
ContextCompat.checkSelfPermission(getApplicationContext(),
|
||||||
|
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkPlayServices()) {
|
||||||
|
// Building the GoogleApi client
|
||||||
|
buildGoogleApiClient();
|
||||||
|
|
||||||
|
createLocationRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an instance of GoogleAPIClient.
|
||||||
|
if (mGoogleApiClient == null) {
|
||||||
|
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
//attemptLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -931,5 +998,223 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
});*/
|
});*/
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
|
||||||
|
}
|
||||||
|
checkgpsEnableDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
|
||||||
|
checkAppPermission(Manifest.permission.CAMERA, MY_PERMISSIONS_REQUEST_CAMERA);
|
||||||
|
|
||||||
|
/*if (requestCode == PERMISSIONS_REQUEST_READ_PHONE_STATE
|
||||||
|
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
imeiNumbers = imei.getDeviceImei();
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
|
||||||
|
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||||
|
ContextCompat.checkSelfPermission(getApplicationContext(),
|
||||||
|
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkPlayServices()) {
|
||||||
|
// Building the GoogleApi client
|
||||||
|
buildGoogleApiClient();
|
||||||
|
|
||||||
|
createLocationRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an instance of GoogleAPIClient.
|
||||||
|
if (mGoogleApiClient == null) {
|
||||||
|
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkPlayServices() {
|
||||||
|
int resultCode = GooglePlayServicesUtil
|
||||||
|
.isGooglePlayServicesAvailable(this);
|
||||||
|
if (resultCode != ConnectionResult.SUCCESS) {
|
||||||
|
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
|
||||||
|
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
||||||
|
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
|
||||||
|
, Toast.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected synchronized void buildGoogleApiClient() {
|
||||||
|
if (mGoogleApiClient == null) {
|
||||||
|
mGoogleApiClient = new GoogleApiClient.Builder(context)
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this)
|
||||||
|
.addApi(LocationServices.API)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createLocationRequest() {
|
||||||
|
mLocationRequest = new LocationRequest();
|
||||||
|
mLocationRequest.setInterval(UPDATE_INTERVAL);
|
||||||
|
mLocationRequest.setFastestInterval(FATEST_INTERVAL);
|
||||||
|
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||||
|
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionSuspended(int i) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||||
|
|
||||||
|
// Toast.makeText(this, " WORKS_lat_lon " + latLng, Toast.LENGTH_LONG).show();
|
||||||
|
// updateLocation(latLng);
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startLocationUpdates() {
|
||||||
|
|
||||||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
|
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
|
||||||
|
// Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int distFrom(double lat1, double lng1, double lat2, double lng2) {
|
||||||
|
double earthRadius = 6371000; //meters
|
||||||
|
double dLat = Math.toRadians(lat2 - lat1);
|
||||||
|
double dLng = Math.toRadians(lng2 - lng1);
|
||||||
|
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||||
|
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
|
||||||
|
Math.sin(dLng / 2) * Math.sin(dLng / 2);
|
||||||
|
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||||
|
int dist = (int) (earthRadius * c);
|
||||||
|
|
||||||
|
return dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnected(Bundle bundle) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// TODO: Consider calling
|
||||||
|
// ActivityCompat#requestPermissions
|
||||||
|
// here to request the missing permissions, and then overriding
|
||||||
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||||
|
// int[] grantResults)
|
||||||
|
// to handle the case where the user grants the permission. See the documentation
|
||||||
|
// for ActivityCompat#requestPermissions for more details.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
|
|| ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
if (mLastLocation != null) {
|
||||||
|
lat = mLastLocation.getLatitude();
|
||||||
|
lon = mLastLocation.getLongitude();
|
||||||
|
// Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
startLocationUpdates();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(ConnectionResult connectionResult) {
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkgpsEnableDevice() {
|
||||||
|
boolean flag = true;
|
||||||
|
if (!hasGPSDevice(context)) {
|
||||||
|
Toast.makeText(context, "Gps not Supported", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER) && hasGPSDevice(context)) {
|
||||||
|
enableLoc();
|
||||||
|
flag = false;
|
||||||
|
} else if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER) && hasGPSDevice(context)) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasGPSDevice(Context context) {
|
||||||
|
final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
if (mgr == null)
|
||||||
|
return false;
|
||||||
|
final List<String> providers = mgr.getAllProviders();
|
||||||
|
if (providers == null)
|
||||||
|
return false;
|
||||||
|
return providers.contains(LocationManager.GPS_PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableLoc() {
|
||||||
|
LocationRequest locationRequest = LocationRequest.create();
|
||||||
|
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||||
|
locationRequest.setInterval(30 * 1000);
|
||||||
|
locationRequest.setFastestInterval(5 * 1000);
|
||||||
|
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest);
|
||||||
|
builder.setAlwaysShow(true);
|
||||||
|
if (mGoogleApiClient != null) {
|
||||||
|
PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build());
|
||||||
|
result.setResultCallback(new ResultCallback<LocationSettingsResult>() {
|
||||||
|
@Override
|
||||||
|
public void onResult(LocationSettingsResult result) {
|
||||||
|
final Status status = result.getStatus();
|
||||||
|
switch (status.getStatusCode()) {
|
||||||
|
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
|
||||||
|
try {
|
||||||
|
// Show the dialog by calling startResolutionForResult(),
|
||||||
|
// and check the result in onActivityResult().
|
||||||
|
status.startResolutionForResult((Activity) context, REQUEST_LOCATION);
|
||||||
|
} catch (IntentSender.SendIntentException e) {
|
||||||
|
// Ignore the error.
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,9 @@ import android.content.pm.PackageManager;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
@@ -25,7 +22,6 @@ import android.support.v4.widget.DrawerLayout;
|
|||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -34,15 +30,11 @@ import android.webkit.WebView;
|
|||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
|
||||||
@@ -57,9 +49,9 @@ import cpm.com.gskmtorange.dailyentry.ServiceActivity;
|
|||||||
import cpm.com.gskmtorange.dailyentry.SettingsActivity;
|
import cpm.com.gskmtorange.dailyentry.SettingsActivity;
|
||||||
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
import cpm.com.gskmtorange.dailyentry.StoreListActivity;
|
||||||
import cpm.com.gskmtorange.download.DownloadActivity;
|
import cpm.com.gskmtorange.download.DownloadActivity;
|
||||||
|
import cpm.com.gskmtorange.password.ChangePasswordActivity;
|
||||||
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
|
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
|
||||||
import cpm.com.gskmtorange.upload.UploadActivity;
|
import cpm.com.gskmtorange.upload.UploadActivity;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationContrywiseGetterSetter;
|
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
|
||||||
import io.fabric.sdk.android.Fabric;
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
@@ -148,9 +140,19 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
TextView tv_username = (TextView) headerView.findViewById(R.id.nav_user_name);
|
TextView tv_username = (TextView) headerView.findViewById(R.id.nav_user_name);
|
||||||
//tv_usertype = (TextView) headerView.findViewById(R.id.nav_user_type);
|
//tv_usertype = (TextView) headerView.findViewById(R.id.nav_user_type);
|
||||||
|
ImageView img_change_password = (ImageView) headerView.findViewById(R.id.img_change_password);
|
||||||
|
|
||||||
tv_username.setText(user_name);
|
tv_username.setText(user_name);
|
||||||
//tv_usertype.setText(user_type);
|
//tv_usertype.setText(user_type);
|
||||||
|
|
||||||
|
img_change_password.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent in = new Intent(getApplicationContext(), ChangePasswordActivity.class);
|
||||||
|
startActivity(in);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
navigationView.addHeaderView(headerView);
|
navigationView.addHeaderView(headerView);
|
||||||
|
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
@@ -194,6 +196,10 @@ public class MainActivity extends AppCompatActivity
|
|||||||
nav_Menu.findItem(R.id.nav_deviation).setVisible(true);
|
nav_Menu.findItem(R.id.nav_deviation).setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//temp remove it
|
||||||
|
/* Menu nav_Menu1 = navigationView.getMenu();
|
||||||
|
nav_Menu1.findItem(R.id.nav_deviation).setVisible(true);*/
|
||||||
|
|
||||||
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("PDF ALLOW") &&
|
if (configurationData.get(i).getCONFIGURE().get(0).equalsIgnoreCase("PDF ALLOW") &&
|
||||||
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
|
configurationData.get(i).getACTIVE().get(0).equalsIgnoreCase("1")) {
|
||||||
Menu nav_Menu = navigationView.getMenu();
|
Menu nav_Menu = navigationView.getMenu();
|
||||||
@@ -254,9 +260,6 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
if (id == R.id.nav_route_plan) {
|
if (id == R.id.nav_route_plan) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Intent in_jcp = new Intent(this, StoreListActivity.class);
|
Intent in_jcp = new Intent(this, StoreListActivity.class);
|
||||||
in_jcp.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_JCP);
|
in_jcp.putExtra(CommonString.KEY_STORE_FLAG, CommonString.FROM_JCP);
|
||||||
startActivity(in_jcp);
|
startActivity(in_jcp);
|
||||||
@@ -269,46 +272,63 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
} else if (id == R.id.nav_upload) {
|
} else if (id == R.id.nav_upload) {
|
||||||
|
|
||||||
db.open();
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
|
builder.setMessage(getResources().getString(R.string.want_to_upload)).setCancelable(false)
|
||||||
|
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
if (checkNetIsAvailable()) {
|
db.open();
|
||||||
|
|
||||||
//Alert need to change this check so than user can work on Adhoc even having no JCP
|
if (checkNetIsAvailable()) {
|
||||||
//storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
|
|
||||||
|
|
||||||
if (db.getSKUMasterData(null).size() == 0) {
|
//Alert need to change this check so than user can work on Adhoc even having no JCP
|
||||||
|
//storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
|
||||||
|
|
||||||
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
|
if (db.getSKUMasterData(null).size() == 0) {
|
||||||
.setAction("Action", null).show();
|
|
||||||
|
|
||||||
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
|
Snackbar.make(webView, R.string.title_store_list_download_data, Snackbar.LENGTH_SHORT)
|
||||||
} else {
|
.setAction("Action", null).show();
|
||||||
|
|
||||||
if (coverageList.size() == 0) {
|
// Toast.makeText(getBaseContext(), "Please Download Data First", Toast.LENGTH_LONG).show();
|
||||||
Snackbar.make(webView, R.string.no_data_for_upload, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
} else {
|
||||||
|
|
||||||
} else {
|
if (coverageList.size() == 0) {
|
||||||
if (isStoreCheckedIn() && isValid()) {
|
Snackbar.make(webView, R.string.no_data_for_upload, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||||
|
|
||||||
Intent i = new Intent(getBaseContext(), UploadActivity.class);
|
} else {
|
||||||
startActivity(i);
|
if (isStoreCheckedIn() && isValid()) {
|
||||||
|
|
||||||
//finish();
|
Intent i = new Intent(getBaseContext(), UploadActivity.class);
|
||||||
} else {
|
startActivity(i);
|
||||||
Snackbar.make(webView, error_msg, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
|
||||||
|
//finish();
|
||||||
|
} else {
|
||||||
|
Snackbar.make(webView, error_msg, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
|
||||||
|
// Toast.makeText(getApplicationContext(), "No Network Available", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
|
|
||||||
.setAction("Action", null).show();
|
|
||||||
|
|
||||||
// Toast.makeText(getApplicationContext(), "No Network Available", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} else if (id == R.id.nav_geotag) {
|
} else if (id == R.id.nav_geotag) {
|
||||||
|
|
||||||
|
|
||||||
@@ -324,6 +344,28 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
} else if (id == R.id.nav_exit) {
|
} else if (id == R.id.nav_exit) {
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
|
builder.setMessage(getResources().getString(R.string.want_to_exit)).setCancelable(false)
|
||||||
|
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
/* Intent startDownload = new Intent(this, LoginActivity.class);
|
||||||
|
startActivity(startDownload);*/
|
||||||
|
ActivityCompat.finishAffinity(MainActivity.this);
|
||||||
|
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
|
||||||
/* try {
|
/* try {
|
||||||
int i = 1/0;
|
int i = 1/0;
|
||||||
}
|
}
|
||||||
@@ -338,12 +380,6 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
// finish();
|
// finish();
|
||||||
|
|
||||||
Intent startDownload = new Intent(this, LoginActivity.class);
|
|
||||||
startActivity(startDownload);
|
|
||||||
|
|
||||||
ActivityCompat.finishAffinity(this);
|
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
|
|
||||||
} else if (id == R.id.nav_setting) {
|
} else if (id == R.id.nav_setting) {
|
||||||
|
|
||||||
@@ -475,7 +511,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
storestatus = store_data.getUPLOAD_STATUS();
|
storestatus = store_data.getUPLOAD_STATUS();
|
||||||
String coverage_status = store_data.getCHECKOUT_STATUS();
|
String coverage_status = store_data.getCHECKOUT_STATUS();
|
||||||
|
|
||||||
if (!storestatus.equalsIgnoreCase(CommonString.KEY_U)) {
|
if (!storestatus.equalsIgnoreCase(CommonString.KEY_U) && !storestatus.equalsIgnoreCase(CommonString.KEY_UN)) {
|
||||||
if ((coverage_status.equalsIgnoreCase(CommonString.KEY_Y) || storestatus.equalsIgnoreCase(CommonString.KEY_P) ||
|
if ((coverage_status.equalsIgnoreCase(CommonString.KEY_Y) || storestatus.equalsIgnoreCase(CommonString.KEY_P) ||
|
||||||
storestatus.equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE))) {
|
storestatus.equalsIgnoreCase(CommonString.STORE_STATUS_LEAVE))) {
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -493,12 +529,12 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
public boolean isPreviousValid(String visit_date) {
|
public boolean isPreviousValid(String visit_date) {
|
||||||
boolean isvalid = false;
|
boolean isvalid = false;
|
||||||
ArrayList<CoverageBean> coverage_list = db.getPreviousCoverageData(visit_date);
|
ArrayList<CoverageBean> coverage_list = db.getPreviousCoverageData(visit_date, null);
|
||||||
for (int i = 0; i < coverage_list.size(); i++) {
|
for (int i = 0; i < coverage_list.size(); i++) {
|
||||||
StoreBean storeData = db.getSpecificStoreData(coverage_list.get(i).getVisitDate(), coverage_list.get(i).getStoreId(), coverage_list.get(i).getFlag_from());
|
StoreBean storeData = db.getSpecificStoreData(coverage_list.get(i).getVisitDate(), coverage_list.get(i).getStoreId(), coverage_list.get(i).getFlag_from());
|
||||||
if (storeData.getSTORE_ID() != null) {
|
if (storeData.getSTORE_ID() != null) {
|
||||||
|
|
||||||
if (!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U) && (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
if (!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U) && !storeData.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_UN) && (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
||||||
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) || storeData.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P))) {
|
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) || storeData.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P))) {
|
||||||
isvalid = true;
|
isvalid = true;
|
||||||
break;
|
break;
|
||||||
@@ -701,41 +737,61 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
//for download
|
//for download
|
||||||
public void downloadMethod(){
|
public void downloadMethod() {
|
||||||
if (checkNetIsAvailable()) {
|
|
||||||
|
|
||||||
boolean previousflag = false;
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
|
builder.setMessage(getResources().getString(R.string.want_to_download)).setCancelable(false)
|
||||||
|
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
if (db.isPreviousCoverageDataFilled(date)) {
|
if (checkNetIsAvailable()) {
|
||||||
if (isPreviousValid(date)) {
|
|
||||||
previousflag = true;
|
|
||||||
} else {
|
|
||||||
db.deletePreviousCoverageData(date);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousflag) {
|
boolean previousflag = false;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
|
||||||
builder.setTitle("Parinaam");
|
|
||||||
builder.setMessage(getResources().getString(R.string.previous_data_upload)).setCancelable(false)
|
|
||||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
|
|
||||||
Intent in = new Intent(getApplicationContext(), PreviousDataUploadActivity.class);
|
if (db.isPreviousCoverageDataFilled(date)) {
|
||||||
startActivity(in);
|
if (isPreviousValid(date)) {
|
||||||
//finish();
|
previousflag = true;
|
||||||
|
} else {
|
||||||
|
db.deletePreviousCoverageData(date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
|
|
||||||
} else {
|
if (previousflag) {
|
||||||
Intent in = new Intent(getApplicationContext(), DownloadActivity.class);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
startActivity(in);
|
builder.setTitle("Parinaam");
|
||||||
}
|
builder.setMessage(getResources().getString(R.string.previous_data_upload)).setCancelable(false)
|
||||||
} else {
|
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
.setAction("Action", null).show();
|
|
||||||
}
|
Intent in = new Intent(getApplicationContext(), PreviousDataUploadActivity.class);
|
||||||
|
startActivity(in);
|
||||||
|
//finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Intent in = new Intent(getApplicationContext(), DownloadActivity.class);
|
||||||
|
startActivity(in);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.password.MPinActivity;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
|
||||||
|
|
||||||
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
|
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
@@ -72,12 +73,18 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
if (selected_flag) {
|
if (selected_flag) {
|
||||||
Intent intent = new Intent(getBaseContext(),
|
/* Intent intent = new Intent(getBaseContext(),
|
||||||
MainActivity.class);
|
MainActivity.class);
|
||||||
|
|
||||||
intent.putExtra(CommonString.KEY_LOGIN_DATA, login_data);
|
intent.putExtra(CommonString.KEY_LOGIN_DATA, login_data);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();*/
|
||||||
|
|
||||||
|
Intent in = new Intent(getApplicationContext(), MPinActivity.class);
|
||||||
|
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
|
||||||
|
startActivity(in);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(view, getString(R.string.select_language), Snackbar.LENGTH_LONG)
|
Snackbar.make(view, getString(R.string.select_language), Snackbar.LENGTH_LONG)
|
||||||
.setAction("Action", null).show();
|
.setAction("Action", null).show();
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package cpm.com.gskmtorange;
|
package cpm.com.gskmtorange;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
@@ -17,11 +19,16 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.password.MPinActivity;
|
||||||
|
|
||||||
public class SplashScreenActivity extends AppCompatActivity {
|
public class SplashScreenActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static int SPLASH_TIME_OUT = 3000;
|
private static int SPLASH_TIME_OUT = 3000;
|
||||||
LinearLayout linearLayout;
|
LinearLayout linearLayout;
|
||||||
|
|
||||||
|
private SharedPreferences preferences = null;
|
||||||
|
|
||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
@@ -35,6 +42,8 @@ public class SplashScreenActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
linearLayout = findViewById(R.id.lin_lay);
|
linearLayout = findViewById(R.id.lin_lay);
|
||||||
|
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
StartAnimations();
|
StartAnimations();
|
||||||
|
|
||||||
sendToLogin();
|
sendToLogin();
|
||||||
@@ -116,12 +125,29 @@ public class SplashScreenActivity extends AppCompatActivity {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// close this activity
|
// close this activity
|
||||||
Intent i = new Intent(SplashScreenActivity.this, LoginActivity.class);
|
//before MPin
|
||||||
|
/* Intent i = new Intent(SplashScreenActivity.this, LoginActivity.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
|
|
||||||
finish();
|
finish();*/
|
||||||
|
|
||||||
|
//after Mpin
|
||||||
|
String mpin = preferences.getString(CommonString.MPIN, null);
|
||||||
|
if(mpin!=null){
|
||||||
|
Intent in = new Intent(getApplicationContext(), MPinActivity.class);
|
||||||
|
in.putExtra(CommonString.IS_PASSWORD_CHECK, true);
|
||||||
|
startActivity(in);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Intent i = new Intent(getApplicationContext(), LoginActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}, SPLASH_TIME_OUT);
|
}, SPLASH_TIME_OUT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.content.res.Configuration;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.FileProvider;
|
import android.support.v4.content.FileProvider;
|
||||||
@@ -251,13 +252,31 @@ public class AutoUpdateActivity extends AppCompatActivity {
|
|||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
||||||
if (result.equals(CommonString.KEY_SUCCESS)) {
|
if (result.equals(CommonString.KEY_SUCCESS)) {
|
||||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
/* Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
i.setDataAndType(FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", new File(Environment
|
i.setDataAndType(FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", new File(Environment
|
||||||
.getExternalStorageDirectory()
|
.getExternalStorageDirectory()
|
||||||
+ "/download/"
|
+ "/download/"
|
||||||
+ "app.apk")),
|
+ "app.apk")),
|
||||||
"application/vnd.android.package-archive");
|
"application/vnd.android.package-archive");
|
||||||
startActivity(i);
|
startActivity(i);*/
|
||||||
|
|
||||||
|
File toInstall = new File(Environment.getExternalStorageDirectory()
|
||||||
|
+ "/download/"
|
||||||
|
+ "app.apk");
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
Uri apkUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", toInstall);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
|
intent.setData(apkUri);
|
||||||
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Uri apkUri = Uri.fromFile(toInstall);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
AutoUpdateActivity.this.finish();
|
AutoUpdateActivity.this.finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,240 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BigButtonView extends FrameLayout {
|
||||||
|
|
||||||
|
private FrameLayout frameLayout;
|
||||||
|
private View clickEffect;
|
||||||
|
private TextView text;
|
||||||
|
private TextView subText;
|
||||||
|
private String textString = "";
|
||||||
|
private String subTextString = "";
|
||||||
|
private ObjectAnimator clickEffectAnimator;
|
||||||
|
private int duration = 500;
|
||||||
|
private OnPressListener onPressListener;
|
||||||
|
|
||||||
|
public BigButtonView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigButtonView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.big_button_view, this, true);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
frameLayout = (FrameLayout)findViewById(R.id.frame_layout);
|
||||||
|
|
||||||
|
text = (TextView)findViewById(R.id.text);
|
||||||
|
text.setText(textString);
|
||||||
|
text.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_text_color));
|
||||||
|
text.setTextSize(resources.getInteger(R.integer.default_big_button_text_size));
|
||||||
|
|
||||||
|
subText = (TextView)findViewById(R.id.sub_text);
|
||||||
|
subText.setText(subTextString);
|
||||||
|
subText.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_sub_text_color));
|
||||||
|
subText.setTextSize(resources.getInteger(R.integer.default_big_button_sub_text_size));
|
||||||
|
|
||||||
|
clickEffect = findViewById(R.id.click_effect);
|
||||||
|
clickEffect.setAlpha(0);
|
||||||
|
clickEffectAnimator = ObjectAnimator.ofFloat(clickEffect, "alpha", 1f, 0f);
|
||||||
|
clickEffectAnimator.setDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the listener, for returning what happened to BlurLockView.
|
||||||
|
*
|
||||||
|
* @param onPressListener OnPressListener.
|
||||||
|
*/
|
||||||
|
public void setOnPressListener(OnPressListener onPressListener) {
|
||||||
|
this.onPressListener = onPressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the width of the button.
|
||||||
|
*
|
||||||
|
* @param width Width, in pixels.
|
||||||
|
*/
|
||||||
|
public void setWidth(int width) {
|
||||||
|
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
|
||||||
|
layoutParams.width = width;
|
||||||
|
frameLayout.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the height of the button.
|
||||||
|
*
|
||||||
|
* @param height Height, in pixels.
|
||||||
|
*/
|
||||||
|
public void setHeight(int height) {
|
||||||
|
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
|
||||||
|
layoutParams.height = height;
|
||||||
|
frameLayout.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the resource of background.
|
||||||
|
*
|
||||||
|
* @param resourceId ResourceId.
|
||||||
|
*/
|
||||||
|
public void setBackground(int resourceId) {
|
||||||
|
frameLayout.setBackgroundResource(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the resource of click effect.
|
||||||
|
*
|
||||||
|
* @param resourceId ResourceId.
|
||||||
|
*/
|
||||||
|
public void setEffect(int resourceId) {
|
||||||
|
clickEffect.setBackgroundResource(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the duration of the effect.
|
||||||
|
*
|
||||||
|
* @param duration Duration, in ms.
|
||||||
|
*/
|
||||||
|
public void setEffectDuration(int duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text size of the main text.
|
||||||
|
*
|
||||||
|
* @param size Text size, in sp.
|
||||||
|
*/
|
||||||
|
public void setTextSize(int size) {
|
||||||
|
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text size of the sub text.
|
||||||
|
*
|
||||||
|
* @param size Text size, in sp.
|
||||||
|
*/
|
||||||
|
public void setSubTextSize(int size) {
|
||||||
|
subText.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text color of main text.
|
||||||
|
*
|
||||||
|
* @param color Color.
|
||||||
|
*/
|
||||||
|
public void setTextColor(int color) {
|
||||||
|
text.setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text color of sub text.
|
||||||
|
*
|
||||||
|
* @param color Color.
|
||||||
|
*/
|
||||||
|
public void setSubTextColor(int color) {
|
||||||
|
subText.setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set font of button.
|
||||||
|
*
|
||||||
|
* @param typeFace New font.
|
||||||
|
*/
|
||||||
|
public void setTypeFace(Typeface typeFace) {
|
||||||
|
text.setTypeface(typeFace);
|
||||||
|
subText.setTypeface(typeFace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the string of the text.
|
||||||
|
*
|
||||||
|
* @param textString The new string.
|
||||||
|
*/
|
||||||
|
public void setText(String textString) {
|
||||||
|
this.textString = textString;
|
||||||
|
if (text != null) text.setText(textString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the string of the sub text.
|
||||||
|
*
|
||||||
|
* @param subTextString The new string.
|
||||||
|
*/
|
||||||
|
public void setSubText(String subTextString) {
|
||||||
|
this.subTextString = subTextString;
|
||||||
|
if (subText != null) subText.setText(subTextString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the visibility of sub textview.
|
||||||
|
*
|
||||||
|
* @param visibility The visibility.
|
||||||
|
*/
|
||||||
|
public void setSubTextVisibility(int visibility) {
|
||||||
|
if (visibility == GONE) {
|
||||||
|
text.setGravity(Gravity.CENTER);
|
||||||
|
} else {
|
||||||
|
text.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
subText.setVisibility(visibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform the click effect.
|
||||||
|
*
|
||||||
|
* @param event MotionEvent.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
switch(event.getAction()){
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
if (onPressListener != null) onPressListener.onPress(textString);
|
||||||
|
clickEffectAnimator.cancel();
|
||||||
|
clickEffect.setAlpha(1);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
clickEffectAnimator.start();
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the animation.
|
||||||
|
*/
|
||||||
|
public void clearAnimation() {
|
||||||
|
if (clickEffect.getAlpha() == 1) {
|
||||||
|
clickEffectAnimator.cancel();
|
||||||
|
clickEffectAnimator.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPressListener {
|
||||||
|
void onPress(String string);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,870 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.Display;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.blurlockview.Directions.HideType;
|
||||||
|
import cpm.com.gskmtorange.blurlockview.Directions.ShowType;
|
||||||
|
import cpm.com.gskmtorange.blurlockview.Eases.EaseType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/16.
|
||||||
|
*/
|
||||||
|
public class BlurLockView extends FrameLayout
|
||||||
|
implements
|
||||||
|
BigButtonView.OnPressListener,
|
||||||
|
SmallButtonView.OnPressListener {
|
||||||
|
|
||||||
|
private final char CHARS[][] = {
|
||||||
|
{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'},
|
||||||
|
{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'},
|
||||||
|
{ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L' },
|
||||||
|
{ 'Z', 'X', 'C', 'V', 'B', 'N', 'M' }
|
||||||
|
};
|
||||||
|
|
||||||
|
private Password type = Password.NUMBER;
|
||||||
|
|
||||||
|
private int passwordLength = 4;
|
||||||
|
private String correctPassword = null;
|
||||||
|
private int incorrectInputTimes = 0;
|
||||||
|
private Typeface typeface;
|
||||||
|
|
||||||
|
private boolean animationIsPlaying = false;
|
||||||
|
|
||||||
|
public boolean isIs_Password_Check_Mode() {
|
||||||
|
return is_Password_Check_Mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_Password_Check_Mode(boolean is_Password_Check_Mode) {
|
||||||
|
this.is_Password_Check_Mode = is_Password_Check_Mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean is_Password_Check_Mode = false;
|
||||||
|
|
||||||
|
private Stack<String> passwordStack = null;
|
||||||
|
|
||||||
|
private TextView title;
|
||||||
|
private Indicator indicator;
|
||||||
|
|
||||||
|
private BigButtonView[] bigButtonViews;
|
||||||
|
private SmallButtonView[][] smallButtonViews;
|
||||||
|
private BlurView mBlurView;
|
||||||
|
private TextView leftButton;
|
||||||
|
private TextView rightButton;
|
||||||
|
|
||||||
|
private OnLeftButtonClickListener onLeftButtonClickListener;
|
||||||
|
private OnPasswordInputListener onPasswordInputListener;
|
||||||
|
|
||||||
|
public BlurLockView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlurLockView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init.
|
||||||
|
*/
|
||||||
|
private void init() {
|
||||||
|
// number password
|
||||||
|
LayoutInflater.from(getContext()).inflate(R.layout.number_lock_view, this, true);
|
||||||
|
|
||||||
|
bigButtonViews = new BigButtonView[10];
|
||||||
|
bigButtonViews[0] = (BigButtonView)findViewById(R.id.button_0);
|
||||||
|
bigButtonViews[1] = (BigButtonView)findViewById(R.id.button_1);
|
||||||
|
bigButtonViews[2] = (BigButtonView)findViewById(R.id.button_2);
|
||||||
|
bigButtonViews[3] = (BigButtonView)findViewById(R.id.button_3);
|
||||||
|
bigButtonViews[4] = (BigButtonView)findViewById(R.id.button_4);
|
||||||
|
bigButtonViews[5] = (BigButtonView)findViewById(R.id.button_5);
|
||||||
|
bigButtonViews[6] = (BigButtonView)findViewById(R.id.button_6);
|
||||||
|
bigButtonViews[7] = (BigButtonView)findViewById(R.id.button_7);
|
||||||
|
bigButtonViews[8] = (BigButtonView)findViewById(R.id.button_8);
|
||||||
|
bigButtonViews[9] = (BigButtonView)findViewById(R.id.button_9);
|
||||||
|
|
||||||
|
String[] texts = getResources().getStringArray(R.array.default_big_button_text);
|
||||||
|
String[] subTexts = getResources().getStringArray(R.array.default_big_button_sub_text);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
bigButtonViews[i].setOnPressListener(this);
|
||||||
|
bigButtonViews[i].setText(texts[i]);
|
||||||
|
//bigButtonViews[i].setSubText(subTexts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bigButtonViews[0].setSubTextVisibility(View.GONE);
|
||||||
|
bigButtonViews[1].setSubTextVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
|
// text password
|
||||||
|
smallButtonViews = new SmallButtonView[4][10];
|
||||||
|
|
||||||
|
// get screen width
|
||||||
|
Display display = ((Activity)getContext()).getWindowManager().getDefaultDisplay();
|
||||||
|
Point size = new Point();
|
||||||
|
display.getSize(size);
|
||||||
|
int width = size.x;
|
||||||
|
|
||||||
|
int buttonHorizontalMargin = 6;
|
||||||
|
int buttonVerticalMargin = 24;
|
||||||
|
int buttonWidth = (width - 11 * buttonHorizontalMargin) / 10;
|
||||||
|
|
||||||
|
// add buttons to lines
|
||||||
|
LinearLayout line1 = (LinearLayout)findViewById(R.id.line_1);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
smallButtonViews[0][i] = new SmallButtonView(getContext());
|
||||||
|
smallButtonViews[0][i].setOnPressListener(this);
|
||||||
|
smallButtonViews[0][i].setText(CHARS[0][i] + "");
|
||||||
|
smallButtonViews[0][i].setWidth(buttonWidth);
|
||||||
|
smallButtonViews[0][i].setHeight(buttonWidth);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
buttonWidth,
|
||||||
|
buttonWidth
|
||||||
|
);
|
||||||
|
if (i == 0)
|
||||||
|
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
else if (i == 9)
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
|
||||||
|
else
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
line1.addView(smallButtonViews[0][i], params);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinearLayout line2 = (LinearLayout)findViewById(R.id.line_2);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
smallButtonViews[1][i] = new SmallButtonView(getContext());
|
||||||
|
smallButtonViews[1][i].setOnPressListener(this);
|
||||||
|
smallButtonViews[1][i].setText(CHARS[1][i] + "");
|
||||||
|
smallButtonViews[1][i].setWidth(buttonWidth);
|
||||||
|
smallButtonViews[1][i].setHeight(buttonWidth);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
buttonWidth,
|
||||||
|
buttonWidth
|
||||||
|
);
|
||||||
|
if (i == 0)
|
||||||
|
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
else if (i == 9)
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
|
||||||
|
else
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
line2.addView(smallButtonViews[1][i], params);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinearLayout line3 = (LinearLayout)findViewById(R.id.line_3);
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
smallButtonViews[2][i] = new SmallButtonView(getContext());
|
||||||
|
smallButtonViews[2][i].setOnPressListener(this);
|
||||||
|
smallButtonViews[2][i].setText(CHARS[2][i] + "");
|
||||||
|
smallButtonViews[2][i].setWidth(buttonWidth);
|
||||||
|
smallButtonViews[2][i].setHeight(buttonWidth);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
buttonWidth,
|
||||||
|
buttonWidth
|
||||||
|
);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
else if (i == 8)
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
|
||||||
|
else
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
line3.addView(smallButtonViews[2][i], params);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinearLayout line4 = (LinearLayout)findViewById(R.id.line_4);
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
smallButtonViews[3][i] = new SmallButtonView(getContext());
|
||||||
|
smallButtonViews[3][i].setOnPressListener(this);
|
||||||
|
smallButtonViews[3][i].setText(CHARS[3][i] + "");
|
||||||
|
smallButtonViews[3][i].setWidth(buttonWidth);
|
||||||
|
smallButtonViews[3][i].setHeight(buttonWidth);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
|
buttonWidth,
|
||||||
|
buttonWidth
|
||||||
|
);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
params.setMargins(buttonHorizontalMargin, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
else if (i == 6)
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin, buttonVerticalMargin / 2);
|
||||||
|
else
|
||||||
|
params.setMargins(buttonHorizontalMargin / 2, buttonVerticalMargin / 2, buttonHorizontalMargin / 2, buttonVerticalMargin / 2);
|
||||||
|
line4.addView(smallButtonViews[3][i], params);
|
||||||
|
}
|
||||||
|
|
||||||
|
passwordStack = new Stack<>();
|
||||||
|
|
||||||
|
mBlurView = (BlurView)findViewById(R.id.blurview);
|
||||||
|
mBlurView.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
indicator = (Indicator)findViewById(R.id.indicator);
|
||||||
|
indicator.setPasswordLength(passwordLength);
|
||||||
|
|
||||||
|
title = (TextView)findViewById(R.id.title);
|
||||||
|
title.setTextColor(ContextCompat.getColor(getContext(), R.color.default_title_text_color));
|
||||||
|
title.setTextSize(resources.getInteger(R.integer.default_title_text_size));
|
||||||
|
|
||||||
|
leftButton = (TextView)findViewById(R.id.left_button);
|
||||||
|
leftButton.setTextColor(ContextCompat.getColor(getContext(), R.color.default_left_button_text_color));
|
||||||
|
leftButton.setTextSize(resources.getInteger(R.integer.default_left_button_text_size));
|
||||||
|
leftButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onLeftButtonClickListener != null) onLeftButtonClickListener.onClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rightButton = (TextView)findViewById(R.id.right_button);
|
||||||
|
rightButton.setTextColor(ContextCompat.getColor(getContext(), R.color.default_right_button_text_color));
|
||||||
|
rightButton.setTextSize(resources.getInteger(R.integer.default_right_button_text_size));
|
||||||
|
rightButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (passwordStack.size() > 0) {
|
||||||
|
passwordStack.pop();
|
||||||
|
indicator.delete();
|
||||||
|
if (onPasswordInputListener != null){
|
||||||
|
StringBuilder nowPassword = new StringBuilder("");
|
||||||
|
for (String s : passwordStack) {
|
||||||
|
nowPassword.append(s);
|
||||||
|
}
|
||||||
|
onPasswordInputListener.clear(nowPassword.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the text keyboard smoothly or not.
|
||||||
|
*
|
||||||
|
* @param smoothly Smoothly or not.
|
||||||
|
*/
|
||||||
|
private void showText(boolean smoothly) {
|
||||||
|
if (animationIsPlaying) return;
|
||||||
|
animationIsPlaying = true;
|
||||||
|
if (smoothly) {
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_123), "alpha", 1f, 0f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_456), "alpha", 1f, 0f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_789), "alpha", 1f, 0f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.button_0), "alpha", 1f, 0f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator showAnimator =
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.text_layout), "alpha", 0f, 1f);
|
||||||
|
showAnimator.setDuration(500).addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
super.onAnimationStart(animation);
|
||||||
|
findViewById(R.id.text_layout).setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
findViewById(R.id.layout_123).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.layout_456).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.layout_789).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.button_0).setVisibility(INVISIBLE);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showAnimator.start();
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.layout_123).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.layout_456).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.layout_789).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.button_0).setVisibility(INVISIBLE);
|
||||||
|
findViewById(R.id.text_layout).setVisibility(VISIBLE);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the number keyboard smoothly or not.
|
||||||
|
*
|
||||||
|
* @param smoothly Smoothly or not.
|
||||||
|
*/
|
||||||
|
private void showNumber(boolean smoothly) {
|
||||||
|
if (animationIsPlaying) return;
|
||||||
|
animationIsPlaying = true;
|
||||||
|
if (smoothly) {
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_123), "alpha", 0f, 1f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_456), "alpha", 0f, 1f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.layout_789), "alpha", 0f, 1f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.button_0), "alpha", 0f, 1f)
|
||||||
|
.setDuration(500).start();
|
||||||
|
ObjectAnimator showAnimator =
|
||||||
|
ObjectAnimator.ofFloat(findViewById(R.id.text_layout), "alpha", 1f, 0f);
|
||||||
|
showAnimator.setDuration(500).addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
super.onAnimationStart(animation);
|
||||||
|
findViewById(R.id.layout_123).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.layout_456).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.layout_789).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.button_0).setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
findViewById(R.id.text_layout).setVisibility(INVISIBLE);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showAnimator.start();
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.layout_123).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.layout_456).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.layout_789).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.button_0).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.text_layout).setVisibility(INVISIBLE);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the view that need to be blurred.
|
||||||
|
*
|
||||||
|
* @param blurredView The view.
|
||||||
|
*/
|
||||||
|
public void setBlurredView(View blurredView) {
|
||||||
|
mBlurView.setBlurredView(blurredView);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the listener.
|
||||||
|
*
|
||||||
|
* @param onLeftButtonClickListener Listener.
|
||||||
|
*/
|
||||||
|
public void setOnLeftButtonClickListener(OnLeftButtonClickListener onLeftButtonClickListener) {
|
||||||
|
this.onLeftButtonClickListener = onLeftButtonClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the listener.
|
||||||
|
*
|
||||||
|
* @param onPasswordInputListener Listener.
|
||||||
|
*/
|
||||||
|
public void setOnPasswordInputListener(OnPasswordInputListener onPasswordInputListener) {
|
||||||
|
this.onPasswordInputListener = onPasswordInputListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From the button views.
|
||||||
|
*
|
||||||
|
* @param string The string from button views.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPress(String string) {
|
||||||
|
if (correctPassword == null) {
|
||||||
|
throw new RuntimeException("The correct password has NOT been set!");
|
||||||
|
}
|
||||||
|
if (passwordStack.size() >= passwordLength) return;
|
||||||
|
passwordStack.push(string);
|
||||||
|
indicator.add();
|
||||||
|
StringBuilder nowPassword = new StringBuilder("");
|
||||||
|
for (String s : passwordStack) {
|
||||||
|
nowPassword.append(s);
|
||||||
|
}
|
||||||
|
String nowPasswordString = nowPassword.toString();
|
||||||
|
if (correctPassword.equals(nowPasswordString)) {
|
||||||
|
// correct password
|
||||||
|
if (onPasswordInputListener != null)
|
||||||
|
onPasswordInputListener.correct(nowPasswordString);
|
||||||
|
} else {
|
||||||
|
if (correctPassword.length() > nowPasswordString.length()) {
|
||||||
|
// input right now
|
||||||
|
if (onPasswordInputListener != null)
|
||||||
|
onPasswordInputListener.input(nowPasswordString);
|
||||||
|
} else {
|
||||||
|
// incorrect password
|
||||||
|
if (onPasswordInputListener != null)
|
||||||
|
onPasswordInputListener.incorrect(nowPasswordString);
|
||||||
|
if(is_Password_Check_Mode){
|
||||||
|
// perform the clear animation
|
||||||
|
incorrectInputTimes++;
|
||||||
|
indicator.clear();
|
||||||
|
passwordStack.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent click 2 or above buttons at the same time.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
if (event.getPointerCount() > 1) {
|
||||||
|
if (Password.NUMBER.equals(type)) {
|
||||||
|
for (int i = 0; i < bigButtonViews.length; i++) bigButtonViews[i].clearAnimation();
|
||||||
|
} else if (Password.TEXT.equals(type)) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++) {
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++) {
|
||||||
|
if (smallButtonViews[i][j] != null) smallButtonViews[i][j].clearAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set big buttons' background.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setBigButtonViewsBackground(int id) {
|
||||||
|
for (int i = 0; i < 10; i++) bigButtonViews[i].setBackground(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set big buttons' click effect.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setBigButtonViewsClickEffect(int id) {
|
||||||
|
for (int i = 0; i < 10; i++) bigButtonViews[i].setEffect(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the click effect duration.
|
||||||
|
*
|
||||||
|
* @param duration
|
||||||
|
*/
|
||||||
|
public void setBigButtonViewsClickEffectDuration(int duration) {
|
||||||
|
for (int i = 0; i < 10; i++) bigButtonViews[i].setEffectDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set small buttons' background.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setSmallButtonViewsBackground(int id) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++)
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++)
|
||||||
|
if (smallButtonViews[i][j] != null)
|
||||||
|
smallButtonViews[i][j].setBackground(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set small buttons' click effect.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setSmallButtonViewsClickEffect(int id) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++)
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++)
|
||||||
|
if (smallButtonViews[i][j] != null)
|
||||||
|
smallButtonViews[i][j].setEffect(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the click effect duration.
|
||||||
|
*
|
||||||
|
* @param duration
|
||||||
|
*/
|
||||||
|
public void setSmallButtonViewsClickEffectDuration(int duration) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++)
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++)
|
||||||
|
if (smallButtonViews[i][j] != null)
|
||||||
|
smallButtonViews[i][j].setEffectDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all the fonts.
|
||||||
|
*
|
||||||
|
* @param typeface
|
||||||
|
*/
|
||||||
|
public void setTypeface(Typeface typeface) {
|
||||||
|
this.typeface = typeface;
|
||||||
|
if (type.equals(Password.NUMBER)) {
|
||||||
|
for (int i = 0; i < 10; i++) bigButtonViews[i].setTypeFace(typeface);
|
||||||
|
} else if (type.equals(Password.TEXT)) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++)
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++)
|
||||||
|
if (smallButtonViews[i][j] != null)
|
||||||
|
smallButtonViews[i][j].setTypeFace(typeface);
|
||||||
|
}
|
||||||
|
title.setTypeface(typeface);
|
||||||
|
leftButton.setTypeface(typeface);
|
||||||
|
rightButton.setTypeface(typeface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all the text color.
|
||||||
|
*
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
|
public void setTextColor(int color) {
|
||||||
|
if (type.equals(Password.NUMBER)) {
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
bigButtonViews[i].setTextColor(color);
|
||||||
|
bigButtonViews[i].setSubTextColor(color);
|
||||||
|
}
|
||||||
|
} else if (type.equals(Password.TEXT)) {
|
||||||
|
for (int i = 0; i < smallButtonViews.length; i++)
|
||||||
|
for (int j = 0; j < smallButtonViews[i].length; j++)
|
||||||
|
if (smallButtonViews[i][j] != null)
|
||||||
|
smallButtonViews[i][j].setTextColor(color);
|
||||||
|
}
|
||||||
|
title.setTextColor(color);
|
||||||
|
leftButton.setTextColor(color);
|
||||||
|
rightButton.setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the length of the password.
|
||||||
|
* Default length is 4.
|
||||||
|
*
|
||||||
|
* @param passwordLength
|
||||||
|
*/
|
||||||
|
public void setPasswordLength(int passwordLength) {
|
||||||
|
this.passwordLength = passwordLength;
|
||||||
|
indicator.setPasswordLength(passwordLength);
|
||||||
|
passwordStack.clear();
|
||||||
|
correctPassword = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the password type.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Password getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the password type.
|
||||||
|
*
|
||||||
|
* @param type Number or text.
|
||||||
|
*/
|
||||||
|
public void setType(Password type, boolean smoothly) {
|
||||||
|
if (animationIsPlaying) return;
|
||||||
|
this.type = type;
|
||||||
|
indicator.clear();
|
||||||
|
passwordStack.clear();
|
||||||
|
if (Password.NUMBER.equals(type)) {
|
||||||
|
showNumber(smoothly);
|
||||||
|
} else if (Password.TEXT.equals(type)) {
|
||||||
|
showText(smoothly);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the title text.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public void setTitle(String string) {
|
||||||
|
title.setText(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text of left button.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public void setLeftButton(String string) {
|
||||||
|
leftButton.setText(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text of right button.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public void setRightButton(String string) {
|
||||||
|
rightButton.setText(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the target password.
|
||||||
|
*
|
||||||
|
* @param correctPassword The target password.
|
||||||
|
*/
|
||||||
|
public void setCorrectPassword(String correctPassword) {
|
||||||
|
setPasswordLength(correctPassword.length());
|
||||||
|
this.correctPassword = correctPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You can use this to reset the incorrect input times.
|
||||||
|
*
|
||||||
|
* @param incorrectInputTimes The incorrect input times.
|
||||||
|
*/
|
||||||
|
public void setIncorrectInputTimes(int incorrectInputTimes) {
|
||||||
|
this.incorrectInputTimes = incorrectInputTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the incorrect input times.
|
||||||
|
*
|
||||||
|
* @return Incorrect input times.
|
||||||
|
*/
|
||||||
|
public int getIncorrectInputTimes() {
|
||||||
|
return incorrectInputTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidate the blur view.
|
||||||
|
*/
|
||||||
|
public void update() {
|
||||||
|
mBlurView.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show this BlurLockView.
|
||||||
|
*
|
||||||
|
* @param duration Duration, in ms.
|
||||||
|
* @param showType Direction, in ShowType.
|
||||||
|
* @param easeType Ease type, in EaseType.
|
||||||
|
*/
|
||||||
|
public void show(int duration, ShowType showType, EaseType easeType) {
|
||||||
|
if (animationIsPlaying) return;
|
||||||
|
animationIsPlaying = true;
|
||||||
|
indicator.clear();
|
||||||
|
passwordStack.clear();
|
||||||
|
ObjectAnimator animator = null;
|
||||||
|
setVisibility(VISIBLE);
|
||||||
|
if (showType.equals(ShowType.FROM_TOP_TO_BOTTOM)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationY",
|
||||||
|
getTranslationY() - getHeight(),
|
||||||
|
getTranslationY());
|
||||||
|
} else if (showType.equals(ShowType.FROM_RIGHT_TO_LEFT)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationX",
|
||||||
|
getTranslationX() + getWidth(),
|
||||||
|
getTranslationX());
|
||||||
|
} else if (showType.equals(ShowType.FROM_BOTTOM_TO_TOP)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationY",
|
||||||
|
getTranslationY() + getHeight(),
|
||||||
|
getTranslationY());
|
||||||
|
} else if (showType.equals(ShowType.FROM_LEFT_TO_RIGHT)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationX",
|
||||||
|
getTranslationX() - getWidth(),
|
||||||
|
getTranslationX());
|
||||||
|
} else if (showType.equals(ShowType.FADE_IN)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "alpha",
|
||||||
|
0,
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
animator.setDuration(duration);
|
||||||
|
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animator.setInterpolator(InterpolatorFactory.getInterpolator(easeType));
|
||||||
|
animator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide this BlurLockView.
|
||||||
|
*
|
||||||
|
* @param duration Duration, in ms.
|
||||||
|
* @param hideType Direction, in HideType.
|
||||||
|
* @param easeType Ease type, in EaseType.
|
||||||
|
*/
|
||||||
|
public void hide(int duration, HideType hideType, EaseType easeType) {
|
||||||
|
if (animationIsPlaying) return;
|
||||||
|
animationIsPlaying = true;
|
||||||
|
ObjectAnimator animator = null;
|
||||||
|
final float originalX = getTranslationX();
|
||||||
|
final float originalY = getTranslationY();
|
||||||
|
if (hideType.equals(HideType.FROM_TOP_TO_BOTTOM)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationY",
|
||||||
|
getTranslationY(),
|
||||||
|
getTranslationY() + getHeight());
|
||||||
|
} else if (hideType.equals(HideType.FROM_RIGHT_TO_LEFT)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationX",
|
||||||
|
getTranslationX(),
|
||||||
|
getTranslationX() - getWidth());
|
||||||
|
} else if (hideType.equals(HideType.FROM_BOTTOM_TO_TOP)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationY",
|
||||||
|
getTranslationY(),
|
||||||
|
getTranslationY() - getHeight());
|
||||||
|
} else if (hideType.equals(HideType.FROM_LEFT_TO_RIGHT)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "translationX",
|
||||||
|
getTranslationX(),
|
||||||
|
getTranslationX() + getWidth());
|
||||||
|
} else if (hideType.equals(HideType.FADE_OUT)) {
|
||||||
|
animator = ObjectAnimator.ofFloat(this, "alpha",
|
||||||
|
1,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
animator.setDuration(duration);
|
||||||
|
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
setVisibility(INVISIBLE);
|
||||||
|
setTranslationX(originalX);
|
||||||
|
setTranslationY(originalY);
|
||||||
|
setAlpha(1);
|
||||||
|
animationIsPlaying = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
animator.setInterpolator(InterpolatorFactory.getInterpolator(easeType));
|
||||||
|
animator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPasswordInputListener {
|
||||||
|
void correct(String inputPassword);
|
||||||
|
void incorrect(String inputPassword);
|
||||||
|
void input(String inputPassword);
|
||||||
|
void clear(String remainingPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnLeftButtonClickListener {
|
||||||
|
void onClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the title.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TextView getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the left button.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TextView getLeftButton() {
|
||||||
|
return leftButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the right button.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TextView getRightButton() {
|
||||||
|
return rightButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the numbers.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BigButtonView[] getBigButtonViews() {
|
||||||
|
return bigButtonViews;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the texts.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SmallButtonView[][] getSmallButtonViews() {
|
||||||
|
return smallButtonViews;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the blur radius.
|
||||||
|
*/
|
||||||
|
public void setBlurRadius(int blurRadius) {
|
||||||
|
mBlurView.setBlurRadius(blurRadius);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the blur radius.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getBlurRadius() {
|
||||||
|
return mBlurView.getBlurRadius();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the downsample factor.
|
||||||
|
* @param downsampleFactor
|
||||||
|
*/
|
||||||
|
public void setDownsampleFactor(int downsampleFactor) {
|
||||||
|
mBlurView.setDownsampleFactor(downsampleFactor);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the downsample factor.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getDownsampleFactor() {
|
||||||
|
return mBlurView.getDownsampleFactor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the overlay color.
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
|
public void setOverlayColor(int color) {
|
||||||
|
mBlurView.setOverlayColor(color);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the overlay color.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getOverlayColor() {
|
||||||
|
return mBlurView.getmOverlayColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.renderscript.Allocation;
|
||||||
|
import android.renderscript.Element;
|
||||||
|
import android.renderscript.RenderScript;
|
||||||
|
import android.renderscript.ScriptIntrinsicBlur;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/16.
|
||||||
|
*/
|
||||||
|
public class BlurView extends View {
|
||||||
|
|
||||||
|
private int mBlurRadius;
|
||||||
|
private int mDownsampleFactor;
|
||||||
|
private int mOverlayColor;
|
||||||
|
|
||||||
|
private View mBlurredView;
|
||||||
|
private int mBlurredViewWidth, mBlurredViewHeight;
|
||||||
|
|
||||||
|
private boolean mDownsampleFactorChanged;
|
||||||
|
private Bitmap mBitmapToBlur, mBlurredBitmap;
|
||||||
|
private Canvas mBlurringCanvas;
|
||||||
|
private RenderScript mRenderScript;
|
||||||
|
private ScriptIntrinsicBlur mBlurScript;
|
||||||
|
private Allocation mBlurInput, mBlurOutput;
|
||||||
|
|
||||||
|
public BlurView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlurView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
final Resources res = getResources();
|
||||||
|
final int defaultBlurRadius = res.getInteger(R.integer.default_blur_radius);
|
||||||
|
final int defaultDownsampleFactor = res.getInteger(R.integer.default_downsample_factor);
|
||||||
|
final int defaultOverlayColor = res.getColor(R.color.default_overlay_color);
|
||||||
|
|
||||||
|
initializeRenderScript(context);
|
||||||
|
|
||||||
|
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BlurView);
|
||||||
|
setBlurRadius(a.getInt(R.styleable.BlurView_blurRadius, defaultBlurRadius));
|
||||||
|
setDownsampleFactor(a.getInt(R.styleable.BlurView_downsampleFactor,
|
||||||
|
defaultDownsampleFactor));
|
||||||
|
setOverlayColor(a.getColor(R.styleable.BlurView_overlayColor, defaultOverlayColor));
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlurredView(View blurredView) {
|
||||||
|
mBlurredView = blurredView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
if (mBlurredView != null) {
|
||||||
|
if (prepare()) {
|
||||||
|
// If the background of the blurred view is a color drawable, we use it to clear
|
||||||
|
// the blurring canvas, which ensures that edges of the child views are blurred
|
||||||
|
// as well; otherwise we clear the blurring canvas with a transparent color.
|
||||||
|
if (mBlurredView.getBackground() != null && mBlurredView.getBackground() instanceof ColorDrawable) {
|
||||||
|
mBitmapToBlur.eraseColor(((ColorDrawable) mBlurredView.getBackground()).getColor());
|
||||||
|
} else {
|
||||||
|
mBitmapToBlur.eraseColor(Color.TRANSPARENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] mBlurredViewXY = new int[2];
|
||||||
|
mBlurredView.getLocationOnScreen(mBlurredViewXY);
|
||||||
|
int[] mBlurringViewXY = new int[2];
|
||||||
|
getLocationOnScreen(mBlurringViewXY);
|
||||||
|
|
||||||
|
mBlurredView.draw(mBlurringCanvas);
|
||||||
|
blur();
|
||||||
|
|
||||||
|
canvas.save();
|
||||||
|
|
||||||
|
// modify here to get the correct bitmap when the blurring view is in a parent
|
||||||
|
canvas.translate(mBlurredViewXY[0] - mBlurringViewXY[0], mBlurredViewXY[1] - mBlurringViewXY[1]);
|
||||||
|
canvas.scale(mDownsampleFactor, mDownsampleFactor);
|
||||||
|
canvas.drawBitmap(mBlurredBitmap, 0, 0, null);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
canvas.drawColor(mOverlayColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlurRadius(int radius) {
|
||||||
|
mBlurRadius = radius;
|
||||||
|
mBlurScript.setRadius(mBlurRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlurRadius() {
|
||||||
|
return mBlurRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownsampleFactor(int factor) {
|
||||||
|
if (factor <= 0) {
|
||||||
|
throw new IllegalArgumentException("Downsample factor must be greater than 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDownsampleFactor != factor) {
|
||||||
|
mDownsampleFactor = factor;
|
||||||
|
mDownsampleFactorChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDownsampleFactor() {
|
||||||
|
return mDownsampleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverlayColor(int color) {
|
||||||
|
mOverlayColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getmOverlayColor() {
|
||||||
|
return mOverlayColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeRenderScript(Context context) {
|
||||||
|
mRenderScript = RenderScript.create(context);
|
||||||
|
mBlurScript = ScriptIntrinsicBlur.create(mRenderScript, Element.U8_4(mRenderScript));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean prepare() {
|
||||||
|
final int width = mBlurredView.getWidth();
|
||||||
|
final int height = mBlurredView.getHeight();
|
||||||
|
|
||||||
|
if (mBlurringCanvas == null || mDownsampleFactorChanged
|
||||||
|
|| mBlurredViewWidth != width || mBlurredViewHeight != height) {
|
||||||
|
mDownsampleFactorChanged = false;
|
||||||
|
|
||||||
|
mBlurredViewWidth = width;
|
||||||
|
mBlurredViewHeight = height;
|
||||||
|
|
||||||
|
int scaledWidth = width / mDownsampleFactor;
|
||||||
|
int scaledHeight = height / mDownsampleFactor;
|
||||||
|
|
||||||
|
// The following manipulation is to avoid some RenderScript artifacts at the edge.
|
||||||
|
scaledWidth = scaledWidth - scaledWidth % 4 + 4;
|
||||||
|
scaledHeight = scaledHeight - scaledHeight % 4 + 4;
|
||||||
|
|
||||||
|
if (mBlurredBitmap == null
|
||||||
|
|| mBlurredBitmap.getWidth() != scaledWidth
|
||||||
|
|| mBlurredBitmap.getHeight() != scaledHeight) {
|
||||||
|
mBitmapToBlur = Bitmap.createBitmap(scaledWidth, scaledHeight,
|
||||||
|
Bitmap.Config.ARGB_8888);
|
||||||
|
if (mBitmapToBlur == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mBlurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight,
|
||||||
|
Bitmap.Config.ARGB_8888);
|
||||||
|
if (mBlurredBitmap == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mBlurringCanvas = new Canvas(mBitmapToBlur);
|
||||||
|
mBlurringCanvas.scale(1f / mDownsampleFactor, 1f / mDownsampleFactor);
|
||||||
|
mBlurInput = Allocation.createFromBitmap(mRenderScript, mBitmapToBlur,
|
||||||
|
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
|
||||||
|
mBlurOutput = Allocation.createTyped(mRenderScript, mBlurInput.getType());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void blur() {
|
||||||
|
mBlurInput.copyFrom(mBitmapToBlur);
|
||||||
|
mBlurScript.setInput(mBlurInput);
|
||||||
|
mBlurScript.forEach(mBlurOutput);
|
||||||
|
mBlurOutput.copyTo(mBlurredBitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
if (mRenderScript != null) {
|
||||||
|
mRenderScript.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Directions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public enum HideType {
|
||||||
|
|
||||||
|
FROM_TOP_TO_BOTTOM(0),
|
||||||
|
FROM_RIGHT_TO_LEFT(1),
|
||||||
|
FROM_BOTTOM_TO_TOP(2),
|
||||||
|
FROM_LEFT_TO_RIGHT(3),
|
||||||
|
FADE_OUT(4);
|
||||||
|
|
||||||
|
int type;
|
||||||
|
|
||||||
|
HideType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Directions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public enum ShowType {
|
||||||
|
|
||||||
|
FROM_TOP_TO_BOTTOM(0),
|
||||||
|
FROM_RIGHT_TO_LEFT(1),
|
||||||
|
FROM_BOTTOM_TO_TOP(2),
|
||||||
|
FROM_LEFT_TO_RIGHT(3),
|
||||||
|
FADE_IN(4);
|
||||||
|
|
||||||
|
int type;
|
||||||
|
|
||||||
|
ShowType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public class Dot extends FrameLayout {
|
||||||
|
|
||||||
|
private View selected;
|
||||||
|
private View unselected;
|
||||||
|
|
||||||
|
private ObjectAnimator selectedAnimator;
|
||||||
|
private ObjectAnimator unselectedAnimator;
|
||||||
|
|
||||||
|
private boolean isSelected = false;
|
||||||
|
|
||||||
|
public Dot(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dot(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.dot_view, this, true);
|
||||||
|
|
||||||
|
selected = findViewById(R.id.selected);
|
||||||
|
unselected = findViewById(R.id.unselected);
|
||||||
|
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this dot to selected or not.
|
||||||
|
*
|
||||||
|
* @param isSelected Selected or not.
|
||||||
|
*/
|
||||||
|
public void setSelected(boolean isSelected) {
|
||||||
|
if (!(this.isSelected ^ isSelected)) return;
|
||||||
|
this.isSelected = isSelected;
|
||||||
|
if (isSelected) {
|
||||||
|
// change to selected
|
||||||
|
selected.setAlpha(0);
|
||||||
|
unselected.setAlpha(1);
|
||||||
|
if (selectedAnimator != null) selectedAnimator.cancel();
|
||||||
|
if (unselectedAnimator != null) unselectedAnimator.cancel();
|
||||||
|
|
||||||
|
selectedAnimator = ObjectAnimator.ofFloat(selected, "alpha", 0f, 1f);
|
||||||
|
selectedAnimator.setDuration(300);
|
||||||
|
selectedAnimator.start();
|
||||||
|
|
||||||
|
unselectedAnimator = ObjectAnimator.ofFloat(unselected, "alpha", 1f, 0f);
|
||||||
|
unselectedAnimator.setDuration(300);
|
||||||
|
unselectedAnimator.start();
|
||||||
|
} else {
|
||||||
|
// change to unselected
|
||||||
|
selected.setAlpha(1);
|
||||||
|
unselected.setAlpha(0);
|
||||||
|
if (selectedAnimator != null) selectedAnimator.cancel();
|
||||||
|
if (unselectedAnimator != null) unselectedAnimator.cancel();
|
||||||
|
|
||||||
|
selectedAnimator = ObjectAnimator.ofFloat(selected, "alpha", 1f, 0f);
|
||||||
|
selectedAnimator.setDuration(300);
|
||||||
|
selectedAnimator.start();
|
||||||
|
|
||||||
|
unselectedAnimator = ObjectAnimator.ofFloat(unselected, "alpha", 0f, 1f);
|
||||||
|
unselectedAnimator.setDuration(300);
|
||||||
|
unselectedAnimator.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the dot.
|
||||||
|
*/
|
||||||
|
public void clear() {
|
||||||
|
selected.setAlpha(0);
|
||||||
|
unselected.setAlpha(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
import android.graphics.PointF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
public abstract class CubicBezier {
|
||||||
|
|
||||||
|
private PointF start;
|
||||||
|
private PointF end;
|
||||||
|
private PointF a = new PointF();
|
||||||
|
private PointF b = new PointF();
|
||||||
|
private PointF c = new PointF();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* init the 4 values of the cubic-bezier
|
||||||
|
* @param startX x of start
|
||||||
|
* @param startY y of start
|
||||||
|
* @param endX x of end
|
||||||
|
* @param endY y of end
|
||||||
|
*/
|
||||||
|
public void init(float startX, float startY, float endX, float endY) {
|
||||||
|
setStart(new PointF(startX, startY));
|
||||||
|
setEnd(new PointF(endX, endY));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double startX, double startY, double endX, double endY) {
|
||||||
|
init((float) startX, (float) startY, (float) endX, (float) endY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float offset) {
|
||||||
|
return getBezierCoordinateY(getXForTime(offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getBezierCoordinateY(float time) {
|
||||||
|
c.y = 3 * start.y;
|
||||||
|
b.y = 3 * (end.y - start.y) - c.y;
|
||||||
|
a.y = 1 - c.y - b.y;
|
||||||
|
return time * (c.y + time * (b.y + time * a.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getXForTime(float time) {
|
||||||
|
float x = time;
|
||||||
|
float z;
|
||||||
|
for (int i = 1; i < 14; i++) {
|
||||||
|
z = getBezierCoordinateX(x) - time;
|
||||||
|
if (Math.abs(z) < 1e-3) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x -= z / getXDerivate(x);
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getXDerivate(float t) {
|
||||||
|
return c.x + t * (2 * b.x + 3 * a.x * t);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getBezierCoordinateX(float time) {
|
||||||
|
c.x = 3 * start.x;
|
||||||
|
b.x = 3 * (end.x - start.x) - c.x;
|
||||||
|
a.x = 1 - c.x - b.x;
|
||||||
|
return time * (c.x + time * (b.x + time * a.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointF getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(PointF start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointF getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(PointF end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInBack extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInBack() {
|
||||||
|
init(0.6, -0.28, 0.735, 0.045);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInBounce extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInBounce() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
return c - easeOutBounce(d-t, 0, c, d) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float easeOutBounce(float t, float b, float c, float d) {
|
||||||
|
if ((t/=d) < (1/2.75f)) {
|
||||||
|
return c*(7.5625f*t*t) + b;
|
||||||
|
} else if (t < (2/2.75f)) {
|
||||||
|
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
|
||||||
|
} else if (t < (2.5/2.75)) {
|
||||||
|
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
|
||||||
|
} else {
|
||||||
|
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInCirc extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInCirc() {
|
||||||
|
init(0.6, 0.04, 0.98, 0.335);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInCubic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInCubic() {
|
||||||
|
init(0.55, 0.055, 0.675, 0.19);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInElastic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInElastic() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
if (t==0) return b; if ((t/=d)==1) return b+c;
|
||||||
|
float p=d*.3f;
|
||||||
|
float a=c;
|
||||||
|
float s=p/4;
|
||||||
|
return -(a*(float) Math.pow(2,10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInExpo extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInExpo() {
|
||||||
|
init(0.95, 0.05, 0.795, 0.035);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutBack extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutBack() {
|
||||||
|
init(0.68, -0.55, 0.265, 1.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutBounce extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutBounce() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
if (t < d / 2)
|
||||||
|
return easeInBounce(t * 2, 0, c, d) * .5f + b;
|
||||||
|
else
|
||||||
|
return easeOutBounce(t * 2 - d, 0, c, d) * .5f + c * .5f + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float easeInBounce(float t, float b, float c, float d) {
|
||||||
|
return c - easeOutBounce(d - t, 0, c, d) + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float easeOutBounce(float t, float b, float c, float d) {
|
||||||
|
if ((t/=d) < (1/2.75f)) {
|
||||||
|
return c*(7.5625f*t*t) + b;
|
||||||
|
} else if (t < (2/2.75f)) {
|
||||||
|
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
|
||||||
|
} else if (t < (2.5/2.75)) {
|
||||||
|
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
|
||||||
|
} else {
|
||||||
|
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutCirc extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutCirc() {
|
||||||
|
init(0.785, 0.135, 0.15, 0.86);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutCubic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutCubic() {
|
||||||
|
init(0.645, 0.045, 0.355, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutElastic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutElastic() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
if (t==0) return b; if ((t/=d/2)==2) return b+c;
|
||||||
|
float p=d*(.3f*1.5f);
|
||||||
|
float a=c;
|
||||||
|
float s=p/4;
|
||||||
|
if (t < 1) return -.5f*(a*(float) Math.pow(2,10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )) + b;
|
||||||
|
return a*(float) Math.pow(2,-10*(t-=1)) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p )*.5f + c + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutExpo extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutExpo() {
|
||||||
|
init(1, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutQuad extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutQuad() {
|
||||||
|
init(0.455, 0.03, 0.515, 0.955);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutQuart extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutQuart() {
|
||||||
|
init(0.77, 0, 0.175, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutQuint extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutQuint() {
|
||||||
|
init(0.86, 0, 0.07, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInOutSine extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInOutSine() {
|
||||||
|
init(0.445, 0.05, 0.55, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInQuad extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInQuad() {
|
||||||
|
init(0.55, 0.085, 0.68, 0.53);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInQuart extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInQuart() {
|
||||||
|
init(0.895, 0.03, 0.685, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInQuint extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInQuint() {
|
||||||
|
init(0.755, 0.05, 0.855, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseInSine extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseInSine() {
|
||||||
|
init(0.47, 0, 0.745, 0.715);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutBack extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutBack() {
|
||||||
|
init(0.175, 0.885, 0.32, 1.275);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutBounce extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutBounce() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
if ((t/=d) < (1/2.75f)) {
|
||||||
|
return c*(7.5625f*t*t) + b;
|
||||||
|
} else if (t < (2/2.75f)) {
|
||||||
|
return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
|
||||||
|
} else if (t < (2.5/2.75)) {
|
||||||
|
return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
|
||||||
|
} else {
|
||||||
|
return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutCirc extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutCirc() {
|
||||||
|
init(0.075, 0.82, 0.165, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutCubic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutCubic() {
|
||||||
|
init(0.215, 0.61, 0.355, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutElastic extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutElastic() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float t) {
|
||||||
|
float b = 0;
|
||||||
|
float c = 1;
|
||||||
|
float d = 1;
|
||||||
|
if (t==0) return b; if ((t/=d)==1) return b+c;
|
||||||
|
float p=d*.3f;
|
||||||
|
float a=c;
|
||||||
|
float s=p/4;
|
||||||
|
return (a*(float) Math.pow(2,-10*t) * (float) Math.sin( (t*d-s)*(2*(float) Math.PI)/p ) + c + b);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutExpo extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutExpo() {
|
||||||
|
init(0.19, 1, 0.22, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutQuad extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutQuad() {
|
||||||
|
init(0.25, 0.46, 0.45, 0.94);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutQuart extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutQuart() {
|
||||||
|
init(0.165, 0.84, 0.44, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutQuint extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutQuint() {
|
||||||
|
init(0.23, 1, 0.32, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EaseOutSine extends CubicBezier {
|
||||||
|
|
||||||
|
public EaseOutSine() {
|
||||||
|
init(0.39, 0.575, 0.565, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum EaseType {
|
||||||
|
|
||||||
|
EaseInSine(EaseInSine.class),
|
||||||
|
EaseOutSine(EaseOutSine.class),
|
||||||
|
EaseInOutSine(EaseInOutSine.class),
|
||||||
|
|
||||||
|
EaseInQuad(EaseInQuad.class),
|
||||||
|
EaseOutQuad(EaseOutQuad.class),
|
||||||
|
EaseInOutQuad(EaseInOutQuad.class),
|
||||||
|
|
||||||
|
EaseInCubic(EaseInCubic.class),
|
||||||
|
EaseOutCubic(EaseOutCubic.class),
|
||||||
|
EaseInOutCubic(EaseInOutCubic.class),
|
||||||
|
|
||||||
|
EaseInQuart(EaseInQuart.class),
|
||||||
|
EaseOutQuart(EaseOutQuart.class),
|
||||||
|
EaseInOutQuart(EaseInOutQuart.class),
|
||||||
|
|
||||||
|
EaseInQuint(EaseInQuint.class),
|
||||||
|
EaseOutQuint(EaseOutQuint.class),
|
||||||
|
EaseInOutQuint(EaseInOutQuint.class),
|
||||||
|
|
||||||
|
EaseInExpo(EaseInExpo.class),
|
||||||
|
EaseOutExpo(EaseOutExpo.class),
|
||||||
|
EaseInOutExpo(EaseInOutExpo.class),
|
||||||
|
|
||||||
|
EaseInCirc(EaseInCirc.class),
|
||||||
|
EaseOutCirc(EaseOutCirc.class),
|
||||||
|
EaseInOutCirc(EaseInOutCirc.class),
|
||||||
|
|
||||||
|
EaseInBack(EaseInBack.class),
|
||||||
|
EaseOutBack(EaseOutBack.class),
|
||||||
|
EaseInOutBack(EaseInOutBack.class),
|
||||||
|
|
||||||
|
EaseInElastic(EaseInElastic.class),
|
||||||
|
EaseOutElastic(EaseOutElastic.class),
|
||||||
|
EaseInOutElastic(EaseInOutElastic.class),
|
||||||
|
|
||||||
|
EaseInBounce(EaseInBounce.class),
|
||||||
|
EaseOutBounce(EaseOutBounce.class),
|
||||||
|
EaseInOutBounce(EaseInOutBounce.class),
|
||||||
|
|
||||||
|
Linear(Linear.class);
|
||||||
|
|
||||||
|
private Class easingType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ease animation helps to make the movement more real
|
||||||
|
* @param easingType
|
||||||
|
*/
|
||||||
|
EaseType(Class easingType) {
|
||||||
|
this.easingType = easingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getOffset(float offset) {
|
||||||
|
try {
|
||||||
|
return ((CubicBezier) easingType.getConstructor().newInstance()).getOffset(offset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new Error("CubicBezier init error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview.Eases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Linear extends CubicBezier {
|
||||||
|
|
||||||
|
public Linear() {
|
||||||
|
init(0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public class Indicator extends LinearLayout {
|
||||||
|
|
||||||
|
private Dot[] dots;
|
||||||
|
private int number = 0;
|
||||||
|
|
||||||
|
public Indicator(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Indicator(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPasswordLength(int length) {
|
||||||
|
removeAllViews();
|
||||||
|
dots = new Dot[length];
|
||||||
|
|
||||||
|
for(int i = 0; i < length; i++) {
|
||||||
|
Dot view = new Dot(getContext());
|
||||||
|
|
||||||
|
view.setBackgroundResource(R.drawable.indicator_background);
|
||||||
|
|
||||||
|
LayoutParams params = new LayoutParams(
|
||||||
|
30,
|
||||||
|
30
|
||||||
|
);
|
||||||
|
params.setMargins(20, 10, 20, 10);
|
||||||
|
addView(view, params);
|
||||||
|
dots[i] = view;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a dot.
|
||||||
|
*/
|
||||||
|
public void add() {
|
||||||
|
if (number == dots.length) return;
|
||||||
|
dots[number++].setSelected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a dot.
|
||||||
|
*/
|
||||||
|
public void delete() {
|
||||||
|
if (number == 0) return;
|
||||||
|
dots[--number].setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all dots.
|
||||||
|
*/
|
||||||
|
public void clear() {
|
||||||
|
number = 0;
|
||||||
|
for (int i = 0; i < dots.length; i++) dots[i].setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.blurlockview.Eases.EaseType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public class InterpolatorFactory {
|
||||||
|
|
||||||
|
public static BLVInterpolator getInterpolator(EaseType easeType) {
|
||||||
|
return new BLVInterpolator(easeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BLVInterpolator implements Interpolator {
|
||||||
|
|
||||||
|
private EaseType easeType;
|
||||||
|
|
||||||
|
public BLVInterpolator(EaseType easeType) {
|
||||||
|
this.easeType = easeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getInterpolation(float input) {
|
||||||
|
return easeType.getOffset(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/17.
|
||||||
|
*/
|
||||||
|
public enum Password {
|
||||||
|
|
||||||
|
NUMBER(0),
|
||||||
|
TEXT(1);
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
private Password(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package cpm.com.gskmtorange.blurlockview;
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Weiping on 2016/3/16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SmallButtonView extends FrameLayout {
|
||||||
|
|
||||||
|
private FrameLayout frameLayout;
|
||||||
|
private View clickEffect;
|
||||||
|
private TextView text;
|
||||||
|
private String textString = "";
|
||||||
|
private ObjectAnimator clickEffectAnimator;
|
||||||
|
private int duration = 500;
|
||||||
|
private OnPressListener onPressListener;
|
||||||
|
|
||||||
|
public SmallButtonView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmallButtonView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.small_button_view, this, true);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
frameLayout = (FrameLayout)findViewById(R.id.frame_layout);
|
||||||
|
|
||||||
|
text = (TextView)findViewById(R.id.text);
|
||||||
|
text.setText(textString);
|
||||||
|
text.setTextColor(ContextCompat.getColor(context, R.color.default_small_button_text_color));
|
||||||
|
text.setTextSize(resources.getInteger(R.integer.default_small_button_text_size));
|
||||||
|
|
||||||
|
clickEffect = findViewById(R.id.click_effect);
|
||||||
|
clickEffect.setAlpha(0);
|
||||||
|
clickEffectAnimator = ObjectAnimator.ofFloat(clickEffect, "alpha", 1f, 0f);
|
||||||
|
clickEffectAnimator.setDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the listener, for returning what happened to BlurLockView.
|
||||||
|
*
|
||||||
|
* @param onPressListener OnPressListener.
|
||||||
|
*/
|
||||||
|
public void setOnPressListener(OnPressListener onPressListener) {
|
||||||
|
this.onPressListener = onPressListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the width of the button.
|
||||||
|
*
|
||||||
|
* @param width Width, in pixels.
|
||||||
|
*/
|
||||||
|
public void setWidth(int width) {
|
||||||
|
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
|
||||||
|
layoutParams.width = width;
|
||||||
|
frameLayout.setLayoutParams(layoutParams);
|
||||||
|
layoutParams = clickEffect.getLayoutParams();
|
||||||
|
layoutParams.width = width;
|
||||||
|
clickEffect.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the height of the button.
|
||||||
|
*
|
||||||
|
* @param height Height, in pixels.
|
||||||
|
*/
|
||||||
|
public void setHeight(int height) {
|
||||||
|
ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
|
||||||
|
layoutParams.height = height;
|
||||||
|
frameLayout.setLayoutParams(layoutParams);
|
||||||
|
layoutParams = clickEffect.getLayoutParams();
|
||||||
|
layoutParams.height = height;
|
||||||
|
clickEffect.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the resource of background.
|
||||||
|
*
|
||||||
|
* @param resourceId ResourceId.
|
||||||
|
*/
|
||||||
|
public void setBackground(int resourceId) {
|
||||||
|
frameLayout.setBackgroundResource(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the resource of click effect.
|
||||||
|
*
|
||||||
|
* @param resourceId ResourceId.
|
||||||
|
*/
|
||||||
|
public void setEffect(int resourceId) {
|
||||||
|
clickEffect.setBackgroundResource(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the duration of the effect.
|
||||||
|
*
|
||||||
|
* @param duration Duration, in ms.
|
||||||
|
*/
|
||||||
|
public void setEffectDuration(int duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text size of the main text.
|
||||||
|
*
|
||||||
|
* @param size Text size, in sp.
|
||||||
|
*/
|
||||||
|
public void setTextSize(int size) {
|
||||||
|
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text color of main text.
|
||||||
|
*
|
||||||
|
* @param color Color.
|
||||||
|
*/
|
||||||
|
public void setTextColor(int color) {
|
||||||
|
text.setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set font of button.
|
||||||
|
*
|
||||||
|
* @param typeFace New font.
|
||||||
|
*/
|
||||||
|
public void setTypeFace(Typeface typeFace) {
|
||||||
|
text.setTypeface(typeFace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the string of the text.
|
||||||
|
*
|
||||||
|
* @param textString The new string.
|
||||||
|
*/
|
||||||
|
public void setText(String textString) {
|
||||||
|
this.textString = textString;
|
||||||
|
if (text != null) text.setText(textString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform the click effect.
|
||||||
|
*
|
||||||
|
* @param event MotionEvent.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
switch(event.getAction()){
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
if (onPressListener != null) onPressListener.onPress(textString);
|
||||||
|
clickEffectAnimator.cancel();
|
||||||
|
clickEffect.setAlpha(1);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
clickEffectAnimator.start();
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the animation.
|
||||||
|
*/
|
||||||
|
public void clearAnimation() {
|
||||||
|
if (clickEffect.getAlpha() == 1) {
|
||||||
|
clickEffectAnimator.cancel();
|
||||||
|
clickEffectAnimator.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPressListener {
|
||||||
|
void onPress(String string);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package cpm.com.gskmtorange.constant;
|
package cpm.com.gskmtorange.constant;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -13,6 +15,10 @@ import android.widget.ImageView;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yadavendras on 13-11-2017.
|
* Created by yadavendras on 13-11-2017.
|
||||||
@@ -133,4 +139,48 @@ public class CommonFunctions {
|
|||||||
|
|
||||||
return inSampleSize;
|
return inSampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showAlertDialog(final Context context, String msg){
|
||||||
|
|
||||||
|
final DialogCallbackListener[] mListener = new DialogCallbackListener[1];
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Instantiate the NoticeDialogListener so we can send events to the host
|
||||||
|
mListener[0] = (DialogCallbackListener) context;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
Activity activity = (Activity) context;
|
||||||
|
// The activity doesn't implement the interface, throw exception
|
||||||
|
throw new ClassCastException(activity.getClass() + " must implement DialogCallbackListener");
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean[] flag = new boolean[1];
|
||||||
|
|
||||||
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||||
|
alertDialogBuilder.setTitle(context.getResources().getString(R.string.dialog_title));
|
||||||
|
|
||||||
|
// set dialog message
|
||||||
|
alertDialogBuilder.setMessage(msg)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(context.getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
mListener[0].onSelect(true);
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(context.getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
// if this button is clicked, just close
|
||||||
|
// the dialog box and do nothing
|
||||||
|
mListener[0].onSelect(false);
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// create alert dialog
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
|
// show it
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class CommonString {
|
|||||||
public static final String KEY_P = "P";
|
public static final String KEY_P = "P";
|
||||||
public static final String KEY_D = "D";
|
public static final String KEY_D = "D";
|
||||||
public static final String KEY_U = "U";
|
public static final String KEY_U = "U";
|
||||||
|
public static final String KEY_UN = "UN";
|
||||||
public static final String KEY_C = "C";
|
public static final String KEY_C = "C";
|
||||||
public static final String KEY_Y = "Y";
|
public static final String KEY_Y = "Y";
|
||||||
public static final String KEY_L = "Leave";
|
public static final String KEY_L = "Leave";
|
||||||
@@ -183,6 +184,10 @@ public class CommonString {
|
|||||||
|
|
||||||
public static final String SOAP_ACTION_UPLOAD_IMAGE = "http://tempuri.org/" + METHOD_UPLOAD_IMAGE;
|
public static final String SOAP_ACTION_UPLOAD_IMAGE = "http://tempuri.org/" + METHOD_UPLOAD_IMAGE;
|
||||||
|
|
||||||
|
public static final String METHOD_UPDATE_PASSWORD = "Update_Password";
|
||||||
|
public static final String SOAP_ACTION_UPDATE_PASSWORD = "http://tempuri.org/"
|
||||||
|
+ METHOD_UPDATE_PASSWORD;
|
||||||
|
|
||||||
//Alert Messages
|
//Alert Messages
|
||||||
public static final String MESSAGE_FAILURE = "Server Error.Please Access After Some Time";
|
public static final String MESSAGE_FAILURE = "Server Error.Please Access After Some Time";
|
||||||
public static final String MESSAGE_FALSE = "Invalid User";
|
public static final String MESSAGE_FALSE = "Invalid User";
|
||||||
@@ -1001,6 +1006,9 @@ public class CommonString {
|
|||||||
+ "ANSWER_ID"
|
+ "ANSWER_ID"
|
||||||
+ " INTEGER,"
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "ANSWER"
|
||||||
|
+ " VARCHAR,"
|
||||||
|
|
||||||
+ "CATEGORY_ID"
|
+ "CATEGORY_ID"
|
||||||
+ " INTEGER,"
|
+ " INTEGER,"
|
||||||
|
|
||||||
@@ -1037,5 +1045,99 @@ public class CommonString {
|
|||||||
+ "CATEGORY_ID"
|
+ "CATEGORY_ID"
|
||||||
+ " INTEGER"
|
+ " INTEGER"
|
||||||
|
|
||||||
|
+ ")";
|
||||||
|
|
||||||
|
public static String IS_PASSWORD_CHECK = "IS_PASSWORD_CHECK";
|
||||||
|
public static String MPIN = "MPIN";
|
||||||
|
public static String TABLE_MAPPING_STOCK_ADHOC = "MAPPING_STOCK_ADHOC";
|
||||||
|
public static String TABLE_MAPPING_STOCK = "MAPPING_STOCK";
|
||||||
|
public static String TABLE_MAPPING_STOCK_STOREWISE = "MAPPING_STOCK_STOREWISE";
|
||||||
|
public static String TABLE_MAPPING_T2P_ADHOC = "MAPPING_T2P_ADHOC";
|
||||||
|
public static String TABLE_MAPPING_PROMOTION_ADHOC = "MAPPING_PROMOTION_ADHOC";
|
||||||
|
public static String TABLE_MAPPING_ADDITIONAL_PROMOTION_ADHOC = "MAPPING_ADDITIONAL_PROMOTION_ADHOC";
|
||||||
|
public static String TABLE_MAPPING_PLANOGRAM_ADHOC = "MAPPING_PLANOGRAM_ADHOC";
|
||||||
|
public static String TABLE_MAPPING_SOS_TARGET_ADHOC = "MAPPING_SOS_TARGET_ADHOC";
|
||||||
|
public static String TABLE_NO_CAMERA_LAST_VISIT_DATA_ADHOC = "NO_CAMERA_LAST_VISIT_DATA_ADHOC";
|
||||||
|
public static String TABLE_STORE_PERFORMANCE_NEW_ADHOC = "STORE_PERFORMANCE_NEW_ADHOC";
|
||||||
|
|
||||||
|
public static final String TABLE_IS_ADHOC_SAVED = "IS_ADHOC_SAVED";
|
||||||
|
public static final String CREATE_ABLE_IS_ADHOC_SAVED = "CREATE TABLE IF NOT EXISTS "
|
||||||
|
+ TABLE_IS_ADHOC_SAVED
|
||||||
|
+ " ("
|
||||||
|
+ "KEY_ID"
|
||||||
|
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||||
|
|
||||||
|
+ KEY_STORE_ID
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ KEY_VISIT_DATE
|
||||||
|
+ " VARCHAR"
|
||||||
|
|
||||||
|
+ ")";
|
||||||
|
|
||||||
|
public static String TABLE_MAPPING_PLANOGRAM = "MAPPING_PLANOGRAM";
|
||||||
|
public static String TABLE_MAPPING_PLANOGRAM_STORE_WISE = "MAPPING_PLANOGRAM_STORE_WISE";
|
||||||
|
public static String TABLE_MAPPING_T2P = "MAPPING_T2P";
|
||||||
|
public static String TABLE_MAPPING_PROMOTION = "MAPPING_PROMOTION";
|
||||||
|
public static String TABLE_MAPPING_ADDITIONAL_PROMOTION = "MAPPING_ADDITIONAL_PROMOTION";
|
||||||
|
public static String TABLE_MAPPING_SOS_TARGET = "MAPPING_SOS_TARGET";
|
||||||
|
|
||||||
|
public static final String TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS = "COUNTERFEIT_PRODUCT_EXISTS";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS = "CREATE TABLE IF NOT EXISTS "
|
||||||
|
+ TABLE_INSERT_COUNTERFEIT_PRODUCT_EXISTS
|
||||||
|
+ "("
|
||||||
|
+ "KEY_ID"
|
||||||
|
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||||
|
|
||||||
|
+ "STORE_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "CATEGORY_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "Existss"
|
||||||
|
+ " INTEGER"
|
||||||
|
|
||||||
|
+ ")";
|
||||||
|
|
||||||
|
public static final String TABLE_INSERT_COUNTERFEIT_PRODUCT = "COUNTERFEIT_PRODUCT";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_INSERT_COUNTERFEIT_PRODUCT = "CREATE TABLE IF NOT EXISTS "
|
||||||
|
+ TABLE_INSERT_COUNTERFEIT_PRODUCT
|
||||||
|
+ "("
|
||||||
|
+ "KEY_ID"
|
||||||
|
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||||
|
|
||||||
|
+ "STORE_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "CATEGORY_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "COMMON_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "SKU"
|
||||||
|
+ " VARCHAR,"
|
||||||
|
|
||||||
|
+ "BRAND_ID"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "BRAND"
|
||||||
|
+ " VARCHAR,"
|
||||||
|
|
||||||
|
+ "STOCK"
|
||||||
|
+ " INTEGER,"
|
||||||
|
|
||||||
|
+ "IMAGE"
|
||||||
|
+ " VARCHAR,"
|
||||||
|
|
||||||
|
+ "IMAGE1"
|
||||||
|
+ " VARCHAR,"
|
||||||
|
|
||||||
|
+ "IMAGE2"
|
||||||
|
+ " VARCHAR"
|
||||||
|
|
||||||
+ ")";
|
+ ")";
|
||||||
}
|
}
|
||||||
|
|||||||
+83
-10
@@ -36,6 +36,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -80,6 +81,8 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
PromoAdapter promoAdapter;
|
PromoAdapter promoAdapter;
|
||||||
int price_flasher_available = -1;
|
int price_flasher_available = -1;
|
||||||
|
|
||||||
|
ToggleButton btntoggle;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -100,7 +103,8 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
et_discount = (EditText) findViewById(R.id.et_discount);
|
et_discount = (EditText) findViewById(R.id.et_discount);
|
||||||
et_price = (EditText) findViewById(R.id.et_price);
|
et_price = (EditText) findViewById(R.id.et_price);
|
||||||
img_cam = (ImageView) findViewById(R.id.img_promotion_add);
|
img_cam = (ImageView) findViewById(R.id.img_promotion_add);
|
||||||
lin_parent = (LinearLayout) findViewById(R.id.lin_parent);
|
lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo);
|
||||||
|
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
|
||||||
|
|
||||||
//preference data
|
//preference data
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
@@ -154,6 +158,8 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btntoggle.setChecked(isExists);
|
||||||
|
|
||||||
if(added_promo_list.size()>0){
|
if(added_promo_list.size()>0){
|
||||||
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
promoAdapter = new PromoAdapter(added_promo_list);
|
promoAdapter = new PromoAdapter(added_promo_list);
|
||||||
@@ -196,6 +202,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
fab_add.setOnClickListener(this);
|
fab_add.setOnClickListener(this);
|
||||||
fab_save.setOnClickListener(this);
|
fab_save.setOnClickListener(this);
|
||||||
img_cam.setOnClickListener(this);
|
img_cam.setOnClickListener(this);
|
||||||
|
btntoggle.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -344,8 +351,11 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
else if(isdata_added){
|
else if(isdata_added){
|
||||||
|
|
||||||
|
db.InsertPromoSKUwiseData(added_promo_list, categoryId, store_id, isExists);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
/*AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||||
AdditionalPromoSKUwiseActivity.this);
|
AdditionalPromoSKUwiseActivity.this);
|
||||||
// set title
|
// set title
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
@@ -356,9 +366,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
.setPositiveButton(getResources().getString(R.string.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.InsertPromoSKUwiseData(added_promo_list, categoryId, store_id, isExists);
|
|
||||||
finish();
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
@@ -373,7 +381,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
// show it
|
// show it
|
||||||
alertDialog.show();
|
alertDialog.show();*/
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
finish();
|
finish();
|
||||||
@@ -458,6 +466,71 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
startCameraActivity(1);
|
startCameraActivity(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.btntoggle:
|
||||||
|
isExists = btntoggle.isChecked();
|
||||||
|
|
||||||
|
if(isExists){
|
||||||
|
lin_parent.setVisibility(View.VISIBLE);
|
||||||
|
fab_add.show();//.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalPromoSKUwiseActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
fab_add.hide();//.setVisibility(View.GONE);
|
||||||
|
added_promo_list.clear();
|
||||||
|
|
||||||
|
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
|
promoAdapter = new PromoAdapter(added_promo_list);
|
||||||
|
rec_added_promo.setAdapter(promoAdapter);
|
||||||
|
|
||||||
|
/* if(promoAdapter!=null){
|
||||||
|
promoAdapter.list.clear();
|
||||||
|
promoAdapter.notifyDataSetChanged();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
lin_parent.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
sub_category = "";
|
||||||
|
sub_category_id = "0";
|
||||||
|
brand= "";
|
||||||
|
brand_id = "0";
|
||||||
|
sku = "";
|
||||||
|
sku_id = "0";
|
||||||
|
discount = "";
|
||||||
|
price = "";
|
||||||
|
img_str = "";
|
||||||
|
|
||||||
|
et_discount.setText("");
|
||||||
|
et_price.setText("");
|
||||||
|
spinner_sub_category_list.setSelection(0);
|
||||||
|
clearBrandSpinner();
|
||||||
|
clearSkuSpinner();
|
||||||
|
if(is_camera_compulsory){
|
||||||
|
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
|
}
|
||||||
|
isdata_added = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
//checkBox.setChecked(true);
|
||||||
|
btntoggle.setChecked(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -799,7 +872,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
ischanged();
|
ischanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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.menu_promo_skuwise, menu);
|
getMenuInflater().inflate(R.menu.menu_promo_skuwise, menu);
|
||||||
@@ -831,10 +904,10 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
promoAdapter = new PromoAdapter(added_promo_list);
|
promoAdapter = new PromoAdapter(added_promo_list);
|
||||||
rec_added_promo.setAdapter(promoAdapter);
|
rec_added_promo.setAdapter(promoAdapter);
|
||||||
|
|
||||||
/* if(promoAdapter!=null){
|
*//* if(promoAdapter!=null){
|
||||||
promoAdapter.list.clear();
|
promoAdapter.list.clear();
|
||||||
promoAdapter.notifyDataSetChanged();
|
promoAdapter.notifyDataSetChanged();
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
lin_parent.setVisibility(View.GONE);
|
lin_parent.setVisibility(View.GONE);
|
||||||
|
|
||||||
@@ -876,7 +949,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
|
|||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|||||||
+132
-47
@@ -60,6 +60,7 @@ import cpm.com.gskmtorange.GetterSetter.AddittionalGetterSetter;
|
|||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.ADDITIONAL_DISPLAY_MASTERGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.ADDITIONAL_DISPLAY_MASTERGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
||||||
@@ -68,7 +69,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
|||||||
* Created by ashishc on 05-01-2017.
|
* Created by ashishc on 05-01-2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
|
public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener, DialogCallbackListener {
|
||||||
ArrayList<AdditionalDialogGetterSetter> list = new ArrayList<AdditionalDialogGetterSetter>();
|
ArrayList<AdditionalDialogGetterSetter> list = new ArrayList<AdditionalDialogGetterSetter>();
|
||||||
ArrayList<AddittionalGetterSetter> listdata = new ArrayList<>();
|
ArrayList<AddittionalGetterSetter> listdata = new ArrayList<>();
|
||||||
ArrayList<AddittionalGetterSetter> listMain = new ArrayList<AddittionalGetterSetter>();
|
ArrayList<AddittionalGetterSetter> listMain = new ArrayList<AddittionalGetterSetter>();
|
||||||
@@ -83,7 +84,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
public static ArrayList<AddittionalGetterSetter> data = new ArrayList<AddittionalGetterSetter>();
|
public static ArrayList<AddittionalGetterSetter> data = new ArrayList<AddittionalGetterSetter>();
|
||||||
ToggleButton btntoggle;
|
ToggleButton btntoggle;
|
||||||
ImageView btnimage, btnedit, btnimage1, btnimage2;
|
ImageView btnimage, btnedit, btnimage1, btnimage2;
|
||||||
Button btnsku, btnaddlayout;
|
Button btnsku; //btnaddlayout;
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
ArrayList<SkuGetterSetter> sku_list;
|
ArrayList<SkuGetterSetter> sku_list;
|
||||||
String brand_name = "", brand_id = "", SKU_name = "", SKU_ID = "", brand_list_name = "", brand_list_id = "", sku_list_name = "", sku_list_id = "", display_planogram_url="";
|
String brand_name = "", brand_id = "", SKU_name = "", SKU_ID = "", brand_list_name = "", brand_list_id = "", sku_list_name = "", sku_list_id = "", display_planogram_url="";
|
||||||
@@ -106,17 +107,18 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
EditText Edt_txt;
|
EditText Edt_txt;
|
||||||
MyAdaptorStock adapterData;
|
MyAdaptorStock adapterData;
|
||||||
ListView listviewlay;
|
ListView listviewlay;
|
||||||
String errormsg, categoryName, categoryId,country_id;
|
String errormsg, categoryName, categoryId,country_id, store_flag_str;
|
||||||
MyAdaptorAdditionalStock adapteradditional;
|
MyAdaptorAdditionalStock adapteradditional;
|
||||||
AddittionalGetterSetter adGt, newadd;
|
AddittionalGetterSetter adGt, newadd;
|
||||||
LinearLayout brandlayout, diaplylayout, cameralayout;
|
LinearLayout brandlayout, diaplylayout, cameralayout;
|
||||||
FloatingActionButton fab;
|
FloatingActionButton fab, fab_add;
|
||||||
//RelativeLayout skulayout;
|
//RelativeLayout skulayout;
|
||||||
CardView cardvew, maincard;
|
//CardView cardvew, maincard;
|
||||||
String gallery_package = "";
|
String gallery_package = "";
|
||||||
Uri outputFileUri;
|
Uri outputFileUri;
|
||||||
|
|
||||||
Toolbar toolbar;
|
Toolbar toolbar;
|
||||||
|
boolean editFlag = false;
|
||||||
|
|
||||||
////String brand_id,SKU_ID;
|
////String brand_id,SKU_ID;
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -127,7 +129,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
@@ -138,6 +140,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||||
|
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
@@ -152,7 +155,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
db.open();
|
db.open();
|
||||||
spinner_brand_list = (Spinner) findViewById(R.id.spinner_Brand1);
|
spinner_brand_list = (Spinner) findViewById(R.id.spinner_Brand1);
|
||||||
spinner_sku_list = (Spinner) findViewById(R.id.spinner_SkuMaster);
|
spinner_sku_list = (Spinner) findViewById(R.id.spinner_SkuMaster);
|
||||||
cardvew = (CardView) findViewById(R.id.cardviewid);
|
//cardvew = (CardView) findViewById(R.id.cardviewid);
|
||||||
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
|
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
|
||||||
btnimage = (ImageView) findViewById(R.id.btn_image);
|
btnimage = (ImageView) findViewById(R.id.btn_image);
|
||||||
btnimage1 = (ImageView) findViewById(R.id.btn_image2);
|
btnimage1 = (ImageView) findViewById(R.id.btn_image2);
|
||||||
@@ -160,13 +163,14 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
btnedit = (ImageView) findViewById(R.id.btn_edit);
|
btnedit = (ImageView) findViewById(R.id.btn_edit);
|
||||||
btnsku = (Button) findViewById(R.id.btn_sku);
|
btnsku = (Button) findViewById(R.id.btn_sku);
|
||||||
btnaddlayout = (Button) findViewById(R.id.btadd);
|
//btnaddlayout = (Button) findViewById(R.id.btadd);
|
||||||
listviewlay = (ListView) findViewById(R.id.listviewlv);
|
listviewlay = (ListView) findViewById(R.id.listviewlv);
|
||||||
brandlayout = (LinearLayout) findViewById(R.id.tv_brandlayout);
|
brandlayout = (LinearLayout) findViewById(R.id.tv_brandlayout);
|
||||||
diaplylayout = (LinearLayout) findViewById(R.id.tv_displaylayout);
|
diaplylayout = (LinearLayout) findViewById(R.id.tv_displaylayout);
|
||||||
cameralayout = (LinearLayout) findViewById(R.id.tv_cameralayout);
|
cameralayout = (LinearLayout) findViewById(R.id.tv_cameralayout);
|
||||||
fab = (FloatingActionButton) findViewById(R.id.fab);
|
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
maincard = (CardView) findViewById(R.id.cardviewid);
|
fab_add = (FloatingActionButton) findViewById(R.id.fab_add);
|
||||||
|
//maincard = (CardView) findViewById(R.id.cardviewid);
|
||||||
img_planogram = (ImageView) findViewById(R.id.img_planogram);
|
img_planogram = (ImageView) findViewById(R.id.img_planogram);
|
||||||
|
|
||||||
img_planogram.setOnClickListener(new View.OnClickListener() {
|
img_planogram.setOnClickListener(new View.OnClickListener() {
|
||||||
@@ -266,9 +270,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
if (tooglevalue.equalsIgnoreCase("0")) {
|
if (tooglevalue.equalsIgnoreCase("0")) {
|
||||||
listviewlay.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||||
cardvew.setVisibility(View.INVISIBLE);
|
fab_add.hide();
|
||||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
|
||||||
|
|
||||||
btntoggle.setChecked(false);
|
btntoggle.setChecked(false);
|
||||||
brandlayout.setVisibility(View.GONE);
|
brandlayout.setVisibility(View.GONE);
|
||||||
@@ -279,10 +282,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||||
listviewlay.setAdapter(adapteradditional);
|
listviewlay.setAdapter(adapteradditional);
|
||||||
listviewlay.invalidateViews();
|
listviewlay.invalidateViews();
|
||||||
btnaddlayout.setVisibility(View.VISIBLE);
|
//btnaddlayout.setVisibility(View.VISIBLE);
|
||||||
cardvew.setVisibility(View.VISIBLE);
|
fab_add.show();
|
||||||
listviewlay.setVisibility(View.VISIBLE);
|
listviewlay.setVisibility(View.VISIBLE);
|
||||||
maincard.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* String KeyID = listdata.get(k).getKey_id();
|
/* String KeyID = listdata.get(k).getKey_id();
|
||||||
@@ -342,7 +344,15 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||||
|
|
||||||
if (listdata.size() > 0) {
|
if (listdata.size() > 0) {
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
|
||||||
|
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||||
|
|
||||||
|
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
|
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||||
AdditionalVisibility.this);
|
AdditionalVisibility.this);
|
||||||
// set title
|
// set title
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
@@ -355,7 +365,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||||
|
|
||||||
/*for (int J = 0; J < listdata.size(); J++) {
|
*//*for (int J = 0; J < listdata.size(); J++) {
|
||||||
newadd = new AddittionalGetterSetter();
|
newadd = new AddittionalGetterSetter();
|
||||||
newadd.setBrand(listdata.get(J).getBrand_id());
|
newadd.setBrand(listdata.get(J).getBrand_id());
|
||||||
newadd.setBrand_id(listdata.get(J).getBrand_id());
|
newadd.setBrand_id(listdata.get(J).getBrand_id());
|
||||||
@@ -375,7 +385,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
KeyID = "";
|
KeyID = "";
|
||||||
additionalVisibilitySkuList.clear();
|
additionalVisibilitySkuList.clear();
|
||||||
}*/
|
}*//*
|
||||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
@@ -394,15 +404,35 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
// show it
|
// show it
|
||||||
alertDialog.show();
|
alertDialog.show();*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||||
|
|
||||||
|
listdata.clear();
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
newadd = new AddittionalGetterSetter();
|
||||||
|
newadd.setBrand("");
|
||||||
|
newadd.setBrand_id("");
|
||||||
|
newadd.setImage("");
|
||||||
|
newadd.setImage2("");
|
||||||
|
newadd.setImage3("");
|
||||||
|
newadd.setSku("");
|
||||||
|
newadd.setSku_id("");
|
||||||
|
newadd.setStore_id(store_id);
|
||||||
|
newadd.setBtn_toogle(togglevalue);
|
||||||
|
newadd.setCategoryId(categoryId);
|
||||||
|
|
||||||
|
listdata.add(newadd);
|
||||||
|
|
||||||
|
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
|
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||||
AdditionalVisibility.this);
|
AdditionalVisibility.this);
|
||||||
// set title
|
// set title
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
@@ -449,7 +479,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
// show it
|
// show it
|
||||||
alertDialog.show();
|
alertDialog.show();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -457,7 +487,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
btnaddlayout.setOnClickListener(new View.OnClickListener() {
|
fab_add.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
@@ -494,6 +524,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
//Adding data to existing parent list
|
//Adding data to existing parent list
|
||||||
listdata.add(adGt);
|
listdata.add(adGt);
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
clearViews();
|
clearViews();
|
||||||
|
|
||||||
@@ -503,17 +534,15 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
for (int i = 0; i < listdata.size(); i++) {
|
for (int i = 0; i < listdata.size(); i++) {
|
||||||
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
||||||
listviewlay.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||||
cardvew.setVisibility(View.INVISIBLE);
|
fab_add.hide();
|
||||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
|
||||||
} else {
|
} else {
|
||||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||||
listviewlay.setAdapter(adapteradditional);
|
listviewlay.setAdapter(adapteradditional);
|
||||||
listviewlay.invalidateViews();
|
listviewlay.invalidateViews();
|
||||||
btnaddlayout.setVisibility(View.VISIBLE);
|
//btnaddlayout.setVisibility(View.VISIBLE);
|
||||||
cardvew.setVisibility(View.VISIBLE);
|
fab_add.show();
|
||||||
listviewlay.setVisibility(View.VISIBLE);
|
listviewlay.setVisibility(View.VISIBLE);
|
||||||
maincard.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -544,6 +573,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
btntoggle.setOnClickListener(new View.OnClickListener() {
|
btntoggle.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
if (btntoggle.isChecked()) {
|
if (btntoggle.isChecked()) {
|
||||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||||
|
|
||||||
@@ -659,10 +689,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
diaplylayout.setVisibility(View.VISIBLE);
|
diaplylayout.setVisibility(View.VISIBLE);
|
||||||
cameralayout.setVisibility(View.VISIBLE);
|
cameralayout.setVisibility(View.VISIBLE);
|
||||||
btnsku.setVisibility(View.VISIBLE);
|
btnsku.setVisibility(View.VISIBLE);
|
||||||
btnaddlayout.setVisibility(View.VISIBLE);
|
//btnaddlayout.setVisibility(View.VISIBLE);
|
||||||
cardvew.setVisibility(View.VISIBLE);
|
fab_add.show();
|
||||||
listviewlay.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -703,13 +732,15 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
togglevalue = "0";
|
togglevalue = "0";
|
||||||
btntoggle.setChecked(false);
|
btntoggle.setChecked(false);
|
||||||
defdata.clear();
|
defdata.clear();
|
||||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||||
|
fab_add.hide();
|
||||||
brandlayout.setVisibility(View.GONE);
|
brandlayout.setVisibility(View.GONE);
|
||||||
diaplylayout.setVisibility(View.INVISIBLE);
|
diaplylayout.setVisibility(View.INVISIBLE);
|
||||||
cameralayout.setVisibility(View.INVISIBLE);
|
cameralayout.setVisibility(View.INVISIBLE);
|
||||||
btnsku.setVisibility(View.INVISIBLE);
|
btnsku.setVisibility(View.INVISIBLE);
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
adapteradditional.notifyDataSetChanged();
|
adapteradditional.notifyDataSetChanged();
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -745,12 +776,13 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
togglevalue = "0";
|
togglevalue = "0";
|
||||||
btntoggle.setChecked(false);
|
btntoggle.setChecked(false);
|
||||||
defdata.clear();
|
defdata.clear();
|
||||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||||
|
fab_add.hide();
|
||||||
brandlayout.setVisibility(View.GONE);
|
brandlayout.setVisibility(View.GONE);
|
||||||
diaplylayout.setVisibility(View.INVISIBLE);
|
diaplylayout.setVisibility(View.INVISIBLE);
|
||||||
cameralayout.setVisibility(View.INVISIBLE);
|
cameralayout.setVisibility(View.INVISIBLE);
|
||||||
btnsku.setVisibility(View.INVISIBLE);
|
btnsku.setVisibility(View.INVISIBLE);
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
clearViews();
|
clearViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -813,6 +845,39 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
//super.onBackPressed();
|
||||||
|
showDataLostAlert();
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDataLostAlert(){
|
||||||
|
if(editFlag){
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(AdditionalVisibility.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void clearViews(){
|
void clearViews(){
|
||||||
spinner_brand_list.setSelection(0);
|
spinner_brand_list.setSelection(0);
|
||||||
spinner_sku_list.setSelection(0);
|
spinner_sku_list.setSelection(0);
|
||||||
@@ -885,6 +950,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(boolean flag) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSave(boolean flag) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private class MyWebViewClient extends WebViewClient {
|
private class MyWebViewClient extends WebViewClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1236,11 +1311,19 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
public void showSkuDialog() {
|
public void showSkuDialog() {
|
||||||
|
|
||||||
final ArrayList<BrandMasterGetterSetter> brandList;
|
final ArrayList<BrandMasterGetterSetter> brandList;
|
||||||
if(country_id.equals("7")){
|
/* if(country_id.equals("7")){
|
||||||
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id);
|
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id);
|
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (country_id.equals("7")) {
|
||||||
|
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
|
} else {
|
||||||
|
brandList = db.getBrandT2PData(store_type_id, class_id, key_account_id, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||||
@@ -1376,12 +1459,16 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
brand_name = brandList.get(position).getBRAND().get(0);
|
brand_name = brandList.get(position).getBRAND().get(0);
|
||||||
|
|
||||||
if(country_id.equals("7")){
|
if(country_id.equals("7")){
|
||||||
sku_list = db.getSkuT2PData(null, null, null, brand_id, store_id);
|
sku_list = db.getSkuT2PData(null, null, null, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
|
}
|
||||||
|
else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
sku_list = db.getSkuT2PData(store_type_id, class_id, key_account_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sku_list = db.getSkuT2PData(store_type_id, class_id, key_account_id, brand_id, store_id);
|
sku_list = db.getSkuT2PData(store_type_id, class_id, key_account_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SkuGetterSetter select = new SkuGetterSetter();
|
SkuGetterSetter select = new SkuGetterSetter();
|
||||||
select.setSKU(getResources().getString(R.string.select));
|
select.setSKU(getResources().getString(R.string.select));
|
||||||
sku_list.add(0, select);
|
sku_list.add(0, select);
|
||||||
@@ -1455,10 +1542,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
if (id == android.R.id.home) {
|
if (id == android.R.id.home) {
|
||||||
|
|
||||||
// NavUtils.navigateUpFromSameTask(this);
|
// NavUtils.navigateUpFromSameTask(this);
|
||||||
finish();
|
/*finish();
|
||||||
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
|
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);*/
|
||||||
|
showDataLostAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -1666,17 +1753,15 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
|||||||
for (int i = 0; i < listdata.size(); i++) {
|
for (int i = 0; i < listdata.size(); i++) {
|
||||||
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
||||||
listviewlay.setVisibility(View.INVISIBLE);
|
listviewlay.setVisibility(View.INVISIBLE);
|
||||||
cardvew.setVisibility(View.INVISIBLE);
|
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
fab_add.hide();
|
||||||
maincard.setVisibility(View.INVISIBLE);
|
|
||||||
} else {
|
} else {
|
||||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||||
listviewlay.setAdapter(adapteradditional);
|
listviewlay.setAdapter(adapteradditional);
|
||||||
listviewlay.invalidateViews();
|
listviewlay.invalidateViews();
|
||||||
btnaddlayout.setVisibility(View.VISIBLE);
|
//btnaddlayout.setVisibility(View.VISIBLE);
|
||||||
cardvew.setVisibility(View.VISIBLE);
|
fab_add.show();
|
||||||
listviewlay.setVisibility(View.VISIBLE);
|
listviewlay.setVisibility(View.VISIBLE);
|
||||||
maincard.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
boolean checkflag = true;
|
boolean checkflag = true;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
String categoryName, categoryId, Error_Message = "", pathforcheck = "", _path = "", str, img_str = "", img_str2 = "";
|
String categoryName, categoryId, Error_Message = "", pathforcheck = "", _path = "", str, img_str = "", img_str2 = "";
|
||||||
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, store_flag_str;
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
ArrayList<AuditDataGetterSetter> question_list = new ArrayList<>(), childListData;
|
ArrayList<AuditDataGetterSetter> question_list = new ArrayList<>(), childListData;
|
||||||
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> hashMapAnsListChildData;
|
HashMap<AuditDataGetterSetter, ArrayList<AuditDataGetterSetter>> hashMapAnsListChildData;
|
||||||
@@ -94,6 +94,7 @@ public class AuditActivity 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, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
toolbar.setTitle(getResources().getString(R.string.audit));
|
toolbar.setTitle(getResources().getString(R.string.audit));
|
||||||
|
|
||||||
@@ -162,8 +163,14 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
if (question_list.size() > 0) {
|
if (question_list.size() > 0) {
|
||||||
if (validateData(question_list)) {
|
|
||||||
|
|
||||||
|
recyclerView.clearFocus();
|
||||||
|
|
||||||
|
if (validateData(question_list)) {
|
||||||
|
db.saveAuditQuestionAnswerData(question_list, store_id, categoryId);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
/*
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(AuditActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(AuditActivity.this);
|
||||||
builder.setMessage(R.string.title_activity_Want_save)
|
builder.setMessage(R.string.title_activity_Want_save)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
@@ -181,7 +188,7 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
} else {
|
} else {
|
||||||
questionAdapter.notifyDataSetChanged();
|
questionAdapter.notifyDataSetChanged();
|
||||||
Snackbar.make(recyclerView, error_msg, Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(recyclerView, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||||
@@ -198,7 +205,15 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
boolean t2p_flag = false;
|
boolean t2p_flag = false;
|
||||||
|
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
boolean flag_t2p_mapping;
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId,CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId,CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
if (db.isFilledT2P(store_id, categoryId)) {
|
if (db.isFilledT2P(store_id, categoryId)) {
|
||||||
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
||||||
|
|
||||||
@@ -344,11 +359,18 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown")) {
|
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown")) {
|
||||||
holder.sp_auditAnswer.setVisibility(View.VISIBLE);
|
holder.sp_auditAnswer.setVisibility(View.VISIBLE);
|
||||||
holder.edt_answer.setVisibility(View.GONE);
|
holder.edt_answer.setVisibility(View.GONE);
|
||||||
} else {
|
} else if(holder.data.getANSWER_TYPE().equalsIgnoreCase("TEXTBOX")){
|
||||||
holder.edt_answer.setVisibility(View.VISIBLE);
|
holder.edt_answer.setVisibility(View.VISIBLE);
|
||||||
holder.sp_auditAnswer.setVisibility(View.GONE);
|
holder.sp_auditAnswer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (holder.data.getCAMERA_ALLOW().equals("1")) {
|
||||||
|
holder.parent_cam_layout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
holder.parent_cam_layout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
holder.sp_auditAnswer.setAdapter(new AnswerSpinnerAdapter(AuditActivity.this, R.layout.custom_spinner_item, ans_list));
|
holder.sp_auditAnswer.setAdapter(new AnswerSpinnerAdapter(AuditActivity.this, R.layout.custom_spinner_item, ans_list));
|
||||||
|
|
||||||
final ArrayList<AuditDataGetterSetter> finalAns_list = ans_list;
|
final ArrayList<AuditDataGetterSetter> finalAns_list = ans_list;
|
||||||
@@ -420,7 +442,7 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
holder.data.setANSWER_ID("0");
|
holder.data.setANSWER_ID("0");
|
||||||
holder.data.setANSWER(((EditText) v).getText().toString());
|
holder.data.setANSWER(((EditText) v).getText().toString().replaceAll("[&^<>{}'$]", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -429,11 +451,13 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown") && ans_list.get(i).getANSWER_ID().equals(holder.data.getANSWER_ID())) {
|
if (holder.data.getANSWER_TYPE().equalsIgnoreCase("Dropdown") && ans_list.get(i).getANSWER_ID().equals(holder.data.getANSWER_ID())) {
|
||||||
holder.sp_auditAnswer.setSelection(i);
|
holder.sp_auditAnswer.setSelection(i);
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
holder.edt_answer.setText(ans_list.get(i).getANSWER());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(holder.data.getANSWER_TYPE().equalsIgnoreCase("TEXTBOX")){
|
||||||
|
holder.edt_answer.setText(holder.data.getANSWER());
|
||||||
|
}
|
||||||
|
|
||||||
if (!img_str.equals("")) {
|
if (!img_str.equals("")) {
|
||||||
if (child_position == position) {
|
if (child_position == position) {
|
||||||
holder.data.setCAM_IMAGE(img_str);
|
holder.data.setCAM_IMAGE(img_str);
|
||||||
@@ -547,7 +571,10 @@ public class AuditActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.clear();
|
checkHeaderArray.clear();
|
||||||
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
if (data.get(i).getANSWER_ID().equalsIgnoreCase("0")) {
|
if(data.get(i).getANSWER_TYPE().equalsIgnoreCase("TEXTBOX") && data.get(i).getANSWER().equalsIgnoreCase("")){
|
||||||
|
error_msg = getString(R.string.pls_answer_all_qns);
|
||||||
|
checkflag = false;
|
||||||
|
}else if (data.get(i).getANSWER_TYPE().equalsIgnoreCase("DROPDOWN") && data.get(i).getANSWER_ID().equalsIgnoreCase("0")) {
|
||||||
error_msg = getString(R.string.pls_answer_all_qns);
|
error_msg = getString(R.string.pls_answer_all_qns);
|
||||||
checkflag = false;
|
checkflag = false;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId;
|
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId;
|
||||||
ImageView im1, im2, im3, im4;
|
ImageView im1, im2, im3, im4;
|
||||||
ListView listview;
|
ListView listview;
|
||||||
String store_id, date, intime, img_str1="", img_str2="", img_str3="", img_str4="", togglevalue = "1", CATEGORY_ID, camera_allow, store_type_id, class_id, key_account_id, country_id;
|
String store_id, date, intime, img_str1 = "", img_str2 = "", img_str3 = "", img_str4 = "", togglevalue = "1", CATEGORY_ID, camera_allow, store_type_id, class_id, key_account_id, country_id, store_flag_str;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
Uri outputFileUri;
|
Uri outputFileUri;
|
||||||
String gallery_package = "";
|
String gallery_package = "";
|
||||||
@@ -61,6 +61,8 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
ArrayList<CategoryImagesAllowed> categoryImagesAllowed = new ArrayList<>();
|
ArrayList<CategoryImagesAllowed> categoryImagesAllowed = new ArrayList<>();
|
||||||
|
|
||||||
|
boolean editFlag = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -76,6 +78,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||||
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
@@ -100,7 +103,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
adddata = db.getCategoryPictureData(store_id, categoryId);
|
adddata = db.getCategoryPictureData(store_id, categoryId);
|
||||||
categoryImagesAllowed = db.getCategoryPictureAllowedData(categoryId);
|
categoryImagesAllowed = db.getCategoryPictureAllowedData(categoryId);
|
||||||
|
|
||||||
if(categoryImagesAllowed.size()>0){
|
if (categoryImagesAllowed.size() > 0) {
|
||||||
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam1(), im1);
|
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam1(), im1);
|
||||||
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im2);
|
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im2);
|
||||||
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im3);
|
setCamAllowImage(categoryImagesAllowed.get(0).isImg_cam2(), im3);
|
||||||
@@ -109,41 +112,42 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
if (adddata.size() != 0) {
|
if (adddata.size() != 0) {
|
||||||
|
|
||||||
String key_id = adddata.get(0).getKEY_ID();
|
String key_id = adddata.get(0).getKEY_ID();
|
||||||
|
|
||||||
listdat = db.getCategoryPictureListData(store_id, categoryId, key_id);
|
listdat = db.getCategoryPictureListData(store_id, categoryId, key_id);
|
||||||
|
|
||||||
String image1 = adddata.get(0).getCategoryImage1();
|
String image1 = adddata.get(0).getCategoryImage1();
|
||||||
String image2 = adddata.get(0).getCategoryImage2();
|
String image2 = adddata.get(0).getCategoryImage2();
|
||||||
String image3 = adddata.get(0).getCategoryImage3();
|
String image3 = adddata.get(0).getCategoryImage3();
|
||||||
String image4 = adddata.get(0).getCategoryImage4();
|
String image4 = adddata.get(0).getCategoryImage4();
|
||||||
|
|
||||||
if (image1 != null && !image1.equals("")) {
|
if (image1 != null && !image1.equals("")) {
|
||||||
im1.setBackgroundResource(R.mipmap.camera_green);
|
im1.setBackgroundResource(R.mipmap.camera_green);
|
||||||
img_str1 = image1;
|
img_str1 = image1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image2 != null && !image2.equals("")) {
|
if (image2 != null && !image2.equals("")) {
|
||||||
im2.setBackgroundResource(R.mipmap.camera_green);
|
im2.setBackgroundResource(R.mipmap.camera_green);
|
||||||
img_str2 = image2;
|
img_str2 = image2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image3 != null && !image3.equals("")) {
|
if (image3 != null && !image3.equals("")) {
|
||||||
im3.setBackgroundResource(R.mipmap.camera_green);
|
im3.setBackgroundResource(R.mipmap.camera_green);
|
||||||
img_str3 = image3;
|
img_str3 = image3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image4 != null && !image4.equals("")) {
|
if (image4 != null && !image4.equals("")) {
|
||||||
im4.setBackgroundResource(R.mipmap.camera_green);
|
im4.setBackgroundResource(R.mipmap.camera_green);
|
||||||
img_str4 = image4;
|
img_str4 = image4;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
listdat = db.getCategoryPicturedata(categoryId, null, null, null, store_id);
|
listdat = db.getCategoryPicturedata(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
}
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
else {
|
listdat = db.getCategoryPicturedata(categoryId, key_account_id, store_type_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
listdat = db.getCategoryPicturedata(categoryId, key_account_id, store_type_id, class_id, store_id);
|
} else {
|
||||||
|
listdat = db.getCategoryPicturedata(categoryId, key_account_id, store_type_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -167,7 +171,13 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
if (validateData(CP, listdat)) {
|
if (validateData(CP, listdat)) {
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(CategoryPicture.this);
|
db.open();
|
||||||
|
|
||||||
|
db.InsertCategoryPictureData(CP, listdat, categoryId);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
|
/* AlertDialog.Builder builder = new AlertDialog.Builder(CategoryPicture.this);
|
||||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
@@ -185,7 +195,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -209,7 +219,6 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
|
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
|
||||||
startCameraActivity();
|
startCameraActivity();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -275,7 +284,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KSA)) {
|
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_KSA)) {
|
||||||
cdate = arabicToenglish(cdate);
|
cdate = arabicToenglish(cdate);
|
||||||
}else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)) {
|
} else if (preferences.getString(CommonString.KEY_LANGUAGE, "").equalsIgnoreCase(CommonString.KEY_LANGUAGE_ARABIC_UAE)) {
|
||||||
cdate = arabicToenglish(cdate);
|
cdate = arabicToenglish(cdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +298,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
Log.i("MakeMachine", "startCameraActivity()");
|
Log.i("MakeMachine", "startCameraActivity()");
|
||||||
File file = new File(_path);
|
File file = new File(_path);
|
||||||
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
||||||
|
|
||||||
String defaultCameraPackage = "";
|
String defaultCameraPackage = "";
|
||||||
final PackageManager packageManager = getPackageManager();
|
final PackageManager packageManager = getPackageManager();
|
||||||
@@ -352,6 +361,8 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
if (_pathforcheck1 != null && !_pathforcheck1.equals("")) {
|
if (_pathforcheck1 != null && !_pathforcheck1.equals("")) {
|
||||||
if (new File(str + _pathforcheck1).exists()) {
|
if (new File(str + _pathforcheck1).exists()) {
|
||||||
|
|
||||||
@@ -500,12 +511,17 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
if(listdat.get(position1).getImage_allow().equals("1") && listdat.get(position1).getSubCategoryCamera1().equalsIgnoreCase("")){
|
||||||
Adapterposition = position1;
|
Snackbar.make(listview,R.string.first_click_compulsory_image,Snackbar.LENGTH_LONG).show();
|
||||||
_path = CommonString.FILE_PATH + Camerapath2;
|
}
|
||||||
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
|
else {
|
||||||
startCameraActivity();
|
Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
||||||
listview.invalidateViews();
|
Adapterposition = position1;
|
||||||
|
_path = CommonString.FILE_PATH + Camerapath2;
|
||||||
|
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
|
||||||
|
startCameraActivity();
|
||||||
|
listview.invalidateViews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -544,33 +560,33 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
boolean validateData(CategoryPictureGetterSetter data, ArrayList<CategoryPictureGetterSetter> list) {
|
boolean validateData(CategoryPictureGetterSetter data, ArrayList<CategoryPictureGetterSetter> list) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
||||||
if(categoryImagesAllowed.size()>0){
|
if (categoryImagesAllowed.size() > 0) {
|
||||||
|
|
||||||
if(categoryImagesAllowed.get(0).isImg_cam1()){
|
if (categoryImagesAllowed.get(0).isImg_cam1()) {
|
||||||
if(data.getCategoryImage1().equals("")){
|
if (data.getCategoryImage1().equals("")) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
if(categoryImagesAllowed.get(0).isImg_cam2()){
|
if (categoryImagesAllowed.get(0).isImg_cam2()) {
|
||||||
if(data.getCategoryImage2().equals("")){
|
if (data.getCategoryImage2().equals("")) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
if(categoryImagesAllowed.get(0).isImg_cam3()){
|
if (categoryImagesAllowed.get(0).isImg_cam3()) {
|
||||||
if(data.getCategoryImage3().equals("")){
|
if (data.getCategoryImage3().equals("")) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
if(categoryImagesAllowed.get(0).isImg_cam4()){
|
if (categoryImagesAllowed.get(0).isImg_cam4()) {
|
||||||
if(data.getCategoryImage4().equals("")){
|
if (data.getCategoryImage4().equals("")) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -606,24 +622,7 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
|
|
||||||
if (id == android.R.id.home) {
|
if (id == android.R.id.home) {
|
||||||
|
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CategoryPicture.this);
|
showDataLossAlert();
|
||||||
builder.setTitle("Parinaam");
|
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
|
|
||||||
finish();
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
android.app.AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
//noinspection SimplifiableIfStatement
|
||||||
@@ -634,28 +633,37 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showDataLossAlert() {
|
||||||
|
if (editFlag) {
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CategoryPicture.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
//super.onBackPressed();
|
//super.onBackPressed();
|
||||||
|
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CategoryPicture.this);
|
showDataLossAlert();
|
||||||
builder.setTitle("Parinaam");
|
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
|
|
||||||
finish();
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
android.app.AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -665,12 +673,11 @@ public class CategoryPicture extends AppCompatActivity {
|
|||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCamAllowImage(boolean isAllowed, ImageView img_cam){
|
public void setCamAllowImage(boolean isAllowed, ImageView img_cam) {
|
||||||
|
|
||||||
if(isAllowed){
|
if (isAllowed) {
|
||||||
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
img_cam.setBackgroundResource(R.drawable.camera_orange_star_green);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
img_cam.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
|
|||||||
|
|
||||||
multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor);
|
multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor);
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|||||||
+601
@@ -0,0 +1,601 @@
|
|||||||
|
package cpm.com.gskmtorange.dailyentry;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v4.content.FileProvider;
|
||||||
|
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.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.SpinnerAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||||
|
|
||||||
|
public class CounterfeitProductsActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
|
||||||
|
|
||||||
|
ToggleButton btntoggle;
|
||||||
|
boolean isDataAdded = false, isExists = true, is_camera_compulsory = false;
|
||||||
|
LinearLayout lin_parent;
|
||||||
|
GSKOrangeDB db;
|
||||||
|
private SharedPreferences preferences;
|
||||||
|
Spinner spinner_brand_list;
|
||||||
|
String store_id, visit_date, username, country_id;
|
||||||
|
String categoryName, categoryId;
|
||||||
|
ArrayList<BrandMasterGetterSetter> brand_list = new ArrayList<>();
|
||||||
|
String brand = "", _path = "";
|
||||||
|
EditText et_stock, et_sku_name;
|
||||||
|
FloatingActionButton fab_save, fab_add;
|
||||||
|
ImageView imgCam, imgCam1, imgCam2;
|
||||||
|
String img_str = "", img_str1 = "", img_str2 = "";
|
||||||
|
String _pathforcheck, _pathforcheck1, _pathforcheck2;
|
||||||
|
Uri outputFileUri;
|
||||||
|
String gallery_package = "";
|
||||||
|
boolean editFlag = false, isdata_added = false;
|
||||||
|
String str, skuName, stock = "";
|
||||||
|
int brand_id = 0;
|
||||||
|
RecyclerView rec_added_counterfeit_product;
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> addedCounterfeitProducts = new ArrayList<>();
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> exists_data = new ArrayList<>();
|
||||||
|
|
||||||
|
ProductAdapter productAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_counterfeit_products);
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
|
||||||
|
lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo);
|
||||||
|
et_stock = (EditText) findViewById(R.id.et_stock);
|
||||||
|
et_sku_name = (EditText) findViewById(R.id.et_sku_name);
|
||||||
|
spinner_brand_list = (Spinner) findViewById(R.id.sp_brand);
|
||||||
|
rec_added_counterfeit_product = (RecyclerView) findViewById(R.id.rec_added_counterfeit_product);
|
||||||
|
|
||||||
|
//fab
|
||||||
|
fab_save = findViewById(R.id.fab);
|
||||||
|
fab_add = findViewById(R.id.fab_add);
|
||||||
|
|
||||||
|
//camera Images
|
||||||
|
imgCam = (ImageView) findViewById(R.id.img_cam);
|
||||||
|
imgCam1 = (ImageView) findViewById(R.id.img_cam1);
|
||||||
|
imgCam2 = (ImageView) findViewById(R.id.img_cam2);
|
||||||
|
|
||||||
|
//preference data
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
|
||||||
|
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||||
|
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||||
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||||
|
|
||||||
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
|
//Intent data
|
||||||
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
|
categoryId = getIntent().getStringExtra("categoryId");
|
||||||
|
|
||||||
|
db = new GSKOrangeDB(CounterfeitProductsActivity.this);
|
||||||
|
db.open();
|
||||||
|
|
||||||
|
btntoggle.setOnClickListener(this);
|
||||||
|
fab_save.setOnClickListener(this);
|
||||||
|
fab_add.setOnClickListener(this);
|
||||||
|
imgCam.setOnClickListener(this);
|
||||||
|
imgCam1.setOnClickListener(this);
|
||||||
|
imgCam2.setOnClickListener(this);
|
||||||
|
|
||||||
|
brand_list = db.getBrandMasterData(store_id, categoryId);
|
||||||
|
//brand_list = db.getBrandData(categoryId);
|
||||||
|
|
||||||
|
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||||
|
String select = getResources().getString(R.string.select);
|
||||||
|
brand_select.setBRAND(select);
|
||||||
|
brand_select.setBRAND_ID("0");
|
||||||
|
brand_list.add(0, brand_select);
|
||||||
|
CustomBrandAdapter adapter = new CustomBrandAdapter(CounterfeitProductsActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||||
|
|
||||||
|
spinner_brand_list.setAdapter(adapter);
|
||||||
|
spinner_brand_list.setOnItemSelectedListener(this);
|
||||||
|
|
||||||
|
//Product List
|
||||||
|
exists_data = db.getCounterfeitProductExistsAfterData(store_id, categoryId);
|
||||||
|
|
||||||
|
if(exists_data.size()>0){
|
||||||
|
isExists = exists_data.get(0).isExists();
|
||||||
|
if(exists_data.get(0).isExists()){
|
||||||
|
addedCounterfeitProducts = db.getCounterfeitProductAfterData(store_id, categoryId);
|
||||||
|
if(addedCounterfeitProducts.size()>0){
|
||||||
|
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
|
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||||
|
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//fab_add.hide();//.setVisibility(View.GONE);
|
||||||
|
addedCounterfeitProducts.clear();
|
||||||
|
lin_parent.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
btntoggle.setChecked(isExists);
|
||||||
|
|
||||||
|
str = CommonString.FILE_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case R.id.btntoggle:
|
||||||
|
isExists = btntoggle.isChecked();
|
||||||
|
|
||||||
|
if (isExists) {
|
||||||
|
lin_parent.setVisibility(View.VISIBLE);
|
||||||
|
isdata_added = true;
|
||||||
|
} else {
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CounterfeitProductsActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
lin_parent.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
brand = "";
|
||||||
|
brand_id = 0;
|
||||||
|
|
||||||
|
stock = "";
|
||||||
|
skuName = "";
|
||||||
|
img_str = "";
|
||||||
|
img_str1 = "";
|
||||||
|
img_str2 = "";
|
||||||
|
|
||||||
|
et_stock.setText("");
|
||||||
|
et_sku_name.setText("");
|
||||||
|
spinner_brand_list.setSelection(0);
|
||||||
|
|
||||||
|
addedCounterfeitProducts.clear();
|
||||||
|
isdata_added = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
//checkBox.setChecked(true);
|
||||||
|
btntoggle.setChecked(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.fab_add:
|
||||||
|
|
||||||
|
skuName = et_sku_name.getText().toString().replaceAll("[&^<>{}'$]", "").replaceFirst("^0+(?!$)", "");
|
||||||
|
stock = et_stock.getText().toString();
|
||||||
|
|
||||||
|
if (brand.equals("")) {
|
||||||
|
Snackbar.make(rec_added_counterfeit_product, R.string.pls_select_brand, Snackbar.LENGTH_SHORT).show();
|
||||||
|
} else if (stock.equals("")) {
|
||||||
|
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_stock, Snackbar.LENGTH_SHORT).show();
|
||||||
|
} else if (skuName.equals("")) {
|
||||||
|
Snackbar.make(rec_added_counterfeit_product, R.string.pls_enter_sku, Snackbar.LENGTH_SHORT).show();
|
||||||
|
} else if (img_str.equals("") && img_str1.equals("") && img_str2.equals("")) {
|
||||||
|
Snackbar.make(rec_added_counterfeit_product, R.string.click_image, Snackbar.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
CounterfeitProductGetterSetter product = new CounterfeitProductGetterSetter();
|
||||||
|
product.setBrand(brand);
|
||||||
|
product.setBrandId(brand_id);
|
||||||
|
product.setStock(Integer.parseInt(stock));
|
||||||
|
product.setSkuName(skuName);
|
||||||
|
product.setImgStr(img_str);
|
||||||
|
product.setImgStr1(img_str1);
|
||||||
|
product.setImgStr2(img_str2);
|
||||||
|
|
||||||
|
addedCounterfeitProducts.add(product);
|
||||||
|
|
||||||
|
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
|
productAdapter = new ProductAdapter(addedCounterfeitProducts);
|
||||||
|
rec_added_counterfeit_product.setAdapter(productAdapter);
|
||||||
|
|
||||||
|
brand = "";
|
||||||
|
brand_id = 0;
|
||||||
|
|
||||||
|
stock = "";
|
||||||
|
skuName = "";
|
||||||
|
img_str = "";
|
||||||
|
img_str1 = "";
|
||||||
|
img_str2 = "";
|
||||||
|
|
||||||
|
et_stock.setText("");
|
||||||
|
et_sku_name.setText("");
|
||||||
|
spinner_brand_list.setSelection(0);
|
||||||
|
//clearBrandSpinner();
|
||||||
|
|
||||||
|
imgCam.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
|
imgCam1.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
|
imgCam2.setBackgroundResource(R.mipmap.camera_orange);
|
||||||
|
|
||||||
|
isdata_added = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.fab:
|
||||||
|
if(isExists && addedCounterfeitProducts.size()==0){
|
||||||
|
Snackbar.make(rec_added_counterfeit_product, R.string.title_activity_Want_add,Snackbar.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
db.InsertCounterfeitProductData(addedCounterfeitProducts, categoryId, store_id, isExists);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.img_cam:
|
||||||
|
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
||||||
|
_path = CommonString.FILE_PATH + _pathforcheck;
|
||||||
|
startCameraActivity();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.img_cam1:
|
||||||
|
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
||||||
|
_path = CommonString.FILE_PATH + _pathforcheck1;
|
||||||
|
startCameraActivity();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.img_cam2:
|
||||||
|
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
|
||||||
|
_path = CommonString.FILE_PATH + _pathforcheck2;
|
||||||
|
startCameraActivity();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearBrandSpinner() {
|
||||||
|
brand_list.clear();
|
||||||
|
|
||||||
|
BrandMasterGetterSetter brand_select = new BrandMasterGetterSetter();
|
||||||
|
String str = getResources().getString(R.string.select);
|
||||||
|
brand_select.setBRAND(str);
|
||||||
|
brand_select.setBRAND_ID("0");
|
||||||
|
brand_list.add(0, brand_select);
|
||||||
|
CustomBrandAdapter adapter = new CustomBrandAdapter(CounterfeitProductsActivity.this, R.layout.custom_spinner_item, brand_list);
|
||||||
|
|
||||||
|
spinner_brand_list.setAdapter(adapter);
|
||||||
|
spinner_brand_list.setOnItemSelectedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
switch (parent.getId()) {
|
||||||
|
case R.id.sp_brand:
|
||||||
|
|
||||||
|
if (position != 0) {
|
||||||
|
brand = brand_list.get(position).getBRAND().get(0);
|
||||||
|
brand_id = Integer.parseInt(brand_list.get(position).getBRAND_ID().get(0));
|
||||||
|
} else {
|
||||||
|
brand = "";
|
||||||
|
brand_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CustomBrandAdapter extends ArrayAdapter<String> {
|
||||||
|
|
||||||
|
private Activity activity;
|
||||||
|
private ArrayList data;
|
||||||
|
BrandMasterGetterSetter tempValues = null;
|
||||||
|
LayoutInflater inflater;
|
||||||
|
|
||||||
|
/*************
|
||||||
|
* CustomBrandAdapter Constructor
|
||||||
|
*****************/
|
||||||
|
public CustomBrandAdapter(
|
||||||
|
CounterfeitProductsActivity 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(getResources().getString(R.string.select));
|
||||||
|
//sub.setText("");
|
||||||
|
} else {
|
||||||
|
// Set values for spinner each row
|
||||||
|
label.setText(tempValues.getBRAND().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startCameraActivity() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
Log.i("MakeMachine", "startCameraActivity()");
|
||||||
|
File file = new File(_path);
|
||||||
|
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
||||||
|
|
||||||
|
String defaultCameraPackage = "";
|
||||||
|
final PackageManager packageManager = getPackageManager();
|
||||||
|
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
|
for (int n = 0; n < list.size(); n++) {
|
||||||
|
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||||
|
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
|
||||||
|
Log.e("TAG", "package name : " + list.get(n).packageName);
|
||||||
|
|
||||||
|
//temp value in case camera is gallery app above jellybean
|
||||||
|
String packag = list.get(n).loadLabel(packageManager).toString();
|
||||||
|
if (packag.equalsIgnoreCase("Gallery") || packag.equalsIgnoreCase("Galeri") || packag.equalsIgnoreCase("الاستوديو")) {
|
||||||
|
gallery_package = list.get(n).packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
|
||||||
|
defaultCameraPackage = list.get(n).packageName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (packag.equalsIgnoreCase("Camera") || packag.equalsIgnoreCase("Kamera") || packag.equalsIgnoreCase("الكاميرا")) {
|
||||||
|
|
||||||
|
defaultCameraPackage = list.get(n).packageName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//com.android.gallery3d
|
||||||
|
|
||||||
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||||
|
intent.setPackage(defaultCameraPackage);
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
|
||||||
|
intent.setPackage(gallery_package);
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
|
Log.i("MakeMachine", "resultCode: " + resultCode);
|
||||||
|
switch (resultCode) {
|
||||||
|
case 0:
|
||||||
|
Log.i("MakeMachine", "User cancelled");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -1:
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
|
if (_pathforcheck != null && !_pathforcheck.equals("")) {
|
||||||
|
if (new File(str + _pathforcheck).exists()) {
|
||||||
|
|
||||||
|
imgCam.setBackgroundResource(R.mipmap.camera_green);
|
||||||
|
|
||||||
|
img_str = _pathforcheck;
|
||||||
|
_pathforcheck = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pathforcheck1 != null && !_pathforcheck1.equals("")) {
|
||||||
|
if (new File(str + _pathforcheck1).exists()) {
|
||||||
|
|
||||||
|
imgCam1.setBackgroundResource(R.mipmap.camera_green);
|
||||||
|
|
||||||
|
img_str1 = _pathforcheck1;
|
||||||
|
_pathforcheck1 = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_pathforcheck2 != null && !_pathforcheck2.equals("")) {
|
||||||
|
if (new File(str + _pathforcheck2).exists()) {
|
||||||
|
|
||||||
|
imgCam2.setBackgroundResource(R.mipmap.camera_green);
|
||||||
|
|
||||||
|
img_str2 = _pathforcheck2;
|
||||||
|
_pathforcheck2 = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private ArrayList<CounterfeitProductGetterSetter> list;
|
||||||
|
|
||||||
|
public ProductAdapter(ArrayList<CounterfeitProductGetterSetter> promoList) {
|
||||||
|
list = promoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProductAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.item_counterfeit_product, parent, false);
|
||||||
|
return new ProductAdapter.ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ProductAdapter.ViewHolder holder, int position) {
|
||||||
|
|
||||||
|
final CounterfeitProductGetterSetter mItem = list.get(position);
|
||||||
|
holder.tv_brand.setText(getString(R.string.brand) + " - " + mItem.getBrand());
|
||||||
|
holder.tv_sku_name.setText(getString(R.string.skuname) + " - " + mItem.getSkuName());
|
||||||
|
holder.tv_stock.setText(" - " + mItem.getStock());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final View mView;
|
||||||
|
public final TextView tv_brand, tv_sku_name, tv_stock;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
|
||||||
|
mView = view;
|
||||||
|
|
||||||
|
tv_brand = (TextView) mView.findViewById(R.id.tv_brand);
|
||||||
|
tv_sku_name = (TextView) mView.findViewById(R.id.tv_sku_name);
|
||||||
|
tv_stock = (TextView) mView.findViewById(R.id.tv_stock);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
ischanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ischanged(){
|
||||||
|
if(isdata_added){
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(CounterfeitProductsActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.onBackPressed();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
ischanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,7 +44,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
|||||||
public class CreateSelfActivity extends AppCompatActivity {
|
public class CreateSelfActivity extends AppCompatActivity {
|
||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, store_flag_str;
|
||||||
String categoryName, categoryId;
|
String categoryName, categoryId;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
MSL_AvailabilityStockFacingGetterSetter brand_selected;
|
MSL_AvailabilityStockFacingGetterSetter brand_selected;
|
||||||
@@ -71,6 +71,7 @@ public class CreateSelfActivity extends AppCompatActivity {
|
|||||||
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);
|
||||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
//Intent data
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
@@ -107,6 +108,14 @@ public class CreateSelfActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
for(int i=0; i<sub_category_list.size(); i++){
|
for(int i=0; i<sub_category_list.size(); i++){
|
||||||
|
|
||||||
|
ArrayList<NoCameraDataGetterSetter> noCameraLastVisitData;
|
||||||
|
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
noCameraLastVisitData = db.getNoCameraLastVisitCategoryData(store_id, categoryId, sub_category_list.get(i).getSub_category_id(), CommonString.TABLE_NO_CAMERA_LAST_VISIT_DATA_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
noCameraLastVisitData = db.getNoCameraLastVisitCategoryData(store_id, categoryId, sub_category_list.get(i).getSub_category_id(), "NO_CAMERA_LAST_VISIT_DATA");
|
||||||
|
}
|
||||||
if(db.getNoCameraCategoryDataInserted(store_id, categoryId, sub_category_list.get(i).getSub_category_id()).size()>0){
|
if(db.getNoCameraCategoryDataInserted(store_id, categoryId, sub_category_list.get(i).getSub_category_id()).size()>0){
|
||||||
|
|
||||||
MSL_AvailabilityStockFacingGetterSetter subCategory = new MSL_AvailabilityStockFacingGetterSetter();
|
MSL_AvailabilityStockFacingGetterSetter subCategory = new MSL_AvailabilityStockFacingGetterSetter();
|
||||||
@@ -114,7 +123,7 @@ public class CreateSelfActivity extends AppCompatActivity {
|
|||||||
subCategory.setSub_category_id(sub_category_list.get(i).getSub_category_id());
|
subCategory.setSub_category_id(sub_category_list.get(i).getSub_category_id());
|
||||||
added_sub_category_list.add(subCategory);
|
added_sub_category_list.add(subCategory);
|
||||||
}
|
}
|
||||||
else if(db.getNoCameraLastVisitCategoryData(store_id, categoryId, sub_category_list.get(i).getSub_category_id()).size()>0){
|
else if(noCameraLastVisitData.size()>0){
|
||||||
MSL_AvailabilityStockFacingGetterSetter subCategory = new MSL_AvailabilityStockFacingGetterSetter();
|
MSL_AvailabilityStockFacingGetterSetter subCategory = new MSL_AvailabilityStockFacingGetterSetter();
|
||||||
subCategory.setSub_category(sub_category_list.get(i).getSub_category());
|
subCategory.setSub_category(sub_category_list.get(i).getSub_category());
|
||||||
subCategory.setSub_category_id(sub_category_list.get(i).getSub_category_id());
|
subCategory.setSub_category_id(sub_category_list.get(i).getSub_category_id());
|
||||||
|
|||||||
@@ -57,12 +57,13 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
|
|||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
DeliveryAdapter deliveryAdapter;
|
DeliveryAdapter deliveryAdapter;
|
||||||
FloatingActionButton fab_upload, fab;
|
FloatingActionButton fab_upload, fab;
|
||||||
|
Toolbar toolbar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_delivery_call);
|
setContentView(R.layout.activity_delivery_call);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
recyclerView = (RecyclerView) findViewById(R.id.rec_delivery_calls);
|
recyclerView = (RecyclerView) findViewById(R.id.rec_delivery_calls);
|
||||||
@@ -73,6 +74,8 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
|
|||||||
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
visit_date = preferences.getString(CommonString.KEY_DATE, null);
|
||||||
userId = preferences.getString(CommonString.KEY_USERNAME, null);
|
userId = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||||
|
|
||||||
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
database = new GSKOrangeDB(this);
|
database = new GSKOrangeDB(this);
|
||||||
database.open();
|
database.open();
|
||||||
|
|
||||||
@@ -199,6 +202,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
toolbar.setTitle(getString(R.string.delivery_call));
|
||||||
|
|
||||||
deliveryCallsList = database.getDeliveryCallsData(visit_date);
|
deliveryCallsList = database.getDeliveryCallsData(visit_date);
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -84,12 +84,13 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
|
|||||||
GoogleApiClient mGoogleApiClient;
|
GoogleApiClient mGoogleApiClient;
|
||||||
private static final String TAG = DeliveryCallAddStoreActivity.class.getSimpleName();
|
private static final String TAG = DeliveryCallAddStoreActivity.class.getSimpleName();
|
||||||
Context context;
|
Context context;
|
||||||
|
Toolbar toolbar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_delivery_call_add_store);
|
setContentView(R.layout.activity_delivery_call_add_store);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
database = new GSKOrangeDB(this);
|
database = new GSKOrangeDB(this);
|
||||||
@@ -222,6 +223,9 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
toolbar.setTitle(getString(R.string.delivery_call));
|
||||||
|
|
||||||
checkgpsEnableDevice();
|
checkgpsEnableDevice();
|
||||||
// Resuming the periodic location updates
|
// Resuming the periodic location updates
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class FutureJCPActivity extends AppCompatActivity implements View.OnClick
|
|||||||
void declaration() {
|
void declaration() {
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
fab = (FloatingActionButton) findViewById(R.id.fab);
|
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
//calenderBtn = (ImageButton) findViewById(R.id.iconCalender);
|
//calenderBtn = (ImageButton) findViewById(R.id.iconCalender);
|
||||||
@@ -152,6 +152,12 @@ public class FutureJCPActivity extends AppCompatActivity implements View.OnClick
|
|||||||
progressDialog = new ProgressDialog(FutureJCPActivity.this);
|
progressDialog = new ProgressDialog(FutureJCPActivity.this);
|
||||||
|
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
|
c = Calendar.getInstance();
|
||||||
|
year = c.get(Calendar.YEAR);
|
||||||
|
month = c.get(Calendar.MONTH);
|
||||||
|
day = c.get(Calendar.DAY_OF_MONTH);
|
||||||
|
showDatePickerDialog(year, month, day);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsyncTask asyncTask = new AsyncTask<String, String, String>() {
|
// AsyncTask asyncTask = new AsyncTask<String, String, String>() {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.RowColumnGetterSetter;
|
|||||||
public class NoCameraActivity extends AppCompatActivity implements Listener {
|
public class NoCameraActivity extends AppCompatActivity implements Listener {
|
||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, str, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, str, country_id, store_flag_str;
|
||||||
String categoryName, categoryId;
|
String categoryName, categoryId;
|
||||||
int number_of_rows, FROM;
|
int number_of_rows, FROM;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
@@ -116,6 +116,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
|
|||||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
class_id = preferences.getString(CommonString.KEY_CLASS_ID, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
str = CommonString.FILE_PATH;
|
str = CommonString.FILE_PATH;
|
||||||
|
|
||||||
@@ -1026,10 +1027,14 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
|
|||||||
|
|
||||||
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> mappingPlanogramList;
|
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> mappingPlanogramList;
|
||||||
|
|
||||||
|
|
||||||
if (country_id.equals("7")) {
|
if (country_id.equals("7")) {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, null, null, store_id);
|
mappingPlanogramList= db.getMappingPlanogramData(categoryId, null, null, store_id, CommonString.TABLE_MAPPING_PLANOGRAM_STORE_WISE);
|
||||||
} else {
|
} else if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null);
|
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null, CommonString.TABLE_MAPPING_PLANOGRAM_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null, CommonString.TABLE_MAPPING_PLANOGRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class NonWorkingReason extends AppCompatActivity implements
|
|||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|||||||
+182
-50
@@ -4,6 +4,7 @@ import android.app.Activity;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -16,6 +17,7 @@ import android.support.v7.widget.Toolbar;
|
|||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -48,6 +50,8 @@ import cpm.com.gskmtorange.xmlGetterSetter.POGGetterSetter;
|
|||||||
public class POGQuestionsActivity extends AppCompatActivity {
|
public class POGQuestionsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
ExpandableListView expandableListView;
|
ExpandableListView expandableListView;
|
||||||
|
LinearLayout linPlanogramType;
|
||||||
|
Spinner spinPlanogramType;
|
||||||
|
|
||||||
String categoryName, categoryId, Error_Message = "";
|
String categoryName, categoryId, Error_Message = "";
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, pog_type_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, pog_type_id;
|
||||||
@@ -57,14 +61,16 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
|
|
||||||
List<MSL_AvailabilityStockFacingGetterSetter> headerDataList;
|
List<MSL_AvailabilityStockFacingGetterSetter> headerDataList = new ArrayList<>();
|
||||||
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<POGGetterSetter>> hashMapListChildData = new HashMap<>();
|
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<POGGetterSetter>> hashMapListChildData = new HashMap<>();
|
||||||
|
|
||||||
ExpandableListAdapter adapter;
|
ExpandableListAdapter adapter;
|
||||||
|
|
||||||
List<Integer> checkHeaderArray = new ArrayList<>();
|
List<Integer> checkHeaderArray = new ArrayList<>();
|
||||||
String error_msg="";
|
String error_msg = "";
|
||||||
boolean checkflag = true;
|
boolean checkflag = true;
|
||||||
|
int selectedPOSMTypePosition = 0;
|
||||||
|
boolean userSelect = false, changedFlag = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -74,6 +80,8 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||||
|
linPlanogramType = (LinearLayout) findViewById(R.id.lin_planogram_type);
|
||||||
|
spinPlanogramType = (Spinner) findViewById(R.id.spinner_planogram_type);
|
||||||
|
|
||||||
db = new GSKOrangeDB(this);
|
db = new GSKOrangeDB(this);
|
||||||
db.open();
|
db.open();
|
||||||
@@ -100,7 +108,7 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
toolbar.setTitle(getResources().getString(R.string.pog));
|
toolbar.setTitle(getResources().getString(R.string.pog));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
@@ -109,7 +117,11 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (validateData()) {
|
if (validateData()) {
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(POGQuestionsActivity.this);
|
db.savePOGQuestionAnswerData(hashMapListChildData, headerDataList, store_id, categoryId);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
|
/* AlertDialog.Builder builder = new AlertDialog.Builder(POGQuestionsActivity.this);
|
||||||
builder.setMessage(R.string.title_activity_Want_save)
|
builder.setMessage(R.string.title_activity_Want_save)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
@@ -126,16 +138,113 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
expandableListView.invalidateViews();
|
if(adapter!=null){
|
||||||
Snackbar.make(expandableListView,error_msg , Snackbar.LENGTH_SHORT).show();
|
adapter.notifyDataSetChanged();
|
||||||
|
expandableListView.invalidateViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
Snackbar.make(expandableListView, error_msg, Snackbar.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
prepareListData();
|
if (country_id.equals("2") && (storeType_id.equals("9") || storeType_id.equals("15"))) {
|
||||||
|
linPlanogramType.setVisibility(View.VISIBLE);
|
||||||
|
final ArrayAdapter planogramTypeAdapter = new ArrayAdapter<CharSequence>(this,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
|
||||||
|
String select_str = getResources().getString(R.string.select_promo);
|
||||||
|
|
||||||
|
planogramTypeAdapter.add(select_str);
|
||||||
|
|
||||||
|
final ArrayList<String> pogTypeList = db.getPogType(categoryId, storeType_id, pog_type_id);
|
||||||
|
|
||||||
|
for (int i = 0; i < pogTypeList.size(); i++) {
|
||||||
|
planogramTypeAdapter.add(pogTypeList.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
spinPlanogramType.setAdapter(planogramTypeAdapter);
|
||||||
|
|
||||||
|
planogramTypeAdapter
|
||||||
|
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
|
||||||
|
spinPlanogramType.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
userSelect = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
spinPlanogramType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) {
|
||||||
|
|
||||||
|
if (userSelect) {
|
||||||
|
|
||||||
|
userSelect = false;
|
||||||
|
|
||||||
|
if (changedFlag) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(POGQuestionsActivity.this);
|
||||||
|
builder.setMessage(R.string.DELETE_ALERT_MESSAGE)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getResources().getString(R.string.yes),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
|
selectedPOSMTypePosition = position;
|
||||||
|
prepareListData(planogramTypeAdapter.getItem(position).toString(), true);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getResources().getString(R.string.no),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
|
|
||||||
|
spinPlanogramType.setSelection(selectedPOSMTypePosition);
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
|
||||||
|
alert.show();
|
||||||
|
} else {
|
||||||
|
selectedPOSMTypePosition = position;
|
||||||
|
prepareListData(planogramTypeAdapter.getItem(position).toString(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ArrayList<POGGetterSetter> pogSavedList = db.getAfterSavePOGUploadQuestionAnswerData(store_id, categoryId);
|
||||||
|
|
||||||
|
if (pogSavedList.size() > 0) {
|
||||||
|
String qType = pogSavedList.get(0).getQTYPE();
|
||||||
|
for (int i = 0; i < pogTypeList.size(); i++) {
|
||||||
|
if (qType.equals(pogTypeList.get(i))) {
|
||||||
|
selectedPOSMTypePosition = i + 1;
|
||||||
|
spinPlanogramType.setSelection(i + 1);
|
||||||
|
prepareListData(qType, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
changedFlag = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
prepareListData(null, false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -148,6 +257,38 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (id == android.R.id.home) {
|
if (id == android.R.id.home) {
|
||||||
|
|
||||||
|
if (changedFlag) {
|
||||||
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(POGQuestionsActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
//super.onBackPressed();
|
||||||
|
if (changedFlag) {
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(POGQuestionsActivity.this);
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(POGQuestionsActivity.this);
|
||||||
builder.setTitle("Parinaam");
|
builder.setTitle("Parinaam");
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
@@ -166,57 +307,38 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
android.app.AlertDialog alert = builder.create();
|
android.app.AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
//super.onBackPressed();
|
|
||||||
|
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(POGQuestionsActivity.this);
|
|
||||||
builder.setTitle("Parinaam");
|
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
|
|
||||||
finish();
|
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
android.app.AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void prepareListData(){
|
void prepareListData(String planogramType, boolean clearFlag) {
|
||||||
headerDataList = new ArrayList<>();
|
headerDataList = new ArrayList<>();
|
||||||
|
|
||||||
headerDataList = db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id);
|
headerDataList = db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id, planogramType);
|
||||||
|
|
||||||
if (headerDataList.size() > 0) {
|
if (headerDataList.size() > 0) {
|
||||||
for (int i = 0; i < headerDataList.size(); i++) {
|
for (int i = 0; i < headerDataList.size(); i++) {
|
||||||
|
|
||||||
ArrayList<POGGetterSetter> quizDataList = db.getAfterSavePOGQuestionAnswerData(store_id, categoryId, headerDataList.get(i).getSub_category_id());
|
ArrayList<POGGetterSetter> quizDataList = new ArrayList<>();
|
||||||
|
if (!clearFlag) {
|
||||||
if(quizDataList.size()==0){
|
quizDataList = db.getAfterSavePOGQuestionAnswerData(store_id, categoryId, headerDataList.get(i).getSub_category_id());
|
||||||
quizDataList = db.getPOGSubCategoryWise(headerDataList.get(i).getSub_category_id(), pog_type_id, storeType_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//hashMapListChildData = new HashMap<>();
|
|
||||||
|
if (quizDataList.size() == 0) {
|
||||||
|
quizDataList = db.getPOGSubCategoryWise(headerDataList.get(i).getSub_category_id(), pog_type_id, storeType_id, planogramType);
|
||||||
|
}
|
||||||
|
|
||||||
|
//hashMapListChildData = new HashMap<>();
|
||||||
ArrayList<POGGetterSetter> childListData = new ArrayList<>();
|
ArrayList<POGGetterSetter> childListData = new ArrayList<>();
|
||||||
|
|
||||||
if (quizDataList.size() > 0) {
|
if (quizDataList.size() > 0) {
|
||||||
String select = getString(R.string.title_activity_select_dropdown);
|
String select = getString(R.string.title_activity_select_dropdown);
|
||||||
// Adding child data
|
// Adding child data
|
||||||
for (int j = 0; j < quizDataList.size();j++) {
|
for (int j = 0; j < quizDataList.size(); j++) {
|
||||||
childListData = db.getPOGAnswerData(quizDataList.get(j).getQUESTION_ID(), headerDataList.get(i).getSub_category_id(), select);
|
childListData = db.getPOGAnswerData(quizDataList.get(j).getQUESTION_ID(), headerDataList.get(i).getSub_category_id(), select);
|
||||||
quizDataList.get(j).setAnswerList(childListData);
|
quizDataList.get(j).setAnswerList(childListData);
|
||||||
}
|
}
|
||||||
@@ -235,6 +357,9 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
adapter = new ExpandableListAdapter(this, headerDataList, hashMapListChildData);
|
adapter = new ExpandableListAdapter(this, headerDataList, hashMapListChildData);
|
||||||
expandableListView.setAdapter(adapter);
|
expandableListView.setAdapter(adapter);
|
||||||
|
|
||||||
|
for (int i = 0; i < adapter.getGroupCount(); i++)
|
||||||
|
expandableListView.expandGroup(i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||||
@@ -270,7 +395,7 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
convertView = infalInflater.inflate(R.layout.item_msl_availability_stock_facing_header, null, false);
|
convertView = infalInflater.inflate(R.layout.item_pog_header, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView txt_categoryHeader = (TextView) convertView.findViewById(R.id.txt_categoryHeader);
|
TextView txt_categoryHeader = (TextView) convertView.findViewById(R.id.txt_categoryHeader);
|
||||||
@@ -360,7 +485,7 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
POGGetterSetter ans = finalAns_list.get(position);
|
POGGetterSetter ans = finalAns_list.get(position);
|
||||||
childData.setANSWER_ID(ans.getANSWER_ID());
|
childData.setANSWER_ID(ans.getANSWER_ID());
|
||||||
childData.setANSWER(ans.getANSWER());
|
childData.setANSWER(ans.getANSWER());
|
||||||
|
changedFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -369,20 +494,20 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
holder.txt_question.setText(childData.getQUESTION() + " ("+childData.getQTYPE()+")");
|
holder.txt_question.setText(childData.getQUESTION() + " (" + childData.getQTYPE() + ")");
|
||||||
|
|
||||||
for (int i = 0; i < ans_list.size(); i++) {
|
for (int i = 0; i < ans_list.size(); i++) {
|
||||||
if ( ans_list.get(i).getANSWER_ID().equals(childData.getANSWER_ID())) {
|
if (ans_list.get(i).getANSWER_ID().equals(childData.getANSWER_ID())) {
|
||||||
holder.sp_auditAnswer.setSelection(i);
|
holder.sp_auditAnswer.setSelection(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!checkflag){
|
if (!checkflag) {
|
||||||
if(childData.getANSWER_ID().equals("0")){
|
if (childData.getANSWER_ID().equals("0")) {
|
||||||
holder.cardView.setCardBackgroundColor(getResources().getColor(android.R.color.holo_red_dark));
|
holder.cardView.setCardBackgroundColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
holder.cardView.setCardBackgroundColor(getResources().getColor(R.color.white));
|
holder.cardView.setCardBackgroundColor(getResources().getColor(R.color.white));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,7 +578,14 @@ public class POGQuestionsActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.clear();
|
checkHeaderArray.clear();
|
||||||
|
|
||||||
checkflag = true;
|
checkflag = true;
|
||||||
for(int l=0; l<headerDataList.size(); l++){
|
if (country_id.equals("2") && (storeType_id.equals("9") || storeType_id.equals("15"))) {
|
||||||
|
if (headerDataList.size() == 0) {
|
||||||
|
error_msg = getString(R.string.title_activity_select_dropdown);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int l = 0; l < headerDataList.size(); l++) {
|
||||||
|
|
||||||
List<POGGetterSetter> child_data = hashMapListChildData.get(headerDataList.get(l));
|
List<POGGetterSetter> child_data = hashMapListChildData.get(headerDataList.get(l));
|
||||||
for (int i = 0; i < child_data.size(); i++) {
|
for (int i = 0; i < child_data.size(); i++) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
|
|
||||||
String categoryName, categoryId, storeId, Error_Message = "";
|
String categoryName, categoryId, storeId, Error_Message = "";
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
|
||||||
boolean isDialogOpen = true;
|
boolean isDialogOpen = true;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
int scrollPosition = 0;
|
int scrollPosition = 0;
|
||||||
@@ -62,6 +62,7 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
boolean checkflag = true;
|
boolean checkflag = true;
|
||||||
FloatingActionButton fab;
|
FloatingActionButton fab;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -80,6 +81,7 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
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, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
|
||||||
|
|
||||||
@@ -155,11 +157,11 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
int lastItem = firstVisibleItem + visibleItemCount;
|
int lastItem = firstVisibleItem + visibleItemCount;
|
||||||
|
|
||||||
if (firstVisibleItem == 0) {
|
if (firstVisibleItem == 0) {
|
||||||
fab.setVisibility(View.VISIBLE);
|
fab.show();//setVisibility(View.VISIBLE);
|
||||||
} else if (lastItem == totalItemCount) {
|
} else if (lastItem == totalItemCount) {
|
||||||
fab.setVisibility(View.INVISIBLE);
|
fab.hide();//setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
fab.setVisibility(View.VISIBLE);
|
fab.show();//setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,12 +236,16 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//Header
|
//Header
|
||||||
if(country_id.equals("7")){
|
if(country_id.equals("7")){
|
||||||
headerDataList = db.getStockFacingHeaderData(categoryId, null, null, null, store_id);
|
headerDataList = db.getStockFacingHeaderData(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET);
|
||||||
|
}
|
||||||
|
else if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
headerDataList = db.getStockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id,CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
headerDataList = db.getStockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id);
|
headerDataList = db.getStockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id,CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (headerDataList.size() > 0) {
|
if (headerDataList.size() > 0) {
|
||||||
for (int i = 0; i < headerDataList.size(); i++) {
|
for (int i = 0; i < headerDataList.size(); i++) {
|
||||||
hashMapListHeaderData.add(headerDataList.get(i));
|
hashMapListHeaderData.add(headerDataList.get(i));
|
||||||
@@ -247,7 +253,7 @@ public class StockDataActivity extends AppCompatActivity {
|
|||||||
//childDataList = new ArrayList<>();
|
//childDataList = new ArrayList<>();
|
||||||
childDataList = db.getMSL_Availability_StockFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
childDataList = db.getMSL_Availability_StockFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||||
if (!(childDataList.size() > 0)) {
|
if (!(childDataList.size() > 0)) {
|
||||||
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), keyAccount_id, storeType_id, class_id, null);
|
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), keyAccount_id, storeType_id, class_id, null, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
|
||||||
|
|||||||
+1
-1
@@ -109,7 +109,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
|||||||
|
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -96,7 +96,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
private FailureGetterSetter failureGetterSetter = null;
|
private FailureGetterSetter failureGetterSetter = null;
|
||||||
String _pathforcheck, _path, str;
|
String _pathforcheck, _path, str;
|
||||||
|
|
||||||
String store_id, visit_date, username, intime, date, _UserId, store_flag_str;
|
String store_id, visit_date, username, intime, date, _UserId, store_flag_str, country_id;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
AlertDialog alert;
|
AlertDialog alert;
|
||||||
String img_str, strflag;
|
String img_str, strflag;
|
||||||
@@ -129,7 +129,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
img_cam = (ImageView) findViewById(R.id.img_selfie);
|
||||||
@@ -144,6 +144,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
username = preferences.getString(CommonString.KEY_USERNAME, null);
|
||||||
_UserId = preferences.getString(CommonString.KEY_USERNAME, "");
|
_UserId = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||||
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
|
||||||
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
//store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
|
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
|
||||||
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
|
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
|
||||||
@@ -500,7 +502,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
|
|
||||||
String status;
|
String status;
|
||||||
|
|
||||||
if (store_flag_str.equals(CommonString.FROM_JCP)) {
|
if (store_flag_str.equals(CommonString.FROM_JCP) || country_id.equalsIgnoreCase("5")) {
|
||||||
status = CommonString.KEY_INVALID;
|
status = CommonString.KEY_INVALID;
|
||||||
} else {
|
} else {
|
||||||
status = CommonString.KEY_VALID;
|
status = CommonString.KEY_VALID;
|
||||||
@@ -915,7 +917,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
|
|||||||
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
||||||
if (store_flag_str.equals(CommonString.FROM_JCP)) {
|
if (store_flag_str.equals(CommonString.FROM_JCP)|| country_id.equalsIgnoreCase("5")) {
|
||||||
Intent in = new Intent(StoreimageActivity.this, StoreWisePerformanceActivity.class);
|
Intent in = new Intent(StoreimageActivity.this, StoreWisePerformanceActivity.class);
|
||||||
startActivity(in);
|
startActivity(in);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
+77
-47
@@ -78,7 +78,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
RecyclerView rec_t2p;
|
RecyclerView rec_t2p;
|
||||||
MyAdaptorStock adapterData;
|
MyAdaptorStock adapterData;
|
||||||
String categoryName, categoryId;
|
String categoryName, categoryId;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, store_flag_str;
|
||||||
String str = CommonString.FILE_PATH,
|
String str = CommonString.FILE_PATH,
|
||||||
path = "", path1 = "", path2 = "",
|
path = "", path1 = "", path2 = "",
|
||||||
_pathforcheck = "", _pathforcheck1 = "", _pathforcheck2 = "",
|
_pathforcheck = "", _pathforcheck1 = "", _pathforcheck2 = "",
|
||||||
@@ -95,6 +95,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
ArrayList<BrandAvabilityGetterSetter> brand_new_list = new ArrayList<BrandAvabilityGetterSetter>();
|
ArrayList<BrandAvabilityGetterSetter> brand_new_list = new ArrayList<BrandAvabilityGetterSetter>();
|
||||||
ArrayList<BrandAvabilityGetterSetter> brandList;
|
ArrayList<BrandAvabilityGetterSetter> brandList;
|
||||||
ArrayList<SelectGetterSetter> select = new ArrayList<>();
|
ArrayList<SelectGetterSetter> select = new ArrayList<>();
|
||||||
|
boolean editFlag = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -129,6 +130,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
rec_t2p = (RecyclerView) findViewById(R.id.rec_t2p);
|
rec_t2p = (RecyclerView) findViewById(R.id.rec_t2p);
|
||||||
|
|
||||||
@@ -139,7 +141,11 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
db.InsertT2PData(t2PGetterSetters, store_id, categoryId);
|
||||||
|
//Snackbar.make(view, "Data Saved", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
|
finish();
|
||||||
|
|
||||||
|
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||||
T2PComplianceActivity.this);
|
T2PComplianceActivity.this);
|
||||||
// set title
|
// set title
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
@@ -166,7 +172,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
// show it
|
// show it
|
||||||
alertDialog.show();
|
alertDialog.show();*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(view, error_msg, Snackbar.LENGTH_LONG)
|
Snackbar.make(view, error_msg, Snackbar.LENGTH_LONG)
|
||||||
@@ -179,7 +185,13 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
t2PGetterSetters = db.getT2pComplianceData(store_id, categoryId);
|
t2PGetterSetters = db.getT2pComplianceData(store_id, categoryId);
|
||||||
|
|
||||||
if (t2PGetterSetters.size() == 0) {
|
if (t2PGetterSetters.size() == 0) {
|
||||||
t2PGetterSetters = db.getT2PDefaultData(store_id, categoryId);
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
t2PGetterSetters = db.getT2PDefaultData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
t2PGetterSetters = db.getT2PDefaultData(store_id, categoryId, "MAPPING_T2P");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
for (int i = 0; i < t2PGetterSetters.size(); i++) {
|
||||||
@@ -291,6 +303,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
|
||||||
mItem.setNon_t2p_reason_id(non_t2p_reason_list.get(position).getTREASON_ID().get(0));
|
mItem.setNon_t2p_reason_id(non_t2p_reason_list.get(position).getTREASON_ID().get(0));
|
||||||
|
editFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -315,6 +328,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
if (userSelect[0]) {
|
if (userSelect[0]) {
|
||||||
userSelect[0] = false;
|
userSelect[0] = false;
|
||||||
|
|
||||||
@@ -326,12 +341,11 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
case 0:
|
case 0:
|
||||||
if (mItem.getPresent() == 1) {
|
if (mItem.getPresent() == 1) {
|
||||||
flag_clear = true;
|
flag_clear = true;
|
||||||
} else if(mItem.getPresent() == 0){
|
} else if (mItem.getPresent() == 0) {
|
||||||
mItem.setNon_t2p_reason_id("0");
|
mItem.setNon_t2p_reason_id("0");
|
||||||
mItem.setPresent(-1);
|
mItem.setPresent(-1);
|
||||||
t2PAdapter.notifyDataSetChanged();
|
t2PAdapter.notifyDataSetChanged();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mItem.setPresent(-1);
|
mItem.setPresent(-1);
|
||||||
t2PAdapter.notifyDataSetChanged();
|
t2PAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@@ -361,6 +375,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (flag_clear) {
|
if (flag_clear) {
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(T2PComplianceActivity.this);
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(T2PComplianceActivity.this);
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
|
|
||||||
@@ -683,10 +699,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
holder.img_cam2.setEnabled(is_enabled);
|
holder.img_cam2.setEnabled(is_enabled);
|
||||||
holder.btn_gaps.setEnabled(is_enabled);
|
holder.btn_gaps.setEnabled(is_enabled);
|
||||||
|
|
||||||
if(mItem.getPresent()==0){
|
if (mItem.getPresent() == 0) {
|
||||||
holder.layout_t2p_non_reason.setVisibility(View.VISIBLE);
|
holder.layout_t2p_non_reason.setVisibility(View.VISIBLE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
holder.layout_t2p_non_reason.setVisibility(View.GONE);
|
holder.layout_t2p_non_reason.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,8 +744,8 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<non_t2p_reason_list.size();i++){
|
for (int i = 0; i < non_t2p_reason_list.size(); i++) {
|
||||||
if(mItem.getNon_t2p_reason_id().equals(non_t2p_reason_list.get(i).getTREASON_ID().get(0))){
|
if (mItem.getNon_t2p_reason_id().equals(non_t2p_reason_list.get(i).getTREASON_ID().get(0))) {
|
||||||
holder.spinner_t2p_non_reason.setSelection(i);
|
holder.spinner_t2p_non_reason.setSelection(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -800,7 +815,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
btn_save.setOnClickListener(new View.OnClickListener() {
|
btn_save.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
editFlag = true;
|
||||||
t2p.setGapsChecklist(gapsChecklist);
|
t2p.setGapsChecklist(gapsChecklist);
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
t2PAdapter.notifyDataSetChanged();
|
t2PAdapter.notifyDataSetChanged();
|
||||||
@@ -818,12 +833,15 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
final BrandMasterGetterSetter[] brand_selected = new BrandMasterGetterSetter[1];
|
final BrandMasterGetterSetter[] brand_selected = new BrandMasterGetterSetter[1];
|
||||||
|
|
||||||
final ArrayList<BrandMasterGetterSetter> brandList;
|
final ArrayList<BrandMasterGetterSetter> brandList;
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id);
|
brandList = db.getBrandT2PData(null, null, null, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
}
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
else {
|
brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id, categoryId, store_id);
|
} else {
|
||||||
|
brandList = db.getBrandT2PData(storeType_id, class_id, keyAccount_id, categoryId, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
BrandMasterGetterSetter brand = new BrandMasterGetterSetter();
|
||||||
brand.setBRAND("select");
|
brand.setBRAND("select");
|
||||||
brandList.add(0, brand);
|
brandList.add(0, brand);
|
||||||
@@ -860,6 +878,9 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
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 {
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
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));
|
||||||
@@ -927,11 +948,12 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
String brand_id = brandList.get(position).getBRAND_ID().get(0);
|
String brand_id = brandList.get(position).getBRAND_ID().get(0);
|
||||||
|
|
||||||
ArrayList<SkuGetterSetter> temp_list;
|
ArrayList<SkuGetterSetter> temp_list;
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
temp_list = db.getSkuT2PData(null, null, null, brand_id, store_id);
|
temp_list = db.getSkuT2PData(null, null, null, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
}
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
else {
|
temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id, store_id);
|
}else {
|
||||||
|
temp_list = db.getSkuT2PData(storeType_id, class_id, keyAccount_id, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 0; k < temp_list.size(); k++) {
|
for (int k = 0; k < temp_list.size(); k++) {
|
||||||
@@ -1050,7 +1072,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Log.i("Stock & Facing ", "startCameraActivity()");
|
Log.i("Stock & Facing ", "startCameraActivity()");
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
|
||||||
|
|
||||||
String defaultCameraPackage = "";
|
String defaultCameraPackage = "";
|
||||||
final PackageManager packageManager = getPackageManager();
|
final PackageManager packageManager = getPackageManager();
|
||||||
@@ -1196,12 +1218,12 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (t2PGetterSetters.get(i).getPresent() == 0) {
|
} else if (t2PGetterSetters.get(i).getPresent() == 0) {
|
||||||
if(t2PGetterSetters.get(i).getNon_t2p_reason_id().equals("0")){
|
if (t2PGetterSetters.get(i).getNon_t2p_reason_id().equals("0")) {
|
||||||
flag = false;
|
flag = false;
|
||||||
error_msg = getResources().getString(R.string.error_message_non_t2p_reason);
|
error_msg = getResources().getString(R.string.error_message_non_t2p_reason);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else if (t2PGetterSetters.get(i).getPresent() == -1) {
|
} else if (t2PGetterSetters.get(i).getPresent() == -1) {
|
||||||
flag = false;
|
flag = false;
|
||||||
error_msg = getResources().getString(R.string.msg_select_present);
|
error_msg = getResources().getString(R.string.msg_select_present);
|
||||||
break;
|
break;
|
||||||
@@ -1216,24 +1238,31 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
//super.onBackPressed();
|
//super.onBackPressed();
|
||||||
|
|
||||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
|
if(editFlag){
|
||||||
builder.setTitle("Parinaam");
|
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(T2PComplianceActivity.this);
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
builder.setTitle("Parinaam");
|
||||||
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
android.app.AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
android.app.AlertDialog alert = builder.create();
|
|
||||||
alert.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1600,11 +1629,12 @@ public class T2PComplianceActivity extends AppCompatActivity {
|
|||||||
public void showBrandAvabilitydialog(final ArrayList<BrandAvabilityGetterSetter> brandGetdata) {
|
public void showBrandAvabilitydialog(final ArrayList<BrandAvabilityGetterSetter> brandGetdata) {
|
||||||
|
|
||||||
final ArrayList<BrandAvabilityGetterSetter> brandList;
|
final ArrayList<BrandAvabilityGetterSetter> brandList;
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
brandList = db.getBrandAvailbilitydata(store_id, categoryId, null, null, null);
|
brandList = db.getBrandAvailbilitydata(store_id, categoryId, null, null, null, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
}
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
else {
|
brandList = db.getBrandAvailbilitydata(store_id, categoryId, keyAccount_id, class_id, storeType_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
brandList = db.getBrandAvailbilitydata(store_id, categoryId, keyAccount_id, class_id, storeType_id);
|
}else {
|
||||||
|
brandList = db.getBrandAvailbilitydata(store_id, categoryId, keyAccount_id, class_id, storeType_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BrandAvabilityGetterSetter brand = new BrandAvabilityGetterSetter();
|
BrandAvabilityGetterSetter brand = new BrandAvabilityGetterSetter();
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class T2pBrand_Avaibility extends AppCompatActivity {
|
|||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
categoryId = getIntent().getStringExtra("categoryId");
|
categoryId = getIntent().getStringExtra("categoryId");
|
||||||
/////
|
/////
|
||||||
brand_list = db.getBrandAvailbilitydata(store_id, categoryId, keyAccount_id, class_id, storeType_id);
|
brand_list = db.getBrandAvailbilitydata(store_id, categoryId, keyAccount_id, class_id, storeType_id,CommonString.TABLE_MAPPING_STOCK);
|
||||||
BrandAvabilityGetterSetter brand = new BrandAvabilityGetterSetter();
|
BrandAvabilityGetterSetter brand = new BrandAvabilityGetterSetter();
|
||||||
String str = getResources().getString(R.string.select);
|
String str = getResources().getString(R.string.select);
|
||||||
brand.setBRAND(str);
|
brand.setBRAND(str);
|
||||||
|
|||||||
@@ -1181,6 +1181,7 @@ public class DownloadActivity extends AppCompatActivity {
|
|||||||
//ADDITIONAL_QUESTION
|
//ADDITIONAL_QUESTION
|
||||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
|
||||||
request.addProperty("UserName", userId);
|
request.addProperty("UserName", userId);
|
||||||
|
//request.addProperty("Type", "POG_QUESTION_NEW");
|
||||||
request.addProperty("Type", "POG_QUESTION_NEW");
|
request.addProperty("Type", "POG_QUESTION_NEW");
|
||||||
request.addProperty("cultureid", culture_id);
|
request.addProperty("cultureid", culture_id);
|
||||||
|
|
||||||
@@ -1729,22 +1730,22 @@ public class DownloadActivity extends AppCompatActivity {
|
|||||||
db.InsertBrandMaster(brandMasterGetterSetter);
|
db.InsertBrandMaster(brandMasterGetterSetter);
|
||||||
db.InsertSkuMaster(skumastergettersetter);
|
db.InsertSkuMaster(skumastergettersetter);
|
||||||
db.InsertDisplayMaster(displayMasterGetterSetter);
|
db.InsertDisplayMaster(displayMasterGetterSetter);
|
||||||
db.InsertMAPPING_T2P(mappingt2PGetterSetter);
|
db.InsertMAPPING_T2P(mappingt2PGetterSetter, "MAPPING_T2P");
|
||||||
db.InsertMappingStock(mappingStockGetterSetter);
|
db.InsertMappingStock(mappingStockGetterSetter, "MAPPING_STOCK");
|
||||||
db.InsertDisplayChecklistMaster(checklistMasterGetterSetter);
|
db.InsertDisplayChecklistMaster(checklistMasterGetterSetter);
|
||||||
db.InsertMappingDisplayChecklist(mappingChecklistGetterSetter);
|
db.InsertMappingDisplayChecklist(mappingChecklistGetterSetter);
|
||||||
db.InsertMAPPING_PROMOTION(mappingPromotionGetterSetter);
|
db.InsertMAPPING_PROMOTION(mappingPromotionGetterSetter, "MAPPING_PROMOTION");
|
||||||
db.InsertMAPPING_ADDITIONAL_PROMOTION(mapping_additional_promotion_masterGetterSetter);
|
db.InsertMAPPING_ADDITIONAL_PROMOTION(mapping_additional_promotion_masterGetterSetter, "MAPPING_ADDITIONAL_PROMOTION");
|
||||||
|
|
||||||
db.insertNonWorkingData(nonWorkingReasonGetterSetter);
|
db.insertNonWorkingData(nonWorkingReasonGetterSetter);
|
||||||
|
|
||||||
//NON_WORKING_SUB_REASON added - 26.09.2018
|
//NON_WORKING_SUB_REASON added - 26.09.2018
|
||||||
db.insertNonWorkingSubreasonData(nonWorkingSubReasonGetterSetter);
|
db.insertNonWorkingSubreasonData(nonWorkingSubReasonGetterSetter);
|
||||||
|
|
||||||
db.InsertSTORE_PERFORMANCE(store_performance_masterGetterSetter);
|
db.InsertSTORE_PERFORMANCE(store_performance_masterGetterSetter, "STORE_PERFORMANCE_NEW");
|
||||||
db.InsertMAPPING_PLANOGRAM(mapping_planogram_masterGetterSetter);
|
db.InsertMAPPING_PLANOGRAM(mapping_planogram_masterGetterSetter, "MAPPING_PLANOGRAM");
|
||||||
db.InsertADDITIONAL_DISPLAY(additional_display_getter_setter);
|
db.InsertADDITIONAL_DISPLAY(additional_display_getter_setter);
|
||||||
db.InsertMAPPING_SOS_TARGET(mapping_sos_target_masterGetterSetter);
|
db.InsertMAPPING_SOS_TARGET(mapping_sos_target_masterGetterSetter, "MAPPING_SOS_TARGET");
|
||||||
db.InsertSHELF_MASTER(shelfMasterGetterSetter);
|
db.InsertSHELF_MASTER(shelfMasterGetterSetter);
|
||||||
|
|
||||||
db.InsertMappingSubCategoryImageAllow(mappingSubCategoryImageAllowGetterSetter);
|
db.InsertMappingSubCategoryImageAllow(mappingSubCategoryImageAllowGetterSetter);
|
||||||
@@ -1755,7 +1756,7 @@ public class DownloadActivity extends AppCompatActivity {
|
|||||||
db.InsertPOGQUESTION(pogQuestionGetterSetter);
|
db.InsertPOGQUESTION(pogQuestionGetterSetter);
|
||||||
db.InsertNON_T2P_REASON(nonT2pReasonGetterSetter);
|
db.InsertNON_T2P_REASON(nonT2pReasonGetterSetter);
|
||||||
db.InsertCONFIGURATION_COUNTRY_WISE(configurationContrywiseGetterSetter);
|
db.InsertCONFIGURATION_COUNTRY_WISE(configurationContrywiseGetterSetter);
|
||||||
db.InsertNO_CAMERA_LAST_VISIT_DATA(noCameraLastVisitGetterSetter);
|
db.InsertNO_CAMERA_LAST_VISIT_DATA(noCameraLastVisitGetterSetter,"NO_CAMERA_LAST_VISIT_DATA");
|
||||||
db.insertSUPERVISOR_LIST_DATA(supervisorListGetterSetter);
|
db.insertSUPERVISOR_LIST_DATA(supervisorListGetterSetter);
|
||||||
db.InsertGeoTag_DATA(geoFencingGetterSetter);
|
db.InsertGeoTag_DATA(geoFencingGetterSetter);
|
||||||
db.InsertCONFIGURATION_MASTER(configurationMasterGetterSetter);
|
db.InsertCONFIGURATION_MASTER(configurationMasterGetterSetter);
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public class ServiceActivityFragment extends Fragment {
|
|||||||
|
|
||||||
if (sd.canWrite()) {
|
if (sd.canWrite()) {
|
||||||
String currentDBPath = "//data//cpm.com.gskmtorange//databases//" + GSKOrangeDB.DATABASE_NAME;
|
String currentDBPath = "//data//cpm.com.gskmtorange//databases//" + GSKOrangeDB.DATABASE_NAME;
|
||||||
String backupDBPath = "GSKMT_ORANGE_Database_backup_carmen.s_01182019_150602";
|
String backupDBPath = "GSKMT_ORANGE_Database_backup_testksa_02272019_155842";
|
||||||
File currentDB = new File(data, currentDBPath);
|
File currentDB = new File(data, currentDBPath);
|
||||||
File backupDB = new File(sd, backupDBPath);
|
File backupDB = new File(sd, backupDBPath);
|
||||||
|
|
||||||
|
|||||||
+104
-17
@@ -42,7 +42,7 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
CategoryListAdapter adapter;
|
CategoryListAdapter adapter;
|
||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id,camera_allow, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id,camera_allow, country_id, store_flag_str, pog_type_id;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,13 +69,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
pog_type_id = preferences.getString(CommonString.KEY_POG_TYPE_ID, "");
|
||||||
|
|
||||||
/*txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
/*txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
|
||||||
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));*/
|
txt_categoryName.setText(getResources().getString(R.string.title_activity_category_list));*/
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_list));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_category_list));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_category);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_category);
|
||||||
@@ -98,10 +99,13 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
categoryList = new ArrayList<>();
|
categoryList = new ArrayList<>();
|
||||||
|
|
||||||
if(country_id.equals("7")){
|
if(country_id.equals("7")){
|
||||||
categoryList = db.getCategoryListData(null, null, null, store_id);
|
categoryList = db.getCategoryListData(null, null, null, store_id, "MAPPING_STOCK_STOREWISE");
|
||||||
|
}
|
||||||
|
else if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id, store_id);
|
categoryList = db.getCategoryListData(keyAccount_id, storeType_id, class_id, store_id, "MAPPING_STOCK");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categoryList.size() > 0) {
|
if (categoryList.size() > 0) {
|
||||||
@@ -134,10 +138,13 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
boolean flag_mapping_stock;
|
boolean flag_mapping_stock;
|
||||||
//New MSL_Availability_StockFacing
|
//New MSL_Availability_StockFacing
|
||||||
if(country_id.equals("7")){
|
if(country_id.equals("7")){
|
||||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id);
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
|
}
|
||||||
|
else if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id);
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
if (flag_mapping_stock) {
|
if (flag_mapping_stock) {
|
||||||
if (!db.checkMsl_Availability_StockFacingData(store_id, category_id)) {
|
if (!db.checkMsl_Availability_StockFacingData(store_id, category_id)) {
|
||||||
@@ -153,7 +160,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (db.isMappingPromotionData(store_id, category_id)) {
|
boolean isMappingPromotion_Flag;
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
if (isMappingPromotion_Flag) {
|
||||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
@@ -164,7 +178,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//T2P
|
//T2P
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (db.isMappingT2PData(store_id, category_id)) {
|
boolean flag_t2p_mapping;
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
if (!db.isFilledT2P(store_id, category_id)) {
|
if (!db.isFilledT2P(store_id, category_id)) {
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
@@ -196,6 +217,26 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(flag){
|
||||||
|
if (db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).size() > 0) {
|
||||||
|
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag){
|
||||||
|
|
||||||
|
//Counterfeit Product Option - Egypt
|
||||||
|
if(country_id.equals("6")){
|
||||||
|
|
||||||
|
if (db.getCounterfeitProductExistsAfterData(store_id, category_id).size() == 0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flag_filled = flag;
|
flag_filled = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,8 +298,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
if (!item.getKEYACCOUNT_ID().equals("0") && !item.getKEYACCOUNT_ID().equals(keyAccount_id)) {
|
if (!item.getKEYACCOUNT_ID().equals("0") && !item.getKEYACCOUNT_ID().equals(keyAccount_id)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else if (!item.getCHECK_TYPE().equals("NA") && item.getCHECK_TYPE().equals("T2P")) {
|
} else if (!item.getCHECK_TYPE().equals("NA") && item.getCHECK_TYPE().equals("T2P")) {
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
if (!db.isMappingT2PData(store_id, category_id)) {
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
if (!flag_t2p_mapping) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,8 +317,15 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
ArrayList<AuditDataGetterSetter> getAuditQnsRemoved(String categoryId) {
|
ArrayList<AuditDataGetterSetter> getAuditQnsRemoved(String categoryId) {
|
||||||
|
|
||||||
boolean t2p_flag = false;
|
boolean t2p_flag = false;
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId,CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId,CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
if (flag_t2p_mapping) {
|
||||||
if (db.isFilledT2P(store_id, categoryId)) {
|
if (db.isFilledT2P(store_id, categoryId)) {
|
||||||
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
||||||
|
|
||||||
@@ -448,10 +502,13 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
boolean flag_mapping_stock;
|
boolean flag_mapping_stock;
|
||||||
//New MSL_Availability_StockFacing
|
//New MSL_Availability_StockFacing
|
||||||
if(country_id.equals("7")){
|
if(country_id.equals("7")){
|
||||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id);
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
|
}
|
||||||
|
else if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id);
|
flag_mapping_stock = db.isMappingStockDataStockFacing(category_id, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
if (flag_mapping_stock) {
|
if (flag_mapping_stock) {
|
||||||
if (!db.checkMsl_Availability_StockFacingData(store_id, category_id)) {
|
if (!db.checkMsl_Availability_StockFacingData(store_id, category_id)) {
|
||||||
@@ -467,7 +524,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (db.isMappingPromotionData(store_id, category_id)) {
|
boolean isMappingPromotion_Flag;
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, category_id, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
if (isMappingPromotion_Flag) {
|
||||||
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
if (!db.checkPromoComplianceData(store_id, category_id)) {
|
||||||
flag_filled = false;
|
flag_filled = false;
|
||||||
break;
|
break;
|
||||||
@@ -475,8 +539,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
if (db.isMappingT2PData(store_id, category_id)) {
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, category_id,CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
if (!db.isFilledT2P(store_id, category_id)) {
|
if (!db.isFilledT2P(store_id, category_id)) {
|
||||||
flag_filled = false;
|
flag_filled = false;
|
||||||
break;
|
break;
|
||||||
@@ -500,6 +570,23 @@ public class CategoryListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (db.getSubCategoryMasterForPOG(category_id, storeType_id, pog_type_id, null).size() > 0) {
|
||||||
|
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, category_id).size() == 0) {
|
||||||
|
flag_filled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Counterfeit Product Option - Egypt
|
||||||
|
if(country_id.equals("6")){
|
||||||
|
|
||||||
|
if (db.getCounterfeitProductExistsAfterData(store_id, category_id).size() == 0) {
|
||||||
|
flag_filled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
flag_filled = true;
|
flag_filled = true;
|
||||||
} else {
|
} else {
|
||||||
flag_filled = false;
|
flag_filled = false;
|
||||||
|
|||||||
+10
-3
@@ -41,7 +41,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
|||||||
CategoryWisePerformaceAdapter adapter;
|
CategoryWisePerformaceAdapter adapter;
|
||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, store_flag_str;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,6 +68,7 @@ public class CategoryWisePerformanceActivity 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, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
//Intent data
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
@@ -76,7 +77,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
|||||||
//txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
//txt_categoryName.setText(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
toolbar.setTitle(getResources().getString(R.string.title_activity_category_wise_performance) + " " + categoryName);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
@@ -102,7 +103,13 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
try {
|
try {
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId);
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId, "STORE_PERFORMANCE_NEW");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
|
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|||||||
+119
-30
@@ -36,6 +36,7 @@ import cpm.com.gskmtorange.dailyentry.AdditionalPromoSKUwiseActivity;
|
|||||||
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
import cpm.com.gskmtorange.dailyentry.AdditionalVisibility;
|
||||||
import cpm.com.gskmtorange.dailyentry.AuditActivity;
|
import cpm.com.gskmtorange.dailyentry.AuditActivity;
|
||||||
import cpm.com.gskmtorange.dailyentry.CategoryPicture;
|
import cpm.com.gskmtorange.dailyentry.CategoryPicture;
|
||||||
|
import cpm.com.gskmtorange.dailyentry.CounterfeitProductsActivity;
|
||||||
import cpm.com.gskmtorange.dailyentry.CreateSelfActivity;
|
import cpm.com.gskmtorange.dailyentry.CreateSelfActivity;
|
||||||
import cpm.com.gskmtorange.dailyentry.POGQuestionsActivity;
|
import cpm.com.gskmtorange.dailyentry.POGQuestionsActivity;
|
||||||
import cpm.com.gskmtorange.dailyentry.StockDataActivity;
|
import cpm.com.gskmtorange.dailyentry.StockDataActivity;
|
||||||
@@ -52,7 +53,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String categoryName = "", categoryId;
|
String categoryName = "", categoryId;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, pog_type_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, pog_type_id, store_flag_str;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
ArrayList<CategoryPictureGetterSetter> category_camera_list;
|
ArrayList<CategoryPictureGetterSetter> category_camera_list;
|
||||||
@@ -87,6 +88,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
pog_type_id = preferences.getString(CommonString.KEY_POG_TYPE_ID, "");
|
pog_type_id = preferences.getString(CommonString.KEY_POG_TYPE_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
//Intent data
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
categoryId = getIntent().getStringExtra("categoryId");
|
categoryId = getIntent().getStringExtra("categoryId");
|
||||||
@@ -94,7 +96,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
//txt_categoryName.setText(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
//txt_categoryName.setText(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
toolbar.setTitle(getResources().getString(R.string.title_activity_daily_main_menu) + " - " + categoryName);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
@@ -181,7 +183,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
//T2p
|
//T2p
|
||||||
data = new DailyDataMenuGetterSetter();
|
data = new DailyDataMenuGetterSetter();
|
||||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
|
data.setCategory_name(getResources().getString(R.string.daily_data_menu_t2p));
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
boolean flag_t2p_mapping;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
} else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
if (db.isFilledT2P(store_id, categoryId)) {
|
if (db.isFilledT2P(store_id, categoryId)) {
|
||||||
data.setCategory_img(R.mipmap.t2p_compliance_done);
|
data.setCategory_img(R.mipmap.t2p_compliance_done);
|
||||||
} else {
|
} else {
|
||||||
@@ -206,16 +215,28 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
data = new DailyDataMenuGetterSetter();
|
data = new DailyDataMenuGetterSetter();
|
||||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
|
data.setCategory_name(getResources().getString(R.string.daily_data_menu_promo_compliance));
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
if(db.getPromoComplianceSkuwiseExistsAfterData(store_id, categoryId).size()==0){
|
if (db.getPromoComplianceSkuwiseExistsAfterData(store_id, categoryId).size() == 0) {
|
||||||
data.setCategory_img(R.mipmap.promo_compliance);
|
data.setCategory_img(R.mipmap.promo_compliance);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
data.setCategory_img(R.mipmap.promo_compliance_done);
|
data.setCategory_img(R.mipmap.promo_compliance_done);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
boolean isMappingPromotion_Flag;
|
||||||
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isMappingAdditionalPromotion_Flag;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMappingPromotion_Flag || isMappingAdditionalPromotion_Flag) {
|
||||||
if (db.checkPromoComplianceData(store_id, categoryId) ||
|
if (db.checkPromoComplianceData(store_id, categoryId) ||
|
||||||
db.checkAdditionalPromoComplianceData(store_id, categoryId)) {
|
db.checkAdditionalPromoComplianceData(store_id, categoryId)) {
|
||||||
data.setCategory_img(R.mipmap.promo_compliance_done);
|
data.setCategory_img(R.mipmap.promo_compliance_done);
|
||||||
@@ -276,7 +297,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//POG
|
//POG
|
||||||
data = new DailyDataMenuGetterSetter();
|
data = new DailyDataMenuGetterSetter();
|
||||||
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id).size() > 0) {
|
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id, null).size() > 0) {
|
||||||
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, categoryId).size() > 0) {
|
if (db.getAfterSavePOGUploadQuestionAnswerData(store_id, categoryId).size() > 0) {
|
||||||
data.setCategory_img(R.mipmap.msl_availability_done);
|
data.setCategory_img(R.mipmap.msl_availability_done);
|
||||||
} else {
|
} else {
|
||||||
@@ -290,6 +311,20 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
data.setCategory_name(getString(R.string.pog));
|
data.setCategory_name(getString(R.string.pog));
|
||||||
categoryList.add(data);
|
categoryList.add(data);
|
||||||
|
|
||||||
|
//Counterfeit Product Option - Egypt
|
||||||
|
if(country_id.equals("6")){
|
||||||
|
data = new DailyDataMenuGetterSetter();
|
||||||
|
|
||||||
|
if (db.getCounterfeitProductExistsAfterData(store_id, categoryId).size() > 0) {
|
||||||
|
data.setCategory_img(R.mipmap.counterfeit_done);
|
||||||
|
} else {
|
||||||
|
data.setCategory_img(R.mipmap.counterfeit);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.setCategory_name(getString(R.string.title_activity_counterfeit_products));
|
||||||
|
categoryList.add(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*data = new DailyDataMenuGetterSetter();
|
/*data = new DailyDataMenuGetterSetter();
|
||||||
data.setCategory_name(getResources().getString(R.string.daily_data_menu_competition_tracking));
|
data.setCategory_name(getResources().getString(R.string.daily_data_menu_competition_tracking));
|
||||||
@@ -341,8 +376,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
ArrayList<AuditDataGetterSetter> getAuditQnsRemoved() {
|
ArrayList<AuditDataGetterSetter> getAuditQnsRemoved() {
|
||||||
|
|
||||||
boolean t2p_flag = false;
|
boolean t2p_flag = false;
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
} else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
if (flag_t2p_mapping) {
|
||||||
if (db.isFilledT2P(store_id, categoryId)) {
|
if (db.isFilledT2P(store_id, categoryId)) {
|
||||||
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
ArrayList<T2PGetterSetter> t2PList = db.getT2pComplianceData(store_id, categoryId);
|
||||||
|
|
||||||
@@ -428,11 +469,24 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
} else*/
|
} else*/
|
||||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||||
|
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
}
|
} else {
|
||||||
else {
|
boolean isMappingPromotion_Flag;
|
||||||
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isMappingAdditionalPromotion_Flag;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMappingPromotion_Flag || isMappingAdditionalPromotion_Flag) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
} else {
|
} else {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
||||||
@@ -440,7 +494,15 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
boolean t2p_flag = false;
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
} else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
} else {
|
} else {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
||||||
@@ -471,7 +533,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.pog))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.pog))) {
|
||||||
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id).size() > 0) {
|
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id, null).size() > 0) {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||||
} else {
|
} else {
|
||||||
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
holder.categoryName.setTextColor(getResources().getColor(R.color.grey_background));
|
||||||
@@ -500,14 +562,27 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
} else */
|
} else */
|
||||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, AdditionalPromoSKUwiseActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, AdditionalPromoSKUwiseActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
} else {
|
||||||
else {
|
boolean isMappingPromotion_Flag;
|
||||||
if (db.isMappingPromotionData(store_id, categoryId) || db.isMappingAdditionalPromotionData(store_id, categoryId)) {
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingPromotion_Flag = db.isMappingPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isMappingAdditionalPromotion_Flag;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION_ADHOC);
|
||||||
|
} else {
|
||||||
|
isMappingAdditionalPromotion_Flag = db.isMappingAdditionalPromotionData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMappingPromotion_Flag || isMappingAdditionalPromotion_Flag) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, PromoComplianceActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
@@ -517,7 +592,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase((getResources().getString(R.string.daily_data_menu_t2p)))) {
|
||||||
if (db.isMappingT2PData(store_id, categoryId)) {
|
boolean t2p_flag = false;
|
||||||
|
boolean flag_t2p_mapping;
|
||||||
|
if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P_ADHOC);
|
||||||
|
} else {
|
||||||
|
flag_t2p_mapping = db.isMappingT2PData(store_id, categoryId, CommonString.TABLE_MAPPING_T2P);
|
||||||
|
}
|
||||||
|
if (flag_t2p_mapping) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, T2PComplianceActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
@@ -578,7 +660,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.pog))) {
|
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.pog))) {
|
||||||
|
|
||||||
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id).size() > 0) {
|
if (db.getSubCategoryMasterForPOG(categoryId, storeType_id, pog_type_id, null).size() > 0) {
|
||||||
Intent intent = new Intent(DailyDataMenuActivity.this, POGQuestionsActivity.class);
|
Intent intent = new Intent(DailyDataMenuActivity.this, POGQuestionsActivity.class);
|
||||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
intent.putExtra("categoryId", categoryId);
|
intent.putExtra("categoryId", categoryId);
|
||||||
@@ -586,6 +668,12 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_counterfeit_products))) {
|
||||||
|
Intent intent = new Intent(DailyDataMenuActivity.this, CounterfeitProductsActivity.class);
|
||||||
|
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||||
|
intent.putExtra("categoryId", categoryId);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -611,13 +699,14 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isMappingStockData(){
|
boolean isMappingStockData() {
|
||||||
boolean flag;
|
boolean flag;
|
||||||
if(country_id.equals("7")){
|
if (country_id.equals("7")) {
|
||||||
flag = db.isMappingStockDataStockFacing(categoryId, null, null, null, store_id);
|
flag = db.isMappingStockDataStockFacing(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
}
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
else {
|
flag = db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
flag = db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id, store_id);
|
} else {
|
||||||
|
flag = db.isMappingStockDataStockFacing(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
|
|||||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_msl__availability));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
prepareList();
|
prepareList();
|
||||||
|
|||||||
+188
-68
@@ -57,11 +57,12 @@ import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
|||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.interfaces.DialogCallbackListener;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGetterSetter;
|
||||||
|
|
||||||
public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
public class MSL_Availability_StockFacingActivity extends AppCompatActivity implements DialogCallbackListener {
|
||||||
ExpandableListView expandableListView;
|
ExpandableListView expandableListView;
|
||||||
TextView txt_mslAvailabilityName;
|
TextView txt_mslAvailabilityName;
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
|
|
||||||
String categoryName, categoryId, storeId, Error_Message = "";
|
String categoryName, categoryId, storeId, Error_Message = "";
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, country_id, store_flag_str;
|
||||||
boolean isDialogOpen = true;
|
boolean isDialogOpen = true;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
int scrollPosition = 0;
|
int scrollPosition = 0;
|
||||||
@@ -90,6 +91,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramShelfHeaderDataList = new ArrayList<>();
|
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramShelfHeaderDataList = new ArrayList<>();
|
||||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramSkuChildDataList;
|
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> planogramSkuChildDataList;
|
||||||
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, ArrayList<StockFacing_PlanogramTrackerDataGetterSetter>> planogramHashMapListChildData = new HashMap<>();
|
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, ArrayList<StockFacing_PlanogramTrackerDataGetterSetter>> planogramHashMapListChildData = new HashMap<>();
|
||||||
|
boolean editFlag = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -129,6 +131,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
|
||||||
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
//Intent data
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
@@ -137,7 +140,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
//txt_mslAvailabilityName.setText(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_msl__availability));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_msl__availability));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
str_planogram = CommonString.FILE_PATH_PLANOGRAM;
|
str_planogram = CommonString.FILE_PATH_PLANOGRAM;
|
||||||
@@ -158,7 +161,20 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
|
||||||
|
db.open();
|
||||||
|
|
||||||
|
if (db.checkMsl_Availability_StockFacingData(store_id, categoryId)) {
|
||||||
|
db.updateMSL_Availability_StockFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
|
Snackbar.make(view, getResources().getString(R.string.update_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
|
} else {
|
||||||
|
db.InsertMSL_Availability_StockFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
|
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
|
/*AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
||||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
@@ -182,23 +198,23 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
} else {
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
for (int i = 0; i < adapter.getGroupCount(); i++)
|
||||||
|
expandableListView.expandGroup(i);
|
||||||
|
|
||||||
|
/*AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
||||||
builder.setMessage(Error_Message)
|
builder.setMessage(Error_Message)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
//expandableListView.smoothScrollToPosition(scrollPosition);
|
//expandableListView.smoothScrollToPosition(scrollPosition);
|
||||||
|
|
||||||
/* if (!expandableListView.isGroupExpanded(scrollPosition)) {
|
|
||||||
expandableListView.expandGroup(scrollPosition);
|
|
||||||
}*/
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -292,10 +308,19 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
if (id == android.R.id.home) {
|
if (id == android.R.id.home) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
|
||||||
|
if (editFlag) {
|
||||||
|
CommonFunctions.showAlertDialog(MSL_Availability_StockFacingActivity.this, getResources().getString(R.string.data_will_be_lost));
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
||||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
.setPositiveButton(getResources().getString(R.string.ok), 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) {
|
||||||
|
|
||||||
//adapter.notifyDataSetChanged();
|
//adapter.notifyDataSetChanged();
|
||||||
@@ -310,14 +335,14 @@ public class MSL_Availability_StockFacingActivity 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(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
//finish();
|
//finish();
|
||||||
} else if (id == R.id.action_planogram) {//Planogram Dialog
|
} else if (id == R.id.action_planogram) {//Planogram Dialog
|
||||||
expandableListView.clearFocus();
|
expandableListView.clearFocus();
|
||||||
@@ -334,13 +359,14 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//Header
|
//Header
|
||||||
if (country_id.equals("7")) {
|
if (country_id.equals("7")) {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, null, null, store_id);
|
mappingPlanogramList = db.getMappingPlanogramData(categoryId, null, null, store_id, CommonString.TABLE_MAPPING_PLANOGRAM_STORE_WISE);
|
||||||
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
mappingPlanogramList = db.getMappingPlanogramData(categoryId, storeType_id, class_id, null, CommonString.TABLE_MAPPING_PLANOGRAM_ADHOC);
|
||||||
} else {
|
} else {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null);
|
mappingPlanogramList = db.getMappingPlanogramData(categoryId, storeType_id, class_id, null, CommonString.TABLE_MAPPING_PLANOGRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
||||||
WebView webView = (WebView) dialog.findViewById(R.id.webview);
|
WebView webView = (WebView) dialog.findViewById(R.id.webview);
|
||||||
webView.setWebViewClient(new MyWebViewClient());
|
webView.setWebViewClient(new MyWebViewClient());
|
||||||
@@ -389,6 +415,27 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(boolean flag) {
|
||||||
|
if (flag) {
|
||||||
|
//adapter.notifyDataSetChanged();
|
||||||
|
if (!validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||||
|
|
||||||
|
if (!camera_allow.equals("1")) {
|
||||||
|
db.deletePlanogramListStoreAndCategorywise(store_id, categoryId,
|
||||||
|
planogramShelfHeaderDataList, planogramHashMapListChildData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSave(boolean flag) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private class MyWebViewClient extends WebViewClient {
|
private class MyWebViewClient extends WebViewClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -571,9 +618,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//Header
|
//Header
|
||||||
if (country_id.equals("7")) {
|
if (country_id.equals("7")) {
|
||||||
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, null, null, null, store_id);
|
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE, CommonString.TABLE_MAPPING_SOS_TARGET);
|
||||||
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC, CommonString.TABLE_MAPPING_SOS_TARGET_ADHOC);
|
||||||
} else {
|
} else {
|
||||||
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id);
|
headerDataList = db.getMSL_Availability_StockFacingHeaderData(categoryId, keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK, CommonString.TABLE_MAPPING_SOS_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -585,9 +634,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
childDataList = db.getMSL_Availability_StockFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
childDataList = db.getMSL_Availability_StockFacingSKU_AfterSaveData(categoryId, headerDataList.get(i).getBrand_id(), store_id);
|
||||||
if (!(childDataList.size() > 0)) {
|
if (!(childDataList.size() > 0)) {
|
||||||
if (country_id.equals("7")) {
|
if (country_id.equals("7")) {
|
||||||
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), null, null, null, store_id);
|
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), null, null, null, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||||
|
} else if (store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK_ADHOC);
|
||||||
} else {
|
} else {
|
||||||
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), keyAccount_id, storeType_id, class_id, store_id);
|
childDataList = db.getMSL_Availability_StockFacingSKUData(categoryId, headerDataList.get(i).getBrand_id(), keyAccount_id, storeType_id, class_id, store_id, CommonString.TABLE_MAPPING_STOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,6 +648,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
|
||||||
expandableListView.setAdapter(adapter);
|
expandableListView.setAdapter(adapter);
|
||||||
|
|
||||||
|
//expand all
|
||||||
|
for (int i = 0; i < adapter.getGroupCount(); i++)
|
||||||
|
expandableListView.expandGroup(i);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -604,12 +660,26 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
boolean validateData(List<MSL_AvailabilityStockFacingGetterSetter> listDataHeader,
|
boolean validateData(List<MSL_AvailabilityStockFacingGetterSetter> listDataHeader,
|
||||||
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<MSL_AvailabilityStockFacingGetterSetter>> listDataChild) {
|
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<MSL_AvailabilityStockFacingGetterSetter>> listDataChild) {
|
||||||
boolean flag = true;
|
boolean flag = true, child_flag = true, all_flag = true;
|
||||||
|
|
||||||
checkHeaderArray.clear();
|
checkHeaderArray.clear();
|
||||||
|
int childCount = 0;
|
||||||
|
|
||||||
|
//temp list data for empty only
|
||||||
|
List<MSL_AvailabilityStockFacingGetterSetter> listDataHeaderTemp = new ArrayList<>();
|
||||||
|
|
||||||
|
HashMap<MSL_AvailabilityStockFacingGetterSetter, List<MSL_AvailabilityStockFacingGetterSetter>> listDataChildTemp = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < listDataHeader.size(); i++) {
|
for (int i = 0; i < listDataHeader.size(); i++) {
|
||||||
|
flag = true;
|
||||||
|
|
||||||
|
List<MSL_AvailabilityStockFacingGetterSetter> listTemp = new ArrayList<>();
|
||||||
|
|
||||||
for (int j = 0; j < listDataChild.get(listDataHeader.get(i)).size(); j++) {
|
for (int j = 0; j < listDataChild.get(listDataHeader.get(i)).size(); j++) {
|
||||||
|
|
||||||
|
child_flag = true;
|
||||||
|
|
||||||
MSL_AvailabilityStockFacingGetterSetter data = listDataChild.get(listDataHeader.get(i)).get(j);
|
MSL_AvailabilityStockFacingGetterSetter data = listDataChild.get(listDataHeader.get(i)).get(j);
|
||||||
|
|
||||||
String stock = data.getStock();
|
String stock = data.getStock();
|
||||||
@@ -631,11 +701,13 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.add(i);
|
checkHeaderArray.add(i);
|
||||||
}
|
}
|
||||||
//expandableListView.smoothScrollToPosition(i);
|
//expandableListView.smoothScrollToPosition(i);
|
||||||
scrollPosition = i;
|
scrollPosition = i + j + childCount;
|
||||||
|
|
||||||
|
all_flag = false;
|
||||||
flag = false;
|
flag = false;
|
||||||
|
child_flag = false;
|
||||||
Error_Message = getResources().getString(R.string.faceup_value);
|
Error_Message = getResources().getString(R.string.faceup_value);
|
||||||
break;
|
//break;
|
||||||
} else {
|
} else {
|
||||||
if (data.getToggleValue().equals("0")) {
|
if (data.getToggleValue().equals("0")) {
|
||||||
|
|
||||||
@@ -644,11 +716,13 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.add(i);
|
checkHeaderArray.add(i);
|
||||||
}
|
}
|
||||||
//expandableListView.smoothScrollToPosition(i);
|
//expandableListView.smoothScrollToPosition(i);
|
||||||
scrollPosition = i;
|
scrollPosition = i + j + childCount;
|
||||||
|
|
||||||
|
all_flag = false;
|
||||||
flag = false;
|
flag = false;
|
||||||
|
child_flag = false;
|
||||||
Error_Message = getResources().getString(R.string.stock_value);
|
Error_Message = getResources().getString(R.string.stock_value);
|
||||||
break;
|
//break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//for Egypt
|
//for Egypt
|
||||||
@@ -658,11 +732,13 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.add(i);
|
checkHeaderArray.add(i);
|
||||||
}
|
}
|
||||||
//expandableListView.smoothScrollToPosition(i);
|
//expandableListView.smoothScrollToPosition(i);
|
||||||
scrollPosition = i;
|
scrollPosition = i + j + childCount;
|
||||||
|
|
||||||
|
all_flag = false;
|
||||||
flag = false;
|
flag = false;
|
||||||
|
child_flag = false;
|
||||||
Error_Message = getResources().getString(R.string.stock_value);
|
Error_Message = getResources().getString(R.string.stock_value);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -674,24 +750,41 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
checkHeaderArray.add(i);
|
checkHeaderArray.add(i);
|
||||||
}
|
}
|
||||||
//expandableListView.smoothScrollToPosition(i);
|
//expandableListView.smoothScrollToPosition(i);
|
||||||
scrollPosition = i;
|
scrollPosition = i + j + childCount;
|
||||||
|
|
||||||
|
all_flag = false;
|
||||||
flag = false;
|
flag = false;
|
||||||
|
child_flag = false;
|
||||||
Error_Message = getResources().getString(R.string.faceup_value);
|
Error_Message = getResources().getString(R.string.faceup_value);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!child_flag)
|
||||||
|
listTemp.add(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag == false) {
|
if (flag == false) {
|
||||||
checkflag = false;
|
//checkflag = false;
|
||||||
break;
|
listDataHeaderTemp.add(listDataHeader.get(i));
|
||||||
|
listDataChildTemp.put(listDataHeader.get(i), listTemp);
|
||||||
|
|
||||||
|
//break;
|
||||||
} else {
|
} else {
|
||||||
checkflag = true;
|
childCount = childCount + listDataChild.get(listDataHeader.get(i)).size();
|
||||||
|
//checkflag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return checkflag;
|
if (!all_flag) {
|
||||||
|
adapter = new ExpandableListAdapter(this, listDataHeaderTemp, listDataChildTemp);
|
||||||
|
expandableListView.setAdapter(adapter);
|
||||||
|
checkflag = false;
|
||||||
|
} else {
|
||||||
|
checkflag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return all_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -699,10 +792,10 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
//super.onBackPressed();
|
//super.onBackPressed();
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
/*AlertDialog.Builder builder = new AlertDialog.Builder(MSL_Availability_StockFacingActivity.this);
|
||||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||||
.setPositiveButton(getResources().getString(R.string.ok), 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) {
|
||||||
|
|
||||||
//adapter.notifyDataSetChanged();
|
//adapter.notifyDataSetChanged();
|
||||||
@@ -717,14 +810,36 @@ public class MSL_Availability_StockFacingActivity 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(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();*/
|
||||||
|
if (editFlag) {
|
||||||
|
CommonFunctions.showAlertDialog(MSL_Availability_StockFacingActivity.this, getResources().getString(R.string.data_will_be_lost));
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if(flag){
|
||||||
|
//adapter.notifyDataSetChanged();
|
||||||
|
if (!validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||||
|
|
||||||
|
if (!camera_allow.equals("1")) {
|
||||||
|
db.deletePlanogramListStoreAndCategorywise(store_id, categoryId,
|
||||||
|
planogramShelfHeaderDataList, planogramHashMapListChildData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
public class ExpandableListAdapter extends BaseExpandableListAdapter {
|
||||||
@@ -916,35 +1031,38 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
holder.toggle_available.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
holder.toggle_available.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if(buttonView.isPressed()){
|
if (buttonView.isPressed()) {
|
||||||
if (isChecked) {
|
|
||||||
childData.setToggleValue("1");
|
editFlag = true;
|
||||||
//for Egypt
|
|
||||||
if (country_id.equals("6")) {
|
if (isChecked) {
|
||||||
finalHolder.stock.setVisibility(View.VISIBLE);
|
childData.setToggleValue("1");
|
||||||
} else {
|
//for Egypt
|
||||||
finalHolder.stock.setVisibility(View.GONE);
|
if (country_id.equals("6")) {
|
||||||
}
|
finalHolder.stock.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
finalHolder.stock.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
/*childData.setStock("");
|
/*childData.setStock("");
|
||||||
childData.setFacing("");*/
|
childData.setFacing("");*/
|
||||||
} else {
|
} else {
|
||||||
/* childData.setStock("");
|
/* childData.setStock("");
|
||||||
childData.setFacing("");*/
|
childData.setFacing("");*/
|
||||||
childData.setToggleValue("0");
|
childData.setToggleValue("0");
|
||||||
finalHolder.stock.setVisibility(View.VISIBLE);
|
finalHolder.stock.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
//If MBQ Value is 0
|
//If MBQ Value is 0
|
||||||
if (Integer.parseInt(childData.getMbq()) == 0) {
|
if (Integer.parseInt(childData.getMbq()) == 0) {
|
||||||
childData.setStock("0");
|
childData.setStock("0");
|
||||||
childData.setFacing("0");
|
childData.setFacing("0");
|
||||||
} else {
|
} else {
|
||||||
//for Egypt
|
//for Egypt
|
||||||
if (country_id.equals("6")) {
|
if (country_id.equals("6")) {
|
||||||
childData.setStock("");
|
childData.setStock("");
|
||||||
childData.setFacing("");
|
childData.setFacing("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* else {
|
/* else {
|
||||||
if (finalHolder.facing.getText().toString() != null && !finalHolder.facing.getText().toString().equals("")) {
|
if (finalHolder.facing.getText().toString() != null && !finalHolder.facing.getText().toString().equals("")) {
|
||||||
@@ -955,11 +1073,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
expandableListView.clearFocus();
|
expandableListView.clearFocus();
|
||||||
expandableListView.invalidateViews();
|
expandableListView.invalidateViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -988,7 +1106,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
/*if (!childData.getFacing().equals("") && Integer.parseInt(stock) >= 0 && Integer.parseInt(childData.getFacing()) < Integer.parseInt(stock)) {
|
/*if (!childData.getFacing().equals("") && Integer.parseInt(stock) >= 0 && Integer.parseInt(childData.getFacing()) < Integer.parseInt(stock)) {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
editFlag = true;
|
||||||
if (!edStock.equals("")) {
|
if (!edStock.equals("")) {
|
||||||
String stock = edStock;
|
String stock = edStock;
|
||||||
|
|
||||||
@@ -1094,6 +1212,8 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
final EditText caption = (EditText) v;
|
final EditText caption = (EditText) v;
|
||||||
String edFaceup = caption.getText().toString().replaceFirst("^0+(?!$)", "");
|
String edFaceup = caption.getText().toString().replaceFirst("^0+(?!$)", "");
|
||||||
|
|
||||||
|
editFlag = true;
|
||||||
|
|
||||||
if (edFaceup != null && !edFaceup.equals("") && !edFaceup.equals(".")) {
|
if (edFaceup != null && !edFaceup.equals("") && !edFaceup.equals(".")) {
|
||||||
//int num = Integer.parseInt(edFaceup);
|
//int num = Integer.parseInt(edFaceup);
|
||||||
double faceup = Double.parseDouble(edFaceup);
|
double faceup = Double.parseDouble(edFaceup);
|
||||||
@@ -1334,7 +1454,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//for Egypt
|
//for Egypt
|
||||||
if(country_id.equals("6")){
|
if (country_id.equals("6")) {
|
||||||
if (holder.stock.getText().toString().equals("")) {
|
if (holder.stock.getText().toString().equals("")) {
|
||||||
holder.stock.setBackgroundColor(getResources().getColor(R.color.white));
|
holder.stock.setBackgroundColor(getResources().getColor(R.color.white));
|
||||||
holder.stock.setHintTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
holder.stock.setHintTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||||
|
|||||||
+44
-10
@@ -28,12 +28,14 @@ import android.view.MenuItem;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
@@ -60,7 +62,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
Spinner sp_promo;
|
Spinner sp_promo;
|
||||||
Spinner toggle_add_InStock, toggle_add_promoAnnouncer;
|
Spinner toggle_add_InStock, toggle_add_promoAnnouncer;
|
||||||
ToggleButton toggle_add_runningPos;
|
ToggleButton toggle_add_runningPos;
|
||||||
Button btn_add;
|
//Button btn_add;
|
||||||
ImageView img_addPromotion;
|
ImageView img_addPromotion;
|
||||||
|
|
||||||
ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData;
|
ArrayList<Promo_Compliance_DataGetterSetter> promoSkuListData;
|
||||||
@@ -69,7 +71,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String categoryName, categoryId;
|
String categoryName, categoryId;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, store_flag_str;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
String str = CommonString.FILE_PATH,
|
String str = CommonString.FILE_PATH,
|
||||||
@@ -79,7 +81,9 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
String gallery_package = "";
|
String gallery_package = "";
|
||||||
String error_msg;
|
String error_msg;
|
||||||
Promo_Compliance_DataGetterSetter cd;
|
Promo_Compliance_DataGetterSetter cd;
|
||||||
|
FloatingActionButton fab, fab_add;
|
||||||
|
ScrollView scrollView;
|
||||||
|
private int oldScrollYPostion = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -90,20 +94,36 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_promo_compliance));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_promo_compliance));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
|
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
|
||||||
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
|
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
|
||||||
view_promo_sku = findViewById(R.id.view_promo_sku);
|
view_promo_sku = findViewById(R.id.view_promo_sku);
|
||||||
view_additional_promo = findViewById(R.id.view_additional_promo);
|
//view_additional_promo = findViewById(R.id.view_additional_promo);
|
||||||
|
|
||||||
sp_promo = (Spinner) findViewById(R.id.sp_promo);
|
sp_promo = (Spinner) findViewById(R.id.sp_promo);
|
||||||
toggle_add_InStock = (Spinner) findViewById(R.id.toggle_add_InStock);
|
toggle_add_InStock = (Spinner) findViewById(R.id.toggle_add_InStock);
|
||||||
toggle_add_promoAnnouncer = (Spinner) findViewById(R.id.toggle_add_promoAnnouncer);
|
toggle_add_promoAnnouncer = (Spinner) findViewById(R.id.toggle_add_promoAnnouncer);
|
||||||
toggle_add_runningPos = (ToggleButton) findViewById(R.id.toggle_add_runningPos);
|
toggle_add_runningPos = (ToggleButton) findViewById(R.id.toggle_add_runningPos);
|
||||||
btn_add = (Button) findViewById(R.id.btn_add);
|
//btn_add = (Button) findViewById(R.id.btn_add);
|
||||||
img_addPromotion = (ImageView) findViewById(R.id.img_addPromotion);
|
img_addPromotion = (ImageView) findViewById(R.id.img_addPromotion);
|
||||||
|
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
|
fab_add = (FloatingActionButton) findViewById(R.id.fab_add);
|
||||||
|
scrollView = (ScrollView) findViewById(R.id.scrollView_promoCompliance);
|
||||||
|
|
||||||
|
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollChanged() {
|
||||||
|
if (scrollView.getScrollY() > oldScrollYPostion) {
|
||||||
|
fab.hide();
|
||||||
|
} else if (scrollView.getScrollY() < oldScrollYPostion || scrollView.getScrollY() <= 0) {
|
||||||
|
fab.show();
|
||||||
|
}
|
||||||
|
oldScrollYPostion = scrollView.getScrollY();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
db = new GSKOrangeDB(this);
|
db = new GSKOrangeDB(this);
|
||||||
db.open();
|
db.open();
|
||||||
@@ -120,6 +140,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
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, "");
|
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
//Intent data
|
//Intent data
|
||||||
categoryName = getIntent().getStringExtra("categoryName");
|
categoryName = getIntent().getStringExtra("categoryName");
|
||||||
@@ -283,7 +304,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_add.setOnClickListener(new View.OnClickListener() {
|
fab_add.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
if (!cd.getSp_promo().equals("0")) {
|
if (!cd.getSp_promo().equals("0")) {
|
||||||
@@ -330,7 +351,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
@@ -431,11 +452,24 @@ public class PromoComplianceActivity extends AppCompatActivity {
|
|||||||
//Promo SKU List
|
//Promo SKU List
|
||||||
promoSkuListData = db.getPromoComplianceSkuAfterData(store_id, categoryId);
|
promoSkuListData = db.getPromoComplianceSkuAfterData(store_id, categoryId);
|
||||||
if (!(promoSkuListData.size() > 0)) {
|
if (!(promoSkuListData.size() > 0)) {
|
||||||
promoSkuListData = db.getPromoComplianceSkuData(store_id, categoryId);
|
|
||||||
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
promoSkuListData = db.getPromoComplianceSkuData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
promoSkuListData = db.getPromoComplianceSkuData(store_id, categoryId, CommonString.TABLE_MAPPING_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Promo Spinner List
|
//Promo Spinner List
|
||||||
promoSpinnerListData = db.getPromoSpinnerData(store_id, categoryId);
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)){
|
||||||
|
promoSpinnerListData = db.getPromoSpinnerData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
promoSpinnerListData = db.getPromoSpinnerData(store_id, categoryId, CommonString.TABLE_MAPPING_ADDITIONAL_PROMOTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ArrayAdapter<String> sp_promo_adapter = new ArrayAdapter<>(PromoComplianceActivity.this, android.R.layout.simple_list_item_1);
|
ArrayAdapter<String> sp_promo_adapter = new ArrayAdapter<>(PromoComplianceActivity.this, android.R.layout.simple_list_item_1);
|
||||||
for (int i = 0; i < promoSpinnerListData.size(); i++) {
|
for (int i = 0; i < promoSpinnerListData.size(); i++) {
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setTitle(getResources().getString(R.string.stock_planogram_planogram_tracker));
|
toolbar.setTitle(getResources().getString(R.string.stock_planogram_planogram_tracker));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
db = new GSKOrangeDB(this);
|
db = new GSKOrangeDB(this);
|
||||||
|
|||||||
+18
-3
@@ -152,7 +152,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
//txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
//txt_stockFacingName.setText(getResources().getString(R.string.title_activity_stock_facing));
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_stock_facing));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_stock_facing));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
//Stock Facing List
|
//Stock Facing List
|
||||||
@@ -180,6 +180,21 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
if (validateData(hashMapListHeaderData, hashMapListChildData)) {
|
||||||
|
|
||||||
|
db.open();
|
||||||
|
//Stock Facing insert or update
|
||||||
|
if (db.checkStockAndFacingData(store_id, categoryId)) {
|
||||||
|
db.updateStockAndFacing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
|
Snackbar.make(view, getResources().getString(R.string.update_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||||
|
} else {
|
||||||
|
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(Stock_FacingActivity.this);
|
||||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
@@ -1176,9 +1191,9 @@ public class Stock_FacingActivity extends AppCompatActivity {
|
|||||||
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> mappingPlanogramList;
|
ArrayList<MAPPING_PLANOGRAM_DataGetterSetter> mappingPlanogramList;
|
||||||
|
|
||||||
if (country_id.equals("7")) {
|
if (country_id.equals("7")) {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, null, null, store_id);
|
mappingPlanogramList= db.getMappingPlanogramData(categoryId, null, null, store_id, CommonString.TABLE_MAPPING_PLANOGRAM_STORE_WISE);
|
||||||
} else {
|
} else {
|
||||||
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null);
|
mappingPlanogramList= db.getMappingPlanogramData(categoryId, storeType_id, class_id, null, CommonString.TABLE_MAPPING_PLANOGRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
//ImageView img_planogram = (ImageView) dialog.findViewById(R.id.img_planogram);
|
||||||
|
|||||||
+10
-3
@@ -43,7 +43,7 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
|||||||
StoreWisePerformaceAdapter adapter;
|
StoreWisePerformaceAdapter adapter;
|
||||||
|
|
||||||
GSKOrangeDB db;
|
GSKOrangeDB db;
|
||||||
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id;
|
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
|
||||||
private SharedPreferences preferences;
|
private SharedPreferences preferences;
|
||||||
|
|
||||||
|
|
||||||
@@ -71,10 +71,11 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
|||||||
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, "");
|
||||||
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
|
||||||
|
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
|
||||||
|
|
||||||
toolbar.setTitle(getResources().getString(R.string.title_activity_store_wise_performance));
|
toolbar.setTitle(getResources().getString(R.string.title_activity_store_wise_performance));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
@@ -131,7 +132,13 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
|
|||||||
try {
|
try {
|
||||||
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
|
||||||
|
|
||||||
storeWisePerformanceList = db.getStoreWisePerformance(store_id);
|
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||||
|
storeWisePerformanceList = db.getStoreWisePerformance(store_id, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
storeWisePerformanceList = db.getStoreWisePerformance(store_id, "STORE_PERFORMANCE_NEW");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
|
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package cpm.com.gskmtorange.interfaces;
|
||||||
|
|
||||||
|
public interface DialogCallbackListener {
|
||||||
|
|
||||||
|
public void onSelect(boolean flag);
|
||||||
|
public void onSave(boolean flag);
|
||||||
|
}
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
package cpm.com.gskmtorange.password;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
|
||||||
|
import org.ksoap2.SoapEnvelope;
|
||||||
|
import org.ksoap2.serialization.SoapObject;
|
||||||
|
import org.ksoap2.serialization.SoapSerializationEnvelope;
|
||||||
|
import org.ksoap2.transport.HttpTransportSE;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.LoginActivity;
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
|
import cpm.com.gskmtorange.messgae.AlertMessage;
|
||||||
|
|
||||||
|
public class ChangePasswordActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
|
||||||
|
EditText et_old_password, et_new_password, et_confirm_password;
|
||||||
|
Button btn_submit;
|
||||||
|
ImageView img_info;
|
||||||
|
|
||||||
|
private SharedPreferences preferences = null;
|
||||||
|
private SharedPreferences.Editor editor = null;
|
||||||
|
|
||||||
|
String user_id;
|
||||||
|
String new_pw, old_password;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_change_password);
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
et_old_password = (EditText) findViewById(R.id.et_old_password);
|
||||||
|
et_new_password = (EditText) findViewById(R.id.et_new_password);
|
||||||
|
et_confirm_password = (EditText) findViewById(R.id.et_confirm_password);
|
||||||
|
btn_submit = (Button) findViewById(R.id.btn_submit);
|
||||||
|
img_info = (ImageView) findViewById(R.id.img_info);
|
||||||
|
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
editor = preferences.edit();
|
||||||
|
|
||||||
|
user_id = preferences.getString(CommonString.KEY_USERNAME, "");
|
||||||
|
old_password = preferences.getString(CommonString.KEY_PASSWORD, "");
|
||||||
|
|
||||||
|
//new password
|
||||||
|
et_new_password.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
String result = s.toString().replaceAll(" ", "");
|
||||||
|
if (!s.toString().equals(result)) {
|
||||||
|
et_new_password.setText(result);
|
||||||
|
et_new_password.setSelection(result.length());
|
||||||
|
et_new_password.setError(getString(R.string.space_not_allowed_in_password));
|
||||||
|
et_new_password.requestFocus();
|
||||||
|
// alert the user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//confirm password
|
||||||
|
et_confirm_password.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
String result = s.toString().replaceAll(" ", "");
|
||||||
|
if (!s.toString().equals(result)) {
|
||||||
|
et_confirm_password.setText(result);
|
||||||
|
et_confirm_password.setSelection(result.length());
|
||||||
|
et_confirm_password.setError(getString(R.string.space_not_allowed_in_password));
|
||||||
|
et_confirm_password.requestFocus();
|
||||||
|
// alert the user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
img_info.setOnClickListener(this);
|
||||||
|
btn_submit.setOnClickListener(this);
|
||||||
|
|
||||||
|
FloatingActionButton fab = findViewById(R.id.fab);
|
||||||
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
|
||||||
|
switch (id){
|
||||||
|
case R.id.img_info:
|
||||||
|
|
||||||
|
Dialog dialog = new Dialog(ChangePasswordActivity.this);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||||
|
dialog.setContentView(R.layout.password_rule_dialog);
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.btn_submit:
|
||||||
|
|
||||||
|
if(isValid()){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isValid(){
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
boolean cancel = false;
|
||||||
|
View focusView = null;
|
||||||
|
|
||||||
|
|
||||||
|
//New Password
|
||||||
|
new_pw = et_new_password.getText().toString();
|
||||||
|
|
||||||
|
if(new_pw.equals("")){
|
||||||
|
et_new_password.setError(getString(R.string.error_field_required));
|
||||||
|
focusView = et_new_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//final String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})";
|
||||||
|
/* if(!PASSWORD_PATTERN.matches(new_pw)){
|
||||||
|
et_new_password.setError(getString(R.string.invalid_password));
|
||||||
|
focusView = et_new_password;
|
||||||
|
cancel = true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Pattern textPattern = Pattern.compile("^(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%])(?=.*\\d).+$");
|
||||||
|
|
||||||
|
if(new_pw.equals(old_password)){
|
||||||
|
et_new_password.setError(getString(R.string.new_password_not_equal_to_old_password));
|
||||||
|
focusView = et_new_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
else if(new_pw.length()>=6 && new_pw.length()<=8 && textPattern.matcher(new_pw).matches()){
|
||||||
|
//New Password
|
||||||
|
String confirm_pw = et_confirm_password.getText().toString();
|
||||||
|
if(confirm_pw.equals("")){
|
||||||
|
et_confirm_password.setError(getString(R.string.error_field_required));
|
||||||
|
focusView = et_confirm_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
else if(!confirm_pw.equals(new_pw)){
|
||||||
|
et_confirm_password.setError(getString(R.string.password_and_confirm_password_not_match));
|
||||||
|
focusView = et_confirm_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new AuthenticateTask().execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
et_new_password.setError(getString(R.string.invalid_password));
|
||||||
|
focusView = et_new_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Old Password
|
||||||
|
String old_pw = et_old_password.getText().toString().trim();
|
||||||
|
|
||||||
|
if(old_pw.equals("")){
|
||||||
|
et_old_password.setError(getString(R.string.error_field_required));
|
||||||
|
focusView = et_old_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!old_password.equals("") && !old_pw.equals(old_password)) {
|
||||||
|
et_old_password.setError(getString(R.string.error_incorrect_password));
|
||||||
|
focusView = et_old_password;
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cancel) {
|
||||||
|
// There was an error; don't attempt login and focus the first
|
||||||
|
// form field with an error.
|
||||||
|
focusView.requestFocus();
|
||||||
|
|
||||||
|
} else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return !cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AuthenticateTask extends AsyncTask<Void, Void, String> {
|
||||||
|
private ProgressDialog dialog = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
|
||||||
|
super.onPreExecute();
|
||||||
|
|
||||||
|
dialog = new ProgressDialog(ChangePasswordActivity.this);
|
||||||
|
dialog.setTitle("Login");
|
||||||
|
dialog.setMessage("Authenticating....");
|
||||||
|
dialog.setCancelable(false);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(Void... params) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
|
||||||
|
+ user_id + "[/USER_ID]" + "[OLD_PASSWORD]" + old_password
|
||||||
|
+ "[/OLD_PASSWORD]" + "[NEW_PASSWORD]" + new_pw
|
||||||
|
+ "[/NEW_PASSWORD]" + "[/USER_DATA][/DATA]";
|
||||||
|
|
||||||
|
SoapObject request = new SoapObject(CommonString.NAMESPACE,
|
||||||
|
CommonString.METHOD_UPDATE_PASSWORD);
|
||||||
|
request.addProperty("onXML", userauth_xml);
|
||||||
|
|
||||||
|
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
|
||||||
|
SoapEnvelope.VER11);
|
||||||
|
envelope.dotNet = true;
|
||||||
|
envelope.setOutputSoapObject(request);
|
||||||
|
|
||||||
|
HttpTransportSE androidHttpTransport = new HttpTransportSE(
|
||||||
|
CommonString.URL);
|
||||||
|
|
||||||
|
androidHttpTransport.call(CommonString.SOAP_ACTION_UPDATE_PASSWORD,
|
||||||
|
envelope);
|
||||||
|
|
||||||
|
Object result = (Object) envelope.getResponse();
|
||||||
|
|
||||||
|
if (result.toString()
|
||||||
|
.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
|
|
||||||
|
return CommonString.KEY_SUCCESS;
|
||||||
|
|
||||||
|
} else if (result.toString()
|
||||||
|
.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
showAlert(CommonString.MESSAGE_FAILURE, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (result.toString().equalsIgnoreCase(
|
||||||
|
CommonString.KEY_FALSE)) {
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
showAlert(CommonString.MESSAGE_FALSE, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (result.toString().equalsIgnoreCase(
|
||||||
|
CommonString.KEY_CHANGED)) {
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
//showAlert(CommonString.MESSAGE_CHANGED);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
|
||||||
|
/* final AlertMessage message = new AlertMessage(
|
||||||
|
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
|
||||||
|
"acra_login", e);
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
//showAlert(CommonString.MESSAGE_EXCEPTION);
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
final AlertMessage message = new AlertMessage(
|
||||||
|
ChangePasswordActivity.this,
|
||||||
|
AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket_login", e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
/* final AlertMessage message = new AlertMessage(
|
||||||
|
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
|
||||||
|
"acra_login", e);*/
|
||||||
|
Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
|
||||||
|
Crashlytics.logException(e.getCause());
|
||||||
|
Crashlytics.logException(new Exception("My custom login Exception"));
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//showAlert(CommonString.MESSAGE_EXCEPTION);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String result) {
|
||||||
|
|
||||||
|
super.onPostExecute(result);
|
||||||
|
|
||||||
|
//Stop performance trace
|
||||||
|
//myTrace.stop();
|
||||||
|
|
||||||
|
if (result.equals(CommonString.KEY_SUCCESS)) {
|
||||||
|
|
||||||
|
// PUT IN PREFERENCES
|
||||||
|
|
||||||
|
editor.putString(CommonString.KEY_PASSWORD, new_pw);
|
||||||
|
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
showAlert(getString(R.string.password_updated_successfully), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.dismiss();
|
||||||
|
showAlert(getString(R.string.error), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAlert(String str, final boolean flag_finish) {
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(ChangePasswordActivity.this);
|
||||||
|
builder.setTitle("Parinaam");
|
||||||
|
builder.setMessage(str).setCancelable(false)
|
||||||
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
||||||
|
if(flag_finish){
|
||||||
|
Intent i = new Intent(ChangePasswordActivity.this, LoginActivity.class);
|
||||||
|
// set the new task and clear flags
|
||||||
|
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Intent i = new Intent(activity, StorelistActivity.class);
|
||||||
|
activity.startActivity(i);
|
||||||
|
activity.finish();*/
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
|||||||
|
package cpm.com.gskmtorange.progressbar;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.Animator.AnimatorListener;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.LinearInterpolator;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
import cpm.com.gskmtorange.R;
|
||||||
|
|
||||||
|
|
||||||
|
public class CircularProgressBar extends ProgressBar {
|
||||||
|
private static final String TAG = "CircularProgressBar";
|
||||||
|
|
||||||
|
private static final int STROKE_WIDTH = 20;
|
||||||
|
|
||||||
|
private String mTitle = "";
|
||||||
|
private String mSubTitle = "";
|
||||||
|
|
||||||
|
private int mStrokeWidth = STROKE_WIDTH;
|
||||||
|
|
||||||
|
private final RectF mCircleBounds = new RectF();
|
||||||
|
|
||||||
|
private final Paint mProgressColorPaint = new Paint();
|
||||||
|
private final Paint mBackgroundColorPaint = new Paint();
|
||||||
|
private final Paint mTitlePaint = new Paint();
|
||||||
|
private final Paint mSubtitlePaint = new Paint();
|
||||||
|
|
||||||
|
private boolean mHasShadow = true;
|
||||||
|
private int mShadowColor = Color.BLACK;
|
||||||
|
|
||||||
|
public interface ProgressAnimationListener{
|
||||||
|
public void onAnimationStart();
|
||||||
|
public void onAnimationFinish();
|
||||||
|
public void onAnimationProgress(int progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CircularProgressBar(Context context) {
|
||||||
|
super(context);
|
||||||
|
init(null, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CircularProgressBar(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CircularProgressBar(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init(attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(AttributeSet attrs, int style){
|
||||||
|
//so that shadow shows up properly for lines and arcs
|
||||||
|
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
|
|
||||||
|
TypedArray a = getContext().obtainStyledAttributes(attrs,
|
||||||
|
R.styleable.CircularProgressBar, style, 0);
|
||||||
|
|
||||||
|
String color;
|
||||||
|
Resources res = getResources();
|
||||||
|
|
||||||
|
this.mHasShadow = a.getBoolean(R.styleable.CircularProgressBar_cpb_hasShadow, true);
|
||||||
|
|
||||||
|
color = a.getString(R.styleable.CircularProgressBar_cpb_progressColor);
|
||||||
|
if(color==null)
|
||||||
|
mProgressColorPaint.setColor(res.getColor(R.color.circular_progress_default_progress));
|
||||||
|
else
|
||||||
|
mProgressColorPaint.setColor(Color.parseColor(color));
|
||||||
|
|
||||||
|
color = a.getString(R.styleable.CircularProgressBar_cpb_backgroundColor);
|
||||||
|
if(color==null)
|
||||||
|
mBackgroundColorPaint.setColor(res.getColor(R.color.circular_progress_default_background));
|
||||||
|
else
|
||||||
|
mBackgroundColorPaint.setColor(Color.parseColor(color));
|
||||||
|
|
||||||
|
color = a.getString(R.styleable.CircularProgressBar_cpb_titleColor);
|
||||||
|
if(color==null)
|
||||||
|
mTitlePaint.setColor(res.getColor(R.color.circular_progress_default_title));
|
||||||
|
else
|
||||||
|
mTitlePaint.setColor(Color.parseColor(color));
|
||||||
|
|
||||||
|
color = a.getString(R.styleable.CircularProgressBar_cpb_subtitleColor);
|
||||||
|
if(color==null)
|
||||||
|
mSubtitlePaint.setColor(res.getColor(R.color.circular_progress_default_subtitle));
|
||||||
|
else
|
||||||
|
mSubtitlePaint.setColor(Color.parseColor(color));
|
||||||
|
|
||||||
|
|
||||||
|
String t = a.getString(R.styleable.CircularProgressBar_cpb_title);
|
||||||
|
if(t!=null)
|
||||||
|
mTitle = t;
|
||||||
|
|
||||||
|
t = a.getString(R.styleable.CircularProgressBar_cpb_subtitle);
|
||||||
|
if(t!=null)
|
||||||
|
mSubTitle = t;
|
||||||
|
|
||||||
|
mStrokeWidth = a.getInt(R.styleable.CircularProgressBar_cpb_strokeWidth, STROKE_WIDTH);
|
||||||
|
|
||||||
|
a.recycle();
|
||||||
|
|
||||||
|
|
||||||
|
mProgressColorPaint.setAntiAlias(true);
|
||||||
|
mProgressColorPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mProgressColorPaint.setStrokeWidth(mStrokeWidth);
|
||||||
|
|
||||||
|
mBackgroundColorPaint.setAntiAlias(true);
|
||||||
|
mBackgroundColorPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mBackgroundColorPaint.setStrokeWidth(mStrokeWidth);
|
||||||
|
|
||||||
|
mTitlePaint.setTextSize(60);
|
||||||
|
mTitlePaint.setStyle(Style.FILL);
|
||||||
|
mTitlePaint.setAntiAlias(true);
|
||||||
|
mTitlePaint.setTypeface(Typeface.create("Roboto-Thin", Typeface.NORMAL));
|
||||||
|
mTitlePaint.setShadowLayer(0.1f, 0, 1, Color.GRAY);
|
||||||
|
|
||||||
|
mSubtitlePaint.setTextSize(20);
|
||||||
|
mSubtitlePaint.setStyle(Style.FILL);
|
||||||
|
mSubtitlePaint.setAntiAlias(true);
|
||||||
|
mSubtitlePaint.setTypeface(Typeface.create("Roboto-Thin", Typeface.BOLD));
|
||||||
|
// mSubtitlePaint.setShadowLayer(0.1f, 0, 1, Color.GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected synchronized void onDraw(Canvas canvas) {
|
||||||
|
canvas.drawArc(mCircleBounds, 0, 360 , false, mBackgroundColorPaint);
|
||||||
|
|
||||||
|
int prog = getProgress();
|
||||||
|
float scale = getMax() > 0 ? (float)prog/getMax() *360: 0;
|
||||||
|
|
||||||
|
if(mHasShadow)
|
||||||
|
mProgressColorPaint.setShadowLayer( 3, 0, 1, mShadowColor);
|
||||||
|
canvas.drawArc(mCircleBounds, 270, scale , false, mProgressColorPaint);
|
||||||
|
|
||||||
|
|
||||||
|
if(!TextUtils.isEmpty(mTitle)){
|
||||||
|
int xPos = (int)(getMeasuredWidth()/2 - mTitlePaint.measureText(mTitle) / 2);
|
||||||
|
int yPos = (int) (getMeasuredHeight()/2);
|
||||||
|
|
||||||
|
float titleHeight = Math.abs(mTitlePaint.descent() + mTitlePaint.ascent());
|
||||||
|
if(TextUtils.isEmpty(mSubTitle)){
|
||||||
|
yPos += titleHeight/2;
|
||||||
|
}
|
||||||
|
canvas.drawText(mTitle, xPos, yPos, mTitlePaint);
|
||||||
|
|
||||||
|
yPos += titleHeight;
|
||||||
|
xPos = (int)(getMeasuredWidth()/2 - mSubtitlePaint.measureText(mSubTitle) / 2);
|
||||||
|
|
||||||
|
canvas.drawText(mSubTitle, xPos, yPos, mSubtitlePaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onDraw(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
|
||||||
|
final int height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
|
||||||
|
final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
|
||||||
|
final int min = Math.min(width, height);
|
||||||
|
setMeasuredDimension(min+2*STROKE_WIDTH, min+2*STROKE_WIDTH);
|
||||||
|
|
||||||
|
mCircleBounds.set(STROKE_WIDTH, STROKE_WIDTH, min+STROKE_WIDTH, min+STROKE_WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void setProgress(int progress) {
|
||||||
|
super.setProgress(progress);
|
||||||
|
|
||||||
|
// the setProgress super will not change the details of the progress bar
|
||||||
|
// anymore so we need to force an update to redraw the progress bar
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void animateProgressTo(final int start, final int end, final ProgressAnimationListener listener){
|
||||||
|
if(start!=0)
|
||||||
|
setProgress(start);
|
||||||
|
|
||||||
|
//check
|
||||||
|
final ObjectAnimator progressBarAnimator = ObjectAnimator.ofFloat(this, TRANSLATION_X, start, end);
|
||||||
|
progressBarAnimator.setDuration(1500);
|
||||||
|
// progressBarAnimator.setInterpolator(new AnticipateOvershootInterpolator(2f, 1.5f));
|
||||||
|
progressBarAnimator.setInterpolator(new LinearInterpolator());
|
||||||
|
|
||||||
|
progressBarAnimator.addListener(new AnimatorListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(final Animator animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(final Animator animation) {
|
||||||
|
CircularProgressBar.this.setProgress(end);
|
||||||
|
if(listener!=null)
|
||||||
|
listener.onAnimationFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(final Animator animation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(final Animator animation) {
|
||||||
|
if(listener!=null)
|
||||||
|
listener.onAnimationStart();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
progressBarAnimator.addUpdateListener(new AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(final ValueAnimator animation) {
|
||||||
|
int progress = ((Float) animation.getAnimatedValue()).intValue();
|
||||||
|
if(progress!=CircularProgressBar.this.getProgress()){
|
||||||
|
Log.d(TAG, progress + "");
|
||||||
|
CircularProgressBar.this.setProgress(progress);
|
||||||
|
if(listener!=null)
|
||||||
|
listener.onAnimationProgress(progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
progressBarAnimator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setTitle(String title){
|
||||||
|
this.mTitle = title;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setSubTitle(String subtitle){
|
||||||
|
this.mSubTitle = subtitle;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setSubTitleColor(int color){
|
||||||
|
mSubtitlePaint.setColor(color);
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setTitleColor(int color){
|
||||||
|
mTitlePaint.setColor(color);
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setHasShadow(boolean flag){
|
||||||
|
this.mHasShadow = flag;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setShadow(int color){
|
||||||
|
this.mShadowColor = color;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(){
|
||||||
|
return mTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHasShadow(){
|
||||||
|
return mHasShadow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ import android.net.Uri;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
@@ -33,6 +35,7 @@ import com.google.android.gms.maps.OnMapReadyCallback;
|
|||||||
import com.google.android.gms.maps.SupportMapFragment;
|
import com.google.android.gms.maps.SupportMapFragment;
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
import com.google.android.gms.maps.model.LatLngBounds;
|
||||||
import com.google.android.gms.maps.model.MarkerOptions;
|
import com.google.android.gms.maps.model.MarkerOptions;
|
||||||
import com.google.android.gms.maps.model.PolylineOptions;
|
import com.google.android.gms.maps.model.PolylineOptions;
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ 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;
|
||||||
|
|
||||||
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
|
||||||
|
|
||||||
private GoogleMap mMap;
|
private GoogleMap mMap;
|
||||||
StoreBean store;
|
StoreBean store;
|
||||||
@@ -66,16 +69,27 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
private Location mLastLocation;
|
private Location mLastLocation;
|
||||||
double latitude = 0.0;
|
double latitude = 0.0;
|
||||||
double longitude = 0.0;
|
double longitude = 0.0;
|
||||||
Boolean markerflag=true;
|
Boolean markerflag = true;
|
||||||
|
FloatingActionButton fab_cancel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_store_route);
|
setContentView(R.layout.activity_store_route);
|
||||||
|
fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);
|
||||||
|
fab_cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
store = (StoreBean) getIntent().getSerializableExtra(CommonString.KEY_STORE_LIST);
|
store = (StoreBean) getIntent().getSerializableExtra(CommonString.KEY_STORE_LIST);
|
||||||
store.setLATITUDE("28.5420901");
|
/*store.setLATITUDE("28.5420901");
|
||||||
store.setLONGITUDE("77.2430997");
|
store.setLONGITUDE("77.2430997");*/
|
||||||
|
/*store.setLATITUDE("28.544055");
|
||||||
|
store.setLONGITUDE("77.264060");*/
|
||||||
|
|
||||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||||
@@ -99,7 +113,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
|
||||||
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
PLAY_SERVICES_RESOLUTION_REQUEST).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.notsuppoted)
|
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
|
||||||
, Toast.LENGTH_LONG)
|
, Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
finish();
|
finish();
|
||||||
@@ -151,7 +165,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
mMap = googleMap;
|
mMap = googleMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showMarker(double lat, double lon){
|
public void showMarker(double lat, double lon) {
|
||||||
// Add a marker and move the camera
|
// Add a marker and move the camera
|
||||||
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(R.layout.marker_view, null, false);
|
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(R.layout.marker_view, null, false);
|
||||||
|
|
||||||
@@ -188,7 +202,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
String output = "json";
|
String output = "json";
|
||||||
|
|
||||||
// Building the url to the web service
|
// Building the url to the web service
|
||||||
String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters;
|
String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters+"&key=AIzaSyCPo-giwVv5h8AzsbE1IDRsFsPHjVlCm5A";
|
||||||
|
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
@@ -237,6 +251,16 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnected(@Nullable Bundle bundle) {
|
public void onConnected(@Nullable Bundle bundle) {
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// TODO: Consider calling
|
||||||
|
// ActivityCompat#requestPermissions
|
||||||
|
// here to request the missing permissions, and then overriding
|
||||||
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||||
|
// int[] grantResults)
|
||||||
|
// to handle the case where the user grants the permission. See the documentation
|
||||||
|
// for ActivityCompat#requestPermissions for more details.
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
@@ -254,13 +278,19 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
store1.setLATITUDE(latitude+"");
|
store1.setLATITUDE(latitude+"");
|
||||||
store1.setLONGITUDE(longitude+"");
|
store1.setLONGITUDE(longitude+"");
|
||||||
store1.setSTORE_NAME("Current Location");
|
store1.setSTORE_NAME("Current Location");
|
||||||
showMarker(store1);
|
showMarker(store1, R.layout.current_marker_view);
|
||||||
|
|
||||||
showMarker(store);
|
showMarker(store, R.layout.marker_view);
|
||||||
|
|
||||||
|
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||||
|
builder.include(new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE())));
|
||||||
|
builder.include(new LatLng(latitude, longitude));
|
||||||
|
//mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 48));
|
||||||
|
mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 48));
|
||||||
|
|
||||||
//destination = new LatLng(mapLat[1], mapLon[1]);
|
//destination = new LatLng(mapLat[1], mapLon[1]);
|
||||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(origin));
|
/*mMap.moveCamera(CameraUpdateFactory.newLatLng(origin));
|
||||||
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
|
mMap.animateCamera(CameraUpdateFactory.zoomTo(17));*/
|
||||||
|
|
||||||
//new GetDirection().execute();
|
//new GetDirection().execute();
|
||||||
// Getting URL to the Google Directions API
|
// Getting URL to the Google Directions API
|
||||||
@@ -294,9 +324,9 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showMarker(StoreBean store){
|
public void showMarker(StoreBean store, int layout_resource){
|
||||||
// Add a marker of latest location and move the camera
|
// Add a marker of latest location and move the camera
|
||||||
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(R.layout.marker_view, null, false);
|
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(layout_resource, null, false);
|
||||||
|
|
||||||
TextView desc = (TextView) tv.findViewById(R.id.tv_desc);
|
TextView desc = (TextView) tv.findViewById(R.id.tv_desc);
|
||||||
desc.setText(store.getSTORE_NAME());
|
desc.setText(store.getSTORE_NAME());
|
||||||
@@ -311,6 +341,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
LatLng loc = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
LatLng loc = new LatLng(Double.parseDouble(store.getLATITUDE()), Double.parseDouble(store.getLONGITUDE()));
|
||||||
mMap.addMarker(new MarkerOptions().position(loc).anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
mMap.addMarker(new MarkerOptions().position(loc).anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(bm)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
@@ -429,8 +460,8 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
|
|||||||
|
|
||||||
// Adding all the points in the route to LineOptions
|
// Adding all the points in the route to LineOptions
|
||||||
lineOptions.addAll(points);
|
lineOptions.addAll(points);
|
||||||
lineOptions.width(10);
|
lineOptions.width(15);
|
||||||
lineOptions.color(Color.parseColor("#64dd17"));
|
lineOptions.color(Color.parseColor("#5ac614"));
|
||||||
|
|
||||||
Log.d("onPostExecute","onPostExecute lineoptions decoded");
|
Log.d("onPostExecute","onPostExecute lineoptions decoded");
|
||||||
|
|
||||||
|
|||||||
+133
-3
@@ -47,6 +47,7 @@ import cpm.com.gskmtorange.R;
|
|||||||
import cpm.com.gskmtorange.constant.CommonFunctions;
|
import cpm.com.gskmtorange.constant.CommonFunctions;
|
||||||
import cpm.com.gskmtorange.constant.CommonString;
|
import cpm.com.gskmtorange.constant.CommonString;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||||
@@ -99,6 +100,8 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
ArrayList<PromoComplianceSkuwiseGetterSetter> promoComplianceSkuwiseGetterSetters, promoComplianceSkuwiseExistsGetterSetters;
|
ArrayList<PromoComplianceSkuwiseGetterSetter> promoComplianceSkuwiseGetterSetters, promoComplianceSkuwiseExistsGetterSetters;
|
||||||
|
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> counterfeitProductGetterSetters, counterfeitProductExistsGetterSetters;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -241,7 +244,43 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
protected String doInBackground(Void... params) {
|
protected String doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
data = new Data();
|
data = new Data();
|
||||||
coverageList = db.getPreviousCoverageData(date);
|
|
||||||
|
ArrayList<CoverageBean> adhoc_coverageList = db.getPreviousCoverageData(date, CommonString.FROM_DEVIATION);
|
||||||
|
|
||||||
|
if (adhoc_coverageList.size() > 0) {
|
||||||
|
|
||||||
|
for (int i = 0; i < adhoc_coverageList.size(); i++) {
|
||||||
|
|
||||||
|
String onXML = "[ADHOC_JCP]"
|
||||||
|
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||||
|
+ "[VISIT_DATE]" + adhoc_coverageList.get(i).getVisitDate() + "[/VISIT_DATE]"
|
||||||
|
+ "[STORE_CD]" + adhoc_coverageList.get(i).getStoreId() + "[/STORE_CD]"
|
||||||
|
+ "[/ADHOC_JCP]";
|
||||||
|
|
||||||
|
final String adhoc_xml = "[DATA]" + onXML + "[/DATA]";
|
||||||
|
|
||||||
|
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||||
|
request.addProperty("XMLDATA", adhoc_xml);
|
||||||
|
request.addProperty("KEYS", "ADHOC_JOURNEY_PLAN");
|
||||||
|
request.addProperty("USERNAME", userId);
|
||||||
|
request.addProperty("MID", 0);
|
||||||
|
|
||||||
|
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||||
|
envelope.dotNet = true;
|
||||||
|
envelope.setOutputSoapObject(request);
|
||||||
|
|
||||||
|
HttpTransportSE 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
coverageList = db.getPreviousCoverageData(date, null);
|
||||||
|
|
||||||
if (coverageList.size() > 0) {
|
if (coverageList.size() > 0) {
|
||||||
if (coverageList.size() == 1) {
|
if (coverageList.size() == 1) {
|
||||||
@@ -258,10 +297,24 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
if (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
||||||
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) ||
|
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) ||
|
||||||
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U)) {
|
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U)||
|
||||||
|
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_UN)) {
|
||||||
|
|
||||||
String camera_allow = storeData.getCAMERA_ALLOW();
|
String camera_allow = storeData.getCAMERA_ALLOW();
|
||||||
|
|
||||||
|
String adhoc;
|
||||||
|
if (coverageList.get(i).getFlag_from()!=null && coverageList.get(i).getFlag_from().equals(CommonString.FROM_DEVIATION)) {
|
||||||
|
adhoc = "1";
|
||||||
|
} else {
|
||||||
|
adhoc = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String sub_reason_id = coverageList.get(i).getSub_reasonId();
|
||||||
|
if (sub_reason_id!=null && sub_reason_id.equals("")) {
|
||||||
|
sub_reason_id = "0";
|
||||||
|
}
|
||||||
|
|
||||||
String onXML = "[DATA]"
|
String onXML = "[DATA]"
|
||||||
+ "[USER_DATA]"
|
+ "[USER_DATA]"
|
||||||
+ "[STORE_CD]" + coverageList.get(i).getStoreId() + "[/STORE_CD]"
|
+ "[STORE_CD]" + coverageList.get(i).getStoreId() + "[/STORE_CD]"
|
||||||
@@ -278,6 +331,8 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
+ "[REASON_REMARK]" + coverageList.get(i).getRemark() + "[/REASON_REMARK]"
|
+ "[REASON_REMARK]" + coverageList.get(i).getRemark() + "[/REASON_REMARK]"
|
||||||
+ "[CAMERA_ALLOWED]" + camera_allow + "[/CAMERA_ALLOWED]"
|
+ "[CAMERA_ALLOWED]" + camera_allow + "[/CAMERA_ALLOWED]"
|
||||||
+ "[CHECKOUT_IMAGE]" + coverageList.get(i).getCheckOut_Image() + "[/CHECKOUT_IMAGE]"
|
+ "[CHECKOUT_IMAGE]" + coverageList.get(i).getCheckOut_Image() + "[/CHECKOUT_IMAGE]"
|
||||||
|
+ "[ADHOC]" + adhoc + "[/ADHOC]"
|
||||||
|
+ "[SUBREASONID]" + sub_reason_id + "[/SUBREASONID]"
|
||||||
+ "[/USER_DATA]"
|
+ "[/USER_DATA]"
|
||||||
+ "[/DATA]";
|
+ "[/DATA]";
|
||||||
|
|
||||||
@@ -1085,6 +1140,8 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
+ "[QUESTION_ID]" + audit_data.get(n).getQUESTION_ID() + "[/QUESTION_ID]"
|
+ "[QUESTION_ID]" + audit_data.get(n).getQUESTION_ID() + "[/QUESTION_ID]"
|
||||||
+ "[ANSWER_ID]" + audit_data.get(n).getANSWER_ID() + "[/ANSWER_ID]"
|
+ "[ANSWER_ID]" + audit_data.get(n).getANSWER_ID() + "[/ANSWER_ID]"
|
||||||
+ "[ANSWER_IMAGE]" + audit_data.get(n).getCAM_IMAGE() + "[/ANSWER_IMAGE]"
|
+ "[ANSWER_IMAGE]" + audit_data.get(n).getCAM_IMAGE() + "[/ANSWER_IMAGE]"
|
||||||
|
+ "[ANSWER_IMAGE2]" + audit_data.get(n).getCAM_IMAGE2() + "[/ANSWER_IMAGE2]"
|
||||||
|
+ "[ANSWER]" + audit_data.get(n).getANSWER() + "[/ANSWER]"
|
||||||
+ "[/AUDIT_DATA]";
|
+ "[/AUDIT_DATA]";
|
||||||
|
|
||||||
Audit_data = Audit_data + onXml_audit_data;
|
Audit_data = Audit_data + onXml_audit_data;
|
||||||
@@ -1094,7 +1151,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||||
request.addProperty("XMLDATA", sos_xml);
|
request.addProperty("XMLDATA", sos_xml);
|
||||||
request.addProperty("KEYS", "AUDIT_DATA");
|
request.addProperty("KEYS", "AUDIT_DATA_LATEST");
|
||||||
request.addProperty("USERNAME", userId);
|
request.addProperty("USERNAME", userId);
|
||||||
request.addProperty("MID", mid);
|
request.addProperty("MID", mid);
|
||||||
|
|
||||||
@@ -1205,6 +1262,79 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
|||||||
publishProgress(data);
|
publishProgress(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Counterfeit Product - Country Id - 6 (UAE)
|
||||||
|
String counterfeit_product_data_xml = "", add_product_data_xml = "", product_exists_xml = "", product_add_xml = "";
|
||||||
|
|
||||||
|
db.open();
|
||||||
|
counterfeitProductExistsGetterSetters = db.getCounterfeitProductExistsAfterData(coverageList.get(i).getStoreId(), null);
|
||||||
|
if (counterfeitProductExistsGetterSetters.size() > 0) {
|
||||||
|
|
||||||
|
for (int l = 0; l < counterfeitProductExistsGetterSetters.size(); l++) {
|
||||||
|
|
||||||
|
counterfeitProductGetterSetters = db.getCounterfeitProductAfterData(counterfeitProductExistsGetterSetters.get(l).get_id(), null);
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < counterfeitProductGetterSetters.size(); i1++) {
|
||||||
|
if (!counterfeitProductGetterSetters.get(i1).getCategory_id().equals("0")) {
|
||||||
|
|
||||||
|
product_add_xml = "[PRODUCT_DATA]"
|
||||||
|
+ "[MID]" + mid + "[/MID]"
|
||||||
|
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||||
|
+ "[CATEGORY_ID]" + Integer.parseInt(counterfeitProductGetterSetters.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||||
|
+ "[SKU_NAME]" + counterfeitProductGetterSetters.get(i1).getSkuName() + "[/SKU_NAME]"
|
||||||
|
+ "[BRAND_ID]" + counterfeitProductGetterSetters.get(i1).getBrandId() + "[/BRAND_ID]"
|
||||||
|
+ "[STOCK]" + counterfeitProductGetterSetters.get(i1).getStock() + "[/STOCK]"
|
||||||
|
+ "[IMAGE]" + counterfeitProductGetterSetters.get(i1).getImgStr() + "[/IMAGE]"
|
||||||
|
+ "[IMAGE1]" + counterfeitProductGetterSetters.get(i1).getImgStr1() + "[/IMAGE1]"
|
||||||
|
+ "[IMAGE2]" + counterfeitProductGetterSetters.get(i1).getImgStr2() + "[/IMAGE2]"
|
||||||
|
+ "[/PRODUCT_DATA]";
|
||||||
|
|
||||||
|
add_product_data_xml = add_product_data_xml + product_add_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int exists = 0;
|
||||||
|
if (counterfeitProductExistsGetterSetters.get(l).isExists()) {
|
||||||
|
exists = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
product_exists_xml = "[COUNTERFEIT_PRODUCT_DATA]"
|
||||||
|
+ "[MID]" + mid + "[/MID]"
|
||||||
|
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||||
|
+ "[CATEGORY_ID]" + Integer.parseInt(counterfeitProductExistsGetterSetters.get(l).getCategory_id()) + "[/CATEGORY_ID]"
|
||||||
|
+ "[IS_EXISTS]" + exists + "[/IS_EXISTS]"
|
||||||
|
+ "[COUNTERFEIT_DATA]" + add_product_data_xml + "[/COUNTERFEIT_DATA]"
|
||||||
|
+ "[/COUNTERFEIT_PRODUCT_DATA]";
|
||||||
|
|
||||||
|
counterfeit_product_data_xml = counterfeit_product_data_xml + product_exists_xml;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
final String sos_xml = "[DATA]" + counterfeit_product_data_xml + "[/DATA]";
|
||||||
|
|
||||||
|
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||||
|
request.addProperty("XMLDATA", sos_xml);
|
||||||
|
request.addProperty("KEYS", "COUNTERFEIT_PRODUCT_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;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
data.value = 65;
|
||||||
|
data.name = getString(R.string.title_activity_counterfeit_products);
|
||||||
|
publishProgress(data);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Images Upload
|
// Images Upload
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import cpm.com.gskmtorange.constant.CommonString;
|
|||||||
import cpm.com.gskmtorange.retrofit.PostApiForFile;
|
import cpm.com.gskmtorange.retrofit.PostApiForFile;
|
||||||
import cpm.com.gskmtorange.retrofit.StringConverterFactory;
|
import cpm.com.gskmtorange.retrofit.StringConverterFactory;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.AuditDataGetterSetter;
|
||||||
|
import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||||
@@ -114,6 +115,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
ArrayList<Store_wise_camera_DataGetterSetter> storeWiseCameraDataGetterSetters;
|
ArrayList<Store_wise_camera_DataGetterSetter> storeWiseCameraDataGetterSetters;
|
||||||
ArrayList<PromoComplianceSkuwiseGetterSetter> promoComplianceSkuwiseGetterSetters, promoComplianceSkuwiseExistsGetterSetters;
|
ArrayList<PromoComplianceSkuwiseGetterSetter> promoComplianceSkuwiseGetterSetters, promoComplianceSkuwiseExistsGetterSetters;
|
||||||
|
ArrayList<CounterfeitProductGetterSetter> counterfeitProductGetterSetters, counterfeitProductExistsGetterSetters;
|
||||||
|
|
||||||
RequestBody body1;
|
RequestBody body1;
|
||||||
private Retrofit adapter;
|
private Retrofit adapter;
|
||||||
@@ -321,7 +323,8 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_D) && (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
if (!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_D) && (storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_Y) ||
|
||||||
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) ||
|
storeData.getCHECKOUT_STATUS().equals(CommonString.KEY_L) ||
|
||||||
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U))) {
|
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_U)||
|
||||||
|
!storeData.getUPLOAD_STATUS().equals(CommonString.KEY_UN))) {
|
||||||
|
|
||||||
String camera_allow = storeData.getCAMERA_ALLOW();
|
String camera_allow = storeData.getCAMERA_ALLOW();
|
||||||
String adhoc;
|
String adhoc;
|
||||||
@@ -1180,6 +1183,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
+ "[ANSWER_ID]" + audit_data.get(n).getANSWER_ID() + "[/ANSWER_ID]"
|
+ "[ANSWER_ID]" + audit_data.get(n).getANSWER_ID() + "[/ANSWER_ID]"
|
||||||
+ "[ANSWER_IMAGE]" + audit_data.get(n).getCAM_IMAGE() + "[/ANSWER_IMAGE]"
|
+ "[ANSWER_IMAGE]" + audit_data.get(n).getCAM_IMAGE() + "[/ANSWER_IMAGE]"
|
||||||
+ "[ANSWER_IMAGE2]" + audit_data.get(n).getCAM_IMAGE2() + "[/ANSWER_IMAGE2]"
|
+ "[ANSWER_IMAGE2]" + audit_data.get(n).getCAM_IMAGE2() + "[/ANSWER_IMAGE2]"
|
||||||
|
+ "[ANSWER]" + audit_data.get(n).getANSWER() + "[/ANSWER]"
|
||||||
+ "[/AUDIT_DATA]";
|
+ "[/AUDIT_DATA]";
|
||||||
|
|
||||||
Audit_data = Audit_data + onXml_audit_data;
|
Audit_data = Audit_data + onXml_audit_data;
|
||||||
@@ -1189,7 +1193,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||||
request.addProperty("XMLDATA", sos_xml);
|
request.addProperty("XMLDATA", sos_xml);
|
||||||
request.addProperty("KEYS", "AUDIT_DATA_NEW");
|
request.addProperty("KEYS", "AUDIT_DATA_LATEST");
|
||||||
request.addProperty("USERNAME", userId);
|
request.addProperty("USERNAME", userId);
|
||||||
request.addProperty("MID", mid);
|
request.addProperty("MID", mid);
|
||||||
|
|
||||||
@@ -1299,6 +1303,81 @@ public class UploadActivity extends AppCompatActivity {
|
|||||||
publishProgress(data);
|
publishProgress(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Counterfeit Product - Country Id - 6 (UAE)
|
||||||
|
String counterfeit_product_data_xml = "", add_product_data_xml = "", product_exists_xml = "", product_add_xml = "";
|
||||||
|
|
||||||
|
db.open();
|
||||||
|
counterfeitProductExistsGetterSetters = db.getCounterfeitProductExistsAfterData(coverageList.get(i).getStoreId(), null);
|
||||||
|
if (counterfeitProductExistsGetterSetters.size() > 0) {
|
||||||
|
|
||||||
|
for (int l = 0; l < counterfeitProductExistsGetterSetters.size(); l++) {
|
||||||
|
|
||||||
|
add_product_data_xml ="";
|
||||||
|
|
||||||
|
counterfeitProductGetterSetters = db.getCounterfeitProductAfterData(counterfeitProductExistsGetterSetters.get(l).get_id(), null);
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < counterfeitProductGetterSetters.size(); i1++) {
|
||||||
|
if (!counterfeitProductGetterSetters.get(i1).getCategory_id().equals("0")) {
|
||||||
|
|
||||||
|
product_add_xml = "[PRODUCT_DATA]"
|
||||||
|
+ "[MID]" + mid + "[/MID]"
|
||||||
|
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||||
|
+ "[CATEGORY_ID]" + Integer.parseInt(counterfeitProductGetterSetters.get(i1).getCategory_id()) + "[/CATEGORY_ID]"
|
||||||
|
+ "[SKU_NAME]" + counterfeitProductGetterSetters.get(i1).getSkuName() + "[/SKU_NAME]"
|
||||||
|
+ "[BRAND_ID]" + counterfeitProductGetterSetters.get(i1).getBrandId() + "[/BRAND_ID]"
|
||||||
|
+ "[STOCK]" + counterfeitProductGetterSetters.get(i1).getStock() + "[/STOCK]"
|
||||||
|
+ "[IMAGE]" + counterfeitProductGetterSetters.get(i1).getImgStr() + "[/IMAGE]"
|
||||||
|
+ "[IMAGE1]" + counterfeitProductGetterSetters.get(i1).getImgStr1() + "[/IMAGE1]"
|
||||||
|
+ "[IMAGE2]" + counterfeitProductGetterSetters.get(i1).getImgStr2() + "[/IMAGE2]"
|
||||||
|
+ "[/PRODUCT_DATA]";
|
||||||
|
|
||||||
|
add_product_data_xml = add_product_data_xml + product_add_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int exists = 0;
|
||||||
|
if (counterfeitProductExistsGetterSetters.get(l).isExists()) {
|
||||||
|
exists = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
product_exists_xml = "[COUNTERFEIT_PRODUCT_DATA]"
|
||||||
|
+ "[MID]" + mid + "[/MID]"
|
||||||
|
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||||
|
+ "[CATEGORY_ID]" + Integer.parseInt(counterfeitProductExistsGetterSetters.get(l).getCategory_id()) + "[/CATEGORY_ID]"
|
||||||
|
+ "[IS_EXISTS]" + exists + "[/IS_EXISTS]"
|
||||||
|
+ "[COUNTERFEIT_DATA]" + add_product_data_xml + "[/COUNTERFEIT_DATA]"
|
||||||
|
+ "[/COUNTERFEIT_PRODUCT_DATA]";
|
||||||
|
|
||||||
|
counterfeit_product_data_xml = counterfeit_product_data_xml + product_exists_xml;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
final String sos_xml = "[DATA]" + counterfeit_product_data_xml + "[/DATA]";
|
||||||
|
|
||||||
|
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||||
|
request.addProperty("XMLDATA", sos_xml);
|
||||||
|
request.addProperty("KEYS", "COUNTERFEIT_PRODUCT_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;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
data.value = 65;
|
||||||
|
data.name = getString(R.string.title_activity_counterfeit_products);
|
||||||
|
publishProgress(data);
|
||||||
|
|
||||||
// SET COVERAGE STATUS
|
// SET COVERAGE STATUS
|
||||||
String final_xml = "";
|
String final_xml = "";
|
||||||
onXML = "";
|
onXML = "";
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||||
|
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
|
||||||
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
import cpm.com.gskmtorange.GetterSetter.StoreBean;
|
||||||
import cpm.com.gskmtorange.MainActivity;
|
import cpm.com.gskmtorange.MainActivity;
|
||||||
import cpm.com.gskmtorange.R;
|
import cpm.com.gskmtorange.R;
|
||||||
@@ -534,9 +535,20 @@ public class UploadImageWithRetrofit {
|
|||||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||||
|
|
||||||
db.open();
|
db.open();
|
||||||
db.updateCoverageStatus(storeList.get(i).getSTORE_ID(), CommonString.KEY_U);
|
|
||||||
|
final CoverageBean coverageObj = db.getCoverageSpecificData(storeList.get(i).getVISIT_DATE(), storeList.get(i).getSTORE_ID());
|
||||||
|
|
||||||
|
String uploadStatus;
|
||||||
|
if(coverageObj.getReasonid().equalsIgnoreCase("0")){
|
||||||
|
uploadStatus = CommonString.KEY_U;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uploadStatus = CommonString.KEY_UN;
|
||||||
|
}
|
||||||
|
|
||||||
|
db.updateCoverageStatus(storeList.get(i).getSTORE_ID(), uploadStatus);
|
||||||
db.updateStoreStatusOnLeave(storeList.get(i).getSTORE_ID(), storeList.get(i).getVISIT_DATE(),
|
db.updateStoreStatusOnLeave(storeList.get(i).getSTORE_ID(), storeList.get(i).getVISIT_DATE(),
|
||||||
CommonString.KEY_U, CommonString.FROM_JCP);
|
uploadStatus, CommonString.FROM_JCP);
|
||||||
|
|
||||||
db.deleteTableWithStoreID(storeList.get(i).getSTORE_ID());
|
db.deleteTableWithStoreID(storeList.get(i).getSTORE_ID());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ package cpm.com.gskmtorange.xmlGetterSetter;
|
|||||||
|
|
||||||
public class AuditDataGetterSetter {
|
public class AuditDataGetterSetter {
|
||||||
|
|
||||||
String QUESTION_ID, CULTURE_ID, CATEGORY_ID, QUESTION, ANSWER_TYPE, ANSWER_ID, ANSWER, CAM_IMAGE="", CAMERA_ALLOW="0", KEYACCOUNT_ID="0", NO_OF_CAMERA ="1", CAM_IMAGE2="", CHECK_TYPE;
|
String QUESTION_ID, CULTURE_ID, CATEGORY_ID, QUESTION, ANSWER_TYPE, ANSWER_ID = "0", ANSWER="", CAM_IMAGE="", CAMERA_ALLOW="0", KEYACCOUNT_ID="0", NO_OF_CAMERA ="1", CAM_IMAGE2="", CHECK_TYPE;
|
||||||
|
|
||||||
|
|
||||||
public String getQUESTION_ID() {
|
public String getQUESTION_ID() {
|
||||||
|
|||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
package cpm.com.gskmtorange.xmlGetterSetter;
|
||||||
|
|
||||||
|
public class CounterfeitProductGetterSetter {
|
||||||
|
|
||||||
|
String skuName, imgStr, imgStr1, imgStr2, brand, _id, category_id;
|
||||||
|
int stock, brandId;
|
||||||
|
|
||||||
|
boolean isExists = true;
|
||||||
|
|
||||||
|
public String getSkuName() {
|
||||||
|
return skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuName(String skuName) {
|
||||||
|
this.skuName = skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgStr() {
|
||||||
|
return imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgStr(String imgStr) {
|
||||||
|
this.imgStr = imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgStr1() {
|
||||||
|
return imgStr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgStr1(String imgStr1) {
|
||||||
|
this.imgStr1 = imgStr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgStr2() {
|
||||||
|
return imgStr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgStr2(String imgStr2) {
|
||||||
|
this.imgStr2 = imgStr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStock() {
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock(int stock) {
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBrandId() {
|
||||||
|
return brandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrandId(int brandId) {
|
||||||
|
this.brandId = brandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBrand() {
|
||||||
|
return brand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrand(String brand) {
|
||||||
|
this.brand = brand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get_id() {
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_id(String _id) {
|
||||||
|
this._id = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExists() {
|
||||||
|
return isExists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExists(boolean exists) {
|
||||||
|
isExists = exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory_id() {
|
||||||
|
return category_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory_id(String category_id) {
|
||||||
|
this.category_id = category_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item android:state_pressed="true" >
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_focused="true">
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
<stroke android:width="1.5dip" android:color="@color/default_button_press" />
|
||||||
|
<solid android:color="@android:color/transparent"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item >
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
<stroke android:width="1.5dip" android:color="@color/default_button_press" />
|
||||||
|
<solid android:color="@android:color/transparent"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item >
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
<solid android:color="@color/default_button_press"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user