sa_full_image

This commit is contained in:
CPM
2021-03-24 15:56:23 +05:30
parent 9d6cc81cb0
commit 7ae36ff834
62 changed files with 461 additions and 526 deletions
Binary file not shown.
+5
View File
@@ -26,5 +26,10 @@
<option name="name" value="Google" /> <option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" /> <option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component> </component>
</project> </project>
+18 -10
View File
@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.crashlytics'
android { android {
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion '29.0.3' buildToolsVersion '29.0.3'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
@@ -21,7 +21,7 @@ android {
defaultConfig { defaultConfig {
applicationId "cpm.com.gskmtorange" applicationId "cpm.com.gskmtorange"
minSdkVersion 20 minSdkVersion 20
targetSdkVersion 29 targetSdkVersion 30
/*//For Egypt /*//For Egypt
versionCode 31 versionCode 31
@@ -32,8 +32,8 @@ android {
versionName "4.0"*/ versionName "4.0"*/
//For Turkey //For Turkey
versionCode 26 /* versionCode 26
versionName "3.8" versionName "3.8"*/
//For KSA //For KSA
/* versionCode 28 /* versionCode 28
@@ -43,11 +43,11 @@ android {
versionName "3.8"*/ versionName "3.8"*/
//For SA //For SA
/* versionCode 28 /* versionCode 28
versionName "3.9"*/ versionName "3.9"*/
//sa //sa
/* versionCode 22 versionCode 23
versionName "3.4"*/ versionName "3.5"
//Kenya //Kenya
/* versionCode 2 /* versionCode 2
@@ -79,25 +79,33 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-auth:20.0.3'
testImplementation 'junit:junit:4.13.1' testImplementation 'junit:junit:4.13.1'
implementation 'android.arch.navigation:navigation-fragment:1.0.0' implementation 'android.arch.navigation:navigation-fragment:1.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics' implementation platform('com.google.firebase:firebase-bom:26.7.0')
// implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ndk' implementation 'com.google.firebase:firebase-crashlytics-ndk'
implementation 'com.google.firebase:firebase-messaging' implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.android.gms:play-services-location:17.1.0' implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0' implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.kyanogen.signatureview:signature-view:1.0' implementation 'com.kyanogen.signatureview:signature-view:1.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar') implementation files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar')
implementation 'com.squareup.retrofit2:retrofit:2.0.2' implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1' implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2' implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.google.firebase:firebase-appindexing:19.1.0' implementation 'com.google.android.gms:play-services-appindexing:8.3.0'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
// Recommended: Add the Google Analytics SDK.
implementation 'com.google.firebase:firebase-analytics:18.0.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
+7 -7
View File
@@ -1,33 +1,33 @@
{ {
"project_info": { "project_info": {
"project_number": "28956372652", "project_number": "310038602345",
"project_id": "orangenew-48962", "project_id": "gskorangev2",
"storage_bucket": "orangenew-48962.appspot.com" "storage_bucket": "gskorangev2.appspot.com"
}, },
"client": [ "client": [
{ {
"client_info": { "client_info": {
"mobilesdk_app_id": "1:28956372652:android:a70b27bfa2543c229f7909", "mobilesdk_app_id": "1:310038602345:android:dab7010946bd056dd1f8f8",
"android_client_info": { "android_client_info": {
"package_name": "cpm.com.gskmtorange" "package_name": "cpm.com.gskmtorange"
} }
}, },
"oauth_client": [ "oauth_client": [
{ {
"client_id": "28956372652-fgiv0dvng874u5g11u1sv498ok02qsmf.apps.googleusercontent.com", "client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
} }
], ],
"api_key": [ "api_key": [
{ {
"current_key": "AIzaSyCcvobTX6bSIU9eSaQPuyYqFS5Q4Y-FDX4" "current_key": "AIzaSyDg2pgsaB0sWKD9pAF7mb9DSk8ec5rX7uI"
} }
], ],
"services": { "services": {
"appinvite_service": { "appinvite_service": {
"other_platform_oauth_client": [ "other_platform_oauth_client": [
{ {
"client_id": "28956372652-fgiv0dvng874u5g11u1sv498ok02qsmf.apps.googleusercontent.com", "client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
} }
] ]
+1
View File
@@ -20,6 +20,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
@@ -96,7 +96,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
*/ */
public class GSKOrangeDB extends SQLiteOpenHelper { public class GSKOrangeDB extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "GSK_ORANGE_DB614"; public static final String DATABASE_NAME = "GSK_ORANGE_DB616";
public static final int DATABASE_VERSION = 15; public static final int DATABASE_VERSION = 15;
TableBean tableBean; TableBean tableBean;
private SQLiteDatabase db; private SQLiteDatabase db;
@@ -54,7 +54,7 @@ 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 com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.appindexing.Action;
import org.ksoap2.SoapEnvelope; import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapObject;
@@ -92,7 +92,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
private Context context;
String result, errormsg = ""; String result, errormsg = "";
private ProgressBar pb; private ProgressBar pb;
private GoogleMap mMap; private GoogleMap mMap;
@@ -143,7 +143,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
//storeid = preferences.getString(CommonString.KEY_STORE_ID, null); //storeid = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -161,7 +161,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
db = new GSKOrangeDB(GeoTagActivity.this); db = new GSKOrangeDB(GeoTagActivity.this);
db.open(); db.open();
context = this;
//storeid = getIntent().getStringExtra("Storeid"); //storeid = getIntent().getStringExtra("Storeid");
str = CommonString.FILE_PATH; str = CommonString.FILE_PATH;
@@ -279,7 +279,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
} }
}*/ }*/
_pathforcheck = storeid + "GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = storeid + "GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -301,7 +301,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG) , Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
@@ -427,7 +427,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_store_geotag)); toolbar.setTitle(getResources().getString(R.string.title_activity_store_geotag));
/* checkPlayServices(); /* checkPlayServices();
@@ -520,7 +520,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -591,7 +591,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
if (new File(str + _pathforcheck).exists()) { if (new File(str + _pathforcheck).exists()) {
fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.mipmap.camera_green)); fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_green));
//fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC"))); //fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC")));
@@ -990,7 +990,6 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
//Toast.makeText(getApplicationContext(),"GeoTag Uploaded ",Toast.LENGTH_LONG).show();
String Statustag = "U"; String Statustag = "U";
db.open(); db.open();
@@ -1032,7 +1031,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GeoTagActivity.this.finish(); GeoTagActivity.this.finish();
Toast.makeText(getApplicationContext(),getResources().getString(R.string.success),Toast.LENGTH_LONG).show(); Toast.makeText(context,getResources().getString(R.string.success),Toast.LENGTH_LONG).show();
} }
else if(!result.equals(CommonString.KEY_SUCCESS)) else if(!result.equals(CommonString.KEY_SUCCESS))
@@ -1042,7 +1041,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, getResources().getString(R.string.failure), null); + result, getResources().getString(R.string.failure), null);
message.showMessage();*/ message.showMessage();*/
Toast.makeText(getApplicationContext(),getResources().getString(R.string.failure),Toast.LENGTH_LONG).show(); Toast.makeText(context,getResources().getString(R.string.failure),Toast.LENGTH_LONG).show();
Intent intent = new Intent( Intent intent = new Intent(
GeoTagActivity.this, GeoTagActivity.this,
StoreimageActivity.class); StoreimageActivity.class);
@@ -55,6 +55,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
FloatingActionButton fab; FloatingActionButton fab;
Toolbar toolbar; Toolbar toolbar;
private Context context;
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);
@@ -66,7 +67,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
// 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);
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
context = this;
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@@ -75,7 +76,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, ""); visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
@@ -86,7 +87,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent in = new Intent(getApplicationContext(), DownloadActivity.class); Intent in = new Intent(context, DownloadActivity.class);
startActivity(in); startActivity(in);
finish(); finish();
@@ -96,7 +97,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN); storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
if (storelist.size() > 0) { if (storelist.size() > 0) {
adapter = new ValueAdapter(getApplicationContext(), storelist); adapter = new ValueAdapter(context, storelist);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -257,7 +258,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_store_geotag)); toolbar.setTitle(getString(R.string.title_activity_store_geotag));
} }
@@ -55,6 +55,7 @@ import com.google.android.gms.maps.model.LatLng;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@@ -162,16 +163,9 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
context = this; context = this;
// Obtain the FirebaseAnalytics instance.
// mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
// Fabric.with(this, new Crashlytics());
TextView tv_version = (TextView) findViewById(R.id.tv_version_code); TextView tv_version = (TextView) findViewById(R.id.tv_version_code);
try { try {
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName); app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
// login_version.setText("Parinaam Version " + app_ver); // login_version.setText("Parinaam Version " + app_ver);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@@ -222,9 +216,8 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
/* museridView.setText("testmer"); /* museridView.setText("testmer");
mPasswordView.setText("cpm123");*/ mPasswordView.setText("cpm123");*/
//sa //sa
/* museridView.setText("testsa"); /* museridView.setText("testsa");
mPasswordView.setText("cpm123"); mPasswordView.setText("cpm123");*/
*/
//Kenya //Kenya
// museridView.setText("test.Kenya"); // museridView.setText("test.Kenya");
@@ -254,9 +247,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
FirebaseCrashlytics.getInstance().recordException(e);
} }
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
museridSignInButton = (Button) findViewById(R.id.user_login_button); museridSignInButton = (Button) findViewById(R.id.user_login_button);
museridSignInButton.setOnClickListener(new OnClickListener() { museridSignInButton.setOnClickListener(new OnClickListener() {
@Override @Override
@@ -521,12 +516,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
try { try {
versionCode = getPackageManager().getPackageInfo( versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
getPackageName(), 0).versionCode;
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]" String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
+ userid + "[/USER_ID]" + "[PASSWORD]" + password + userid + "[/USER_ID]" + "[PASSWORD]" + password
+ "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()) + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context)
+ "[/IN_TIME]" + "[LATITUDE]" + lat + "[/IN_TIME]" + "[LATITUDE]" + lat
+ "[/LATITUDE]" + "[LONGITUDE]" + lon + "[/LATITUDE]" + "[LONGITUDE]" + lon
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver + "[/LONGITUDE]" + "[APP_VERSION]" + app_ver
@@ -635,15 +629,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
editor.putString(CommonString.KEY_USERNAME, userid); editor.putString(CommonString.KEY_USERNAME, userid);
editor.putString(CommonString.KEY_PASSWORD, password); editor.putString(CommonString.KEY_PASSWORD, password);
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION()); editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH()); editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE()); editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
//editor.putString(CommonString.KEY_DATE, "01/25/2019"); //editor.putString(CommonString.KEY_DATE, "01/25/2019");
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID()); editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
editor.commit(); editor.commit();
setDataFromSharedPreferences(lgs); setDataFromSharedPreferences(lgs);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@@ -651,23 +641,16 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data"); bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data");
bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, "")); bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
// mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
FirebaseCrashlytics.getInstance().setUserId(userid.toLowerCase());
// Crashlytics.setUserIdentifier(userid);
return CommonString.KEY_SUCCESS; return CommonString.KEY_SUCCESS;
} }
} }
return ""; return "";
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
FirebaseCrashlytics.getInstance().recordException(e);
/* final AlertMessage message = new AlertMessage(
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
"acra_login", e);*/
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
@@ -678,6 +661,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
}); });
} catch (IOException e) { } catch (IOException e) {
FirebaseCrashlytics.getInstance().recordException(e);
/* final AlertMessage message = new AlertMessage( /* final AlertMessage message = new AlertMessage(
LoginActivity.this, LoginActivity.this,
AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket_login", e);*/ AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket_login", e);*/
@@ -697,6 +681,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
} }
}); });
} catch (Exception e) { } catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(e);
/* final AlertMessage message = new AlertMessage( /* final AlertMessage message = new AlertMessage(
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION, LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
"acra_login", e);*/ "acra_login", e);*/
@@ -704,7 +689,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
// Crashlytics.logException(e.getCause()); // Crashlytics.logException(e.getCause());
// Crashlytics.logException(new Exception("My custom login Exception")); // Crashlytics.logException(new Exception("My custom login Exception"));
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION); showAlert(CommonString.MESSAGE_EXCEPTION);
@@ -717,9 +701,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
@Override @Override
protected void onPostExecute(String result) { protected void onPostExecute(String result) {
super.onPostExecute(result); super.onPostExecute(result);
//Stop performance trace //Stop performance trace
/// myTrace.stop(); /// myTrace.stop();
@@ -742,10 +724,10 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setLanguageDataFromSharedPreferences(); setLanguageDataFromSharedPreferences();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
Intent in = new Intent(getApplicationContext(), MPinActivity.class); Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false); in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in); startActivity(in);
finish(); finish();
@@ -770,7 +752,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setLanguageDataFromSharedPreferences(); setLanguageDataFromSharedPreferences();
Intent in = new Intent(getApplicationContext(), MPinActivity.class); Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false); in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in); startActivity(in);
finish(); finish();
@@ -932,10 +914,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
private void setDataFromSharedPreferences(LoginGetterSetter lgs) { private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
Gson gson = new Gson(); Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs); String jsonCurProduct = gson.toJson(lgs);
//SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct); editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit(); editor.commit();
} }
@@ -987,13 +966,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
file_planogram.mkdir(); file_planogram.mkdir();
} }
/* if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}*/
if (checkPlayServices()) { if (checkPlayServices()) {
// Building the GoogleApi client // Building the GoogleApi client
buildGoogleApiClient(); buildGoogleApiClient();
@@ -1100,8 +1072,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted), Toast.LENGTH_LONG)
, Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
} }
@@ -58,11 +58,10 @@ import cpm.com.gskmtorange.pharma_stores.PharmaActivityFragment;
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity; import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
import cpm.com.gskmtorange.upload.UploadActivity; import cpm.com.gskmtorange.upload.UploadActivity;
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
//import io.fabric.sdk.android.Fabric;
public class MainActivity extends AppCompatActivity public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener { implements NavigationView.OnNavigationItemSelectedListener {
private Context context;
WebView webView; WebView webView;
ImageView imageView; ImageView imageView;
String date, visit_status; String date, visit_status;
@@ -92,13 +91,9 @@ public class MainActivity extends AppCompatActivity
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
context = this;
// Crashlytics.setBool(CommonString.KEY_LOGIN_DONE, true); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
// Crashlytics.setString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Fabric.with(this, new Crashlytics());
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
imageView = (ImageView) findViewById(R.id.img_main); imageView = (ImageView) findViewById(R.id.img_main);
@@ -109,9 +104,6 @@ public class MainActivity extends AppCompatActivity
user_name = preferences.getString(CommonString.KEY_USERNAME, null); user_name = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null); country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
// Crashlytics.setString(CommonString.KEY_USER_ID, user_name);
//user_type = preferences.getString(CommonString.KEY_USER_TYPE, null);
db = new GSKOrangeDB(MainActivity.this); db = new GSKOrangeDB(MainActivity.this);
webView.setWebViewClient(new MyWebViewClient()); webView.setWebViewClient(new MyWebViewClient());
@@ -124,15 +116,6 @@ public class MainActivity extends AppCompatActivity
} }
/* 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();
}
});
*/
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
@@ -153,7 +136,7 @@ public class MainActivity extends AppCompatActivity
img_change_password.setOnClickListener(new View.OnClickListener() { img_change_password.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent in = new Intent(getApplicationContext(), ChangePasswordActivity.class); Intent in = new Intent(context, ChangePasswordActivity.class);
startActivity(in); startActivity(in);
} }
}); });
@@ -170,7 +153,7 @@ public class MainActivity extends AppCompatActivity
super.onResume(); super.onResume();
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.main_menu_activity_name)); toolbar.setTitle(getString(R.string.main_menu_activity_name));
db.open(); db.open();
@@ -340,7 +323,6 @@ public class MainActivity extends AppCompatActivity
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT) Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
.setAction("Action", null).show(); .setAction("Action", null).show();
// Toast.makeText(getApplicationContext(), "No Network Available", Toast.LENGTH_SHORT).show();
} }
} }
}) })
@@ -828,7 +810,7 @@ public class MainActivity extends AppCompatActivity
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { .setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
Intent in = new Intent(getApplicationContext(), PreviousDataUploadActivity.class); Intent in = new Intent(context, PreviousDataUploadActivity.class);
startActivity(in); startActivity(in);
//finish(); //finish();
} }
@@ -837,7 +819,7 @@ public class MainActivity extends AppCompatActivity
alert.show(); alert.show();
} else { } else {
Intent in = new Intent(getApplicationContext(), DownloadActivity.class); Intent in = new Intent(context, DownloadActivity.class);
startActivity(in); startActivity(in);
} }
} else { } else {
@@ -29,7 +29,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener { public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
Button btn_lang_1, btn_lang_2; Button btn_lang_1, btn_lang_2;
private Context context;
private SharedPreferences preferences = null; private SharedPreferences preferences = null;
private SharedPreferences.Editor editor = null; private SharedPreferences.Editor editor = null;
@@ -44,7 +44,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
setContentView(R.layout.activity_select_language); setContentView(R.layout.activity_select_language);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit(); editor = preferences.edit();
@@ -81,7 +81,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
startActivity(intent); startActivity(intent);
finish();*/ finish();*/
Intent in = new Intent(getApplicationContext(), MPinActivity.class); Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false); in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in); startActivity(in);
finish(); finish();
@@ -101,7 +101,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
switch (id) { switch (id) {
case R.id.btn_language_one: case R.id.btn_language_one:
selected_flag = true; selected_flag = true;
CommonFunctions.updateLangResources(getApplicationContext(), language.get(0)); CommonFunctions.updateLangResources(context, language.get(0));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background)); btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
editor.putString(CommonString.KEY_LANGUAGE, language.get(0)); editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
@@ -115,7 +115,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
selected_flag = true; selected_flag = true;
CommonFunctions.updateLangResources(getApplicationContext(), language.get(1)); CommonFunctions.updateLangResources(context, language.get(1));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background)); btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
@@ -133,8 +133,6 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
private void setDataFromSharedPreferences(LoginGetterSetter lgs) { private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
Gson gson = new Gson(); Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs); String jsonCurProduct = gson.toJson(lgs);
//SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct); editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
@@ -1,5 +1,6 @@
package cpm.com.gskmtorange; package cpm.com.gskmtorange;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
@@ -27,7 +28,7 @@ public class SplashScreenActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 3000; private static int SPLASH_TIME_OUT = 3000;
LinearLayout linearLayout; LinearLayout linearLayout;
private Context context;
private SharedPreferences preferences = null; private SharedPreferences preferences = null;
public void onAttachedToWindow() { public void onAttachedToWindow() {
@@ -44,7 +45,7 @@ public class SplashScreenActivity extends AppCompatActivity {
linearLayout = findViewById(R.id.lin_lay); linearLayout = findViewById(R.id.lin_lay);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
context = this;
StartAnimations(); StartAnimations();
sendToLogin(); sendToLogin();
@@ -137,14 +138,14 @@ public class SplashScreenActivity extends AppCompatActivity {
//after Mpin //after Mpin
String mpin = preferences.getString(CommonString.MPIN, null); String mpin = preferences.getString(CommonString.MPIN, null);
if(mpin!=null){ if(mpin!=null){
Intent in = new Intent(getApplicationContext(), MPinActivity.class); Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, true); in.putExtra(CommonString.IS_PASSWORD_CHECK, true);
startActivity(in); startActivity(in);
finish(); finish();
} }
else { else {
Intent i = new Intent(getApplicationContext(), LoginActivity.class); Intent i = new Intent(context, LoginActivity.class);
startActivity(i); startActivity(i);
finish(); finish();
} }
@@ -37,7 +37,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
public class AutoUpdateActivity extends AppCompatActivity { public class AutoUpdateActivity extends AppCompatActivity {
private Context context;
String versionCode; String versionCode;
int length; int length;
private Dialog dialog; private Dialog dialog;
@@ -57,12 +57,13 @@ public class AutoUpdateActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
Intent intent = getIntent(); Intent intent = getIntent();
context = this;
path = intent.getStringExtra(CommonString.KEY_PATH); path = intent.getStringExtra(CommonString.KEY_PATH);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Parinaam"); builder.setTitle("Parinaam");
@@ -253,20 +254,13 @@ public class AutoUpdateActivity extends AppCompatActivity {
dialog.dismiss(); dialog.dismiss();
if (result.equals(CommonString.KEY_SUCCESS)) { if (result.equals(CommonString.KEY_SUCCESS)) {
/* Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", new File(Environment
.getExternalStorageDirectory()
+ "/download/"
+ "app.apk")),
"application/vnd.android.package-archive");
startActivity(i);*/
File toInstall = new File(Environment.getExternalStorageDirectory() File toInstall = new File(Environment.getExternalStorageDirectory()
+ "/download/" + "/download/"
+ "app.apk"); + "app.apk");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Uri apkUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", toInstall); Uri apkUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", toInstall);
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE); Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri); intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -58,6 +58,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener{ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener{
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
String store_id, visit_date, username, intime, date; String store_id, visit_date, username, intime, date;
String categoryName, categoryId; String categoryName, categoryId;
@@ -107,7 +108,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
img_cam = (ImageView) findViewById(R.id.img_promotion_add); img_cam = (ImageView) findViewById(R.id.img_promotion_add);
lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo); lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo);
btntoggle = (ToggleButton) findViewById(R.id.btntoggle); btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -115,7 +116,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null); country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data //Intent data
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
@@ -163,7 +164,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
btntoggle.setChecked(isExists); btntoggle.setChecked(isExists);
if(added_promo_list.size()>0){ if(added_promo_list.size()>0){
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list); promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter); rec_added_promo.setAdapter(promoAdapter);
} }
@@ -426,7 +427,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
added_promo_list.add(promo); added_promo_list.add(promo);
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
PromoAdapter gapAdapter = new PromoAdapter(added_promo_list); PromoAdapter gapAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(gapAdapter); rec_added_promo.setAdapter(gapAdapter);
@@ -462,7 +463,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
case R.id.img_promotion_add: case R.id.img_promotion_add:
_pathforcheck = "Additional_Promo_Skuwise_Image" + store_id + categoryId + visit_date.replace("/", "") + "_" + _pathforcheck = "Additional_Promo_Skuwise_Image" + store_id + categoryId + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -486,7 +487,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
fab_add.hide();//.setVisibility(View.GONE); fab_add.hide();//.setVisibility(View.GONE);
added_promo_list.clear(); added_promo_list.clear();
rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list); promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter); rec_added_promo.setAdapter(promoAdapter);
@@ -541,7 +542,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
Log.i("Stock & Facing ", "startCameraActivity()"); Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -73,6 +73,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener, DialogCallbackListener { public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener, DialogCallbackListener {
ArrayList<AdditionalDialogGetterSetter> list = new ArrayList<AdditionalDialogGetterSetter>(); ArrayList<AdditionalDialogGetterSetter> list = new ArrayList<AdditionalDialogGetterSetter>();
private Context context;
ArrayList<AddittionalGetterSetter> listdata = new ArrayList<>(); ArrayList<AddittionalGetterSetter> listdata = new ArrayList<>();
ArrayList<AddittionalGetterSetter> listMain = new ArrayList<AddittionalGetterSetter>(); ArrayList<AddittionalGetterSetter> listMain = new ArrayList<AddittionalGetterSetter>();
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList; ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
@@ -130,10 +131,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
setContentView(R.layout.additionalvisibilitylayout); setContentView(R.layout.additionalvisibilitylayout);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, ""); camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
@@ -144,7 +143,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, ""); country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null); store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId"); categoryId = getIntent().getStringExtra("categoryId");
@@ -798,10 +797,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage.setOnClickListener(new View.OnClickListener() { btnimage.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1; _path = CommonString.FILE_PATH + _pathforcheck1;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
} }
@@ -810,10 +809,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage1.setOnClickListener(new View.OnClickListener() { btnimage1.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2; _path = CommonString.FILE_PATH + _pathforcheck2;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
} }
@@ -822,10 +821,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage2.setOnClickListener(new View.OnClickListener() { btnimage2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck3; _path = CommonString.FILE_PATH + _pathforcheck3;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
} }
@@ -1213,7 +1212,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -1872,7 +1871,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_Additional_visibility)); toolbar.setTitle(getResources().getString(R.string.title_activity_Additional_visibility));
} }
@@ -56,7 +56,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class AuditActivity extends AppCompatActivity { public class AuditActivity extends AppCompatActivity {
private Context context;
List<Integer> checkHeaderArray = new ArrayList<>(); List<Integer> checkHeaderArray = new ArrayList<>();
boolean checkflag = true; boolean checkflag = true;
private SharedPreferences preferences; private SharedPreferences preferences;
@@ -80,14 +80,12 @@ public class AuditActivity extends AppCompatActivity {
setContentView(R.layout.activity_audit); setContentView(R.layout.activity_audit);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
no_data_lay = (LinearLayout) findViewById(R.id.no_data_lay); no_data_lay = (LinearLayout) findViewById(R.id.no_data_lay);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -265,7 +263,7 @@ public class AuditActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.audit)); toolbar.setTitle(getResources().getString(R.string.audit));
} }
@@ -422,10 +420,10 @@ public class AuditActivity extends AppCompatActivity {
holder.img_cam.setOnClickListener(new View.OnClickListener() { holder.img_cam.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
pathforcheck = store_id + "AuditAnsPic" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; pathforcheck = store_id + "AuditAnsPic" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + pathforcheck; _path = CommonString.FILE_PATH + pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position; child_position = position;
startCameraActivity(0); startCameraActivity(0);
} }
@@ -434,10 +432,10 @@ public class AuditActivity extends AppCompatActivity {
holder.img_cam2.setOnClickListener(new View.OnClickListener() { holder.img_cam2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
pathforcheck = store_id + "AuditAnsPic2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; pathforcheck = store_id + "AuditAnsPic2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + pathforcheck; _path = CommonString.FILE_PATH + pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position; child_position = position;
startCameraActivity(1); startCameraActivity(1);
} }
@@ -609,7 +607,7 @@ public class AuditActivity extends AppCompatActivity {
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -46,6 +46,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryImagesAllowed; import cpm.com.gskmtorange.xmlGetterSetter.CategoryImagesAllowed;
public class CategoryPicture extends AppCompatActivity { public class CategoryPicture extends AppCompatActivity {
private Context context;
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId; String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId;
ImageView im1, im2, im3, im4; ImageView im1, im2, im3, im4;
ListView listview; ListView listview;
@@ -71,7 +72,7 @@ public class CategoryPicture extends AppCompatActivity {
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, ""); camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
@@ -80,7 +81,7 @@ public class CategoryPicture extends AppCompatActivity {
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, ""); key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, ""); country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null); store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId"); categoryId = getIntent().getStringExtra("categoryId");
@@ -214,10 +215,10 @@ public class CategoryPicture extends AppCompatActivity {
public void onClick(View view) { public void onClick(View view) {
_pathforcheck1 = store_id + "CategoryPicture1" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck1 = store_id + "CategoryPicture1" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1; _path = CommonString.FILE_PATH + _pathforcheck1;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
} }
@@ -227,10 +228,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck2 = store_id + "CategoryPicture2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck2 = store_id + "CategoryPicture2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2; _path = CommonString.FILE_PATH + _pathforcheck2;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
@@ -240,10 +241,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck3 = store_id + "CategoryPicture3" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck3 = store_id + "CategoryPicture3" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck3; _path = CommonString.FILE_PATH + _pathforcheck3;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
@@ -253,10 +254,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
_pathforcheck4 = store_id + "CategoryPicture4" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck4 = store_id + "CategoryPicture4" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck4; _path = CommonString.FILE_PATH + _pathforcheck4;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
@@ -299,7 +300,7 @@ public class CategoryPicture extends AppCompatActivity {
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -493,11 +494,11 @@ public class CategoryPicture extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
Adapterposition = position1; Adapterposition = position1;
_path = CommonString.FILE_PATH + Camerapath1; _path = CommonString.FILE_PATH + Camerapath1;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
listview.invalidateViews(); listview.invalidateViews();
@@ -516,10 +517,10 @@ public class CategoryPicture extends AppCompatActivity {
Snackbar.make(listview,R.string.first_click_compulsory_image,Snackbar.LENGTH_LONG).show(); Snackbar.make(listview,R.string.first_click_compulsory_image,Snackbar.LENGTH_LONG).show();
} }
else { else {
Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
Adapterposition = position1; Adapterposition = position1;
_path = CommonString.FILE_PATH + Camerapath2; _path = CommonString.FILE_PATH + Camerapath2;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
listview.invalidateViews(); listview.invalidateViews();
} }
@@ -670,7 +671,7 @@ public class CategoryPicture extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture)); toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture));
} }
@@ -37,7 +37,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.download.DownloadActivity; import cpm.com.gskmtorange.download.DownloadActivity;
public class CheckoutActivity extends AppCompatActivity { public class CheckoutActivity extends AppCompatActivity {
private Context context;
private Dialog dialog; private Dialog dialog;
private ProgressBar pb; private ProgressBar pb;
private TextView percentage, message; private TextView percentage, message;
@@ -62,12 +62,12 @@ public class CheckoutActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID); store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG); store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -135,7 +135,7 @@ public class CheckoutActivity extends AppCompatActivity {
+ "[LATITUDE]" + lat + "[/LATITUDE]" + "[LATITUDE]" + lat + "[/LATITUDE]"
+ "[LOGITUDE]" + lon + "[/LOGITUDE]" + "[LOGITUDE]" + lon + "[/LOGITUDE]"
+ "[CHECKOUT_DATE]" + visit_date + "[/CHECKOUT_DATE]" + "[CHECKOUT_DATE]" + visit_date + "[/CHECKOUT_DATE]"
+ "[CHECK_OUTTIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()) + "[/CHECK_OUTTIME]" + "[CHECK_OUTTIME]" + CommonFunctions.getCurrentTimeWithLanguage(context) + "[/CHECK_OUTTIME]"
+ "[CHECK_INTIME]" + coverageBean.getInTime() + "[/CHECK_INTIME]" + "[CHECK_INTIME]" + coverageBean.getInTime() + "[/CHECK_INTIME]"
+ "[CREATED_BY]" + username + "[/CREATED_BY]" + "[CREATED_BY]" + username + "[/CREATED_BY]"
+ "[/STORE_CHECK_OUT_STATUS]"; + "[/STORE_CHECK_OUT_STATUS]";
@@ -185,7 +185,7 @@ public class CheckoutActivity extends AppCompatActivity {
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) { if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()), CommonString.KEY_Y, checkOutImagePath); db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(context), CommonString.KEY_Y, checkOutImagePath);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, ""); editor.putString(CommonString.KEY_STORE_ID, "");
@@ -295,7 +295,7 @@ public class CheckoutActivity extends AppCompatActivity {
CheckOutStoreActivity.this, CommonString1.ERROR + result, "success", null); CheckOutStoreActivity.this, CommonString1.ERROR + result, "success", null);
message.showMessage();*/ message.showMessage();*/
Toast.makeText(getApplicationContext(), "Network Error Try Again", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Network Error Try Again", Toast.LENGTH_SHORT).show();
finish(); finish();
} }
@@ -312,7 +312,7 @@ public class CheckoutActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_checkout)); toolbar.setTitle(getResources().getString(R.string.title_activity_checkout));
} }
@@ -2,6 +2,7 @@ package cpm.com.gskmtorange.dailyentry;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
@@ -47,6 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SupervisorListGetterSetter;
public class CoachingVisitActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener { public class CoachingVisitActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
private Context context;
private GSKOrangeDB database; private GSKOrangeDB database;
ArrayList<SupervisorListGetterSetter> supervisorList; ArrayList<SupervisorListGetterSetter> supervisorList;
private Spinner exist_spinner; //supervisor_spinner; private Spinner exist_spinner; //supervisor_spinner;
@@ -81,13 +83,13 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
img_cam = (ImageView) findViewById(R.id.img_cam); img_cam = (ImageView) findViewById(R.id.img_cam);
multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor); multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_coaching_visit)); toolbar.setTitle(getResources().getString(R.string.title_activity_coaching_visit));
@@ -271,7 +273,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
switch (v.getId()) { switch (v.getId()) {
case R.id.img_cam: case R.id.img_cam:
_pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -304,7 +306,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id); database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
} }
Toast.makeText(getApplicationContext(), getString(R.string.save_message), Toast.LENGTH_SHORT).show(); Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
saved_flag = true; saved_flag = true;
@@ -320,7 +322,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id); database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
Toast.makeText(getApplicationContext(), getString(R.string.save_message), Toast.LENGTH_SHORT).show(); Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
saved_flag = true; saved_flag = true;
fab_next.show();//setVisibility(View.VISIBLE); fab_next.show();//setVisibility(View.VISIBLE);
} }
@@ -363,7 +365,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -49,7 +49,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CompetitonPromoGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.PROMOTION_TYPE_MASTERGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.PROMOTION_TYPE_MASTERGetterSetter;
public class CompetitionPromoActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener { public class CompetitionPromoActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
private Context context;
ToggleButton btntoggle; ToggleButton btntoggle;
boolean isDataAdded = false, isExists = true, is_camera_compulsory = false; boolean isDataAdded = false, isExists = true, is_camera_compulsory = false;
LinearLayout lin_parent; LinearLayout lin_parent;
@@ -108,7 +108,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
imgCam = (ImageView) findViewById(R.id.img_cam); imgCam = (ImageView) findViewById(R.id.img_cam);
imgCam1 = (ImageView) findViewById(R.id.img_cam1); imgCam1 = (ImageView) findViewById(R.id.img_cam1);
imgCam2 = (ImageView) findViewById(R.id.img_cam2); imgCam2 = (ImageView) findViewById(R.id.img_cam2);
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -122,7 +122,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, ""); storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data //Intent data
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
@@ -183,7 +183,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
if(exists_data.get(0).isExists()){ if(exists_data.get(0).isExists()){
addedCounterfeitProducts = db.getCometionPromoAfterData(store_id, categoryId); addedCounterfeitProducts = db.getCometionPromoAfterData(store_id, categoryId);
if(addedCounterfeitProducts.size()>0){ if(addedCounterfeitProducts.size()>0){
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts); productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter); rec_added_counterfeit_product.setAdapter(productAdapter);
} }
@@ -278,7 +278,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
addedCounterfeitProducts.add(product); addedCounterfeitProducts.add(product);
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts); productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter); rec_added_counterfeit_product.setAdapter(productAdapter);
@@ -320,19 +320,19 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
break; break;
case R.id.img_cam: case R.id.img_cam:
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
startCameraActivity(); startCameraActivity();
break; break;
case R.id.img_cam1: case R.id.img_cam1:
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1; _path = CommonString.FILE_PATH + _pathforcheck1;
startCameraActivity(); startCameraActivity();
break; break;
case R.id.img_cam2: case R.id.img_cam2:
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2; _path = CommonString.FILE_PATH + _pathforcheck2;
startCameraActivity(); startCameraActivity();
break; break;
@@ -610,7 +610,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -63,7 +63,7 @@ public class ConversationActivity extends AppCompatActivity {
private SharedPreferences preferences = null; private SharedPreferences preferences = null;
GSKOrangeDB db; GSKOrangeDB db;
private Context context;
ArrayList<ChatMessageGetterSetter> conversation_list = new ArrayList<>(); ArrayList<ChatMessageGetterSetter> conversation_list = new ArrayList<>();
MyRecyclerAdapter adapter; MyRecyclerAdapter adapter;
@@ -85,7 +85,7 @@ public class ConversationActivity extends AppCompatActivity {
db = new GSKOrangeDB(ConversationActivity.this); db = new GSKOrangeDB(ConversationActivity.this);
db.open(); db.open();
context = this;
rec = (RecyclerView) findViewById(R.id.rec_conversation); rec = (RecyclerView) findViewById(R.id.rec_conversation);
et_reply = (EditText) findViewById(R.id.et_reply); et_reply = (EditText) findViewById(R.id.et_reply);
@@ -96,7 +96,7 @@ public class ConversationActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -146,9 +146,9 @@ public class ConversationActivity extends AppCompatActivity {
}); });
//if (conversation_list.size() > 0) { //if (conversation_list.size() > 0) {
adapter = new MyRecyclerAdapter(getApplicationContext(), conversation_list); adapter = new MyRecyclerAdapter(context, conversation_list);
rec.setAdapter(adapter); rec.setAdapter(adapter);
rec.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec.setLayoutManager(new LinearLayoutManager(context));
//} //}
} }
@@ -1,5 +1,6 @@
package cpm.com.gskmtorange.dailyentry; package cpm.com.gskmtorange.dailyentry;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@@ -21,7 +22,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
public class CounterfeitIndicatorWebActivity extends AppCompatActivity { public class CounterfeitIndicatorWebActivity extends AppCompatActivity {
private Context context;
WebView webView; WebView webView;
String url = "https://gskme.parinaam.in/res/eg/fake.html"; String url = "https://gskme.parinaam.in/res/eg/fake.html";
private SharedPreferences preferences; private SharedPreferences preferences;
@@ -32,11 +33,11 @@ public class CounterfeitIndicatorWebActivity extends AppCompatActivity {
setContentView(R.layout.activity_counterfeit_indicator_web); setContentView(R.layout.activity_counterfeit_indicator_web);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_counterfeit_indicator_web)); toolbar.setTitle(getResources().getString(R.string.title_activity_counterfeit_indicator_web));
webView = (WebView) findViewById(R.id.webview); webView = (WebView) findViewById(R.id.webview);
@@ -51,6 +51,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
public class CounterfeitProductsActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener { public class CounterfeitProductsActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
private Context context;
ToggleButton btntoggle; ToggleButton btntoggle;
boolean isDataAdded = false, isExists = true, is_camera_compulsory = false; boolean isDataAdded = false, isExists = true, is_camera_compulsory = false;
LinearLayout lin_parent; LinearLayout lin_parent;
@@ -82,7 +83,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
setContentView(R.layout.activity_counterfeit_products); setContentView(R.layout.activity_counterfeit_products);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
btntoggle = (ToggleButton) findViewById(R.id.btntoggle); btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
@@ -108,7 +109,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
username = preferences.getString(CommonString.KEY_USERNAME, null); username = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null); country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data //Intent data
categoryName = getIntent().getStringExtra("categoryName"); categoryName = getIntent().getStringExtra("categoryName");
@@ -146,7 +147,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
if(exists_data.get(0).isExists()){ if(exists_data.get(0).isExists()){
addedCounterfeitProducts = db.getCounterfeitProductAfterData(store_id, categoryId); addedCounterfeitProducts = db.getCounterfeitProductAfterData(store_id, categoryId);
if(addedCounterfeitProducts.size()>0){ if(addedCounterfeitProducts.size()>0){
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts); productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter); rec_added_counterfeit_product.setAdapter(productAdapter);
} }
@@ -237,7 +238,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
addedCounterfeitProducts.add(product); addedCounterfeitProducts.add(product);
rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts); productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter); rec_added_counterfeit_product.setAdapter(productAdapter);
@@ -277,19 +278,19 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
break; break;
case R.id.img_cam: case R.id.img_cam:
_pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
startCameraActivity(); startCameraActivity();
break; break;
case R.id.img_cam1: case R.id.img_cam1:
_pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1; _path = CommonString.FILE_PATH + _pathforcheck1;
startCameraActivity(); startCameraActivity();
break; break;
case R.id.img_cam2: case R.id.img_cam2:
_pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2; _path = CommonString.FILE_PATH + _pathforcheck2;
startCameraActivity(); startCameraActivity();
break; break;
@@ -401,7 +402,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -53,7 +53,7 @@ public class CreateSelfActivity extends AppCompatActivity {
RecyclerView rec_sub_category; RecyclerView rec_sub_category;
static int FROM_DIALOG = 0; static int FROM_DIALOG = 0;
static int FROM_CLICK = 1; static int FROM_CLICK = 1;
private Context context;
ArrayList<MSL_AvailabilityStockFacingGetterSetter> added_sub_category_list; ArrayList<MSL_AvailabilityStockFacingGetterSetter> added_sub_category_list;
@Override @Override
@@ -66,7 +66,7 @@ public class CreateSelfActivity extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec_sub_category = (RecyclerView) findViewById(R.id.rec_sub_category); rec_sub_category = (RecyclerView) findViewById(R.id.rec_sub_category);
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -195,7 +195,7 @@ public class CreateSelfActivity extends AppCompatActivity {
Snackbar.make(btn_create,"Sub Category already added",Snackbar.LENGTH_SHORT).show(); Snackbar.make(btn_create,"Sub Category already added",Snackbar.LENGTH_SHORT).show();
} }
else { else {
Intent in = new Intent(getApplicationContext(), NoCameraActivity.class); Intent in = new Intent(context, NoCameraActivity.class);
in.putExtra("categoryName", categoryName); in.putExtra("categoryName", categoryName);
in.putExtra("categoryId", categoryId); in.putExtra("categoryId", categoryId);
in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, number_of_rows); in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, number_of_rows);
@@ -467,7 +467,7 @@ public class CreateSelfActivity extends AppCompatActivity {
holder.parentLayout.setOnClickListener(new View.OnClickListener() { holder.parentLayout.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent in = new Intent(getApplicationContext(), NoCameraActivity.class); Intent in = new Intent(context, NoCameraActivity.class);
in.putExtra("categoryName", categoryName); in.putExtra("categoryName", categoryName);
in.putExtra("categoryId", categoryId); in.putExtra("categoryId", categoryId);
in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, 0); in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, 0);
@@ -51,7 +51,7 @@ import cpm.com.gskmtorange.upload.UploadImageWithRetrofit;
import cpm.com.gskmtorange.xmlGetterSetter.DeliveryCallsGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.DeliveryCallsGetterSetter;
public class DeliveryCallActivity extends AppCompatActivity implements View.OnClickListener { public class DeliveryCallActivity extends AppCompatActivity implements View.OnClickListener {
private Context context;
private SharedPreferences preferences; private SharedPreferences preferences;
private GSKOrangeDB database; private GSKOrangeDB database;
String visit_date, userId; String visit_date, userId;
@@ -67,7 +67,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
setContentView(R.layout.activity_delivery_call); setContentView(R.layout.activity_delivery_call);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
recyclerView = (RecyclerView) findViewById(R.id.rec_delivery_calls); recyclerView = (RecyclerView) findViewById(R.id.rec_delivery_calls);
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
fab_upload = (FloatingActionButton) findViewById(R.id.fab_upload); fab_upload = (FloatingActionButton) findViewById(R.id.fab_upload);
@@ -76,7 +76,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
database = new GSKOrangeDB(this); database = new GSKOrangeDB(this);
database.open(); database.open();
@@ -103,7 +103,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
Snackbar.make(recyclerView, getString(R.string.title_store_list_checkout_current), Snackbar.LENGTH_SHORT).show(); Snackbar.make(recyclerView, getString(R.string.title_store_list_checkout_current), Snackbar.LENGTH_SHORT).show();
} else { } else {
Intent in = new Intent(getApplicationContext(), DeliveryCallAddStoreActivity.class); Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
startActivity(in); startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out); overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -162,7 +162,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
public void onClick(View v) { public void onClick(View v) {
if (current.getUPLOAD_STATUS().equals(CommonString.KEY_CHECK_IN)) { if (current.getUPLOAD_STATUS().equals(CommonString.KEY_CHECK_IN)) {
Intent in = new Intent(getApplicationContext(), DeliveryCallAddStoreActivity.class); Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
in.putExtra(CommonString.KEY_STORE_ID, current); in.putExtra(CommonString.KEY_STORE_ID, current);
in.putExtra(CommonString.KEY_STORE_FLAG, false); in.putExtra(CommonString.KEY_STORE_FLAG, false);
startActivity(in); startActivity(in);
@@ -203,14 +203,14 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.delivery_call)); toolbar.setTitle(getString(R.string.delivery_call));
deliveryCallsList = database.getDeliveryCallsData(visit_date); deliveryCallsList = database.getDeliveryCallsData(visit_date);
if (deliveryCallsList.size() > 0) { if (deliveryCallsList.size() > 0) {
//list.setAdapter(new MyAdaptor()); //list.setAdapter(new MyAdaptor());
deliveryAdapter = new DeliveryAdapter(getApplicationContext(), deliveryCallsList); deliveryAdapter = new DeliveryAdapter(context, deliveryCallsList);
recyclerView.setAdapter(deliveryAdapter); recyclerView.setAdapter(deliveryAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -106,7 +106,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
checkin_flag = getIntent().getBooleanExtra(CommonString.KEY_STORE_FLAG, true); checkin_flag = getIntent().getBooleanExtra(CommonString.KEY_STORE_FLAG, true);
deliveryCallsData = (DeliveryCallsGetterSetter) getIntent().getSerializableExtra(CommonString.KEY_STORE_ID); deliveryCallsData = (DeliveryCallsGetterSetter) getIntent().getSerializableExtra(CommonString.KEY_STORE_ID);
@@ -224,7 +224,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
super.onResume(); super.onResume();
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.delivery_call)); toolbar.setTitle(getString(R.string.delivery_call));
checkgpsEnableDevice(); checkgpsEnableDevice();
@@ -318,9 +318,9 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
switch (v.getId()) { switch (v.getId()) {
case R.id.img_checkin: case R.id.img_checkin:
in_time = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); in_time = CommonFunctions.getCurrentTimeWithLanguage(context);
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -329,9 +329,9 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
case R.id.img_checkout: case R.id.img_checkout:
out_time = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); out_time = CommonFunctions.getCurrentTimeWithLanguage(context);
_pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -345,7 +345,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -439,7 +439,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG) , Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
@@ -153,7 +153,7 @@ public class FutureJCPActivity extends AppCompatActivity implements View.OnClick
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
progressDialog = new ProgressDialog(FutureJCPActivity.this); progressDialog = new ProgressDialog(FutureJCPActivity.this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
c = Calendar.getInstance(); c = Calendar.getInstance();
year = c.get(Calendar.YEAR); year = c.get(Calendar.YEAR);
@@ -56,7 +56,7 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class MessageActivity extends AppCompatActivity { public class MessageActivity extends AppCompatActivity {
//ArrayList<MessageGetterSetter> messages; //ArrayList<MessageGetterSetter> messages;
private Context context;
String categoryName = "", categoryId; String categoryName = "", categoryId;
MyRecyclerAdapter adapter; MyRecyclerAdapter adapter;
@@ -81,7 +81,7 @@ public class MessageActivity extends AppCompatActivity {
setContentView(R.layout.activity_message); setContentView(R.layout.activity_message);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec = (RecyclerView)findViewById(R.id.rec); rec = (RecyclerView)findViewById(R.id.rec);
@@ -91,7 +91,7 @@ public class MessageActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -122,7 +122,7 @@ public class MessageActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_message)); toolbar.setTitle(getString(R.string.title_activity_message));
new DowloadAsync(MessageActivity.this).execute(); new DowloadAsync(MessageActivity.this).execute();
@@ -398,9 +398,9 @@ public class MessageActivity extends AppCompatActivity {
chatmessagelist = db.getChatMessageData(store_id); chatmessagelist = db.getChatMessageData(store_id);
if(chatmessagelist.size()>0){ if(chatmessagelist.size()>0){
adapter = new MyRecyclerAdapter(getApplicationContext(), chatmessagelist); adapter = new MyRecyclerAdapter(context, chatmessagelist);
rec.setAdapter(adapter); rec.setAdapter(adapter);
rec.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec.setLayoutManager(new LinearLayoutManager(context));
} }
//finish(); //finish();
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGette
public class NewStockDataActivity extends AppCompatActivity implements DialogCallbackListener{ public class NewStockDataActivity extends AppCompatActivity implements DialogCallbackListener{
private Context context;
ExpandableListView expandableListView; ExpandableListView expandableListView;
TextView txt_mslAvailabilityName; TextView txt_mslAvailabilityName;
ArrayList<MSL_AvailabilityStockFacingGetterSetter> headerDataList; ArrayList<MSL_AvailabilityStockFacingGetterSetter> headerDataList;
@@ -121,11 +122,11 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null); store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -245,7 +246,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -268,7 +269,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -281,7 +282,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -659,7 +660,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
private void prepareList() { private void prepareList() {
@@ -1,6 +1,7 @@
package cpm.com.gskmtorange.dailyentry; package cpm.com.gskmtorange.dailyentry;
import android.app.Dialog; import android.app.Dialog;
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;
@@ -65,7 +66,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.NoCameraDataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.RowColumnGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.RowColumnGetterSetter;
public class NoCameraActivity extends AppCompatActivity implements Listener { public class NoCameraActivity extends AppCompatActivity implements Listener {
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, str, country_id, store_flag_str; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, str, country_id, store_flag_str;
String categoryName, categoryId; String categoryName, categoryId;
@@ -93,7 +94,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
@@ -158,11 +159,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter(); DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button // first Button
RelativeLayout rLayout = new RelativeLayout(getApplicationContext()); RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
TextView tv = new TextView(getApplicationContext()); TextView tv = new TextView(context);
tv.setHeight(60); tv.setHeight(60);
tv.setTextSize(18); tv.setTextSize(18);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview)); tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -175,7 +176,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object //set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id); dynamic_ids.setTextview_id(tv_id);
RecyclerView rec_bottom = new RecyclerView(getApplicationContext()); RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId(); int rec_id = View.generateViewId();
//set dynamic recycler id to object //set dynamic recycler id to object
@@ -193,7 +194,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2; lprams2.height = 2;
View view = new View(getApplicationContext()); View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white)); view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2); view.setLayoutParams(lprams2);
@@ -221,7 +222,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
dynamic_ids.setTotal_unit(getTotalUnit(sku_group_master)); dynamic_ids.setTotal_unit(getTotalUnit(sku_group_master));
ids.add(dynamic_ids); ids.add(dynamic_ids);
MyAdapter adapter = new MyAdapter(getApplicationContext(), sku_group_master, this, rec_bottom); MyAdapter adapter = new MyAdapter(context, sku_group_master, this, rec_bottom);
rec_bottom.setAdapter(adapter); rec_bottom.setAdapter(adapter);
rec_bottom.scrollToPosition(sku_group_master.size() - 1); rec_bottom.scrollToPosition(sku_group_master.size() - 1);
@@ -248,11 +249,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter(); DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button // first Button
RelativeLayout rLayout = new RelativeLayout(getApplicationContext()); RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
TextView tv = new TextView(getApplicationContext()); TextView tv = new TextView(context);
//tv.setHeight(60); //tv.setHeight(60);
tv.setTextSize(20); tv.setTextSize(20);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview)); tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -265,7 +266,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object //set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id); dynamic_ids.setTextview_id(tv_id);
RecyclerView rec_bottom = new RecyclerView(getApplicationContext()); RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId(); int rec_id = View.generateViewId();
//set dynamic recycler id to object //set dynamic recycler id to object
@@ -283,7 +284,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2; lprams2.height = 2;
View view = new View(getApplicationContext()); View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white)); view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2); view.setLayoutParams(lprams2);
@@ -310,7 +311,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
List<NoCameraDataGetterSetter> brands = new ArrayList<>(); List<NoCameraDataGetterSetter> brands = new ArrayList<>();
MyAdapter adapter = new MyAdapter(getApplicationContext(), brands, this, rec_bottom); MyAdapter adapter = new MyAdapter(context, brands, this, rec_bottom);
rec_bottom.setAdapter(adapter); rec_bottom.setAdapter(adapter);
tv.setOnDragListener(adapter.getDragInstance()); tv.setOnDragListener(adapter.getDragInstance());
@@ -1203,11 +1204,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter(); DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button // first Button
RelativeLayout rLayout = new RelativeLayout(getApplicationContext()); RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
TextView tv = new TextView(getApplicationContext()); TextView tv = new TextView(context);
//tv.setHeight(60); //tv.setHeight(60);
tv.setTextSize(20); tv.setTextSize(20);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview)); tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -1220,7 +1221,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object //set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id); dynamic_ids.setTextview_id(tv_id);
RecyclerView rec_bottom = new RecyclerView(getApplicationContext()); RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId(); int rec_id = View.generateViewId();
//set dynamic recycler id to object //set dynamic recycler id to object
@@ -1238,7 +1239,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2; lprams2.height = 2;
View view = new View(getApplicationContext()); View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white)); view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2); view.setLayoutParams(lprams2);
@@ -1265,7 +1266,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
List<NoCameraDataGetterSetter> brands = new ArrayList<>(); List<NoCameraDataGetterSetter> brands = new ArrayList<>();
MyAdapter adapter = new MyAdapter(getApplicationContext(), brands, this, rec_bottom); MyAdapter adapter = new MyAdapter(context, brands, this, rec_bottom);
rec_bottom.setAdapter(adapter); rec_bottom.setAdapter(adapter);
tv.setOnDragListener(adapter.getDragInstance()); tv.setOnDragListener(adapter.getDragInstance());
@@ -74,7 +74,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class NonWorkingReason extends AppCompatActivity implements public class NonWorkingReason extends AppCompatActivity implements
OnItemSelectedListener, OnClickListener { OnItemSelectedListener, OnClickListener {
private Context context;
ArrayList<NonWorkingReasonGetterSetter> reasondata = new ArrayList<NonWorkingReasonGetterSetter>(); ArrayList<NonWorkingReasonGetterSetter> reasondata = new ArrayList<NonWorkingReasonGetterSetter>();
ArrayList<NonWorkingSubReasonGetterSetter> sub_reasondata = new ArrayList<>(); ArrayList<NonWorkingSubReasonGetterSetter> sub_reasondata = new ArrayList<>();
private Spinner reasonspinner, subreason_spinner; private Spinner reasonspinner, subreason_spinner;
@@ -130,12 +130,12 @@ public class NonWorkingReason extends AppCompatActivity implements
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG); store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -190,7 +190,7 @@ public class NonWorkingReason extends AppCompatActivity implements
} }
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
camera.setOnClickListener(this); camera.setOnClickListener(this);
save.setOnClickListener(this); save.setOnClickListener(this);
@@ -310,7 +310,7 @@ public class NonWorkingReason extends AppCompatActivity implements
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -428,7 +428,7 @@ public class NonWorkingReason extends AppCompatActivity implements
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (v.getId() == R.id.imgcam) { if (v.getId() == R.id.imgcam) {
_pathforcheck = store_id + "NonWorking" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = store_id + "NonWorking" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
@@ -447,13 +447,13 @@ public class NonWorkingReason extends AppCompatActivity implements
if(!validateSubReasonData()){ if(!validateSubReasonData()){
valid_flag = false; valid_flag = false;
Toast.makeText(getApplicationContext(), R.string.title_activity_select_dropdown, Toast.makeText(context, R.string.title_activity_select_dropdown,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
} else { } else {
valid_flag = false; valid_flag = false;
Toast.makeText(getApplicationContext(), R.string.pleaseenterRemarks, Toast.makeText(context, R.string.pleaseenterRemarks,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
} }
@@ -489,7 +489,7 @@ public class NonWorkingReason extends AppCompatActivity implements
cdata.setVisitDate(visit_date); cdata.setVisitDate(visit_date);
cdata.setUserId(_UserId); cdata.setUserId(_UserId);
cdata.setInTime(intime); cdata.setInTime(intime);
cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext())); cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(context));
cdata.setReason(reasonname); cdata.setReason(reasonname);
cdata.setReasonid(reasonid); cdata.setReasonid(reasonid);
cdata.setLatitude("0.0"); cdata.setLatitude("0.0");
@@ -524,7 +524,7 @@ public class NonWorkingReason extends AppCompatActivity implements
cdata.setVisitDate(visit_date); cdata.setVisitDate(visit_date);
cdata.setUserId(_UserId); cdata.setUserId(_UserId);
cdata.setInTime(intime); cdata.setInTime(intime);
cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext())); cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(context));
cdata.setReason(reasonname); cdata.setReason(reasonname);
cdata.setReasonid(reasonid); cdata.setReasonid(reasonid);
cdata.setLatitude("0.0"); cdata.setLatitude("0.0");
@@ -586,11 +586,11 @@ public class NonWorkingReason extends AppCompatActivity implements
} }
} else { } else {
Toast.makeText(getApplicationContext(), Toast.makeText(context,
R.string.title_activity_take_image, Toast.LENGTH_SHORT).show(); R.string.title_activity_take_image, Toast.LENGTH_SHORT).show();
} }
} else { } else {
Toast.makeText(getApplicationContext(), Toast.makeText(context,
R.string.title_activity_select_dropdown, Toast.LENGTH_SHORT).show(); R.string.title_activity_select_dropdown, Toast.LENGTH_SHORT).show();
} }
@@ -671,7 +671,7 @@ public class NonWorkingReason extends AppCompatActivity implements
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
@@ -48,7 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.POGGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.POGGetterSetter;
public class POGQuestionsActivity extends AppCompatActivity { public class POGQuestionsActivity extends AppCompatActivity {
private Context context;
ExpandableListView expandableListView; ExpandableListView expandableListView;
LinearLayout linPlanogramType; LinearLayout linPlanogramType;
Spinner spinPlanogramType; Spinner spinPlanogramType;
@@ -82,13 +82,13 @@ public class POGQuestionsActivity extends AppCompatActivity {
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView); expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
linPlanogramType = (LinearLayout) findViewById(R.id.lin_planogram_type); linPlanogramType = (LinearLayout) findViewById(R.id.lin_planogram_type);
spinPlanogramType = (Spinner) findViewById(R.id.spinner_planogram_type); spinPlanogramType = (Spinner) findViewById(R.id.spinner_planogram_type);
context = this;
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -64,7 +64,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers; import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class PlanogramPDFActivity extends AppCompatActivity { public class PlanogramPDFActivity extends AppCompatActivity {
private Context context;
private Dialog dialog; private Dialog dialog;
private ProgressBar pb; private ProgressBar pb;
private TextView percentage, message; private TextView percentage, message;
@@ -86,7 +86,7 @@ public class PlanogramPDFActivity extends AppCompatActivity {
setContentView(R.layout.activity_planogram_pdf); setContentView(R.layout.activity_planogram_pdf);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec = (RecyclerView) findViewById(R.id.rec); rec = (RecyclerView) findViewById(R.id.rec);
@@ -96,7 +96,7 @@ public class PlanogramPDFActivity extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(checkNetIsAvailable()){ if(checkNetIsAvailable()){
new DowloadAsync(getApplicationContext()).execute(); new DowloadAsync(context).execute();
} }
else { else {
Snackbar.make(fab, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT) Snackbar.make(fab, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
@@ -108,7 +108,7 @@ public class PlanogramPDFActivity 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, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
new DowloadAsync(getApplicationContext()).execute(); new DowloadAsync(context).execute();
} }
//region Download doc //region Download doc
@@ -255,9 +255,9 @@ public class PlanogramPDFActivity extends AppCompatActivity {
if (result.contains(CommonString.KEY_SUCCESS)) { if (result.contains(CommonString.KEY_SUCCESS)) {
if(document.getPLANOGRAM_URL().size()>0){ if(document.getPLANOGRAM_URL().size()>0){
adapter = new MyRecyclerAdapter(getApplicationContext(), document); adapter = new MyRecyclerAdapter(context, document);
rec.setAdapter(adapter); rec.setAdapter(adapter);
rec.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec.setLayoutManager(new LinearLayoutManager(context));
} }
@@ -26,7 +26,7 @@ public class ServiceActivity extends AppCompatActivity {
private SharedPreferences preferences; private SharedPreferences preferences;
Toolbar toolbar; Toolbar toolbar;
private Context context;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -35,11 +35,11 @@ public class ServiceActivity extends AppCompatActivity {
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
/* ServiceActivityFragment fragment = new ServiceActivityFragment(); /* ServiceActivityFragment fragment = new ServiceActivityFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/ getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/
@@ -83,7 +83,7 @@ public class ServiceActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_service); toolbar.setTitle(R.string.title_activity_service);
} }
@@ -30,7 +30,7 @@ import cpm.com.gskmtorange.fragment.SettingsActivityFragment;
public class SettingsActivity extends AppCompatActivity implements SelectLanguageFragment.OnFragmentInteractionListener { public class SettingsActivity extends AppCompatActivity implements SelectLanguageFragment.OnFragmentInteractionListener {
String selected_lang = "", culture_id, notice_url; String selected_lang = "", culture_id, notice_url;
private Context context;
FloatingActionButton fab; FloatingActionButton fab;
private SharedPreferences preferences; private SharedPreferences preferences;
@@ -45,14 +45,14 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
setContentView(R.layout.activity_settings); setContentView(R.layout.activity_settings);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit(); editor = preferences.edit();
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
/* SettingsActivityFragment fragment = new SettingsActivityFragment(); /* SettingsActivityFragment fragment = new SettingsActivityFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/ getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/
@@ -68,14 +68,14 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
.setAction("Action", null).show(); .setAction("Action", null).show();
} else { } else {
CommonFunctions.updateLangResources(getApplicationContext(),selected_lang); CommonFunctions.updateLangResources(context,selected_lang);
editor.putString(CommonString.KEY_LANGUAGE, selected_lang); editor.putString(CommonString.KEY_LANGUAGE, selected_lang);
editor.putString(CommonString.KEY_CULTURE_ID, culture_id); editor.putString(CommonString.KEY_CULTURE_ID, culture_id);
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url); editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url);
editor.commit(); editor.commit();
Intent startDownload = new Intent(getApplicationContext(), MainActivity.class); Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload); startActivity(startDownload);
finish(); finish();
} }
@@ -106,7 +106,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
if (id == android.R.id.home) { if (id == android.R.id.home) {
Intent startDownload = new Intent(getApplicationContext(), MainActivity.class); Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload); startActivity(startDownload);
finish(); finish();
@@ -124,7 +124,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
@Override @Override
public void onBackPressed() { public void onBackPressed() {
//super.onBackPressed(); //super.onBackPressed();
Intent startDownload = new Intent(getApplicationContext(), MainActivity.class); Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload); startActivity(startDownload);
finish(); finish();
@@ -135,7 +135,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_settings); toolbar.setTitle(R.string.title_activity_settings);
} }
@@ -42,7 +42,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
public class StockActivity extends AppCompatActivity implements DialogCallbackListener { public class StockActivity extends AppCompatActivity implements DialogCallbackListener {
GSKOrangeDB db; GSKOrangeDB db;
private Context context;
String categoryName, categoryId, storeId, Error_Message = ""; String categoryName, categoryId, storeId, Error_Message = "";
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
boolean isDialogOpen = true; boolean isDialogOpen = true;
@@ -70,9 +70,9 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -174,7 +174,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -197,7 +197,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -210,7 +210,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -54,7 +54,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
public class StockDataActivity extends AppCompatActivity implements DialogCallbackListener { public class StockDataActivity extends AppCompatActivity implements DialogCallbackListener {
GSKOrangeDB db; GSKOrangeDB db;
private Context context;
String categoryName, categoryId, storeId, Error_Message = ""; String categoryName, categoryId, storeId, Error_Message = "";
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
boolean isDialogOpen = true; boolean isDialogOpen = true;
@@ -83,9 +83,9 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -184,7 +184,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -207,7 +207,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -220,7 +220,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -41,7 +41,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
public class StockPricingActivity extends AppCompatActivity { public class StockPricingActivity extends AppCompatActivity {
private Context context;
ExpandableListView expandableListView; ExpandableListView expandableListView;
private SharedPreferences preferences; private SharedPreferences preferences;
@@ -71,10 +71,10 @@ public class StockPricingActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null); store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -158,7 +158,7 @@ public class StockPricingActivity extends AppCompatActivity {
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -181,7 +181,7 @@ public class StockPricingActivity extends AppCompatActivity {
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -194,7 +194,7 @@ public class StockPricingActivity extends AppCompatActivity {
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -76,7 +76,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
*/ */
public class StoreCheckoutImageActivity extends AppCompatActivity implements View.OnClickListener, public class StoreCheckoutImageActivity extends AppCompatActivity implements View.OnClickListener,
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private Context context;
String gallery_package = ""; String gallery_package = "";
Uri outputFileUri; Uri outputFileUri;
@@ -105,9 +105,9 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store_checkout_image); setContentView(R.layout.activity_store_checkout_image);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@@ -150,8 +150,8 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
} }
if (Build.VERSION.SDK_INT >= 23 && if (Build.VERSION.SDK_INT >= 23 &&
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return; return;
} }
} }
@@ -188,9 +188,9 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
switch (id) { switch (id) {
case R.id.img_cam_selfie: case R.id.img_cam_selfie:
_pathforcheck = checkOutStore_id + "CHK_SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = checkOutStore_id + "CHK_SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
break; break;
@@ -225,7 +225,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
alert = builder.create(); alert = builder.create();
alert.show(); alert.show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show(); Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
} }
break; break;
@@ -246,7 +246,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
Log.i("MakeMachine", "startCameraActivity()"); Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path); File file = new File(_path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -366,7 +366,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_store_checkout_image); toolbar.setTitle(R.string.title_activity_store_checkout_image);
} }
@@ -226,12 +226,13 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
context = this; context = this;
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG); store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -254,16 +255,16 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent in = new Intent(getApplicationContext(), DownloadActivity.class); Intent in = new Intent(context, DownloadActivity.class);
startActivity(in); startActivity(in);
finish(); finish();
} }
}); });
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(), if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(), ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return; return;
} }
@@ -294,7 +295,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG) , Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
@@ -345,7 +346,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (mGoogleApiClient != null) { if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
// Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
} }
} }
@@ -382,7 +382,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
if (mLastLocation != null) { if (mLastLocation != null) {
lat = mLastLocation.getLatitude(); lat = mLastLocation.getLatitude();
lon = mLastLocation.getLongitude(); lon = mLastLocation.getLongitude();
// Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
} }
startLocationUpdates(); startLocationUpdates();
} }
@@ -484,7 +484,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
} }
checkgpsEnableDevice(); checkgpsEnableDevice();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//toolbar.setTitle(getString(R.string.title_activity_store_list)); //toolbar.setTitle(getString(R.string.title_activity_store_list));
db.open(); db.open();
if(store_flag_str.equals(CommonString.FROM_JCP)){ if(store_flag_str.equals(CommonString.FROM_JCP)){
@@ -520,7 +520,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
StatusCompare ratingCompare = new StatusCompare(); StatusCompare ratingCompare = new StatusCompare();
Collections.sort(storelist, ratingCompare); Collections.sort(storelist, ratingCompare);
adapter = new StoreListActivity.ValueAdapter(getApplicationContext(), storelist); adapter = new StoreListActivity.ValueAdapter(context, storelist);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -571,8 +571,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
}else if (id == R.id.iconMap) { }else if (id == R.id.iconMap) {
//Intent in = new Intent(getApplicationContext(), StoreListMapActivity.class); Intent in = new Intent(context, StoreListRouteActivity.class);
Intent in = new Intent(getApplicationContext(), StoreListRouteActivity.class);
in.putExtra(CommonString.KEY_STORE_LIST, storelist); in.putExtra(CommonString.KEY_STORE_LIST, storelist);
startActivity(in); startActivity(in);
} }
@@ -877,7 +876,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
else { else {
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters"; String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
} }
} }
} }
@@ -985,7 +984,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
viewHolder.imgview_navigation.setOnClickListener(new View.OnClickListener() { viewHolder.imgview_navigation.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent in = new Intent(getApplicationContext(), StoreRouteActivity.class); Intent in = new Intent(context, StoreRouteActivity.class);
in.putExtra(CommonString.KEY_STORE_LIST,current); in.putExtra(CommonString.KEY_STORE_LIST,current);
startActivity(in); startActivity(in);
} }
@@ -1161,7 +1160,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
else { else {
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters"; String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
} }
} }
} }
@@ -89,7 +89,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
String gallery_package = ""; String gallery_package = "";
Uri outputFileUri; Uri outputFileUri;
private Context context;
ImageView img_cam, img_clicked; ImageView img_cam, img_clicked;
Button btn_save; Button btn_save;
private Dialog dialog; private Dialog dialog;
@@ -126,9 +126,9 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_storeimage); setContentView(R.layout.activity_storeimage);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@@ -221,8 +221,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
} }
if (Build.VERSION.SDK_INT >= 23 && if (Build.VERSION.SDK_INT >= 23 &&
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return; return;
} }
} }
@@ -251,9 +251,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted), Toast.LENGTH_LONG).show();
, Toast.LENGTH_LONG)
.show();
finish(); finish();
} }
return false; return false;
@@ -480,11 +478,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
case R.id.img_cam_selfie: case R.id.img_cam_selfie:
_pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; _pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck; _path = CommonString.FILE_PATH + _pathforcheck;
intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()); intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity(); startCameraActivity();
@@ -570,7 +568,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
alert.show(); alert.show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show(); Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
} }
break; break;
} }
@@ -594,7 +592,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
//android.os.FileUriExposedException: file:///storage/emulated/0/.GSK_MT_ORANGE_IMAGES/15024SI_01022019_120426.jpg exposed beyond app through ClipData.Item.getUri() //android.os.FileUriExposedException: file:///storage/emulated/0/.GSK_MT_ORANGE_IMAGES/15024SI_01022019_120426.jpg exposed beyond app through ClipData.Item.getUri()
//outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); //outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -706,7 +704,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_store_image); toolbar.setTitle(R.string.title_activity_store_image);
// Resuming the periodic location updates // Resuming the periodic location updates
@@ -72,7 +72,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class T2PComplianceActivity extends AppCompatActivity { public class T2PComplianceActivity extends AppCompatActivity {
private Context context;
String gallery_package = ""; String gallery_package = "";
Uri outputFileUri; Uri outputFileUri;
@@ -113,11 +113,11 @@ public class T2PComplianceActivity extends AppCompatActivity {
db = new GSKOrangeDB(T2PComplianceActivity.this); db = new GSKOrangeDB(T2PComplianceActivity.this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -231,7 +231,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (t2PGetterSetters.size() > 0) { if (t2PGetterSetters.size() > 0) {
rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_t2p.setLayoutManager(new LinearLayoutManager(context));
t2PAdapter = new T2PAdapter(t2PGetterSetters); t2PAdapter = new T2PAdapter(t2PGetterSetters);
rec_t2p.setAdapter(t2PAdapter); rec_t2p.setAdapter(t2PAdapter);
@@ -254,7 +254,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
@@ -334,11 +334,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
} }
}); });
//holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
/* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
*/
holder.spinner.setOnTouchListener(new View.OnTouchListener() { holder.spinner.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View view, MotionEvent motionEvent) { public boolean onTouch(View view, MotionEvent motionEvent) {
@@ -594,7 +589,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
_pathforcheck = "T2P_Image_" + store_id + categoryId + "_" + mItem.getBrand_id() + _pathforcheck = "T2P_Image_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = position; child_position = position;
path = str + _pathforcheck; path = str + _pathforcheck;
@@ -623,7 +618,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
_pathforcheck1 = "T2P_Image1_" + store_id + categoryId + "_" + mItem.getBrand_id() + _pathforcheck1 = "T2P_Image1_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position1 = position; child_position1 = position;
path = str + _pathforcheck1; path = str + _pathforcheck1;
@@ -652,7 +647,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
_pathforcheck2 = "T2P_Image2_" + store_id + categoryId + "_" + mItem.getBrand_id() + _pathforcheck2 = "T2P_Image2_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" + mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position2 = position; child_position2 = position;
path = str + _pathforcheck2; path = str + _pathforcheck2;
@@ -840,7 +835,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
dialog.setContentView(R.layout.gaps_dialog_layout); dialog.setContentView(R.layout.gaps_dialog_layout);
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1); //pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
RecyclerView rec_gap_checklist = (RecyclerView) dialog.findViewById(R.id.rec_gap_checklist); RecyclerView rec_gap_checklist = (RecyclerView) dialog.findViewById(R.id.rec_gap_checklist);
rec_gap_checklist.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_gap_checklist.setLayoutManager(new LinearLayoutManager(context));
GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist); GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist);
rec_gap_checklist.setAdapter(gapAdapter); rec_gap_checklist.setAdapter(gapAdapter);
@@ -898,7 +893,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (skuAddedList.size() > 0) { if (skuAddedList.size() > 0) {
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_sku.setLayoutManager(new LinearLayoutManager(context));
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList); SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
rec_sku.setAdapter(skuAdapter); rec_sku.setAdapter(skuAdapter);
@@ -924,7 +919,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
skuAddedList.add(sku); skuAddedList.add(sku);
rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext())); rec_sku.setLayoutManager(new LinearLayoutManager(context));
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList); SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
rec_sku.setAdapter(skuAdapter); rec_sku.setAdapter(skuAdapter);
@@ -1106,7 +1101,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
Log.i("Stock & Facing ", "startCameraActivity()"); Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(path); File file = new File(path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -47,6 +47,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
public class T2pBrand_Avaibility extends AppCompatActivity { public class T2pBrand_Avaibility extends AppCompatActivity {
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
private SharedPreferences preferences; private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow; String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
@@ -67,7 +68,7 @@ public class T2pBrand_Avaibility extends AppCompatActivity {
spinner_brand = (Spinner) findViewById(R.id.spinner); spinner_brand = (Spinner) findViewById(R.id.spinner);
add = (Button) findViewById(R.id.button2); add = (Button) findViewById(R.id.button2);
recyclerView = (RecyclerView) findViewById(R.id.layout_recycle); recyclerView = (RecyclerView) findViewById(R.id.layout_recycle);
context = this;
db = new GSKOrangeDB(T2pBrand_Avaibility.this); db = new GSKOrangeDB(T2pBrand_Avaibility.this);
db.open(); db.open();
@@ -75,7 +76,7 @@ public class T2pBrand_Avaibility extends AppCompatActivity {
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -84,7 +84,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers; import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class DownloadActivity extends AppCompatActivity { public class DownloadActivity extends AppCompatActivity {
private Context context;
Data data; Data data;
int eventType; int eventType;
GSKOrangeDB db; GSKOrangeDB db;
@@ -152,10 +152,10 @@ public class DownloadActivity extends AppCompatActivity {
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, ""); culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -2078,7 +2078,7 @@ public class DownloadActivity extends AppCompatActivity {
super.onResume(); super.onResume();
toolbar.setTitle(getString(R.string.main_menu_activity_name)); toolbar.setTitle(getString(R.string.main_menu_activity_name));
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
@@ -38,6 +38,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter; import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class CategoryListActivity extends AppCompatActivity { public class CategoryListActivity extends AppCompatActivity {
private Context context;
RecyclerView recyclerView; RecyclerView recyclerView;
TextView txt_categoryName; TextView txt_categoryName;
ArrayList<CategoryGetterSetter> categoryList; ArrayList<CategoryGetterSetter> categoryList;
@@ -53,8 +54,9 @@ public class CategoryListActivity extends AppCompatActivity {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -89,7 +91,7 @@ public class CategoryListActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>(); categoryList = new ArrayList<>();
@@ -351,7 +353,7 @@ public class CategoryListActivity extends AppCompatActivity {
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList); adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2)); recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
updateStatus(); updateStatus();
} }
@@ -38,6 +38,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
RecyclerView recyclerView,recyclerView_sos; RecyclerView recyclerView,recyclerView_sos;
LinearLayout lay_sos; LinearLayout lay_sos;
Toolbar toolbar; Toolbar toolbar;
private Context context;
String categoryName = "", categoryId; String categoryName = "", categoryId;
ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList; ArrayList<CategoryWisePerformaceGetterSetter> categoryWisePerformanceList;
ArrayList<STORE_CATEGORY_WISEGetterSetter> store_category_wiseGetterSetters; ArrayList<STORE_CATEGORY_WISEGetterSetter> store_category_wiseGetterSetters;
@@ -62,10 +63,10 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -108,7 +109,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
try { try {
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) { if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC); categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
} }
@@ -122,11 +123,11 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
} }
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList); adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); recyclerView.setLayoutManager(new LinearLayoutManager(context));
sos_adapter = new CategoryWiseSosPerformaceAdapter(CategoryWisePerformanceActivity.this, store_category_wiseGetterSetters); sos_adapter = new CategoryWiseSosPerformaceAdapter(CategoryWisePerformanceActivity.this, store_category_wiseGetterSetters);
recyclerView_sos.setAdapter(sos_adapter); recyclerView_sos.setAdapter(sos_adapter);
recyclerView_sos.setLayoutManager(new LinearLayoutManager(getApplicationContext())); recyclerView_sos.setLayoutManager(new LinearLayoutManager(context));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -55,6 +55,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
ArrayList<DailyDataMenuGetterSetter> categoryList; ArrayList<DailyDataMenuGetterSetter> categoryList;
DailyDataMenuAdapter adapter; DailyDataMenuAdapter adapter;
TextView txt_categoryName; TextView txt_categoryName;
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
String categoryName = "", categoryId; String categoryName = "", categoryId;
@@ -76,11 +77,11 @@ public class DailyDataMenuActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -121,7 +122,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
try { try {
categoryList = new ArrayList<>(); categoryList = new ArrayList<>();
@@ -428,7 +429,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList); adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2)); recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
} catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException e) {
e.printStackTrace(); e.printStackTrace();
@@ -48,7 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
public class MSL_AvailabilityActivity extends AppCompatActivity { public class MSL_AvailabilityActivity extends AppCompatActivity {
ExpandableListView expandableListView; ExpandableListView expandableListView;
TextView txt_mslAvailabilityName; TextView txt_mslAvailabilityName;
private Context context;
ArrayList<MSL_AvailabilityGetterSetter> headerDataList; ArrayList<MSL_AvailabilityGetterSetter> headerDataList;
ArrayList<MSL_AvailabilityGetterSetter> childDataList; ArrayList<MSL_AvailabilityGetterSetter> childDataList;
List<MSL_AvailabilityGetterSetter> hashMapListHeaderData; List<MSL_AvailabilityGetterSetter> hashMapListHeaderData;
@@ -75,11 +75,11 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGette
public class MSL_Availability_StockFacingActivity extends AppCompatActivity implements DialogCallbackListener { public class MSL_Availability_StockFacingActivity extends AppCompatActivity implements DialogCallbackListener {
ExpandableListView expandableListView; ExpandableListView expandableListView;
private Context context;
TextView txt_mslAvailabilityName; TextView txt_mslAvailabilityName;
ArrayList<MSL_AvailabilityStockFacingGetterSetter> headerDataList; ArrayList<MSL_AvailabilityStockFacingGetterSetter> headerDataList;
ArrayList<MSL_AvailabilityStockFacingGetterSetter> childDataList; ArrayList<MSL_AvailabilityStockFacingGetterSetter> childDataList;
@@ -122,11 +123,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null); store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
@@ -210,7 +211,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -233,7 +234,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -246,7 +247,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -428,7 +429,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
private void prepareList() { private void prepareList() {
@@ -61,6 +61,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SelectGetterSetter;
public class PromoComplianceActivity extends AppCompatActivity { public class PromoComplianceActivity extends AppCompatActivity {
LinearLayout lin_promo_sku, lin_addtional_promo; LinearLayout lin_promo_sku, lin_addtional_promo;
View view_promo_sku, view_additional_promo; View view_promo_sku, view_additional_promo;
private Context context;
Spinner sp_promo; Spinner sp_promo;
Spinner toggle_add_InStock, toggle_add_promoAnnouncer; Spinner toggle_add_InStock, toggle_add_promoAnnouncer;
ToggleButton toggle_add_runningPos; ToggleButton toggle_add_runningPos;
@@ -98,7 +99,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context = this;
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku); lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo); lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
view_promo_sku = findViewById(R.id.view_promo_sku); view_promo_sku = findViewById(R.id.view_promo_sku);
@@ -132,7 +133,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -183,7 +184,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
_pathforcheck = "AddPromo_Image_" + store_id + categoryId + "_" _pathforcheck = "AddPromo_Image_" + store_id + categoryId + "_"
+ visit_date.replace("/", "") + "_" + + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
path = str + _pathforcheck; path = str + _pathforcheck;
startCameraActivity(2); startCameraActivity(2);
@@ -333,7 +334,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
img_addPromotion.setBackgroundResource(R.mipmap.camera_grey); img_addPromotion.setBackgroundResource(R.mipmap.camera_grey);
Snackbar.make(v, getResources().getString(R.string.promo_add), Snackbar.LENGTH_LONG).setAction("Action", null).show(); Snackbar.make(v, getResources().getString(R.string.promo_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
//Toast.makeText(getApplicationContext(), "promo is add", Toast.LENGTH_LONG).show();
} }
}) })
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() { .setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
@@ -446,7 +447,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
private void prepareList() { private void prepareList() {
@@ -597,7 +598,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
_pathforcheck = "Promo_Image_" + store_id + categoryId + "_" + data.getSku_id() + _pathforcheck = "Promo_Image_" + store_id + categoryId + "_" + data.getSku_id() +
data.getPromo_id() + visit_date.replace("/", "") + "_" + data.getPromo_id() + visit_date.replace("/", "") + "_" +
CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
//child_position = position; //child_position = position;
child_position = finalI; child_position = finalI;
path = str + _pathforcheck; path = str + _pathforcheck;
@@ -985,7 +986,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
Log.i("Stock & Facing ", "startCameraActivity()"); Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(path); File file = new File(path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -61,6 +61,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
{ {
private Context context;
Button btn_addShelf, btn_addSKU; Button btn_addShelf, btn_addSKU;
ExpandableListView expandableListView; ExpandableListView expandableListView;
String brand, brand_id, company_id, sub_category, sub_category_id; String brand, brand_id, company_id, sub_category, sub_category_id;
@@ -100,9 +101,9 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -301,7 +302,7 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -876,6 +877,6 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
} }
@@ -81,6 +81,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.Store_wise_camera_DataGetterSetter;
import static android.R.attr.angle; import static android.R.attr.angle;
public class Stock_FacingActivity extends AppCompatActivity { public class Stock_FacingActivity extends AppCompatActivity {
private Context context;
static int child_position = -1; static int child_position = -1;
ExpandableListView expandableListView; ExpandableListView expandableListView;
TextView txt_stockFacingName; TextView txt_stockFacingName;
@@ -120,7 +121,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView); expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
//txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName); //txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
camera1 = (ImageView) findViewById(R.id.img_camera1); camera1 = (ImageView) findViewById(R.id.img_camera1);
@@ -136,7 +137,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -191,7 +192,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
} else { } else {
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData); db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show(); Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
} }
finish(); finish();
@@ -219,7 +219,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
} else { } else {
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData); db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show(); Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
//Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
} }
finish(); finish();
@@ -266,7 +265,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
@Override @Override
public void onScrollStateChanged(AbsListView arg0, int arg1) { public void onScrollStateChanged(AbsListView arg0, int arg1) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) { if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -289,7 +288,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override @Override
public void onGroupExpand(int groupPosition) { public void onGroupExpand(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -310,7 +309,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override @Override
public void onGroupCollapse(int groupPosition) { public void onGroupCollapse(int groupPosition) {
InputMethodManager inputManager = (InputMethodManager) getApplicationContext() InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE); .getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) { if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -731,7 +730,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try { try {
Log.e("MakeMachine", "startCameraActivity()"); Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path); File file = new File(path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -818,7 +817,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try { try {
Log.e("MakeMachine", "startCameraActivity()"); Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path); File file = new File(path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -902,7 +901,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try { try {
Log.e("MakeMachine", "startCameraActivity()"); Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path); File file = new File(path);
outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file); outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = ""; String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager(); final PackageManager packageManager = getPackageManager();
@@ -1298,7 +1297,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
public class ExpandableListAdapter extends BaseExpandableListAdapter { public class ExpandableListAdapter extends BaseExpandableListAdapter {
@@ -1380,7 +1379,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-'); //String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id() _pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id()
+ "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = groupPosition; child_position = groupPosition;
path = str + _pathforcheck; path = str + _pathforcheck;
@@ -1409,7 +1408,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-'); //String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id() _pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id()
+ "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg"; + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = groupPosition; child_position = groupPosition;
path = str + _pathforcheck; path = str + _pathforcheck;
@@ -40,6 +40,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StoreWisePerformaceGetterSetter;
public class StoreWisePerformanceActivity extends AppCompatActivity { public class StoreWisePerformanceActivity extends AppCompatActivity {
RecyclerView recyclerView; RecyclerView recyclerView;
Toolbar toolbar; Toolbar toolbar;
private Context context;
ArrayList<StoreWisePerformaceGetterSetter> storeWisePerformanceList; ArrayList<StoreWisePerformaceGetterSetter> storeWisePerformanceList;
StoreWisePerformaceAdapter adapter; StoreWisePerformaceAdapter adapter;
@@ -59,11 +60,11 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
//preference data //preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null); store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null); visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
@@ -133,7 +134,7 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
try { try {
CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) { if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
storeWisePerformanceList = db.getStoreWisePerformance(store_id, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC); storeWisePerformanceList = db.getStoreWisePerformance(store_id, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
@@ -146,7 +147,7 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList); adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); recyclerView.setLayoutManager(new LinearLayoutManager(context));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -90,7 +90,7 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class MPinActivity extends AppCompatActivity implements public class MPinActivity extends AppCompatActivity implements
View.OnClickListener, View.OnClickListener,
BlurLockView.OnPasswordInputListener, BlurLockView.OnPasswordInputListener,
BlurLockView.OnLeftButtonClickListener,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { BlurLockView.OnLeftButtonClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
BlurLockView blurLockView; BlurLockView blurLockView;
ImageView imageView1; ImageView imageView1;
@@ -101,13 +101,13 @@ public class MPinActivity extends AppCompatActivity implements
private SharedPreferences.Editor editor = null; private SharedPreferences.Editor editor = null;
private Dialog dialog; private Dialog dialog;
String userId, password, app_ver; String userId, password, app_ver;
int eventType; int eventType;
LoginGetterSetter lgs = null; LoginGetterSetter lgs = null;
FirebaseAnalytics mFirebaseAnalytics; FirebaseAnalytics mFirebaseAnalytics;
static int counter = 1; static int counter = 1;
// Trace myTrace; // Trace myTrace;
private int versionCode; private int versionCode;
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10; private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10;
@@ -141,9 +141,9 @@ public class MPinActivity extends AppCompatActivity implements
setSupportActionBar(toolbar);*/ setSupportActionBar(toolbar);*/
// Obtain the FirebaseAnalytics instance. // Obtain the FirebaseAnalytics instance.
// mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); // mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
// myTrace = FirebasePerformance.getInstance().newTrace("test_trace"); // myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
// myTrace.start(); // myTrace.start();
IS_PASSWORD_CHECK = getIntent().getBooleanExtra(CommonString.IS_PASSWORD_CHECK, false); IS_PASSWORD_CHECK = getIntent().getBooleanExtra(CommonString.IS_PASSWORD_CHECK, false);
@@ -182,7 +182,6 @@ public class MPinActivity extends AppCompatActivity implements
blurLockView.setIs_Password_Check_Mode(IS_PASSWORD_CHECK); blurLockView.setIs_Password_Check_Mode(IS_PASSWORD_CHECK);
blurLockView.setRightButton(getString(R.string.clear)); blurLockView.setRightButton(getString(R.string.clear));
blurLockView.setTypeface(getTypeface()); blurLockView.setTypeface(getTypeface());
blurLockView.setOnLeftButtonClickListener(this); blurLockView.setOnLeftButtonClickListener(this);
@@ -281,7 +280,8 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit(); editor.commit();
finish(); finish();
Intent in = new Intent(getApplicationContext(), LoginActivity.class);
Intent in = new Intent(context , LoginActivity.class);
startActivity(in); startActivity(in);
} }
@@ -352,7 +352,7 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit(); editor.commit();
finish(); finish();
Intent in = new Intent(getApplicationContext(), LoginActivity.class); Intent in = new Intent(context, LoginActivity.class);
startActivity(in); startActivity(in);
} }
@@ -366,14 +366,13 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit(); editor.commit();
Intent in = new Intent(getApplicationContext(), MainActivity.class); Intent in = new Intent(context, MainActivity.class);
//Intent in = new Intent(getApplicationContext(), OneQADActivity.class);
startActivity(in); startActivity(in);
finish(); finish();
} else { } else {
Toast.makeText(getApplicationContext(), "Please fill four digit MPin", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Please fill four digit MPin", Toast.LENGTH_SHORT).show();
} }
} }
@@ -589,12 +588,11 @@ public class MPinActivity extends AppCompatActivity implements
try { try {
versionCode = getPackageManager().getPackageInfo( versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
getPackageName(), 0).versionCode;
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]" String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
+ userId + "[/USER_ID]" + "[PASSWORD]" + password + userId + "[/USER_ID]" + "[PASSWORD]" + password
+ "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()) + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context)
+ "[/IN_TIME]" + "[LATITUDE]" + lat + "[/IN_TIME]" + "[LATITUDE]" + lat
+ "[/LATITUDE]" + "[LONGITUDE]" + lon + "[/LATITUDE]" + "[LONGITUDE]" + lon
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver + "[/LONGITUDE]" + "[APP_VERSION]" + app_ver
@@ -602,28 +600,19 @@ public class MPinActivity extends AppCompatActivity implements
+ "[NETWORK_STATUS]" + "LoginStatus" + "[NETWORK_STATUS]" + "LoginStatus"
+ "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]"; + "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]";
SoapObject request = new SoapObject(CommonString.NAMESPACE, SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_LOGIN);
CommonString.METHOD_LOGIN);
request.addProperty("onXML", userauth_xml); request.addProperty("onXML", userauth_xml);
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_LOGIN, envelope);
androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN,
envelope);
Object result = (Object) envelope.getResponse(); Object result = (Object) envelope.getResponse();
if (result.toString() if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
.equalsIgnoreCase(CommonString.KEY_FAILURE)) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -631,8 +620,7 @@ public class MPinActivity extends AppCompatActivity implements
} }
}); });
} else if (result.toString().equalsIgnoreCase( } else if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
CommonString.KEY_FALSE)) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -643,8 +631,7 @@ public class MPinActivity extends AppCompatActivity implements
} }
}); });
} else if (result.toString().equalsIgnoreCase( } else if (result.toString().equalsIgnoreCase(CommonString.KEY_CHANGED)) {
CommonString.KEY_CHANGED)) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@@ -657,19 +644,16 @@ public class MPinActivity extends AppCompatActivity implements
} else { } else {
XmlPullParserFactory factory = XmlPullParserFactory XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
.newInstance();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser(); XmlPullParser xpp = factory.newPullParser();
xpp.setInput(new StringReader(result.toString())); xpp.setInput(new StringReader(result.toString()));
xpp.next(); xpp.next();
eventType = xpp.getEventType(); eventType = xpp.getEventType();
final FailureGetterSetter failureGetterSetter = XMLHandlers final FailureGetterSetter failureGetterSetter = XMLHandlers.failureXMLHandler(xpp, eventType);
.failureXMLHandler(xpp, eventType);
if (failureGetterSetter.getStatus().equalsIgnoreCase( if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
CommonString.KEY_FAILURE)) {
/* final AlertMessage message = new AlertMessage( /* final AlertMessage message = new AlertMessage(
MPinActivity.this, CommonString.METHOD_LOGIN MPinActivity.this, CommonString.METHOD_LOGIN
+ failureGetterSetter.getErrorMsg(), + failureGetterSetter.getErrorMsg(),
@@ -679,8 +663,7 @@ public class MPinActivity extends AppCompatActivity implements
@Override @Override
public void run() { public void run() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
showAlert(CommonString.METHOD_LOGIN showAlert(CommonString.METHOD_LOGIN + failureGetterSetter.getErrorMsg());
+ failureGetterSetter.getErrorMsg());
} }
}); });
} else { } else {
@@ -703,15 +686,11 @@ public class MPinActivity extends AppCompatActivity implements
editor.putString(CommonString.KEY_USERNAME, userId); editor.putString(CommonString.KEY_USERNAME, userId);
editor.putString(CommonString.KEY_PASSWORD, password); editor.putString(CommonString.KEY_PASSWORD, password);
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION()); editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH()); editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE()); editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
//editor.putString(CommonString.KEY_DATE, "01/25/2019"); //editor.putString(CommonString.KEY_DATE, "01/25/2019");
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID()); editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
editor.commit(); editor.commit();
setDataFromSharedPreferences(lgs); setDataFromSharedPreferences(lgs);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@@ -719,9 +698,9 @@ public class MPinActivity extends AppCompatActivity implements
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data"); bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data");
bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, "")); bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
// mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); // mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
// Crashlytics.setUserIdentifier(userId); // Crashlytics.setUserIdentifier(userId);
return CommonString.KEY_SUCCESS; return CommonString.KEY_SUCCESS;
@@ -770,7 +749,7 @@ public class MPinActivity extends AppCompatActivity implements
"acra_login", e);*/ "acra_login", e);*/
//Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString()); //Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
//Crashlytics.logException(e.getCause()); //Crashlytics.logException(e.getCause());
// Crashlytics.logException(new Exception("My custom login Exception")); // Crashlytics.logException(new Exception("My custom login Exception"));
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
@@ -789,14 +768,14 @@ public class MPinActivity extends AppCompatActivity implements
super.onPostExecute(result); super.onPostExecute(result);
//Stop performance trace //Stop performance trace
// myTrace.stop(); // myTrace.stop();
if (result.equals(CommonString.KEY_SUCCESS)) { if (result.equals(CommonString.KEY_SUCCESS)) {
//set true for South Africa //set true for South Africa
boolean forSA = false; boolean forSA = false;
if(forSA){ if (forSA) {
//For SA Only //For SA Only
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equals("")) { if (preferences.getString(CommonString.KEY_LANGUAGE, "").equals("")) {
@@ -811,7 +790,7 @@ public class MPinActivity extends AppCompatActivity implements
setLanguageDataFromSharedPreferences(); setLanguageDataFromSharedPreferences();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
Intent intent = new Intent(getBaseContext(), Intent intent = new Intent(getBaseContext(),
MainActivity.class); MainActivity.class);
@@ -821,8 +800,7 @@ public class MPinActivity extends AppCompatActivity implements
//uploadPreviousImages(); //uploadPreviousImages();
} }
} } else {
else {
//for other than SA //for other than SA
//database.open(); //database.open();
if (preferences.getString(CommonString.KEY_VERSION, "").equals( if (preferences.getString(CommonString.KEY_VERSION, "").equals(
@@ -830,7 +808,7 @@ public class MPinActivity extends AppCompatActivity implements
setLanguageDataFromSharedPreferences(); setLanguageDataFromSharedPreferences();
Intent in = new Intent(getApplicationContext(), MainActivity.class); Intent in = new Intent(context, MainActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false); in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in); startActivity(in);
finish(); finish();
@@ -858,13 +836,14 @@ public class MPinActivity extends AppCompatActivity implements
LoginGetterSetter login_data; LoginGetterSetter login_data;
private void setLanguageDataFromSharedPreferences(){ private void setLanguageDataFromSharedPreferences() {
Gson gson = new Gson(); Gson gson = new Gson();
login_data = new LoginGetterSetter(); login_data = new LoginGetterSetter();
String jsonPreferences = preferences.getString(CommonString.KEY_LOOGIN_PREF, ""); String jsonPreferences = preferences.getString(CommonString.KEY_LOOGIN_PREF, "");
Type type = new TypeToken<LoginGetterSetter>() {}.getType(); Type type = new TypeToken<LoginGetterSetter>() {
}.getType();
login_data = gson.fromJson(jsonPreferences, type); login_data = gson.fromJson(jsonPreferences, type);
language = login_data.getCULTURE_NAME(); language = login_data.getCULTURE_NAME();
@@ -873,9 +852,9 @@ public class MPinActivity extends AppCompatActivity implements
String lang = preferences.getString(CommonString.KEY_LANGUAGE, ""); String lang = preferences.getString(CommonString.KEY_LANGUAGE, "");
if(language.size()>0){ if (language.size() > 0) {
for(int i=0; i<language.size();i++){ for (int i = 0; i < language.size(); i++) {
if(lang.equals(language.get(i))){ if (lang.equals(language.get(i))) {
editor.putString(CommonString.KEY_LANGUAGE, language.get(i)); editor.putString(CommonString.KEY_LANGUAGE, language.get(i));
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(i)); editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(i));
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url.get(i)); editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url.get(i));
@@ -934,13 +913,11 @@ public class MPinActivity extends AppCompatActivity implements
Gson gson = new Gson(); Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs); String jsonCurProduct = gson.toJson(lgs);
//SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct); editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit(); editor.commit();
} }
//permission and location related //permission and location related
void checkAppPermission(String permission, int requestCode) { void checkAppPermission(String permission, int requestCode) {
@@ -989,9 +966,9 @@ public class MPinActivity extends AppCompatActivity implements
file_planogram.mkdir(); file_planogram.mkdir();
} }
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(), if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(), ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return; return;
} }
@@ -1059,9 +1036,9 @@ public class MPinActivity extends AppCompatActivity implements
*/ */
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(), if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(getApplicationContext(), ContextCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return; return;
} }
@@ -1092,7 +1069,7 @@ public class MPinActivity extends AppCompatActivity implements
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG) , Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
@@ -1144,7 +1121,6 @@ public class MPinActivity extends AppCompatActivity implements
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (mGoogleApiClient != null) { if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
// Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
} }
} }
@@ -1181,7 +1157,6 @@ public class MPinActivity extends AppCompatActivity implements
if (mLastLocation != null) { if (mLastLocation != null) {
lat = mLastLocation.getLatitude(); lat = mLastLocation.getLatitude();
lon = mLastLocation.getLongitude(); lon = mLastLocation.getLongitude();
// Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
} }
startLocationUpdates(); startLocationUpdates();
} }
@@ -1,6 +1,7 @@
package cpm.com.gskmtorange.storeinmap; package cpm.com.gskmtorange.storeinmap;
import android.Manifest; import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
@@ -57,7 +58,7 @@ import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString; import cpm.com.gskmtorange.constant.CommonString;
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
private Context context;
private GoogleMap mMap; private GoogleMap mMap;
StoreBean store; StoreBean store;
LatLng origin, destination; LatLng origin, destination;
@@ -78,6 +79,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store_route); setContentView(R.layout.activity_store_route);
fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel); fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);
context = this;
fab_cancel.setOnClickListener(new View.OnClickListener() { fab_cancel.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@@ -114,7 +116,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
GooglePlayServicesUtil.getErrorDialog(resultCode, this, GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show(); PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else { } else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted) Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG) , Toast.LENGTH_LONG)
.show(); .show();
finish(); finish();
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler; import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class PreviousDataUploadActivity extends AppCompatActivity { public class PreviousDataUploadActivity extends AppCompatActivity {
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
ArrayList<CoverageBean> coverageList; ArrayList<CoverageBean> coverageList;
@@ -118,7 +119,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
@@ -126,7 +127,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
db = new GSKOrangeDB(this); db = new GSKOrangeDB(this);
db.open(); db.open();
context = this;
Path = CommonString.FILE_PATH; Path = CommonString.FILE_PATH;
//start upload //start upload
@@ -2174,7 +2175,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
} }
@@ -87,7 +87,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
import retrofit.Retrofit; import retrofit.Retrofit;
public class UploadActivity extends AppCompatActivity { public class UploadActivity extends AppCompatActivity {
private Context context;
GSKOrangeDB db; GSKOrangeDB db;
ArrayList<CoverageBean> coverageList; ArrayList<CoverageBean> coverageList;
String date, userId, app_version; String date, userId, app_version;
@@ -136,12 +136,12 @@ public class UploadActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
context = this;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
preferences = PreferenceManager.getDefaultSharedPreferences(this); preferences = PreferenceManager.getDefaultSharedPreferences(this);
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null); date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null); userId = preferences.getString(CommonString.KEY_USERNAME, null);
@@ -1871,7 +1871,7 @@ public class UploadActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, "")); CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_upload)); toolbar.setTitle(getString(R.string.title_activity_upload));
} }
@@ -334,6 +334,7 @@ public class UploadImageWithRetrofit {
return file2; return file2;
} }
/* /*
public File saveBitmapToFileSmaller(File file) { public File saveBitmapToFileSmaller(File file) {
File file2 = file; File file2 = file;
@@ -383,6 +384,7 @@ public class UploadImageWithRetrofit {
*/ */
public void showAlert(final Context context, String str, final boolean flag) { public void showAlert(final Context context, String str, final boolean flag) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
+9 -7
View File
@@ -1,20 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
maven {
url "https://jitpack.io"
}
} }
dependencies { dependencies {
// classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.gms:google-services:4.3.4'
// Add dependency
// classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
// classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
} }
} }
@@ -23,7 +25,7 @@ allprojects {
google() google()
jcenter() jcenter()
maven { maven {
url 'https://maven.google.com/' url "https://jitpack.io"
} }
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
#Thu Dec 03 19:56:06 IST 2020 #Tue Mar 23 15:41:02 IST 2021
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+3 -3
View File
@@ -24,11 +24,11 @@ ext {
} }
android { android {
compileSdkVersion 28 compileSdkVersion 30
buildToolsVersion '28.0.3' buildToolsVersion '28.0.3'
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 20
targetSdkVersion 26 targetSdkVersion 29
versionCode 1 versionCode 1
versionName '1.0' versionName '1.0'
} }
@@ -1,12 +0,0 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.androidbuts.multispinnerfilter;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String LIBRARY_PACKAGE_NAME = "com.androidbuts.multispinnerfilter";
public static final String BUILD_TYPE = "debug";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}