Merge remote-tracking branch 'origin/GeoT' into GeoT

# Conflicts:
#	GSKMTOrange/src/main/AndroidManifest.xml
#	GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagActivity.java
This commit is contained in:
ashishandroid
2017-01-05 10:52:09 +05:30
76 changed files with 7730 additions and 449 deletions
+1
View File
@@ -39,4 +39,5 @@ dependencies {
compile 'com.google.android.gms:play-services-location:9.0.2' compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.2' compile 'com.google.android.gms:play-services-maps:9.0.2'
compile 'com.android.support:cardview-v7:24.2.1' compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.0.2'
} }
+49 -4
View File
@@ -18,6 +18,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".SplashScreenActivity" android:name=".SplashScreenActivity"
android:label="@string/app_name" android:label="@string/app_name"
@@ -28,10 +29,12 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".LoginActivity" android:name=".LoginActivity"
android:label="@string/title_activity_login" android:label="@string/title_activity_login"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
@@ -41,21 +44,58 @@
android:name=".SelectLanguageActivity" android:name=".SelectLanguageActivity"
android:label="@string/title_activity_select_language" android:label="@string/title_activity_select_language"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".download.DownloadActivity"></activity>
<activity android:name=".download.DownloadActivity" />
<activity <activity
android:name=".geotag.GeoTagStoreList"
android:name=".GeoTag.GeoTagStoreList"
android:label="@string/title_activity_store_list_geotag" android:label="@string/title_activity_store_list_geotag"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
android:name=".gsk_dailyentry.CategoryListActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!--android:label="@string/title_activity_category_list"-->
<activity
android:name=".gsk_dailyentry.CategoryWisePerformanceActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!-- android:label="@string/title_activity_category_wise_performance" -->
<activity
android:name=".gsk_dailyentry.DailyDataMenuActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!--android:label="@string/title_activity_daily_main_menu"-->
<activity
android:name=".gsk_dailyentry.MSL_AvailabilityActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<!--android:label="@string/title_activity_msl__availability"-->
<activity <activity
android:name=".dailyentry.StoreListActivity" android:name=".dailyentry.StoreListActivity"
android:label="@string/title_activity_store_list_geotag" android:label="@string/title_activity_store_list_geotag"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".geotag.GeoTagActivity" android:name=".dailyentry.StoreimageActivity"
android:label="@string/title_activity_store_list_geotag"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".GeoTag.GeoTagActivity"
android:label="@string/title_activity_store_geotag" android:label="@string/title_activity_store_geotag"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
@@ -66,7 +106,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
android:name=".gsk_dailyentry.Stock_FacingActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
</application> </application>
</manifest> </manifest>
@@ -1,4 +1,4 @@
package cpm.com.gskmtorange.database; package cpm.com.gskmtorange.Database;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
@@ -9,32 +9,40 @@ import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import cpm.com.gskmtorange.gettersetter.StoreBean;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans;
import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.TableBean; import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.SubCategoryMasterGetterSetter;
/** /**
* Created by ashishc on 29-12-2016. * Created by ashishc on 29-12-2016.
*/ */
public class GSKOrangeDB extends SQLiteOpenHelper{ public class GSKOrangeDB extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "GSK_ORANGE";
public static final int DATABASE_VERSION = 13;
public static final String DATABASE_NAME = "GSK_ORANGE"; private SQLiteDatabase db;
public static final int DATABASE_VERSION = 13; TableBean tableBean;
private SQLiteDatabase db;
TableBean tableBean;
public GSKOrangeDB(Context context) { public GSKOrangeDB(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, null, DATABASE_VERSION);
} }
public void open() { public void open() {
try { try {
db = this.getWritableDatabase(); db = this.getWritableDatabase();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -45,37 +53,37 @@ public class GSKOrangeDB extends SQLiteOpenHelper{
public void onCreate(SQLiteDatabase db) { public void onCreate(SQLiteDatabase db) {
db.execSQL(TableBean.getJourneyPlan()); db.execSQL(TableBean.getJourneyPlan());
db.execSQL(TableBean.getBrandMaster());
db.execSQL(TableBean.getSkuMaster());
db.execSQL(TableBean.getCategoryMaster());
db.execSQL(TableBean.getSubCategoryMaster());
db.execSQL(TableBean.getDisplayMaster());
db.execSQL(TableBean.getMappingStock());
db.execSQL(TableBean.getMappingT2p());
db.execSQL(CommonString.CREATE_TABLE_STORE_GEOTAGGING);
db.execSQL(CommonString.CREATE_TABLE_COVERAGE_DATA);
} }
@Override @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TableBean.getJourneyPlan()); db.execSQL("DROP TABLE IF EXISTS " + TableBean.getJourneyPlan());
} }
public void deleteTableWithStoreID(String storeid, String process_id){ public void deleteTableWithStoreID(String storeid, String process_id) {
} }
public void deleteAllTables(){ public void deleteAllTables() {
} }
public void InsertJCP(JourneyPlanGetterSetter data) { public void InsertJCP(JourneyPlanGetterSetter data) {
db.delete("JOURNEY_PLAN", null, null); db.delete("JOURNEY_PLAN", null, null);
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
try { try {
for (int i = 0; i < data.getSTORE_ID().size(); i++) { for (int i = 0; i < data.getSTORE_ID().size(); i++) {
@@ -115,21 +123,11 @@ public class GSKOrangeDB extends SQLiteOpenHelper{
} }
} } catch (Exception ex) {
catch (Exception ex) {
Log.d("Exception in JCP", ex.toString()); Log.d("Exception in JCP", ex.toString());
} }
} }
public ArrayList<StoreBean> getStoreData(String date) { public ArrayList<StoreBean> getStoreData(String date) {
@@ -208,6 +206,196 @@ public class GSKOrangeDB extends SQLiteOpenHelper{
return list; return list;
} }
//Gagan Goel
public void InsertCategory(CategoryMasterGetterSetter data) {
db.delete("CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getCATEGORY_ID().size(); i++) {
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("CATEGORY", data.getCATEGORY().get(i));
values.put("CATEGORY_SEQUENCE", data.getCATEGORY_SEQUENCE().get(i));
db.insert("CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in CATEGORY_MASTER " + ex.toString());
}
}
public void InsertMappingStock(MappingStockGetterSetter data) {
db.delete("MAPPING_STOCK", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getKEYACCOUNT_ID().size(); i++) {
values.put("KEYACCOUNT_ID", data.getKEYACCOUNT_ID().get(i));
values.put("STORETYPE_ID", data.getSTORETYPE_ID().get(i));
values.put("CLASS_ID", data.getCLASS_ID().get(i));
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("MUST_HAVE", data.getMUST_HAVE().get(i));
values.put("MBQ", data.getMBQ().get(i));
db.insert("MAPPING_STOCK", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
public void InsertSubCategoryMaster(SubCategoryMasterGetterSetter data) {
db.delete("SUB_CATEGORY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSUB_CATEGORY_ID().size(); i++) {
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("SUB_CATEGORY", data.getSUB_CATEGORY().get(i));
values.put("CATEGORY_ID", data.getCATEGORY_ID().get(i));
values.put("SUB_CATEGORY_SEQUENCE", data.getSUB_CATEGORY_SEQUENCE().get(i));
db.insert("SUB_CATEGORY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_STOCK " + ex.toString());
}
}
public void InsertBrandMaster(BrandMasterGetterSetter data) {
db.delete("BRAND_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getBRAND_ID().size(); i++) {
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("BRAND", data.getBRAND().get(i));
values.put("SUB_CATEGORY_ID", data.getSUB_CATEGORY_ID().get(i));
values.put("COMPANY_ID", data.getCOMPANY_ID().get(i));
values.put("BRAND_SEQUENCE", data.getBRAND_SEQUENCE().get(i));
db.insert("BRAND_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in BRAND_MASTER " + ex.toString());
}
}
public void InsertSkuMaster(SkuMasterGetterSetter data) {
db.delete("SKU_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSKU_ID().size(); i++) {
values.put("SKU_ID", data.getSKU_ID().get(i));
values.put("SKU", data.getSKU().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("MRP", data.getMRP().get(i));
values.put("SKU_SEQUENCE", data.getSKU_SEQUENCE().get(i));
db.insert("SKU_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in SKU_MASTER " + ex.toString());
}
}
public void InsertDisplayMaster(DisplayMasterGetterSetter data) {
db.delete("DISPLAY_MASTER", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getDISPLAY_ID().size(); i++) {
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
values.put("DISPLAY", data.getDISPLAY().get(i));
values.put("IMAGE_URL", data.getIMAGE_URL().get(i));
db.insert("DISPLAY_MASTER", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in DISPLAY_MASTER " + ex.toString());
}
}
public void InsertMAPPING_T2P(MAPPINGT2PGetterSetter data) {
db.delete("MAPPING_T2P", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getSTORE_ID().size(); i++) {
values.put("STORE_ID", data.getSTORE_ID().get(i));
values.put("BRAND_ID", data.getBRAND_ID().get(i));
values.put("DISPLAY_ID", data.getDISPLAY_ID().get(i));
db.insert("MAPPING_T2P", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " in MAPPING_T2P " + ex.toString());
}
}
public void InsertSTOREgeotag(String storeid, double lat, double longitude, String path,String status) {
ContentValues values = new ContentValues();
try {
values.put("STORE_ID", storeid);
values.put("LATITUDE", Double.toString(lat));
values.put("LONGITUDE", Double.toString(longitude));
values.put("FRONT_IMAGE", path);
values.put("GEO_TAG", status);
values.put("STATUS", status);
db.insert(CommonString.TABLE_STORE_GEOTAGGING, null, values);
} catch (Exception ex) {
Log.d("Database Exception ", ex.toString());
}
}
public void updateStatus(String id, String status, double lat, double longtitude) {
ContentValues values = new ContentValues();
try {
values.put("GEO_TAG", status);
db.update(CommonString.KEY_JOURNEY_PLAN, values, CommonString.KEY_STORE_ID + "='" + id + "'", null);
} catch (Exception ex) {
}
}
public void updateCheckoutStatus(String id, String status) {
ContentValues values = new ContentValues();
try {
values.put("CHECKOUT_STATUS", status);
db.update(CommonString.KEY_JOURNEY_PLAN, values, CommonString.KEY_STORE_ID + "='" + id + "'", null);
} catch (Exception ex) {
}
}
@@ -217,4 +405,194 @@ public class GSKOrangeDB extends SQLiteOpenHelper{
public ArrayList<GeotaggingBeans> getinsertGeotaggingData(String status) {
ArrayList<GeotaggingBeans> geodata = new ArrayList<GeotaggingBeans>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * from " + CommonString.TABLE_STORE_GEOTAGGING + " WHERE GEO_TAG = '" + status + "'", null);
if (dbcursor != null) {
int numrows = dbcursor.getCount();
dbcursor.moveToFirst();
for (int i = 1; i <= numrows; ++i) {
GeotaggingBeans data = new GeotaggingBeans();
data.setStoreid(dbcursor.getString(dbcursor.getColumnIndexOrThrow("STORE_ID")));
data.setLatitude(Double.parseDouble(dbcursor.getString(dbcursor.getColumnIndexOrThrow("LATITUDE"))));
data.setLongitude(Double.parseDouble(dbcursor.getString(dbcursor.getColumnIndexOrThrow("LONGITUDE"))));
data.setUrl1(dbcursor.getString(dbcursor.getColumnIndexOrThrow("FRONT_IMAGE")));
geodata.add(data);
dbcursor.moveToNext();
}
dbcursor.close();
}
} catch (Exception e) {
}
finally {
if (dbcursor != null && !dbcursor.isClosed()) {
dbcursor.close();
}
}
return geodata;
}
public void updateGeoTagData(String storeid,String status) {
try {
ContentValues values = new ContentValues();
values.put("GEO_TAG", status);
int l = db.update(CommonString.TABLE_STORE_GEOTAGGING, values,
CommonString.KEY_STORE_ID + "=?", new String[] { storeid });
System.out.println("update : " + l);
} catch (Exception e) {
Log.d("Database Data ", e.toString());
}
}
public void updateDataStatus(String id,String status) {
ContentValues values = new ContentValues();
try {
values.put("GEO_TAG", status);
db.update(CommonString.KEY_JOURNEY_PLAN, values,
CommonString.KEY_STORE_ID + "='" + id + "'", null);
} catch (Exception ex) {
}
}
public void deleteGeoTagData(String storeid) {
try {
db.delete(CommonString.TABLE_STORE_GEOTAGGING, CommonString.KEY_STORE_ID + "='" + storeid + "'", null);
} catch (Exception e) {
}
}
public ArrayList<CoverageBean> getCoverageData(String visitdate) {
ArrayList<CoverageBean> list = new ArrayList<CoverageBean>();
Cursor dbcursor = null;
try {
dbcursor = db.rawQuery("SELECT * from " + CommonString.TABLE_COVERAGE_DATA + " where "
+ CommonString.KEY_VISIT_DATE + "='" + visitdate + "'",
null);
if (dbcursor != null) {
dbcursor.moveToFirst();
while (!dbcursor.isAfterLast()) {
CoverageBean sb = new CoverageBean();
sb.setStoreId(dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_STORE_ID)));
sb.setUserId((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_USER_ID))));
sb.setInTime(((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_IN_TIME)))));
sb.setOutTime(((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_OUT_TIME)))));
sb.setVisitDate((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_VISIT_DATE))))));
sb.setLatitude(((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_LATITUDE)))));
sb.setLongitude(((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_LONGITUDE)))));
sb.setStatus((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_COVERAGE_STATUS))))));
sb.setImage((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_IMAGE))))));
sb.setReason((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_REASON))))));
sb.setReasonid((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_REASON_ID))))));
sb.setMID(Integer.parseInt(((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_ID))))));
if(dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_COVERAGE_REMARK))==null){
sb.setRemark("");
}
else{
sb.setRemark((((dbcursor.getString(dbcursor
.getColumnIndexOrThrow(CommonString.KEY_COVERAGE_REMARK))))));
}
list.add(sb);
dbcursor.moveToNext();
}
dbcursor.close();
return list;
}
} catch (Exception e) {
Log.d("Exception ", e.toString());
}
return list;
}
public long InsertCoverageData(CoverageBean data) {
//db.delete(CommonString1.TABLE_COVERAGE_DATA, "STORE_ID" + "='" + data.getStoreId() + "'", null);
ContentValues values = new ContentValues();
try {
values.put(CommonString.KEY_STORE_ID, data.getStoreId());
values.put(CommonString.KEY_USER_ID, data.getUserId());
values.put(CommonString.KEY_IN_TIME, data.getInTime());
values.put(CommonString.KEY_OUT_TIME, data.getOutTime());
values.put(CommonString.KEY_VISIT_DATE, data.getVisitDate());
values.put(CommonString.KEY_LATITUDE, data.getLatitude());
values.put(CommonString.KEY_LONGITUDE, data.getLongitude());
values.put(CommonString.KEY_REASON_ID, data.getReasonid());
values.put(CommonString.KEY_REASON, data.getReason());
values.put(CommonString.KEY_COVERAGE_STATUS, data.getStatus());
values.put(CommonString.KEY_IMAGE, data.getImage());
values.put(CommonString.KEY_COVERAGE_REMARK, data.getRemark());
values.put(CommonString.KEY_REASON_ID, data.getReasonid());
values.put(CommonString.KEY_REASON, data.getReason());
values.put(CommonString.KEY_GEO_TAG, data.getGEO_TAG());
return db.insert(CommonString.TABLE_COVERAGE_DATA, null, values);
} catch (Exception ex) {
Log.d("Database Exception ", ex.toString());
}
return 0;
}
} }
@@ -1,24 +1,44 @@
package cpm.com.gskmtorange.geotag; package cpm.com.gskmtorange.GeoTag;
import android.Manifest;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.location.Geocoder; import android.location.Geocoder;
import android.location.Location; import android.location.Location;
import android.location.LocationManager; import android.location.LocationManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
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.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient;
@@ -32,31 +52,59 @@ import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.StringReader;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.GeotaggingBeans;
import cpm.com.gskmtorange.messgae.AlertMessage;
import cpm.com.gskmtorange.upload.Base64;
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
/** /**
* Created by ashishc on 27-12-2016. * Created by ashishc on 27-12-2016.
*/ */
public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallback,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener
{
public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
String result, errormsg = "";
;
private ProgressBar pb;
private GoogleMap mMap; private GoogleMap mMap;
double latitude =0.0; double latitude = 0.0;
double longitude =0.0; double longitude = 0.0;
protected String diskpath = "", _path, _pathforcheck, img_str = "", status;
private Location mLastLocation; private Location mLastLocation;
private LocationManager locmanager = null; private LocationManager locmanager = null;
FloatingActionButton fab,fabcarmabtn; FloatingActionButton fab, fabcarmabtn;
SupportMapFragment mapFragment; SupportMapFragment mapFragment;
SharedPreferences preferences; SharedPreferences preferences;
String username,storeid,str; String username, storeid, str, storename, visitData;
GSKOrangeDB db; GSKOrangeDB db;
LocationManager locationManager; LocationManager locationManager;
Geocoder geocoder; Geocoder geocoder;
boolean enabled; boolean enabled;
private Dialog dialog;
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000; private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 1000;
private GoogleApiClient mGoogleApiClient; private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest; private LocationRequest mLocationRequest;
@@ -64,7 +112,17 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
private static int FATEST_INTERVAL = 100; // 1 sec private static int FATEST_INTERVAL = 100; // 1 sec
private static int DISPLACEMENT = 5; // 10 meters private static int DISPLACEMENT = 5; // 10 meters
private static final String TAG = GeoTagActivity.class.getSimpleName(); private static final String TAG = GeoTagActivity.class.getSimpleName();
String defaultCameraPackage = "";
File file;
private int factor, k;
ArrayList<GeotaggingBeans> geotaglist = new ArrayList<GeotaggingBeans>();
private TextView percentage, message;
private FailureGetterSetter failureGetterSetter = null;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -72,9 +130,14 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
storeid = preferences.getString(CommonString.KEY_STORE_ID, null);
storename = preferences.getString(CommonString.KEY_STORE_NAME, null);
visitData = preferences.getString(CommonString.KEY_VISIT_DATE, null);
final PackageManager packageManager = getPackageManager();
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
fabcarmabtn = (FloatingActionButton) findViewById(R.id.camrabtn); fabcarmabtn = (FloatingActionButton) findViewById(R.id.camrabtn);
@@ -82,19 +145,14 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
db = new GSKOrangeDB(GeoTagActivity.this); db = new GSKOrangeDB(GeoTagActivity.this);
db.open(); db.open();
//storeid = getIntent().getStringExtra("Storeid");
storeid = getIntent().getStringExtra("Storeid");
str = CommonString.FILE_PATH; str = CommonString.FILE_PATH;
mapFragment = (SupportMapFragment) getSupportFragmentManager() mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map); .findFragmentById(R.id.map);
mapFragment.getMapAsync(this); mapFragment.getMapAsync(this);
locationManager = (LocationManager) this locationManager = (LocationManager) this
.getSystemService(LOCATION_SERVICE); .getSystemService(LOCATION_SERVICE);
geocoder = new Geocoder(this); geocoder = new Geocoder(this);
@@ -108,7 +166,6 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
} }
if (checkPlayServices()) { if (checkPlayServices()) {
// Building the GoogleApi client // Building the GoogleApi client
@@ -117,14 +174,10 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
createLocationRequest(); createLocationRequest();
} }
locmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
enabled = locmanager.isProviderEnabled(LocationManager.GPS_PROVIDER); enabled = locmanager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!enabled) { if (!enabled) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder( AlertDialog.Builder alertDialog = new AlertDialog.Builder(
GeoTagActivity.this); GeoTagActivity.this);
@@ -161,11 +214,57 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
} }
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!img_str.equalsIgnoreCase("")) {
status = "Y";
db.updateStatus(storeid, status, latitude, longitude);
db.InsertSTOREgeotag(storeid, latitude, longitude, img_str, status);
img_str = "";
new GeoTagUpload(GeoTagActivity.this).execute();
} else {
Snackbar.make(view, "Please Take Image Before Save", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
}
});
fabcarmabtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.d("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.d("TAG", "package name : " + list.get(n).packageName);
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
_pathforcheck = storeid + "Store" + "Image" + getCurrentTime().replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
startCameraActivity();
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
} }
private boolean checkPlayServices() { private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this); .isGooglePlayServicesAvailable(this);
@@ -203,8 +302,8 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
protected void startLocationUpdates() { protected void startLocationUpdates() {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
@@ -225,8 +324,8 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
mLastLocation = LocationServices.FusedLocationApi mLastLocation = LocationServices.FusedLocationApi
.getLastLocation(mGoogleApiClient); .getLastLocation(mGoogleApiClient);
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (mLastLocation != null) { if (mLastLocation != null) {
latitude = mLastLocation.getLatitude(); latitude = mLastLocation.getLatitude();
longitude = mLastLocation.getLongitude(); longitude = mLastLocation.getLongitude();
@@ -255,12 +354,12 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
} }
@Override @Override
public void onLocationChanged (Location location){ public void onLocationChanged(Location location) {
} }
@Override @Override
public void onConnectionFailed (ConnectionResult connectionResult) { public void onConnectionFailed(ConnectionResult connectionResult) {
Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + connectionResult.getErrorCode()); Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + connectionResult.getErrorCode());
} }
@@ -270,10 +369,15 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
} }
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
if (mGoogleApiClient != null) { if (mGoogleApiClient != null) {
mGoogleApiClient.connect(); mGoogleApiClient.connect();
} }
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.start(client, getIndexApiAction());
} }
@Override @Override
@@ -290,10 +394,15 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.end(client, getIndexApiAction());
if (mGoogleApiClient.isConnected()) { if (mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect(); mGoogleApiClient.disconnect();
} }
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.disconnect();
} }
@Override @Override
@@ -302,7 +411,586 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCa
stopLocationUpdates(); stopLocationUpdates();
} }
public String getCurrentTime() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
String cdate = formatter.format(m_cal.getTime());
/* String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":"
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
return cdate;
}
protected void startCameraActivity() {
/* Log.i("MakeMachine", "startCameraActivity()");
file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.setPackage(defaultCameraPackage);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(takePictureIntent, 1);*/
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
String defaultCameraPackage="";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n=0;n<list.size();n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.setPackage(defaultCameraPackage);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(takePictureIntent, 1);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("MakeMachine", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.i("MakeMachine", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.mipmap.camera_icon_done));
fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC")));
img_str = _pathforcheck;
_pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
public Action getIndexApiAction() {
Thing object = new Thing.Builder()
.setName("GeoTag Page") // TODO: Define a title for the content shown.
// TODO: Make sure this auto-generated URL is correct.
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
.build();
return new Action.Builder(Action.TYPE_VIEW)
.setObject(object)
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
.build();
}
public class GeoTagUpload extends AsyncTask<Void, Void, String> {
private Context context;
GeoTagUpload(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Uploading Data");
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
percentage = (TextView) dialog.findViewById(R.id.percentage);
message = (TextView) dialog.findViewById(R.id.message);
}
@Override
protected String doInBackground(Void... params) {
try {
GSKOrangeDB db = new GSKOrangeDB(GeoTagActivity.this);
db.open();
geotaglist = db.getinsertGeotaggingData("Y");
// uploading Geotag
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
String geo_xml = "";
ArrayList<String> geotemplist = new ArrayList<String>();
if (geotaglist.size() > 0) {
for (int i = 0; i < geotaglist.size(); i++) {
runOnUiThread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
k = k + factor;
pb.setProgress(k);
percentage.setText(k + "%");
message.setText("Uploading Geotag Data...");
}
});
String onXML = "[GeoTag_DATA][STORE_ID]"
+ geotaglist.get(i).getStoreid()
+ "[/STORE_ID]"
+ "[LATTITUDE]"
+ geotaglist.get(i).getLatitude()
+ "[/LATTITUDE]"
+ "[LONGITUDE]"
+ geotaglist.get(i).getLongitude()
+ "[/LONGITUDE]"
+ "[FRONT_IMAGE]"
+ geotaglist.get(i).getUrl1()
+ "[/FRONT_IMAGE]"
+ "[CREATED_BY]" + username
+ "[/CREATED_BY][/GeoTag_DATA]";
geo_xml = geo_xml + onXML;
geotemplist.add(geotaglist.get(i).getStoreid());
}
geo_xml = "[DATA]" + geo_xml
+ "[/DATA]";
SoapObject request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
request.addProperty("MID", "0");
request.addProperty("KEYS", "GEOTAG_NEW_DATA");
request.addProperty("USERNAME", username);
request.addProperty("XMLDATA", geo_xml);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(
CommonString.URL);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UPLOAD_ASSET_XMLDATA, envelope);
Object result = (Object) envelope.getResponse();
if (result.toString().equalsIgnoreCase(
CommonString.KEY_SUCCESS)) {
String statusD = "D";
for (int i = 0; i < geotemplist.size(); i++) {
db.updateGeoTagData(geotemplist.get(i).toString(), statusD);
db.updateDataStatus(geotemplist.get(i).toString(), statusD);
}
} else {
if (result.toString().equalsIgnoreCase(
CommonString.KEY_FALSE)) {
return CommonString.METHOD_UPLOAD_ASSET;
}
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result
.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler
.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(
CommonString.KEY_FAILURE)) {
return CommonString.METHOD_UPLOAD_ASSET + ","
+ failureGetterSetter.getErrorMsg();
} else {
}
}
}
return CommonString.KEY_SUCCESS;
} catch (SocketException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
dialog.dismiss();
if (result.equals(CommonString.KEY_SUCCESS)) {
new GeoTagImageUpload(GeoTagActivity.this).execute();
Intent intent = new Intent(
GeoTagActivity.this,
GeoTagStoreList.class);
startActivity(intent);
GeoTagActivity.this.finish();
}
else if(!result.equals(CommonString.KEY_SUCCESS))
{
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, "failure", null);
message.showMessage();
}
else if (!result.equals("")) {
}
}
}
public class GeoTagImageUpload extends AsyncTask<Void, Void, String> {
private Context context;
GeoTagImageUpload(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Uploading Geotag Images");
dialog.setCancelable(false);
dialog.show();
pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
percentage = (TextView) dialog.findViewById(R.id.percentage);
message = (TextView) dialog.findViewById(R.id.message);
}
@Override
protected String doInBackground(Void... params) {
try {
GSKOrangeDB db = new GSKOrangeDB(GeoTagActivity.this);
db.open();
geotaglist = db.getinsertGeotaggingData("D");
// Uploading Geotag
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
if (geotaglist.size() > 0) {
for (int i = 0; i < geotaglist.size(); i++) {
runOnUiThread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
k = k + factor;
pb.setProgress(k);
percentage.setText(k + "%");
message.setText("Uploading Geotag Images...");
}
});
if (geotaglist.get(i).getUrl1() != null
&& !geotaglist.get(i).getUrl1()
.equalsIgnoreCase("")) {
if (new File(Environment.getExternalStorageDirectory() + "/GSK_MT_Images/"
+ geotaglist.get(i).getUrl1()).exists()) {
result = UploadGeoImage(geotaglist.get(i).getUrl1(), "GeoTag");
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return "GeoTag";
}
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.METHOD_Get_DR_STORE_IMAGES_GEO;
} else if (result
.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
return CommonString.METHOD_Get_DR_STORE_IMAGES_GEO + "," + errormsg;
}
/* runOnUiThread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
message.setText("Image1 Upload");
}
});*/
}
}
// for(int i =0 ; i < geotaglist.size(); i++){
// }
}
}
return CommonString.KEY_SUCCESS;
}
catch (SocketException ex) {
ex.printStackTrace();
}
catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
dialog.dismiss();
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
//Toast.makeText(getApplicationContext(),"GeoTag Uploaded ",Toast.LENGTH_LONG).show();
String Statustag = "U";
db.open();
for (int i = 0; i < geotaglist.size(); i++) {
db.updateGeoTagData(geotaglist.get(i).getStoreid(), Statustag);
db.updateDataStatus(geotaglist.get(i).getStoreid(), Statustag);
// db.updateGeoTagDataInMain(geotaglist.get(i).getStoreid());
db.deleteGeoTagData(geotaglist.get(i).getStoreid());
}
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_ERROR
+ result, "success", null);
message.showMessage();
}
else if(!result.equals(CommonString.KEY_SUCCESS))
{
AlertMessage message = new AlertMessage(
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, "failure", null);
message.showMessage();
}
else if (!result.equals("")) {
}
}
}
public String UploadGeoImage(String path, String folder) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/GSK_MT_Images/" + path, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 1024;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/GSK_MT_Images/" + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_Get_DR_POSM_IMAGES);
request.addProperty("img", ba1);
request.addProperty("name", path);
request.addProperty("FolderName", folder);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(
CommonString.URL);
androidHttpTransport.call(
CommonString.SOAP_ACTION_Get_DR_POSM_IMAGES, envelope);
Object result = (Object) envelope.getResponse();
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
new File(Environment.getExternalStorageDirectory() + "/GSK_MT_Images/" + path).delete();
/*SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler
.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(
CommonString.KEY_FAILURE)) {
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}*/
} else if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
} else {
return CommonString.KEY_FAILURE;
}
return result.toString();
}
} }
@@ -1,31 +1,31 @@
package cpm.com.gskmtorange.geotag; package cpm.com.gskmtorange.GeoTag;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity; 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.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.dailyentry.StoreListActivity; import cpm.com.gskmtorange.MainActivity;
import cpm.com.gskmtorange.database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.gettersetter.StoreBean; 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;
@@ -33,30 +33,35 @@ import cpm.com.gskmtorange.constant.CommonString;
* Created by ashishc on 27-12-2016. * Created by ashishc on 27-12-2016.
*/ */
public class GeoTagStoreList extends AppCompatActivity { public class GeoTagStoreList extends AppCompatActivity implements View.OnClickListener {
private SharedPreferences preferences; private SharedPreferences preferences;
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>(); ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
String date,visit_status; String date,visit_status;
GSKOrangeDB db; GSKOrangeDB db;
ListView list; // ListView list;
ValueAdapter adapter;
RecyclerView recyclerView;
private SharedPreferences.Editor editor = null;
LinearLayout parent_linear,nodata_linear; LinearLayout parent_linear,nodata_linear;
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.storelistlayout); setContentView(R.layout.storelistlayout);
list = (ListView) findViewById(R.id.list_id); //list = (ListView) findViewById(R.id.list_id);
recyclerView=(RecyclerView) findViewById(R.id.drawer_layout_recycle);
// nodata_linear = (LinearLayout) findViewById(R.id.no_data_lay); // nodata_linear = (LinearLayout) findViewById(R.id.no_data_lay);
//parent_linear = (LinearLayout) findViewById(R.id.parent_linear); //parent_linear = (LinearLayout) findViewById(R.id.parent_linear);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, ""); visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
@@ -64,41 +69,24 @@ public class GeoTagStoreList extends AppCompatActivity {
db = new GSKOrangeDB(GeoTagStoreList.this); db = new GSKOrangeDB(GeoTagStoreList.this);
db.open(); db.open();
list = (ListView)findViewById(R .id.list_id);
storelist = db.getStoreData(date); storelist = db.getStoreData(date);
if (storelist.size()>0) { if (storelist.size()>0) {
list.setAdapter(new MyAdaptor());
adapter=new ValueAdapter(getApplicationContext(),storelist);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
} }
else
{
list.setOnItemClickListener(new AdapterView.OnItemClickListener() { }
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent in =new Intent(GeoTagStoreList.this,GeoTagActivity.class);
startActivity(in);
finish();
Toast.makeText(getApplicationContext(),"Click",Toast.LENGTH_LONG).show();
}
});
} }
/*
private class MyAdaptor extends BaseAdapter { private class MyAdaptor extends BaseAdapter {
@Override @Override
@@ -141,27 +129,20 @@ public class GeoTagStoreList extends AppCompatActivity {
holder.storename.setText(storelist.get(position).getSTORE_NAME()); holder.storename.setText(storelist.get(position).getSTORE_NAME());
//holder.storeaddress.setText(storelist.get(position).getCITY()); //holder.storeaddress.setText(storelist.get(position).getCITY());
return convertView; return convertView;
} }
} }
*/
private class ViewHolder { /*private class ViewHolder {
TextView storename, storeaddress; TextView storename, storeaddress;
ImageView imgtick; ImageView imgtick;
Button checkout; Button checkout;
RelativeLayout l1; RelativeLayout l1;
} }*/
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
@@ -172,7 +153,7 @@ public class GeoTagStoreList extends AppCompatActivity {
if(id==android.R.id.home){ if(id==android.R.id.home){
// 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);
@@ -181,6 +162,234 @@ public class GeoTagStoreList extends AppCompatActivity {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
Intent intent = new Intent(GeoTagStoreList.this, MainActivity.class);
startActivity(intent);
GeoTagStoreList.this.finish();
}
/*protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
// super.onListItemClick(l, v, position, id);
storelist = db.getStoreData(date);
StoreBean sb = storelist.get(position);
// When clicked, show a toast with the TextView text
if (storelist.get(position).getGEO_TAG().equalsIgnoreCase("U")) {
Snackbar.make(v, R.string.title_geo_tag_activity_upload_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (storelist.get(position).getGEO_TAG().equalsIgnoreCase("D")){
Snackbar.make(v, R.string.title_geo_tag_activity_geo_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else if (storelist.get(position).getGEO_TAG().equalsIgnoreCase("Y")) {
Snackbar.make(v, R.string.title_geo_tag_activity_geo_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (storelist.get(position).getGEO_TAG().equalsIgnoreCase("P")) {
Snackbar.make(v, R.string.title_geo_tag_activity_geo_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else {
// PUT IN PREFERENCES
editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, sb.getSTORE_ID());
editor.putString(CommonString.KEY_STORE_NAME, sb.getSTORE_NAME());
editor.putString(CommonString.KEY_VISIT_DATE, sb.getVISIT_DATE());
editor.commit();
Intent intent = new Intent(GeoTagStoreList.this, GeoTagActivity.class);
startActivity(intent);
GeoTagStoreList();
}
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
public void GeoTagStoreList() {
this.finish();
}*/
public class ValueAdapter extends RecyclerView.Adapter<ValueAdapter.MyViewHolder>{
private LayoutInflater inflator;
List<StoreBean> data= Collections.emptyList();
public ValueAdapter(Context context, List<StoreBean> data){
inflator = LayoutInflater.from(context);
this.data=data;
}
@Override
public ValueAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view=inflator.inflate(R.layout.geotagstorelist,parent,false);
MyViewHolder holder=new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final ValueAdapter.MyViewHolder viewHolder, final int position) {
final StoreBean current=data.get(position);
//viewHolder.txt.setText(current.txt);
viewHolder.txt.setText(current.getSTORE_NAME());
if(current.getGEO_TAG().equalsIgnoreCase("Y"))
{
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.geopin);
}
else if(current.getGEO_TAG().equalsIgnoreCase("D")){
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_d);
}
else if(current.getGEO_TAG().equalsIgnoreCase("U")){
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_u);
}
else if(current.getGEO_TAG().equalsIgnoreCase("P")){
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_p);
}
else
{
viewHolder.imageview.setVisibility(View.INVISIBLE);
}
viewHolder.relativelayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(current.getGEO_TAG().equalsIgnoreCase("Y"))
{
Snackbar.make(v, R.string.title_geo_tag_activity_geo_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else if(current.getGEO_TAG().equalsIgnoreCase("D")){
Snackbar.make(v, R.string.title_geo_tag_activity_geo_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else if(current.getGEO_TAG().equalsIgnoreCase("U")){
Snackbar.make(v, R.string.title_geo_tag_activity_upload_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else if(current.getGEO_TAG().equalsIgnoreCase("P")){
Snackbar.make(v, R.string.title_geo_tag_activity_geo_data, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
else
{
// PUT IN PREFERENCES
editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
editor.commit();
Intent in =new Intent(GeoTagStoreList.this,GeoTagActivity.class);
startActivity(in);
finish();
}
}
});
}
@Override
public int getItemCount() {
return data.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView txt;
ImageView icon;
RelativeLayout relativelayout;
ImageView imageview;
public MyViewHolder(View itemView) {
super(itemView);
txt=(TextView) itemView.findViewById(R.id.geolistviewxml_storename);
relativelayout=(RelativeLayout) itemView.findViewById(R.id.relativelayout);
imageview=(ImageView) itemView.findViewById(R.id.imageView1);
}
}
}
public List<StoreBean> getdata() {
List<StoreBean> data = new ArrayList<>();
storelist = db.getStoreData(date);
StoreBean storelistdata=new StoreBean();
for(int i=0;i<storelist.size();i++)
{
storelistdata.setSTORE_NAME(storelist.get(0).getSTORE_NAME());
data.add(storelistdata);
}
return data;
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
@@ -1,4 +1,4 @@
package cpm.com.gskmtorange.gettersetter; package cpm.com.gskmtorange.GetterSetter;
/** /**
* Created by ashishc on 29-12-2016. * Created by ashishc on 29-12-2016.
@@ -117,13 +117,11 @@ public class LoginActivity extends AppCompatActivity {
// Set up the login form. // Set up the login form.
museridView = (AutoCompleteTextView) findViewById(R.id.userid); museridView = (AutoCompleteTextView) findViewById(R.id.userid);
//populateAutoComplete(); //populateAutoComplete();
mPasswordView = (EditText) findViewById(R.id.password); mPasswordView = (EditText) findViewById(R.id.password);
museridView.setText("testmer"); museridView.setText("testmer");
mPasswordView.setText("cpm123"); mPasswordView.setText("cpm123");
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
@@ -1,9 +1,12 @@
package cpm.com.gskmtorange; package cpm.com.gskmtorange;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -19,8 +22,17 @@ import android.webkit.WebViewClient;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import cpm.com.gskmtorange.geotag.GeoTagStoreList;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.gsk_dailyentry.CategoryListActivity;
import cpm.com.gskmtorange.dailyentry.StoreListActivity; import cpm.com.gskmtorange.dailyentry.StoreListActivity;
import cpm.com.gskmtorange.download.DownloadActivity; import cpm.com.gskmtorange.download.DownloadActivity;
@@ -47,7 +59,7 @@ public class MainActivity extends AppCompatActivity
webView = (WebView) findViewById(R.id.webview); webView = (WebView) findViewById(R.id.webview);
String url = preferences.getString(CommonString.KEY_NOTICE_BOARD_LINK,""); String url = preferences.getString(CommonString.KEY_NOTICE_BOARD_LINK, "");
user_name = preferences.getString(CommonString.KEY_USERNAME, null); user_name = preferences.getString(CommonString.KEY_USERNAME, null);
//user_type = preferences.getString(CommonString.KEY_USER_TYPE, null); //user_type = preferences.getString(CommonString.KEY_USER_TYPE, null);
@@ -55,7 +67,7 @@ public class MainActivity extends AppCompatActivity
webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptEnabled(true);
if(!url.equals("")){ if (!url.equals("")) {
webView.loadUrl(url); webView.loadUrl(url);
@@ -80,7 +92,7 @@ public class MainActivity extends AppCompatActivity
View headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, navigationView, false); View headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, navigationView, false);
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);
tv_username.setText(user_name); tv_username.setText(user_name);
@@ -130,7 +142,7 @@ public class MainActivity extends AppCompatActivity
if (id == R.id.nav_route_plan) { if (id == R.id.nav_route_plan) {
Intent startDownload = new Intent(this,StoreListActivity.class); Intent startDownload = new Intent(this, StoreListActivity.class);
startActivity(startDownload); startActivity(startDownload);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out); overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -154,32 +166,68 @@ public class MainActivity extends AppCompatActivity
overridePendingTransition(R.anim.activity_in, R.anim.activity_out); overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
} else if (id == R.id.nav_exit) {
}
//}
else if (id == R.id.nav_export) {
}
else if (id == R.id.nav_exit) {
} else if (id == R.id.nav_services) { } else if (id == R.id.nav_services) {
}else if (id == R.id.nav_setting) { } else if (id == R.id.nav_setting) {
startActivity(new Intent(MainActivity.this, CategoryListActivity.class));
} else if (id == R.id.nav_export) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("Are you sure you want to take the backup of your data")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@SuppressWarnings("resource")
public void onClick(DialogInterface dialog, int id) {
try {
/*File file = new File(Environment
.getExternalStorageDirectory(),
"capital_backup");
if (!file.isDirectory()) {
file.mkdir();
}*/
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
long date = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("MMM/dd/yy");
String dateString = sdf.format(date);
String currentDBPath = "//data//cpm.com.gskmtorange//databases//" + GSKOrangeDB.DATABASE_NAME;
String backupDBPath = "GSKMT_ORANGE_Database_backup" + dateString.replace('/', '-');
String path = Environment.getExternalStorageDirectory().getPath();
File currentDB = new File(data, currentDBPath);
File backupDB = new File(path, backupDBPath);
//Snackbar.make(rec_store_data, "Database Exported Successfully", Snackbar.LENGTH_SHORT).show();
if (currentDB.exists()) {
@SuppressWarnings("resource")
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert1 = builder1.create();
alert1.show();
} }
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
@@ -22,11 +22,51 @@ public class CommonString {
public static final String KEY_PATH = "path"; public static final String KEY_PATH = "path";
public static final String KEY_VERSION = "APP_VERSION"; public static final String KEY_VERSION = "APP_VERSION";
public static final String KEY_LANGUAGE = "LANGUAGE"; public static final String KEY_LANGUAGE = "LANGUAGE";
public static final String KEY_NOTICE_BOARD_LINK = "NOTICE_BOARD_LINK"; public static final String KEY_NOTICE_BOARD_LINK = "NOTICE_BOARD_LINK";
public static final String KEY_LOGIN_DATA = "LOGIN_DATA"; public static final String KEY_LOGIN_DATA = "LOGIN_DATA";
public static final String KEY_CULTURE_ID = "CULTURE_ID"; public static final String KEY_CULTURE_ID = "CULTURE_ID";
public static final String KEY_STORE_ID = "STORE_ID";
public static final String KEY_STORE_NAME = "STORE_NAME";
public static final String KEY_VISIT_DATE = "VISIT_DATE";
public static final String KEY_CAMERA_ALLOW = "CAMERA_ALLOW";
public static final String KEY_CHECKOUT_STATUS = "CHECKOUT_STATUS";
public static final String KEY_CLASS_ID = "CLASS_ID";
public static final String KEY_EMP_ID = "EMP_ID";
public static final String KEY_GEO_TAG = "GEO_TAG";
public static final String KEY_KEYACCOUNT_ID = "KEYACCOUNT_ID";
public static final String KEY_STORETYPE_ID = "STORETYPE_ID";
public static final String KEY_UPLOAD_STATUS = "UPLOAD_STATUS";
public static final String KEY_STORE_IN_TIME = "STORE_IN_TIME";
public static final String KEY_USER_ID = "USER_ID";
public static final String KEY_IN_TIME = "IN_TIME";
public static final String KEY_OUT_TIME = "OUT_TIME";
public static final String KEY_LATITUDE = "LATITUDE";
public static final String KEY_LONGITUDE = "LONGITUDE";
public static final String KEY_COVERAGE_STATUS = "Coverage";
public static final String KEY_REASON_ID = "REASON_ID";
public static final String KEY_REASON = "REASON";
public static final String KEY_COVERAGE_REMARK = "REMARK";
public static final String KEY_IMAGE = "IMAGE";
public static final String KEY_ID = "Id";
public static final String KEY_MERCHANDISER_ID = "MERCHANDISER_ID";
public static final String KEY_JOURNEY_PLAN = "JOURNEY_PLAN";
public static final String KEY_P = "P";
public static final String KEY_D = "D";
public static final String KEY_U = "U";
public static final String KEY_C = "C";
public static final String KEY_L = "Leave";
public static final String KEY_N = "NOT_VISITED";
public static final String KEY_INVALID = "INVALID";
public static final String STORE_STATUS_LEAVE = "L";
public static final String KEY_VALID = "Valid";
public static final String DATA_DELETE_ALERT_MESSAGE="Saved data will be lost - Do you want to continue?";
public static final String KEY_CHECK_IN = "I";
// webservice constants // webservice constants
public static final String KEY_SUCCESS = "Success"; public static final String KEY_SUCCESS = "Success";
@@ -45,15 +85,77 @@ public class CommonString {
public static final String METHOD_NAME_UNIVERSAL_DOWNLOAD = "Download_Universal"; public static final String METHOD_NAME_UNIVERSAL_DOWNLOAD = "Download_Universal";
public static final String SOAP_ACTION_UNIVERSAL = "http://tempuri.org/" public static final String SOAP_ACTION_UNIVERSAL = "http://tempuri.org/"
+ METHOD_NAME_UNIVERSAL_DOWNLOAD; + METHOD_NAME_UNIVERSAL_DOWNLOAD;
public static final String METHOD_UPLOAD_STOCK_XML_DATA = "DrUploadXml";
public static final String SOAP_ACTION_UPLOAD_ASSET_XMLDATA = "http://tempuri.org/"
+ METHOD_UPLOAD_STOCK_XML_DATA;
public static final String METHOD_UPLOAD_ASSET = "Upload_Stock_Availiablity_V1";
public static final String METHOD_Get_DR_POSM_IMAGES = "GetImageNew";
public static final String SOAP_ACTION_Get_DR_POSM_IMAGES = "http://tempuri.org/"
+ METHOD_Get_DR_POSM_IMAGES;
public static final String METHOD_Get_DR_STORE_IMAGES_GEO = "Upload_StoreGeoTag_IMAGES";
public static final String SOAP_ACTION_DR_STORE_IMAGES_GEO = "http://tempuri.org/"
+ METHOD_Get_DR_STORE_IMAGES_GEO;
//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";
public static final String MESSAGE_CHANGED = "Invalid UserId Or Password / Password Has Been Changed."; public static final String MESSAGE_CHANGED = "Invalid UserId Or Password / Password Has Been Changed.";
public static final String MESSAGE_EXCEPTION = "Problem Occured : Report The Problem To Parinaam "; public static final String MESSAGE_EXCEPTION = "Problem Occured : Report The Problem To Parinaam ";
public static final String MESSAGE_SOCKETEXCEPTION = "Network Communication Failure. Check Your Network Connection"; public static final String MESSAGE_SOCKETEXCEPTION = "Network Communication Failure. Check Your Network Connection";
public static final String TABLE_STORE_GEOTAGGING = "STORE_GEOTAGGING";
public static final String TABLE_COVERAGE_DATA = "COVERAGE_DATA";
public static final String CREATE_TABLE_COVERAGE_DATA = "CREATE TABLE IF NOT EXISTS "
+ TABLE_COVERAGE_DATA + " (" + KEY_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT ," + KEY_STORE_ID
+ " VARCHAR,USER_ID VARCHAR, " + KEY_IN_TIME + " VARCHAR,"
+ KEY_OUT_TIME + " VARCHAR," + KEY_VISIT_DATE + " VARCHAR,"
+ KEY_LATITUDE + " VARCHAR," + KEY_LONGITUDE + " VARCHAR,"+ KEY_MERCHANDISER_ID + " VARCHAR,"
+ KEY_COVERAGE_STATUS + " VARCHAR,"+ KEY_IMAGE + " VARCHAR,"
+ KEY_GEO_TAG + " VARCHAR,"
+ KEY_REASON_ID + " VARCHAR," + KEY_COVERAGE_REMARK
+ " VARCHAR," + KEY_REASON + " VARCHAR)";
public static final String CREATE_TABLE_STORE_GEOTAGGING = "CREATE TABLE IF NOT EXISTS "
+ TABLE_STORE_GEOTAGGING
+ " ("
+ "KEY_ID"
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ "STORE_ID"
+ " VARCHAR,"
+ "LATITUDE"
+ " VARCHAR,"
+ "LONGITUDE"
+ " VARCHAR,"
+ "GEO_TAG"
+ " VARCHAR,"
+ "STATUS"
+ " VARCHAR,"
+ "FRONT_IMAGE" + " VARCHAR)";
} }
@@ -1,30 +1,38 @@
package cpm.com.gskmtorange.dailyentry; package cpm.com.gskmtorange.dailyentry;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
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.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity; 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.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.gettersetter.StoreBean;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
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;
@@ -32,17 +40,20 @@ import cpm.com.gskmtorange.constant.CommonString;
* Created by ashishc on 29-12-2016. * Created by ashishc on 29-12-2016.
*/ */
public class StoreListActivity extends AppCompatActivity { public class StoreListActivity extends AppCompatActivity {
ArrayList<CoverageBean> coverage;
ArrayList<StoreBean> storelist = new ArrayList<StoreBean>(); ArrayList<StoreBean> storelist = new ArrayList<StoreBean>();
//ListView list;
ListView list;
private SharedPreferences preferences; private SharedPreferences preferences;
String date, visit_status;
String date,visit_status;
GSKOrangeDB db; GSKOrangeDB db;
StoreListActivity.ValueAdapter adapter;
RecyclerView recyclerView;
private SharedPreferences.Editor editor = null;
LinearLayout linearlay;
String store_id;
private Dialog dialog;
boolean result_flag = false, leaveflag = false;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -63,132 +74,24 @@ public class StoreListActivity extends AppCompatActivity {
db.open(); db.open();
list = (ListView)findViewById(R .id.list_id); linearlay = (LinearLayout) findViewById(R.id.linearlayout);
recyclerView = (RecyclerView) findViewById(R.id.drawer_layout_recycle);
storelist = db.getStoreData(date); storelist = db.getStoreData(date);
coverage=db.getCoverageData(date);
if (storelist.size() > 0) {
//list.setAdapter(new MyAdaptor());
adapter = new StoreListActivity.ValueAdapter(getApplicationContext(), storelist);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
if (storelist.size()>0) { } else {
list.setAdapter(new MyAdaptor());
recyclerView.setVisibility(View.INVISIBLE);
linearlay.setVisibility(View.VISIBLE);
} }
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(getApplicationContext(),"Click",Toast.LENGTH_LONG).show();
}
});
}
private class MyAdaptor extends BaseAdapter {
@Override
public int getCount() {
return storelist.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.storeviewlist, null);
holder.storename = (TextView) convertView
.findViewById(R.id.storelistviewxml_storename);
holder.storeaddress = (TextView) convertView
.findViewById(R.id.storelistviewxml_storeaddress);
holder.imgtick = (ImageView) convertView
.findViewById(R.id.storelistviewxml_storeico);
holder.checkout = (Button) convertView
.findViewById(R.id.chkout);
holder.l1 = (RelativeLayout) convertView
.findViewById(R.id.storenamelistview_layout);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.storename.setText(storelist.get(position).getSTORE_NAME());
holder.storeaddress.setText(storelist.get(position).getCITY());
holder.checkout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(
StoreListActivity.this);
builder.setMessage("Are you sure you want to checkout")
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog, int id) {
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
return convertView;
}
}
private class ViewHolder {
TextView storename, storeaddress;
ImageView imgtick;
Button checkout;
RelativeLayout l1;
} }
@@ -200,7 +103,7 @@ public class StoreListActivity extends AppCompatActivity {
// as you specify a parent activity in AndroidManifest.xml. // as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId(); int id = item.getItemId();
if(id==android.R.id.home){ if (id == android.R.id.home) {
// NavUtils.navigateUpFromSameTask(this); // NavUtils.navigateUpFromSameTask(this);
finish(); finish();
@@ -213,4 +116,286 @@ public class StoreListActivity extends AppCompatActivity {
} }
public class ValueAdapter extends RecyclerView.Adapter<StoreListActivity.ValueAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<StoreBean> data = Collections.emptyList();
public ValueAdapter(Context context, List<StoreBean> data) {
inflator = LayoutInflater.from(context);
this.data = data;
}
@Override
public StoreListActivity.ValueAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.storeviewlist, parent, false);
StoreListActivity.ValueAdapter.MyViewHolder holder = new StoreListActivity.ValueAdapter.MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final StoreListActivity.ValueAdapter.MyViewHolder viewHolder, final int position) {
final StoreBean current = data.get(position);
String storeid = current.getSTORE_ID();
//viewHolder.txt.setText(current.txt);
viewHolder.txt.setText(current.getSTORE_NAME());
viewHolder.address.setText(current.getADDRESS());
if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_VALID)) {
viewHolder.chkbtn.setVisibility(View.VISIBLE);
viewHolder.imageview.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_u);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_d);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_C)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_c);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tick_p);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.tickl);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_INVALID)) {
if (coverage.size() > 0) {
int i;
for (i = 0; i < coverage.size(); i++) {
if (coverage.get(i).getInTime() != null) {
if (coverage.get(i).getOutTime() == null) {
if (storeid.equals(coverage.get(i).getStoreId())) {
viewHolder.imageview.setVisibility(View.VISIBLE);
viewHolder.imageview.setBackgroundResource(R.mipmap.checkin);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
}
break;
}
}
}
}
} else {
viewHolder.imageview.setVisibility(View.INVISIBLE);
viewHolder.chkbtn.setVisibility(View.INVISIBLE);
}
viewHolder.relativelayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
store_id = current.getSTORE_ID();
if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_U)) {
Snackbar.make(v, R.string.title_store_list_activity_store_already_done, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_D)) {
Snackbar.make(v, R.string.title_store_list_activity_store_data_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getCHECKOUT_STATUS().equalsIgnoreCase(CommonString.KEY_C)) {
Snackbar.make(v, R.string.title_store_list_activity_store_already_checkout, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_P)) {
Snackbar.make(v, R.string.title_store_list_activity_store_again_uploaded, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else if (current.getUPLOAD_STATUS().equalsIgnoreCase(CommonString.KEY_L)) {
Snackbar.make(v, R.string.title_store_list_activity_store_closed, Snackbar.LENGTH_LONG).setAction("Action", null).show();
} else {
// PUT IN PREFERENCES
editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, current.getSTORE_ID());
editor.putString(CommonString.KEY_STORE_NAME, current.getSTORE_NAME());
editor.putString(CommonString.KEY_VISIT_DATE, current.getVISIT_DATE());
editor.putString(CommonString.KEY_CAMERA_ALLOW, current.getCAMERA_ALLOW());
editor.putString(CommonString.KEY_CHECKOUT_STATUS, current.getCHECKOUT_STATUS());
editor.putString(CommonString.KEY_CLASS_ID, current.getCLASS_ID());
editor.putString(CommonString.KEY_EMP_ID, current.getEMP_ID());
editor.putString(CommonString.KEY_GEO_TAG, current.getGEO_TAG());
editor.putString(CommonString.KEY_KEYACCOUNT_ID, current.getKEYACCOUNT_ID());
editor.putString(CommonString.KEY_STORETYPE_ID, current.getSTORETYPE_ID());
editor.putString(CommonString.KEY_UPLOAD_STATUS, current.getUPLOAD_STATUS());
editor.commit();
// showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS());
if (!setcheckedmenthod(store_id)) {
boolean enteryflag = true;
if (coverage.size() > 0) {
int i;
for (i = 0; i < coverage.size(); i++) {
if (coverage.get(i).getInTime() != null) {
if (coverage.get(i).getOutTime() == null) {
if (!store_id.equals(coverage.get(i).getStoreId())) {
Snackbar.make(v, R.string.title_store_list_checkout_current, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
enteryflag = false;
}
break;
}
}
}
}
if (enteryflag) {
showMyDialog(store_id, current.getSTORE_NAME(), "Yes", current.getVISIT_DATE(), current.getCHECKOUT_STATUS());
}
} else {
Snackbar.make(v, R.string.title_store_list_checkout_Already_filled, Snackbar.LENGTH_SHORT).setAction("Action", null).show();
}
}
}
});
}
@Override
public int getItemCount() {
return data.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView txt, address;
ImageView icon;
RelativeLayout relativelayout;
ImageView imageview;
Button chkbtn;
public MyViewHolder(View itemView) {
super(itemView);
txt = (TextView) itemView.findViewById(R.id.storelistviewxml_storename);
address = (TextView) itemView.findViewById(R.id.storelistviewxml_storeaddress);
relativelayout = (RelativeLayout) itemView.findViewById(R.id.storenamelistview_layout);
imageview = (ImageView) itemView.findViewById(R.id.imageView2);
chkbtn = (Button) itemView.findViewById(R.id.chkout);
}
}
}
void showMyDialog(final String storeCd, final String storeName, final String status, final String visitDate, final String checkout_status) {
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialogbox);
RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.radiogrpvisit);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// find which radio button is selected
if (checkedId == R.id.yes) {
Intent in = new Intent(StoreListActivity.this, StoreimageActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
dialog.cancel();
} else if (checkedId == R.id.no) {
dialog.cancel();
if (checkout_status.equals(CommonString.KEY_INVALID) || checkout_status.equals(CommonString.KEY_VALID)) {
AlertDialog.Builder builder = new AlertDialog.Builder(StoreListActivity.this);
builder.setMessage(CommonString.DATA_DELETE_ALERT_MESSAGE)
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
/*Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
startActivity(in);*/
}
})
.setNegativeButton("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
/* Intent in = new Intent(StoreListActivity.this, NonWorkingReason.class);
startActivity(in);*/
}
}
}
});
dialog.show();
}
public boolean setcheckedmenthod(String store_cd) {
for (int i = 0; i < coverage.size(); i++) {
if (store_cd.equals(coverage.get(i).getStoreId())) {
if (coverage.get(i).getOutTime() != null) {
result_flag = true;
break;
}
} else {
result_flag = false;
}
}
return result_flag;
}
} }
@@ -0,0 +1,381 @@
package cpm.com.gskmtorange.dailyentry;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationServices;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.GetterSetter.CoverageBean;
/**
* Created by ashishc on 31-05-2016.
*/
public class StoreimageActivity extends AppCompatActivity implements View.OnClickListener,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
ImageView img_cam,img_clicked;
Button btn_save;
String _pathforcheck,_path,str;
String store_id,visit_date,username,intime,date;
private SharedPreferences preferences;
AlertDialog alert;
String img_str;
private GSKOrangeDB database;
String lat,lon;
GoogleApiClient mGoogleApiClient;
ArrayList<CoverageBean> coverage_list;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_storeimage);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
img_cam = (ImageView) findViewById(R.id.img_selfie);
img_clicked = (ImageView) findViewById(R.id.img_cam_selfie);
btn_save = (Button) findViewById(R.id.btn_save_selfie);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null);
intime = preferences.getString(CommonString.KEY_STORE_IN_TIME, "");
str = CommonString.FILE_PATH;
database = new GSKOrangeDB(this);
database.open();
coverage_list = database.getCoverageData(date);
img_cam.setOnClickListener(this);
img_clicked.setOnClickListener(this);
btn_save.setOnClickListener(this);
// Create an instance of GoogleAPIClient.
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
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 ;
}
}
@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){
// NavUtils.navigateUpFromSameTask(this);
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
/*Intent i = new Intent(this, DailyEntryScreen.class);
startActivity(i);*/
finish();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id){
case R.id.img_cam_selfie:
_pathforcheck = store_id + "Store"
+ "Image" + visit_date.replace("/","") + getCurrentTime().replace(":","")+".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
intime = getCurrentTime();
startCameraActivity();
break;
case R.id.btn_save_selfie:
if (img_str !=null) {
AlertDialog.Builder builder = new AlertDialog.Builder(
StoreimageActivity.this);
builder.setMessage("Do you want to save the data ")
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int id) {
alert.getButton(
AlertDialog.BUTTON_POSITIVE)
.setEnabled(false);
String status ="INVALID";
CoverageBean cdata = new CoverageBean();
cdata.setStoreId(store_id);
cdata.setVisitDate(visit_date);
cdata.setUserId(username);
cdata.setInTime(intime);
cdata.setReason("");
cdata.setReasonid("0");
cdata.setLatitude(lat);
cdata.setLongitude(lon);
cdata.setImage(img_str);
cdata.setRemark("");
cdata.setStatus(CommonString.KEY_CHECK_IN);
database.InsertCoverageData(cdata);
database.updateCheckoutStatus(store_id, status);
/* SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_STOREVISITED_STATUS, "");
editor.putString(CommonString.KEY_STORE_IN_TIME, "");
editor.commit();*/
/* Intent in=new Intent(StoreimageActivity.this,StoreEntry.class);
startActivity(in);
finish();*/
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int id) {
dialog.cancel();
}
});
alert = builder.create();
alert.show();
}
else {
Toast.makeText(getApplicationContext(),
"Please click the image", Toast.LENGTH_SHORT).show();
}
break;
}
}
protected void startCameraActivity() {
try {
/*Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 0);*/
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
String defaultCameraPackage="";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n=0;n<list.size();n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.e("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
Log.e("TAG", "package name : " + list.get(n).packageName);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
} else {
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Gallery")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
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:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
Bitmap bmp = BitmapFactory.decodeFile(str + _pathforcheck);
img_cam.setImageBitmap(bmp);
img_clicked.setVisibility(View.GONE);
img_cam.setVisibility(View.VISIBLE);
img_str = _pathforcheck;
_pathforcheck = "";
}
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
public String getCurrentTime() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss:mmm");
String cdate = formatter.format(m_cal.getTime());
/* String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":"
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
return cdate;
}
@Override
public void onConnected(Bundle bundle) {
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (mLastLocation != null) {
lat = String.valueOf(mLastLocation.getLatitude());
lon = String.valueOf(mLastLocation.getLongitude());
}
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
protected void onStart() {
mGoogleApiClient.connect();
super.onStart();
}
protected void onStop() {
mGoogleApiClient.disconnect();
super.onStop();
}
}
@@ -26,7 +26,7 @@ import java.io.StringReader;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import cpm.com.gskmtorange.database.GSKOrangeDB; import cpm.com.gskmtorange.Database.GSKOrangeDB;
import cpm.com.gskmtorange.R; import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
@@ -70,7 +70,7 @@ public class DownloadActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, null); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
new UploadTask(DownloadActivity.this).execute(); new UploadTask(DownloadActivity.this).execute();
} }
@@ -79,8 +79,7 @@ public class DownloadActivity extends AppCompatActivity {
String name; String name;
} }
private class UploadTask extends AsyncTask<Void , Data, String>{ private class UploadTask extends AsyncTask<Void, Data, String> {
private Context context; private Context context;
UploadTask(Context context) { UploadTask(Context context) {
@@ -100,75 +99,63 @@ public class DownloadActivity extends AppCompatActivity {
message = (TextView) dialog.findViewById(R.id.message); message = (TextView) dialog.findViewById(R.id.message);
dialog.setCancelable(false); dialog.setCancelable(false);
dialog.show(); dialog.show();
} }
@Override @Override
protected String doInBackground(Void... voids) { protected String doInBackground(Void... voids) {
try { try {
String resultHttp = "";
String resultHttp="";
data = new Data(); data = new Data();
data.value = 10; data.value = 10;
data.name = "JCP Data Downloading"; data.name = "JCP Data Downloading";
publishProgress(data); publishProgress(data);
XmlPullParserFactory factory = XmlPullParserFactory XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
.newInstance();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser(); XmlPullParser xpp = factory.newPullParser();
SoapObject request = new SoapObject(CommonString.NAMESPACE, SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "JOURNEY_PLAN"); request.addProperty("Type", "JOURNEY_PLAN");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapEnvelope.VER11);
envelope.dotNet = true; envelope.dotNet = true;
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE( HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
CommonString.URL); androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL,
envelope);
Object result = (Object) envelope.getResponse(); Object result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
//InputStream stream = new ByteArrayInputStream(result.toString().getBytes("UTF-8")); //InputStream stream = new ByteArrayInputStream(result.toString().getBytes("UTF-8"));
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
// xpp.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false); // xpp.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
// xpp.setInput(stream,"UTF-8"); // xpp.setInput(stream,"UTF-8");
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
jcpgettersetter = XMLHandlers.JCPXMLHandler(xpp, eventType); jcpgettersetter = XMLHandlers.JCPXMLHandler(xpp, eventType);
if(jcpgettersetter.getSTORE_ID().size()>0){ if (jcpgettersetter.getSTORE_ID().size() > 0) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
String jcpTable = jcpgettersetter.getTable_journey_plan(); String jcpTable = jcpgettersetter.getTable_journey_plan();
TableBean.setJourneyPlan(jcpTable); TableBean.setJourneyPlan(jcpTable);
} else {
}else{
return "JOURNEY_PLAN"; return "JOURNEY_PLAN";
} }
data.value = 10; data.value = 10;
data.name = "JCP Data Downloading"; data.name = "JCP Data Downloading";
} }
publishProgress(data); publishProgress(data);
// Store List Master // Store List Master
request = new SoapObject(CommonString.NAMESPACE, request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "SKU_MASTER"); request.addProperty("Type", "SKU_MASTER");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -178,36 +165,33 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
skumastergettersetter =XMLHandlers.skuMasterXMLHandler(xpp, eventType); skumastergettersetter = XMLHandlers.skuMasterXMLHandler(xpp, eventType);
if(skumastergettersetter.getSKU_ID().size()>0){ if (skumastergettersetter.getSKU_ID().size() > 0) {
String skutable = skumastergettersetter.getTable_SKU_MASTER(); String skutable = skumastergettersetter.getTable_SKU_MASTER();
if(skutable!=null){ if (skutable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setSkuMaster(skutable); TableBean.setSkuMaster(skutable);
} }
}else{ } else {
return "SKU_MASTER"; return "SKU_MASTER";
} }
data.value = 20; data.value = 20;
data.name = "SKU_MASTER Data Download"; data.name = "SKU_MASTER Data Download";
} }
publishProgress(data); publishProgress(data);
// BRAND_MASTER
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// BRAND_MASTER
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "BRAND_MASTER"); request.addProperty("Type", "BRAND_MASTER");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -217,36 +201,33 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
brandMasterGetterSetter =XMLHandlers.brandMasterXMLHandler(xpp, eventType); brandMasterGetterSetter = XMLHandlers.brandMasterXMLHandler(xpp, eventType);
if(brandMasterGetterSetter.getBRAND_ID().size()>0){ if (brandMasterGetterSetter.getBRAND_ID().size() > 0) {
String brandtable = brandMasterGetterSetter.getTable_BRAND_MASTER(); String brandtable = brandMasterGetterSetter.getTable_BRAND_MASTER();
if(brandtable!=null){ if (brandtable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setBrandMaster(brandtable); TableBean.setBrandMaster(brandtable);
} }
}else{ } else {
return "BRAND_MASTER"; return "BRAND_MASTER";
} }
data.value = 30; data.value = 30;
data.name = "BRAND_MASTER Data Download"; data.name = "BRAND_MASTER Data Download";
} }
publishProgress(data); publishProgress(data);
// SUB_CATEGORY_MASTER
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// SUB_CATEGORY_MASTER
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "SUB_CATEGORY_MASTER"); request.addProperty("Type", "SUB_CATEGORY_MASTER");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -256,36 +237,32 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
subCategoryMasterGetterSetter =XMLHandlers.subCategoryMasterXMLHandler(xpp, eventType); subCategoryMasterGetterSetter = XMLHandlers.subCategoryMasterXMLHandler(xpp, eventType);
if(subCategoryMasterGetterSetter.getSUB_CATEGORY_ID().size()>0){ if (subCategoryMasterGetterSetter.getSUB_CATEGORY_ID().size() > 0) {
String categorytable = subCategoryMasterGetterSetter.getTable_SUB_CATEGORY_MASTER(); String categorytable = subCategoryMasterGetterSetter.getTable_SUB_CATEGORY_MASTER();
if(categorytable!=null){ if (categorytable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setSubCategoryMaster(categorytable); TableBean.setSubCategoryMaster(categorytable);
} }
}else{ } else {
return "SUB_CATEGORY_MASTER"; return "SUB_CATEGORY_MASTER";
} }
data.value = 40;
data.value = 20;
data.name = "SUB_CATEGORY_MASTER Data Download"; data.name = "SUB_CATEGORY_MASTER Data Download";
} }
publishProgress(data); publishProgress(data);
// CATEGORY_MASTER
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// CATEGORY_MASTER
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "CATEGORY_MASTER"); request.addProperty("Type", "CATEGORY_MASTER");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -295,36 +272,32 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
categoryMasterGetterSetter =XMLHandlers.categoryMasterXMLHandler(xpp, eventType); categoryMasterGetterSetter = XMLHandlers.categoryMasterXMLHandler(xpp, eventType);
if(categoryMasterGetterSetter.getCATEGORY_ID().size()>0){ if (categoryMasterGetterSetter.getCATEGORY_ID().size() > 0) {
String skutable = categoryMasterGetterSetter.getTable_CATEGORY_MASTER(); String skutable = categoryMasterGetterSetter.getTable_CATEGORY_MASTER();
if(skutable!=null){ if (skutable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setCategoryMaster(skutable); TableBean.setCategoryMaster(skutable);
} }
}else{ } else {
return "CATEGORY_MASTER"; return "CATEGORY_MASTER";
} }
data.value = 50;
data.value = 20;
data.name = "CATEGORY_MASTER Data Download"; data.name = "CATEGORY_MASTER Data Download";
} }
publishProgress(data); publishProgress(data);
// DISPLAY_MASTER
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// DISPLAY_MASTER
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "DISPLAY_MASTER"); request.addProperty("Type", "DISPLAY_MASTER");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -334,36 +307,32 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
displayMasterGetterSetter =XMLHandlers.displayMasterXMLHandler(xpp, eventType); displayMasterGetterSetter = XMLHandlers.displayMasterXMLHandler(xpp, eventType);
if(displayMasterGetterSetter.getDISPLAY_ID().size()>0){ if (displayMasterGetterSetter.getDISPLAY_ID().size() > 0) {
String display_table = displayMasterGetterSetter.getTable_DISPLAY_MASTER(); String display_table = displayMasterGetterSetter.getTable_DISPLAY_MASTER();
if(display_table!=null){ if (display_table != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setDisplayMaster(display_table); TableBean.setDisplayMaster(display_table);
} }
}else{ } else {
return "DISPLAY_MASTER"; return "DISPLAY_MASTER";
} }
data.value = 60;
data.value = 20;
data.name = "DISPLAY_MASTER Data Download"; data.name = "DISPLAY_MASTER Data Download";
} }
publishProgress(data); publishProgress(data);
// MAPPING_STOCK
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// MAPPING_STOCK
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "MAPPING_STOCK"); request.addProperty("Type", "MAPPING_STOCK");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -373,36 +342,32 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
mappingStockGetterSetter =XMLHandlers.mappingStockXMLHandler(xpp, eventType); mappingStockGetterSetter = XMLHandlers.mappingStockXMLHandler(xpp, eventType);
if(mappingStockGetterSetter.getSKU_ID().size()>0){ if (mappingStockGetterSetter.getSKU_ID().size() > 0) {
String stocktable = mappingStockGetterSetter.getTable_MAPPING_STOCK(); String stocktable = mappingStockGetterSetter.getTable_MAPPING_STOCK();
if(stocktable!=null){ if (stocktable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingStock(stocktable); TableBean.setMappingStock(stocktable);
} }
}else{ } else {
return "MAPPING_STOCK"; return "MAPPING_STOCK";
} }
data.value = 80;
data.value = 20;
data.name = "MAPPING_STOCK Data Download"; data.name = "MAPPING_STOCK Data Download";
} }
publishProgress(data); publishProgress(data);
// MAPPING_T2P
request = new SoapObject(CommonString.NAMESPACE,
CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
// MAPPING_T2P
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId); request.addProperty("UserName", userId);
request.addProperty("Type", "MAPPING_T2P"); request.addProperty("Type", "MAPPING_T2P");
request.addProperty("cultureid", culture_id); request.addProperty("cultureid", culture_id);
@@ -412,84 +377,65 @@ public class DownloadActivity extends AppCompatActivity {
envelope.setOutputSoapObject(request); envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL); androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
androidHttpTransport.call(
CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse(); result = (Object) envelope.getResponse();
if(result.toString()!=null){ if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
mappingt2PGetterSetter =XMLHandlers.mappingT2pXMLHandler(xpp, eventType); mappingt2PGetterSetter = XMLHandlers.mappingT2pXMLHandler(xpp, eventType);
if(mappingt2PGetterSetter.getSTORE_ID().size()>0){ if (mappingt2PGetterSetter.getSTORE_ID().size() > 0) {
String t2ptable = mappingt2PGetterSetter.getTable_MAPPING_T2P(); String t2ptable = mappingt2PGetterSetter.getTable_MAPPING_T2P();
if(t2ptable!=null){ if (t2ptable != null) {
resultHttp = CommonString.KEY_SUCCESS; resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingT2p(t2ptable); TableBean.setMappingT2p(t2ptable);
} }
}else{ } else {
return "MAPPING_T2P"; return "MAPPING_T2P";
} }
data.value = 100;
data.value = 20;
data.name = "MAPPING_T2P Data Download"; data.name = "MAPPING_T2P Data Download";
} }
publishProgress(data); publishProgress(data);
db.open(); db.open();
db.InsertJCP(jcpgettersetter); db.InsertJCP(jcpgettersetter);
db.InsertCategory(categoryMasterGetterSetter);
db.InsertSubCategoryMaster(subCategoryMasterGetterSetter);
db.InsertBrandMaster(brandMasterGetterSetter);
db.InsertSkuMaster(skumastergettersetter);
db.InsertDisplayMaster(displayMasterGetterSetter);
db.InsertMAPPING_T2P(mappingt2PGetterSetter);
db.InsertMappingStock(mappingStockGetterSetter);
} catch (MalformedURLException e) {
}catch (MalformedURLException e) {
/*final AlertMessage message = new AlertMessage( /*final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this, CompleteDownloadActivity.this,
AlertMessage.MESSAGE_EXCEPTION, "download", e);*/ AlertMessage.MESSAGE_EXCEPTION, "download", e);*/
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
showAlert(CommonString.MESSAGE_EXCEPTION); showAlert(CommonString.MESSAGE_EXCEPTION);
} }
}); });
} catch (IOException e) { } catch (IOException e) {
/* final AlertMessage message = new AlertMessage( /* final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this, CompleteDownloadActivity.this,
AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket", e);*/ AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket", e);*/
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showAlert(CommonString.MESSAGE_SOCKETEXCEPTION); showAlert(CommonString.MESSAGE_SOCKETEXCEPTION);
} }
}); });
} } catch (Exception e) {
catch (Exception e) {
/* final AlertMessage message = new AlertMessage( /* final AlertMessage message = new AlertMessage(
CompleteDownloadActivity.this, CompleteDownloadActivity.this,
AlertMessage.MESSAGE_EXCEPTION, "download", e);*/ AlertMessage.MESSAGE_EXCEPTION, "download", e);*/
@@ -498,15 +444,12 @@ public class DownloadActivity extends AppCompatActivity {
e.printStackTrace(); e.printStackTrace();
e.getCause();*/ e.getCause();*/
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION); showAlert(CommonString.MESSAGE_EXCEPTION);
} }
}); });
} }
return ""; return "";
} }
@@ -517,7 +460,6 @@ public class DownloadActivity extends AppCompatActivity {
pb.setProgress(values[0].value); pb.setProgress(values[0].value);
percentage.setText(values[0].value + "%"); percentage.setText(values[0].value + "%");
message.setText(values[0].name); message.setText(values[0].name);
} }
@Override @Override
@@ -525,7 +467,6 @@ public class DownloadActivity extends AppCompatActivity {
super.onPostExecute(s); super.onPostExecute(s);
dialog.dismiss(); dialog.dismiss();
finish(); finish();
} }
@@ -0,0 +1,223 @@
package cpm.com.gskmtorange.gettersetter;
public class CoverageBean
{
protected int MID;
protected String process_id;
public String getGEO_TAG() {
return GEO_TAG;
}
public void setGEO_TAG(String GEO_TAG) {
this.GEO_TAG = GEO_TAG;
}
protected String GEO_TAG;
public String getProcess_id() {
return process_id;
}
public void setProcess_id(String process_id) {
this.process_id = process_id;
}
protected String storeId;
protected String storename;
public String getStorename() {
return storename;
}
public void setStorename(String storename) {
this.storename = storename;
}
protected String Remark;
public String getRemark() {
return Remark;
}
public void setRemark(String remark) {
Remark = remark;
}
protected String userId;
protected String app_version;
protected String image_allow;
public String getImage_allow() {
return image_allow;
}
public void setImage_allow(String image_allow) {
this.image_allow = image_allow;
}
public String getApp_version() {
return app_version;
}
public void setApp_version(String app_version) {
this.app_version = app_version;
}
protected String inTime;
protected String outTime;
protected String visitDate;
protected String keycontactId;
protected String isdDeploy;
protected String uploadStatus;
private String latitude;
private String longitude;
private String reasonid="";
private String sub_reasonId="";
public String getSub_reasonId() {
return sub_reasonId;
}
public void setSub_reasonId(String sub_reasonId) {
this.sub_reasonId = sub_reasonId;
}
private String reason="";
private String status="N";
private String image="";
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getMID() {
return MID;
}
public void setMID(int mID) {
MID = mID;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getInTime() {
return inTime;
}
public void setInTime(String inTime) {
this.inTime = inTime;
}
public String getOutTime() {
return outTime;
}
public void setOutTime(String outTime) {
this.outTime = outTime;
}
public String getVisitDate() {
return visitDate;
}
public void setVisitDate(String visitDate) {
this.visitDate = visitDate;
}
public String getKeycontactId() {
return keycontactId;
}
public void setKeycontactId(String keycontactId) {
this.keycontactId = keycontactId;
}
public String getIsdDeploy() {
return isdDeploy;
}
public void setIsdDeploy(String isdDeploy) {
this.isdDeploy = isdDeploy;
}
public String getUploadStatus() {
return uploadStatus;
}
public void setUploadStatus(String uploadStatus) {
this.uploadStatus = uploadStatus;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getReasonid() {
return reasonid;
}
public void setReasonid(String reasonid) {
this.reasonid = reasonid;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
@@ -0,0 +1,78 @@
package cpm.com.gskmtorange.gettersetter;
public class GeotaggingBeans {
public String storeid;
public String url1;
public String url2;
public String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String url3;
public double Latitude ;
public double Longitude;
public String getStoreid() {
return storeid;
}
public void setStoreid(String storeid) {
this.storeid = storeid;
}
public double getLatitude() {
return Latitude;
}
public void setLatitude(double d) {
Latitude = d;
}
public double getLongitude() {
return Longitude;
}
public void setLongitude(double d) {
Longitude = d;
}
public void setUrl1(String url1)
{
this.url1=url1;
}
public String getUrl1()
{
return url1;
}
public void setUrl2(String url2)
{
this.url2=url2;
}
public String getUrl2()
{
return url2;
}
public void setUrl3(String url3)
{
this.url3=url3;
}
public String getUrl3()
{
return url3;
}
}
@@ -0,0 +1,166 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryGetterSetter;
public class CategoryListActivity extends AppCompatActivity {
RecyclerView recyclerView;
ArrayList<CategoryGetterSetter> categoryList;
CategoryListAdapter adapter;
TextView txt_categoryName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_list);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
txt_categoryName.setText("Category List");
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
protected void onResume() {
super.onResume();
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>();
CategoryGetterSetter data = new CategoryGetterSetter();
data.setCategory_name("Oral Health");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new CategoryGetterSetter();
data.setCategory_name("Nutritionals");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new CategoryGetterSetter();
data.setCategory_name("Wellness");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
}
public class CategoryListAdapter extends RecyclerView.Adapter<CategoryListAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<CategoryGetterSetter> list = Collections.emptyList();
Context context;
public CategoryListAdapter(CategoryListActivity context, List<CategoryGetterSetter> list) {
inflator = LayoutInflater.from(context);
this.list = list;
this.context = context;
}
@Override
public CategoryListAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.category_menu_row, parent, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
final CategoryGetterSetter categoryData = list.get(position);
holder.categoryName.setText(categoryData.getCategory_name());
holder.categoryIcon.setImageResource(categoryData.getCategory_img());
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CategoryListActivity.this, CategoryWisePerformanceActivity.class);
intent.putExtra("categoryName", categoryData.getCategory_name());
startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView categoryName;
ImageView categoryIcon;
LinearLayout lay_menu;
public MyViewHolder(View itemView) {
super(itemView);
categoryName = (TextView) itemView.findViewById(R.id.categoryName);
categoryIcon = (ImageView) itemView.findViewById(R.id.categoryIcon);
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
@@ -0,0 +1,208 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
public class CategoryWisePerformanceActivity extends AppCompatActivity {
TextView txt_categoryName;
RecyclerView recyclerView;
String categoryName = "";
ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList;
CategoryWisePerformaceAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_wise_performance);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
categoryName = getIntent().getStringExtra("categoryName");
txt_categoryName.setText("CategoryWise Performance " + categoryName);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/* Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();*/
Intent intent = new Intent(CategoryWisePerformanceActivity.this, DailyDataMenuActivity.class);
intent.putExtra("categoryName", categoryName);
startActivity(intent);
}
});
}
@Override
protected void onResume() {
super.onResume();
categoryWisePerformanceList = new ArrayList<>();
CategoryWisePerformaceGetterSetter data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("Period");
data.setSos("SOS");
data.setT2p("T2P");
data.setPromo("Promo");
data.setMsl_availability("MSL Availability");
data.setOss("OSS");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("LTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("MTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("RTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("LTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("MTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
data = new CategoryWisePerformaceGetterSetter();
data.setPeriod("RTM");
data.setSos("75");
data.setT2p("0");
data.setPromo("0");
data.setMsl_availability("25");
data.setOss("55");
categoryWisePerformanceList.add(data);
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
}
public class CategoryWisePerformaceAdapter extends RecyclerView.Adapter<CategoryWisePerformaceAdapter.MyViewHolder> {
Context context;
private LayoutInflater inflator;
List<CategoryWisePerformaceGetterSetter> list = Collections.emptyList();
public CategoryWisePerformaceAdapter(Context context, List<CategoryWisePerformaceGetterSetter> list) {
inflator = LayoutInflater.from(context);
this.list = list;
this.context = context;
}
@Override
public CategoryWisePerformaceAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.item_category_wise_performance, parent, false);
CategoryWisePerformaceAdapter.MyViewHolder holder = new CategoryWisePerformaceAdapter.MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(CategoryWisePerformaceAdapter.MyViewHolder holder, int position) {
final CategoryWisePerformaceGetterSetter categoryData = list.get(position);
holder.txt_period.setText(categoryData.getPeriod());
holder.txt_sos.setText(categoryData.getSos());
holder.txt_t2p.setText(categoryData.getT2p());
holder.txt_promo.setText(categoryData.getPromo());
holder.txt_msl_availability.setText(categoryData.getMsl_availability());
holder.txt_oss.setText(categoryData.getOss());
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView txt_period, txt_sos, txt_t2p, txt_promo, txt_msl_availability, txt_oss;
LinearLayout lay_menu;
public MyViewHolder(View itemView) {
super(itemView);
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
txt_period = (TextView) itemView.findViewById(R.id.txt_period);
txt_sos = (TextView) itemView.findViewById(R.id.txt_sos);
txt_t2p = (TextView) itemView.findViewById(R.id.txt_t2p);
txt_promo = (TextView) itemView.findViewById(R.id.txt_promo);
txt_msl_availability = (TextView) itemView.findViewById(R.id.txt_msl_availability);
txt_oss = (TextView) itemView.findViewById(R.id.txt_oss);
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
@@ -0,0 +1,195 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.DailyDataMenuGetterSetter;
public class DailyDataMenuActivity extends AppCompatActivity {
RecyclerView recyclerView;
ArrayList<DailyDataMenuGetterSetter> categoryList;
DailyDataMenuAdapter adapter;
TextView txt_categoryName;
String categoryName = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_daily_data_menu);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
txt_categoryName = (TextView) findViewById(R.id.txt_categoryName);
categoryName = getIntent().getStringExtra("categoryName");
txt_categoryName.setText("Daily Data Menu - " + categoryName);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
protected void onResume() {
super.onResume();
categoryList = new ArrayList<>();
DailyDataMenuGetterSetter data = new DailyDataMenuGetterSetter();
data.setCategory_name("MSL Availability");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("Stock & Facing");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("T2P Compliance");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("Additional Visibility");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("Promo Compliance");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("Competition Visibility");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
data = new DailyDataMenuGetterSetter();
data.setCategory_name("Competition Promo");
data.setCategory_img(R.drawable.category);
categoryList.add(data);
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
}
public class DailyDataMenuAdapter extends RecyclerView.Adapter<DailyDataMenuAdapter.MyViewHolder> {
private LayoutInflater inflator;
List<DailyDataMenuGetterSetter> list = Collections.emptyList();
Context context;
public DailyDataMenuAdapter(Context context, List<DailyDataMenuGetterSetter> list) {
inflator = LayoutInflater.from(context);
this.list = list;
this.context = context;
}
@Override
public DailyDataMenuAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int i) {
View view = inflator.inflate(R.layout.daily_main_menu_row, parent, false);
DailyDataMenuAdapter.MyViewHolder holder = new DailyDataMenuAdapter.MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(DailyDataMenuAdapter.MyViewHolder holder, int position) {
final DailyDataMenuGetterSetter dailyData = list.get(position);
holder.categoryName.setText(dailyData.getCategory_name());
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
holder.lay_menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (dailyData.getCategory_name().equalsIgnoreCase("MSL Availability")) {
Intent intent = new Intent(DailyDataMenuActivity.this, MSL_AvailabilityActivity.class);
intent.putExtra("categoryName", dailyData.getCategory_name());
startActivity(intent);
} else if (dailyData.getCategory_name().equalsIgnoreCase("Stock & Facing")) {
Intent intent1 = new Intent(DailyDataMenuActivity.this, Stock_FacingActivity.class);
intent1.putExtra("categoryName", dailyData.getCategory_name());
startActivity(intent1);
}
}
});
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView categoryName;
ImageView categoryIcon;
LinearLayout lay_menu;
public MyViewHolder(View itemView) {
super(itemView);
categoryName = (TextView) itemView.findViewById(R.id.categoryName);
categoryIcon = (ImageView) itemView.findViewById(R.id.categoryIcon);
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
@@ -0,0 +1,360 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ToggleButton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
public class MSL_AvailabilityActivity extends AppCompatActivity {
ExpandableListView expandableListView;
TextView txt_mslAvailabilityName;
ArrayList<MSL_AvailabilityGetterSetter> headerDataList;
ArrayList<MSL_AvailabilityGetterSetter> childDataList;
List<MSL_AvailabilityGetterSetter> hashMapListHeaderData;
HashMap<MSL_AvailabilityGetterSetter, List<MSL_AvailabilityGetterSetter>> hashMapListChildData;
ExpandableListAdapter adapter;
String title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_msl__availability);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
txt_mslAvailabilityName = (TextView) findViewById(R.id.txt_mslAvailabilityName);
title = getIntent().getStringExtra("categoryName");
txt_mslAvailabilityName.setText(title);
prepareList();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
expandableListView.invalidateViews();
}
});
// Listview Group click listener
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
return false;
}
});
// Listview Group expanded listener
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
}
});
// Listview Group collasped listener
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
}
});
// Listview on child click listener
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
return false;
}
});
}
private void prepareList() {
headerDataList = new ArrayList<>();
MSL_AvailabilityGetterSetter msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 1");
msl.setMbq("1");
msl.setAvailable("No");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 2");
msl.setMbq("2");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 3");
msl.setMbq("3");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax header 4");
msl.setMbq("4");
msl.setAvailable("No");
headerDataList.add(msl);
hashMapListHeaderData = new ArrayList<>();
hashMapListChildData = new HashMap<>();
if (headerDataList.size() > 0) {
for (int i = 0; i < headerDataList.size(); i++) {
hashMapListHeaderData.add(headerDataList.get(i));
childDataList = new ArrayList<>();
MSL_AvailabilityGetterSetter msl1 = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax 1");
msl.setMbq("1");
msl.setAvailable("No");
childDataList.add(msl1);
msl1 = new MSL_AvailabilityGetterSetter();
msl.setBrandName("Parodontax 2");
msl.setMbq("2");
msl.setAvailable("No");
childDataList.add(msl1);
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
}
}
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
expandableListView.setAdapter(adapter);
}
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<MSL_AvailabilityGetterSetter> _listDataHeader;
private HashMap<MSL_AvailabilityGetterSetter, List<MSL_AvailabilityGetterSetter>> _listDataChild;
public ExpandableListAdapter(Context context, List<MSL_AvailabilityGetterSetter> listDataHeader,
HashMap<MSL_AvailabilityGetterSetter, List<MSL_AvailabilityGetterSetter>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
MSL_AvailabilityGetterSetter headerTitle = (MSL_AvailabilityGetterSetter) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_msl_availability_header, null, false);
}
TextView txt_categoryHeader = (TextView) convertView.findViewById(R.id.txt_categoryHeader);
RelativeLayout rel_header = (RelativeLayout) convertView.findViewById(R.id.rel_categoryHeader);
ImageView img_camera = (ImageView) convertView.findViewById(R.id.img_camera);
txt_categoryHeader.setTypeface(null, Typeface.BOLD);
txt_categoryHeader.setText(headerTitle.getBrandName());
/*img_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = new Date().toLocaleString().toString();
String TempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock" + headerTitle.getBrand_cd() + "_" + store_cd + "_" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImg_cam(img1);
img1 = "";
}
}
if (headerTitle.getImg_cam().equals("")) {
img_camera.setBackgroundResource(R.drawable.cam);
} else {
img_camera.setBackgroundResource(R.drawable.camtick);
}
if (!checkflag) {
if (checkHeaderArray.contains(groupPosition)) {
txt_header.setTextColor(getResources().getColor(R.color.red));
} else {
txt_header.setTextColor(getResources().getColor(R.color.grey_dark));
}
}*/
return convertView;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).size();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
MSL_AvailabilityGetterSetter childData = (MSL_AvailabilityGetterSetter) getChild(groupPosition, childPosition);
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_msl_availability_child, null, false);
holder = new ViewHolder();
holder.cardView = (CardView) convertView.findViewById(R.id.card_view);
holder.lin_category = (LinearLayout) convertView.findViewById(R.id.lin_category);
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
holder.ed_mbq = (EditText) convertView.findViewById(R.id.ed_mbq);
holder.toggle_available = (ToggleButton) convertView.findViewById(R.id.toggle_available);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_skuName.setText(childData.getBrandName());
holder.ed_mbq.setText(childData.getMbq());
holder.toggle_available.setTextOff("No");
holder.toggle_available.setTextOn("Yes");
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
public class ViewHolder {
EditText ed_mbq;
CardView cardView;
TextView txt_skuName;
ToggleButton toggle_available;
LinearLayout lin_category;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
@@ -0,0 +1,467 @@
package cpm.com.gskmtorange.gsk_dailyentry;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
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.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ToggleButton;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
public class Stock_FacingActivity extends AppCompatActivity {
ExpandableListView expandableListView;
TextView txt_stockFacingName;
ArrayList<Stock_FacingGetterSetter> headerDataList;
ArrayList<Stock_FacingGetterSetter> childDataList;
List<Stock_FacingGetterSetter> hashMapListHeaderData;
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> hashMapListChildData;
ExpandableListAdapter adapter;
String title;
String path = "", str = "", _pathforcheck = "", img1 = "";
static int child_position = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stock_facing);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
title = getIntent().getStringExtra("categoryName");
txt_stockFacingName.setText(title);
prepareList();
str = Environment.getExternalStorageState();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
expandableListView.invalidateViews();
}
});
// Listview Group click listener
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
return false;
}
});
// Listview Group expanded listener
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
}
});
// Listview Group collasped listener
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
getCurrentFocus().clearFocus();
}
}
});
// Listview on child click listener
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
return false;
}
});
}
private void prepareList() {
headerDataList = new ArrayList<>();
Stock_FacingGetterSetter msl = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax header 1");
msl.setMbq("1");
msl.setAvailable("No");
headerDataList.add(msl);
msl = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax header 2");
msl.setMbq("2");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax header 3");
msl.setMbq("3");
msl.setAvailable("Yes");
headerDataList.add(msl);
msl = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax header 4");
msl.setMbq("4");
msl.setAvailable("No");
headerDataList.add(msl);
hashMapListHeaderData = new ArrayList<>();
hashMapListChildData = new HashMap<>();
if (headerDataList.size() > 0) {
for (int i = 0; i < headerDataList.size(); i++) {
hashMapListHeaderData.add(headerDataList.get(i));
childDataList = new ArrayList<>();
Stock_FacingGetterSetter msl1 = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax 1");
msl.setMbq("1");
msl.setAvailable("No");
childDataList.add(msl1);
msl1 = new Stock_FacingGetterSetter();
msl.setBrandName("Parodontax 2");
msl.setMbq("2");
msl.setAvailable("No");
childDataList.add(msl1);
hashMapListChildData.put(hashMapListHeaderData.get(i), childDataList);
}
}
adapter = new ExpandableListAdapter(this, hashMapListHeaderData, hashMapListChildData);
expandableListView.setAdapter(adapter);
}
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<Stock_FacingGetterSetter> _listDataHeader;
private HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> _listDataChild;
public ExpandableListAdapter(Context context, List<Stock_FacingGetterSetter> listDataHeader,
HashMap<Stock_FacingGetterSetter, List<Stock_FacingGetterSetter>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
final Stock_FacingGetterSetter headerTitle = (Stock_FacingGetterSetter) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_header, null, false);
}
TextView txt_stockFaceupHeader = (TextView) convertView.findViewById(R.id.txt_stockFaceupHeader);
LinearLayout lin_stockFaceupHeader = (LinearLayout) convertView.findViewById(R.id.lin_stockFaceupHeader);
ImageView img_reference = (ImageView) convertView.findViewById(R.id.img_reference);
ImageView img_camera1 = (ImageView) convertView.findViewById(R.id.img_camera1);
ImageView img_camera2 = (ImageView) convertView.findViewById(R.id.img_camera2);
ImageView img_edit = (ImageView) convertView.findViewById(R.id.img_edit);
txt_stockFaceupHeader.setTypeface(null, Typeface.BOLD);
txt_stockFaceupHeader.setText(headerTitle.getBrandName());
img_camera1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = new Date().toLocaleString().toString();
String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock Camera1_" + tempDate + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
//headerTitle.setImg_cam(img1);
img1 = "";
}
}
/*if (headerTitle.getImg_cam().equals("")) {
img_camera1.setBackgroundResource(R.drawable.ic_menu_camera);
} else {
//img_camera1.setBackgroundResource(R.drawable.camtick);
}*/
/*img_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String date = new Date().toLocaleString().toString();
String TempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock" + headerTitle.getBrand_cd() + "_" + store_cd + "_" + visit_date.replace("/", "") + getCurrentTime().replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
startCameraActivity(groupPosition);
}
});
if (!img1.equalsIgnoreCase("")) {
if (groupPosition == child_position) {
headerTitle.setImg_cam(img1);
img1 = "";
}
}
if (headerTitle.getImg_cam().equals("")) {
img_camera.setBackgroundResource(R.drawable.cam);
} else {
img_camera.setBackgroundResource(R.drawable.camtick);
}
if (!checkflag) {
if (checkHeaderArray.contains(groupPosition)) {
txt_header.setTextColor(getResources().getColor(R.color.red));
} else {
txt_header.setTextColor(getResources().getColor(R.color.grey_dark));
}
}*/
return convertView;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).size();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
Stock_FacingGetterSetter childData = (Stock_FacingGetterSetter) getChild(groupPosition, childPosition);
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.item_stock_facing_child, null, false);
holder = new ViewHolder();
holder.cardView = (CardView) convertView.findViewById(R.id.card_view);
holder.lin_category = (LinearLayout) convertView.findViewById(R.id.lin_category);
holder.txt_skuName = (TextView) convertView.findViewById(R.id.txt_skuName);
holder.ed_stock = (EditText) convertView.findViewById(R.id.ed_stock);
holder.ed_facing = (EditText) convertView.findViewById(R.id.ed_facing);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_skuName.setText(childData.getBrandName());
holder.ed_stock.setText(childData.getMbq());
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
public class ViewHolder {
EditText ed_stock, ed_facing;
CardView cardView;
TextView txt_skuName;
LinearLayout lin_category;
}
private void startCameraActivity(int position) {
try {
Log.e("Stock & Facing ", "startCameraActivity()");
File file = new File(path);
Uri outputFileUri = Uri.fromFile(file);
/*String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
for (int n = 0; n < list.size(); n++) {
if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
// Log.d("TAG", "Installed Applications : " + list.get(n).loadLabel(packageManager).toString());
// Log.d("TAG", "package name : " + list.get(n).packageName);
if (list.get(n).loadLabel(packageManager).toString().equalsIgnoreCase("Camera")) {
defaultCameraPackage = list.get(n).packageName;
break;
}
}
}
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.setPackage(defaultCameraPackage);
startActivityForResult(intent, position);*/
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, position);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("Stock & Facing", "resultCode: " + resultCode);
switch (resultCode) {
case 0:
Log.e("Stock & Facing", "User cancelled");
break;
case -1:
if (_pathforcheck != null && !_pathforcheck.equals("")) {
if (new File(str + _pathforcheck).exists()) {
img1 = _pathforcheck;
//adapter.notifyDataSetChanged();
_pathforcheck = "";
}
}
break;
}
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
}
public String getCurrentTime() {
Calendar m_cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String cdate = formatter.format(m_cal.getTime());
/* String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":"
+ m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND);*/
return cdate;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
@@ -0,0 +1,112 @@
package cpm.com.gskmtorange.messgae;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import cpm.com.gskmtorange.GeoTag.GeoTagStoreList;
/**
* Created by ashishc on 03-01-2017.
*/
public class AlertMessage {
public static final String MESSAGE_ERROR = "Network Error , ";
public static final String MESSAGE_DATA_NOT = "Data Not Uploaded , ";
private Exception exception;
String value;
private String data, condition,exceptionString;
private Activity activity;
private String error;
public AlertMessage(Activity activity, String data, String condition,
Exception exception) {
this.activity = activity;
this.data = data;
this.condition = condition;
this.exception = exception;
}
public AlertMessage(Activity activity, String data, String condition,
String exception, String a) {
this.activity = activity;
this.data = data;
this.condition = condition;
this.exceptionString = exception;
this.error = a;
}
public void showMessage() {
if (condition.equals("success")) {
ShowAlert1(data);
}
else if(condition.equals("failure"))
{
ShowAlertSocket(data);
}
}
public void ShowAlert1(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(activity, GeoTagStoreList.class);
activity.startActivity(i);
activity.finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
public void ShowAlertSocket(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(activity, GeoTagStoreList.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,27 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 22-12-2016.
*/
public class CategoryGetterSetter {
String category_name;
int category_img = -1;
public String getCategory_name() {
return category_name;
}
public void setCategory_name(String category_name) {
this.category_name = category_name;
}
public int getCategory_img() {
return category_img;
}
public void setCategory_img(int category_img) {
this.category_img = category_img;
}
}
@@ -0,0 +1,57 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 23-12-2016.
*/
public class CategoryWisePerformaceGetterSetter {
String period, sos, t2p, promo, msl_availability, oss;
public String getPeriod() {
return period;
}
public void setPeriod(String period) {
this.period = period;
}
public String getSos() {
return sos;
}
public void setSos(String sos) {
this.sos = sos;
}
public String getT2p() {
return t2p;
}
public void setT2p(String t2p) {
this.t2p = t2p;
}
public String getPromo() {
return promo;
}
public void setPromo(String promo) {
this.promo = promo;
}
public String getMsl_availability() {
return msl_availability;
}
public void setMsl_availability(String msl_availability) {
this.msl_availability = msl_availability;
}
public String getOss() {
return oss;
}
public void setOss(String oss) {
this.oss = oss;
}
}
@@ -0,0 +1,27 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 22-12-2016.
*/
public class DailyDataMenuGetterSetter {
String category_name;
int category_img = -1;
public String getCategory_name() {
return category_name;
}
public void setCategory_name(String category_name) {
this.category_name = category_name;
}
public int getCategory_img() {
return category_img;
}
public void setCategory_img(int category_img) {
this.category_img = category_img;
}
}
@@ -0,0 +1,33 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 23-12-2016.
*/
public class MSL_AvailabilityGetterSetter {
String brandName, mbq, available;
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getMbq() {
return mbq;
}
public void setMbq(String mbq) {
this.mbq = mbq;
}
public String getAvailable() {
return available;
}
public void setAvailable(String available) {
this.available = available;
}
}
@@ -0,0 +1,51 @@
package cpm.com.gskmtorange.xmlGetterSetter;
import java.util.ArrayList;
/**
* Created by yadavendras on 28-12-2016.
*/
public class SkuGetterSetter {
String SKU_ID, SKU, BRAND_ID, MRP, SKU_SEQUENCE;
public String getSKU_ID() {
return SKU_ID;
}
public void setSKU_ID(String SKU_ID) {
this.SKU_ID = SKU_ID;
}
public String getSKU() {
return SKU;
}
public void setSKU(String SKU) {
this.SKU = SKU;
}
public String getBRAND_ID() {
return BRAND_ID;
}
public void setBRAND_ID(String BRAND_ID) {
this.BRAND_ID = BRAND_ID;
}
public String getMRP() {
return MRP;
}
public void setMRP(String MRP) {
this.MRP = MRP;
}
public String getSKU_SEQUENCE() {
return SKU_SEQUENCE;
}
public void setSKU_SEQUENCE(String SKU_SEQUENCE) {
this.SKU_SEQUENCE = SKU_SEQUENCE;
}
}
@@ -0,0 +1,33 @@
package cpm.com.gskmtorange.xmlGetterSetter;
/**
* Created by gagang on 23-12-2016.
*/
public class Stock_FacingGetterSetter {
String brandName, mbq, available;
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getMbq() {
return mbq;
}
public void setMbq(String mbq) {
this.mbq = mbq;
}
public String getAvailable() {
return available;
}
public void setAvailable(String available) {
this.available = available;
}
}
@@ -0,0 +1,53 @@
package cpm.com.gskmtorange.xmlHandlers;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import cpm.com.gskmtorange.xmlGetterSetter.FailureGetterSetter;
public class FailureXMLHandler extends DefaultHandler{
private String elementValue;
private FailureGetterSetter failureGetterSetter = null;
public FailureGetterSetter getFailureGetterSetter()
{
return failureGetterSetter;
}
@Override
public void startDocument() throws SAXException {
// TODO Auto-generated method stub
super.startDocument();
failureGetterSetter = new FailureGetterSetter();
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
// TODO Auto-generated method stub
super.characters(ch, start, length);
elementValue = new String(ch, start, length);
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// TODO Auto-generated method stub
super.endElement(uri, localName, qName);
if(qName.equals("STATUS"))
{
failureGetterSetter.setStatus(elementValue);
}
else if(qName.equals("ERRORMSG"))
{
failureGetterSetter.setErrorMsg(elementValue);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_category_list" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_category_wise_performance" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_daily_main_menu" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context="cpm.com.gskmtorange.geotag.GeoTagActivity"> tools:context="cpm.com.gskmtorange.GeoTag.GeoTagActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_msl__availability" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_stock_facing" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@color/colorPrimary"
app:srcCompat="@drawable/save_icon" />
</android.support.design.widget.CoordinatorLayout>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="cpm.com.gskmtorange.dailyentry.StoreimageActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/contentstoreimage" />
</android.support.design.widget.CoordinatorLayout>
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
card_view:cardBackgroundColor="@android:color/white"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:id="@+id/lay_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:weightSum="2">
<!--android:weightSum="10"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/categoryIcon"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/category" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:id="@+id/categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#FFF"
android:ellipsize="end"
android:gravity="center"
android:padding="10dp"
android:text="Category List"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="#f2711f"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_category_list">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/txt_categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Category Performance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp" />
</LinearLayout>
</RelativeLayout>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_category_wise_performance"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_category_wise_performance">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/txt_categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Category Performance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp" />
</LinearLayout>
</RelativeLayout>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_daily_main_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_daily_data_menu">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Category Performance"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp" />
</LinearLayout>
</RelativeLayout>
@@ -11,7 +11,7 @@
android:paddingRight="@dimen/custom_margin" android:paddingRight="@dimen/custom_margin"
android:paddingTop="@dimen/custom_margin" android:paddingTop="@dimen/custom_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="cpm.com.gskmtorange.geotag.GeoTagActivity" tools:context="cpm.com.gskmtorange.GeoTag.GeoTagActivity"
tools:showIn="@layout/activity_geo_tag"> tools:showIn="@layout/activity_geo_tag">
</fragment> </fragment>
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_msl__availability"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_msl__availability">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/txt_mslAvailabilityName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Must Have Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
<LinearLayout
android:id="@+id/lin_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SKU"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="MBQ"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Available"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
</LinearLayout>
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:divider="@null"
android:dividerHeight="0dp"
android:scrollingCache="false" />
</LinearLayout>
</RelativeLayout>
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_msl__availability"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_msl__availability">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/txt_stockFacingName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF1710F"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Stock Facing"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black" />
<LinearLayout
android:id="@+id/lin_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SKU"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Stock"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Faceup"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
</LinearLayout>
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:divider="@null"
android:dividerHeight="0dp"
android:scrollingCache="false" />
</LinearLayout>
</RelativeLayout>
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="cpm.com.gskmtorange.dailyentry.StoreimageActivity"
tools:showIn="@layout/activity_storeimage"
android:weightSum="10"
android:orientation="vertical"
android:background="@color/grey_background">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Store Front Image"
android:textSize="@dimen/store_entry_text_size"
android:layout_centerInParent="true"
android:textColor="@color/white"
android:textStyle="bold"/>
</RelativeLayout>
<!-- <RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="10dp"
>
<ImageView
android:id="@+id/imgloreal"
android:layout_width="200dp"
android:layout_height="100dp"
android:src="@drawable/loreal"
android:layout_centerInParent="true"
/>
</RelativeLayout>-->
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="5dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rel_selfie"
>
<ImageView
android:id="@+id/img_selfie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
/>
<ImageView
android:id="@+id/img_cam_selfie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/camera_icon_done"
android:layout_centerInParent="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/btn_save_selfie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:text="@string/save"
android:textSize="@dimen/store_entry_text_size"
android:layout_centerInParent="true"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_marginTop="20dp"/>
</LinearLayout>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/progressBar1"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar1"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true" />
</RelativeLayout>
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
card_view:cardBackgroundColor="@android:color/white"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:id="@+id/lay_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:weightSum="2">
<!--android:weightSum="10"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/categoryIcon"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/category" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:id="@+id/categoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#FFF"
android:ellipsize="end"
android:gravity="center"
android:padding="10dp"
android:text="Category List"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="#f2711f"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical"
android:padding="10sp" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Store Visited"
android:textColor="@color/black"
android:textSize="25sp" />
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/white" />
<RadioGroup
android:id="@+id/radiogrpvisit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioButton
android:id="@+id/yes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Yes"
android:textColor="#000000"
android:background="@color/colorPrimary"/>
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="@color/white" />
<RadioButton
android:id="@+id/no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="No"
android:textColor="#000000"
android:background="@color/colorPrimary"/>
</RadioGroup>
</LinearLayout>
@@ -4,7 +4,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
@@ -25,6 +25,7 @@
<RelativeLayout <RelativeLayout
android:id="@+id/relativelayout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginBottom="1sp" android:layout_marginBottom="1sp"
@@ -58,7 +59,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@+id/geolistviewxml_storeico" android:layout_alignBottom="@+id/geolistviewxml_storeico"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:background="@mipmap/geopin" /> android:background="@mipmap/geopin"
android:visibility="gone"/>
</RelativeLayout> </RelativeLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/lay_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="30">
<!--android:background="#F1E9E9"-->
<TextView
android:id="@+id/txt_period"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Period"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_sos"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SOS"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_t2p"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="T2P"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_promo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Promo"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_msl_availability"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="MSL Availability"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#f2711f" />
<TextView
android:id="@+id/txt_oss"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="OSS"
android:textColor="#000"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#888" />
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="10dp">
<LinearLayout
android:id="@+id/lin_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SKU"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<TextView
android:id="@+id/txt_skuName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:text="SKU Name Value "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="MBQ"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<EditText
android:id="@+id/ed_mbq"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:inputType="number"
android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222"
android:textColorHint="#666" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Available"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<ToggleButton
android:id="@+id/toggle_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/grey_background"
card_view:cardCornerRadius="10dp">
<RelativeLayout
android:id="@+id/rel_categoryHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txt_categoryHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="25dp"
android:text="Brand Name "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
<ImageView
android:id="@+id/img_camera"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="30dp"
android:src="@drawable/ic_menu_camera"
android:visibility="invisible" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="10dp">
<LinearLayout
android:id="@+id/lin_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="SKU"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<TextView
android:id="@+id/txt_skuName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:text="SKU Name Value "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Stock"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<EditText
android:id="@+id/ed_stock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:inputType="number"
android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222"
android:textColorHint="#666" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.25"
android:orientation="vertical">
<!--<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Faceup"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />-->
<EditText
android:id="@+id/ed_facing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:inputType="number"
android:maxLength="7"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222"
android:textColorHint="#666" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/grey_background"
card_view:cardCornerRadius="10dp">
<LinearLayout
android:id="@+id/lin_stockFaceupHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="10dp">
<TextView
android:id="@+id/txt_stockFaceupHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingRight="5dp"
android:text="Brand Name "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#222" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_reference"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:src="@android:drawable/btn_star_big_off" />
<ImageView
android:id="@+id/img_camera1"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_menu_camera" />
<ImageView
android:id="@+id/img_camera2"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_menu_camera" />
<ImageView
android:id="@+id/img_edit"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginRight="20dp"
android:src="@android:drawable/ic_menu_edit" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
+39 -2
View File
@@ -62,7 +62,7 @@
> >
<ListView <!-- <ListView
android:id="@+id/list_id" android:id="@+id/list_id"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -72,7 +72,44 @@
android:dividerHeight="2dp" android:dividerHeight="2dp"
android:drawSelectorOnTop="false" android:drawSelectorOnTop="false"
android:fastScrollEnabled="true" android:fastScrollEnabled="true"
android:smoothScrollbar="true" /> android:smoothScrollbar="true" />-->
<android.support.v7.widget.RecyclerView
android:id="@+id/drawer_layout_recycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
>
</android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:layout_weight="100"
android:visibility="gone"
>
<View
android:id="@+id/viewid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/sad_cloud"
>
</View>
</LinearLayout> </LinearLayout>
@@ -7,6 +7,10 @@
android:orientation="vertical" android:orientation="vertical"
android:weightSum="100"> android:weightSum="100">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -60,7 +64,7 @@
> >
<ListView <!-- <ListView
android:id="@+id/list_id" android:id="@+id/list_id"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -70,7 +74,21 @@
android:dividerHeight="2dp" android:dividerHeight="2dp"
android:drawSelectorOnTop="false" android:drawSelectorOnTop="false"
android:fastScrollEnabled="true" android:fastScrollEnabled="true"
android:smoothScrollbar="true" /> android:smoothScrollbar="true" />-->
<android.support.v7.widget.RecyclerView
android:id="@+id/drawer_layout_recycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
>
</android.support.v7.widget.RecyclerView>
</LinearLayout> </LinearLayout>
@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
@@ -35,7 +35,8 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginRight="6sp" android:layout_marginRight="6sp"
android:background="@mipmap/store" android:background="@mipmap/store"
android:paddingTop="5sp" /> android:layout_marginTop="10dp"
android:paddingTop="25sp" />
<TextView <TextView
android:id="@+id/storelistviewxml_storename" android:id="@+id/storelistviewxml_storename"
@@ -67,6 +68,18 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:focusable="false" android:focusable="false"
android:visibility="invisible" /> android:visibility="invisible" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignBottom="@+id/storelistviewxml_storeico"
android:layout_alignParentRight="true"
android:background="@mipmap/tick_c"
android:visibility="gone"
/>
</RelativeLayout> </RelativeLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</RelativeLayout> </RelativeLayout>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -21,4 +21,8 @@
<string name="menu_setting">ضبط</string> <string name="menu_setting">ضبط</string>
<string name="menu_services">خدمات</string> <string name="menu_services">خدمات</string>
</resources> </resources>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
@@ -20,4 +20,13 @@
<string name="menu_setting">Ayarlar</string> <string name="menu_setting">Ayarlar</string>
<string name="menu_services">Hizmetler</string> <string name="menu_services">Hizmetler</string>
//changes after
<string name="title_geo_tag_activity_upload_data">Store Uploaded</string>
<string name="title_geo_tag_activity_geo_data">Store Geo Data Uploaded</string>
<string name="title_geo_tag_activity_geo_already_done">Store Already Geotagged</string>
</resources> </resources>
+1 -1
View File
@@ -11,5 +11,5 @@
<dimen name="text_size_normal">20sp</dimen> <dimen name="text_size_normal">20sp</dimen>
<dimen name="text_size_small">16sp</dimen> <dimen name="text_size_small">16sp</dimen>
<dimen name="store_entry_text_size">20sp</dimen>
</resources> </resources>
@@ -39,4 +39,29 @@
<string name="menu_setting">Setting</string> <string name="menu_setting">Setting</string>
<string name="menu_services">Services</string> <string name="menu_services">Services</string>
<string name="title_activity_category_list">Category List</string>
<string name="title_activity_category_wise_performance">CategoryWise Performance</string>
<string name="title_activity_daily_main_menu">DailyMainMenuActivity</string>
<string name="title_activity_msl__availability">MSL_AvailabilityActivity</string>
<string name="title_geo_tag_activity_upload_data">Store Uploaded</string>
<string name="title_geo_tag_activity_geo_data">Store Geo Data Uploaded</string>
<string name="title_geo_tag_activity_geo_already_done">Store Already Geotagged</string>
<string name="title_store_list_activity_store_already_done">Store Already Uploaded</string>
<string name="title_store_list_activity_store_data_uploaded">Store Data Uploaded</string>
<string name="title_store_list_activity_store_already_checkout">Store Already Checkout</string>
<string name="title_store_list_activity_store_again_uploaded">Please Store data again Uploaded</string>
<string name="title_store_list_activity_store_closed">Store Closed</string>
<string name="save">SAVE</string>
<string name="title_store_list_checkout_current">Please checkout from current store</string>
<string name="title_store_list_checkout_Already_filled">Data already filled</string>
</resources> </resources>
@@ -17,4 +17,7 @@
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources> </resources>